PageSourceSearch

https://thetool.company/_next/static/chunks/3og0ssztxf1k-.js

js thetool.company collected 2026-09-24 15:00:09 UTC 80,943 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,982760,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(287751),s=e.i(401851),r=e.i(980797),l=e.i(611316),i=e.i(812478),o=e.i(826514),c=e.i(87316),d=e.i(278716),m=e.i(522016),u=e.i(611423),x=e.i(167881),h=e.i(210578),p=e.i(213788),f=e.i(687194),g=e.i(647163);e.s(["EntityMeetingsTab",0,function({entityType:e,entityId:v}){let[j,b]=(0,n.useState)(null),[w,y]=(0,n.useState)({}),[N,k]=(0,n.useState)({}),_=(0,n.useMemo)(()=>{let t=new Date,n=new Date(t.getFullYear(),t.getMonth()-6,1).toISOString(),a=new Date(t.getFullYear(),t.getMonth()+6,1).toISOString();return`/api/calendar/events/entity?entityType=${e}&entityId=${v}&timeMin=${encodeURIComponent(n)}&timeMax=${encodeURIComponent(a)}`},[e,v]),{data:C,isLoading:S,error:T}=(0,a.useCachedFetch)(_,{staleTime:6e4,fetcher:async e=>{let t=await fetch(e);if(!t.ok){let e=await t.json().catch(()=>({}));if(e.needsReconnect)throw Error("calendar_not_connected");throw Error(e.error||"Failed to load")}let n=await t.json();return Array.isArray(n)?n.filter(e=>"cancelled"!==e.status):[]}}),M=(0,n.useMemo)(()=>C??[],[C]),E=T?T instanceof Error?T.message:"Failed to load events":null;(0,n.useEffect)(()=>{let e=new Set;for(let t of M)for(let n of t.attendees??[]){let t=(n.email??"").trim().toLowerCase();t&&e.add(t)}0!==e.size&&fetch("/api/calendar/attendees-records",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({emails:[...e]})}).then(e=>e.ok?e.json():{}).then(e=>{e.attendees&&y(e.attendees),e.googleNames&&k(t=>({...t,...e.googleNames}))}).catch(()=>{})},[M]);let{upcoming:I,past:P}=(0,n.useMemo)(()=>{let e=[],t=[];for(let n of M){let a=(0,f.parseEventStart)(n);a&&(0,i.isPast)(a)?t.push(n):e.push(n)}return e.sort((e,t)=>((0,f.parseEventStart)(e)?.getTime()??0)-((0,f.parseEventStart)(t)?.getTime()??0)),t.sort((e,t)=>{let n=(0,f.parseEventStart)(e)?.getTime()??0;return((0,f.parseEventStart)(t)?.getTime()??0)-n}),{upcoming:e,past:t}},[M]),D=e=>{let t=(0,f.parseEventStart)(e),n=(0,f.parseEventEnd)(e);return t&&n?(0,f.isAllDayEvent)(e)?"All day":`${(0,s.format)(t,"h:mm a")} – ${(0,s.format)(n,"h:mm a")}`:"-"};if(S)return(0,t.jsx)("div",{className:"flex flex-col gap-5 py-4",children:Array.from({length:3}).map((e,n)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u.Skeleton,{className:"h-3 w-24 rounded-full"}),Array.from({length:2}).map((e,n)=>(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-1 py-2",children:[(0,t.jsx)(u.Skeleton,{className:"size-9 rounded-full shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 space-y-1.5 min-w-0",children:[(0,t.jsx)(u.Skeleton,{className:"h-3.5 w-48 rounded-full"}),(0,t.jsx)(u.Skeleton,{className:"h-2.5 w-32 rounded-full"})]})]},n))]},n))});if("calendar_not_connected"===E)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,t.jsx)(c.Calendar,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect your calendar to see meetings"})]});if(E)return(0,t.jsx)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-6 text-sm",children:(0,t.jsx)("p",{className:"font-medium text-destructive",children:E})});if(0===M.length)return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,t.jsx)("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mb-4",children:(0,t.jsx)(c.Calendar,{className:"h-6 w-6 text-muted-foreground"})}),(0,t.jsx)("h3",{className:"text-sm font-medium",children:"No meetings found"}),(0,t.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground max-w-sm",children:["Calendar meetings with this ","contact"===e?"contact":"company"===e?"company":"deal"," will appear here."]})]});let z=(e,n)=>{if(0===n.length)return null;let a=new Map;for(let e of n){let t=(0,f.parseEventStart)(e);if(t){let n=(0,s.format)(t,"yyyy-MM-dd"),r=a.get(n)||[];r.push(e),a.set(n,r)}}let i=Array.from(a.entries()).sort(([t],[n])=>"Upcoming"===e?t.localeCompare(n):n.localeCompare(t));return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[e," (",n.length,")"]}),i.map(([e,n])=>{let a=(0,o.parseISO)(e+"T12:00:00");return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,t.jsx)("div",{className:(0,g.cn)("flex items-center justify-center rounded-full size-9 shrink-0 text-xs font-bold",(0,r.isToday)(a)?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:(0,s.format)(a,"d")}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-semibold",children:(0,r.isToday)(a)?"Today":(0,l.isTomorrow)(a)?"Tomorrow":(0,s.format)(a,"EEEE")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,s.format)(a,"d MMMM, yyyy")})]}),(0,t.jsx)("div",{className:"flex-1 h-px bg-border/40"})]}),(0,t.jsx)("div",{className:"space-y-1.5 mt-1",children:n.map(e=>{let n=j===e.id,a=(0,f.getEventJoinUrl)(e),s=e.attendees?.map(e=>w[(e.email??"").toLowerCase()]).find(e=>e)??null,r=(e.attendees?.[0]?.email??"").toLowerCase(),l=s?.name??e.attendees?.[0]?.displayName??N[r]??e.summary??"?";return(0,t.jsxs)("div",{className:(0,g.cn)("rounded-lg border border-border bg-white dark:bg-background transition-colors",n&&"shadow-sm"),children:[(0,t.jsxs)("button",{onClick:()=>b(t=>t===e.id?null:e.id),className:"flex items-center gap-2.5 p-2.5 w-full text-left",children:[s?.company_logo_url||s?.company_name?(0,t.jsx)(p.CompanyLogo,{domain:s.company_domain,companyName:s.company_name??"",logoUrl:s.company_logo_url,size:"xs"}):(0,t.jsx)(h.ContactAvatar,{imageUrl:s?.image_url??null,name:l,size:"xs"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-[13px] font-medium truncate block",children:e.summary||"(No title)"}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:D(e)}),!n&&e.attendees&&e.attendees.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-0.5",children:[e.attendees.slice(0,3).map((e,n)=>{let a=(e.email??"").toLowerCase(),s=w[a];return(0,t.jsx)(h.ContactAvatar,{imageUrl:s?.image_url??null,name:s?.name??e.displayName??N[a]??a,size:"xs",className:"!h-4 !w-4"},n)}),e.attendees.length>3&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",e.attendees.length-3]})]})]}),a&&!n&&(0,t.jsx)(d.Video,{className:"size-3.5 text-primary shrink-0"})]}),n&&(0,t.jsxs)("div",{className:"px-2.5 pb-2.5 space-y-2 border-t border-border/50 pt-2",children:[(0,t.jsx)("p",{className:"text-[11px] font-medium text-muted-foreground",children:D(e)}),e.location&&(0,t.jsxs)("a",{href:`https://maps.google.com/?q=${encodeURIComponent(e.location)}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-[11px] text-primary hover:underline",children:[(0,t.jsx)("span",{children:"📍"})," ",e.location]}),e.attendees&&e.attendees.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] font-medium text-muted-foreground mb-1.5",children:"Attendees"}),(0,t.jsxs)("div",{className:"space-y-1",children:[e.attendees.slice(0,6).map((e,n)=>{let a=(e.email??"").toLowerCase(),s=w[a],r=s?.name??e.displayName??N[a]??e.email??"";return(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center gap-2 rounded-lg border border-border p-1.5",s&&"hover:bg-muted/30 transition-colors"),children:[(0,t.jsx)(h.ContactAvatar,{imageUrl:s?.image_url??null,name:r,size:"xs"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[s?(0,t.jsx)(m.default,{href:`/people/${s.id}`,className:"text-[11px] font-medium truncate block hover:underline",children:r}):(0,t.jsx)("span",{className:"text-[11px] font-medium truncate block",children:r}),s?.company_name&&(0,t.jsx)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mt-0.5",children:s.company_id?(0,t.jsxs)(m.default,{href:`/companies/${s.company_id}`,className:"flex items-center gap-1 hover:opacity-80 min-w-0",children:[(0,t.jsx)(p.CompanyLogo,{domain:s.company_domain,companyName:s.company_name,logoUrl:s.company_logo_url,size:"xs",className:"!h-3.5 !w-3.5"}),(0,t.jsx)("span",{className:"truncate",children:s.company_name})]}):(0,t.jsx)("span",{className:"truncate",children:s.company_name})})]})]},n)}),e.attendees.length>6&&(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground",children:["+",e.attendees.length-6," more"]})]})]}),a&&(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"inline-flex",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)(x.Button,{size:"sm",className:"h-7 gap-1.5 text-xs",children:[(0,t.jsx)(d.Video,{className:"size-3"})," Join meeting"]})})]})]},e.id)})})]},e)})]})};return(0,t.jsxs)("div",{className:"flex flex-col gap-6 overflow-y-auto min-h-0 flex-1 py-4",children:[z("Upcoming",I),I.length>0&&P.length>0&&(0,t.jsx)("div",{className:"h-px bg-border"}),z("Past",P)]})}])},694853,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(287751),s=e.i(25257),r=e.i(618566),l=e.i(542356),i=e.i(278716),o=e.i(778917),c=e.i(431343),d=e.i(174886),m=e.i(846696),u=e.i(362597),x=e.i(920755),h=e.i(611423),p=e.i(167881),f=e.i(625959),g=e.i(947627),v=e.i(132193),j=e.i(821875),b=e.i(527070),w=e.i(29383),y=e.i(195898),N=e.i(672987),k=e.i(826902),_=e.i(515389),C=e.i(425324),S=e.i(437658),T=e.i(439468),M=e.i(63270),E=e.i(341256),I=e.i(31954),P=e.i(5832);function D({children:e,title:n}){return(0,t.jsx)("span",{title:n,className:"relative inline-flex squircle bg-background p-px shrink-0",children:e})}function z({count:e}){return(0,t.jsx)(D,{children:(0,t.jsxs)("span",{className:"flex size-6 items-center justify-center squircle bg-muted text-[10px] font-medium text-muted-foreground",children:["+",e]})})}function $({name:e,color:n,avatarMap:a}){let s=(0,C.resolveAvatar)(e,a);return(0,t.jsx)(D,{title:e,children:(0,t.jsxs)(M.Avatar,{size:"sm",children:[s?(0,t.jsx)(M.AvatarImage,{src:s,alt:e,className:"object-cover"}):null,(0,t.jsx)(M.AvatarFallback,{className:"text-[9px] font-medium text-foreground
1/70",style:{background:n??"var(--muted)"},children:(0,C.initialsOf)(e)})]})})}function R({company:e}){let n=(0,T.useDomainLogo)(e.domain),a=e.logo_url??n;return(0,t.jsx)(D,{title:e.name,children:(0,t.jsxs)(M.Avatar,{size:"sm",children:[a?(0,t.jsx)(M.AvatarImage,{src:a,alt:e.name,className:"object-contain bg-white"}):null,(0,t.jsx)(M.AvatarFallback,{className:"text-[9px] font-medium text-foreground/70",children:(0,C.initialsOf)(e.name)})]})})}function L({companies:e}){return e&&0!==e.length?(0,t.jsxs)("div",{className:"flex -space-x-2",children:[e.slice(0,4).map(e=>(0,t.jsx)(R,{company:e},e.id)),e.length>4&&(0,t.jsx)(z,{count:e.length-4})]}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground/40",children:"-"})}function A(e){if(!e)return"0:00";let t=Math.floor(e/1e3),n=Math.floor(t/3600),a=Math.floor(t%3600/60),s=t%60;return n>0?`${n}:${a.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${a}:${s.toString().padStart(2,"0")}`}function q(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let a=Math.floor(n/24);return a<30?`${a}d ago`:new Date(e).toLocaleDateString("en-GB")}function B(e){let t=e.speaker_analytics?.map(e=>e.name)??[],n=e.participants??[];if(0===t.length)return n;let a=new Set(t.map(e=>e.toLowerCase()));return[...t,...n.filter(e=>e&&!a.has(e.toLowerCase()))]}function F({buckets:e,pct:n}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-[100px]",children:[e&&e.length>0?(0,t.jsx)("div",{className:"flex h-2.5 rounded-full overflow-hidden gap-[1px] bg-muted/40 flex-1 min-w-[80px]",children:e.map((e,n)=>(0,t.jsx)("div",{className:"flex-1 min-w-[1px] rounded-[1px]",style:{background:e?"oklch(0.65 0.10 240)":"oklch(0.92 0 0)"}},n))}):(0,t.jsx)("div",{className:"h-2.5 rounded-full bg-muted/40 flex-1 min-w-[80px] overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full",style:{width:`${Math.max(2,n)}%`,background:"oklch(0.65 0.10 240)"}})}),(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 whitespace-nowrap",children:[n,"%"]})]})}let U=["title","created","duration","conferencing","owner","participants","companies","talktime"],O={title:"Title",created:"Date",duration:"Duration",conferencing:"Conferencing",owner:"Owner",participants:"Participants",companies:"Companies",talktime:"Talk time"},H=new Set(["title","created","duration"]);function W({id:e}){switch(e){case"title":return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(h.Skeleton,{className:"h-3.5 w-40 rounded-full"}),(0,t.jsx)(h.Skeleton,{className:"h-2.5 w-24 rounded-full"})]});case"conferencing":return(0,t.jsx)(h.Skeleton,{className:"h-5 w-16 rounded-full"});case"owner":return(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(h.Skeleton,{className:"h-5 w-5 squircle shrink-0"}),(0,t.jsx)(h.Skeleton,{className:"h-3.5 w-16 rounded-full"})]});case"participants":case"companies":return(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(h.Skeleton,{className:"h-5 w-5 rounded-full"}),(0,t.jsx)(h.Skeleton,{className:"h-5 w-5 rounded-full"})]});case"created":return(0,t.jsx)(h.Skeleton,{className:"h-4 w-16 rounded-full"});case"duration":case"talktime":return(0,t.jsx)(h.Skeleton,{className:"h-4 w-12 rounded-full"});default:return(0,t.jsx)(h.Skeleton,{className:"h-4 w-20 rounded-full"})}}e.s(["EntityRecordingsTab",0,function({entityType:e,entityId:T}){let M=(0,s.useShareOrigin)("video"),{data:D=[],isLoading:R,mutate:G}=(0,a.useCachedFetch)(`/api/videos/recordings?entityType=${encodeURIComponent(e)}&entityId=${encodeURIComponent(T)}`,{staleTime:3e4,fetcher:async e=>{let t=await fetch(e);if(!t.ok)return[];let{recordings:n}=await t.json();return n}}),[X,V]=(0,n.useState)(""),[Y,J]=(0,P.usePersistedView)("entity-recordings"),[K,Q]=(0,n.useState)([]),[Z,ee]=(0,n.use
1State)(new Set),et=(0,n.useRef)(null),{sortColumn:en,sortDir:ea,handleSort:es}=(0,k.useTableSort)("created","desc"),{getColumnStyle:er,getResizeProps:el}=(0,j.useColumnResize)("entity-recordings"),ei=(0,n.useMemo)(()=>[...U],[]),{orderedIds:eo,getDragProps:ec}=(0,b.useColumnOrder)("entity-recordings",ei),ed=(0,r.useRouter)(),em=(0,n.useMemo)(()=>(0,l.createIntentPrefetcher)(ed),[ed]),eu=(0,x.createClient)(),ex=(0,n.useMemo)(()=>[{key:"source",label:"Source",type:"select",options:_.MEETING_SOURCE_FILTER_OPTIONS},{key:"date",label:"Date",type:"select",options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"},{value:"older",label:"Older"}]},{key:"auto",label:"Recording type",type:"select",options:[{value:"auto",label:"Auto-recorded"},{value:"manual",label:"Manual"}]}],[]),eh=D.length>0&&Z.size===D.length,ep=Z.size>0&&!eh,ef=async(e,t)=>{G(n=>(n??[]).map(n=>n.id===e?{...n,title:t}:n));let{error:n}=await eu.from("videos").update({title:t}).eq("id",e);n&&(G(D),m.toast.error("Failed to rename recording"))},eg=(0,n.useMemo)(()=>{let e=D;if(X.trim()){let t=X.toLowerCase();e=e.filter(e=>e.title.toLowerCase().includes(t)||e.owner?.full_name?.toLowerCase().includes(t)||B(e).some(e=>e.toLowerCase().includes(t)))}for(let t of K)if("source"===t.field&&(e=e.filter(e=>(0,_.matchesSourceFilter)(e.meeting_source,t.value))),"auto"===t.field&&"auto"===t.value&&(e=e.filter(e=>e.auto_recorded)),"auto"===t.field&&"manual"===t.value&&(e=e.filter(e=>!e.auto_recorded)),"date"===t.field){let n=Date.now();"today"===t.value&&(e=e.filter(e=>n-new Date(e.created_at).getTime()<864e5)),"week"===t.value&&(e=e.filter(e=>n-new Date(e.created_at).getTime()<6048e5)),"month"===t.value&&(e=e.filter(e=>n-new Date(e.created_at).getTime()<2592e6)),"older"===t.value&&(e=e.filter(e=>n-new Date(e.created_at).getTime()>=2592e6))}return en?[...e].sort((e,t)=>{let n=0;switch(en){case"title":n=e.title.localeCompare(t.title);break;case"created":n=new Date(e.created_at).getTime()-new Date(t.created_at).getTime();break;case"duration":n=(e.duration_ms||0)-(t.duration_ms||0)}return"desc"===ea?-n:n}):e},[D,X,K,en,ea]);return R?(0,t.jsxs)("div",{className:"flex flex-col gap-4 pt-4 pb-4 overflow-hidden flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)(N.DynamicFilterBar,{fields:ex,search:X,onSearchChange:V,searchPlaceholder:"Search recordings…",filters:K,onFiltersChange:Q}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(y.ViewToggle,{view:Y,onChange:J})})]}),(0,t.jsx)("div",{className:"rounded-lg border border-border/50 overflow-hidden",children:(0,t.jsxs)(g.Table,{children:[(0,t.jsx)(g.TableHeader,{children:(0,t.jsxs)(g.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(g.TableHead,{className:"w-10 pl-4",children:(0,t.jsx)(h.Skeleton,{className:"h-4 w-4 rounded"})}),(0,t.jsx)(g.TableHead,{className:"w-16"}),eo.map(e=>(0,t.jsx)(g.TableHead,{className:"text-xs text-muted-foreground font-medium",style:er(e),children:O[e]},e)),(0,t.jsx)(g.TableHead,{className:"w-24"})]})}),(0,t.jsx)(g.TableBody,{children:Array.from({length:6}).map((e,n)=>(0,t.jsxs)(g.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(g.TableCell,{className:"w-10 pl-4",children:(0,t.jsx)(h.Skeleton,{className:"h-4 w-4 rounded"})}),(0,t.jsx)(g.TableCell,{className:"w-16",children:(0,t.jsx)(h.Skeleton,{className:"h-12 w-20 rounded-md"})}),eo.map(e=>(0,t.jsx)(g.TableCell,{style:er(e),children:(0,t.jsx)(W,{id:e})},e)),(0,t.jsx)(g.TableCell,{className:"w-24"})]},n))})]})})]}):0!==D.length||X||0!==K.length?(0,t.jsxs)("div",{className:"flex flex-col gap-4 pt-4 pb-4 overflow-hidden flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)(N.DynamicFilterBar,{fields:ex,search:X,onSearchChange:V,searchPlaceholder:"Search recordings…",filters:K,onFiltersChange:Q}),(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(y.ViewToggle,{view:Y,onChange:J})})]}),Z.size>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/50 rounded-lg text-sm shrink-0",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[Z.size," selected"]}),(0,t.jsxs)(p.Button,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>
1{if(!confirm(`Delete ${Z.size} recording${Z.size>1?"s":""}?`))return;let e=Array.from(Z);(0,u.deleteWithUndo)({message:`${e.length} recording${e.length>1?"s":""} deleted`,keys:e.map(e=>`videos:${e}`),onOptimistic:()=>{G(t=>(t??[]).filter(t=>!e.includes(t.id))),ee(new Set)},onUndo:()=>G(D),onError:()=>{G(D),m.toast.error("Failed to delete")},commit:async()=>{for(let t of e){let{error:e}=await eu.from("videos").delete().eq("id",t);if(e)throw e}}})},children:[(0,t.jsx)(E.TrashIcon,{className:"h-3 w-3 mr-1"})," Delete"]}),(0,t.jsx)(p.Button,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>ee(new Set),children:"Clear"})]}),"table"===Y&&(0,t.jsx)("div",{className:"rounded-lg border border-border/50 overflow-hidden flex-1 min-h-0",children:(0,t.jsxs)(g.Table,{children:[(0,t.jsx)(g.TableHeader,{children:(0,t.jsxs)(g.TableRow,{className:"hover:bg-transparent",children:[(0,t.jsx)(g.TableHead,{className:"w-10 pl-4",children:(0,t.jsx)(f.Checkbox,{checked:!!eh||!!ep&&"indeterminate",onCheckedChange:()=>ee(eh?new Set:new Set(D.map(e=>e.id)))})}),(0,t.jsx)(g.TableHead,{className:"w-16"}),eo.map(e=>H.has(e)?(0,t.jsx)(w.SortableTableHead,{columnId:e,label:O[e],sortColumn:en,sortDir:ea,onSort:es,className:"text-xs text-muted-foreground font-medium",style:er(e),extra:(0,t.jsx)(g.TableResizeHandle,{...el(e)}),...ec(e)},e):(0,t.jsxs)(g.TableHead,{className:"text-xs text-muted-foreground font-medium",style:er(e),...ec(e),children:[O[e],(0,t.jsx)(g.TableResizeHandle,{...el(e)})]},e)),(0,t.jsx)(g.TableHead,{className:"w-24"})]})}),(0,t.jsx)(g.TableBody,{children:eg.map(e=>{let n=function(e){if(!e||0===e.length)return null;let t=0,n=0;for(let a of e)a.you&&t++,a.others&&n++;let a=e.length;return{youPercent:Math.round(t/a*100),othersPercent:Math.round(n/a*100)}}(e.speaker_timeline),a=B(e),s=(0,C.buildSpeakerColorMap)(a),r=new Map(Object.entries(e.participant_avatars??{}));return(0,t.jsxs)(g.TableRow,{className:"cursor-pointer group",onClick:()=>{(0,S.markVideoShell)("meeting"),ed.push(`/videos/${e.id}`)},onMouseEnter:()=>em.enter(`/videos/${e.id}`),onMouseLeave:em.leave,children:[(0,t.jsx)(g.TableCell,{className:"pl-4",onClick:t=>{t.stopPropagation(),((e,t=[],n=!1)=>{ee(a=>(0,I.applyRangeToggle)(a,e,t,et.current,n)),et.current=e})(e.id,eg.map(e=>e.id),t.shiftKey)},children:(0,t.jsx)(f.Checkbox,{checked:Z.has(e.id),"aria-label":"Select recording"})}),(0,t.jsx)(g.TableCell,{className:"pr-0",children:(0,t.jsx)("div",{className:"w-14 h-9 rounded bg-muted overflow-hidden flex items-center justify-center shrink-0",children:e.thumbnail_url?(0,t.jsx)("img",{src:e.thumbnail_url,alt:"",className:"w-full h-full object-cover"}):(0,t.jsx)(c.Play,{className:"h-3 w-3 text-muted-foreground/40"})})}),eo.map(l=>(l=>{switch(l){case"title":return(0,t.jsxs)(g.TableCell,{children:[(0,t.jsx)(v.InlineEdit,{value:e.title,onSave:t=>ef(e.id,t),required:!0,className:"font-medium text-sm max-w-[220px]",title:`${e.title} (click to edit)`}),e.auto_recorded&&(0,t.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] font-medium bg-muted text-muted-foreground mt-0.5 block w-fit",children:"Auto"})]},l);case"created":return(0,t.jsx)(g.TableCell,{className:"text-muted-foreground text-xs",children:q(e.created_at)},l);case"duration":return(0,t.jsx)(g.TableCell,{className:"text-muted-foreground font-mono text-xs",children:A(e.duration_ms)},l);case"conferencing":return(0,t.jsx)(g.TableCell,{children:(0,t.jsx)(_.MeetingSourceCell,{source:e.meeting_source})},l);case"owner":return(0,t.jsx)(g.TableCell,{children:e.owner?(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.owner.avatar_url?(0,t.jsx)("img",{src:e.owner.avatar_url,alt:"",className:"h-5 w-5 squircle object-cover shrink-0 avatar-border"}):(0,t.jsx)("span",{className:"h-5 w-5 squircle bg-muted flex items-center justify-center text-[8px] font-medium text-muted-foreground shrink-0 avatar-border",children:(0,C.initialsOf)(e.owner.full_name??"?")}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:e.owner.full_name??"Unknown"})]}
1):(0,t.jsx)("span",{className:"text-xs text-muted-foreground/40",children:"-"})},l);case"participants":return(0,t.jsx)(g.TableCell,{children:a.length>0?(0,t.jsxs)("div",{className:"flex -space-x-2",children:[a.slice(0,4).map((e,n)=>(0,t.jsx)($,{name:e,color:s.get(e),avatarMap:r},n)),a.length>4&&(0,t.jsx)(z,{count:a.length-4})]}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground/40",children:"-"})},l);case"companies":return(0,t.jsx)(g.TableCell,{children:(0,t.jsx)(L,{companies:e.companies})},l);case"talktime":{let a=e.my_talk_pct??n?.youPercent??null;return(0,t.jsx)(g.TableCell,{children:null!=a?(0,t.jsx)(F,{buckets:e.my_talk_buckets,pct:a}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground/40",children:"-"})},l)}default:return null}})(l)),(0,t.jsx)(g.TableCell,{children:(0,t.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)("button",{onClick:t=>{var n;return n=e.share_token,void(t.stopPropagation(),navigator.clipboard.writeText(`${M||window.location.origin}/watch/${n}`),m.toast.success("Link copied"))},className:"h-6 w-6 rounded flex items-center justify-center hover:bg-muted",title:"Copy link",children:(0,t.jsx)(d.Copy,{className:"h-3 w-3 text-muted-foreground"})}),e.meeting_url&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),window.open(e.meeting_url,"_blank")},className:"h-6 w-6 rounded flex items-center justify-center hover:bg-muted",title:"Open Meet",children:(0,t.jsx)(o.ExternalLink,{className:"h-3 w-3 text-muted-foreground"})}),(0,t.jsx)("button",{onClick:t=>{var n;return n=e.id,void(t?.stopPropagation(),!confirm("Delete this recording?")||(0,u.deleteWithUndo)({message:"Deleted",keys:[`videos:${n}`],onOptimistic:()=>G(e=>(e??[]).filter(e=>e.id!==n)),onUndo:()=>G(D),onError:()=>{G(D),m.toast.error("Failed to delete")},commit:()=>eu.from("videos").delete().eq("id",n)}))},className:"h-6 w-6 rounded flex items-center justify-center hover:bg-muted hover:text-destructive",title:"Delete",children:(0,t.jsx)(E.TrashIcon,{className:"h-3 w-3 text-muted-foreground"})})]})})]},e.id)})})]})}),"kanban"===Y&&(0,t.jsx)("div",{className:"overflow-y-auto flex-1 min-h-0",children:(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:eg.map(e=>(0,t.jsxs)("div",{className:"group cursor-pointer",onClick:()=>{(0,S.markVideoShell)("meeting"),ed.push(`/videos/${e.id}`)},onMouseEnter:()=>em.enter(`/videos/${e.id}`),onMouseLeave:em.leave,children:[(0,t.jsxs)("div",{className:"relative aspect-video bg-muted rounded-md overflow-hidden border border-card-border",children:[e.thumbnail_url?(0,t.jsx)("img",{src:e.thumbnail_url,alt:e.title,className:"w-full h-full object-cover"}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,t.jsx)(c.Play,{className:"h-6 w-6 text-muted-foreground/30"})}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center group-hover:opacity-0 transition-opacity pointer-events-none",children:(0,t.jsx)("div",{className:"h-9 w-9 rounded-full bg-black/35 backdrop-blur-sm flex items-center justify-center",children:(0,t.jsx)(c.Play,{className:"h-3.5 w-3.5 text-white ml-0.5",fill:"white"})})}),e.duration_ms&&(0,t.jsx)("div",{className:"absolute bottom-1.5 right-1.5 px-1.5 py-0.5 rounded bg-black/70 text-white text-[10px] font-mono",children:A(e.duration_ms)})]}),(0,t.jsx)("p",{className:"text-sm font-medium truncate mt-1.5 px-0.5",children:e.title}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-0.5 px-0.5 w-fit",children:[(0,t.jsx)("span",{children:q(e.created_at)}),(0,t.jsx)(_.MeetingSourcePill,{source:e.meeting_source})]})]},e.id))})}),0===eg.length&&(X||K.length>0)&&(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground py-8",children:"No recordings match your filters"})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,t.jsx)("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mb-4",children:(0,t.jsx)(i.Video,{className:"h-6 w-6 text-muted-foreground"})}),(0,t.jsx)("h3",{className:"text-sm font-medium",children:"No meeting recordings"}),(0,t.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground max-w-sm",children:["Meeting recordings associated with this ","contact"===e?"contact":"company"===e?"company":"deal"," will appear here."]})]})}])},841074,344984,503738,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(643531),s=e.i(844700),r=e.i(920755),l=e.i(705599),i=e.i(916371),o=e.i(494913),c=e.i(541071),d=e.i(367240),m=e.i(788699),u=e.i(903659),x=e.i(993899),h=e.i(167881),p=e.i(463415),f=e.i(63270),g=e.i(846696),v=e.i(101380),j=e.i(740043);function b({body:e,variant:a="inline"}){let s=(0,v.tokenizeBody)(e);return(0,t.jsx)("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:s.map((e,s)=>"mention"===e.kind?(0,t.jsx)(j.MentionPill,{type:e.entity_type,id:e.entity_id,name:e.display_name,variant:a},s):(0,t.jsx)(n.Fragment,{children:e.value},s))})}e.s(["CommentBody",0,b],344984);var w=e.i(178583),y=e.i(37727),N=e.i(761691),k=e.i(609216);function _({attachments:e}
1){let[a,s]=(0,n.useState)(null);return 0===e.length?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>{let n=e.mime_type.startsWith("image/"),a=e.mime_type.startsWith("video/");return n?(0,t.jsx)("button",{type:"button",onClick:()=>s(e),className:"block focus:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded-lg",children:(0,t.jsx)("img",{src:e.url,alt:e.name,className:"max-h-48 max-w-[16rem] rounded-lg border object-cover hover:opacity-90 transition-opacity"})},e.id):a?(0,t.jsx)(k.VideoPlayer,{src:e.url,className:"rounded-lg border",videoClassName:"max-h-48 max-w-[16rem]"},e.id):(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-lg border bg-muted/40 px-2.5 py-1.5 text-xs hover:bg-muted transition-colors max-w-[14rem]",children:[(0,N.isPdfFile)(e.mime_type,e.name)?(0,t.jsx)(N.PdfIcon,{className:"h-3.5 w-3.5 shrink-0"}):(0,t.jsx)(w.FileText,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.name||"Attachment"})]},e.id)})}),a&&(0,t.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:()=>s(null),children:[(0,t.jsx)("button",{type:"button",onClick:()=>s(null),className:"absolute top-4 right-4 h-9 w-9 flex items-center justify-center rounded-full bg-white/10 backdrop-blur-md text-white hover:bg-white/20 transition-colors z-10",children:(0,t.jsx)(y.X,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{className:"max-w-[90vw] max-h-[85vh]",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("img",{src:a.url,alt:a.name,className:"max-w-full max-h-[85vh] object-contain rounded-xl"}),a.name&&(0,t.jsx)("p",{className:"text-center text-white/60 text-xs mt-2 truncate",children:a.name})]})]})]})}var C=e.i(341256);function S(e){return e&&((e.full_name||e.email).match(/\b\w/g)||[]).slice(0,2).join("").toUpperCase()||"?"}function T(e){return e?e.full_name||e.email:"Unknown"}function M({comment:e,replies:r,authors:l,attachmentsByComment:j,currentUserId:w,isReply:y,variant:N="default",showConnector:k=!1,onReply:E,onUpdate:I,onDelete:P}){let D=l[e.owner_id],z=w===e.owner_id,[$,R]=(0,n.useState)(!1),[L,A]=(0,n.use
1State)(!1),[q,B]=(0,n.useState)(!1),[F,U]=(0,n.useState)(!1),[O,H]=(0,n.useState)([]),W=!!e.resolved_at,G=j[e.id]??[];return L?(0,t.jsx)("div",{className:W?"opacity-60":"",children:(0,t.jsx)(i.CommentComposer,{autoFocus:!0,submitLabel:"Save",placeholder:"Edit comment",initialText:(0,v.parseStoredBody)(e.body).text,initialMentions:(0,v.parseStoredBody)(e.body).mentions,initialAttachments:(G??[]).map(e=>({url:e.url,mime_type:e.mime_type,name:e.name,size_bytes:e.size_bytes,width:e.width,height:e.height})),onCancel:()=>A(!1),onSubmit:async({body:t,mentions:n,attachments:a})=>{await I(e.id,{body:t,mentions:n,attachments:a}),A(!1)}})}):"compact"===N?(0,t.jsxs)("li",{className:"group/comment relative flex gap-2.5 text-sm",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center shrink-0",children:[(0,t.jsxs)(f.Avatar,{className:"h-6 w-6",children:[D?.avatar_url&&(0,t.jsx)(f.AvatarImage,{src:D.avatar_url,alt:T(D)}),(0,t.jsx)(f.AvatarFallback,{className:"text-[10px]",children:S(D)})]}),k&&(0,t.jsx)("div",{className:"w-px flex-1 bg-border/60 mt-1"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 pb-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 h-6",children:[(0,t.jsx)("span",{className:"text-sm font-semibold leading-none",children:T(D)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground leading-none",children:function(e){let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${Math.max(t,1)}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let a=Math.floor(n/60);if(a<24)return`${a}h`;let s=Math.floor(a/24);if(s<7)return`${s}d`;let r=Math.floor(s/7);if(r<5)return`${r}w`;let l=Math.floor(s/30);return l<12?`${l}mo`:`${Math.floor(s/365)}y`}(new Date(e.created_at))}),e.updated_at!==e.created_at&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground/70 leading-none",children:"(edited)"})]}),(0,t.jsxs)("div",{className:"mt-1",children:[e.body.trim().length>0&&(0,t.jsx)(b,{body:e.body}),G.length>0&&(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(_,{attachments:G})}),O.length>0&&(0,t.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:O.map((e,n)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-xs",children:[(0,t.jsx)("span",{children:e}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:"1"})]},`${e}-${n}`))})]})]}),(0,t.jsxs)("div",{className:"absolute right-0 -top-2 z-10 flex items-center gap-0.5 rounded-md border border-border/60 bg-white dark:bg-card p-0.5 shadow-sm opacity-0 pointer-events-none transition-opacity group-hover/comment:opacity-100 group-hover/comment:pointer-events-auto has-[[data-state=open]]:opacity-100 has-[[data-state=open]]:pointer-events-auto",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("button",{type:"button",onClick:()=>U(e=>!e),className:"h-6 w-6 inline-flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted rounded","aria-label":"Add reaction",title:"Add reaction",children:(0,t.jsx)(u.SmilePlus,{className:"h-3.5 w-3.5"})}),F&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[199]",onClick:()=>U(!1)}),(0,t.jsx)("div",{ref:e=>{if(!e)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left="auto",e.style.right="0"),t.bottom>window.innerHeight-8&&(e.style.top="auto",e.style.bottom="100%",e.style.marginTop="0",e.style.marginBottom="4px")},className:"absolute top-full left-0 mt-1 z-[200]",children:(0,t.jsx)(x.EmojiPicker,{onSelect:e=>{H(t=>[...t,e]),U(!1)},onClose:()=>U(!1)})})]})]}),z&&(0,t.jsxs)(p.DropdownMenu,{children:[(0,t.jsx)(p.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:"h-6 w-6 inline-flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted rounded","aria-label":"More actions",children:(0,t.jsx)(c.MoreHorizontal,{className:"h-3.5 w-3.5"})})}),(0,t.jsxs)(p.DropdownMenuContent,{align:"end",sideOffset:4,collisionPadding:8,children:[(0,t.jsxs)(p.DropdownMenuItem,{onClick:()=>A(!0),children:[(0,t.jsx)(m.Pencil,{className:"!h-3.5 !w-3.5"}),"Edit"]}),(0,t.jsxs)(p.DropdownMenuItem,{onClick:()=>B(!0),className:"text-destructive focus:text-destructive",children:[(0,t.jsx)(C.TrashIcon,{className:"!h-3.5 !w-3.5"}),"Delete"]})]})]})]}),q&&(0,t.jsxs)("div",{className:"absolute right-0 top-7 z-20 flex items-center gap-2 rounded-lg border bg-background shadow-md px-3 py-2 text-xs",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Delete?"}),(0,t.jsx)(h.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>B(!1),children:"Cancel"}),(0,t.jsx)(h.Button,{variant:"destructive",size:"sm",className:"h-6 px-2 text-xs",onClick:async()=>{try{await P(e.id)}catch(e){g.toast.error(e instanceof Error?e.message:"Failed to delete")}B(!1)},children:"Delete"})]})]}):(0,t.jsxs)("div",{className:W?"opacity-60":"",children:[(0,t.jsx)("div",{className:"rounded-2xl border border-card-border bg-light-oat dark:bg-black p-3 hover:border-foreground
1/20 transition-colors",children:(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsxs)(f.Avatar,{className:"h-8 w-8 shrink-0",children:[D?.avatar_url&&(0,t.jsx)(f.AvatarImage,{src:D.avatar_url,alt:T(D)}),(0,t.jsx)(f.AvatarFallback,{children:S(D)})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"font-medium truncate",children:T(D)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,o.formatDistanceToNow)(new Date(e.created_at),{addSuffix:!0})}),e.updated_at!==e.created_at&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground/70",children:"(edited)"}),W&&(0,t.jsxs)("span",{className:"ml-1 inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-success",children:[(0,t.jsx)(a.Check,{className:"h-3 w-3"})," Resolved"]})]}),e.body.trim().length>0&&(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsx)(b,{body:e.body})}),G.length>0&&(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(_,{attachments:G})}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[!y&&E&&(0,t.jsxs)(h.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground hover:bg-accent",onClick:()=>R(e=>!e),children:[(0,t.jsx)(s.ChatBubbleIcon,{className:"!h-3.5 !w-3.5"}),"Reply"]}),!y&&(0,t.jsx)(h.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground hover:bg-accent",onClick:()=>I(e.id,{resolved:!W}).catch(e=>g.toast.error(e instanceof Error?e.message:"Failed")),children:W?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.RotateCcw,{className:"!h-3.5 !w-3.5"}),"Reopen"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Check,{className:"!h-3.5 !w-3.5"}),"Resolve"]})})]}),z&&(0,t.jsxs)(p.DropdownMenu,{children:[(0,t.jsx)(p.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:"h-7 w-7 flex items-center justify-center squircle text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:(0,t.jsx)(c.MoreHorizontal,{className:"h-4 w-4"})})}),(0,t.jsxs)(p.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(p.DropdownMenuItem,{onClick:()=>A(!0),children:[(0,t.jsx)(m.Pencil,{className:"!h-3.5 !w-3.5"}),"Edit"]}),(0,t.jsxs)(p.DropdownMenuItem,{onClick:()=>B(!0),className:"text-destructive focus:text-destructive",children:[(0,t.jsx)(C.TrashIcon,{className:"!h-3.5 !w-3.5"}),"Delete"]})]})]})]})]})]})}),q&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Delete this comment?"}),(0,t.jsx)(h.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>B(!1),children:"Cancel"}),(0,t.jsx)(h.Button,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:async()=>{try{await P(e.id)}catch(e){g.toast.error(e instanceof Error?e.message:"Failed to delete")}B(!1)},children:"Delete"})]}),r.length>0&&(0,t.jsx)("div",{className:"mt-3 space-y-3 border-l-2 border-border/60 pl-4",children:r.map(e=>(0,t.jsx)(M,{comment:e,replies:[],authors:l,attachmentsByComment:j,currentUserId:w,isReply:!0,onUpdate:I,onDelete:P},e.id))}),$&&E&&(0,t.jsx)("div",{className:"mt-3 pl-4 border-l-2 border-border/60",children:(0,t.jsx)(i.CommentComposer,{autoFocus:!0,submitLabel:"Reply",placeholder:"Reply to this thread… use @ to mention someone",onCancel:()=>R(!1),onSubmit:async({body:e,mentions:t,attachments:n})=>{await E({body:e,mentions:t,attachments:n}),R(!1)}})})]})}e.s(["CommentItem",0,M],503738);let E=[{value:"open",label:"Open"},{value:"resolved",label:"Resolved"},{value:"all",label:"All"}];e.s(["CommentsSection",0,function({entityType:e,entityId:o,hideEmpty:c=!1,variant:d="default",headerLabel:m}){let{comments:u,authors:x,attachmentsByComment:h,loading:p,error:f,createComment:g,updateComment:v,deleteComment:j}
1=(0,l.useComments)(e,o),[b,w]=(0,n.useState)(null),[y,N]=(0,n.useState)("open");(0,n.useEffect)(()=>{let e=!1;return(async()=>{let t=(0,r.createClient)(),{data:{user:n}}=await t.auth.getUser();e||w(n?.id??null)})(),()=>{e=!0}},[]);let k=(0,n.useMemo)(()=>{let e=u.filter(e=>!e.parent_comment_id),t=new Map;for(let e of u){if(!e.parent_comment_id)continue;let n=t.get(e.parent_comment_id)??[];n.push(e),t.set(e.parent_comment_id,n)}return e.slice().sort((e,t)=>t.created_at<e.created_at?-1:1).map(e=>({comment:e,replies:(t.get(e.id)??[]).slice().sort((e,t)=>e.created_at<t.created_at?-1:1)}))},[u]),_=(0,n.useMemo)(()=>"all"===y?k:"resolved"===y?k.filter(e=>!!e.comment.resolved_at):k.filter(e=>!e.comment.resolved_at),[k,y]),C=(0,n.useMemo)(()=>{let e=0,t=0;for(let n of k)n.comment.resolved_at?t+=1:e+=1;return{open:e,resolved:t,all:k.length}},[k]);if("compact"===d){let e=u.filter(e=>!e.resolved_at).slice().sort((e,t)=>e.created_at<t.created_at?-1:1);return(0,t.jsxs)("div",{className:"group/thread space-y-3",children:[m&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 min-h-[1.25rem]",children:[(0,t.jsx)("h4",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:m}),e.length>0&&(0,t.jsxs)("button",{type:"button",onClick:async()=>{for(let t of e)await v(t.id,{resolved:!0})},className:"inline-flex items-center gap-1 rounded-md px-2 h-6 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground hover:bg-muted group-hover/thread:opacity-100","aria-label":"Resolve thread",title:"Resolve thread",children:[(0,t.jsx)(a.Check,{className:"h-3.5 w-3.5"}),"Resolve"]})]}),e.length>0&&(0,t.jsx)("ul",{className:"space-y-0",children:e.map((n,a)=>(0,t.jsx)(M,{comment:n,replies:[],authors:x,attachmentsByComment:h,currentUserId:b,variant:"compact",showConnector:a<e.length-1,onUpdate:v,onDelete:j},n.id))}),(0,t.jsx)(i.CommentComposer,{onSubmit:async({body:e,mentions:t,attachments:n})=>{await g({body:e,mentions:t,attachments:n})}})]})}return(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsx)(i.CommentComposer,{onSubmit:async({body:e,mentions:t,attachments:n})=>{await g({body:e,mentions:t,attachments:n})}}),k.length>0&&(0,t.jsx)("div",{className:"flex items-center gap-1 text-xs",children:E.map(e=>{let n=C[e.value],a=y===e.value;return(0,t.jsxs)("button",{type:"button",onClick:()=>N(e.value),className:"rounded-full px-3 py-1 transition-colors "+(a?"bg-foreground text-background":"bg-muted/50 text-muted-foreground hover:bg-muted"),children:[e.label,(0,t.jsx)("span",{className:"ml-1.5 text-[10px] opacity-70",children:n})]},e.value)})}),f&&(0,t.jsx)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive",children:f}),p?(0,t.jsx)("div",{className:"space-y-4",children:[0,1,2].map(e=>(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("div",{className:"h-8 w-8 shrink-0 rounded-full bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,t.jsx)("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-3 w-full rounded bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-3 w-2/3 rounded bg-muted animate-pulse"})]})]},e))}):0===_.length?c?null:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 rounded-2xl border border-dashed py-10 text-center",children:[(0,t.jsx)("div",{className:"rounded-full bg-muted/60 p-2.5",children:(0,t.jsx)(s.ChatBubbleIcon,{className:"h-4 w-4 text-muted-foreground"})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:0===k.length?"No comments yet - start the conversation above.":"open"===y?"No open comments.":"No resolved comments."})]}):(0,t.jsx)("div",{className:"space-y-6",children:_.map(e=>(0,t.jsx)(M,{comment:e.comment,replies:e.replies,authors:x,attachmentsByComment:h,currentUserId:b,onReply:async({body:t,mentions:n,attachments:a})=>{await g({body:t,mentions:n,attachments:a,parentCommentId:e.comment.id})},onUpdate:v,onDelete:j},e.comment.id))})]})}],841074)},740043,e=>{"use strict";var t=e.i(843476),n=e.i(522016),a=e.i(271645),s=e.i(149685),r=e.i(839124),l=e.i(620278),i=e.i(213788),o=e.i(210578),c=e.i(290593),d=e.i(920755),m=e.i(647163),u=e.i(783618);let x={user:()=>null,contact:e=>`/people/${e}`,company:e=>`/companies/${e}`,deal:e=>`/deals/${e}`,goal:()=>"/goals",plan:e=>`/plans/${e}`,plan_task:()=>null,visitor:()=>null},h=new Map,p=new Map;async function f(e,t){let n=`${e}:${t}`,a=h.get(n);if(a)return a;let s=p.get(n);if(s)return s;let r=(async()=>{let a=(0,d.createClient)(),s=null,r=null;try{if("user"===e){let{data:e}=await a.from("profiles").select("avatar_url").eq("id",t).maybeSingle();s=e?.avatar_url??null}else if("contact"===e){let{data:e}=await a.from("contacts").select("image_url").eq("id",t).maybeSingle();s=e?.image_url??null}else if("company"===e){let{data:e}=await a.from("companies").select("logo_url, domain").eq("id",t).maybeSingle();s=e?.logo_url??null,r=e?.domain??null}}catch{}
1let l={imageUrl:s,domain:r};return h.set(n,l),p.delete(n),l})();return p.set(n,r),r}function g(e,t){let[n,s]=(0,a.useState)(()=>h.get(`${e}:${t}`)??null);return(0,a.useEffect)(()=>{if(null!==n||"user"!==e&&"contact"!==e&&"company"!==e)return;let a=!1;return f(e,t).then(e=>{a||s(e)}),()=>{a=!0}},[e,t,n]),n}let v=(0,u.pillClass)("default","sq-capsule align-middle"),j={deal:s.Handshake,goal:r.Goal,plan:l.Target,plan_task:l.Target};function b({type:e,name:n,imageUrl:a,domain:c,size:d="inline"}){let u="card"===d,x=u?"h-5 w-5":"h-4 w-4",h=u?"h-3 w-3":"h-2.5 w-2.5";return"company"===e?(0,t.jsx)(i.CompanyLogo,{domain:c,companyName:n,logoUrl:a,size:"xs",className:(0,m.cn)("shrink-0",u?"!h-5 !w-5":"!h-4 !w-4")}):"deal"===e?(0,t.jsx)("span",{className:(0,m.cn)("flex items-center justify-center squircle bg-muted avatar-border shrink-0",x),children:(0,t.jsx)(s.Handshake,{className:(0,m.cn)("text-foreground/70",h)})}):"goal"===e?(0,t.jsx)("span",{className:(0,m.cn)("flex items-center justify-center squircle bg-muted avatar-border shrink-0",x),children:(0,t.jsx)(r.Goal,{className:(0,m.cn)("text-foreground/70",h)})}):"plan"===e||"plan_task"===e?(0,t.jsx)("span",{className:(0,m.cn)("flex items-center justify-center squircle bg-muted avatar-border shrink-0",x),children:(0,t.jsx)(l.Target,{className:(0,m.cn)("text-foreground/70",h)})}):(0,t.jsx)(o.ContactAvatar,{imageUrl:a,name:n,size:"xs",className:(0,m.cn)("shrink-0",x,u?"text-[11px]":"text-[8px]")})}e.s(["EditableMentionChip",0,function({type:e,id:n,name:a}){let s=g(e,n);return(0,t.jsxs)("span",{"data-mention":"","data-mention-type":e,"data-mention-id":n,"data-mention-name":a,contentEditable:!1,className:(0,m.cn)(v,"cursor-default select-none"),children:[(0,t.jsx)(b,{type:e,name:a,imageUrl:s?.imageUrl??null,domain:s?.domain??null,size:"card"}),(0,t.jsx)("span",{className:"truncate max-w-[160px]",children:a})]})},"MentionAvatar",0,b,"MentionPill",0,function({type:e,id:a,name:s,variant:r="inline"}){let l=g(e,a),d=x[e](a);if("pill"===r){let n=j[e];return(0,t.jsx)(c.ItemPill,{href:d??void 0,label:s,icon:n?(0,t.jsx)(n,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):"company"===e?(0,t.jsx)(i.CompanyLogo,{domain:l?.domain??null,companyName:s,logoUrl:l?.imageUrl??null,size:"xs",className:"shrink-0 !h-4 !w-4"}):(0,t.jsx)(o.ContactAvatar,{imageUrl:l?.imageUrl??null,name:s,size:"xs",className:"h-4 w-4 text-[8px] shrink-0"})})}let u="card"===r?v:"inline-flex items-center gap-1 rounded-lg border border-border bg-white dark:bg-card pl-0.5 pr-2 py-0.5 align-middle text-[11px] font-medium text-foreground/85 transition-colors hover:border-foreground
1/30",h=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{type:e,name:s,imageUrl:l?.imageUrl??null,domain:l?.domain??null,size:r}),(0,t.jsx)("span",{className:(0,m.cn)("truncate","card"===r?"max-w-[160px]":"max-w-[140px]"),children:s})]});return d?(0,t.jsx)(n.default,{href:d,className:u,onClick:e=>e.stopPropagation(),children:h}):(0,t.jsx)("span",{className:u,children:h})},"primeMentionMeta",0,function(e,t,n){h.set(`${e}:${t}`,n)},"useEntityMeta",0,g])},666354,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(373375),s=e.i(664659),r=e.i(398361),l=e.i(135745),i=e.i(640761),i=i,o=e.i(416788),c=e.i(647163),d=e.i(47075),m=e.i(414318),u=e.i(957639),x=e.i(63270),h=e.i(922083),p=e.i(463415),f=e.i(572377),g=e.i(786223),v=e.i(644871),j=e.i(992427),b=e.i(194976),w=e.i(812946),y=e.i(407909),N=e.i(597576),k=e.i(287751),_=e.i(103464),C=e.i(199598),S=e.i(25394),T=e.i(502072),M=e.i(783618),E=e.i(399513),I=e.i(59377),P=e.i(826244),D=e.i(534857),z=e.i(236883),$=e.i(476819),R=e.i(920755),L=e.i(846696);function A(e,t){return`${e}:${t}`}let q=new Map;function B({icon:e,size:n}){return(0,D.isDocIconImage)(e)?(0,t.jsx)(P.DocIcon,{icon:e,size:n}):e.startsWith(z.LUCIDE_PREFIX)?(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center justify-center overflow-hidden squircle bg-muted text-foreground",style:{width:(0,$.designPx)(n),height:(0,$.designPx)(n)},children:(0,t.jsx)(P.DocIcon,{icon:e,size:Math.round(.55*n)})}):(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center justify-center overflow-hidden squircle bg-muted leading-none",style:{width:(0,$.designPx)(n),height:(0,$.designPx)(n),fontSize:(0,$.designPx)(Math.round(.55*n))},children:e})}function F({channel:e,conversationRef:a,icon:s,onIcon:r,size:l,children:i}){let[o,c]=(0,n.useState)(!1);return a?(0,t.jsxs)(I.Popover,{open:o,onOpenChange:c,children:[(0,t.jsx)(I.PopoverTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",className:"relative shrink-0 cursor-pointer rounded-[inherit] hover:opacity-80 transition-opacity","aria-label":"Change conversation icon",title:"Change icon",onClick:e=>e.stopPropagation(),children:s?(0,t.jsx)(B,{icon:s,size:l}):i})}),(0,t.jsx)(I.PopoverContent,{align:"start",side:"bottom",container:"u">typeof document?document.body:null,shellClassName:"!z-[200]",className:"w-auto border-0 bg-transparent p-0 shadow-none",onMouseDown:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[s&&(0,t.jsx)("div",{className:"flex items-center rounded-lg [corner-shape:squircle] squircle-safari-fallback border bg-popover px-1.5 py-1 shadow-xl",children:(0,t.jsx)("button",{type:"button",onClick:()=>{r(null),c(!1)},className:"flex w-full items-center gap-2 rounded-md [corner-shape:squircle] squircle-safari-fallback px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:"Use the default icon"})}),(0,t.jsx)(P.IconPicker,{onSelect:e=>{r(e),c(!1)},onClose:()=>c(!1)})]})})]}):(0,t.jsx)(t.Fragment,{children:s?(0,t.jsx)(B,{icon:s,size:l}):i})}var U=e.i(488854);let O="convo-widget-card native-card-surface border border-foreground
1/15 rounded-[20px] bg-card",H=[],W={id:null,full_name:null,avatar_url:null},G={email:"Email",linkedin:"LinkedIn",linkedin_comments:"LinkedIn Comments",x:"X",reddit:"Reddit",whatsapp:"WhatsApp",sms:"SMS",imessage:"iMessage",messages:"iMessage/SMS",slack:"Slack",chat:"Chat"};function X({channel:e,provider:n,className:a}){switch(e){case"email":return(0,t.jsx)(f.MailProviderSquircle,{provider:n??void 0,className:a,bg:"bg-white dark:bg-card"});case"linkedin":return(0,t.jsx)(f.LinkedInSquircle,{className:a});case"linkedin_comments":return(0,t.jsx)(f.LinkedInCommentsSquircle,{className:a});case"x":return(0,t.jsx)(f.XSquircle,{className:a});case"reddit":return(0,t.jsx)(f.RedditSquircle,{className:a});case"whatsapp":return(0,t.jsx)(f.WhatsAppSquircle,{className:a});case"sms":return(0,t.jsx)(f.SmsSquircle,{className:a});case"imessage":case"messages":return(0,t.jsx)(f.IMessageSquircle,{className:a});case"slack":return(0,t.jsx)(f.SlackSquircle,{className:a});case"chat":return(0,t.jsx)(f.ChatSquircle,{className:a});default:return null}}function V(e){return(e||"?").split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2)}function Y(e){if(!e)return"";let t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),s=Math.floor(n/36e5),r=Math.floor(n/864e5);return a<1?"now":a<60?`${a}m`:s<24?`${s}h`:r<7?`${r}d`:t.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}e.s(["ConversationsWidget",0,function({entityType:e,entityId:f,workspaceId:I,displayName:P,contactImageUrl:D,initialDataPromise:z,heightClassName:$="h-[460px]",className:J,style:K,autoOpenLatest:Q=!1,linkedInStatus:Z,contactLinkedInUrn:ee,contactXHandle:et,contactRedditUsername:en}){let ea=(0,j.useIsMobile)(),es=(0,_.entityConversationsKeyFor)(e,f),er=void 0!==(0,k.getCached)(es),{data:el,refetch:ei}=(0,k.useCachedFetch)(es,{staleTime:9e4,background:!!z&&!er});(0,n.useEffect)(()=>{z&&z.then(e=>(0,k.mutate)(es,e,{revalidate:!1}),()=>{ei()})},[z,es,ei]);let eo=el?.conversations??H,{iconFor:ec,setIcon:ed}=function(e,t){let a=(0,n.useMemo)(()=>t.filter(e=>e.conversation_ref).map(e=>A(e.channel,e.conversation_ref)).sort().join("|"),[t]),[s,r]=(0,n.useState)(()=>{let e={};for(let t of a.split("|"))t&&q.has(t)&&(e[t]=q.get(t)??null);return e});async function l(t,n,a){if(!e||!n)return;let s=A(t,n);q.set(s,a),r(e=>({...e,[s]:a}));let l=(0,R.createClient)();(a?await l.from("conversation_icons").upsert({workspace_id:e,channel:t,conversation_ref:n,icon:a,updated_at:new Date().toISOString()},{onConflict:"workspace_id,channel,conversation_ref"}):await l.from("conversation_icons").delete().eq("workspace_id",e).eq("channel",t).eq("conversation_ref",n)).error&&L.toast.error("Couldn’t save the icon")}return(0,n.useEffect)(()=>{if(!e||!a)return;let t=a.split("|").map(e=>{let t=e.indexOf(":");return{channel:e.slice(0,t),conversationRef:e.slice(t+1)}}),n=!1;return(0,R.createClient)().from("conversation_icons").select("channel, conversation_ref, icon").eq("workspace_id",e).in("conversation_ref",[...new Set(t.map(e=>e.conversationRef))]).then(({data:e})=>{if(n)return;let a=new Set((e??[]).map(e=>A(e.channel,e.conversation_ref))),s={};for(let e of t){let t=A(e.channel,e.conversationRef);s[t]=null,q.set(t,null)}for(let t of e??[]){let e=A(t.channel,t.conversation_ref);a.has(e)&&(s[e]=t.icon,q.set(e,t.icon))}r(e=>({...e,...s}))}),()=>{n=!0}},[e,a]),{iconFor:function(e,t){let n=A(e,t);return n in s?s[n]:q.get(n)??null},setIcon:l}}(I,eo),em=void 0!==el,eu=el?.current_user??W,ex=eu.id,eh=(0,n.useCallback)(()=>{ei()},[ei]);(0,m.useOnEmailRefresh)(eh),(0,m.useOnInboxRefresh)(eh),(0,n.useEffect)(()=>(0,u.onBusEvent)("entity",()=>eh()),[eh]);let ep=Q&&!!ee&&"connected"===Z,ef=Q&&!!et&&!ep,eg=Q&&!!ee&&(void 0===Z||"loading"===Z),ev=(0,n.useMemo)(()=>!ep||eo.some(e=>"linkedin"===e.channel&&e.owner_user_id===ex)?null:{id:`synthetic-linkedin-${f}`,channel:"linkedin",contact_id:"contact"===e?f:null,company_id:null,contact_name:P,contact_image_url:D??null,company_name:null,company_logo_url:null,company_domain:null,snippet:null,is_read:!0,unread_count:0,last_message_at:null,conversation_ref:"",owner_user_id:ex,owner_name:eu.full_name,owner_avatar_url:eu.avatar_url},[ep,eo,e,f,P,D,ex,eu]),ej=(0,n.useMemo)(()=>!Q||!et||eo.some(e=>"x"===e.channel)?null:{id:`synthetic-x-${f}`,channel:"x",contact_id:"contact"===e?f:null,company_id:null,contact_name:P,contact_image_url:D??null,company_name:null,company_logo_url:null,company_domain:null,snippet:null,is_read:!0,unread_count:0,last_message_at:null,conversation_ref:""},[Q,et,eo,e,f,P,D]),eb=(0,n.useMemo)(()=>!en||eo.some(e=>"reddit"===e.channel)?null:{id:`synthetic-reddit-${f}`,channel:"reddit",contact_id:"contact"===e?f:null,company_id:null,contact_name:P,contact_image_url:D??null,company_name:null,company_logo_url:null,company_domain:null,snippet:null,is_read:!0,unread_count:0,last_message_at:null,conversation_ref:""},[en,eo,e,f,P,D]),ew=(0,n.useMemo)(()=>{let e=[ev,ej,eb].filter(e=>null!=e);return e.length>0?[...eo,...e]:eo},[eo,ev,ej,eb]),ey=(0,n.useMemo)(()=>[...ew].sort((e,t)=>
1{let n=e.last_message_at?new Date(e.last_message_at).getTime():0;return(t.last_message_at?new Date(t.last_message_at).getTime():0)-n}),[ew]),eN=(0,U.useSlackGroupCompanies)(I,(0,n.useMemo)(()=>ey.filter(e=>"slack"===e.channel&&e.is_group).map(e=>e.conversation_ref),[ey])),ek=(0,n.useMemo)(()=>eo.reduce((e,t)=>e+(t.unread_count??+!t.is_read),0),[eo]),e_=(0,n.useMemo)(()=>{let e=new Map;for(let t of ey){if(t.is_group)continue;let n=e.get(t.channel);if(!n){e.set(t.channel,t);continue}ex&&t.owner_user_id===ex&&n.owner_user_id!==ex&&e.set(t.channel,t)}return e},[ey,ex]),eC=(0,n.useMemo)(()=>[...e_.keys()],[e_]),[eS,eT]=(0,n.useState)(()=>{if(!Q)return null;let e=(0,k.getCached)(es);return e?(0,C.pickLatestOpenable)(e.conversations,e.current_user?.id??null):null}),eM=eS?.channel!=="linkedin"||eS.is_group?null:eS.id,eE=(0,S.useLinkedInParticipantUrns)((0,n.useMemo)(()=>eM?[eM]:[],[eM])),eI=(0,S.useLinkedInPresence)(eM?ee??eE[eM]??null:null),[eP,eD]=(0,n.useState)(!1),[ez,e$]=(0,n.useState)("inline"),[eR,eL]=(0,n.useState)(0),eA=(0,n.useCallback)(()=>{"modal"===ez&&(0,d.hasAnyComposerDraft)()&&eL(e=>e+1),e$("inline")},[ez]),[eq,eB]=(0,n.useState)(!0),[eF,eU]=(0,n.useState)(!1),[eO,eH]=(0,n.useState)(!1),[eW,eG]=(0,n.useState)(null),eX=(0,n.useCallback)(e=>
1eG(e),[]),eV=(0,n.useRef)(!1),[eY,eJ]=(0,n.useState)(!1),eK=(0,n.useCallback)(e=>{eV.current=e,eJ(e)},[]),[eQ,eZ]=(0,n.useState)(!1),e0=(0,n.useRef)(null),e1=(0,n.useCallback)(e=>{(!e.is_read||(e.unread_count??0)>0)&&(0,k.mutate)(es,t=>({conversations:(t?.conversations??[]).map(t=>t.id===e.id?{...t,is_read:!0,unread_count:0}:t),current_user:t?.current_user??W}),{revalidate:!1}),eD(!1),eT(e)},[es]),e5=()=>{eT(null),eD(!1),e$(e=>"dock"===e?e:"inline")},e4=(0,n.useRef)(null!==eS);(0,n.useEffect)(()=>{let e=eS??(Q?(0,C.pickLatestOpenable)(eo,ex):null)??eo[0];e&&(0,C.prefetchWidgetThread)(e,{workspaceId:I,profileUrn:ee})},[eS,Q,eo,ex,I,ee]);let e2=(0,n.useMemo)(()=>{let e=new Set;return[...e_.values(),...ey.slice(0,8)].filter(t=>!e.has(t.id)&&(e.add(t.id),!0))},[e_,ey]);if((0,n.useEffect)(()=>{if(0===e2.length)return;let e=()=>{for(let e of e2)(0,C.prefetchWidgetThread)(e,{workspaceId:I,profileUrn:ee})};if("function"==typeof window.requestIdleCallback){let t=window.requestIdleCallback(e,{timeout:2e3});return()=>window.cancelIdleCallback(t)}let t=setTimeout(e,300);return()=>clearTimeout(t)},[e2,I,ee]),(0,n.useEffect)(()=>{if(!Q||e4.current||0===ey.length)return;let e=ey.find(e=>!e.is_group&&e.last_message_at);if(e){e4.current=!0,e1(e_.get(e.channel)??e);return}let t=()=>{if(e4.current)return;let e=(ep?e_.get("linkedin"):void 0)??(ef?e_.get("x"):void 0)??ey.find(e=>!e.is_group)??ey[0];e&&(e4.current=!0,e1(e))};if(eg){let e=setTimeout(t,1200);return()=>clearTimeout(e)}t()},[Q,ey,ep,ef,e_,eg,e1]),(0,n.useEffect)(()=>{if(!eW)return;eK(!1),eB(!0);let e=e=>e instanceof Node&&!!eW.querySelector("[data-composer]")?.contains(e),t=()=>{(()=>{let e=eW.querySelector("[data-composer]");if(!e)return!1;let t=e.querySelector("textarea");if(t&&t.value.trim())return!0;let n=e.querySelector('[contenteditable="true"]');return!!n&&!!(n.textContent??"").trim()})()||eB(!0)},n=n=>{e(n.target)||eV.current||t()},a=t=>{e(t.target)&&(eK(!0),eB(!1))},s=t=>{!eV.current&&e(t.target)&&eW.querySelector("[data-composer]")?.querySelector('textarea, [contenteditable="true"]')?.focus()},r=n=>{e(n.target)&&setTimeout(()=>{let n=document.activeElement;if(e(n)||n instanceof Element&&n.closest('[data-radix-popper-content-wrapper],[data-slot="popover-content"],[data-slot="dropdown-menu-content"],[data-slot="tooltip-content"],[data-slot="slash-menu"],[data-composer-overlay],[role="dialog"]'))return;let a=eW.querySelector("[data-composer]");(!n||n===document.body)&&a?.querySelector('textarea[disabled],textarea[readonly],[contenteditable="false"]')||(eK(!1),t())},0)};return eW.addEventListener("scroll",n,!0),eW.addEventListener("focusin",a),eW.addEventListener("focusout",r),eW.addEventListener("click",s),()=>{eW.removeEventListener("scroll",n,!0),eW.removeEventListener("focusin",a),eW.removeEventListener("focusout",r),eW.removeEventListener("click",s)}},[eS,eW,eK]),(0,n.useEffect)(()=>{if(!eS)return;let e=e=>{e0.current={x:e.clientX,y:e.clientY}};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)},[eS]),(0,n.useEffect)(()=>{if(!eY)return void eZ(!1);let e=eW?.querySelector("[data-composer-toolbar]"),t=e0.current,n=(t,n)=>{let a=e?.getBoundingClientRect();return!a||t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom};
1if(!t||!n(t.x,t.y))return void eZ(!0);let a=e=>{n(e.clientX,e.clientY)&&24>Math.hypot(e.clientX-t.x,e.clientY-t.y)||(eZ(!0),document.removeEventListener("pointermove",a))};return document.addEventListener("pointermove",a),()=>document.removeEventListener("pointermove",a)},[eY,eS,eW]),(0,n.useEffect)(()=>{if(!eW||!eq)return void eU(!1);let e=eW.querySelector("[data-composer]"),t=(t,n)=>{if(e?.isConnected||(e=eW.querySelector("[data-composer]")),!e)return!1;let a=e.getBoundingClientRect();return t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom},n=null,a=!1,s=()=>{n=null,a=!1,eU(!1),eH(!1)},r=e=>{if(!t(e.clientX,e.clientY))return void s();if(eU(!0),!n){n={x:e.clientX,y:e.clientY};return}!a&&Math.hypot(e.clientX-n.x,e.clientY-n.y)>=8&&(a=!0,eH(!0))},l=e=>{e.relatedTarget||s()},i=s=>{n&&!a&&t(s.clientX,s.clientY)&&e?.querySelector('textarea, [contenteditable="true"]')?.focus()};return document.addEventListener("pointermove",r),document.addEventListener("pointerout",l),document.addEventListener("click",i),()=>{document.removeEventListener("pointermove",r),document.removeEventListener("pointerout",l),document.removeEventListener("click",i),eH(!1)}},[eS,eq,eW]),eS){let n=eS.channel,d=eS.is_group?eS.contact_image_url||null:eS.contact_image_url||D||null,m=eS.contact_id||("contact"===e?f:null),u=eS.conversation_ref||(eS.id.startsWith("synthetic-")?"":eS.id),v="email"===n&&eP,j="slack"===eS.channel&&eS.is_group?(0,E.slackAvatarMarks)(eS,eN[eS.conversation_ref]):void 0,w=(0,t.jsxs)("div",{className:"relative flex items-center justify-between gap-2 h-10 border-b border-foreground
1/15 px-3 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)("button",{type:"button",onClick:e5,className:"squircle flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground transition-colors -ml-1","aria-label":"Back to conversations",children:(0,t.jsx)(a.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(F,{channel:n,conversationRef:u,icon:ec(n,u),onIcon:e=>{ed(n,u,e)},size:28,children:(0,t.jsxs)("span",{className:"relative shrink-0",children:[j?(0,t.jsx)(E.CompanyLogoStack,{companies:j,size:28}):(0,t.jsxs)(x.Avatar,{className:"h-7 w-7",style:eI?(0,h.presenceNotch)({size:28,dot:6}):void 0,children:[d&&(0,t.jsx)(x.AvatarImage,{src:d,alt:eS.contact_name??""}),(0,t.jsx)(x.AvatarFallback,{className:"text-[10px] bg-foreground/8 text-foreground/60 font-medium",children:eS.is_group?(0,t.jsx)(o.PeopleGroupIcon,{className:"h-3.5 w-3.5"}):V(eS.contact_name)})]}),eI&&(0,t.jsx)(h.PresenceDot,{online:"online"===eI,size:28,dot:6})]})}),(0,t.jsx)("a",{href:eS.contact_id?`/people/${eS.contact_id}`:void 0,className:(0,c.cn)("min-w-0",eS.contact_id&&"hover:opacity-80 transition-opacity"),children:(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate leading-tight",children:eS.contact_name||P||"Conversation"}),eS.company_name&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground truncate leading-tight",children:eS.company_name})]})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[eC.length>1?(0,t.jsxs)(p.DropdownMenu,{onOpenChange:e=>{e&&eC.forEach(e=>(0,C.preloadChannelPanel)(e))},children:[(0,t.jsx)(p.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:(0,M.pillClass)("icon",(0,c.cn)("relative z-30 leading-none transition-opacity duration-200",v&&"pointer-events-none opacity-0")),"aria-hidden":v||void 0,tabIndex:v?-1:void 0,"aria-label":"Switch channel",children:[(0,t.jsx)(X,{channel:n,provider:eS.email_provider,className:"h-4 w-4"}),(0,t.jsx)("span",{children:G[n]}),(0,t.jsx)(s.ChevronDown,{className:"h-3 w-3 text-muted-foreground"})]})}),(0,t.jsx)(p.DropdownMenuContent,{align:"end",className:"min-w-[210px]",children:eC.map(e=>{let a=e_.get(e),s=a.unread_count??+!a.is_read,r=e===n;return(0,t.jsxs)(p.DropdownMenuItem,{onClick:()=>{r||e1(a)},onPointerEnter:()=>{r||(0,C.prefetchWidgetThread)(a,{workspaceId:I,profileUrn:ee})},className:(0,c.cn)("gap-2",r&&"bg-muted/60"),children:[(0,t.jsx)(X,{channel:e,provider:a.email_provider,className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 truncate",children:G[e]}),a.last_message_at&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:Y(a.last_message_at)}),s>0&&(0,t.jsx)("span",{className:"inline-flex items-center justify-center min-w-[16px] h-[16px] px-1 rounded-full bg-[#A6BFD0] dark:bg-[#7AC8F0] text-white text-[9px] font-semibold leading-none shrink-0",children:s>99?"99+":s})]},e)})})]}):(0,t.jsxs)("div",{className:(0,M.pillClass)("icon",(0,c.cn)("relative z-30 leading-none transition-opacity duration-200",v&&"pointer-events-none opacity-0")),children:[(0,t.jsx)(X,{channel:n,provider:eS.email_provider,className:"h-4 w-4"}),(0,t.jsx)("span",{children:G[n]})]}),!("email"===n&&eP)&&(0,t.jsxs)(t.Fragment,{children:[!ea&&(0,t.jsx)("button",{type:"button",onClick:()=>e$(e=>"dock"===e?"inline":"dock"),className:`squircle relative z-30 flex h-7 w-7 items-center justify-center transition-colors hover:bg-foreground
1/[0.06] hover:text-foreground ${"dock"===ez?"text-foreground":"text-muted-foreground"}`,title:"dock"===ez?"Close the side panel":"Open in the side panel","aria-label":"dock"===ez?"Close the side panel":"Open conversation in the side panel","aria-pressed":"dock"===ez,children:"dock"===ez?(0,t.jsx)(i.default,{className:"h-3.5 w-3.5"}):(0,t.jsx)(l.PanelRight,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>e$("modal"),className:"squircle relative z-30 flex h-7 w-7 items-center justify-center text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground transition-colors",title:"Open in modal","aria-label":"Open conversation in modal",children:(0,t.jsx)(r.Maximize2,{className:"h-3.5 w-3.5"})})]}),"email"===n&&(0,t.jsx)("button",{type:"button",onClick:()=>eD(e=>!e),className:"squircle relative z-30 flex h-7 w-7 items-center justify-center text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground transition-colors",title:eP?"Hide email actions":"Show email actions","aria-label":"Toggle email actions","aria-expanded":eP,children:(0,t.jsx)(T.AnimatedChevron,{open:eP,icon:a.ChevronLeft,degOpen:180,degClosed:0,className:"h-4 w-4"})})]}),"email"===n&&(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 right-0 w-11 bg-card z-[25]"})]});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,c.cn)(O,"relative flex flex-col overflow-hidden","dock"===ez&&"hidden",$,J),style:K,children:[w,(0,t.jsx)("div",{ref:"dock"===ez?void 0:eX,className:(0,c.cn)("flex-1 min-h-0 flex flex-col","email"!==n&&"overflow-hidden"),"data-convo-widget":!0,"data-convo-surface":"card","data-email-toolbar":eP?"open":void 0,"data-composer-collapsed":eq?"true":void 0,"data-composer-hover":eq&&eF?"true":void 0,"data-composer-hover-settled":eq&&eF&&eO?"true":void 0,"data-composer-armed":eY&&eQ?"true":void 0,children:"dock"===ez?null:(0,t.jsx)(g.ConversationPanel,{contactId:m,contactName:eS.contact_name,contactImageUrl:d,companyName:eS.company_name,companyDomain:eS.company_domain,companyLogoUrl:eS.company_logo_url,channel:n,conversationRef:u,workspaceId:I,emailProvider:eS.email_provider,onBack:e5,hideHeader:!0,hideSidebar:!0},`${n}-${eS.id}-${eR}`)})]}),"inline"!==ez&&(0,t.jsx)(b.ChatExpandedSurface,{expansion:ez,title:eS.contact_name||P||"Conversation",onCollapse:eA,children:"dock"===ez?(0,t.jsxs)(t.Fragment,{children:[w,(0,t.jsx)("div",{ref:eX,className:(0,c.cn)("flex-1 min-h-0 flex flex-col","email"!==n&&"overflow-hidden"),"data-convo-widget":!0,"data-convo-surface":"dock","data-email-toolbar":eP?"open":void 0,"data-composer-armed":eY&&eQ?"true":void 0,children:(0,t.jsx)(g.ConversationPanel,{contactId:m,contactName:eS.contact_name,contactImageUrl:d,companyName:eS.company_name,companyDomain:eS.company_domain,companyLogoUrl:eS.company_logo_url,channel:n,conversationRef:u,workspaceId:I,emailProvider:eS.email_provider,onBack:e5,hideHeader:!0,hideSidebar:!0},`dock-${n}-${eS.id}`)})]}):(0,t.jsx)(g.ConversationPanel,{contactId:m,contactName:eS.contact_name,contactImageUrl:d,companyName:eS.company_name,companyDomain:eS.company_domain,companyLogoUrl:eS.company_logo_url,channel:n,conversationRef:u,workspaceId:I,emailProvider:eS.email_provider,onBack:eA,isModal:!0},`${ez}-${n}-${eS.id}`)})]})}if(0===ey.length)return em?null:(0,t.jsx)(w.ConversationsWidgetCardSkeleton,{heightClassName:$,className:J,style:K});let e6=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 h-12 border-b border-foreground
1/15 px-4 shrink-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:"Conversations"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[ek>0&&(0,t.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#A6BFD0] dark:bg-[#7AC8F0] text-white text-[10px] font-semibold leading-none",children:ek>99?"99+":ek}),"dock"===ez&&(0,t.jsx)("button",{type:"button",onClick:()=>e$("inline"),className:"squircle relative z-30 -mr-1 flex h-7 w-7 items-center justify-center text-foreground transition-colors hover:bg-foreground/[0.06]",title:"Close the side panel","aria-label":"Close the side panel",children:(0,t.jsx)(i.default,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsx)("div",{"data-keeps-wheel":!0,className:"flex-1 min-h-0 overflow-y-auto px-1 py-1 space-y-0.5",children:ey.map(e=>{let n,a=e.unread_count??+!e.is_read,s="slack"===e.channel&&e.is_group?(0,E.slackAvatarMarks)(e,eN[e.conversation_ref]):void 0,r=(0,N.conversationSenderLabel)(e,ex)||(e.is_group?null:(n=(e.contact_name??"").trim())?n.split(/\s+/)[0]??null:null),l=ec(e.channel,e.conversation_ref);return(0,t.jsxs)("button",{type:"button",onClick:()=>e1(e),onMouseEnter:()=>(0,C.prefetchWidgetThread)(e,{workspaceId:I,profileUrn:ee}),className:"w-full flex items-center gap-2.5 px-3 py-2.5 rounded-lg cursor-pointer hover:bg-muted/40 text-left",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[l?(0,t.jsx)(B,{icon:l,size:36}):s&&s.length>0?(0,t.jsx)(E.CompanyLogoStack,{companies:s,size:36}):(0,t.jsxs)(x.Avatar,{className:"h-9 w-9",children:[e.contact_image_url&&!e.is_group&&(0,t.jsx)(x.AvatarImage,{src:e.contact_image_url,alt:e.contact_name??""}),(0,t.jsx)(x.AvatarFallback,{className:"text-[11px] bg-foreground
1/8 text-foreground/60 font-medium",children:e.is_group?(0,t.jsx)(o.PeopleGroupIcon,{className:"h-4 w-4"}):V(e.contact_name)})]}),(0,t.jsx)(X,{channel:e.channel,provider:e.email_provider,className:"absolute -bottom-1 -right-1 z-10 h-4 w-4"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`text-[13px] truncate ${a>0?"font-semibold text-foreground":"font-medium text-foreground/85"}`,children:e.contact_name||P||G[e.channel]}),(0,t.jsx)(v.ConversationOwnerChip,{ownerUserId:e.owner_user_id,ownerName:e.owner_name,ownerAvatarUrl:e.owner_avatar_url,viewerId:ex}),e.last_message_at&&(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground tabular-nums ml-auto shrink-0",children:Y(e.last_message_at)})]}),e.last_message_at?(0,t.jsxs)("p",{className:"text-[11px] text-muted-foreground/80 truncate mt-0.5",children:[r&&(0,t.jsxs)("span",{className:"text-foreground/70 font-medium",children:[r,": "]}),(0,t.jsx)("span",{className:"text-muted-foreground/70",children:e.snippet?.trim()?(0,t.jsx)(y.FormattedText,{text:e.snippet,preview:!0}):"Message"})]}):(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground/50 italic truncate mt-0.5",children:"No messages yet"})]}),a>0&&(0,t.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#A6BFD0] dark:bg-[#7AC8F0] text-white text-[10px] font-semibold leading-none shrink-0",children:a>99?"99+":a})]},`${e.channel}-${e.id}`)})})]});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,c.cn)(O,"relative flex flex-col overflow-hidden","dock"===ez&&"hidden",$,J),style:K,children:e6}),"dock"===ez&&(0,t.jsx)(b.ChatExpandedSurface,{expansion:"dock",title:"Conversations",onCollapse:()=>e$("inline"),children:e6})]})},"ConversationsWidgetSkeleton",0,function(e){return(0,t.jsx)(w.ConversationsWidgetCardSkeleton,{...e})}],666354)},416853,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(618566),s=e.i(871689),r=e.i(167881),l=e.i(897937),i=e.i(647163);let o={people:"People",companies:"Companies",deals:"Deals",tickets:"Tickets",customers:"Customers",documents:"Documents",contracts:"Documents",templates:"Templates",skills:"Skills",videos:"Videos",recordings:"Recordings",finance:"Finance",sequences:"Sequences",social:"Social",invoices:"Invoices",inbox:"Inbox",meetings:"Meetings",calendar:"Calendar",tasks:"Tasks",plans:"Plans",spaces:"Spaces"};function c(e,t){let s=(0,a.useRouter)(),{previousPath:r,canGoBack:i}=(0,l.useNavHistory)();return{goBack:(0,n.useCallback)(()=>{i?s.back():s.push(e)},[i,e,s]),label:i?function(e){if(!e)return null;let t=e.split("?")[0].split("/").filter(Boolean)[0];return t?o[t]??null:null}(r)??"Back":t??"Back",canGoBack:i}}e.s(["BackButton",0,function({fallbackHref:e,fallbackLabel:n,className:a}){let{goBack:l,label:o}=c(e,n);return(0,t.jsxs)(r.Button,{variant:"ghost",size:"sm",onClick:l,"aria-label":o,title:o,className:(0,i.cn)("shrink-0 px-2 sm:px-3.5 sm:has-[>svg]:px-3",a),children:[(0,t.jsx)(s.ArrowLeft,{className:"h-4 w-4 sm:mr-1.5"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:o})]})},"useSmartBack",0,c])},705599,e=>{"use strict";var t=e.i(271645),n=e.i(287751);function a(e,t){let n=new URLSearchParams({entity_type:e,entity_id:t});return`/api/comments?${n.toString()}`}let s=[],r=[];e.s(["prefetchComments",0,function(e,t){(0,n.prefetch)(a(e,t))},"useComments",0,function(e,l){let i=a(e,l),{data:o,error:c,isLoading:d,refetch:m}=(0,n.useCachedFetch)(i),u=(0,t.useMemo)(()=>{let e={};for(let t of o?.attachments??[]){let n=e[t.comment_id]??[];n.push(t),e[t.comment_id]=n}return e},[o]),x=(0,t.useMemo)(()=>{let e={};for(let t of o?.authors??[])e[t.id]=t;return e},[o]),h=(0,t.useCallback)(async()=>{await m()},[m]),p=(0,t.useCallback)(async t=>{let n=await fetch("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity_type:e,entity_id:l,parent_comment_id:t.parentCommentId??null,body:t.body,mentions:t.mentions??[],attachments:t.attachments??[]})});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to post comment");await m()},[e,l,m]),f=(0,t.useCallback)(async(e,t)=>{let n=await fetch(`/api/comments/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to update comment");await m()},[m]),g=(0,t.useCallback)(async e=>{let t=await fetch(`/api/comments/${e}`,{method:"DELETE"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete comment");await m()},[m]);return{comments:o?.comments??s,mentions:o?.mentions??r,attachmentsByComment:u,authors:x,loading:d,error:c?c instanceof Error?c.message:"Failed to load comments":null,refetch:h,createComment:p,updateComment:f,deleteComment:g}}])},897937,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(618566);let s=(0,n.createContext)({previousPath:null,canGoBack:!1}),r=0;
1e.s(["NavHistoryProvider",0,function({children:e}){let l=(0,a.usePathname)(),i=(0,n.useRef)([]),[o,c]=(0,n.useState)({previousPath:null,canGoBack:!1});return(0,n.useEffect)(()=>{let e=i.current,t=e[e.length-1],n=Date.now()-r<1e3;r=0,t===l||(n?(e.length=0,e.push(l)):e.length>=2&&e[e.length-2]===l?e.pop():e.push(l));let a=e.length>=2?e[e.length-2]:null;c({previousPath:a,canGoBack:null!==a})},[l]),(0,t.jsx)(s.Provider,{value:o,children:e})},"markNavSwitch",0,function(){r=Date.now()},"useNavHistory",0,function(){return(0,n.useContext)(s)}])},20362,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(618566);let s=(0,n.createContext)(null);e.s(["PaneTitleProvider",0,function({children:e}){let[a,r]=(0,n.useState)(null);return(0,t.jsx)(s.Provider,{value:{title:a,setTitle:r},children:e})},"usePaneTitle",0,function(){return(0,n.useContext)(s)?.title??null},"useSetPaneTitle",0,function(e){let t=(0,n.useContext)(s),r=(0,a.usePathname)();(0,n.useEffect)(()=>{if(t)return t.setTitle(e?{...e,url:r}:null),()=>t.setTitle(null)},[e?.label,e?.avatarUrl,r])}])},546428,567379,143086,960709,e=>{"use strict";var t=e.i(271645),n=e.i(127341),a=e.i(843476),s=e.i(647163);function r(e){let t=e.querySelector("[data-sticky-detail-header] > *");return t?Math.round(t.getBoundingClientRect().height)+12:0}e.s(["StickyDetailHeader",0,function({pinned:e,leading:n,avatar:r,title:l,subtitle:i,meta:o,actions:c,alignRef:d,className:m}){let u=(0,t.useRef)(null),[x,h]=(0,t.useState)(0),[p,f]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let e=u.current,t=e?.closest("[data-scroll-root]");if(!e||!t)return;let n=d?.current??null,a=()=>{if(h(parseFloat(getComputedStyle(t).paddingTop)||0),n){let t=n.getBoundingClientRect(),a=e.getBoundingClientRect(),s=e.offsetWidth>0?a.width/e.offsetWidth:1,r=.02>Math.abs(s-1)||s<.01?1:s;f({left:(t.left-a.left)/r,width:t.width/r})}};a();let s=new ResizeObserver(a);return s.observe(t),n&&s.observe(n),window.addEventListener("resize",a),()=>{s.disconnect(),window.removeEventListener("resize",a)}},[d]),(0,a.jsx)("div",{ref:u,"data-sticky-detail-header":!0,className:"sticky z-30 h-0",style:{to
1p:-x+12},"aria-hidden":!e,children:(0,a.jsxs)("div",{className:(0,s.cn)("absolute top-0 flex h-20 items-center gap-2 rounded-[40px]","border border-foreground/10 bg-background/[0.04] px-6","backdrop-blur-xl","overflow-hidden","transition-[opacity,transform] duration-300 ease-out will-change-[opacity,transform]",e?"translate-y-0 opacity-100":"pointer-events-none -translate-y-2 opacity-0",m),style:p?{left:p.left,width:p.width}:{left:0,right:0},children:[n&&(0,a.jsx)("div",{className:"shrink-0",children:n}),(0,a.jsxs)("button",{type:"button",onClick:()=>{u.current?.closest("[data-scroll-root]")?.scrollTo({top:0,behavior:"smooth"})},title:"Back to top",className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[(0,a.jsx)("span",{className:"shrink-0",children:r}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-semibold leading-snug",children:l}),null!=i&&""!==i&&(0,a.jsx)("span",{className:"block truncate text-xs leading-snug text-muted-foreground",children:i}),null!=o&&""!==o&&(0,a.jsx)("span",{className:"block truncate text-xs leading-snug text-muted-foreground",children:o})]})]}),c&&(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:c})]})})},"stickyHeaderInset",0,r,"useStickyHeaderPin",0,function(){let e=(0,t.useRef)(null),[n,a]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let t=e.current;if(!t)return;let n=new IntersectionObserver(([e])=>{let t=e.rootBounds?.top??0;a(!e.isIntersecting&&e.boundingClientRect.top<=t)},{root:t.closest("[data-scroll-root]")??null,threshold:0});return n.observe(t),()=>n.disconnect()},[]),{sentinelRef:e,pinned:n}}],567379),e.s(["useTabSectionReveal",0,function(){let e=(0,t.useRef)(null),a=(0,t.useRef)(null),s=(0,t.useCallback)(()=>{let t=e.current,n=t?.closest("[data-scroll-root]");if(!t||!n)return;let a=t.getBoundingClientRect(),s=n.getBoundingClientRect(),l=r(n)+8,i=a.top-s.top-l,o=a.bottom-s.bottom,c=o>0?Math.min(o,i):Math.min(i,0);1>Math.abs(c)||n.scrollTo({top:n.scrollTop+c,behavior:"smooth"})},[]),l=(0,t.useCallback)(()=>{a.current?.(),(0,n.claimTabScroll)(1500);let t=e.current,r=t?.closest("[data-scroll-root]");if(requestAnimationFrame(s),!t||!r)return;let l=new ResizeObserver(s);l.observe(t);let i=()=>{l.disconnect(),clearTimeout(o),r.removeEventListener("wheel",i),r.removeEventListener("touchmove",i),a.current=null},o=setTimeout(i,1200);r.addEventListener("wheel",i,{passive:!0}),r.addEventListener("touchmove",i,{passive:!0}),a.current=i},[s]);return(0,t.useEffect)(()=>()=>a.current?.(),[]),{sectionRef:e,revealSection:l}}],546428),e.s(["PaneFitBox",0,function({className:e,children:n}){let l=(0,t.useRef)(null),[i,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let e=l.current,t=e?.closest("[data-scroll-root]"),n=e?.closest('[data-slot="tabs"]');if(!e||!t||!n)return;let a=()=>{let a=e.getBoundingClientRect().top-n.getBoundingClientRect().top,s=r(t)+8,l=Math.max(400,Math.round(t.clientHeight-s-a-12));o(e=>null!==e&&1>=Math.abs(e-l)?e:l)};a();let s=new ResizeObserver(a);return s.observe(t),s.observe(n),()=>s.disconnect()},[]),(0,a.jsx)("div",{ref:l,className:(0,s.cn)("h-[calc(100dvh-12rem)] min-h-[400px] flex flex-col overflow-hidden",e),style:null!==i?{height:i}:void 0,children:n})}],143086),e.s(["MESSAGING_TABS",0,["messages","emails","linkedin-messages","whatsapp","sms","imessage","slack","website-chat"]],960709)},655900,e=>{"use strict";var t=e.i(399219);e.s(["ChevronUp",()=>t.default])},640761,e=>{"use strict";let t=(0,e.i(475254).default)("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);e.s(["default",0,t])}]);

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.