PageSourceSearch

https://thetool.company/_next/static/chunks/2a-t85a_zzd3l.js

js thetool.company collected 2026-10-02 01:55:38 UTC 71,855 bytes, 19 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,418174,259987,e=>{"use strict";var t=e.i(843476),s=e.i(271645),n=e.i(65373),a=e.i(436648),i=e.i(941388),l=e.i(846696),r=e.i(167881),o=e.i(127341),d=e.i(607486),c=e.i(221345),p=e.i(346897),m=e.i(541071),u=e.i(788699),x=e.i(416788),g=e.i(362597),h=e.i(185480),f=e.i(475311),j=e.i(970065),b=e.i(994179),y=e.i(625959),v=e.i(373264),N=e.i(370956),w=e.i(513744),C=e.i(647163);let _=["table","gallery","org"],k=[{value:"table",label:"Table view",Icon:N.List},{value:"gallery",label:"Gallery view",Icon:v.LayoutGrid},{value:"org",label:"Org chart view",Icon:w.OrgChartIcon}];function S({view:e,onChange:s,className:n}){return(0,t.jsx)("div",{className:(0,C.cn)("inline-flex items-center rounded-full bg-muted p-1",n),children:k.map(({value:n,label:a,Icon:i})=>(0,t.jsx)("button",{type:"button","aria-label":a,onClick:()=>s(n),className:(0,C.cn)("inline-flex items-center justify-center rounded-full px-2.5 py-1.5 transition-colors",e===n?"bg-white dark:bg-background text-foreground font-medium":"text-muted-foreground hover:text-foreground"),children:(0,t.jsx)(i,{className:"h-3.5 w-3.5"})},n))})}var T=e.i(154548),D=e.i(30590),P=e.i(306519),E=e.i(425063),M=e.i(975558),z=e.i(595468),$=e.i(664659),A=e.i(463059),I=e.i(784529),B=e.i(975),O=e.i(32095),F=e.i(852008),L=e.i(398361),R=e.i(299023),H=e.i(620278),G=e.i(463415);let U=["Bootstrapped","Seed","Series A","Series B","Series C","Growth","Public"],V=["IC","Manager","Director","VP","C-Suite"],W=["Sales","Marketing","Customer Success","Support","Product","Engineering","Design","Data / Analytics","Operations","RevOps","Finance","Legal","HR / People","IT / Security","Executive"],K={champion:{label:"Champion",short:"Build a champion",classes:"bg-[#EAD8E5] text-foreground/80 dark:bg-[#4A2D43] dark:text-foreground/90"},meeting:{label:"First meeting",short:"Book a first meeting",classes:"bg-[#DCE8F0] text-foreground/80 dark:bg-[#2C4255] dark:text-foreground/90"},intel:{label:"Intel",short:"Gather intel",classes:"bg-[#F5EBC8] text-foreground/80 dark:bg-[#5A4F2A] dark:text-foreground/90"},buying_approval:{label:"Buying approval",short:"Get sign-off",classes:"bg-[#FBE4D8] text-foreground/80 dark:bg-[#5C3F32] dark:text-foreground/90"},it_approval:{label:"IT / Security",short:"Pass IT review",classes:"bg-[#F5D5CE] text-foreground/80 dark:bg-[#5C3530] dark:text-foreground/90"},influence:{label:"Influence",short:"Build awareness",classes:"bg-[#D5E5E5] text-foreground/80 dark:bg-[#2A4647] dark:text-foreground/90"},reference:{label:"Reference",short:"Get an intro / reference",classes:"bg-[#DCEAD8] text-foreground/80 dark:bg-[#2F4730] dark:text-foreground/90"},custom:{label:"Custom",short:"Custom goal",classes:"bg-foreground
1/[0.06] text-foreground/60"}},J=["champion","meeting","intel","buying_approval","it_approval","influence","reference","custom"],q={1:{label:"Tier 1",classes:"bg-[#E4DFD2] text-foreground/80 dark:bg-[#3A3733] dark:text-foreground/90",ring:"ring-[#E4DFD2] dark:ring-[#3A3733]"},2:{label:"Tier 2",classes:"bg-[#EEEBE5] text-foreground/70 dark:bg-[#2E2C29] dark:text-foreground/80",ring:"ring-[#EEEBE5] dark:ring-[#2E2C29]"},3:{label:"Tier 3",classes:"bg-foreground/[0.04] text-foreground/55 dark:bg-foreground/[0.08]",ring:"ring-foreground/10"}},Y={above:{label:"Above",short:"Above the line",classes:"bg-[#DCE8F0] text-foreground/80 dark:bg-[#2C4255] dark:text-foreground/90"},target:{label:"Target",short:"Target level",classes:"bg-[#DCEAD8] text-foreground/80 dark:bg-[#2F4730] dark:text-foreground/90"},below:{label:"Below",short:"Below the line",classes:"bg-foreground/[0.06] text-foreground/60"}},X=["above","target","below"];e.s(["DEPARTMENT_OPTIONS",0,W,"EXAMPLE_COMPANY_SEEDS",0,[{name:"Mid-Market SaaS",tier:1,description:"Series B–C product-led SaaS with an established sales motion and a real RevOps function.",industries:["B2B SaaS","Sales Tech"],company_size_min:100,company_size_max:500,revenue_range:"$10M–$50M ARR",funding_stages:["Series B","Series C"],geographies:["United States","Canada","United Kingdom"],tech_stack_signals:["Salesforce","HubSpot","Outreach"],keywords:["outbound","pipeline generation","sales engagement"],exclusions:["agencies","consultancies"]},{name:"Growth-Stage FinTech",tier:2,description:"Series C+ fintech with a US sales team and a complex compliance buyer.",industries:["Fintech"],company_size_min:250,company_
1size_max:2e3,revenue_range:"$50M–$200M ARR",funding_stages:["Series C","Growth"],geographies:["United States","United Kingdom"],tech_stack_signals:["Salesforce","Snowflake"],keywords:["compliance","underwriting","risk"],exclusions:["crypto exchanges"]}],"EXAMPLE_PERSONA_SEEDS",0,[{name:"VP of Sales",tier:1,org_position:"above",goal:"meeting",titles:["VP of Sales","Head of Sales","CRO","SVP Sales"],departments:["Sales","Executive"],seniority_levels:["VP","C-Suite"],responsibilities:"Number, hiring, forecast, exec reporting.",pain_points:["Pipeline coverage","Rep ramp time","Forecast accuracy"],messaging_angle:"Pipeline-to-revenue in one tool, less SDR sprawl."},{name:"RevOps Lead",tier:1,org_position:"target",goal:"champion",titles:["Head of RevOps","Director of RevOps","Sales Operations Manager"],departments:["RevOps","Operations"],seniority_levels:["Manager","Director"],responsibilities:"Tooling, data hygiene, reporting, workflow.",pain_points:["Stale data","Tool sprawl","Manual sequences"],messaging_angle:"One source of truth + APIs they can build on."},{name:"IT / Security Reviewer",tier:3,org_position:"below",goal:"it_approval",titles:["IT Manager","Security Engineer","CISO"],departments:["IT / Security"],seniority_levels:["Manager","Director","VP","C-Suite"],responsibilities:"Vendor review, SOC2, SSO, data residency.",pain_points:["Long security reviews","Vendor sprawl","Audit prep"],messaging_angle:"SOC2 / SSO out-of-the-box, short security questionnaire."}],"FUNDING_STAGE_OPTIONS",0,U,"ORG_POSITION_META",0,Y,"ORG_POSITION_VALUES",0,X,"PERSONA_GOAL_META",0,K,"PERSONA_GOAL_VALUES",0,J,"SENIORITY_LEVEL_OPTIONS",0,V,"TIER_META",0,q],259987);let Z=[1,2,3];function Q(e){return e.profile.id}function ee(e){return e.profile.tier}function et({children:e,onClick:s,highlight:n,height:a}){return(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)(T.Handle,{type:"target",position:D.Position.Top,className:"!bg-foreground
1/40 !w-2.5 !h-2.5 !border-2 !border-card !-top-[5px]"}),(0,t.jsx)("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?e=>{"Enter"===e.key&&s()}:void 0,className:(0,C.cn)("rounded-[20px] select-none p-4 text-left flex flex-col","transition-all duration-200 ease-out","border border-card-border bg-[var(--muted)]","hover:border-foreground/15",s&&"cursor-pointer",n&&"border-foreground/20"),style:{width:320,height:a},children:e}),(0,t.jsx)(T.Handle,{type:"source",position:D.Position.Bottom,className:"!bg-foreground/40 !w-2.5 !h-2.5 !border-2 !border-card !-bottom-[5px]"})]})}function es({value:e,onSave:n}){let[a,i]=(0,s.useState)(!1),[l,r]=(0,s.useState)(e);return((0,s.useEffect)(()=>r(e),[e]),a)?(0,t.jsx)("input",{autoFocus:!0,type:"text",value:l,onChange:e=>r(e.target.value),onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key?t.target.blur():"Escape"===t.key&&(r(e),i(!1)),t.stopPropagation()},onBlur:()=>{let t=l.trim();t&&t!==e&&n(t),i(!1)},className:"text-[14px] font-semibold bg-transparent border-b border-foreground
1/30 outline-none w-full"}):(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),i(!0)},className:"text-[14px] font-semibold truncate hover:underline decoration-foreground/20 underline-offset-2 text-left w-full",children:e||"Untitled"})}function en({tier:e,onSelect:s}){let n=q[e];return(0,t.jsxs)(G.DropdownMenu,{children:[(0,t.jsx)(G.DropdownMenuTrigger,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,t.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),className:(0,C.cn)("shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium hover:opacity-80",n.classes),children:n.label})}),(0,t.jsx)(G.DropdownMenuContent,{align:"end",onClick:e=>e.stopPropagation(),children:Z.map(n=>(0,t.jsxs)(G.DropdownMenuItem,{onSelect:()=>s(n),className:"text-xs",children:[(0,t.jsx)("span",{className:(0,C.cn)("mr-2 inline-flex items-center rounded-full px-1.5 py-0 text-[10px] font-medium",q[n].classes),children:q[n].label}),1===n?"Highest priority":2===n?"Solid fit":"Long tail",n===e&&(0,t.jsx)(z.CheckCircle2,{className:"ml-auto size-3 text-foreground/50"})]},n))})]})}function ea({position:e,onChange:s}){let n=Y[e],a="above"===e?M.ArrowUp:"target"===e?I.CircleDot:E.ArrowDown;return(0,t.jsxs)("button",{type:"button",onClick:t=>{let n;t.stopPropagation(),n=X.indexOf(e),s(X[(n+1)%X.length])},onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),title:"Click to cycle Above / Target / Below",className:(0,C.cn)("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium hover:opacity-80",n.classes),children:[(0,t.jsx)(a,{className:"size-3"}),n.label]})}function ei({data:e}){var s,n;let{item:a,onOpen:i,onTierChange:l,onNameChange:r}=e,o=a.profile,c=(s=o.company_size_min,n=o.company_size_max,null==s&&null==n?"":null!=s&&null!=n?`${ec(s)}–${ec(n)}`:null!=s?`${ec(s)}+`:null!=n?`≤${ec(n)}`:"");return(0,t.jsxs)("div",{className:"flex flex-col h-full gap-2 text-[12px]",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(es,{value:o.name,onSave:r}),o.description&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-muted-foreground line-clamp-2",children:o.description})]}),(0,t.jsx)(en,{tier:o.tier,onSelect:l})]}),o.industries.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[o.industries.slice(0,3).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),o.industries.length>3&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",o.industries.length-3]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[c&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(x.PeopleGroupIcon,{className:"size-3"}),c]}),o.geographies[0]&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(H.Target,{className:"size-3"}),o.geographies[0],o.geographies.length>1&&(0,t.jsxs)("span",{className:"opacity-60",children:[" +",o.geographies.length-1]})]}),o.funding_stages.length>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(F.Layers,{className:"size-3"}),o.funding_stages.slice(0,2).join(", "),o.funding_stages.length>2&&(0,t.jsxs)("span",{className:"opacity-60",children:[" +",o.funding_stages.length-2]})]})]}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2 pt-2 border-t border-card-border/50 text-[11px]",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,t.jsx)(d.Building2,{className:"size-3"}),"number"==typeof a.matchCount?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:a.matchCount})," matches"]}):"No matches yet"]}),(0,t.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),i()},onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),className:"text-[10px] text-muted-foreground hover:text-foreground",children:["Score ",(0,t.jsx)("span",{className:"font-medium text-foreground tabular-nums",children:o.score})," · ","Edit ↗"]})]})]})}function el({data:e}){let{item:s,onOpen:n,onTierChange:a,onNameChange:i,onPositionChange:l}=e,r=s.profile,o=K[r.goal],c=r.linked_company_profile_ids.map(e=>
1s.companyById[e]).filter(Boolean);return(0,t.jsxs)("div",{className:"flex flex-col h-full gap-2 text-[12px]",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(es,{value:r.name,onSave:i}),(0,t.jsx)("div",{className:"mt-0.5 flex items-center gap-1.5",children:l&&(0,t.jsx)(ea,{position:r.org_position,onChange:l})})]}),(0,t.jsx)(en,{tier:r.tier,onSelect:a})]}),r.titles.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[r.titles.slice(0,4).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),r.titles.length>4&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",r.titles.length-4]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[r.departments.length>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(x.PeopleGroupIcon,{className:"size-3"}),r.departments.slice(0,2).join(", "),r.departments.length>2&&(0,t.jsxs)("span",{className:"opacity-60",children:[" +",r.departments.length-2]})]}),r.seniority_levels.length>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(O.GraduationCap,{className:"size-3"}),r.seniority_levels.join(", ")]})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${o.classes}`,title:o.short,children:[(0,t.jsx)(B.Crosshair,{className:"size-3 mr-1"}),o.label]})}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2 pt-2 border-t border-card-border/50 text-[11px]",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,t.jsx)(d.Building2,{className:"size-3"}),c.length>0?(0,t.jsxs)("span",{className:"truncate",children:["In: ",c.slice(0,2).map(e=>e.name).join(", "),c.length>2&&` +${c.length-2}`]}):"Any company"]}),(0,t.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),n()},onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),className:"text-[10px] text-muted-foreground hover:text-foreground",children:["Score ",(0,t.jsx)("span",{className:"font-medium text-foreground tabular-nums",children:r.score})," · ","Edit ↗"]})]})]})}let er={orgNode:function({data:e}){if("root"===e.kind)return(0,t.jsxs)(et,{highlight:!0,height:90,children:[(0,t.jsx)("p",{className:"text-[13px] font-semibold",children:e.label}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Targeting"})]});if("tier"===e.kind){let s=q[e.tier];return(0,t.jsxs)(et,{onClick:e.onToggle,height:90,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.collapsed?(0,t.jsx)(A.ChevronRight,{className:"size-3.5 text-muted-foreground"}):(0,t.jsx)($.ChevronDown,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${s.classes}`,children:s.label}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums ml-auto",children:e.count})]}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground pl-5",children:1===e.tier?"Highest priority":2===e.tier?"Solid fit":"Long tail"})]})}return(0,t.jsx)(et,{height:220,children:"company"===e.item.kind?(0,t.jsx)(ei,{data:e}):(0,t.jsx)(el,{data:e})})}};function eo({rootLabel:e,items:n,onProfileClick:a,onTierChange:i,onNameChange:l,onPositionChange:r}){let{fitView:o}
1=(0,T.useReactFlow)(),d=(0,s.useRef)(null),[c,p]=(0,s.useState)({1:!1,2:!1,3:!1}),m=(0,s.useCallback)(e=>{p(t=>({...t,[e]:!t[e]}))},[]),u=(0,s.useMemo)(()=>{let t={1:[],2:[],3:[]};for(let e of n)t[ee(e)].push(e);return[{id:"root",data:{kind:"root",label:e},children:Z.map(e=>{let s=t[e];return{id:`tier-${e}`,data:{kind:"tier",tier:e,count:s.length,collapsed:c[e],onToggle:()=>m(e)},children:c[e]?[]:s.map(e=>({id:`profile-${Q(e)}`,data:{kind:"profile",item:e,onOpen:()=>a(Q(e)),onTierChange:t=>i(Q(e),t),onNameChange:t=>l(Q(e),t),onPositionChange:r?t=>r(Q(e),t):void 0},children:[]}))}})}]},[n,e,c,m,a,i,l,r]),{nodes:x,edges:g,tierXs:h}=(0,s.useMemo)(()=>(function(e){let t,s=(t=e=>({id:e.id,height:"profile"===e.data.kind?220:90,children:e.children.map(t)}),(0,P.layoutHierarchy)(e.map(t),{nodeWidth:320,nodeHeight:90,hGap:40,vGap:60,rootGap:80}).positions),n=[],a=[],i={1:0,2:0,3:0};for(let t of e)!function e(t){let l="profile"===t.data.kind;for(let r of(n.push({id:t.id,type:"orgNode",position:s.get(t.id)??{x:0,y:0},data:t.data,draggable:l}),"tier"===t.data.kind&&(i[t.data.tier]=s.get(t.id)?.x??0),t.children))a.push({id:`e-${t.id}-${r.id}`,source:t.id,target:r.id,type:"smoothstep"}),e(r)}(t);return{nodes:n,edges:a,tierXs:i}})(u),[u]),f=(0,s.useRef)(h);f.current=h;let[j,b]=(0,s.useState)([]),[y,v]=(0,s.useState)([]);(0,s.useEffect)(()=>{b(x),v(g);let e=setTimeout(()=>o({padding:.3,duration:200}),60);return()=>clearTimeout(e)},[x,g]);let N=(0,s.useCallback)(e=>{b(t=>(0,T.applyNodeChanges)(e,t))},[]),w=(0,s.useCallback)((e,t)=>{let s=t.data;if("profile"!==s.kind)return;let n=t.position.x+160,a=Z.map(e=>({tier:e,dist:Math.abs((f.current[e]??0)+160-n)}));a.sort((e,t)=>e.dist-t.dist);let l=a[0].tier;l!==ee(s.item)?i(Q(s.item),l):b(x)},[i,x]);return(0,t.jsx)("div",{ref:d,className:"h-[640px] rounded-xl border overflow-hidden",children:(0,t.jsxs)(T.ReactFlow,{nodes:j,edges:y,nodeTypes:er,onNodesChange:N,onNodeDragStop:w,fitView:!0,fitViewOptions:{padding:.3},elementsSelectable:!1,nodesConnectable:!1,defaultEdgeOptions:{type:"smoothstep",animated:!0,style:{stroke:"var(--foreground)",strokeWidth:1.5,opacity:.15}},proOptions:{hideAttribution:!0},className:"org-chart-canvas",children:[(0,t.jsx)(T.Background,{gap:18,size:1.5,color:"var(--accent)"}),(0,t.jsx)(ed,{})]})})}function ed(){let{zoomIn:e,zoomOut:s,fitView:n}=(0,T.useReactFlow)();return(0,t.jsxs)("div",{className:"hierarchy-controls absolute bottom-4 left-4 z-10 flex flex-col items-center rounded-full border border-card-border bg-[var(--muted)] p-1 gap-1",children:[(0,t.jsx)("button",{onClick:()=>e({duration:200}),className:"flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-white dark:hover:bg-white/10 transition-colors",title:"Zoom in",children:(0,t.jsx)(i.Plus,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:()=>s({duration:200}),className:"flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-white dark:hover:bg-white/10 transition-colors",title:"Zoom out",children:(0,t.jsx)(R.Minus,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:()=>n({padding:.3,duration:200}),className:"flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-white dark:hover:bg-white/10 transition-colors",title:"Fit to view",children:(0,t.jsx)(L.Maximize2,{className:"h-3.5 w-3.5"})})]})}function ec(e){return e>=1e3?`${(e/1e3).toFixed(+(e%1e3!=0))}k`:String(e)}function ep(e){return(0,t.jsx)(T.ReactFlowProvider,{children:(0,t.jsx)(eo,{...e})})}var em=e.i(947627),eu=e.i(29383),ex=e.i(826902),eg=e.i(942530),eh=e.i(821875),ef=e.i(292282),ej=e.i(672987),eb=e.i(341256),ey=e.i(5832);let ev=[{id:"name",label:"Name"},{id:"tier",label:"Tier"},{id:"industries",label:"Industries"},{id:"size",label:"Size"},{id:"geographies",label:"Geographies"},{id:"matches",label:"Matches"}];function eN({profiles:e,matchCounts:n,messagingCounts:a,onEdit:i,onChange:o,onAddCompany:c}){let[p,m]=(0,ey.usePersistedChoice)("list-view:icp-companies","table",_),[u,x]=(0,s.use
1State)(""),[b,v]=(0,s.useState)([]),N=(0,eg.useTableSelection)(),{sortColumn:w,sortDir:C,handleSort:k}=(0,ex.useTableSort)("tier","asc"),{getColumnStyle:T,getResizeProps:D}=(0,eh.useColumnResize)("icp-companies"),P=(0,s.useMemo)(()=>[{key:"tier",label:"Tier",type:"multiselect",options:[{value:"1",label:"Tier 1"},{value:"2",label:"Tier 2"},{value:"3",label:"Tier 3"}]},{key:"funding_stage",label:"Funding stage",type:"multiselect",options:U.map(e=>({value:e,label:e}))},{key:"industry",label:"Industry",type:"text"},{key:"geography",label:"Geography",type:"text"}],[]),E=(0,s.useMemo)(()=>{let t=b.find(e=>"tier"===e.field),s=t?new Set((0,ej.parseMultiSelectFilter)(t.value)):null,n=b.find(e=>"funding_stage"===e.field),a=n?new Set((0,ej.parseMultiSelectFilter)(n.value)):null,i=(b.find(e=>"industry"===e.field)?.value??"").toString().toLowerCase(),l=(b.find(e=>"geography"===e.field)?.value??"").toString().toLowerCase(),r=u.trim().toLowerCase();return e.filter(e=>(!s||!!s.has(String(e.tier)))&&(!a||!!e.funding_stages.some(e=>a.has(e)))&&(!i||!!e.industries.some(e=>e.toLowerCase().includes(i)))&&(!l||!!e.geographies.some(e=>e.toLowerCase().includes(l)))&&(!r||!!`${e.name} ${e.description??""} ${e.industries.join(" ")} ${e.keywords.join(" ")}`.toLowerCase().includes(r))&&!0)},[e,u,b]),M=(0,s.useMemo)(()=>{if(!w)return E;let e="asc"===C?1:-1,t=e=>{switch(w){case"name":return e.name.toLowerCase();case"tier":return e.tier;case"industries":return e.industries[0]?.toLowerCase()??"";case"size":return e.company_size_min??e.company_size_max??0;case"geographies":return e.geographies[0]?.toLowerCase()??"";case"matches":return n[e.id]??-1;default:return""}};return[...E].sort((s,n)=>{let a=t(s),i=t(n);return a<i?-1*e:a>i?+e:0})},[E,w,C,n]),z=(0,s.useMemo)(()=>M.map(e=>e.id),[M]),$=(0,f.useShiftRangeSelect)((0,h.useEventCallback)(e=>N.toggle(e,z,!0)));async function A(t){o(e.filter(e=>e.id!==t)),(await fetch(`/api/icp/companies/${t}`,{method:"DELETE"})).ok||(l.toast.error("Failed to delete"),o(e))}async function I(t,s){let n=e.map(e=>e.id===t?{...e,...s}:e);o(n);let a=await fetch(`/api/icp/companies/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){l.toast.error("Failed to save"),o(e);return}let i=await a.json().catch(()=>({}));i.profile&&o(n.map(e=>e.id===t?i.profile:e))}return 0===e.length?(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,t.jsx)(d.Building2,{className:"h-12 w-12 text-muted-foreground/50"}),(0,t.jsx)("h3",{className:"mt-4 text-lg font-semibold",children:"No target companies yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define the kinds of companies the agent should prioritize."}),(0,t.jsx)(r.Button,{className:"mt-4",variant:"outline",onClick:c,children:"+ Company profile"})]})}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(ej.DynamicFilterBar,{fields:P,search:u,onSearchChange:x,searchPlaceholder:"Search company profiles…",filters:b,onFiltersChange:v})}),(0,t.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,t.jsx)(S,{view:p,onChange:m})})]}),0===E.length?(0,t.jsx)("div",{className:"rounded-lg border border-border/50 py-12 text-center text-sm text-muted-foreground",children:"No profiles match your filters."}):"table"===p?(0,t.jsx)("div",{className:"rounded-lg border border-border/50 overflow-x-auto",children:(0,t.jsxs)(em.Table,{...$,children:[(0,t.jsx)(em.TableHeader,{children:(0,t.jsxs)(em.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(em.TableHead,{className:"w-10 pl-4 pr-0",children:(0,t.jsx)(y.Checkbox,{checked:!!N.isAllSelected(z)||!!N.isSomeSelected(z)&&"indeterminate",onCheckedChange:()=>N.toggleAll(z),"aria-label":"Select all"})}),ev.map(e=>(0,t.jsx)(eu.SortableTableHead,{columnId:e.id,label:e.label,sortColumn:w,sortDir:C,onSort:k,className:"text-xs text-muted-foreground font-medium relative",style:T(e.id),extra:(0,t.jsx)(em.TableResizeHandle,{...D(e.id)})},e.id)),(0,t.jsx)(em.TableHead,{className:"w-10"})]})}),(0,t.jsx)(em.TableBody,{children:M.map(e=>(0,t.jsx)(ew,{profile:e,matchCount:n[e.id],messagingCount:a[e.id],selected:N.isSelected(e.id),getColumnStyle:T,onToggle:t=>N.toggle(e.id,z,t.shiftKey),onEdit:()=>i(e),onDelete:()=>A(e.id)},e.id))})]})}):"gallery"===p?(0,t.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:E.map(e=>(0,t.jsx)(eC,{profile:e,matchCount:n[e.id],messagingCount:a[e.id],onClick:()=>i(e),onDelete:()=>A(e.id)},e.id))}):(0,t.jsx)(ep,{rootLabel:"Target Companies",items:E.map(e=>({kind:"company",profile:e,matchCount:n[e.id]})),onProfileClick:t=>{let s=e.find(e=>e.id===t);s&&i(s)},onTierChange:function(e,t){I(e,{tier:t})},onNameChange:function(e,t){I(e,{name:t})}}),(0,t.jsx)(ef.BulkActionBar,{count:N.count,onClear:N.clear,noun:"profile",pluralNoun:"profiles",actions:[{label:"Delete",icon:(0,t.jsx)(eb.TrashIcon,{className:"h-4 w-4"}),variant:"destructive",onClick:function(){let t=Array.from(N.selectedIds);if(0===t.length)return;let s=new Set(t);(0,g.deleteWithUndo)({message:`Deleted ${t.length} profile${1===t.length?"":"s"}`,keys:t.map(e=>`icp_companies:${e}`),onOptimistic:()=>{o(e.filter(e=>!s.has(e.id))),N.clear()},onUndo:()=>o(e),onError:()=>{l.toast.error(`Failed to delete ${t.length} profile${1===t.length?"":"s"}`),o(e)},commit:async()=>{let e=(await Promise.allSettled(t.map(e=>fetch(`/api/icp/companies/${e}`,{method:"DELETE"})))).filter(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.ok);if(e.length>0)throw Error(`${e.length} of ${t.length} failed`)}})}}]})]})}function ew({profile:e,matchCount:n,messagingCount:a,selected:i,getColumnStyle:l,onToggle:o,onEdit:d,onDelete:p}
1){let x=q[e.tier],g=e_(e.company_size_min,e.company_size_max),[h,f]=(0,s.useState)(!1);return(0,t.jsxs)(em.TableRow,{className:`cursor-pointer ${i?"bg-muted/30":""}`,"data-select-id":e.id,onClick:d,children:[(0,t.jsx)(em.TableCell,{className:"w-10 pl-4 pr-0",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(y.Checkbox,{checked:i,onClick:o,"aria-label":`Select ${e.name}`})}),(0,t.jsx)(em.TableCell,{className:"font-medium",style:l("name"),children:(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate",children:e.name||"Untitled profile"}),e.description&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.description})]})}),(0,t.jsx)(em.TableCell,{style:l("tier"),children:(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${x.classes}`,children:x.label})}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground",style:l("industries"),children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.industries.slice(0,2).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),e.industries.length>2&&(0,t.jsxs)("span",{className:"text-[10px] self-center",children:["+",e.industries.length-2]})]})}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground",style:l("size"),children:g||"-"}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground truncate",style:l("geographies"),children:e.geographies.length>0?e.geographies.join(", "):"-"}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground tabular-nums",style:l("matches"),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"number"==typeof n?n:"-"}),"number"==typeof a&&a>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",title:`${a} messaging item${1===a?"":"s"} linked`,children:[(0,t.jsx)(c.Link,{className:"size-2.5"}),a]})]})}),(0,t.jsx)(em.TableCell,{className:"text-right w-10",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)(G.DropdownMenu,{open:h,onOpenChange:f,children:[(0,t.jsx)(G.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-7",children:(0,t.jsx)(m.MoreHorizontal,{className:"size-3.5"})})}),(0,t.jsxs)(G.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(G.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(u.Pencil,{className:"size-3.5 mr-2"}),"Edit"]}),(0,t.jsxs)(G.DropdownMenuItem,{className:"text-destructive",onClick:p,children:[(0,t.jsx)(eb.TrashIcon,{className:"size-3.5 mr-2"}),"Delete"]})]})]})})]})}function eC({profile:e,matchCount:n,messagingCount:a,onClick:i,onDelete:l,compact:o=!1}){let[g,h]=(0,s.useState)(!1),f=e_(e.company_size_min,e.company_size_max),j=q[e.tier];return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},className:"rounded-md border bg-card p-3 space-y-1.5 hover:shadow-sm transition-shadow text-left w-full cursor-pointer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium leading-tight line-clamp-2",children:e.name||"Untitled profile"}),!o&&e.description&&(0,t.jsx)("div",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-1.5 py-0 text-[10px] font-medium ${j.classes}`,children:j.label}),(0,t.jsxs)(G.DropdownMenu,{open:g,onOpenChange:h,children:[(0,t.jsx)(G.DropdownMenuTrigger,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-6 -mr-1 -mt-0.5",children:(0,t.jsx)(m.MoreHorizontal,{className:"size-3.5"})})}),(0,t.jsxs)(G.DropdownMenuContent,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(G.DropdownMenuItem,{onClick:i,children:[(0,t.jsx)(u.Pencil,{className:"size-3.5 mr-2"}),"Edit"]}),(0,t.jsxs)(G.DropdownMenuItem,{className:"text-destructive",onClick:l,children:[(0,t.jsx)(eb.TrashIcon,{className:"size-3.5 mr-2"}),"Delete"]})]})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[f&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(x.PeopleGroupIcon,{className:"size-3"}),f]}),e.geographies[0]&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(p.MapPin,{className:"size-3"}),e.geographies[0],e.geographies.length>1&&(0,t.jsxs)("span",{className:"opacity-60",children:[" +",e.geographies.length-1]})]}),"number"==typeof n&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",children:[(0,t.jsx)(d.Building2,{className:"size-3"}),n," match",1===n?"":"es"]}),"number"==typeof a&&a>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5",title:`${a} messaging item${1===a?"":"s"} linked`,children:[(0,t.jsx)(c.Link,{className:"size-3"}),a," linked"]})]}),!o&&e.industries.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.industries.slice(0,3).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),e.industries.length>3&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",e.industries.length-3]})]})]})}function e_(e,t){return null==e&&null==t?"":null!=e&&null!=t?`${ek(e)}–${ek(t)}`:null!=e?`${ek(e)}+`:null!=t?`≤${ek(t)}`:""}function ek(e){return e>=1e3?`${(e/1e3).toFixed(+(e%1e3!=0))}k`:String(e)}let eS=[{id:"name",label:"Name"},{id:"tier",label:"Tier"},{id:"position",label:"Position"},{id:"titles",label:"Titles"},{id:"goal",label:"Goal"},{id:"companies",label:"In companies"}];function eT({personas:e,companyById:n,messagingCounts:a,onEdit:i,onChange:o,onAddPersona:d}){let[c,p]=(0,ey.usePersistedChoice)("list-view:icp-personas","table",_),[m,u]=(0,s.use
1State)(""),[b,v]=(0,s.useState)([]),N=(0,eg.useTableSelection)(),{sortColumn:w,sortDir:C,handleSort:k}=(0,ex.useTableSort)("tier","asc"),{getColumnStyle:T,getResizeProps:D}=(0,eh.useColumnResize)("icp-personas"),P=(0,s.useMemo)(()=>[{key:"tier",label:"Tier",type:"multiselect",options:[{value:"1",label:"Tier 1"},{value:"2",label:"Tier 2"},{value:"3",label:"Tier 3"}]},{key:"position",label:"Position",type:"multiselect",options:X.map(e=>({value:e,label:Y[e].short}))},{key:"goal",label:"Goal",type:"multiselect",options:J.map(e=>({value:e,label:K[e].label}))},{key:"department",label:"Department",type:"multiselect",options:W.map(e=>({value:e,label:e}))}],[]),E=(0,s.useMemo)(()=>{let t=b.find(e=>"tier"===e.field),s=t?new Set((0,ej.parseMultiSelectFilter)(t.value)):null,n=b.find(e=>"goal"===e.field),a=n?new Set((0,ej.parseMultiSelectFilter)(n.value)):null,i=b.find(e=>"department"===e.field),l=i?new Set((0,ej.parseMultiSelectFilter)(i.value)):null,r=b.find(e=>"position"===e.field),o=r?new Set((0,ej.parseMultiSelectFilter)(r.value)):null,d=m.trim().toLowerCase();return e.filter(e=>(!s||!!s.has(String(e.tier)))&&(!a||!!a.has(e.goal))&&(!l||!!e.departments.some(e=>l.has(e)))&&(!o||!!o.has(e.org_position))&&(!d||!!`${e.name} ${e.titles.join(" ")} ${e.departments.join(" ")} ${e.messaging_angle??""}`.toLowerCase().includes(d))&&!0)},[e,m,b]),M=(0,s.useMemo)(()=>{if(!w)return E;let e="asc"===C?1:-1,t=e=>{switch(w){case"name":return e.name.toLowerCase();case"tier":return e.tier;case"position":return({above:0,target:1,below:2})[e.org_position];case"titles":return e.titles[0]?.toLowerCase()??"";case"goal":return e.goal;case"companies":{let t=e.linked_company_profile_ids.map(e=>n[e]?.name).filter(Boolean)[0];return t?.toLowerCase()??""}default:return""}};return[...E].sort((s,n)=>{let a=t(s),i=t(n);return a<i?-1*e:a>i?+e:0})},[E,w,C,n]),z=(0,s.useMemo)(()=>M.map(e=>e.id),[M]),$=(0,f.useShiftRangeSelect)((0,h.useEventCallback)(e=>N.toggle(e,z,!0)));async function A(t){o(e.filter(e=>e.id!==t)),(await fetch(`/api/icp/personas/${t}`,{method:"DELETE"})).ok||(l.toast.error("Failed to delete"),o(e))}async function I(t,s){let n=e.map(e=>e.id===t?{...e,...s}:e);o(n);let a=await fetch(`/api/icp/personas/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){l.toast.error("Failed to save"),o(e);return}let i=await a.json().catch(()=>({}));i.persona&&o(n.map(e=>e.id===t?i.persona:e))}return 0===e.length?(0,t.jsx)(j.Card,{children:(0,t.jsxs)(j.CardContent,{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,t.jsx)(x.PeopleGroupIcon,{className:"h-12 w-12 text-muted-foreground/50"}),(0,t.jsx)("h3",{className:"mt-4 text-lg font-semibold",children:"No target personas yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define the buyer roles the agent should pursue inside each account."}),(0,t.jsx)(r.Button,{className:"mt-4",variant:"outline",onClick:d,children:"+ Persona"})]})}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(ej.DynamicFilterBar,{fields:P,search:m,onSearchChange:u,searchPlaceholder:"Search personas…",filters:b,onFiltersChange:v})}),(0,t.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,t.jsx)(S,{view:c,onChange:p})})]}),0===E.length?(0,t.jsx)("div",{className:"rounded-lg border border-border/50 py-12 text-center text-sm text-muted-foreground",children:"No personas match your filters."}):"table"===c?(0,t.jsx)("div",{className:"rounded-lg border border-border/50 overflow-x-auto",children:(0,t.jsxs)(em.Table,{...$,children:[(0,t.jsx)(em.TableHeader,{children:(0,t.jsxs)(em.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(em.TableHead,{className:"w-10 pl-4 pr-0",children:(0,t.jsx)(y.Checkbox,{checked:!!N.isAllSelected(z)||!!N.isSomeSelected(z)&&"indeterminate",onCheckedChange:()=>N.toggleAll(z),"aria-label":"Select all"})}),eS.map(e=>(0,t.jsx)(eu.SortableTableHead,{columnId:e.id,label:e.label,sortColumn:w,sortDir:C,onSort:k,className:"text-xs text-muted-foreground font-medium relative",style:T(e.id),extra:(0,t.jsx)(em.TableResizeHandle,{...D(e.id)})},e.id)),(0,t.jsx)(em.TableHead,{className:"w-10"})]})}),(0,t.jsx)(em.TableBody,{children:M.map(e=>(0,t.jsx)(eE,{persona:e,companyById:n,messagingCount:a[e.id],selected:N.isSelected(e.id),getColumnStyle:T,onToggle:t=>N.toggle(e.id,z,t.shiftKey),onEdit:()=>i(e),onDelete:()=>A(e.id)},e.id))})]})}):"gallery"===c?(0,t.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:E.map(e=>(0,t.jsx)(eM,{persona:e,companyById:n,messagingCount:a[e.id],onClick:()=>i(e),onDelete:()=>A(e.id)},e.id))}):(0,t.jsx)(ep,{rootLabel:"Target Personas",items:E.map(e=>({kind:"persona",profile:e,companyById:n})),onProfileClick:t=>{let s=e.find(e=>e.id===t);s&&i(s)},onTierChange:function(e,t){I(e,{tier:t})},onNameChange:function(e,t){I(e,{name:t})},onPositionChange:function(e,t){I(e,{org_position:t})}}),(0,t.jsx)(ef.BulkActionBar,{count:N.count,onClear:N.clear,noun:"persona",pluralNoun:"personas",actions:[{label:"Delete",icon:(0,t.jsx)(eb.TrashIcon,{className:"h-4 w-4"}),variant:"destructive",onClick:function(){let t=Array.from(N.selectedIds);if(0===t.length)return;let s=new Set(t);(0,g.deleteWithUndo)({message:`Deleted ${t.length} persona${1===t.length?"":"s"}`,keys:t.map(e=>`icp_personas:${e}`),onOptimistic:()=>{o(e.filter(e=>!s.has(e.id))),N.clear()},onUndo:()=>o(e),onError:()=>{l.toast.error(`Failed to delete ${t.length} persona${1===t.length?"":"s"}`),o(e)},commit:async()=>{let e=(await Promise.allSettled(t.map(e=>fetch(`/api/icp/personas/${e}`,{method:"DELETE"})))).filter(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.ok);if(e.length>0)throw Error(`${e.length} of ${t.length} failed`)}})}}]})]})}function eD({position:e}){return"above"===e?(0,t.jsx)(M.ArrowUp,{className:"size-3 text-foreground
1/60"}):"target"===e?(0,t.jsx)(I.CircleDot,{className:"size-3 text-foreground/60"}):(0,t.jsx)(E.ArrowDown,{className:"size-3 text-foreground/60"})}function eP({position:e}){let s=Y[e];return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${s.classes}`,children:[(0,t.jsx)(eD,{position:e}),s.label]})}function eE({persona:e,companyById:n,messagingCount:a,selected:i,getColumnStyle:l,onToggle:o,onEdit:d,onDelete:p}){let x=q[e.tier],g=K[e.goal],h=e.linked_company_profile_ids.map(e=>n[e]?.name).filter(Boolean),[f,j]=(0,s.useState)(!1);return(0,t.jsxs)(em.TableRow,{className:`cursor-pointer ${i?"bg-muted/30":""}`,"data-select-id":e.id,onClick:d,children:[(0,t.jsx)(em.TableCell,{className:"w-10 pl-4 pr-0",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(y.Checkbox,{checked:i,onClick:o,"aria-label":`Select ${e.name}`})}),(0,t.jsx)(em.TableCell,{className:"font-medium",style:l("name"),children:(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"truncate",children:e.name||"Untitled persona"}),e.seniority_levels.length>0&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.seniority_levels.join(", ")})]})}),(0,t.jsx)(em.TableCell,{style:l("tier"),children:(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${x.classes}`,children:x.label})}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground",style:l("position"),children:(0,t.jsx)(eP,{position:e.org_position})}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground",style:l("titles"),children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.titles.slice(0,3).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),e.titles.length>3&&(0,t.jsxs)("span",{className:"text-[10px] self-center",children:["+",e.titles.length-3]})]})}),(0,t.jsx)(em.TableCell,{style:l("goal"),children:(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${g.classes}`,children:g.label})}),(0,t.jsx)(em.TableCell,{className:"text-sm text-muted-foreground",style:l("companies"),children:(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"truncate",children:h.length>0?h.join(", "):"-"}),"number"==typeof a&&a>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",title:`${a} messaging item${1===a?"":"s"} linked`,children:[(0,t.jsx)(c.Link,{className:"size-2.5"}),a]})]})}),(0,t.jsx)(em.TableCell,{className:"text-right w-10",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)(G.DropdownMenu,{open:f,onOpenChange:j,children:[(0,t.jsx)(G.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-7",children:(0,t.jsx)(m.MoreHorizontal,{className:"size-3.5"})})}),(0,t.jsxs)(G.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(G.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(u.Pencil,{className:"size-3.5 mr-2"}),"Edit"]}),(0,t.jsxs)(G.DropdownMenuItem,{className:"text-destructive",onClick:p,children:[(0,t.jsx)(eb.TrashIcon,{className:"size-3.5 mr-2"}),"Delete"]})]})]})})]})}function eM({persona:e,companyById:n,messagingCount:a,onClick:i,onDelete:l,compact:o=!1}){let d=q[e.tier],p=K[e.goal],x=e.linked_company_profile_ids.map(e=>n[e]?.name).filter(Boolean),[g,h]=(0,s.useState)(!1);return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:i,onKeyDown:e=>{"Enter"===e.key&&i()},className:"rounded-md border bg-card p-3 space-y-1.5 hover:shadow-sm transition-shadow text-left w-full cursor-pointer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium leading-tight line-clamp-2",children:e.name||"Untitled persona"}),(0,t.jsxs)("div",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[(0,t.jsx)(eD,{position:e.org_position}),Y[e.org_position].short]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-1.5 py-0 text-[10px] font-medium ${d.classes}`,children:d.label}),(0,t.jsxs)(G.DropdownMenu,{open:g,onOpenChange:h,children:[(0,t.jsx)(G.DropdownMenuTrigger,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"size-6 -mr-1 -mt-0.5",children:(0,t.jsx)(m.MoreHorizontal,{className:"size-3.5"})})}),(0,t.jsxs)(G.DropdownMenuContent,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(G.DropdownMenuItem,{onClick:i,children:[(0,t.jsx)(u.Pencil,{className:"size-3.5 mr-2"}),"Edit"]}),(0,t.jsxs)(G.DropdownMenuItem,{className:"text-destructive",onClick:l,children:[(0,t.jsx)(eb.TrashIcon,{className:"size-3.5 mr-2"}),"Delete"]})]})]})]})]}),!o&&e.titles.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.titles.slice(0,3).map(e=>(0,t.jsx)(b.Badge,{variant:"secondary",className:"font-normal text-[10px] py-0 h-5",children:e},e)),e.titles.length>3&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",e.titles.length-3]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium ${p.classes}`,children:p.label}),!o&&x.length>0&&(0,t.jsxs)("span",{className:"truncate",children:["In: ",x.slice(0,2).join(", "),x.length>
12?` +${x.length-2}`:""]}),"number"==typeof a&&a>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 shrink-0",title:`${a} messaging item${1===a?"":"s"} linked`,children:[(0,t.jsx)(c.Link,{className:"size-3"}),a," linked"]})]})]})}var ez=e.i(656766),e$=e.i(567136),eA=e.i(630374),eI=e.i(23750),eB=e.i(184762),eO=e.i(10708),eF=e.i(967416),eL=e.i(447170),eR=e.i(201788),eH=e.i(611423),eG=e.i(37727),eU=e.i(531278),eV=e.i(555436),eW=e.i(920755),eK=e.i(327147);let eJ={template:"Template",component:"Component",snippet:"Snippet"};function eq({profileId:e,side:n}){let[a,o]=(0,s.useState)([]),[d,c]=(0,s.useState)(!0),[p,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(""),[g,h]=(0,s.useState)(null),[f,j]=(0,s.useState)(!1),[b,y]=(0,s.useState)(null);(0,s.useEffect)(()=>{let t=!1;return async function(){c(!0);try{let s="company_profile_id"===n?"company_profile_id":"persona_profile_id",a=await fetch(`/api/icp/messaging-links?${s}=${e}`);if(!a.ok)return;let i=await a.json();t||o(i.links??[])}finally{t||c(!1)}}(),()=>{t=!0}},[e,n]);let v=(0,s.useCallback)(async()=>{if(m(!0),null===g){j(!0);try{let e=(0,eW.createClient)(),[{data:t},{data:s},{data:n}]=await Promise.all([e.from("email_templates").select("id, name, category").order("name"),e.from("email_components").select("id, name, type").order("name"),e.from("email_snippets").select("id, name").order("name")]),a=[...(t??[]).map(e=>({id:e.id,kind:"template",name:e.name,sub:Array.isArray(e.category)&&e.category.length>0?e.category[0]:void 0})),...(s??[]).map(e=>({id:e.id,kind:"component",name:e.name,sub:e.type})),...(n??[]).map(e=>({id:e.id,kind:"snippet",name:e.name}))];h(a)}finally{j(!1)}}},[g]);async function N(t){y(t.id);try{let s={[n]:e,..."template"===t.kind?{template_id:t.id}:"component"===t.kind?{component_id:t.id}:{snippet_id:t.id}},a=await fetch("/api/icp/messaging-links",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){let e=await a.json().catch(()=>({}));409===a.status?l.toast.info("Already linked"):l.toast.error(e.error||"Failed to link");return}let i="company_profile_id"===n?"company_profile_id":"persona_profile_id",r=await fetch(`/api/icp/messaging-links?${i}=${e}`);if(r.ok){let e=await r.json();o(e.links??[])}}finally{y(null)}}async function w(e){o(t=>t.filter(t=>t.id!==e)),(await fetch("/api/icp/messaging-links",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})).ok||(o(a),l.toast.error("Failed to unlink"))}let C=(0,s.useMemo)(()=>new Set([...a.map(e=>e.email_template_id).filter(Boolean),...a.map(e=>e.email_component_id).filter(Boolean),...a.map(e=>e.email_snippet_id).filter(Boolean)]),[a]),_=(0,s.useMemo)(()=>{if(!g)return[];let e=u.toLowerCase().trim();return g.filter(t=>!C.has(t.id)&&(!e||t.name.toLowerCase().includes(e)||t.sub?.toLowerCase().includes(e)))},[g,u,C]);return(0,t.jsxs)("div",{className:"space-y-2",children:[d?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Array.from({length:3}).map((e,s)=>(0,t.jsx)(eH.Skeleton,{className:"h-6 w-24 rounded-full"},s))}):(0,t.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[0===a.length&&!p&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"None linked yet."}),a.map(e=>{let s=e.template??e.component??e.snippet;if(!s)return null;let n=e.template?"template":e.component?"component":"snippet";return(0,t.jsxs)("div",{className:"inline-flex items-center gap-1.5 border border-card-border rounded-full pl-2.5 pr-1.5 py-0.5 text-xs",children:[(0,t.jsx)("span",{className:"opacity-40 text-[9px] uppercase tracking-wide font-medium",children:eJ[n][0]}),(0,t.jsx)("span",{className:"max-w-[150px] truncate",children:s.name}),(0,t.jsx)("button",{type:"button",onClick:()=>w(e.id),className:"h-3.5 w-3.5 rounded-full flex items-center justify-center hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Unlink",children:(0,t.jsx)(eG.X,{className:"h-2.5 w-2.5"})})]},e.id)})]}),p?(0,t.jsxs)("div",{className:"border border-card-border rounded-lg p-3 space-y-2 bg-muted/20",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(eV.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),(0,t.jsx)(eI.Input,{variant:"default",className:"pl-7 h-7 text-xs",placeholder:"Search templates, components, snippets…",value:u,onChange:e=>x(e.target.value),autoFocus:!0})]}),f?(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground py-2",children:[(0,t.jsx)(eU.Loader2,{className:"h-3 w-3 animate-spin"}),"Loading…"]}):0===_.length?(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground py-1",children:u?"No matches.":"All available items are already linked."}):(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto divide-y divide-card-border/40",children:_.map(e=>(0,t.jsxs)("button",{type:"button",disabled:b===e.id,onClick:()=>N(e),className:"w-full flex items-center gap-2 px-1.5 py-1.5 hover:bg-muted text-left transition-colors disabled:opacity-50 first:rounded-t last:rounded-b",children:[(0,t.jsx)("span",{className:"text-[9px] uppercase tracking-wide text-muted-foreground w-16 shrink-0 font-medium",children:b===e.id?(0,t.jsx)(eK.ButtonSpinner,{}):eJ[e.kind]}),(0,t.jsx)(eK.ShimmerLabel,{active:b===e.id,className:"text-xs truncate flex-1",children:e.name}),e.sub&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:e.sub})]},e.id))}),(0,t.jsx)("div",{className:"flex justify-end pt-0.5",children:(0,t.jsx)(r.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{m(!1),x("")},children:"Done"})})]}):(0,t.jsxs)(r.Button,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:v,children:[(0,t.jsx)(i.Plus,{className:"h-3 w-3"}),"Add messaging item"]})]})}var eY=e.i(275236);let eX=`Help me build out my ICP (Ideal Customer Profile) in everything.
2
3Step 1 - Read my current ICP.
4Call \`get_icp_profiles\` to see my target company profiles and target persona profiles. Treat anything filled 
4in as ground truth - only refine if you see a real gap.
5
6Step 2 - Mine my data for signal.
7Use everything's MCP tools to look at which companies are won vs lost, and what those buyers had in common (industries, size, region, funding, tech stack).
8
9Step 3 - Propose updates and confirm before writing.
10For each new or refined target_company, draft a concrete row and ask before saving. Then call \`upsert_icp_company_profile\` to persist.`;function eZ({open:e,onOpenChange:s,profile:n,onSaved:a}){return(0,t.jsx)(eA.Dialog,{open:e,onOpenChange:s,children:(0,t.jsx)(eA.DialogContent,{className:"sm:max-w-2xl gap-0 overflow-hidden flex flex-col p-0 max-h-[90vh]",children:e&&(0,t.jsx)(eQ,{profile:n,onCancel:()=>s(!1),onSaved:a},n?.id??"new")})})}function eQ({profile:e,onCancel:n,onSaved:a}){let[i,o]=(0,s.useState)(()=>e?{name:e.name,tier:e.tier,description:e.description??"",industries:e.industries,company_size_min:null!=e.company_size_min?String(e.company_size_min):"",company_size_max:null!=e.company_size_max?String(e.company_size_max):"",revenue_range:e.revenue_range??"",funding_stages:e.funding_stages,geographies:e.geographies,tech_stack_signals:e.tech_stack_signals,keywords:e.keywords,exclusions:e.exclusions,notes:e.notes??""}:{name:"",tier:2,description:"",industries:[],company_size_min:"",company_size_max:"",revenue_range:"",funding_stages:[],geographies:[],tech_stack_signals:[],keywords:[],exclusions:[],notes:""}),{agent:d,name:c}
10=(0,e$.useAgentBrand)(),[p,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(!1);function h(e,t){o(s=>({...s,[e]:t}))}async function f(){m(!0);try{let t={name:i.name.trim()||"Untitled profile",tier:i.tier,description:i.description,industries:i.industries,company_size_min:i.company_size_min?Number(i.company_size_min):null,company_size_max:i.company_size_max?Number(i.company_size_max):null,revenue_range:i.revenue_range,funding_stages:i.funding_stages,geographies:i.geographies,tech_stack_signals:i.tech_stack_signals,keywords:i.keywords,exclusions:i.exclusions,notes:i.notes},s=e?`/api/icp/companies/${e.id}`:"/api/icp/companies",n=await fetch(s,{method:e?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));l.toast.error(e.error||"Save failed");return}let r=await n.json();a(r.profile),l.toast.success(e?"Profile updated":"Profile created")}finally{m(!1)}}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eA.DialogHeader,{className:"px-6 pt-6 pb-3 border-b border-card-border/60",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eA.DialogTitle,{children:e?"Edit company profile":"New company profile"}),(0,t.jsxs)("button",{type:"button",onClick:()=>(0,eY.openWithClaude)(eX),className:"inline-flex items-center gap-1.5 rounded-full bg-[#F5F0E8] dark:bg-muted border border-[#D9D2C7] dark:border-border px-3 py-2 text-xs font-medium text-foreground hover:bg-[#E8E1D7] hover:border-transparent dark:hover:bg-muted/80 transition-colors shrink-0",children:[(0,t.jsx)(ez.AgentGlyph,{agent:d,className:"h-3.5 w-3.5"}),"Brainstorm"]})]}),(0,t.jsxs)(eA.DialogDescription,{className:"text-xs",children:["Define the kind of company you target. Read by ",c," when scoring and researching."]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-5",children:[(0,t.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-3 items-end",children:[(0,t.jsx)(e0,{label:"Name",htmlFor:"icp-name",required:!0,children:(0,t.jsx)(eI.Input,{id:"icp-name",variant:"default",value:i.name,onChange:e=>h("name",e.target.value),placeholder:"e.g. Series B SaaS"})}),(0,t.jsx)(e0,{label:"Tier",htmlFor:"icp-tier",children:(0,t.jsx)(eL.SearchableSelect,{value:String(i.tier),onValueChange:e=>h("tier",Number(e)),variant:"default",modal:!0,className:"w-[120px]","aria-label":"Tier",options:[1,2,3].map(e=>({value:String(e),label:q[e].label,icon:(0,t.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${1===e?"bg-amber-500":2===e?"bg-zinc-400":"bg-stone-400"}`})}))})})]}),(0,t.jsx)(e0,{label:"Description",htmlFor:"icp-desc",children:(0,t.jsx)(eB.Textarea,{id:"icp-desc",variant:"default",value:i.description,onChange:e=>h("description",e.target.value),placeholder:"One or two sentences on what makes this profile distinct.",className:"min-h-[64px] text-sm"})}),(0,t.jsxs)("div",{className:"grid sm:grid-cols-2 gap-4",children:[(0,t.jsx)(e0,{label:"Industries",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.industries,onChange:e=>h("industries",e),options:eR.INDUSTRY_OPTIONS,placeholder:"Add industry"})}),(0,t.jsx)(e0,{label:"Funding stages",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.funding_stages,onChange:e=>h("funding_stages",e),options:U,placeholder:"Add stage"})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)(e0,{label:"Min employees",htmlFor:"icp-min",children:(0,t.jsx)(eI.Input,{id:"icp-min",variant:"default",type:"number",inputMode:"numeric",min:0,value:i.company_size_min,onChange:e=>h("company_size_min",e.target.value),placeholder:"50"})}),(0,t.jsx)(e0,{label:"Max employees",htmlFor:"icp-max",children:(0,t.jsx)(eI.Input,{id:"icp-max",variant:"default",type:"number",inputMode:"numeric",min:0,value:i.company_size_max,onChange:e=>h("company_size_max",e.target.value),placeholder:"500"})})]}),(0,t.jsx)(e0,{label:"Revenue range",htmlFor:"icp-rev",children:(0,t.jsx)(eI.Input,{id:"icp-rev",variant:"default",value:i.revenue_range,onChange:e=>h("revenue_range",e.target.value),placeholder:"$10M–$50M ARR"})}),(0,t.jsx)(e0,{label:"Geographies",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.geographies,onChange:e=>h("geographies",e),options:eR.GEOGRAPHY_OPTIONS,placeholder:"Add country or region"})}),(0,t.jsx)(e0,{label:"Tech stack signals",hint:"Tools they must (or commonly) use - looked up against company.tech_stack.",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.tech_stack_signals,onChange:e=>h("tech_stack_signals",e),options:[],placeholder:"Add tool",customLabel:"Add tool"})}),(0,t.jsx)(e0,{label:"Keywords",hint:"Things to look for in their website, job postings, descriptions.",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.keywords,onChange:e=>h("keywords",e),options:[],placeholder:"Add keyword",customLabel:"Add keyword"})}),(0,t.jsx)(e0,{label:"Exclusions",hint:"Disqualifiers - hard 0 score when any matches.",children:(0,t.jsx)(eF.MultiSelectChips,{value:i.exclusions,onChange:e=>h("exclusions",e),options:[],placeholder:"Add exclusion",customLabel:"Add exclusion"})}),(0,t.jsx)(e0,{label:"Notes",htmlFor:"icp-notes",children:(0,t.jsx)(eB.Textarea,{id:"icp-notes",variant:"default",value:i.notes,onChange:e=>h("notes",e.target.value),placeholder:"Internal notes - pricing model, exp
10ansion playbook, anything the agent should know.",className:"min-h-[80px] text-sm"})}),e&&(0,t.jsxs)("div",{className:"space-y-1.5 pt-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Linked messaging"}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Templates, components & snippets used for this profile"})]}),(0,t.jsx)(eq,{profileId:e.id,side:"company_profile_id"})]})]}),(0,t.jsxs)("div",{className:"border-t border-card-border/60 px-6 py-3 flex items-center justify-between gap-3",children:[e?(0,t.jsxs)(r.Button,{type:"button",variant:"ghost",onClick:function(){!e||confirm(`Delete "${e.name}"?`)&&(x(!0),(0,g.deleteWithUndo)({message:"Profile deleted",keys:[`icp_companies:${e.id}`],onOptimistic:()=>{a(null,e.id),x(!1)},onError:()=>l.toast.error("Delete failed"),commit:async()=>{if(!(await fetch(`/api/icp/companies/${e.id}`,{method:"DELETE"})).ok)throw Error("Delete failed")}}))},disabled:u||p,className:"text-destructive hover:text-destructive hover:bg-destructive/10 gap-1.5",children:[u?(0,t.jsx)(eK.ButtonSpinner,{}):(0,t.jsx)(eb.TrashIcon,{className:"h-3.5 w-3.5"}),(0,t.jsx)(eK.ShimmerLabel,{active:u,children:"Delete"})]}):(0,t.jsx)("span",{}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Button,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,t.jsxs)(r.Button,{type:"button",onClick:f,disabled:p,className:"gap-1.5",children:[p&&(0,t.jsx)(eK.ButtonSpinner,{}),(0,t.jsx)(eK.ShimmerLabel,{active:p,children:e?"Save changes":"Create profile"})]})]})]})]})}function e0({label:e,htmlFor:s,hint:n,required:a,children:i}){return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)(eO.Label,{htmlFor:s,className:"text-xs",children:[e,a&&(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),i,n&&(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground leading-snug",children:n})]})}let e1=`Help me build out my ICP personas in everything.
11
12Step 1 - Read my current personas.
13Call \`get_icp_profiles\` to see my target persona profiles. Treat anything filled in as ground truth - only refine if you see a real gap.
14
15Step 2 - Mine my data for signal.
16Use everything's MCP tools to look at which titles convert, which don't, and which personas show up across my deals and contacts.
17
18Step 3 - Propose updates and confirm before writing.
19For each new or refined target_persona, draft a concrete row and ask before saving. Then call \`upsert_icp_persona_profile\` to persist.`;function e2({open:e,onOpenChange:s,persona:n,companies:a,onSaved:i}){return(0,t.jsx)(eA.Dialog,{open:e,onOpenChange:s,children:(0,t.jsx)(eA.DialogContent,{className:"sm:max-w-2xl gap-0 overflow-hidden flex flex-col p-0 max-h-[90vh]",children:e&&(0,t.jsx)(e5,{persona:n,companies:a,onCancel:()=>s(!1),onSaved:i},n?.id??"new")})})}function e5({persona:e,companies:n,onCancel:a,onSaved:i}){let[o,d]=(0,s.useState)(()=>e?{name:e.name,tier:e.tier,org_position:e.org_position,goal:e.goal,goal_custom:e.goal_custom??"",titles:e.titles,departments:e.departments,seniority_levels:e.seniority_levels,responsibilities:e.responsibilities??"",pain_points:e.pain_points,messaging_angle:e.messaging_angle??"",outreach_notes:e.outreach_notes??"",linked_company_profile_ids:e.linked_company_profile_ids}:{name:"",tier:2,org_position:"target",goal:"meeting",goal_custom:"",titles:[],departments:[],seniority_levels:[],responsibilities:"",pain_points:[],messaging_angle:"",outreach_notes:"",linked_company_profile_ids:[]}),{agent:c}
19=(0,e$.useAgentBrand)(),[p,m]=(0,s.useState)(!1),[u,x]=(0,s.useState)(!1);function h(e,t){d(s=>({...s,[e]:t}))}async function f(){m(!0);try{let t={name:o.name.trim()||"Untitled persona",tier:o.tier,org_position:o.org_position,goal:o.goal,goal_custom:"custom"===o.goal?o.goal_custom:"",titles:o.titles,departments:o.departments,seniority_levels:o.seniority_levels,responsibilities:o.responsibilities,pain_points:o.pain_points,messaging_angle:o.messaging_angle,outreach_notes:o.outreach_notes,linked_company_profile_ids:o.linked_company_profile_ids},s=e?`/api/icp/personas/${e.id}`:"/api/icp/personas",n=await fetch(s,{method:e?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));l.toast.error(e.error||"Save failed");return}let a=await n.json();i(a.persona),l.toast.success(e?"Persona updated":"Persona created")}finally{m(!1)}}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eA.DialogHeader,{className:"px-6 pt-6 pb-3 border-b border-card-border/60",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eA.DialogTitle,{children:e?"Edit persona":"New persona"}),(0,t.jsxs)("button",{type:"button",onClick:()=>(0,eY.openWithClaude)(e1),className:"inline-flex items-center gap-1.5 rounded-full bg-[#F5F0E8] dark:bg-muted border border-[#D9D2C7] dark:border-border px-3 py-2 text-xs font-medium text-foreground hover:bg-[#E8E1D7] hover:border-transparent dark:hover:bg-muted/80 transition-colors shrink-0",children:[(0,t.jsx)(ez.AgentGlyph,{agent:c,className:"h-3.5 w-3.5"}),"Brainstorm"]})]}),(0,t.jsx)(eA.DialogDescription,{className:"text-xs",children:"Who you’re trying to reach inside a target account."})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-5",children:[(0,t.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-3 items-end",children:[(0,t.jsx)(e4,{label:"Name",htmlFor:"p-name",required:!0,children:(0,t.jsx)(eI.Input,{id:"p-name",variant:"default",value:o.name,onChange:e=>h("name",e.target.value),placeholder:"e.g. VP of Sales"})}),(0,t.jsx)(e4,{label:"Tier",htmlFor:"p-tier",children:(0,t.jsx)(eL.SearchableSelect,{value:String(o.tier),onValueChange:e=>h("tier",Number(e)),variant:"default",modal:!0,className:"w-[120px]","aria-label":"Tier",options:[1,2,3].map(e=>({value:String(e),label:q[e].label}))})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(e4,{label:"Org position",children:(0,t.jsx)("div",{className:"flex rounded-full border border-card-border p-0.5 bg-muted/30",children:X.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>h("org_position",e),className:`flex-1 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${o.org_position===e?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,title:Y[e].short,children:Y[e].label},e))})}),(0,t.jsx)(e4,{label:"Goal",htmlFor:"p-goal",children:(0,t.jsx)(eL.SearchableSelect,{value:o.goal,onValueChange:e=>h("goal",e),variant:"default",modal:!0,className:"w-full","aria-label":"Goal",options:J.map(e=>({value:e,label:K[e].label}))})})]}),"custom"===o.goal&&(0,t.jsx)(e4,{label:"Custom goal",htmlFor:"p-goal-custom",children:(0,t.jsx)(eI.Input,{id:"p-goal-custom",variant:"default",value:o.goal_custom,onChange:e=>h("goal_custom",e.target.value),placeholder:"What you actually want from this persona"})}),(0,t.jsx)(e4,{label:"Job titles",hint:"Variations to match - VP Sales, Head of Sales, SVP Sales.",children:(0,t.jsx)(eF.MultiSelectChips,{value:o.titles,onChange:e=>h("titles",e),options:[],placeholder:"Add title",customLabel:"Add title"})}),(0,t.jsxs)("div",{className:"grid sm:grid-cols-2 gap-4",children:[(0,t.jsx)(e4,{label:"Departments",children:(0,t.jsx)(eF.MultiSelectChips,{value:o.departments,onChange:e=>h("departments",e),options:W,placeholder:"Add department"})}),(0,t.jsx)(e4,{label:"Seniority",children:(0,t.jsx)(eF.MultiSelectChips,{value:o.seniority_levels,onChange:e=>h("seniority_levels",e),options:V,placeholder:"Add level"})})]}),(0,t.jsx)(e4,{label:"Responsibilities",htmlFor:"p-resp",hint:"What this persona owns / cares about.",children:(0,t.jsx)(eB.Textarea,{id:"p-resp",variant:"default",value:o.responsibilities,onChange:e=>
19h("responsibilities",e.target.value),className:"min-h-[60px] text-sm",placeholder:"Pipeline coverage, rep ramp, forecast accuracy…"})}),(0,t.jsx)(e4,{label:"Pain points",children:(0,t.jsx)(eF.MultiSelectChips,{value:o.pain_points,onChange:e=>h("pain_points",e),options:[],placeholder:"Add pain point",customLabel:"Add pain point"})}),(0,t.jsx)(e4,{label:"Messaging angle",htmlFor:"p-msg",hint:"How you position to them.",children:(0,t.jsx)(eB.Textarea,{id:"p-msg",variant:"default",value:o.messaging_angle,onChange:e=>h("messaging_angle",e.target.value),className:"min-h-[60px] text-sm",placeholder:"Less SDR sprawl, pipeline-to-revenue in one tool."})}),(0,t.jsx)(e4,{label:"Outreach notes",htmlFor:"p-out",hint:"Phrases that land, anti-patterns to avoid.",children:(0,t.jsx)(eB.Textarea,{id:"p-out",variant:"default",value:o.outreach_notes,onChange:e=>h("outreach_notes",e.target.value),className:"min-h-[60px] text-sm",placeholder:"Don't lead with features; lead with a number they care about."})}),(0,t.jsx)(e4,{label:"Applies to which company profiles",hint:"Linking ties this persona to specific target-company types.",children:(0,t.jsx)(e3,{value:o.linked_company_profile_ids,onChange:e=>h("linked_company_profile_ids",e),companies:n})}),e&&(0,t.jsxs)("div",{className:"space-y-1.5 pt-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Linked messaging"}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Templates, components & snippets used for this persona"})]}),(0,t.jsx)(eq,{profileId:e.id,side:"persona_profile_id"})]})]}),(0,t.jsxs)("div",{className:"border-t border-card-border/60 px-6 py-3 flex items-center justify-between gap-3",children:[e?(0,t.jsxs)(r.Button,{type:"button",variant:"ghost",onClick:function(){!e||confirm(`Delete "${e.name}"?`)&&(x(!0),(0,g.deleteWithUndo)({message:"Persona deleted",keys:[`icp_personas:${e.id}`],onOptimistic:()=>{i(null,e.id),x(!1)},onError:()=>l.toast.error("Delete failed"),commit:async()=>{if(!(await fetch(`/api/icp/personas/${e.id}`,{method:"DELETE"})).ok)throw Error("Delete failed")}}))},disabled:u||p,className:"text-destructive hover:text-destructive hover:bg-destructive/10 gap-1.5",children:[u?(0,t.jsx)(eK.ButtonSpinner,{}):(0,t.jsx)(eb.TrashIcon,{className:"h-3.5 w-3.5"}),(0,t.jsx)(eK.ShimmerLabel,{active:u,children:"Delete"})]}):(0,t.jsx)("span",{}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Button,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),(0,t.jsxs)(r.Button,{type:"button",onClick:f,disabled:p,className:"gap-1.5",children:[p&&(0,t.jsx)(eK.ButtonSpinner,{}),(0,t.jsx)(eK.ShimmerLabel,{active:p,children:e?"Save changes":"Create persona"})]})]})]})]})}function e3({value:e,onChange:s,companies:n}){return 0===n.length?(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No target company profiles yet - create one first to link a persona."}):(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(n=>{let a=e.includes(n.id);return(0,t.jsxs)("button",{type:"button",onClick:()=>{var t;return t=n.id,void s(e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${a?"border-foreground
19/30 bg-foreground/10 text-foreground":"border-border text-muted-foreground hover:border-foreground/30 hover:text-foreground"}`,children:[n.name,(0,t.jsxs)("span",{className:"ml-1 opacity-50 text-[10px]",children:["T",n.tier]})]},n.id)})})}function e4({label:e,htmlFor:s,hint:n,required:a,children:i}){return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)(eO.Label,{htmlFor:s,className:"text-xs",children:[e,a&&(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),i,n&&(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground leading-snug",children:n})]})}e.s(["IcpPageClient",0,function({initialCompanies:e,initialPersonas:d}){let[c,p]=(0,a.useSyncedState)(e),[m,u]=(0,a.useSyncedState)(d),[x,g]=(0,n.usePersistedTab)("page-tab:targeting","companies"),[h,f]=(0,s.useState)(null),[j,b]=(0,s.useState)(null),[y,v]=(0,s.useState)({}),[N,w]=(0,s.useState)({}),[C,_]=(0,s.useState)({});async function k(){let e=await fetch("/api/icp/seed",{method:"POST"});if(!(await e.json().catch(()=>({}))).ok)return void l.toast.error("Could not seed examples");let[t,s]=await Promise.all([fetch("/api/icp/companies").then(e=>e.json()),fetch("/api/icp/personas").then(e=>e.json())]);p(t.profiles??[]),u(s.personas??[]),l.toast.success("Added example profiles")}(0,s.useEffect)(()=>{if(0===c.length)return;let e=!1;return fetch("/api/icp/match-counts").then(e=>e.ok?e.json():null).then(t=>{!e&&t&&v(t.counts??{})}).catch(()=>{}),()=>{e=!0}},[c]),(0,s.useEffect)(()=>{if(0===c.length&&0===m.length)return;let e=!1;return fetch("/api/icp/messaging-links/counts").then(e=>e.ok?e.json():null).then(t=>{!e&&t&&(w(t.company_counts??{}),_(t.persona_counts??{}))}).catch(()=>{}),()=>{e=!0}},[c,m]);let S=(0,s.useMemo)(()=>Object.fromEntries(c.map(e=>[e.id,e])),[c]),T=0===c.length&&0===m.length;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"page-title text-[26px] sm:text-3xl font-bold tracking-tight",children:"Targeting"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Define your ideal target companies and personas by tier. The AI agent reads this when researching prospects, drafting outreach, and scoring your contacts."})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[T&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",className:"gap-1.5 h-8 text-xs",onClick:k,children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:"Start with examples"}),(0,t.jsx)("span",{className:"sm:hidden",children:"Examples"})]}),(0,t.jsxs)(r.Button,{className:"shrink-0 rounded-full gap-0 max-sm:size-9 max-sm:p-0 px-5",onClick:()=>"companies"===x?f("new"):b("new"),children:[(0,t.jsx)(i.Plus,{className:"sm:hidden size-4",strokeWidth:2}),(0,t.jsxs)("span",{className:"hidden sm:inline",children:["+ ","companies"===x?"Company profile":"Persona"]})]})]})]}),(0,t.jsxs)(o.Tabs,{value:x,onValueChange:e=>g(e),children:[(0,t.jsxs)(o.TabsList,{className:"justify-start",children:[(0,t.jsxs)(o.TabsTrigger,{value:"companies",children:["Target Companies (",c.length,")"]}),(0,t.jsxs)(o.TabsTrigger,{value:"personas",children:["Target Personas (",m.length,")"]})]}),(0,t.jsx)(o.TabsContent,{value:"companies",className:"pt-4 mt-0",keepMounted:!0,children:(0,t.jsx)(eN,{profiles:c,matchCounts:y,messagingCounts:N,onEdit:e=>f(e),onChange:p,onAddCompany:()=>f("new")})}),(0,t.jsx)(o.TabsContent,{value:"personas",className:"pt-4 mt-0",keepMounted:!0,children:(0,t.jsx)(eT,{personas:m,companyById:S,messagingCounts:C,onEdit:e=>b(e),onChange:u,onAddPersona:()=>b("new")})})]}),(0,t.jsx)(eZ,{open:null!==h,onOpenChange:e=>!e&&f(null),profile:"new"===h?null:h,onSaved:(e,t)=>{t?(p(e=>e.filter(e=>e.id!==t)),u(e=>e.map(e=>({...e,linked_company_profile_ids:e.linked_company_profile_ids.filter(e=>e!==t)})))):e&&p(t=>{let s=t.findIndex(t=>t.id===e.id);if(-1===s)return[...t,e];let n=t.slice();return n[s]=e,n}),f(null)}}),(0,t.jsx)(e2,{open:null!==j,onOpenChange:e=>
19!e&&b(null),persona:"new"===j?null:j,companies:c,onSaved:(e,t)=>{t?u(e=>e.filter(e=>e.id!==t)):e&&u(t=>{let s=t.findIndex(t=>t.id===e.id);if(-1===s)return[...t,e];let n=t.slice();return n[s]=e,n}),b(null)}})]})}],418174)}]);

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.