1import{u as _n,r as i,q as Wr,t as zr,j as t,L as Gr,P as Ie,v as Vt,x as Kr,y as Yr,c as Hr,d as Vr,a as Qr,z as Zr,E as Xr,A as Jr,B as ei,C as ti,D as ni,F as ai,G as si,H as oi,J as ri,K as ii,N as li,O as ci,Q as di,R as mi,S as ui,T as hi,U as ho,V as pi,W as fi,X as Ln,Y as gi,Z as yi,_ as ki,$ as bi,a0 as Ni,p as vi,a1 as xi,a2 as wi,a3 as po,a4 as ji,a5 as Ii,a6 as fo,m as Ci,a7 as Kt,a8 as go,a9 as Si,aa as Li,ab as Ei,ac as Ti,ad as Xt,ae as V,af as En,ag as yo,ah as $e,ai as Yt,aj as Tn,ak as Mn,al as ko,am as Mi,an as Pn,ao as Pi,ap as Ai,aq as Ri,ar as bo,as as $o,at as Fi,au as Ui,av as _i,aw as Bi,ax as Di,ay as No,az as Oi,aA as $i,aB as qi,aC as Wi,aD as zi,aE as Gi,aF as Ki}from"./index-BVpny5eT.js";import{r as Yi,u as Hi,s as Vi}from"./linkedin-csv-upload-flow-Cqxx0yVp.js";import{d as vo,S as Qi,I as Zi,D as Xi,a as Ji,b as el,c as qe}from"./InviteContactModal-1V0C4a3t.js";import{S as tl,M as nl}from"./MuteContactModal-sr0lHFQA.js";import{i as al,A as sl}from"./AddConnectorModal-DRvcVMqr.js";import{I as ol}from"./InviteTeammatesModal-Bv8w6UpC.js";import{i as rl,k as xo,b as il,c as ll,a as cl,r as wo,f as dl,d as ml,e as ul}from"./home-checkin-people-DWmgmAZd.js";import{u as hl}from"./use-resolved-title-company-D550X39m.js";import{C as pl}from"./chevron-right-boUotD-7.js";import"./index-CryiGmSX.js";import"./Combination-Dr9KM_H-.js";import"./index-u7baw35J.js";function fl(r){const c=new Date(r);if(Number.isNaN(c.getTime()))return r;const d=Date.now()-c.getTime(),p=24*60*60*1e3,y=Math.floor(d/p);return y<=0?"today":y===1?"yesterday":y<7?`${y} days ago`:y<30?`${Math.floor(y/7)} weeks ago`:`${c.getMonth()+1}/${c.getDate()}/${c.getFullYear()}`}function gl({inviteByEmailOpen:r,inviteByEmailValue:c,onInviteByEmailOpen:h,onInviteByEmailChange:d,onInviteByEmailCancel:p,onInviteByEmailSubmit:y,invitedList:b,invitedLoading:v,invitedError:T,onAddConnector:_,onInviteTeammate:z}){const{user:B}=_n(),I=(B==null?void 0:B.accessToken)||"",q=i.useRef(null),E=i.useRef(null),[H,M]=i.useState(!1),[C,G]=i.useState(null),[le,te]=i.useState([]),[Z,ce]=i.useState(!1),[se,Ae]=i.useState(0),[ne,be]=i.useState(0);i.useEffect(()=>{if(!I)return;let N=!1;return(async()=>{try{const J=await Wr(I,{limit:1,offset:0});N||Ae(J.total||J.contacts.length)}catch{}})(),()=>{N=!0}},[I,ne]);const Ce=i.useCallback(()=>{var N;(N=E.current)==null||N.call(E),E.current=null,ce(!1),be(J=>J+1)},[]);i.useEffect(()=>()=>{var N;(N=E.current)==null||N.call(E)},[]),i.useEffect(()=>{if(!Z)return;const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=N}},[Z]);const S=i.useCallback(async N=>{var J;if(!I){G({kind:"err",text:"Please sign in again to upload."});return}M(!0),G(null),(J=E.current)==null||J.call(E),E.current=null;try{const{csv:me,parsed:Ne}=await Yi(N);await Hi(I,N.name,me,se),te(Ne),ce(!0),be(Ge=>Ge+1),E.current=Vi(I,Ne,te)}catch(me){G({kind:"err",text:me instanceof Error?me.message:"Upload failed"})}finally{M(!1)}},[I,se]),de=Z&&typeof document<"u"?zr.createPortal(t.jsxs("div",{className:"em-conn-flow-portal",role:"dialog","aria-modal":"true",children:[t.jsx("button",{type:"button",className:"em-conn-flow-close",onClick:Ce,"aria-label":"Close",children:"Ã"}),t.jsx(Gr,{active:Z,token:I,csvContacts:le,onBack:Ce,onFinish:Ce})]}),document.body):null;return t.jsxs("div",{className:"page-expand-map network-add-people-panel",children:[de,t.jsx("input",{ref:q,type:"file",accept:".csv,text/csv,application/vnd.ms-excel",style:{display:"none"},onChange:N=>{var me;const J=(me=N.target.files)==null?void 0:me[0];J&&S(J),N.target&&(N.target.value="")}}),I?t.jsxs("div",{className:"em-actions",children:[z?t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Add teammate"}),t.jsx("div",{className:"em-action-desc",children:"A colleague inside your workspace. You each see who the other knows."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:z,children:"Add teammate"})]}):null,_?t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Add connector"}),t.jsx("div",{className:"em-action-desc",children:"Someone outside the team who makes intros for you. Their network stays theirs."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:_,children:"Add connector"})]}):null,t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Upload CSV"}),t.jsx("div",{className:"em-action-desc",children:"Your LinkedIn connections in bulk â Connections.csv, from Settings â Data privacy."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",disabled:H||!I,onClick:()=>{var N;return(N=q.current)==null?void 0:N.click()},children:H?"Uploadingâ¦":"Upload CSV"})]}),r?null:t.jsxs("div",{className:"em-action-row",children:[t.jsxs("div",{className:"em-action-copy",children:[t.jsx("div",{className:"em-action-name",children:"Invite by email"}),t.jsx("div",{className:"em-action-desc",children:"Invite someone to Gem. When they accept, their network joins your paths."})]}),t.jsx("button",{type:"button",className:"em-csv-upload-btn",onClick:h,children:"Invite by email"})]})]}):null,r?t.jsxs("form",{className:"network-invite-email-form",onSubmit:N=>{N.preventDefault(),y()},children:[t.jsx("input",{type:"email",autoFocus:!0,className:"network-invite-email-input",placeholder:"[email protected]",value:c,onChange:N=>d(N.target.value),onKeyDown:N=>
1{N.key==="Escape"&&p()}}),t.jsx("button",{type:"submit",className:"network-side-action network-side-action--primary",disabled:!c.trim(),children:"Preview invite"}),t.jsx("button",{type:"button",className:"network-side-action",onClick:p,children:"Cancel"})]}):null,C&&C.kind==="err"?t.jsx("div",{className:"em-csv-msg err",role:"status",children:C.text}):null,b.length>0||v||T?t.jsxs("div",{className:"em-invited-section",children:[t.jsxs("div",{className:"em-invited-head",children:[t.jsx("div",{className:"em-section-kicker",children:"Outreach"}),t.jsx("div",{className:"em-section-title",children:"Invited"})]}),v?t.jsx(Ie,{variant:"section",message:"Loading invited listâ¦"}):T?t.jsxs("div",{className:"em-empty",children:["Couldn't load invites: ",T]}):t.jsx("div",{className:"network-side-list",children:b.map(N=>t.jsxs("div",{className:"network-side-row",children:[t.jsx("div",{className:"network-side-row-avatar",children:N.email.slice(0,1).toUpperCase()}),t.jsxs("div",{className:"network-side-row-main",children:[t.jsx("div",{className:"network-side-row-name",children:N.email}),N.createdOn?t.jsxs("div",{className:"network-side-row-meta",children:["Invited ",fl(N.createdOn)]}):null]}),N.isSignUp?t.jsx("span",{className:"network-side-status network-side-status--joined",children:"Joined"}):t.jsx("span",{className:"network-side-status",children:"Pending"})]},N.email+(N.createdOn||"")))})]}):null]})}function yl({open:r,contact:c,onClose:h,onSaved:d}){const{user:p}=_n(),y=p==null?void 0:p.accessToken,[b,v]=i.useState(""),[T,_]=i.useState(""),[z,B]=i.useState(""),[I,q]=i.useState(""),[E,H]=i.useState(""),[M,C]=i.useState(""),[G,le]=i.useState(""),[te,Z]=i.useState(""),[ce,se]=i.useState(!1),[Ae,ne]=i.useState(null);i.useEffect(()=>{!r||!c||(v(Vt(c.fullName||"",c.email)),_((c.email||"").trim()),B((c.phoneNumber||"").trim()),q((c.title||"").trim()),H((c.companyName||"").trim()),C((c.linkedinUrl||"").trim()),le((c.location||"").trim()),Z((c.companyWebsite||"").trim()),se(!1),ne(null))},[r,c]);const be=()=>{ce||h()},Ce=async()=>{if(!y||!(c!=null&&c.id)){ne("Please sign in again.");return}const S=b.trim();if(!S){ne("Name is required.");return}se(!0),ne(null);try{const de={fullName:S,email:T.trim()||null,phoneNumber:z.trim()||null,title:I.trim()||null,companyName:E.trim()||null,linkedinUrl:M.trim()||null,location:G.trim()||null,companyWebsite:te.trim()||null},N=await Kr(y,c.id,de);d==null||d({id:c.id,fullName:N.fullName,email:N.email,phoneNumber:N.phoneNumber,title:N.title,companyName:N.companyName,linkedinUrl:N.linkedinUrl,location:N.location,companyWebsite:N.companyWebsite}),h()}catch(de){ne(de instanceof Error?de.message:"Failed to update contact")}finally{se(!1)}};return!r||!c?null:t.jsx("div",{className:"modal-overlay open",onClick:be,children:t.jsxs("div",{className:"modal",onClick:S=>S.stopPropagation(),style:{maxWidth:480},children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsx("div",{className:"mod-title",children:"Edit profile"}),t.jsx("div",{className:"mod-sub",children:"Update this connection's details in your network."})]}),t.jsx("button",{className:"mod-close",onClick:be,disabled:ce,children:"Ã"})]}),t.jsxs("div",{className:"modal-body",children:[t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Name"}),t.jsx("input",{className:"fld-input",type:"text",value:b,onChange:S=>v(S.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Email"}),t.jsx("input",{className:"fld-input",type:"email",value:T,onChange:S=>_(S.target.value),placeholder:"[email protected]"})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Phone"}),t.jsx("input",{className:"fld-input",type:"tel",value:z,onChange:S=>B(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Title"}),t.jsx("input",{className:"fld-input",type:"text",value:I,onChange:S=>q(S.target.value),placeholder:"Partner, CEO, etc."})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Company"}),t.jsx("input",{className:"fld-input",type:"text",value:E,onChange:S=>H(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"LinkedIn URL"}),t.jsx("input",{className:"fld-input",type:"url",value:M,onChange:S=>C(S.target.value),placeholder:"https://linkedin.com/in/..."})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Location"}),t.jsx("input",{className:"fld-input",type:"text",value:G,onChange:S=>le(S.target.value)})]}),t.jsxs("div",{className:"fld-row",children:[t.jsx("label",{className:"fld-lbl",children:"Company website"}),t.jsx("input",{className:"fld-input",type:"url",value:te,onChange:S=>Z(S.target.value),placeholder:"https://..."})]}),Ae&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:Ae})]}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"btn-foot",onClick:be,disabled:ce,children:"Cancel"}),t.jsx("button",{className:"btn-foot primary",onClick:Ce,disabled:ce,children:ce?"Savingâ¦":"Save changes"})]})]})})}const kl=4,bl=!1,jo=100,Nl=100,vl=300,Io=["purple","green","amber","blue","red","teal"];function Co(r){return Io[Math.abs(r)%Io.length]}function ye(r){const c=(r||"").replace(/\s+/g," ").trim().split(" ").filter(
1Boolean);return c.length>=2?(c[0][0]+c[c.length-1][0]).toUpperCase():(r||"?").slice(0,2).toUpperCase()||"?"}function We(r){return(r||"").trim().split(/\s+/)[0]||r||"there"}const xl=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i;function wl(r,c){const h=(r||"").trim();if(!h||xl.test(h))return!0;const d=(c||"").trim().toLowerCase();return!!(d&&h.toLowerCase()===d)}function pt(r,c){const h=(r||"").trim();return!h||wl(h,c)?"":h}function jl(r,c){const h=pt(r,c);return h?h.split(/\s+/).filter(p=>/[a-zA-Z]/.test(p)).length>=2:!1}function Pe(r,c){return Xt(r,c)}function Qt(r){return r?zi({meetings12mo:r.meetingCount||0,emailsSent90d:r.sentCount||0,emailsReceived90d:r.receivedCount||0,lastMeetingAt:r.lastMeetingAt,lastEmailAt:r.lastSentAt&&r.lastReceivedAt?r.lastSentAt>r.lastReceivedAt?r.lastSentAt:r.lastReceivedAt:r.lastSentAt||r.lastReceivedAt}):null}const So={very_strong:"vs",strong:"s",solid:"so",light:"l"},Ht={very_strong:"Very strong",strong:"Strong",solid:"Solid",light:"Light"};function Il(r){const c=Qt(r);return!c||c.hidden||!c.tier?null:c.tier}function Lo(r,c){const h=(r.email||"").trim().toLowerCase(),d=h?c[h]:null;return Qt(d)}function Zt(r,c,h=!1){return Ri(r,h||Gi(c))}function Eo(r,c){if(r==="connector")return 0;const h=Zt(c,r);return h?h==="very_strong"||h==="strong"?0:h==="light"?1:h==="solid"?2:3:3}function To(r,c){return jl(r,c)?0:pt(r,c)?1:2}function Bn(r,c,h={}){const d=r.email?h[r.email.trim().toLowerCase()]:null,p=c.email?h[c.email.trim().toLowerCase()]:null,y=Qt(d),b=Qt(p),v=y&&!y.hidden?y.tier:null,T=b&&!b.hidden?b.tier:null,_=Eo(r.strengthLabel??null,v),z=Eo(c.strengthLabel??null,T);if(_!==z)return _-z;const B=Zt(v,r.strengthLabel??null),I=Zt(T,c.strengthLabel??null);if(B&&I&&B!==I)return bo[I]-bo[B];const q=y&&!y.hidden?y.score:0,E=b&&!b.hidden?b.score:0;if(q!==E)return E-q;const H=(y==null?void 0:y.lastTouchMs)??0,M=(b==null?void 0:b.lastTouchMs)??0;if(H!==M)return M-H;const C=To(r.rawName,r.email),G=To(c.rawName,c.email);return C!==G?C-G:Pe(r.rawName,r.email).toLowerCase().localeCompare(Pe(c.rawName,c.email).toLowerCase())}function Cl(r,c,h={}){return Bn(r,c,h)}function Mo(r,c,h={}){return Bn({rawName:r.rawName??r.name,email:r.email,strengthLabel:r.strengthLabel},{rawName:c.rawName??c.name,email:c.email,strengthLabel:c.strengthLabel},h)}const Po="network-tier-group-other",Sl=["very_strong","strong","solid","light","other"];function Ll(r,c){const h=new Map;for(const d of r){const p=c(d)??"other",y=h.get(p);y?y.push(d):h.set(p,[d])}return Sl.filter(d=>{var p;return(((p=h.get(d))==null?void 0:p.length)??0)>0}).map(d=>({tier:d,label:d==="other"?"Other":$o(d),rows:h.get(d)}))}const An="__no_company__";function El(r){const c=new Map;for(const d of r){const p=(d.companyName||"").trim(),y=p?p.toLowerCase():An,b=p||"No company listed",v=c.get(y);v?v.rows.push(d):c.set(y,{label:b,rows:[d]})}const h=Array.from(c.entries()).map(([d,{label:p,rows:y}])=>({tier:d,label:p,rows:y}));return h.sort((d,p)=>d.tier===An?1:p.tier===An?-1:p.rows.length!==d.rows.length?p.rows.length-d.rows.length:d.label.localeCompare(p.label)),h}function Ao(r){if(!r)return"";const c=new Date(r);if(!Number.isFinite(c.getTime()))return"";const h=c.getUTCFullYear()===new Date().getUTCFullYear();return c.toLocaleDateString(void 0,h?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"})}function Tl(r){return`${r.toLocaleString()} meeting${r===1?"":"s"}`}function Rn(r){if(!r)return"";const c=Date.now()-new Date(r).getTime();if(!Number.isFinite(c))return"";if(c<0){const b=Math.abs(c),v=Math.round(b/864e5);return v<1?"soon":v<7?`in ${v}d`:v<30?`in ${Math.round(v/7)}w`:v<365?`in ${Math.round(v/30)}mo`:`in ${Math.round(v/365)}y`}const h=Math.floor(c/1e3);if(h<60)return"just now";const d=Math.floor(h/60);if(d<60)return`${d}m ago`;const p=Math.floor(d/60);if(p<24)return`${p}h ago`;const y=Math.floor(p/24);return y===0?"today":y<7?`${y}d ago`:y<30?`${Math.floor(y/7)}w ago`:y<365?`${Math.floor(y/30)}mo ago`:`${Math.floor(y/365)}y ago`}function W(r){return r===1?"Founder":r===2?"Investor":r===3?"Scout":""}function Ro(r,c){return c?r.name.toLowerCase().includes(c)||(r.rawName||"").toLowerCase().includes(c)||(r.role||"").toLowerCase().includes(c)||(r.email||"").toLowerCase().includes(c):!0}function qo(r){const c=r.user,h=(c!=null&&c.user&&typeof c.user=="object"?c.user:void 0)||(c&&typeof c=="object"&&"id"in c?c:void 0),d=(h==null?void 0:h.id)??0;if(!d)return null;const p=h==null?void 0:h.email,y=((h==null?void 0:h.fullname)||"").trim(),b=pt(y,p)||Pe(y,p)||`User ${d}`,v=(c==null?void 0:c.founder)??null,T=(c==null?void 0:c.investor)??null;let _="",z=null,B=null;v&&(v.title||v.companyName)?(z=v.title||null,B=v.companyName||null,_=[v.title,v.companyName].filter(
1Boolean).join(" · ")):T&&(T.title||T.fundName)?(z=T.title||null,B=T.fundName||null,_=[T.title,T.fundName].filter(Boolean).join(" · ")):h!=null&&h.title&&(z=h.title,_=h.title);const I=r.role??(h==null?void 0:h.role)??0;return{connectionID:r.connectionID??0,userId:d,name:b,rawName:y||b,role:_||W(I),email:p,photo:(h==null?void 0:h.profilePhoto)??null,roleKind:I,title:z,companyName:B}}const Fo=[{value:"double",label:"Double",note:"Both sides say yes before anyone is connected."},{value:"single",label:"Single",note:"Only one side is asked â you vouch for the other."},{value:"disabled",label:"Off",note:"No approvals: we connect them right away."}];function Ml({mode:r,onChange:c,disabled:h}){const d=Fo.find(p=>p.value===r);return t.jsxs("div",{className:"intro-optin-bar",children:[t.jsx("span",{className:"intro-optin-bar-lbl",children:"Opt-in"}),t.jsx("div",{className:"intro-optin-seg",role:"radiogroup","aria-label":"Opt-in mode",children:Fo.map(p=>t.jsx("button",{type:"button",role:"radio","aria-checked":r===p.value,title:p.note,className:`intro-optin-seg-btn${r===p.value?" active":""}`,disabled:h,onClick:()=>c(p.value),children:p.label},p.value))}),t.jsx("span",{className:"intro-optin-bar-note",children:d==null?void 0:d.note})]})}function ze({name:r,photo:c,label:h,tone:d,userId:p,title:y,company:b}){const v=hl(p,y,b),T=r.trim().toLowerCase()===h.trim().toLowerCase();return t.jsxs("div",{className:"intro-pick-node",children:[t.jsx("span",{className:`intro-pick-av intro-pick-av--${d}`,children:c?t.jsx("img",{src:c,alt:""}):ye(r)}),t.jsx("span",{className:"intro-pick-node-lbl",children:h}),T?null:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"intro-pick-node-name",title:r,children:r}),v.title?t.jsx("span",{className:"intro-pick-node-meta",title:v.title,children:v.title}):null,v.company?t.jsx("span",{className:"intro-pick-node-meta",title:v.company,children:v.company}):null]})]})}const Fn=[{id:"raise",label:"ð° Series A raise",custom:!1},{id:"hire",label:"ð¥ Hiring",custom:!1},{id:"partner",label:"ð¤ Partnerships",custom:!1}];function ht(r){if(r.sourceKind==="connector"&&r.userId<0)return{key:`connector-${Math.abs(r.userId)}`,userId:0,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email??null,photo:r.photo,roleKind:r.roleKind,kind:"contact",isGem:!1,strengthLabel:r.strengthLabel??null};if(r.userId<0){const c=Math.abs(r.userId);return{key:`contact-${c}`,userId:0,contactId:c,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email??null,photo:r.photo,roleKind:r.roleKind,kind:"contact",isGem:!1,strengthLabel:r.strengthLabel??null}}return{key:`u-${r.userId}`,userId:r.userId,name:r.name,rawName:r.rawName??r.name,role:r.role,title:r.title??null,companyName:r.companyName??null,email:r.email,photo:r.photo,roleKind:r.roleKind,kind:"gem",isGem:!0,strengthLabel:r.strengthLabel??null}}function Wo(r){const c=qo(r);return c?{key:`u-${c.userId}`,userId:c.userId,name:Xt(c.rawName??c.name,c.email),rawName:c.rawName??c.name,role:c.role,title:c.title??null,companyName:c.companyName??null,email:c.email,photo:c.photo,roleKind:c.roleKind,kind:"gem",isGem:!0,strengthLabel:c.strengthLabel??null}:null}function Un(r,c){const h=r,d=Number(h.id||0);if(!d)return null;const p=String(h.fullName||h.displayName||h.name||"").trim(),y=h.email||null,b=h.phoneNumber||h.phone_number||null,v=h.profilePhotoUrl||h.profilePhoto||h.profile_photo_url||null,T=h.linkedinUrl||h.linkedin_url||null,_=h.connectedUserId??h.connected_user_id??null,z=Number(_||0)||null,B=h.title||null,I=h.location||null,q=h.companyName||h.company||null,E=h.companyWebsite||h.company_website||null,H=h.apolloEnrichedAt||h.apollo_enriched_at||null,M=h.strengthLabel||h.strength_label||null,C=M==="strong_connection"||M==="connector"?M:null,G=h.geminiSummary||h.gemini_summary||null;let le=null;const te=h.source||null;return{id:d,fullName:p,source:te&&String(te).trim()?String(te).trim():null,email:y&&String(y).trim()?String(y).trim():null,phoneNumber:b&&String(b).trim()?String(b).trim():null,profilePhotoUrl:v&&String(v).trim()?String(v).trim():null,linkedinUrl:T&&String(T).trim()?String(T).trim():null,connectedUserId:z,title:B&&String(B).trim()?String(B).trim():null,location:I&&String(I).trim()?String(I).trim():null,companyName:q&&String(q).trim()?String(q).trim():null,companyWebsite:E&&String(E).trim()?String(E).trim():null,apolloEnrichedAt:H&&String(H).trim()?String(H).trim():null,
1strengthLabel:C,geminiSummary:G&&String(G).trim()?String(G).trim():null,geminiProfile:le}}function Uo(r){return/already signed up|already invited|already exists?/i.test(r)?"Invitation already exists":r||"Failed to send invite"}function Pl(r){return/invitation already exists|already signed up|already invited|already exists?/i.test(r)}async function Al(r){try{const c=await r.json();if(typeof(c==null?void 0:c.message)=="string")return Uo(c.message);if(typeof(c==null?void 0:c.error)=="string")return Uo(c.error)}catch{}return`Failed to send invite (${r.status})`}async function Rl(r,c,h={}){const d=(h.note||"").trim(),p={email:c,...h.name?{name:h.name}:{},...h.resend?{resend:!0}:{},...d?{note:d}:{}},y=await Fi(p,r);if(!y.ok)throw new Error(await Al(y));const b=await y.json().catch(()=>null),v=typeof(b==null?void 0:b.message)=="string"?b.message:"";if(!h.resend&&/already sent|already invited|already had an invite|already exists?/i.test(v))throw new Error("Invitation already exists")}function _o(r,c){if(r==null)return null;const h=String(r).trim();if(!h||h==="-1,-1,-1"||h==="-1")return null;if(!h.includes("-1")&&!/^\d/.test(h))return h;const d=h.split(",").map(p=>p.trim()).filter(p=>p&&p!=="-1"&&p!=="0").map(p=>c[p]).filter(p=>!!p);return d.length>0?d.join(", "):null}function zo(r){const c=Number((r==null?void 0:r.contactId)||0);if(!c)return null;const h=Number((r==null?void 0:r.connectedUserId)||0),d=[r==null?void 0:r.title,r==null?void 0:r.company].filter(Boolean).join(" · "),p=(r==null?void 0:r.strengthLabel)==="strong_connection"||(r==null?void 0:r.strengthLabel)==="connector"?r.strengthLabel:null,y=((r==null?void 0:r.displayName)||"").trim();return{key:`c-${c}`,userId:h>0?h:0,contactId:c,name:Xt(y,(r==null?void 0:r.email)||null),rawName:y,role:d||"",title:(r==null?void 0:r.title)??null,companyName:(r==null?void 0:r.company)??null,email:(r==null?void 0:r.email)||null,photo:null,roleKind:0,kind:"contact",isGem:h>0,strengthLabel:p}}function Bo(r,c,h){const p=Ui(r).map(Wo).filter(b=>!!b&&b.userId!==c&&b.userId!==h),y=_i(r).map(b=>zo(b)).filter(b=>!(!b||b.userId>0&&(b.userId===c||b.userId===h)));return[...p,...y]}function Fl(r,c,h){const d=r.trim();return{key:`adhoc-${h}`,userId:0,name:d||"Added contact",rawName:d,role:"Added by email",email:c.trim(),photo:null,roleKind:0,kind:"contact",isGem:!1}}function Do(r,c,h){const d=((h==null?void 0:h.email)||c.email||"").trim().toLowerCase(),p=c.userId>0?c.userId:Number((h==null?void 0:h.connectedUserId)||0);for(const y of r)if(!(y.status==="revoked"||y.status==="rejected")&&(p>0&&y.userId===p||d&&(y.email||"").trim().toLowerCase()===d))return y;return null}function Ul(){const r="(max-width: 900px)",[c,h]=i.useState(()=>typeof window<"u"&&window.matchMedia(r).matches);return i.useEffect(()=>{const d=window.matchMedia(r),p=()=>h(d.matches);return p(),d.addEventListener("change",p),()=>d.removeEventListener("change",p)},[]),c}function Oo({className:r="",onInvite:c,inviteLabel:h="Invite",inviteDisabled:d=!1,inviteTitle:p,onMarkConnector:y,onUnmarkConnector:b,connectorMarkBusy:v=!1,isConnector:T=!1,connectorPending:_=!1,connectorInviteDisabled:z=!1,connectorInviteTitle:B,onMarkStrong:I,markStrongBusy:q=!1,onEdit:E,onArchive:H,archiving:M=!1}){return t.jsxs(Xi,{children:[t.jsx(Ji,{asChild:!0,children:t.jsx("button",{type:"button",className:`nc-card-menu-btn ${r}`.trim(),"aria-label":"More actions",onPointerDown:C=>C.stopPropagation(),onClick:C=>C.stopPropagation(),children:"â¯"})}),t.jsxs(el,{align:"end",sideOffset:4,className:"nc-card-menu-dropdown",children:[t.jsx(qe,{className:"nc-card-menu-item",disabled:!c||d,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),c==null||c()},title:p||"Invite",children:"Invite"}),T?t.jsx(qe,{className:"nc-card-menu-item",disabled:!b||v,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),b==null||b()},children:v?"Updatingâ¦":_?"Cancel connector invite":"Remove connector"}):t.jsx(qe,{className:"nc-card-menu-item",disabled:!y||v||z,title:B,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),y==null||y()},children:v?"Updatingâ¦":"Invite as connector"}),I?t.jsx(qe,{className:"nc-card-menu-item",disabled:q,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),I()},children:q?"Updatingâ¦":"Mark as strong"}):null,t.jsx(qe,{className:"nc-card-menu-item",disabled:!E||M,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),E==null||E()},children:"Edit profile"}),t.jsx(qe,{className:"nc-card-menu-item",disabled:!H||M,onClick:C=>C.stopPropagation(),onSelect:C=>{C.stopPropagation(),H==null||H()},children:M?"Archivingâ¦":"Archive"})]})]})}function oc(){var ws,js,Is,Cs,Ss,Ls,Es,Ts,Ms,Ps,As,Rs,Fs,Us,_s,Bs,Ds,Os,$s,qs,Ws,zs,Gs,Ks,Ys,Hs,Vs,Qs,Zs,Xs,Js,eo,to,no,ao,so,oo,ro,io,lo;const{user:r}
1=_n(),{openUpgrade:c,guardPaidAction:h}=Yr(),d=r==null?void 0:r.accessToken,p=r==null?void 0:r.userId,y=ye((r==null?void 0:r.fullName)||"You"),[b,v]=i.useState(!0);Hr(!b);const T=i.useRef(0),_=i.useRef(!1),[z,B]=i.useState(null),[I,q]=i.useState([]),[E,H]=i.useState(""),[M,C]=i.useState(""),G=i.useRef(null),[le,te]=i.useState(jo),[Z,ce]=i.useState(null),[se,Ae]=i.useState(""),[ne,be]=i.useState(""),[Ce]=Vr(),[S,de]=i.useState(()=>Ce.get("tab")==="add"?"add":"all"),[N,J]=i.useState("all"),[me]=i.useState("strength"),[Ne,Ge]=i.useState(!1),Jt=i.useRef(null),Ke=Ul(),Go=Qr(),Ko=Zr(),[Ye,He]=i.useState(null);i.useEffect(()=>{Ke||He(null)},[Ke]),i.useEffect(()=>{if(!Ye)return;const e=document.body.style.overflow;document.body.style.overflow="hidden";const n=a=>{a.key==="Escape"&&He(null)};return window.addEventListener("keydown",n),()=>{document.body.style.overflow=e,window.removeEventListener("keydown",n)}},[Ye]),i.useEffect(()=>{if(!Ne)return;const e=n=>{Jt.current&&!Jt.current.contains(n.target)&&Ge(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[Ne]);const[$,ue]=i.useState([]),[en,Ve]=i.useState(!1),[_l,ft]=i.useState(null),[Re,tn]=i.useState(!1),[Yo,Dn]=i.useState(new Set),[On,$n]=i.useState(null),[Qe,gt]=i.useState(null),[qn,Wn]=i.useState(null),[zn,Gn]=i.useState(null),[Fe,Ho]=i.useState([]),[Ue,Vo]=i.useState(null),[Qo,nn]=i.useState(!1),[Zo,an]=i.useState(!1),[ve,Kn]=i.useState(null),[sn,Yn]=i.useState(null),[Hn,yt]=i.useState(null),[A,_e]=i.useState(null),[Ze,Vn]=i.useState(""),[Qn,Zn]=i.useState(!1),[Xo,Jo]=i.useState([]),[on,Xn]=i.useState(!1),[er,Jn]=i.useState(null),[kt,tr]=i.useState(!1),[rn,ea]=i.useState([]),[ln,ta]=i.useState(!1),[na,aa]=i.useState(null),[cn,nr]=i.useState(!1),[ar,Bl]=i.useState("all"),[sr,sa]=i.useState(null),[or,dn]=i.useState(!1),[bt,mn]=i.useState(""),[Se,Xe]=i.useState(null),[Je,oa]=i.useState(!1),[ra,ia]=i.useState({}),[Nt,la]=i.useState(!1),[ca,da]=i.useState(!1),[Dl,ma]=i.useState(null),[F,un]=i.useState({}),[xe,vt]=i.useState(!1),[ua,ha]=i.useState(!1),[he,rr]=i.useState(null),[et,ir]=i.useState({}),[pa,lr]=i.useState(Xr),[P,tt]=i.useState(null),[s,D]=i.useState(null),hn=i.useRef(null),[Be,De]=i.useState(""),[oe,fa]=i.useState(!1),[xt,Q]=i.useState(null),[wt,nt]=i.useState(null),[ga,j]=i.useState(null),[we,at]=i.useState({}),[cr,jt]=i.useState(!1),[ya,st]=i.useState(null),[ka,ot]=i.useState([]),[ba,Na]=i.useState([]),[dr,va]=i.useState(0),[It,rt]=i.useState({}),[it,Ct]=i.useState({}),[k,Le]=i.useState(null),[xa,wa]=i.useState([]),[Ol,lt]=i.useState(!1),[$l,St]=i.useState(null),[Lt,pn]=i.useState(new Set),[ql,mr]=i.useState(new Set),[ja,Ia]=i.useState([]),[Wl,ct]=i.useState(!1),[zl,Et]=i.useState(null),[Gl,Ca]=i.useState(180),[Sa,La]=i.useState(null),[ur,Ea]=i.useState(null),[Ta,Ma]=i.useState(null),[Pa,Aa]=i.useState(null),[hr,Ra]=i.useState(null),[Fa,fn]=i.useState(null),[Ua,gn]=i.useState(null),[pr,yn]=i.useState(null),[_a,fr]=i.useState({}),[Ba,gr]=i.useState({}),Da=i.useCallback(async()=>{if(!d||!p){v(!1);return}const e=++T.current;_.current=!0,v(!0),lt(!0),ct(!0),Ve(!0),B(null),St(null),Et(null),ft(null);try{const n=await Jr(d,p);if(e!==T.current)return;const o=(Array.isArray(n.connections)?n.connections:[]).map(qo).filter(m=>!!m&&m.userId!==p);q(o),wa(n.stayInTouch||[]),pn(new Set),Ia(n.worthReactivating||[]),Ca(n.silentDays||180),rr(n.networkShape??null),ir(n.signalTiersByEmail??{}),lr(ei(n.strongRelationships)),v(!1),lt(!1),ct(!1);const l=Array.isArray(n.contacts)?n.contacts:[];queueMicrotask(()=>{if(e!==T.current){_.current=!1;return}const m=l.map(u=>Un(u)).filter(u=>!!u);ue(m),tn(!0),Ve(!1),_.current=!1})}catch(n){if(e!==T.current)return;const a=n instanceof Error?n.message:"Failed to load";B(a),St(a),Et(a),ft(a),v(!1),lt(!1),ct(!1),Ve(!1),_.current=!1}},[d,p]);i.useEffect(()=>{Da()},[Da]);const Oa=i.useCallback(async()=>{if(!(!d||!p)){lt(!0),St(null);try{const e=await ti(d,p);wa(e.stayInTouch||[]),pn(new Set)}catch(e){St(e instanceof Error?e.message:"Failed to load")}finally{lt(!1)}}},[d,p]);i.useCallback(e=>{const n=e.contactUserId&&e.contactUserId>0?e.contactUserId:e.userId>0?e.userId:null,a=e.contactImportId&&e.contactImportId>0?e.contactImportId:null;!n&&!a||(yn({contactName:e.name}),fn(n),gn(a))},[]);const yr=i.useCallback((e,n)=>{n.contactUserId&&pn(a=>
1{const o=new Set(a);return o.add(n.contactUserId),o}),n.contactImportId&&mr(a=>{const o=new Set(a);return o.add(n.contactImportId),o}),j(e),setTimeout(()=>j(null),3e3)},[]),$a=i.useCallback(async()=>{if(!(!d||!p)){ct(!0),Et(null);try{const e=await ni(d,p);Ia(e.worthReactivating||[]),Ca(e.silentDays||180)}catch(e){Et(e instanceof Error?e.message:"Failed to load")}finally{ct(!1)}}},[d,p]),qa=i.useCallback(e=>{j(e),setTimeout(()=>j(null),3500),Oa(),$a()},[Oa,$a]);i.useMemo(()=>xa.filter(e=>!Lt.has(e.userId)).slice(0,kl),[xa,Lt]),i.useMemo(()=>ja.filter(e=>!Lt.has(e.userId)),[ja,Lt]);const Tt=i.useCallback(async()=>{if(d){Ve(!0),ft(null);try{const e=await ai(d),n=(e==null?void 0:e.data)??e,a=Array.isArray(n)?n:(n==null?void 0:n.contacts)??(e==null?void 0:e.contacts)??[],l=(Array.isArray(a)?a:[]).map(m=>Un(m)).filter(m=>!!m);ue(l),tn(!0)}catch(e){ft(e instanceof Error?e.message:"Failed to load contacts")}finally{Ve(!1)}}},[d]),Mt=i.useCallback(async()=>{if(d){Xn(!0),Jn(null);try{const e=await si(d),n=(e==null?void 0:e.data)??e,a=Array.isArray(n)?n:(n==null?void 0:n.invited)??(e==null?void 0:e.invited)??[],l=(Array.isArray(a)?a:[]).map(m=>{const u=m,f=String(u.email||"").trim();return f?{email:f,isSignUp:u.isSignUp===!0,createdOn:u.createdOn||null}:null}).filter(m=>!!m);Jo(l),tr(!0)}catch(e){Jn(e instanceof Error?e.message:"Failed to load invites")}finally{Xn(!1)}}},[d]),Wa=i.useCallback(async()=>{if(d){ta(!0),aa(null);try{const e=await oi(d);ea(Array.isArray(e)?e:[]),nr(!0)}catch(e){aa(e instanceof Error?e.message:"Failed to load follow requests")}finally{ta(!1)}}},[d]),za=i.useCallback(async(e,n)=>{if(!(!d||!e)){sa(e);try{await ri(d,e,n),ea(a=>a.filter(o=>o.connectionID!==e)),j(n?"Follow request accepted":"Follow request declined"),setTimeout(()=>j(null),2500)}catch(a){j(a instanceof Error?a.message:"Couldn't respond to request"),setTimeout(()=>j(null),3500)}finally{sa(null)}}},[d]),Ga=i.useCallback(async()=>{if(!(!d||!p)){da(!0),ma(null);try{const e=new Date,n=new Date(e);n.setUTCMonth(n.getUTCMonth()-12);const a=n.toISOString().slice(0,10),o=new Date(e);o.setUTCDate(o.getUTCDate()+1);const l=o.toISOString().slice(0,10),m=await ii(p,a,l,d),u=await m.json().catch(()=>null);if(!m.ok||!u||!u.success){if(m.status===404){ia({}),la(!0);return}throw new Error(u&&u.error||`meeting-stats HTTP ${m.status}`)}const f=Date.now(),g={};for(const x of u.contacts||[]){const w=String(x.contact_email||"").trim().toLowerCase();if(!w)continue;const L=x.last_meeting_at,Y=L?new Date(L).getTime():0,R=L&&Number.isFinite(Y)&&Y<=f?L:null;g[w]={count:Number(x.meeting_count)||0,firstMet:x.first_meeting_at,lastMet:R,name:x.contact_name}}ia(g),la(!0)}catch(e){ma(e instanceof Error?e.message:"Failed to load meetings")}finally{da(!1)}}},[d,p]),Ka=i.useCallback(async()=>{if(!(!d||!p)){ha(!0);try{const e=await li(p,d),n=await e.json().catch(()=>null);if(!e.ok||!n||!n.success){if(e.status===404){un({}),vt(!0);return}vt(!0);return}const a={};for(const o of n.signals||[]){const l=String(o.contact_email||"").trim().toLowerCase();l&&(a[l]={sentCount:Number(o.sent_count)||0,receivedCount:Number(o.received_count)||0,meetingCount:Number(o.meeting_count)||0,lastSentAt:o.last_sent_at,lastReceivedAt:o.last_received_at,lastMeetingAt:o.last_meeting_at,lastSignalAt:o.last_signal_at,name:o.contact_name})}un(a),vt(!0)}catch{vt(!0)}finally{ha(!1)}}},[d,p]),Ya=i.useCallback(e=>{if(e==="all")return"2016-01-01";const n=e==="1mo"?1:e==="3mo"?3:e==="6mo"?6:e==="24mo"?24:12,a=new Date;return a.setUTCMonth(a.getUTCMonth()-n),a.toISOString().slice(0,10)},[]),kr=i.useCallback(async(e,n,a="12mo")=>{if(!(!d||!p||!e)){tt(o=>({email:e,name:n,range:a,loading:!0,error:null,totalMeetings:(o==null?void 0:o.email)===e?o.totalMeetings:0,months:(o==null?void 0:o.email)===e?o.months:[],recent:(o==null?void 0:o.email)===e?o.recent:[]}));try{const o=Ya(a),l=new Date;l.setUTCDate(l.getUTCDate()+1);const m=l.toISOString().slice(0,10),[u,f]=await Promise.all([ci(p,e,o,m,d),di(p,e,o,m,d)]),g=await u.json().catch(()=>null),x=await f.json().catch(()=>null);if(!u.ok||!(g!=null&&g.success))throw new Error((g==null?void 0:g.error)||`HTTP ${u.status}`);tt({email:e,name:n,range:a,loading:!1,error:null,totalMeetings:Number(g.total_meetings)||0,months:Array.isArray(g.months)?g.months:[],recent:f.ok&&Array.isArray(x==null?void 0:x.meetings)?x.meetings.map(w=>({start_at:w.start_at,event_title:w.event_title,status:w.status})):[]})}catch(o){tt(l=>l?{...l,loading:!1,error:o instanceof Error?o.message:"Failed to load meeting details"}:null)}}},[d,p,Ya]),ke=i.useCallback(e=>{const n=(r==null?void 0:r.fullName)||"You";Vn(vo(n)),_e({contactId:e.contactId,email:e.email,name:e.name,mode:e.mode||"send",fromRequestIntro:e.fromRequestIntro})},[r==null?void 0:r.fullName]);i.useCallback(e=>{const n=$.find(l=>l.id===e);if(!n)return;const a=(n.email||"").trim(),o=pt(n.fullName||"",n.email)||n.fullName||"";if(!a){ke({contactId:e,email:"",name:o,mode:"no_email"});return}ke({contactId:e,email:a,name:o,mode:"send"})},[$,ke]);const kn=i.useCallback((e,n,a)=>{const o=(a||"").trim();ke({contactId:e,email:o,name:n,mode:o?"send":"no_email"})},[ke]),Ha=i.useCallback((e,n,a)=>{const o=(a||"").trim();ke({contactId:e,email:o,name:n,mode:o?"send":"no_email",fromRequestIntro:!0})},[ke]),Pt=i.useCallback(async e=>{if(!d)return;const n=e.email.trim();if(n){Zn(!0),e.contactId&&$n(e.contactId);try{await Rl(d,n,{name:e.name,note:e.note,resend:e.resend}),e.contactId&&Dn(a=>
1{const o=new Set(a);return o.add(e.contactId),o}),_e(null),mn(""),dn(!1),Xe(null),j(`Invite sent to ${n}.`),setTimeout(()=>j(null),3e3),kt&&Mt()}catch(a){const o=a instanceof Error?a.message:"Failed to send invite";!e.resend&&Pl(o)?(_e(null),Xe({email:n,name:e.name,contactId:e.contactId})):(j(o),setTimeout(()=>j(null),3500))}finally{Zn(!1),e.contactId&&$n(null)}}},[d,kt,Mt]),Va=i.useMemo(()=>new Map($.map(e=>[e.id,e])),[$]),Qa=i.useMemo(()=>{const e=new Map;for(const n of $)n.connectedUserId&&!e.has(n.connectedUserId)&&e.set(n.connectedUserId,n);return e},[$]),Za=i.useMemo(()=>{const e=new Map;for(const n of $){const a=(n.email||"").trim().toLowerCase();a&&!e.has(a)&&e.set(a,n)}return e},[$]),re=i.useCallback(e=>{if(e.contactId){const a=Va.get(e.contactId);if(a)return a}if(e.userId>0){const a=Qa.get(e.userId);if(a)return a}const n=(e.email||"").trim().toLowerCase();if(n){const a=Za.get(n);if(a)return a}return null},[Va,Qa,Za]),br=i.useCallback(e=>{const n=$.find(a=>a.id===e);n&&yt({...n,fullName:Vt(n.fullName,n.email)})},[$]),pe=i.useCallback(async e=>{if(!d)return j("Please sign in again."),setTimeout(()=>j(null),3e3),null;const n=re(e);if(n)return n;const a={fullName:Vt(e.rawName||e.name,e.email),email:e.email??null,phoneNumber:null,title:e.title??null,companyName:e.companyName??null,linkedinUrl:e.linkedinUrl??null,location:e.location??null,companyWebsite:e.companyWebsite??null,connectedUserId:e.userId>0?e.userId:null,profilePhotoUrl:e.photo??null,source:e.userId>0?"gem_connection":"my_network",strengthLabel:e.strengthLabel??null};try{const o=await mi(d,a),l=Un({...o,connectedUserId:o.connectedUserId??a.connectedUserId,profilePhotoUrl:o.profilePhotoUrl??a.profilePhotoUrl,source:o.source??a.source,strengthLabel:o.strengthLabel??a.strengthLabel});if(!l)throw new Error("Contact create succeeded but no contact returned");return ue(m=>m.some(u=>u.id===l.id)?m.map(u=>u.id===l.id?l:u):[...m,l]),tn(!0),l}catch(o){return j(o instanceof Error?o.message:"Failed to create editable contact"),setTimeout(()=>j(null),3500),null}},[d,re]),Ee=i.useMemo(()=>ui($.map(e=>({id:e.id,connectedUserId:e.connectedUserId,strengthLabel:e.strengthLabel}))),[$]),Te=i.useCallback(async()=>{if(d)try{const e=await hi(d);Ho(e.connectors),Vo(e.quota??null)}catch{}},[d]),Nr=i.useCallback(()=>{if(al(Ue)){c((Ue==null?void 0:Ue.tier)==="pro"?"team":"connectors");return}nn(!0)},[Ue,c]),vr=i.useCallback(()=>{h(()=>an(!0),"team")},[h]);i.useEffect(()=>{Te()},[Te]);const bn=i.useCallback(e=>{const n=re(e),a=((n==null?void 0:n.email)||e.email||"").trim(),o=n?Pe(n.fullName,n.email):e.name,l=o&&o.toLowerCase()!==a.toLowerCase()?o:"";Kn({email:a,name:l})},[re]),Xa=i.useCallback(async(e,n)=>{if(!d||n.status!=="active")return;const a=await pe(e);!a||a.strengthLabel==="connector"||(await ho(d,a.id,"connector"),ue(o=>o.map(l=>l.id===a.id?{...l,strengthLabel:"connector"}:l)),q(o=>o.map(l=>l.userId===e.userId&&e.userId>0?{...l,strengthLabel:"connector"}:l)))},[d,pe]),At=i.useCallback(async e=>{if(!d)return;const n=await pe(e);if(n){Gn(n.id);try{await ho(d,n.id,"strong_connection"),ue(a=>a.map(o=>o.id===n.id?{...o,strengthLabel:"strong_connection"}:o)),q(a=>a.map(o=>o.userId===e.userId&&e.userId>0?{...o,strengthLabel:"strong_connection"}:o))}catch{j("Couldn't update â try again."),setTimeout(()=>j(null),3e3)}finally{Gn(null)}}},[d,pe]),xr=i.useCallback(async e=>{await Te();const n=I.find(a=>e.userId!=null&&a.userId>0&&a.userId===e.userId||e.email&&a.email&&a.email.toLowerCase()===e.email.toLowerCase())??null;n&&await Xa(n,e)},[I,Te,Xa]),Nn=i.useCallback(async e=>{if(!d)return;const n=re(e),a=Do(Fe,e,n),o=(n==null?void 0:n.id)??(e.userId>0?e.userId:null);o!=null&&Wn(o);try{if(a&&(a.status==="pending"||a.status==="active")){const m=a.status==="pending"?"Cancel":"Remove",u=a.name||a.email||e.name;if(!window.confirm(`${m} connector relationship with ${u}?`))return;await pi(d,a.id),await Te()}const l=n??await pe(e);(l==null?void 0:l.strengthLabel)==="connector"&&(await fi(d,l.id),ue(m=>m.map(u=>u.id===l.id?{...u,strengthLabel:null}:u)),q(m=>m.map(u=>u.userId===e.userId&&e.userId>0?{...u,strengthLabel:null}:u))),j(`${e.name} removed as connector`),setTimeout(()=>j(null),3e3)}catch(l){j(l instanceof Error?l.message:"Failed to update connector"),setTimeout(()=>j(null),3500)}finally{Wn(null)}},[d,Fe,re,pe,Te]),wr=i.useCallback(async e=>{const n=await pe(e);n&&yt({...n,fullName:Vt(n.fullName,n.email)})},[pe]),jr=i.useCallback(e=>{ue(n=>n.map(a=>a.id===e.id?{...a,fullName:e.fullName,email:e.email??null,phoneNumber:e.phoneNumber??null,title:e.title??null,companyName:e.companyName??null,linkedinUrl:e.linkedinUrl??null,location:e.location??null,companyWebsite:e.companyWebsite??null}:a)),j("Contact updated."),setTimeout(()=>j(null),3e3)},[]),Ja=i.useCallback(async e=>{if(!d||Qe!=null)return;const n=$.find(o=>o.id===e),a=n?Pe(n.fullName,n.email):"this contact";if(window.confirm(`Archive ${a}? They will be hidden from My Network.`)){gt(e);try{await Ln(d,e),ue(o=>o.filter(l=>l.id!==e)),Dn(o=>
1{if(!o.has(e))return o;const l=new Set(o);return l.delete(e),l}),yt(o=>(o==null?void 0:o.id)===e?null:o),j("Contact archived."),setTimeout(()=>j(null),3e3)}catch(o){j(o instanceof Error?o.message:"Failed to archive contact"),setTimeout(()=>j(null),3500)}finally{gt(null)}}},[d,Qe,$]),es=i.useCallback(async e=>{if(!d||sn!=null)return!1;if(!e.connectionID||e.connectionID<=0)return j("Preparing contact for archive..."),setTimeout(()=>j(null),3e3),!1;if(!window.confirm(`Archive ${e.name}? They will be hidden from My Network.`))return!1;Yn(e.connectionID);try{return await gi(d,e.connectionID),q(n=>n.filter(a=>a.connectionID!==e.connectionID)),j("Contact archived."),setTimeout(()=>j(null),3e3),!0}catch(n){return j(n instanceof Error?n.message:"Failed to archive contact"),setTimeout(()=>j(null),3500),!1}finally{Yn(null)}},[d,sn]),Ir=i.useCallback(async e=>{const n=re(e);if(e.connectionID>0){if(await es(e)&&n&&d)try{await Ln(d,n.id),ue(l=>l.filter(m=>m.id!==n.id))}catch{}return}if(n){await Ja(n.id);return}const a=await pe(e);if(!(!a||!d||Qe!=null)&&window.confirm(`Archive ${e.name}? They will be hidden from My Network.`)){gt(a.id);try{await Ln(d,a.id),ue(l=>l.filter(m=>m.id!==a.id));const o=(e.email||a.email||"").trim().toLowerCase();o&&un(l=>{if(!l[o])return l;const m={...l};return delete m[o],m}),j("Contact archived."),setTimeout(()=>j(null),3e3)}catch(o){j(o instanceof Error?o.message:"Failed to archive contact"),setTimeout(()=>j(null),3500)}finally{gt(null)}}},[Ja,es,Qe,re,pe,d]),Cr=i.useCallback(async()=>{if(!A)return;const e=(A.email||"").trim();if(e){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){j("Enter a valid email."),setTimeout(()=>j(null),3e3);return}await Pt({email:e,name:A.name,contactId:A.contactId,note:Ze})}},[A,Ze,Pt]),Sr=i.useCallback(()=>{const e=bt.trim();if(!e)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){j("Enter a valid email."),setTimeout(()=>j(null),3e3);return}const n=$.find(a=>(a.email||"").trim().toLowerCase()===e.toLowerCase());ke({contactId:n==null?void 0:n.id,email:e,name:(n==null?void 0:n.fullName)||e,mode:"send"})},[bt,$,ke]),Lr=i.useCallback(async()=>{if(!(Se!=null&&Se.email))return;const{email:e,name:n,contactId:a}=Se;oa(!0),await Pt({email:e,name:n,contactId:a,note:Ze||vo((r==null?void 0:r.fullName)||"You"),resend:!0}),oa(!1)},[Se,Ze,Pt,r==null?void 0:r.fullName]);i.useEffect(()=>{d&&(S==="contacts"&&!Re&&!en&&!_.current&&Tt(),!kt&&!on&&Mt(),!cn&&!ln&&Wa(),!Nt&&!ca&&Ga(),!xe&&!ua&&Ka())},[S,d,Re,en,kt,on,cn,ln,Nt,ca,xe,ua,Tt,Mt,Wa,Ga,Ka]);const[Rt,ts]=i.useState(!1),ns=i.useRef(new Set),as=i.useCallback(async e=>{if(!(!d||e.length===0||Rt)){ts(!0);try{const n=await yi(e.slice(0,25),d);if(!n.ok){n.status!==503&&console.warn("apollo enrich failed",n.status);return}await Tt()}catch(n){console.warn("apollo enrich error",n)}finally{ts(!1)}}},[d,Rt,Tt]);i.useEffect(()=>{var n;if(S!=="contacts"||!Re||!Nt&&!xe||Rt)return;const e=[];for(const a of $){if(a.apolloEnrichedAt||!a.email||ns.current.has(a.id))continue;const o=a.email.trim().toLowerCase(),l=((n=ra[o])==null?void 0:n.count)||0,m=F[o],u=((m==null?void 0:m.sentCount)||0)+((m==null?void 0:m.receivedCount)||0);if((l>=1||u>=3)&&(e.push(a.id),ns.current.add(a.id)),e.length>=25)break}e.length>0&&as(e)},[S,Re,Nt,xe,Rt,$,ra,F,as]),i.useEffect(()=>{if(!d)return;let e=!1;return(async()=>{try{const[n,a]=await Promise.all([ki(d),bi(d)]);if(n.ok&&!e){const o=await n.json(),l=Array.isArray(o)?o:(o==null?void 0:o.data)??[],m={};for(const u of l)(u==null?void 0:u.id)!=null&&(u!=null&&u.name)&&(m[String(u.id)]=u.name);fr(m)}if(a.ok&&!e){const o=await a.json(),l=Array.isArray(o)?o:(o==null?void 0:o.data)??[],m={};for(const u of l)(u==null?void 0:u.id)!=null&&(u!=null&&u.name)&&(m[String(u.id)]=u.name);gr(m)}}catch{}})(),()=>{e=!0}},[d]),i.useEffect(()=>{if(!d||!p)return;let e=!1;return(async()=>{var n,a,o,l;try{const m=await Ni(p,d);if(!m.ok)return;const u=await m.json(),f=((n=u==null?void 0:u.user)==null?void 0:n.user)??(u==null?void 0:u.user)??((a=u==null?void 0:u.data)==null?void 0:a.user)??(u==null?void 0:u.data)??u,g=(f==null?void 0:f.profilePhoto)||(f==null?void 0:f.ProfilePhoto)||(f==null?void 0:f.profile_photo)||null,x=(f==null?void 0:f.founder)??((o=u==null?void 0:u.user)==null?void 0:o.founder)??null,w=(f==null?void 0:f.investor)??((l=u==null?void 0:u.user)==null?void 0:l.investor)??null,{title:L,company:Y}=vi({founder:x,investor:w,user:f});e||(g&&ce(String(g)),Ae(L),be(Y))}catch{}})(),()=>{e=!0}},[d,p]),i.useEffect(()=>(G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{C(E),G.current=null},vl),()=>{G.current&&clearTimeout(G.current)}),[E]);const X=i.useMemo(()=>$.filter(e=>!rl(e)).slice().sort((e,n)=>Cl({rawName:e.fullName,email:e.email,strengthLabel:e.strengthLabel},{rawName:n.fullName,email:n.email,strengthLabel:n.strengthLabel},F)),[$,F]),ss=i.useMemo(()=>
1{if(!X.length)return[];const e=new Set(I.map(o=>(o.email||"").trim().toLowerCase()).filter(Boolean)),n=new Set(I.map(o=>o.userId).filter(o=>o>0)),a=new Set;return X.filter(o=>{const l=(o.email||"").trim().toLowerCase();if(o.connectedUserId){if(o.connectedUserId===p||n.has(o.connectedUserId)||a.has(o.connectedUserId))return!1;a.add(o.connectedUserId)}return!l||!e.has(l)}).map(o=>{const l=[o.title,o.companyName].filter(Boolean).join(" at "),m=o.connectedUserId&&o.connectedUserId>0?o.connectedUserId:null;return{connectionID:-o.id,userId:m??-o.id,contactId:o.id,name:Pe(o.fullName,o.email),rawName:o.fullName,role:l||"",email:o.email||void 0,photo:o.profilePhotoUrl??null,roleKind:0,strengthLabel:o.strengthLabel??null,linkedinUrl:o.linkedinUrl??null,title:o.title??null,location:o.location??null,companyName:o.companyName??null,companyWebsite:o.companyWebsite??null}})},[X,I,p]),os=2e9,Ft=i.useMemo(()=>{if(!Fe.length)return[];const e=new Set(I.map(a=>a.userId).filter(a=>a>0));for(const a of X)a.connectedUserId&&a.connectedUserId>0&&e.add(a.connectedUserId);const n=new Set;for(const a of I){const o=(a.email||"").trim().toLowerCase();o&&n.add(o)}for(const a of X){const o=(a.email||"").trim().toLowerCase();o&&n.add(o)}return Fe.filter(a=>a.status==="active"||a.status==="pending").filter(a=>{if(a.userId&&a.userId>0&&e.has(a.userId))return!1;const o=(a.email||"").trim().toLowerCase();return!(o&&n.has(o))}).map(a=>{const o=(a.name||a.email||"Connector").trim(),l=a.userId&&a.userId>0?a.userId:null;return{connectionID:-(os+a.id),userId:l??-(os+a.id),name:o,rawName:o,role:a.role||(a.status==="pending"?"Connector invite pending":"Connector"),email:a.email||void 0,photo:a.profilePhoto,roleKind:0,strengthLabel:a.status==="active"?"connector":null,companyName:a.company,sourceKind:"connector"}})},[Fe,I,X]),rs=i.useMemo(()=>{if(!xe)return[];const e=xo(I.map(n=>n.email||""),X.map(n=>n.email));return il(e,F)},[I,X,F,xe]),vn=i.useMemo(()=>[...I.map(a=>{const o=re(a);return o!=null&&o.strengthLabel?{...a,strengthLabel:o.strengthLabel}:a}),...ss,...Ft,...rs].slice().sort((a,o)=>Mo(a,o,F)),[I,ss,Ft,rs,F,re]),fe=i.useMemo(()=>{const e=M.trim().toLowerCase();return e?vn.filter(n=>Ro(n,e)):vn},[vn,M]),Ut=i.useMemo(()=>{const e=new Set(I.map(o=>(o.email||"").trim().toLowerCase()).filter(Boolean)),n=Re?ll(I.length,e,X):I.length;if(!xe)return n;const a=xo(I.map(o=>o.email||""),X.map(o=>o.email));return n+cl(a,F)+Ft.length},[I,Re,X,F,xe,Ft.length]),_t=i.useMemo(()=>{const e={};for(const[n,a]of Object.entries(F))e[n]={...a,contactName:a.name};return e},[F]),dt=i.useCallback(e=>{const n=(e.email||"").trim().toLowerCase();let a=n?wo(n,F,et):null,o=n;if(!a){const m=dl(e.rawName||e.name,_t);m&&(o=o||m,a=wo(m,F,et))}const l=xi(pa,{userId:e.userId,email:o});return Zt(a,e.strengthLabel,l)},[F,_t,et,pa]),je=i.useCallback((e,n)=>{if(n==="all")return!0;const a=dt(e);return n==="not_rated"?a==null:n==="very_strong"?a==="very_strong":n==="strong"?a==="strong":n==="solid"?a==="solid":a==="light"},[dt]),ae=i.useMemo(()=>{const e={all:fe.length,very_strong:0,strong:0,solid:0,light:0,not_rated:0};for(const n of fe)je(n,"very_strong")&&e.very_strong++,je(n,"strong")&&e.strong++,je(n,"solid")&&e.solid++,je(n,"light")&&e.light++,je(n,"not_rated")&&e.not_rated++;if(he){const n=(he.veryStrong??e.very_strong)+(he.strong??e.strong)+(he.solid??e.solid)+(he.light??e.light);return{all:fe.length,very_strong:he.veryStrong??e.very_strong,strong:he.strong??e.strong,solid:he.solid??e.solid,light:he.light??e.light,not_rated:Math.max(e.n
1ot_rated,fe.length-n)}}return e},[fe,je,he]),Me=i.useMemo(()=>{if(N==="all")return fe;const e=fe.filter(m=>je(m,N));if(N!=="light")return e;const n=new Set;for(const m of e){const f=(ml({name:m.rawName||m.name,email:m.email},_t)||m.email||"").trim().toLowerCase();f&&n.add(f)}const a=ul(n,et),o=M.trim().toLowerCase(),l=o?a.filter(m=>Ro(m,o)):a;return[...e,...l].sort((m,u)=>Mo(m,u,F))},[fe,N,je,et,_t,M,F]);i.useEffect(()=>{te(jo)},[S,M,N]);const Bt=i.useMemo(()=>M.trim()?Me:Me.slice(0,le),[Me,M,le]),Er=!M.trim()&&le<Me.length,xn=i.useMemo(()=>me==="company"?El(Bt):Ll(Bt,dt),[Bt,dt,me]),[is,ls]=i.useState(!1),Dt=i.useCallback(()=>{const e=document.getElementById(Po);return e?(e.scrollIntoView({behavior:"smooth",block:"start"}),!0):!1},[]),Tr=i.useCallback(()=>{Dt()||(J("not_rated"),ls(!0))},[Dt]);i.useEffect(()=>{is&&Dt()&&ls(!1)},[is,xn,Dt]),i.useMemo(()=>{const e=M.trim().toLowerCase();if(!e)return X;const n=e.replace(/[\s\-()]/g,"");return X.filter(a=>{const o=(a.fullName||"").toLowerCase(),l=pt(a.fullName,a.email).toLowerCase(),m=(a.email||"").toLowerCase(),u=(a.phoneNumber||"").replace(/[\s\-()]/g,"").toLowerCase();return o.includes(e)||l.includes(e)||m.includes(e)||n.length>0&&u.includes(n)})},[X,M]);const cs=i.useMemo(()=>({all:[...rn]}),[rn]),ds=i.useMemo(()=>{const e=cs.all,n=M.trim().toLowerCase();return n?e.filter(a=>{var g,x,w,L,Y;const o=(g=a==null?void 0:a.user)==null?void 0:g.user,l=String((o==null?void 0:o.fullname)||"").toLowerCase(),m=String((o==null?void 0:o.email)||"").toLowerCase(),u=String(((w=(x=a==null?void 0:a.user)==null?void 0:x.founder)==null?void 0:w.companyName)||"").toLowerCase(),f=String(((Y=(L=a==null?void 0:a.user)==null?void 0:L.investor)==null?void 0:Y.fundName)||"").toLowerCase();return l.includes(n)||m.includes(n)||u.includes(n)||f.includes(n)}):e},[cs,ar,M]),ms=rn.length,Mr=i.useCallback(async()=>{if(!(!d||!p)){jt(!0),st(null),ot([]);try{const e=await wi(p,d),n=l=>l.userId>0&&Ee.userIds.has(l.userId)?{...l,strengthLabel:"connector"}:l,a=(Array.isArray(e==null?void 0:e.gemConnections)?e.gemConnections:[]).map(l=>Wo(l)).filter(l=>!!l).map(n),o=(Array.isArray(e==null?void 0:e.importContacts)?e.importContacts:[]).map(l=>{const m=$.find(f=>f.id===Number(l.contactId)),u=m?{...l,strengthLabel:m.strengthLabel,displayName:l.displayName||m.fullName}:l;return zo(u)}).filter(l=>!!l).map(l=>l.contactId&&Ee.contactIds.has(l.contactId)?{...l,strengthLabel:"connector"}:n(l));ot([...a,...o])}catch(e){st(e instanceof Error?e.message:"Network error")}finally{jt(!1)}}},[d,p,$,Ee]),us=e=>{at({});const n=fo(e,null,Ee);D({mode:"make",step:"pick",anchor:e,picked:null,activeSide:e?"to":"from",note:"",goals:Fn.map(a=>({...a})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",email1Subject:"",email1Body:"",email2Subject:"",email2Body:"",optInMode:n,singleOptInFirstParty:"from"}),De(""),Q(null),nt(null),hn.current=null,Mr()},hs=(e,n)=>{const a=ge(e),o=Kt(K(n),U(n)),l=`Would you be open to introducing me to ${o}?`,m=`Hi ${a}, 2 3Hope you're doing well. I noticed you're connected to ${o} â I'd love an intro if you're open to it. 4 5I've drafted a short blurb below you can forward as-is, or edit however you like. Totally understand if the timing isn't right. 6 7Thanks either way. 8 9${(r==null?void 0:r.fullName)||"Me"}`,u=`Intro: ${(r==null?void 0:r.fullName)||"Me"} â ${o}`,f=Ki(r==null?void 0:r.fullName,r==null?void 0:r.email);return{email1Subject:l,email1Body:m,email2Subject:u,email2Body:f}},Pr=i.useCallback(async e=>{if(!(!d||!p)){jt(!0),st(null),ot([]);try{const n=await po(e,d);ot(Bo(n,p,e))}catch(n){st(n instanceof Error?n.message:"Network error")}finally{jt(!1)}}},[d,p]),ps=e=>{at({}),D({mode:"request",step:"pick",anchor:e,picked:null,activeSide:"to",note:"",goals:Fn.map(n=>({...n})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",email1Subject:"",email1Body:"",email2Subject:"",email2Body:"",optInMode:"double",singleOptInFirstParty:"from"}),De(""),Q(null),nt(null),e.userId>0&&Pr(e.userId)},Ar=(e,n)=>{const a=(p&&we[p]||"").trim();at({});const o=hs(e,n);a&&(o.email2Body=a),D({mode:"request",step:"compose",anchor:e,picked:n,activeSide:"to",note:"",goals:Fn.map(l=>({...l})),selectedGoalId:null,editingGoalId:null,editingGoalDraft:"",sendMode:"gemphere",...o,optInMode:"double",singleOptInFirstParty:"from"}),De(""),Q(null),nt(null)};i.useCallback(async e=>{if(d)try{const n=await ji(e.userId,d),a=n!=null&&n.data&&typeof n.data=="object"?n.data:n,o=a!=null&&a.user&&typeof a.user=="object"?a.user:a,l=a!=null&&a.founder&&typeof a.founder=="object"?a.founder:{},m=a!=null&&a.investor&&typeof a.investor=="object"?a.investor:{},u={...o,...l,...m},f=w=>{const L=u[w];if(L==null)return null;const R=(typeof L=="string"?L:String(L)).trim();return R&&R!=="Not provided"?R:null},g=Number(f("role"))||e.roleKind||0,x={fullname:f("fullname")||f("Fullname")||e.name,photo:f("profilePhoto")||f("ProfilePhoto")||f("photo")||e.photo||null,title:f("title")||f("Title"),role:g||0,linkedinUrl:f("linkedinProfile")||f("linkedinUrl")||f("linkedin_url"),email:f("email")||e.email||null,location:f("location")||f("city"),school:f("school")||f("education"),experience:f("experience"),companyName:f("companyName")||f("company"),companyOverview:f("companyOverview"),traction:f("traction"),superpower:f("superpower"),why:f("why"),sector:_o(f("sectorIndustryFocus")||f("sector")||f("sectors"),_a),fundName:f("fundName")||f("fund"),checkSize:_o(f("askInitialCheck")||f("checkSize")||f("check_size"),Ba),commonAdvice:f("commonAdvice"),whatThey:f("whatThey"),favPitchStyle:f("favPitchStyle")};Le(w=>w&&w.anchor.userId===e.userId?{...w,profile:x,profileLoading:!1,profileError:null}:w)}catch(n){Le(a=>a&&a.anchor.userId===e.userId?{...a,profileLoading:!1,profileError:n
9instanceof Error?n.message:"Failed to load profile"}:a)}},[d,_a,Ba]),i.useCallback(async e=>{if(!(!d||!p))try{const n=await po(e.userId,d),a=Bo(n,p,e.userId);Le(o=>o&&o.anchor.userId===e.userId?{...o,people:a,peopleLoading:!1,peopleError:null}:o)}catch(n){Le(a=>a&&a.anchor.userId===e.userId?{...a,peopleLoading:!1,peopleError:n instanceof Error?n.message:"Failed to load network"}:a)}},[d,p]);const Rr=(e,n)=>{Le({mode:n,anchor:e,profile:null,profileLoading:n==="request",profileError:null,people:[],peopleLoading:n==="request",peopleError:null,search:""})},mt=e=>Rr(e,"view"),Ot=()=>Le(null),fs=i.useMemo(()=>{const e=[];for(const n of(k==null?void 0:k.people)??[])e.push(n);return{all:e}},[k==null?void 0:k.people]),gs=i.useMemo(()=>{if(!k)return[];const e=fs.all,n=k.search.trim().toLowerCase();return n?e.filter(a=>a.name.toLowerCase().includes(n)||(a.role||"").toLowerCase().includes(n)):[]},[k,fs]),Fr=e=>{if(!k)return;const n=ht(k.anchor);Ot(),Ar(n,e)},ee=()=>{D(null),Q(null),nt(null),ot([]),st(null),Na([]),va(0),rt({}),Ct({}),at({})},ys=()=>{Q(null),D(e=>e&&{...e,step:"compose"})},ks=()=>{Q(null),D(e=>e&&{...e,step:"pick"})},Ur=e=>{D(n=>{if(!n)return n;if(n.mode==="make"){if(n.activeSide==="from"){const m=n.picked&&n.picked.key===e.key?null:n.picked;return{...n,anchor:e,picked:m,activeSide:m?"from":"to"}}
9const l=n.anchor&&n.anchor.key===e.key?null:n.anchor;return{...n,picked:e,anchor:l,activeSide:l?"to":"from"}}if(!n.anchor)return n;const a=hs(n.anchor,e),o=(p&&we[p]||"").trim();return o&&(a.email2Body=o),{...n,picked:e,...a}})},bs=i.useMemo(()=>{var o,l;const e=[],n=(s==null?void 0:s.mode)==="make"?s.activeSide==="from"?(o=s.picked)==null?void 0:o.key:(l=s.anchor)==null?void 0:l.key:void 0,a=[...ka,...ba];for(const m of a)n&&m.key===n||e.push(m);return{all:e}},[ka,ba,s==null?void 0:s.mode,s==null?void 0:s.activeSide,(ws=s==null?void 0:s.picked)==null?void 0:ws.key,(js=s==null?void 0:s.anchor)==null?void 0:js.key]),wn=(e,n,a)=>{const o=dr+1;va(o);const l=Fl(n,a,o);Na(m=>[l,...m]),D(m=>{if(!m)return m;const u={...m,activeSide:e};return m.mode==="make"?e==="from"?(u.anchor=l,m.picked&&m.picked.key===l.key&&(u.picked=null),u.activeSide=u.picked?"from":"to"):(u.picked=l,m.anchor&&m.anchor.key===l.key&&(u.anchor=null),u.activeSide=u.anchor?"to":"from"):u.picked=l,u})},U=e=>{if(!e)return null;const n=It[e.key];return n&&n.trim()?n.trim():e.email||null},K=e=>{if(!e)return"";const n=it[e.key];return n&&n.trim()?n.trim():(e.rawName??e.name).trim()},ge=e=>Bi(K(e),U(e)),jn=e=>{const n=K(e),a=U(e);return Di(n,a)?Kt(n,a):"Add their name"},Ns=i.useMemo(()=>s?bs.all:[],[s,bs]),vs=i.useMemo(()=>{const e=Be.trim().toLowerCase();return e?Ns.filter(a=>[a.name,a.rawName,a.role,a.title,a.companyName,a.email].filter(Boolean).join(" ").toLowerCase().includes(e)).slice().sort((a,o)=>Bn({rawName:a.name,email:a.email??void 0,strengthLabel:a.strengthLabel??null},{rawName:o.name,email:o.email??void 0,strengthLabel:o.strengthLabel??null},F)):[]},[Ns,Be,F]);i.useEffect(()=>{if(!s||s.mode!=="make"||!s.anchor||!s.picked)return;const e=`${s.anchor.key}:${s.picked.key}`;if(hn.current===e)return;hn.current=e;const n=Ii(s.anchor,s.picked,Ee,Lo(s.anchor,F),Lo(s.picked,F)),a=fo(s.anchor,s.picked,Ee);D(o=>!o||o.mode!=="make"||!o.anchor||!o.picked||o.singleOptInFirstParty===n&&o.optInMode===a?o:{...o,singleOptInFirstParty:n,optInMode:a})},[s==null?void 0:s.mode,(Is=s==null?void 0:s.anchor)==null?void 0:Is.key,(Cs=s==null?void 0:s.picked)==null?void 0:Cs.key,(Ss=s==null?void 0:s.anchor)==null?void 0:Ss.roleKind,(Ls=s==null?void 0:s.picked)==null?void 0:Ls.roleKind,(Es=s==null?void 0:s.anchor)==null?void 0:Es.strengthLabel,(Ts=s==null?void 0:s.picked)==null?void 0:Ts.strengthLabel,(Ms=s==null?void 0:s.anchor)==null?void 0:Ms.userId,(Ps=s==null?void 0:s.picked)==null?void 0:Ps.userId,(As=s==null?void 0:s.anchor)==null?void 0:As.contactId,(Rs=s==null?void 0:s.picked)==null?void 0:Rs.contactId,F,Ee]),i.useEffect(()=>{var o,l,m,u;if(!s||!d)return;const e=[];(o=s.anchor)!=null&&o.userId&&s.anchor.userId>0&&e.push(s.anchor.userId),(l=s.picked)!=null&&l.userId&&s.picked.userId>0&&e.push(s.picked.userId),p&&(s.mode==="request"&&e.push(p),s.mode==="make"&&(((m=s.anchor)==null?void 0:m.userId)===p&&e.push(p),((u=s.picked)==null?void 0:u.userId)===p&&e.push(p)));const n=Array.from(new Set(e));if(n.length===0)return;let a=!1;return(async()=>{const f={};await Promise.all(n.map(async g=>{try{const x=await Ci(d,g);f[g]=(x||"").trim()}catch{f[g]=""}})),!a&&at(g=>({...g,...f}))})(),()=>{a=!0}},[s==null?void 0:s.mode,(Fs=s==null?void 0:s.anchor)==null?void 0:Fs.key,(Us=s==null?void 0:s.picked)==null?void 0:Us.key,(_s=s==null?void 0:s.anchor)==null?void 0:_s.userId,(Bs=s==null?void 0:s.picked)==null?void 0:Bs.userId,(Ds=s==null?void 0:s.anchor)==null?void 0:Ds.isGem,(Os=s==null?void 0:s.picked)==null?void 0:Os.isGem,d,p]),i.useEffect(()=>{if(!s||s.mode!=="make"||!s.anchor||!s.picked)return;const e=K(s.anchor),n=K(s.picked),a=U(s.anchor),o=U(s.picked),l=Kt(e,a),m=Kt(n,o),u=s.note.trim()||"something super interesting",f=(s.picked.userId>0&&we[s.picked.userId]||"").trim(),g=(s.anchor.userId>0&&we[s.anchor.userId]||"").trim(),x=`Want me to intro you to ${m}?`,w=go(n,o,f,u,"working_on"),L=`Want me to intro you to ${l}?`,Y=go(e,a,g,u,"click");D(R=>!R||R.mode!=="make"||!R.anchor||!R.picked?R:{...R,email1Subject:x,email1Body:w,email2Subject:L,email2Body:Y})},[s==null?void 0:s.mode,($s=s==null?void 0:s.anchor)==null?void 0:$s.key,(qs=s==null?void 0:s.picked)==null?void 0:qs.key,s==null?void 0:s.note,r==null?void 0:r.fullName,it,It,we[((Ws=s==null?void 0:s.anchor)==null?void 0:Ws.userId)||0],we[((zs=s==null?void 0:s.picked)==null?void 0:zs.userId)||0]]),i.useEffect(()=>{if(!s||s.mode!=="request"||!s.picked)return;const e=(p&&we[p]||"").trim();e&&D(n=>!n||n.mode!=="request"||!n.picked||!Si(n.email2Body,r==null?void 0:r.fullName,r==null?void 0:r.email)?n:{...n,email2Body:e})},[s==null?void 0:s.mode,(Gs=s==null?void 0:s.picked)==null?void 0:Gs.key,p,r==null?void 0:r.fullName,we[p||0]]);const xs=async()=>
9{if(!s||!d||!p)return;const{mode:e,anchor:n,picked:a,note:o}=s;if(!a){Q("Pick the 'to' person first.");return}if(e==="make"&&!n){Q("Pick the 'from' person first.");return}const l=a.isGem&&a.userId>0,m=U(a),u=e==="make"?!!(n&&n.isGem&&n.userId>0):!0,f=e==="make"?U(n):null;if(e==="make"&&!u&&!f){Q(`${n.name} doesn't have an email yet â add one in the warning above to send the intro.`);return}if(!l&&!m){Q(`${a.name} doesn't have an email yet â add one in the warning above to send the intro.`);return}if(e==="make"&&!u&&!No(K(n),f)){Q(`Add a name for ${n.name} above â intro emails never greet someone by their email address.`);return}if(!l&&!No(K(a),m)){Q(`Add a name for ${a.name} above â intro emails never greet someone by their email address.`);return}fa(!0),Q(null);try{const g={};if(e==="make"){const L=n;u?g.fromUserID=L.userId:(g.fromUserID=p,f&&(g.fromEmail=f),g.fromName=K(L)),l?g.toUserID=a.userId:(g.toUserID=0,m&&(g.toEmail=m),g.toName=K(a)),g.note=o.trim()||"I think you two should connect!",s.email1Body.trim()&&(g.connectorMessage=s.email1Body.trim()),s.email2Body.trim()&&(g.blurb=s.email2Body.trim()),s.email1Subject.trim()&&(g.connectorSubject=s.email1Subject.trim()),s.email2Subject.trim()&&(g.blurbSubject=s.email2Subject.trim())}else g.fromUserID=p,g.connectorUserID=n.userId,g.toUserID=l?a.userId:0,l||(m&&(g.toEmail=m),g.toName=K(a)),g.note=s.email1Body.trim()||"I'd love an intro!",g.connectorMessage=s.email1Body.trim(),g.blurb=s.email2Body.trim(),s.email1Subject.trim()&&(g.connectorSubject=s.email1Subject.trim()),s.email2Subject.trim()&&(g.blurbSubject=s.email2Subject.trim());e==="make"&&Object.assign(g,Oi(s.optInMode,s.singleOptInFirstParty));const x=await $i(g,d),w=await x.json().catch(()=>null);if(!x.ok||(w==null?void 0:w.success)===!1||w!=null&&w.error){const L=w&&(w.message||w.error)||`Request failed (${x.status})`;Q(String(L))}else{const L=s.optInMode,Y=s.singleOptInFirstParty==="from"?a.name:n.name,R=e==="make"?L==="disabled"?`Connected ${n.name} and ${a.name}.`:L==="single"?`Intro started between ${n.name} and ${a.name} (single opt-in â waiting on ${Y}).`:`Intro started between ${n.name} and ${a.name}.`:`Asked ${n.name} to intro you to ${a.name}.`;nt(R),setTimeout(()=>{ee(),j(R),setTimeout(()=>j(null),4e3)},900)}}catch(g){Q(g instanceof Error?g.message:"Network error")}finally{fa(!1)}},_r=i.useCallback(e=>{const n=(e.email||"").trim().toLowerCase(),a=n?F[n]:null;return Li(Il(a),e.strengthLabel??null)},[F]),In=e=>{var m,u,f;const n=(s==null?void 0:s.mode)==="make",a=n?e==="from"?(m=s==null?void 0:s.anchor)==null?void 0:m.key:(u=s==null?void 0:s.picked)==null?void 0:u.key:(f=s==null?void 0:s.picked)==null?void 0:f.key,l=!n||(s==null?void 0:s.activeSide)===e?Be.trim():"";return cr?t.jsx(Ie,{variant:"section",message:"Loading your networkâ¦"}):ya?t.jsx("div",{className:"intro-picker-empty",style:{color:"#9a3a2a"},children:ya}):l?vs.length===0?t.jsx("div",{className:"intro-picker-empty",children:"No matches â try a different search."}):t.jsx("div",{className:"intro-picker-list",role:"radiogroup","aria-label":"Pick a person",children:vs.map(g=>{const x=a===g.key,w=_r(g),{titleLine:L,emailLine:Y}=qi(g);return t.jsxs("button",{type:"button",role:"radio","aria-checked":x,className:`intro-pick-row${x?" picked":""}`,onClick:()=>{n&&D(R=>R&&{...R,activeSide:e}),Ur(g)},children:[t.jsx("span",{className:"intro-pick-radio","aria-hidden":"true"}),t.jsx("span",{className:"intro-pick-av intro-pick-av--row",children:g.photo?t.jsx("img",{src:g.photo,alt:""}):ye(g.name)}),t.jsx("span",{className:"intro-pick-name",children:g.name}),t.jsx("span",{className:"intro-pick-role",children:L||Y||""}),t.jsx("span",{className:"intro-pick-tier",children:w?$o(w):""})]},g.key)})}):t.jsx("div",{className:"intro-picker-empty",children:"Start typing a name to see who you can pick."})},Cn=e=>{const n=e.sourceKind==="connector",a=e.userId<0&&!n,o=re(e),l=(o==null?void 0:o.id)??0,m=l||(a?e.contactId??Math.abs(e.userId):0),u=a&&Yo.has(m),f=a&&!u,g=!!e.email,x=a&&On===m,w=l?Qe===l:sn===e.connectionID,L=o?Pe(o.fullName,o.email):e.name,Y=((o==null?void 0:o.title)||e.title||"").trim(),R=((o==null?void 0:o.companyName)||e.companyName||"").trim(),$t=(e.role||W(e.roleKind)).trim(),qt=Y||(!Y&&!R?$t:""),Wt=R,zt=x?"Sending...":u?"Invited":"Invite",ut=g?u?"Already invited":"Invite this contact to Gemphere":"Add their email in the invite popup",Gt=()=>{wr(e)},Oe=()=>{Ir(e)},O=Do(Fe,e,o),ie=(o==null?void 0:o.strengthLabel)==="connector"||e.strengthLabel==="connector"||(O==null?void 0:O.status)==="active"||(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",co=(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",mo=(O==null?void 0:O.status)==="active"||(O==null?void 0:O.status)==="pending"&&O.direction==="outgoing",Or=mo?co?"Connector invite already sent":"Already connected as a connector":"Send a connector invite â they'll need to accept before sharing targets",$r=l>0&&qn===l||e.userId>0&&qn===e.userId,Sn=dt(e),uo=!Wi(Sn,"strong"),qr=l>0&&zn===l||e.userId>0&&zn===e.userId;
9return{isImportedContact:a,contactId:m,canInvite:f,sending:x,archiving:w,displayName:L,roleText:qt,companyDisplay:Wt,inviteLabel:zt,inviteTitle:ut,handleEditProfile:Gt,handleArchiveProfile:Oe,isConnectorMarked:ie,connectorPending:co,connectorInviteDisabled:mo,connectorInviteTitle:Or,connectorMarkBusy:$r,rowTier:Sn,canMarkStrong:uo,markStrongBusy:qr,showMarkStrongAction:uo&&Sn===null}},Br=e=>{const{displayName:n,roleText:a,companyDisplay:o,rowTier:l}=Cn(e),m=[a,o].filter(Boolean).join(" · ");return t.jsxs("div",{className:"mnet-row",role:"button",tabIndex:0,onClick:()=>mt(e),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),mt(e))},children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"mnet-row-av"}):t.jsx("div",{className:"mnet-row-av",children:ye(n)}),t.jsxs("div",{className:"mnet-row-main",children:[t.jsx("div",{className:"mnet-row-name",children:n}),m?t.jsx("div",{className:"mnet-row-meta",children:m}):null]}),t.jsx("i",{role:"img",className:l?`net-dot net-dot--${So[l]} mnet-row-dot`:"mnet-row-dot mnet-row-dot--none","aria-label":l?Ht[l]:"Not rated"}),t.jsx("button",{type:"button",className:"mnet-row-intro","aria-label":`Start an intro with ${n}`,"aria-haspopup":"dialog",onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.stopPropagation(),He({row:e,mode:"intro"})},children:"Intro"}),t.jsx("button",{type:"button",className:"mnet-row-more","aria-label":`More actions for ${n}`,"aria-haspopup":"dialog",onPointerDown:u=>u.stopPropagation(),onClick:u=>{u.stopPropagation(),He({row:e,mode:"more"})},children:"â¯"})]},e.connectionID)},Dr=e=>{if(Ke)return Br(e);const{isImportedContact:n,contactId:a,canInvite:o,sending:l,archiving:m,displayName:u,roleText:f,companyDisplay:g,inviteLabel:x,inviteTitle:w,handleEditProfile:L,handleArchiveProfile:Y,isConnectorMarked:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,rowTier:ut,canMarkStrong:Gt,markStrongBusy:Oe,showMarkStrongAction:O}=Cn(e);return t.jsxs("div",{className:"network-row",role:"button",tabIndex:0,onClick:()=>mt(e),onKeyDown:ie=>{(ie.key==="Enter"||ie.key===" ")&&(ie.preventDefault(),mt(e))},children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"network-row-avatar network-row-avatar-neutral no-border",style:{objectFit:"cover"}}):t.jsx("div",{className:"network-row-avatar network-row-avatar-neutral no-border",children:ye(u)}),t.jsxs("div",{className:"network-row-person",children:[t.jsx("div",{className:"network-row-name-line",children:t.jsx("span",{className:"network-row-name-text",children:u})}),f?t.jsx("span",{className:"network-row-role",children:f}):null]}),t.jsx("div",{className:"network-row-company-col",children:g}),t.jsx("div",{className:"network-row-strength",children:ut?t.jsxs(t.Fragment,{children:[t.jsx("i",{className:`net-dot net-dot--${So[ut]}`}),t.jsx("span",{children:Ht[ut]})]}):t.jsx("span",{className:"network-row-strength-none",children:"Not rated"})}),t.jsxs("div",{className:`network-row-actions${O?" has-strong":""}`,children:[t.jsx("button",{type:"button",className:"network-row-action network-row-action-text",onClick:ie=>{ie.stopPropagation(),us(ht(e))},children:"Make an intro"}),t.jsx("button",{type:"button",className:"network-row-action network-row-action-pill",onClick:ie=>{if(ie.stopPropagation(),n){Ha(a,e.name,e.email);return}ps(ht(e))},children:"Request an intro"}),O?t.jsx("button",{type:"button",className:"network-row-action network-row-action-pill network-row-action-strong",disabled:Oe,onClick:ie=>{ie.stopPropagation(),At(e)},children:Oe?"Updatingâ¦":"Mark as strong"}):null,t.jsx(Oo,{className:"nc-card-desktop-menu network-row-menu",onInvite:n?()=>kn(a,e.name,e.email):void 0,inviteLabel:x,inviteDisabled:n?!o||l||m:!1,inviteTitle:w,isConnector:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,onMarkConnector:()=>bn(e),onUnmarkConnector:()=>void Nn(e),onMarkStrong:Gt&&!O?()=>void At(e):void 0,markStrongBusy:Oe,onEdit:L,onArchive:Y,archiving:m}),t.jsx(Oo,{className:"nc-card-mobile-menu network-row-menu",onInvite:n?()=>kn(a,e.name,e.email):void 0,inviteLabel:x,inviteDisabled:n?!o||l||m:!1,inviteTitle:w,isConnector:R,connectorPending:$t,connectorInviteDisabled:qt,connectorInviteTitle:Wt,connectorMarkBusy:zt,onMarkConnector:()=>bn(e),onUnmarkConnector:()=>void Nn(e),onMarkStrong:Gt&&!O?()=>void At(e):void 0,markStrongBusy:Oe,onEdit:L,onArchive:Y,archiving:m})]})]},e.connectionID)};return t.jsxs("div",{className:"page active page-network",children:[t.jsxs("div",{className:"top-header network-page-header",children:[t.jsxs("div",{className:"header-left",children:[t.jsx("div",{className:"page-h",children:"My network"}),t.jsx("div",{className:"page-sub",children:"People you know directly, sorted by how well you know them."})]}),t.jsxs("div",{className:"network-header-stat","aria-label":b?"Loading count of people you know":`${Ut.toLocaleStr
9ing("en-US")} people you know`,children:[t.jsx("div",{className:"network-header-stat-num",children:b?"â":Ut.toLocaleString("en-US")}),t.jsx("div",{className:"network-header-stat-lbl",children:"People you know"})]})]}),Ke&&Go.canSeeTeam?t.jsxs("button",{type:"button",className:"net-teams-entry",onClick:()=>Ko("/team"),children:[t.jsx("span",{className:"net-teams-entry-icon","aria-hidden":!0,children:t.jsx(Ei,{size:17,strokeWidth:1.75})}),t.jsxs("span",{className:"net-teams-entry-body",children:[t.jsx("span",{className:"net-teams-entry-title",children:"Teams"}),t.jsx("span",{className:"net-teams-entry-sub",children:"Your workspace and its shared network"})]}),t.jsx("span",{className:"net-teams-entry-caret","aria-hidden":!0,children:t.jsx(pl,{size:16,strokeWidth:2})})]}):null,z&&t.jsxs("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:[t.jsx("strong",{children:"Couldn't load your connections:"})," ",z]}),bl,t.jsxs("div",{className:"filters-row network-filters-tabs",children:[t.jsxs("div",{className:"filters network-tab-filters",children:[t.jsxs("div",{className:"net-people-tab",ref:Jt,children:[t.jsxs("span",{className:`filt${S==="all"?" active":""}`,onClick:()=>de("all"),style:{cursor:"pointer"},children:["People",b?null:t.jsx("span",{className:"cnt",children:Ut.toLocaleString("en-US")})]}),S==="all"?t.jsx("button",{type:"button",className:`net-strength-caret${N!=="all"?" filtered":""}${Ne?" open":""}`,"aria-label":"Filter by relationship strength","aria-haspopup":"menu","aria-expanded":Ne,onClick:e=>{e.stopPropagation(),Ge(n=>!n)},children:t.jsx(Ti,{size:13,strokeWidth:2})}):null,S==="all"&&Ne?t.jsx("div",{className:"net-strength-menu",role:"menu",children:[["all","All",null,Ut],["very_strong","Very strong","vs",ae.very_strong],["strong","Strong","s",ae.strong],["solid","Solid","so",ae.solid],["light","Light","l",ae.light],["not_rated","Not rated","u",ae.not_rated]].map(([e,n,a,o])=>t.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":N===e,className:`net-strength-menu-item${N===e?" active":""}`,onClick:()=>{J(e),Ge(!1)},children:[t.jsxs("span",{className:"net-strength-menu-label",children:[a?t.jsx("i",{className:`net-dot net-dot--${a}`}):null,n]}),t.jsx("span",{className:"net-strength-menu-count",children:o.toLocaleString("en-US")})]},e))}):null]}),t.jsx("span",{className:`filt${S==="add"?" active":""}`,onClick:()=>de("add"),style:{cursor:"pointer"},children:"Grow your network"}),t.jsxs("span",{className:`filt${S==="requests"?" active":""}`,onClick:()=>de("requests"),style:{cursor:"pointer"},children:["Requests",cn&&ms?t.jsx("span",{className:"cnt",children:ms.toLocaleString("en-US")}):null]})]}),S==="all"?t.jsxs("label",{className:"net-tab-search",children:[t.jsx("span",{"aria-hidden":!0,children:"â"}),t.jsx("input",{type:"text",placeholder:"Search your network",value:E,onChange:e=>H(e.target.value)})]}):null]}),S==="all"&&ae.not_rated>0&&N!=="not_rated"?t.jsxs("div",{className:"net-notice",children:[t.jsxs("div",{className:"net-notice-text",children:[t.jsxs("b",{children:[ae.not_rated.toLocaleString("en-US")," people aren't rated yet."]})," ","We haven't seen enough email or calendar activity to judge how well you know them."]}),t.jsx("button",{type:"button",className:"net-notice-btn",onClick:Tr,children:"Rate connections"})]}):null,S==="add"?t.jsx(gl,{inviteByEmailOpen:or,inviteByEmailValue:bt,onInviteByEmailOpen:()=>dn(!0),onInviteByEmailChange:mn,onInviteByEmailCancel:()=>{dn(!1),mn("")},onInviteByEmailSubmit:()=>{bt.trim()&&Sr()},invitedList:Xo,invitedLoading:on,invitedError:er,onAddConnector:Nr,onInviteTeammate:vr}):S==="requests"?t.jsxs("div",{className:"network-side-panel",children:[t.jsxs("div",{className:"network-side-panel-head",children:[t.jsx("div",{className:"network-side-panel-kicker",children:"Inbox"}),t.jsx("h2",{className:"network-side-panel-title",children:"Follow requests"}),t.jsx("p",{className:"network-side-panel-desc",children:"People who want to connect with you on Gemphere â accept to add them to your network."})]}),ln?t.jsx(Ie,{variant:"section",message:"Loading follow requestsâ¦"}):na?t.jsxs("div",{className:"network-side-empty network-side-empty--error",children:["Couldn't load follow requests: ",na]}):ds.length===0?t.jsx("div",{className:"network-side-empty",children:M?"No requests match your search.":"You're all caught up â new follow requests will show up here."}):t.jsx("div",{className:"network-side-list",children:ds.map(e=>{var g,x,w;const n=((g=e==null?void 0:e.user)==null?void 0:g.user)||{},a=((x=e==null?void 0:e.user)==null?void 0:x.founder)||null,o=((w=e==null?void 0:e.user)==null?void 0:w.investor)||null,l=Xt(String(n.fullname||""),n.email||null),m=n.profilePhoto||null,u=a!=null&&a.companyName?[a.title,a.companyName].filter(
9Boolean).join(" · "):o!=null&&o.fundName?[o.title,o.fundName].filter(Boolean).join(" · "):W(Number(n.role)||0),f=sr===e.connectionID;return t.jsxs("div",{className:"network-side-row",children:[t.jsx("div",{className:"network-side-row-avatar",children:m?t.jsx("img",{src:m,alt:""}):ye(l)}),t.jsxs("div",{className:"network-side-row-main",children:[t.jsx("div",{className:"network-side-row-name",children:l}),u?t.jsx("div",{className:"network-side-row-meta",children:u}):null]}),t.jsxs("div",{className:"network-side-row-actions",children:[t.jsx("button",{type:"button",className:"network-side-action network-side-action--danger",onClick:()=>za(e.connectionID,!1),disabled:f,children:f?"â¦":"Decline"}),t.jsx("button",{type:"button",className:"network-side-action network-side-action--primary",onClick:()=>za(e.connectionID,!0),disabled:f,children:f?"â¦":"Accept"})]})]},e.connectionID)})})]}):b?t.jsx(Ie,{variant:"page",message:"Loading your networkâ¦"}):fe.length===0&&en?t.jsx(Ie,{variant:"section",message:"Loading imported contactsâ¦"}):fe.length===0?t.jsx("div",{className:"network-empty",children:"No connections yet"}):Me.length===0||xn.length===0?t.jsx("div",{className:"network-empty",children:"No one matches that search"}):t.jsxs(t.Fragment,{children:[xn.map(e=>{const n=e.tier==="very_strong"?ae.very_strong:e.tier==="strong"?ae.strong:e.tier==="solid"?ae.solid:e.tier==="light"?ae.light:e.tier==="other"?ae.not_rated:e.rows.length;return t.jsxs("div",{className:"network-tier-group",id:e.tier==="other"?Po:void 0,children:[t.jsxs("div",{className:"network-tier-head",children:[t.jsx("div",{className:"network-tier-title",children:e.label==="Very Strong"?"Very strong":e.label}),t.jsx("div",{className:"network-tier-count",children:n>e.rows.length?`Showing ${e.rows.length.toLocaleString("en-US")} of ${n.toLocaleString("en-US")}`:e.rows.length.toLocaleString("en-US")}),t.jsx("div",{className:"network-tier-line","aria-hidden":!0})]}),t.jsx("div",{className:"network-list",children:e.rows.map(Dr)})]},e.tier)}),Er?t.jsx("div",{className:"network-load-more",children:t.jsx("button",{type:"button",className:"network-load-more-btn","aria-label":`Load more contacts (${Bt.length} of ${Me.length} shown)`,onClick:()=>te(e=>Math.min(e+Nl,Me.length)),children:"Load more contacts"})}):null]}),Ke&&Ye?(()=>{const e=Ye.row,n=Cn(e),a=()=>He(null),o=We(n.displayName),l=[n.roleText,n.companyDisplay].filter(Boolean).join(" · "),m=()=>{a(),us(ht(e))},u=()=>{if(a(),n.isImportedContact){Ha(n.contactId,e.name,e.email);return}ps(ht(e))},f=t.jsx("span",{className:"mnet-chain-av mnet-chain-av--them",children:e.photo?t.jsx("img",{src:e.photo,alt:""}):ye(n.displayName)}),g=t.jsx("span",{className:"mnet-chain-av mnet-chain-av--you",children:Z?t.jsx("img",{src:Z,alt:""}):y});return Ye.mode==="intro"?t.jsx("div",{className:"mnet-sheet-overlay",role:"presentation",onClick:a,children:t.jsxs("div",{className:"mnet-sheet mnet-sheet--intro",role:"dialog","aria-modal":"true","aria-label":`Start an intro with ${n.displayName}`,onClick:x=>x.stopPropagation(),children:[t.jsx("span",{className:"mnet-sheet-grab","aria-hidden":!0}),t.jsxs("div",{className:"mnet-intro-nav",children:[t.jsx("button",{type:"button",className:"mnet-intro-back",onClick:a,"aria-label":"Back",children:"â¹"}),t.jsxs("div",{children:[t.jsxs("div",{className:"mnet-sheet-eyebrow",children:["With ",o]}),t.jsx("div",{className:"mnet-sheet-title",children:"Start an intro"})]})]}),t.jsxs("div",{className:"mnet-intro-body",children:[t.jsxs("div",{className:"mnet-intro-person",children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:"mnet-row-av"}):t.jsx("div",{className:"mnet-row-av",children:ye(n.displayName)}),t.jsxs("div",{className:"mnet-row-main",children:[t.jsx("div",{className:"mnet-row-name",children:n.displayName}),t.jsx("div",{className:"mnet-row-meta",children:[l,n.rowTier?Ht[n.rowTier].toLowerCase():"not rated"].filter(Boolean).join(" · ")})]})]}),t.jsxs("button",{type:"button",className:"mnet-intro-card",onClick:m,children:[t.jsxs("span",{className:"mnet-chain","aria-hidden":!0,children:[f,t.jsx("span",{className:"mnet-chain-arm"}),g,t.jsx("span",{className:"mnet-chain-arm"}),t.jsx("span",{className:"mnet-chain-av mnet-chain-av--open",children:"?"})]}),t.jsx("span",{className:"mnet-intro-card-eyebrow",children:"Make an intro"}),t.jsxs("span",{className:"mnet-intro-card-title",children:["Introduce ",o," to someone"]}),t.jsx("span",{className:"mnet-intro-card-note",children:"You're the one in the middle. Pick who they should meet, and Gem drafts the emails and asks both of them before anything sends."})]}),t.jsxs("button",{type:"button",className:"mnet-intro-card",onClick:u,children:[t.jsxs("span",{className:"mnet-chain","aria-hidden":!0,
9children:[g,t.jsx("span",{className:"mnet-chain-arm"}),f,t.jsx("span",{className:"mnet-chain-arm"}),t.jsx("span",{className:"mnet-chain-av mnet-chain-av--target",children:"?"})]}),t.jsx("span",{className:"mnet-intro-card-eyebrow",children:"Request an intro"}),t.jsxs("span",{className:"mnet-intro-card-title",children:["Ask ",o," for an intro"]}),t.jsx("span",{className:"mnet-intro-card-note",children:"They're the connector. Pick someone they know, and Gem asks them to forward your blurb â nothing goes out until they say yes."})]})]})]})}):t.jsx("div",{className:"mnet-sheet-overlay",role:"presentation",onClick:a,children:t.jsxs("div",{className:"mnet-sheet",role:"dialog","aria-modal":"true","aria-label":n.displayName,onClick:x=>x.stopPropagation(),children:[t.jsx("span",{className:"mnet-sheet-grab","aria-hidden":!0}),t.jsxs("div",{className:"mnet-sheet-head",children:[t.jsx("div",{className:"mnet-sheet-eyebrow",children:n.rowTier?Ht[n.rowTier]:"Not rated"}),t.jsx("div",{className:"mnet-sheet-title",children:n.displayName}),l?t.jsx("div",{className:"mnet-sheet-sub",children:l}):null]}),n.canMarkStrong?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mnet-sheet-sec",children:"How well you know them"}),t.jsx("div",{className:"mnet-sheet-group",children:t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.markStrongBusy,onClick:()=>{At(e),a()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.markStrongBusy?"Updatingâ¦":"Mark as strong"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Tell Gem this is someone you actually know well"})]})})})]}):null,t.jsx("div",{className:"mnet-sheet-sec",children:"Bring them in"}),t.jsxs("div",{className:"mnet-sheet-group",children:[n.isImportedContact?t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:!n.canInvite||n.sending||n.archiving,title:n.inviteTitle,onClick:()=>{a(),kn(n.contactId,e.name,e.email)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.inviteLabel}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Send them Gemphere. Their network joins the paths you can reach."})]})}):null,n.isConnectorMarked?t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.connectorMarkBusy,onClick:()=>{a(),Nn(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.connectorMarkBusy?"Updatingâ¦":n.connectorPending?"Cancel connector invite":"Remove connector"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:n.connectorPending?"Withdraw the connector invite you sent":"Stop sharing path-matched targets with them"})]})}):t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.connectorMarkBusy||n.connectorInviteDisabled,title:n.connectorInviteTitle,onClick:()=>{a(),bn(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.connectorMarkBusy?"Updatingâ¦":"Invite as connector"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"They stay on their own network and pass intros along"})]})})]}),t.jsx("div",{className:"mnet-sheet-sec",children:"Manage"}),t.jsxs("div",{className:"mnet-sheet-group",children:[t.jsx("button",{type:"button",className:"mnet-sheet-item",onClick:()=>{a(),mt(e)},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:"View profile"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Meetings, shared contacts and how you know them"})]})}),t.jsx("button",{type:"button",className:"mnet-sheet-item",disabled:n.archiving,onClick:()=>{a(),n.handleEditProfile()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:"Edit profile"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Fix the name, title, company or email on file"})]})}),t.jsx("button",{type:"button",className:"mnet-sheet-item mnet-sheet-item--danger",disabled:n.archiving,onClick:()=>{a(),n.handleArchiveProfile()},children:t.jsxs("span",{className:"mnet-sheet-item-main",children:[t.jsx("span",{className:"mnet-sheet-item-name",children:n.archiving?"Archiv
9ingâ¦":"Archive"}),t.jsx("span",{className:"mnet-sheet-item-desc",children:"Hide them from your lists and stop suggesting them"})]})})]}),t.jsx("button",{type:"button",className:"mnet-sheet-cancel",onClick:a,children:"Close"})]})})})():null,s&&s.mode==="make"&&s.step==="pick"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal intro-picker",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"intro-picker-head",children:[t.jsxs("div",{className:"intro-picker-kicker",children:[t.jsx("span",{children:"Step 1 of 2 · Who meets who"}),t.jsx("span",{className:"intro-picker-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsx("button",{className:"mod-close intro-picker-close",onClick:ee,"aria-label":"Close",children:"Ã"}),t.jsx("h2",{className:"intro-picker-title",children:s.anchor?`Introduce ${s.anchor.name} to someone.`:"Introduce two people in your network."}),t.jsxs("div",{className:"intro-picker-chain",children:[t.jsx(ze,{name:((Ks=s.anchor)==null?void 0:Ks.name)||"Person A",photo:(Ys=s.anchor)==null?void 0:Ys.photo,label:"Person A",tone:"asker",userId:(Hs=s.anchor)==null?void 0:Hs.userId,title:V(s.anchor,W).title,company:V(s.anchor,W).company}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(ze,{name:(r==null?void 0:r.fullName)||"You",photo:Z,label:"Connector",tone:"connector",userId:p,title:se,company:ne}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(ze,{name:((Vs=s.picked)==null?void 0:Vs.name)||"Person B",photo:(Qs=s.picked)==null?void 0:Qs.photo,label:"Person B",tone:"target",userId:(Zs=s.picked)==null?void 0:Zs.userId,title:V(s.picked,W).title,company:V(s.picked,W).company})]})]}),t.jsxs("div",{className:"intro-picker-body",children:[!s.anchor&&t.jsxs("div",{className:"intro-picker-field",children:[t.jsx("div",{className:"intro-picker-lede",children:"Person A â who you're introducing"}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:s.activeSide==="from"?Be:"",onFocus:()=>D(e=>e&&{...e,activeSide:"from"}),onChange:e=>{D(n=>n&&{...n,activeSide:"from"}),De(e)},onAdd:({name:e,email:n})=>wn("from",e,n)})}),In("from")]}),t.jsxs("div",{className:"intro-picker-field",children:[t.jsx("div",{className:"intro-picker-lede",children:s.anchor?`Who should ${ge(s.anchor)} meet?`:"Person B â who they should meet"}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:s.activeSide==="to"?Be:"",onFocus:()=>D(e=>e&&{...e,activeSide:"to"}),onChange:e=>{D(n=>n&&{...n,activeSide:"to"}),De(e)},onAdd:({name:e,email:n})=>wn("to",e,n)})}),In("to")]})]}),t.jsxs("div",{className:"intro-picker-foot",children:[t.jsxs("button",{type:"button",className:"intro-picker-go",disabled:!s.anchor||!s.picked,onClick:ys,children:["Draft the emails",t.jsx("span",{"aria-hidden":"true",children:" â"})]}),t.jsx("span",{className:"intro-picker-note",children:"Nothing sends yet â you will see every email first."}),t.jsx("button",{type:"button",className:"intro-picker-cancel",onClick:ee,children:"Cancel"})]})]})}),s&&s.mode==="make"&&s.step==="compose"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal req-modal req-modal--wide make-intro-modal mynet-intro-sheet",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"mynet-sheet-top",children:[t.jsx("div",{className:"modal-head",children:t.jsxs("div",{children:[t.jsxs("div",{className:"req-step-kicker",children:[t.jsx("span",{children:"Step 2 of 2 · What Gem sends"}),t.jsx("span",{className:"req-step-kicker-note",children:s.optInMode==="disabled"?"Nothing sends yet":s.optInMode==="single"?"Single opt-in · Nothing sends yet":"Double opt-in · Nothing sends yet"})]}),t.jsx("div",{className:"mod-title",children:s.anchor&&s.picked?`Intro ${s.anchor.name} to ${s.picked.name}.`:"Make an intro."}),t.jsx("div",{className:"mod-sub",children:"Read every email before anything sends. Only the blurbs are yours to edit."})]})}),t.jsxs(yo,{children:[t.jsx($e,{name:((Xs=s.anchor)==null?void 0:Xs.name)||"Person A",photo:(Js=s.anchor)==null?void 0:Js.photo,role:V(s.anchor,W).title,company:V(s.anchor,W).company,kindLabel:"Person A",badge:"target",badgeLabel:"Person A",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx($e,{name:(r==null?void 0:r.fullName)||"You",photo:Z,role:se,company:ne,kindLabel:"Connector",badge:"you",badgeLabel:"Connector",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx($e,{name:((eo=s.picked)==null?void 0:eo.name)||"Person B",photo:(to=s.picked)==null?void 0:to.photo,role:V(s.picked,W).title,company:V(s.picked,W).company,kindLabel:"Person B",badge:"target",badgeLabel:"Person B",avatarTone:"green",compactName:!1})]}),t.jsx("button",{className:"mod-close mynet-sheet-close",onClick:ee,"aria-label":"Close",children:"Ã"})]}),t.jsxs("div",{className:"req-body",children:[s.anchor&&Tn(s.anchor,U(s.anchor))&&t.jsx(Mn,{personEmail
9:U(s.anchor),value:it[s.anchor.key]||"",onChange:e=>Ct(n=>({...n,[s.anchor.key]:e}))}),s.picked&&Tn(s.picked,U(s.picked))&&t.jsx(Mn,{personEmail:U(s.picked),value:it[s.picked.key]||"",onChange:e=>Ct(n=>({...n,[s.picked.key]:e}))}),s.anchor&&!(s.anchor.isGem&&s.anchor.userId>0)&&!s.anchor.email&&t.jsx(ko,{personName:s.anchor.name,value:It[s.anchor.key]||"",onChange:e=>rt(n=>({...n,[s.anchor.key]:e}))}),s.picked&&!(s.picked.isGem&&s.picked.userId>0)&&!s.picked.email&&t.jsx(ko,{personName:s.picked.name,value:It[s.picked.key]||"",onChange:e=>rt(n=>({...n,[s.picked.key]:e}))}),t.jsxs("div",{className:"intro-note-row",children:[t.jsxs("label",{className:"intro-note-lbl",htmlFor:"make-intro-note",children:["Why this intro? ",t.jsx("span",{className:"intro-note-optional",children:"optional"})]}),t.jsx("input",{id:"make-intro-note",className:"intro-note-input",type:"text",placeholder:"Context helps Gemphere draft both blurbs",value:s.note,onChange:e=>D(n=>n&&{...n,note:e.target.value}),disabled:oe})]}),s.anchor&&s.picked&&s.optInMode==="single"&&t.jsx(Mi,{parties:[{key:"from",name:ge(s.anchor),role:"Person A",isApprover:s.singleOptInFirstParty==="to"},{key:"connector",name:(r==null?void 0:r.fullName)||"You",role:"Connector"},{key:"to",name:ge(s.picked),role:"Person B",isApprover:s.singleOptInFirstParty==="from"}],singleOptInFirstParty:s.singleOptInFirstParty,onSelectFirstParty:e=>D(n=>n&&{...n,singleOptInFirstParty:e}),makerName:(r==null?void 0:r.fullName)||"You",fromName:K(s.anchor),toName:K(s.picked)}),s.anchor&&s.picked&&t.jsx("div",{className:"req-email req-email--split",children:s.optInMode==="single"?(()=>{const e=s.singleOptInFirstParty==="from"?s.picked:s.anchor,n=s.singleOptInFirstParty==="from"?s.email2Body:s.email1Body,a=s.singleOptInFirstParty==="from"?s.anchor:s.picked;return t.jsx(Pn,{title:`Email to ${jn(e)}`,meta:"Cc'd to all parties",recipientName:K(e),recipientEmail:U(e),otherName:K(a),otherEmail:U(a),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:n,onBlurbChange:o=>D(l=>l&&(s.singleOptInFirstParty==="from"?{...l,email2Body:o}:{...l,email1Body:o}))})})():t.jsxs(t.Fragment,{children:[t.jsx(Pn,{title:`1 · Email to ${jn(s.anchor)}`,meta:U(s.anchor)?r!=null&&r.email?"Cc'd to you":"Sends now":"Add their email above",recipientName:K(s.anchor),recipientEmail:U(s.anchor),otherName:K(s.picked),otherEmail:U(s.picked),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:s.email1Body,onBlurbChange:e=>D(n=>n&&{...n,email1Body:e})}),t.jsx(Pn,{title:`2 · Email to ${jn(s.picked)}`,meta:U(s.picked)?r!=null&&r.email?"Cc'd to you":"Sends now":"Add their email above",recipientName:K(s.picked),recipientEmail:U(s.picked),otherName:K(s.anchor),otherEmail:U(s.anchor),connectorName:(r==null?void 0:r.fullName)||"Me",blurb:s.email2Body,onBlurbChange:e=>D(n=>n&&{...n,email2Body:e})})]})}),xt&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:xt}),wt&&t.jsx("div",{className:"info-banner",style:{background:"#E1F5EE",borderColor:"#9FE1CB",color:"#0F6E56",marginBottom:0,marginTop:12},children:wt})]}),t.jsx(Ml,{mode:s.optInMode,onChange:e=>D(n=>n&&{...n,optInMode:e}),disabled:oe}),t.jsxs("div",{className:"modal-foot req-modal-foot--steps",children:[t.jsx("button",{className:"btn-foot primary",onClick:xs,disabled:oe||!s.picked||!s.anchor,children:oe?"Sendingâ¦":s.optInMode==="disabled"?"Connect now":"Send intro"}),t.jsx("button",{type:"button",className:"btn-foot req-foot-back",onClick:ks,disabled:oe,children:"â Back"}),s.optInMode!=="disabled"&&s.anchor&&s.picked?t.jsxs("span",{className:"req-foot-note",children:["Neither ",ge(s.anchor)," nor"," ",ge(s.picked)," is connected until they opt in."]}):null,t.jsx("button",{className:"btn-foot req-foot-cancel",onClick:ee,disabled:oe,children:"Cancel"})]})]})}),k&&k.mode==="view"&&(()=>{const e=k.anchor;return t.jsx(Pi,{open:!0,onClose:Ot,userId:k.anchor.userId,fallbackName:k.anchor.name,fallbackPhoto:k.anchor.photo??null,fallbackRole:k.anchor.roleKind,mode:"view",fallbackEmail:k.anchor.email??null,fallbackLinkedinUrl:e.linkedinUrl??null,fallbackTitle:e.title??null,fallbackLocation:e.location??null,fallbackCompanyName:e.companyName??null,fallbackCompanyWebsite:e.companyWebsite??null})})(),k&&k.mode==="request"&&t.jsx("div",{className:"slide-panel-overlay open",onClick:Ot,children:t.jsxs("div",{className:"slide-panel",onClick:e=>e.stopPropagation(),style:{maxWidth:620},children:[t.jsx("button",{className:"sp-close",onClick:Ot,children:"Ã"}),t.jsxs("div",{className:"sp-body",children:[t.jsxs("div",{className:"sp-header",children:[(no=k.profile)!=null&&no.photo||k.anchor.photo?t.jsx("img",{src:((ao=k.profile)==null?void 0:ao.photo)||k.anchor.photo,alt:"",className:"sp-avatar",style:{objectFit:"cover"}}):t.jsx("div",{className:"sp-avatar",style:{background:"#FAEEDA",color:"#8a5a10"},children:ye(k.anchor.name)}),t.jsxs("div",{className:"sp-header-info",children:[t.jsx("div",{className:"sp-name",children:((so=k.profile)==null?void 0:so.fullname)||k.anchor.name}),t.jsx("div",{className:"sp-role",children:(()=>{const e=k.profile,n=(e==null?void 0:e.title)||"",a=(e==null?void 0:e.fundName)||(e==null?void 0:e.companyName)||"";
9return[n,a].filter(Boolean).join(" · ")||k.anchor.role||W(k.anchor.roleKind)})()}),((oo=k.profile)==null?void 0:oo.linkedinUrl)&&t.jsxs("a",{href:k.profile.linkedinUrl.startsWith("http")?k.profile.linkedinUrl:`https://www.linkedin.com/in/${k.profile.linkedinUrl}`,target:"_blank",rel:"noopener noreferrer",className:"sp-linkedin",children:["â"," ",k.profile.linkedinUrl.replace(/^https?:\/\//,"").replace(/^www\./,"")]})]})]}),t.jsx("div",{className:"sp-sec-lbl",children:"PROFILE & INTEL"}),k.profileLoading?t.jsx(Ie,{variant:"inline",message:"Loading profileâ¦"}):(()=>{const e=k.profile,n=k.anchor,a=(e==null?void 0:e.role)??k.anchor.roleKind,o=[];o.push(["Role",W(a)]);const l=(e==null?void 0:e.title)||n.title;l&&o.push(["Title",l]),a===2&&(e!=null&&e.fundName)&&o.push(["Fund",e.fundName]);const m=(a!==2?e==null?void 0:e.companyName:null)||n.companyName;m&&o.push(["Company",m]),n.companyWebsite&&o.push(["Website",n.companyWebsite]),e!=null&&e.sector&&o.push(["Sectors",e.sector]),a===2&&(e!=null&&e.checkSize)&&o.push(["Initial Check Size",e.checkSize]),e!=null&&e.school&&o.push(["Education",e.school]),e!=null&&e.experience&&o.push(["Experience",e.experience]);const u=(e==null?void 0:e.location)||n.location;u&&o.push(["Location",u]);const f=(e==null?void 0:e.email)||k.anchor.email||null;f&&o.push(["Email",f]);const g=(e==null?void 0:e.linkedinUrl)||n.linkedinUrl;return g&&o.push(["LinkedIn",g]),t.jsx("div",{className:"sp-intel",children:o.map(([x,w])=>t.jsxs("div",{className:"sp-intel-row",children:[t.jsx("span",{className:"sp-intel-key",children:x}),t.jsx("span",{className:"sp-intel-val",style:{textAlign:"right",maxWidth:"65%",wordBreak:"break-word"},children:x==="LinkedIn"||x==="Website"?t.jsx("a",{href:w.startsWith("http")?w:`https://${w}`,target:"_blank",rel:"noopener noreferrer",style:{color:"#0F6E56",textDecoration:"underline"},children:w}):w})]},x))})})(),!k.profileLoading&&k.profile&&(()=>{const e=k.profile,a=(e.role??k.anchor.roleKind)===2?[...e.commonAdvice?[["COMMON ADVICE",e.commonAdvice]]:[],...e.whatThey?[["WHAT I LOOK FOR IN A FOUNDER",e.whatThey]]:[],...e.favPitchStyle?[["FAVOURITE QUOTE",e.favPitchStyle]]:[]]:[...e.companyOverview?[["COMPANY OVERVIEW",e.companyOverview]]:[],...e.traction?[["TRACTION",e.traction]]:[],...e.superpower?[["SUPERPOWER",e.superpower]]:[],...e.why?[["WHY WE BUILD THIS",e.why]]:[]];return a.length===0?null:t.jsx(t.Fragment,{children:a.map(([o,l])=>t.jsxs("div",{children:[t.jsx("div",{className:"sp-sec-lbl",children:o}),t.jsx("div",{className:"sp-why-fits",style:{whiteSpace:"pre-wrap"},children:l})]},o))})})(),k.mode==="request"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sp-sec-lbl",children:[t.jsx("span",{className:"sp-lbl-icon",children:"â¡"}),"WARM INTRO PATHS",!k.peopleLoading&&t.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"#aaa",fontWeight:600},children:[k.people.length," in ",We(k.anchor.name),"'s network"]})]}),t.jsxs("div",{className:"search-box",style:{marginBottom:10},children:[t.jsx("span",{className:"search-ico",children:"ð"}),t.jsx("input",{type:"text",placeholder:`Search ${We(k.anchor.name)}'s networkâ¦`,value:k.search,onChange:e=>Le(n=>n&&{...n,search:e.target.value})})]}),k.peopleLoading?t.jsx(Ie,{variant:"section",message:"Loading warm intro pathsâ¦"}):k.peopleError?t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:k.peopleError}):k.search.trim()?k.people.length===0?t.jsxs("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12},children:["No people in ",We(k.anchor.name),"'s network."]}):gs.length===0?t.jsx("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12},children:"No matches â try a different search."}):t.jsx("div",{className:"sp-team",children:gs.slice(0,200).map(e=>t.jsxs("div",{className:"sp-team-row",children:[e.photo?t.jsx("img",{src:e.photo,alt:"",className:`av sm ${Co(e.userId||0)} no-border`,style:{objectFit:"cover"}}):t.jsx("div",{className:`av sm ${Co(e.userId||0)} no-border`,children:ye(e.name)}),t.jsxs("div",{className:"sp-team-info",children:[t.jsx("div",{className:"sp-team-name",children:e.name}),t.jsx("div",{className:"sp-team-role",children:e.role})]}),t.jsxs("button",{className:"sp-team-btn",onClick:()=>Fr(e),children:[t.jsx("span",{children:"ð¤"}),"Ask ",We(k.anchor.name)," for intro"]})]},e.key))}):t.jsxs("div",{style:{padding:20,textAlign:"center",color:"#aaa",fontSize:12}
9,children:["Start typing a name to search ",We(k.anchor.name),"'s network."]})]})]})]})}),s&&s.mode==="request"&&s.anchor&&s.step==="pick"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal intro-picker",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"intro-picker-head",children:[t.jsxs("div",{className:"intro-picker-kicker",children:[t.jsx("span",{children:"Step 1 of 2 · Who to reach"}),t.jsx("span",{className:"intro-picker-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsx("button",{className:"mod-close intro-picker-close",onClick:ee,"aria-label":"Close",children:"Ã"}),t.jsxs("h2",{className:"intro-picker-title",children:["Request an intro via ",s.anchor.name,"."]}),t.jsxs("div",{className:"intro-picker-chain",children:[t.jsx(ze,{name:(r==null?void 0:r.fullName)||"You",photo:Z,label:"Asker",tone:"asker",userId:p,title:se,company:ne}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(ze,{name:s.anchor.name,photo:s.anchor.photo,label:"Connector",tone:"connector",userId:s.anchor.userId,title:V(s.anchor,W).title,company:V(s.anchor,W).company}),t.jsx("span",{className:"intro-pick-link","aria-hidden":"true"}),t.jsx(ze,{name:((ro=s.picked)==null?void 0:ro.name)||"Target",photo:(io=s.picked)==null?void 0:io.photo,label:"Target",tone:"target",userId:(lo=s.picked)==null?void 0:lo.userId,title:V(s.picked,W).title,company:V(s.picked,W).company})]})]}),t.jsxs("div",{className:"intro-picker-body",children:[t.jsxs("div",{className:"intro-picker-lede",children:["Search ",ge(s.anchor),"'s network and pick who you want to meet"]}),t.jsx("div",{className:"intro-picker-search",children:t.jsx(En,{value:Be,onChange:De,onAdd:({name:e,email:n})=>wn("to",e,n)})}),In("to")]}),t.jsxs("div",{className:"intro-picker-foot",children:[t.jsxs("button",{type:"button",className:"intro-picker-go",disabled:!s.picked,onClick:ys,children:["Draft the emails",t.jsx("span",{"aria-hidden":"true",children:" â"})]}),t.jsx("span",{className:"intro-picker-note",children:"Nothing sends yet â you will see both emails first."}),t.jsx("button",{type:"button",className:"intro-picker-cancel",onClick:ee,children:"Cancel"})]})]})}),s&&s.mode==="request"&&s.anchor&&s.picked&&s.step==="compose"&&t.jsx("div",{className:"modal-overlay open request-intro-portal",onClick:ee,role:"presentation",children:t.jsxs("div",{className:"modal req-modal req-modal--wide",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"req-step-kicker",children:[t.jsx("span",{children:"Step 2 of 2 · What Gem sends"}),t.jsx("span",{className:"req-step-kicker-note",children:"Double opt-in · Nothing sends yet"})]}),t.jsxs("div",{className:"mod-title",children:["Request an intro to ",s.picked.name,"."]}),t.jsx("div",{className:"mod-sub"})]}),t.jsx("button",{className:"mod-close",onClick:ee,"aria-label":"Close",children:"Ã"})]}),t.jsxs(yo,{children:[t.jsx($e,{name:(r==null?void 0:r.fullName)||"You",photo:Z,role:se,company:ne,badge:"you",badgeLabel:"Asker",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx($e,{name:s.anchor.name,photo:s.anchor.photo,role:V(s.anchor,W).title,company:V(s.anchor,W).company,kindLabel:"Connector",badge:"connector",badgeLabel:"Connector",avatarTone:"green",compactName:!1}),t.jsx(Yt,{}),t.jsx($e,{name:s.picked.name,photo:s.picked.photo,role:V(s.picked,W).title,company:V(s.picked,W).company,kindLabel:"Target",badge:"target",badgeLabel:"Target",avatarTone:"green",compactName:!1})]}),t.jsxs("div",{className:"req-body",children:[Tn(s.picked,U(s.picked))&&t.jsx(Mn,{personEmail:U(s.picked),value:it[s.picked.key]||"",onChange:e=>Ct(n=>({...n,[s.picked.key]:e}))}),t.jsxs("div",{className:"req-sec-lbl",children:["What Gem sends",t.jsxs("span",{className:"req-sec-note",children:["Two emails. The second only exists if"," ",ge(s.anchor)," says yes."]})]}),t.jsx(Ai,{connectorName:K(s.anchor),connectorEmail:U(s.anchor),...U(s.anchor)?{}:{onConnectorEmailChange:e=>rt(n=>({...n,[s.anchor.key]:e}))},askerName:(r==null?void 0:r.fullName)||"Me",askerEmail:r==null?void 0:r.email,targetName:K(s.picked),targetEmail:U(s.picked),...U(s.picked)?{}:{onTargetEmailChange:e=>rt(n=>({...n,[s.picked.key]:e}))},blurb:s.email2Body,meta:`${r!=null&&r.email?" - copy sent to you":""}`,onBlurbChange:e=>D(n=>n&&{...n,email2Body:e}),layout:"split",disabled:oe}),xt&&t.jsx("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a",marginBottom:0,marginTop:12},children:xt}),wt&&t.jsx("div",{className:"info-banner",style:{background:"#E1F5EE",borderColor:"#9FE1CB",color:"#0F6E56",marginBottom:0,marginTop:12},children:wt})]}),t.jsxs("div",{className:"modal-foot req-modal-foot--steps",children:[t.jsx("button",{className:"btn-foot primary",onClick:xs,disabled:oe,children:oe?"Sendingâ¦":`Send to ${ge(s.anchor)}`}),t.jsx("button",{type:"button",className:"btn-foot req-foot-back",onClick:ks,disabled:oe,children:"â Back"}),t.jsxs("span",{className:"req-foot-note",children:[s.picked.name," hears nothing until"," ",ge(s.anchor)," accepts."]}),t.jsx("button",{className:"btn-foot req-foot-cancel",onClick:ee,disabled:oe,children:"Cancel"})]})]})}),Se&&t.jsx("div",{className:"modal-overlay open",onClick:()=>{Je||Xe(null)},children:t.jsxs("div",{className:"modal",onClick:e=>e.stopPropagation(),style:{maxWidth:420},children:[t.jsxs("div",{className:"modal-head",children:[t.jsxs("div",{children:[t.jsx("div",{className:"mod-title",children:"Send invitation again?"}),t.jsxs("div",{className:"mod-sub",children:["An invitation already exists for ",Se.email,"."]})]}),t.jsx("button",{className:"mod-close",onClick:()=>Xe(null),disabled:Je,children:"Ã"})]}),t.jsx("div",{className:"modal-body",children:t.jsx("p",{style:{margin:0,color:"#5f5a4f",fontSize:14,lineHeight:1.5},children:"Do you want to send the same invitation email again?"})}),t.jsxs("div",{className:"modal-foot",children:[t.jsx("button",{className:"btn-foot",onClick:()=>Xe(null),disabled:Je,children:"Cancel"}),t.jsx("button",{className:"btn-foot primary",onClick:Lr,disabled:Je,children:Je?"Sendingâ¦":"Send again"})]})]})}),t.jsx(Qi,{open:Sa!=null,contactUserId:Sa,prefill:ur??void 0,onClose:()=>{La(null),Ea(null)},onSent:e=>{La(null),Ea(null),qa(e)}}),t.jsx(tl,{open:Ta!=null||Pa!=null,contactUserId:Ta,contactImportId:Pa,prefill:hr??void 0,onClose:()=>{Ma(null),Aa(null),Ra(null)},onScheduled:e=>{Ma(null),Aa(null),Ra(null),qa(e)}}),t.jsx(nl,{open:Fa!=null||Ua!=null,contactUserId:Fa,contactImportId:Ua,prefill:pr??void 0,onClose:()=>{fn(null),gn(null),yn(null)},onMuted:(e,n)=>{fn(null),gn(null),yn(null),yr(e,n)}}),t.jsx(yl,{open:Hn!=null,contact:Hn,onClose:()=>yt(null),onSaved:jr}),t.jsx(Zi,{open:A!=null,name:(A==null?void 0:A.name)||"",email:A==null?void 0:A.email,fromRequestIntro:A==null?void 0:A.fromRequestIntro,onEmailChange:e=>{_e(n=>n?{...n,email:e,mode:e.trim()?"send":"no_email"}:null)},mode:((A==null?void 0:A.email)||"").trim()?"send":(A==null?void 0:A.mode)||"no_email",inviterName:(r==null?void 0:r.fullName)||"You",personalNote:Ze,onPersonalNoteChange:Vn,sending:Qn||On===(A==null?void 0:A.contactId),onClose:()=>{Qn||_e(null)},onSendInvite:Cr,onEditProfile:()=>{const e=A==null?void 0:A.contactId;_e(null),e&&br(e)}}),t.jsx(sl,{open:ve!=null||Qo,initialEmail:(ve==null?void 0:ve.email)||"",initialName:(ve==null?void 0:ve.name)||"",quota:Ue,onClose:()=>{Kn(null),nn(!1)},onSent:e=>{if(ve){xr(e);return}nn(!1),Te(),j("Connector request sent."),setTimeout(()=>j(null),3e3)}}),t.jsx(ol,{open:Zo,onClose:()=>an(!1),onSent:e=>{an(!1),j(`Sent ${e} invite${e===1?"":"s"}`),setTimeout(()=>j(null),3e3)}}),ga&&t.jsx("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:"#2a2820",color:"#fff",padding:"12px 22px",borderRadius:10,fontSize:13,fontWeight:600,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",zIndex:300},children:ga}),P&&t.jsx("div",{role:"dialog","aria-modal":"true",onClick:()=>tt(null),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:400,padding:16},children:t.jsxs("div",{onClick:e=>e.stopPropagation(),style:{background:"#fff",borderRadius:14,width:"min(560px, 100%)",maxHeight:"85vh",overflow:"auto",boxShadow:"0 24px 48px rgba(0,0,0,0.25)"},children:[t.jsxs("div",{style:{padding:"18px 22px",borderBottom:"1px solid #eee",display:"flex",alignItems:"flex-start",ga
9p:12},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:11,color:"#888",textTransform:"uppercase",letterSpacing:.5},children:"Relationship · powered by your calendar"}),t.jsxs("div",{style:{fontSize:18,fontWeight:700,color:"#1a1a1a",marginTop:2},children:["You & ",P.name]}),t.jsx("div",{style:{fontSize:12,color:"#666",marginTop:2},children:P.email})]}),t.jsx("button",{type:"button",onClick:()=>tt(null),"aria-label":"Close",style:{background:"transparent",border:"none",fontSize:22,color:"#888",cursor:"pointer",lineHeight:1},children:"Ã"})]}),t.jsxs("div",{style:{padding:"10px 22px",borderBottom:"1px solid #eee",background:"#faf8f1",display:"flex",flexWrap:"wrap",alignItems:"center",gap:6},children:[t.jsx("span",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginRight:4},children:"Window:"}),[{id:"1mo",label:"1 mo"},{id:"3mo",label:"3 mo"},{id:"6mo",label:"6 mo"},{id:"12mo",label:"12 mo"},{id:"24mo",label:"2 yr"},{id:"all",label:"All time"}].map(e=>{const n=P.range===e.id;return t.jsx("button",{type:"button",onClick:()=>kr(P.email,P.name,e.id),disabled:P.loading,style:{padding:"4px 10px",borderRadius:999,fontSize:11,fontWeight:600,cursor:P.loading?"wait":"pointer",background:n?"#0F6E56":"#fff",color:n?"#fff":"#1a1a1a",border:n?"1px solid #0F6E56":"1px solid #d8d2c2",transition:"background 0.12s, color 0.12s"},children:e.label},e.id)}),P.loading&&t.jsx("span",{style:{fontSize:11,color:"#888",marginLeft:6},children:"Loadingâ¦"})]}),t.jsx("div",{style:{padding:"14px 22px"},children:(()=>{const e=F[P.email.toLowerCase()]||null,n=(e==null?void 0:e.sentCount)||0,a=(e==null?void 0:e.receivedCount)||0,o=n+a,l=(()=>{const f=e!=null&&e.lastSentAt?new Date(e.lastSentAt).getTime():0,g=e!=null&&e.lastReceivedAt?new Date(e.lastReceivedAt).getTime():0,x=Math.max(f,g);return x?new Date(x).toISOString():null})(),m=o>0,u=!P.loading&&!P.error&&P.totalMeetings===0&&!m;return t.jsx(t.Fragment,{children:P.loading?t.jsx(Ie,{variant:"section",message:"Loading relationship historyâ¦"}):P.error?t.jsxs("div",{className:"info-banner",style:{background:"#fdecea",borderColor:"#f3c3bb",color:"#9a3a2a"},children:[t.jsx("strong",{children:"Couldn't load meetings:"})," ",P.error]}):u?t.jsx("div",{style:{padding:20,textAlign:"center",color:"#666",fontSize:13},children:"No emails or calendar meetings between you in this window. Try widening the range above."}):t.jsxs(t.Fragment,{children:[m&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"Email exchange · last 90 days"}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:8,marginBottom:14},children:[t.jsxs("div",{style:{background:"#eef3fb",border:"1px solid #cdddf3",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#2d4a7a",textTransform:"uppercase",letterSpacing:.5},children:"You sent"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2},children:n.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:e!=null&&e.lastSentAt?`Last ${Rn(e.lastSentAt)}`:"â"})]}),t.jsxs("div",{style:{background:"#eef3fb",border:"1px solid #cdddf3",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#2d4a7a",textTransform:"uppercase",letterSpacing:.5},children:"They sent"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2},children:a.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:e!=null&&e.lastReceivedAt?`Last ${Rn(e.lastReceivedAt)}`:"â"})]}),t.jsxs("div",{style:{background:"#f7f3e8",border:"1px solid #ece4cf",borderRadius:10,padding:"10px 12px"},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:"#7a6628",textTransform:"uppercase",letterSpacing:.5},children:"Total · last touch"}),t.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1a1a1a",marginTop:2}
9,children:o.toLocaleString()}),t.jsx("div",{style:{fontSize:11,color:"#666",marginTop:2},children:l?Rn(l):"â"})]})]})]}),P.totalMeetings>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{background:"#f7f3e8",border:"1px solid #ece4cf",borderRadius:10,padding:"10px 14px",marginBottom:14,fontSize:13,color:"#333"},children:[t.jsxs("strong",{style:{color:"#0F6E56"},children:[Tl(P.totalMeetings)," on the calendar"]})," ","across ",P.months.length," month",P.months.length===1?"":"s"," ·"," ",t.jsx("span",{style:{color:"#7a6628"},children:P.range==="all"?"all time":P.range==="1mo"?"last 30 days":P.range==="3mo"?"last 3 months":P.range==="6mo"?"last 6 months":P.range==="24mo"?"last 2 years":"last 12 months"}),"."]}),t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"By month"}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:18},children:P.months.slice().reverse().map(f=>{const[g,x]=f.year_month.split("-"),w=new Date(Number(g),Number(x)-1,1).toLocaleDateString(void 0,{month:"long",year:"numeric"});return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,padding:"8px 12px",background:"#fafaf6",border:"1px solid #ece4cf",borderRadius:8},children:[t.jsx("div",{style:{flex:"0 0 130px",fontSize:13,fontWeight:600,color:"#1a1a1a"},children:w}),t.jsxs("div",{style:{flex:"0 0 auto",fontSize:13,fontWeight:700,color:"#0F6E56"},children:[f.meeting_count,"Ã"]}),t.jsx("div",{style:{flex:1,fontSize:11,color:"#777",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.days.map(L=>Ao(L)).join(" · ")})]},f.year_month)})}),P.recent.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#888",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:"Recent meetings"}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:P.recent.slice(-30).reverse().map((f,g)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderBottom:"1px solid #f1ece0",opacity:f.status==="cancelled"?.55:1},children:[t.jsx("div",{style:{flex:"0 0 110px",fontSize:12,color:"#1a1a1a",fontWeight:600},children:Ao(f.start_at)}),t.jsx("div",{style:{flex:1,fontSize:12,color:"#444",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.event_title||"(untitled meeting)"}),f.status==="cancelled"&&t.jsx("div",{style:{fontSize:10,color:"#a94442",fontWeight:700,textTransform:"uppercase"},children:"Cancelled"})]},`${f.start_at}-${g}`))})]})]})]})})})()})]})})]})}export{oc 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.