1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,182352,229479,172901,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(751975),r=e.i(37727),s=e.i(167881),i=e.i(59377),l=e.i(477183),o=e.i(76590),c=e.i(807311),d=e.i(786350),u=e.i(607709),m=e.i(463415),h=e.i(23750),p=e.i(626250),f=e.i(127491),x=e.i(363178),g=e.i(647163);e.i(476765);var v=e.i(524657);let y=null,w=null;async function j(){let e=await fetch("/api/gmail/statuses");return e.ok?((await e.json()).statuses||[]).map(e=>({id:e.id,value:e.name,label:e.name,color:e.color,sort_order:e.sort_order})):[]}function k(){let[e,t]=(0,n.useState)(y??[]),[a,r]=(0,n.useState)(!y),s=(0,n.useRef)(!0);(0,n.useEffect)(()=>{if(s.current=!0,y){t(y),r(!1);return}return w||(w=j()),w.then(e=>{y=e,w=null,s.current&&(t(e),r(!1))}),()=>{s.current=!1}},[]);let i=(0,n.useCallback)(async()=>{w=null,y=null;let e=await j();return y=e,s.current&&t(e),e},[]),l=(0,n.useCallback)(async(e,n)=>{let a=await fetch("/api/gmail/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,color:n})});if(!a.ok)throw Error((await a.json()).error||"Failed to create status");let{status:r}=await a.json(),i={id:r.id,value:r.name,label:r.name,color:r.color,sort_order:r.sort_order};return y=y?[...y,i]:[i],s.current&&t(y),i},[]),o=(0,n.useCallback)(async(e,n)=>{let a={id:e};void 0!==n.label&&(a.name=n.label),void 0!==n.color&&(a.color=n.color);let r=await fetch("/api/gmail/statuses",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok)throw Error((await r.json()).error||"Failed to update status");let{status:i}=await r.json(),l={id:i.id,value:i.name,label:i.name,color:i.color,sort_order:i.sort_order};return y=y?.map(t=>t.id===e?l:t)??[],s.current&&t(y),l},[]),c=(0,n.useCallback)(async e=>{await fetch(`/api/gmail/statuses?id=${e}`,{method:"DELETE"}),y=y?.filter(t=>t.id!==e)??[],s.current&&t(y)},[]),d=(0,n.useCallback)(async e=>{y=e,s.current&&t(e);let n=e.map(e=>e.id);await fetch("/api/gmail/statuses/reorder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:n})})},[]),u=(0,n.useCallback)(t=>t?e.find(e=>e.id===t)?.label??"No status":"No status",[e]),m=(0,n.useCallback)(t=>t?e.find(e=>e.id===t)?.color??"gray":"gray",[e]);return{statuses:e,loading:a,addStatus:l,updateStatus:o,removeStatus:c,reorderStatuses:d,refetch:i,getLabel:u,getRawColor:m}}e.s(["useEmailStatuses",0,k],229479);var b=e.i(643531),_=e.i(750570),N=e.i(788699),C=e.i(341256),S=e.i(783618);let E=`${S.PILL_SIZES.default} inline-flex items-center rounded-full sq-capsule border transition-colors`;function T({statusId:e,onChange:a,highlighted:s,className:i}){let{statuses:c,getLabel:h,getRawColor:p,addStatus:x,updateStatus:v,removeStatus:y,reorderStatuses:w}=k(),[j,b]=(0,n.useState)(!1),[_,N]=(0,n.useState)(!1),[C,S]=(0,n.useState)(null),[L,A]=(0,n.use
1State)(""),R=p(e),q=h(e),$=(0,n.useMemo)(()=>{let e=L.trim().toLowerCase();return e?c.filter(t=>t.label.toLowerCase().includes(e)):c},[c,L]),U=L.trim().length>0,D=(0,n.useMemo)(()=>$.map(e=>e.id),[$]),F=(0,l.useSensors)((0,l.useSensor)(l.MouseSensor,{activationConstraint:{distance:5}}),(0,l.useSensor)(l.TouchSensor,{activationConstraint:{delay:250,tolerance:5}})),z=(0,n.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let a=c.findIndex(e=>e.id===t.id),r=c.findIndex(e=>e.id===n.id);-1!==a&&-1!==r&&w((0,o.arrayMove)(c,a,r))},[c,w]),O=(0,f.useRowNavigation)($.length,e=>{let t=$[e];t&&a&&(a(t.id),N(!1))}),B=s?"bg-white dark:bg-white/10 border-[#F0EEEB] dark:border-[oklch(0.34_0.006_60)] text-foreground/80 hover:bg-[#F0EEE6] hover:border-[#EBE7E0] dark:hover:bg-white/15 cursor-pointer":"entity-chip text-foreground/80 cursor-pointer";if(!a)return(0,t.jsxs)("span",{className:(0,g.cn)(E,B,i),children:[(0,t.jsx)(M,{color:R,className:"size-2"}),q]});async function H(t){await y(t),e===t&&a(null)}async function G(e,t){await v(e,t),S(null)}return(0,t.jsxs)(m.DropdownMenu,{open:_,onOpenChange:e=>{N(e),e||(b(!1),S(null),A(""))},children:[(0,t.jsx)(m.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",className:(0,g.cn)(E,B,"focu
1s:outline-none",i),onClick:e=>e.stopPropagation(),children:[(0,t.jsx)(M,{color:R,className:"size-2"}),q]})}),(0,t.jsxs)(m.DropdownMenuContent,{className:"w-64 min-w-0 p-0 z-[300]",align:"start",side:"bottom",container:(0,u.isDemoMode)()?void 0:null,onClick:e=>e.stopPropagation(),children:[(0,t.jsx)(f.DropdownSearchRow,{autoFocus:!0,value:L,onValueChange:e=>{A(e),O.setActive(0)},onKeyDown:O.onKeyDown,placeholder:"Search statusesâ¦",addAction:{label:j?"Cancel":"Add status",active:j,onClick:()=>b(e=>!e)}}),j&&(0,t.jsx)("div",{className:"border-b",children:(0,t.jsx)(I,{initialLabel:L.trim(),initialColor:"#DCE8F0",onSubmit:async(e,t)=>{await W(e,t)},onCancel:()=>b(!1),submitLabel:"Create"})}),e&&!j&&(0,t.jsx)("div",{className:"border-b p-1",children:(0,t.jsxs)("button",{type:"button",onClick:()=>{a(null),N(!1)},className:(0,g.cn)(f.DROPDOWN_ROW_CLASS,"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[(0,t.jsx)(r.X,{className:"size-3.5"}),"Clear status"]})}),(0,t.jsxs)("div",{className:f.DROPDOWN_LIST_CLASS,children:[(0,t.jsx)(l.DndContext,{sensors:F,collisionDetection:l.closestCenter,onDragEnd:z,modifiers:[d.restrictToVerticalAxis],children:(0,t.jsx)(o.SortableContext,{items:D,strategy:o.verticalListSortingStrategy,children:$.map((n,r)=>(0,t.jsx)(P,{option:n,navProps:O.rowProps(r),isActive:e===n.id,isEditing:C===n.id,draggable:!U,onSelect:()=>{a(n.id),N(!1)},onStartEdit:()=>S(n.id),onCancelEdit:()=>S(null),onSaveEdit:e=>G(n.id,e),onDelete:()=>H(n.id)},n.id))})}),0===$.length&&(0,t.jsx)("p",{className:f.DROPDOWN_EMPTY_CLASS,children:"No matches"})]})]})]});async function W(e,t){try{let n=await x(e,t);a(n.id),b(!1),N(!1)}catch{}}}function M({color:e,className:n}){let{resolvedTheme:a}=(0,x.useTheme)();return(0,t.jsx)("span",{className:(0,g.cn)("rounded-full shrink-0",(0,v.dotClassForColor)(e),n),style:(0,v.dotStyleForColor)(e,"dark"===a)})}function I({initialLabel:e,initialColor:a,onSubmit:s,onCancel:i,submitLabel:l}
1){let[o,c]=(0,n.useState)(e),[d,u]=(0,n.useState)(a);async function m(){o.trim()&&await s(o.trim(),d)}return(0,t.jsxs)("div",{className:"p-2 space-y-2",onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&m(),"Escape"===e.key&&i()},children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(h.Input,{autoFocus:!0,variant:"on-white",placeholder:"Status name",value:o,onChange:e=>c(e.target.value),className:"h-7 text-xs flex-1"}),(0,t.jsx)("button",{type:"button",onClick:i,className:"shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(r.X,{className:"size-3"})})]}),(0,t.jsx)(p.StatusColorField,{value:d,onChange:u}),(0,t.jsxs)("button",{type:"button",onClick:m,disabled:!o.trim(),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 disabled:opacity-40 disabled:cursor-not-allowed pt-0.5",children:[(0,t.jsx)(b.Check,{className:"size-3"}),l]})]})}function P({option:e,navProps:n,isActive:a,isEditing:r,draggable:s,onSelect:i,onStartEdit:l,onCancelEdit:d,onSaveEdit:u,onDelete:m}){let{attributes:h,listeners:p,setNodeRef:x,transform:v,transition:y,isDragging:w}=(0,o.useSortable)({id:e.id}),j={transform:c.CSS.Translate.toString(v),transition:y,opacity:w?.5:1,zIndex:w?50:void 0,position:"relative"};return r?(0,t.jsx)("div",{ref:x,style:j,children:(0,t.jsx)(I,{initialLabel:e.label,initialColor:e.color,onSubmit:async(e,t)=>{await u({label:e,color:t})},onCancel:d,submitLabel:"Save"})}):(0,t.jsxs)("div",{ref:x,style:j,"data-slot":"dropdown-row",...n,className:(0,g.cn)(f.DROPDOWN_ROW_CLASS,"gap-1 group/status",a&&"font-medium"),children:[s&&(0,t.jsx)("span",{className:"opacity-0 group-hover/status:opacity-100 cursor-grab active:cursor-grabbing transition-opacity shrink-0 touch-none",...h,...p,children:(0,t.jsx)(_.GripVertical,{className:"size-3 text-muted-foreground"})}),(0,t.jsxs)("button",{type:"button",onClick:i,className:"flex items-center gap-2 flex-1 min-w-0 cursor-pointer text-start",children:[(0,t.jsx)(M,{color:e.color,className:"size-2"}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}),a&&(0,t.jsx)(b.Check,{className:"size-3.5 shrink-0"}),(0,t.jsx)(f.EnterHint,{className:a?"ms-0":void 0}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/status:opacity-100 transition-opacity shrink-0",children:[(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:"p-0.5 text-muted-foreground hover:text-foreground transition-colors rounded",children:(0,t.jsx)(N.Pencil,{className:"size-3"})}),(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),m()},className:"p-0.5 text-muted-foreground hover:text-destructive transition-colors rounded",children:(0,t.jsx)(C.TrashIcon,{className:"size-3"})})]})]})}e.s(["EmailStatusBadge",0,T],172901);var L=e.i(23031),A=e.i(920755),R=e.i(846696);e.s(["ConversationStatusSlot",0,function({conversationId:e,channel:a}){let[r,s]=(0,n.useState)(null),i=(0,A.createClient)();return(0,n.useEffect)(()=>{"linkedin_comments"===a?i.from("linkedin_comment_thread_state").select("status_id").eq("post_urn",e).maybeSingle().then(({data:e})=>{e?.status_id&&s(e.status_id)}):i.from({linkedin:"linkedin_conversations",slack:"slack_conversations",whatsapp:"whatsapp_conversations",sms:"sms_conversations",imessage:"imessage_conversations",chat:"chat_conversations",reddit:"reddit_conversations"}[a]).select("status_id").eq("id",e).single().then(({data:e})=>{e?.status_id&&s(e.status_id)})},[i,a,e]),(0,t.jsx)(T,{statusId:r,onChange:function(t){s(t),fetch("/api/inbox/status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationIds:[e],channel:a,statusId:t})}).catch(()=>{s(r)})},highlighted:!0})},"ThreadMetaBar",0,function({conversationId:e,channel:l,className:o,showStatusOnMobile:c=!1}
1){let[d,u]=(0,n.useState)([]),[m,h]=(0,n.useState)([]),[p,f]=(0,n.useState)(null),[x,g]=(0,n.useState)(!1),[v,y]=(0,n.useState)(!1),w=(0,A.createClient)();(0,n.useEffect)(()=>{"linkedin_comments"===l?w.from("linkedin_comment_thread_state").select("status_id").eq("post_urn",e).maybeSingle().then(({data:e})=>{e?.status_id&&f(e.status_id)}):w.from({linkedin:"linkedin_conversations",slack:"slack_conversations",whatsapp:"whatsapp_conversations",sms:"sms_conversations",imessage:"imessage_conversations",chat:"chat_conversations",reddit:"reddit_conversations"}[l]).select("status_id").eq("id",e).single().then(({data:e})=>{e?.status_id&&f(e.status_id)})},[w,l,e]);let j=(0,n.useCallback)(async()=>{let{data:t}=await w.from("conversation_tags").select("tag_id, tag:tags(id, name, color)").eq("conversation_id",e);t&&h(t.map(e=>e.tag).filter(Boolean))},[w,e]),k=(0,n.useCallback)(async()=>{let{data:e}=await w.from("tags").select("id, name, color").order("name");e&&u(e)},[w]);(0,n.useEffect)(()=>{j()},[j]),(0,n.useEffect)(()=>{x&&k()},[x,k]);let b=new Set(m.map(e=>e.id));async function _(t){y(!0),h(e=>[...e,t]);try{if(!(await fetch("/api/inbox/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationIds:[e],channel:l,tagId:t.id})})).ok)throw Error()}catch{h(e=>e.filter(e=>e.id!==t.id)),R.toast.error("Failed to apply tag")}finally{y(!1)}}async function N(t){h(e=>e.filter(e=>e.id!==t));try{if(!(await fetch(`/api/inbox/tags?conversation_id=${encodeURIComponent(e)}&tag_id=${encodeURIComponent(t)}`,{method:"DELETE"})).ok)throw Error()}catch{h(m),R.toast.error("Failed to remove tag")}}async function C(e,t){y(!0);try{let{data:{user:n}}=await w.auth.getUser();if(!n)throw Error("Not signed in");let{data:a,error:r}=await w.from("tags").insert({owner_id:n.id,name:e,color:t}).select("id, name, color").single();if(r)throw r;a&&(u(e=>e.some(e=>e.id===a.id)?e:[...e,a]),await _(a))}catch{R.toast.error("Failed to create tag")}finally{y(!1)}}return(0,t.jsxs)("div",{className:o??"flex items-center gap-1.5 px-3 py-1 border-b bg-muted/20 overflow-x-auto shrink-0",children:[(0,t.jsx)("span",{className:c?"inline-flex":"hidden sm:inline-flex",children:(0,t.jsx)(T,{statusId:p,onChange:function(t){f(t),fetch("/api/inbox/status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationIds:[e],channel:l,statusId:t})}).catch(()=>{R.toast.error("Failed to update status"),f(p)})},highlighted:!0})}),m.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-full sq-capsule px-1.5 py-0.5 text-[10px] font-medium text-white shrink-0",style:{backgroundColor:e.color},children:[(0,t.jsx)("span",{className:"truncate max-w-[72px]",children:e.name}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),N(e.id)},className:"ml-0.5 rounded-full hover:bg-white/20 p-0 leading-none",children:(0,t.jsx)(r.X,{className:"h-2.5 w-2.5"})})]},e.id)),(0,t.jsxs)(i.Popover,{open:x,onOpenChange:g,children:[(0,t.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(s.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0","aria-label":"Add tag",children:(0,t.jsx)(a.Tag,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(i.PopoverContent,{className:"w-64 p-0 overflow-hidden",align:"start",children:(0,t.jsx)(L.TagPickerPanel,{tags:d,appliedIds:m.map(e=>e.id),onSelect:e=>b.has(e.id)?N(e.id):_(e),onCreate:C,busy:v})})]})]})}],182352)},399513,e=>{"use strict";var t=e.i(843476),n=e.i(439468),a=e.i(955194),r=e.i(476819);function s({company:e}){let a=(0,n.useDomainLogo)(e.logoUrl?null:e.domain),r=e.logoUrl||a;return r?(0,t.jsx)("img",{src:r,alt:"",className:"h-full w-full object-cover"}):(0,t.jsx)("span",{className:"text-[10px] font-medium text-foreground/60",children:(e.name||"?")[0]?.toUpperCase()})}e.s(["CompanyLogoStack",0,function({companies:e,size:n=40}){let i=e.slice(0,3);if(0===i.length)return null;let l=Math.round(.38*n);return(0,t.jsx)("span",{className:"relative z-0 isolate flex shrink-0 items-center",title:i.map(e=>e.name).filter(Boolean).join(", "),children:i.map((e,o)=>{let c,d,u;return(0,t.jsx)("span",{className:"relative flex shrink-0 items-center justify-center overflow-hidden bg-[var(--logo-chip)] avatar-border first:ml-0",style:{width:(0,r.designPx)(n),height:(0,r.designPx)(n),marginLeft:0===o?0:(0,r.designPx)(-l),zIndex:i.length-o,...0===o?{WebkitMaskImage:a.SQUIRCLE_MASK,maskImage:a.SQUIRCLE_MASK,WebkitMaskSize:"100% 100%",maskSize:"100% 100%"}:(c=`${a.SQUIRCLE_MASK}, ${a.SQUIRCLE_MASK}`,{WebkitMaskImage:c,maskImage:c,WebkitMaskPosition:d=`0 0, ${-(n-l)-1.5}px -1.5px`,maskPosition:d,WebkitMaskSize:u=`${n}px ${n}px, ${n+3}px ${n+3}px`,maskSize:u,WebkitMaskRepeat:"no-repeat, no-repeat",maskRepeat:"no-repeat, no-repeat",WebkitMaskComposite:"xor",maskComposite:"exclude"})},children:(0,t.jsx)(s,{company:e})},`${e.domain||e.name||"co"}-${o}`)})})},"slackAvatarMarks",0,function(e,t){if(t&&t.length>0)return t;let n=e.company_name??null,a=e.company_logo_url??null,r=e.company_domain??null;if(n||a||r)return[{name:n,logoUrl:a,domain:r}]}])},934088,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(751975),r=e.i(37727),s=e.i(167881),i=e.i(59377),l=e.i(728231),o=e.i(23031),c=e.i(846696),d=e.i(783618);e.s(["GmailTagManager",0,function({selectedThreadIds:e,onTagged:r,onTaggedOptimistic:d,onTaggedRevert:u}
1){let[m,h]=(0,n.useState)([]),[p,f]=(0,n.useState)(!1),[x,g]=(0,n.useState)(!1);async function v(){let e=await fetch("/api/tags");e.ok&&h((await e.json()).tags||[])}async function y(t,n){g(!0);try{let a=await fetch("/api/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,color:n})});if(!a.ok)throw Error();let r=await a.json();h(e=>e.some(e=>e.id===r.tag.id)?e:[...e,r.tag]),e.length>0&&await w(r.tag.id,r.tag)}catch{c.toast.error("Failed to create tag")}finally{g(!1)}}async function w(t,n){if(!e.length)return;let a=n??m.find(e=>e.id===t);if(a){d?.(e,a),g(!0);try{if(!(await fetch("/api/gmail/tags/threads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e,tagId:t})})).ok)throw Error();c.toast.success("Tag applied"),f(!1),r?.()}catch{c.toast.error("Failed to apply tag"),u?.(e,t)}finally{g(!1)}}}return(0,n.useEffect)(()=>{p&&v()},[p]),(0,t.jsxs)(i.Popover,{open:p,onOpenChange:f,children:[(0,t.jsx)(l.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(l.Tooltip,{children:[(0,t.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(l.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(s.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:0===e.length,children:(0,t.jsx)(a.Tag,{className:"h-3.5 w-3.5"})})})}),(0,t.jsx)(l.TooltipContent,{side:"bottom",children:"Tag"})]})}),(0,t.jsx)(i.PopoverContent,{className:"w-64 p-0 overflow-hidden",align:"start",children:(0,t.jsx)(o.TagPickerPanel,{tags:m,onSelect:e=>w(e.id),onCreate:y,busy:x})})]})},"TagChip",0,function({tag:e,onRemove:n}){return(0,t.jsxs)("span",{className:(0,d.pillClass)("default","group"),children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:e.color}}),e.name,n&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"opacity-0 group-hover:opacity-100 ml-0.5",children:(0,t.jsx)(r.X,{className:"h-2.5 w-2.5"})})]})}])},747250,175622,145319,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(340024),r=e.i(871689),s=e.i(870273),i=e.i(37727),l=e.i(135745),o=e.i(626455),c=e.i(722915),d=e.i(555436),u=e.i(566408),m=e.i(289626),h=e.i(199053),p=e.i(373375),f=e.i(463059),x=e.i(572377),g=e.i(524076),v=e.i(158061),y=e.i(167881),w=e.i(728231),j=e.i(375727),k=e.i(878295),b=e.i(607486),_=e.i(149685),N=e.i(941388),C=e.i(416788),S=e.i(522016),E=e.i(611423),T=e.i(59377),M=e.i(753751),I=e.i(213788),P=e.i(920755),L=e.i(846696);function A({threadId:e}
1){let[a,r]=(0,n.useState)([]),[s,l]=(0,n.useState)([]),[o,c]=(0,n.useState)([]),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(null);async function p(){try{let t=await fetch(`/api/gmail/threads/${e}/associations`);if(!t.ok)return;let n=await t.json();r(n.contacts||[]),l(n.companies||[]),c(n.deals||[])}catch{}finally{u(!1)}}async function f(t,n){try{if(!(await fetch(`/api/gmail/threads/${e}/associations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,entityId:n})})).ok)throw Error();await p(),h(null),L.toast.success(`${t.charAt(0).toUpperCase()+t.slice(1)} linked`)}catch{L.toast.error("Failed to add association")}}async function x(t,n){try{await fetch(`/api/gmail/threads/${e}/associations?type=${t}&entityId=${n}`,{method:"DELETE"}),await p()}catch{L.toast.error("Failed to remove")}}return((0,n.useEffect)(()=>{p()},[e]),d)?(0,t.jsxs)("div",{className:"space-y-3 py-3 px-4",children:[(0,t.jsx)(E.Skeleton,{className:"h-3 w-16"}),Array.from({length:2}).map((e,n)=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E.Skeleton,{className:"h-6 w-6 rounded-md shrink-0"}),(0,t.jsx)(E.Skeleton,{className:"h-3.5 w-24"})]},n))]}):(0,t.jsxs)("div",{className:"space-y-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Linked to"}),(0,t.jsxs)(T.Popover,{open:null!==m,onOpenChange:e=>!e&&h(null),children:[(0,t.jsx)(T.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-6 w-6 p-0",children:(0,t.jsx)(N.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(T.PopoverContent,{className:"w-48 p-1",align:"end",children:m?(0,t.jsx)(R,{type:m,onSelect:e=>f(m,e),onBack:()=>h(null)}):(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-lg [corner-shape:squircle] px-2 py-1.5 text-sm hover:bg-muted",onClick:()=>h("contact"),children:[(0,t.jsx)(C.PeopleGroupIcon,{className:"h-3.5 w-3.5"})," Person"]}),(0,t.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-lg [corner-shape:squircle] px-2 py-1.5 text-sm hover:bg-muted",onClick:()=>h("company"),children:[(0,t.jsx)(b.Building2,{className:"h-3.5 w-3.5"})," Company"]}),(0,t.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-lg [corner-shape:squircle] px-2 py-1.5 text-sm hover:bg-muted",onClick:()=>h("deal"),children:[(0,t.jsx)(_.Handshake,{className:"h-3.5 w-3.5"})," Deal"]})]})})]})]}),a.length>0&&(0,t.jsxs)("div",{className:"px-4 space-y-1",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"People"}),a.map(e=>e.contact&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-2 -mx-2 rounded-lg hover:bg-muted/50 transition-colors group",children:[(0,t.jsxs)(S.default,{href:`/people/${e.contact.id}`,className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"relative flex h-7 w-7 items-center justify-center squircle bg-muted avatar-border text-xs font-medium shrink-0 overflow-hidden",children:e.contact.image_url?(0,t.jsx)("img",{src:e.contact.image_url,alt:"",className:"absolute inset-0 h-full w-full object-cover"}):e.contact.name.charAt(0).toUpperCase()}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.contact.name}),e.contact.email&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.contact.email})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["auto"===e.source&&(0,t.jsx)("span",{className:"text-[9px] text-muted-foreground/60 px-1.5 py-0.5 rounded bg-muted/50",children:"auto"}),(0,t.jsx)("button",{onClick:()=>
1x("contact",e.contact.id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-0.5",children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]})]},e.id))]}),s.length>0&&(0,t.jsxs)("div",{className:"px-4 space-y-1",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"Companies"}),s.map(e=>e.company&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-2 -mx-2 rounded-lg hover:bg-muted/50 transition-colors group",children:[(0,t.jsxs)(S.default,{href:`/companies/${e.company.id}`,className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)(I.CompanyLogo,{domain:e.company.domain||null,companyName:e.company.name,logoUrl:e.company.logo_url,size:"sm"}),(0,t.jsx)("div",{className:"min-w-0",children:(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.company.name})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["auto"===e.source&&(0,t.jsx)("span",{className:"text-[9px] text-muted-foreground/60 px-1.5 py-0.5 rounded bg-muted/50",children:"auto"}),(0,t.jsx)("button",{onClick:()=>x("company",e.company.id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-0.5",children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]})]},e.id))]}),o.length>0&&(0,t.jsxs)("div",{className:"px-4 space-y-1",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"Deals"}),o.map(e=>e.deal&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-2 -mx-2 rounded-lg hover:bg-muted/50 transition-colors group",children:[(0,t.jsxs)(S.default,{href:`/deals/${e.deal.id}`,className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"flex h-8 w-8 items-center justify-center squircle bg-muted avatar-border shrink-0",children:(0,t.jsx)(_.Handshake,{className:"h-4 w-4 text-foreground/70"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.deal.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.deal.amount?`${e.deal.currency} ${e.deal.amount.toLocaleString()}`:e.deal.stage})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["auto"===e.source&&(0,t.jsx)("span",{className:"text-[9px] text-muted-foreground/60 px-1.5 py-0.5 rounded bg-muted/50",children:"auto"}),(0,t.jsx)("button",{onClick:()=>x("deal",e.deal.id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-0.5",children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]})]},e.id))]}),0===a.length&&0===s.length&&0===o.length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground px-4",children:"No linked contacts, companies, or deals."})]})}function R({type:e,onSelect:a,onBack:r}){let[s,i]=(0,n.useState)([]),l=(0,P.createClient)();async function o(t){if(t.length<2)return void i([]);if("contact"===e){let{data:e}=await l.from("contacts").select("id, name, email").or(`name.ilike.%${t}%,email.ilike.%${t}%`).limit(8);i((e||[]).map(e=>({id:e.id,name:e.name,detail:e.email})))}else if("company"===e){let{data:e}=await l.from("companies").select("id, name, domain").or(`name.ilike.%${t}%,domain.ilike.%${t}%`).limit(8);i((e||[]).map(e=>({id:e.id,name:e.name,detail:e.domain||void 0})))}else{let{data:e}=await l.from("deals").select("id, name, stage").ilike("name",`%${t}%`).limit(8);i((e||[]).map(e=>({id:e.id,name:e.name,detail:e.stage})))}}let c="contact"===e?"person":e;return(0,t.jsxs)(M.Command,{shouldFilter:!1,children:[(0,t.jsx)(M.CommandInput,{placeholder:`Search ${c}s...`,onValueChange:o}),(0,t.jsxs)(M.CommandList,{children:[(0,t.jsxs)(M.CommandEmpty,{children:["No ",c,"s found"]}),(0,t.jsx)(M.CommandGroup,{children:s.map(e=>(0,t.jsx)(M.CommandItem,{value:e.id,onSelect:()=>a(e.id),children:(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm truncate",children:e.name}),e.detail&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.detail})]})},e.id))})]})]})}var q=e.i(875527),$=e.i(934088),U=e.i(531278);let D="gmail:labels:v1";function F(){try{let e=sessionStorage.getItem(D);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function z(e){try{sessionStorage.setItem(D,JSON.stringify(e))}catch{}}function O({trigger:e,disabled:a,onMove:r,align:s="end",tooltip:i,open:l,onOpenChange:o,anchorRef:c}
1){let[d,u]=(0,n.useState)(F),[m,h]=(0,n.useState)(!1),[p,f]=(0,n.useState)(null),[x,g]=(0,n.useState)(!1),v=l??x,y=e=>{void 0===l&&g(e),o?.(e)},[j,k]=(0,n.useState)(0),[b,_]=(0,n.useState)(""),[C,S]=(0,n.useState)(!1),I=(0,n.useRef)(null);(0,n.useEffect)(()=>{v||_("")},[v]),(0,n.useEffect)(()=>{if(!v)return;let e=0,t=Date.now()+400,n=()=>{let a=I.current;if(!a||document.activeElement!==a){if(a){a.focus({preventScroll:!0});try{a.setSelectionRange(a.value.length,a.value.length)}catch{}if(document.activeElement===a)return}Date.now()<t&&(e=requestAnimationFrame(n))}};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[v]),(0,n.useEffect)(()=>{if(!v||d.length>0&&0===j)return;let e=new AbortController,t=setTimeout(()=>e.abort(),3e4);return h(!0),f(null),(async()=>{try{let t=await fetch("/api/gmail/labels",{signal:e.signal,cache:"no-store"});if(!t.ok){let e=await t.text().catch(()=>"");throw Error(`HTTP ${t.status}${e?`: ${e.slice(0,120)}`:""}`)}let n=(await t.json()).labels||[];u(n),z(n)}catch(t){let e=t instanceof Error?"AbortError"===t.name?"Request timed out":t.message:"Failed to load labels";console.error("[MoveToFolderDropdown] failed to load labels:",t),f(e)}finally{clearTimeout(t),h(!1)}})(),()=>{clearTimeout(t),e.abort()}},[v,d.length,j]);let P=b.trim(),A=(0,n.useMemo)(()=>d.some(e=>e.name.toLowerCase()===P.toLowerCase()),[d,P]),R=P.length>0&&!A&&!m&&!p;async function q(e){S(!0);try{let t=await fetch("/api/gmail/labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok){if(409===t.status){L.toast.error("A label with that name already exists"),k(e=>e+1);return}throw Error(`HTTP ${t.status}`)}let n=(await t.json()).label,a=[...d,n].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"}));u(a),z(a),r(n.id,n.name),y(!1)}catch(e){console.error("[MoveToFolderDropdown] failed to create label:",e),L.toast.error("Failed to create label")}finally{S(!1)}}let $=(0,t.jsx)(T.PopoverTrigger,{asChild:!0,children:e});return(0,t.jsxs)(T.Popover,{open:!a&&v,onOpenChange:e=>!a&&y(e),children:[c?(0,t.jsx)(T.PopoverAnchor,{virtualRef:c}):null,i?(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:$}),(0,t.jsx)(w.TooltipContent,{side:"bottom",className:"text-xs",children:i})]}):$,(0,t.jsx)(T.PopoverContent,{align:s,className:"w-56 p-0",onOpenAutoFocus:e=>{e.preventDefault(),I.current?.focus()},children:(0,t.jsxs)(M.Command,{children:[(0,t.jsx)(M.CommandInput,{ref:I,autoFocus:!0,placeholder:"Search or create...",value:b,onValueChange:_,className:"text-base sm:text-sm"}),(0,t.jsx)(M.CommandList,{children:m?(0,t.jsx)("div",{className:"py-1",children:Array.from({length:4}).map((e,n)=>(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[(0,t.jsx)(E.Skeleton,{className:"h-4 w-4 rounded shrink-0"}),(0,t.jsx)(E.Skeleton,{className:"h-3.5 w-28"})]},n))}):p?(0,t.jsxs)("div",{className:"flex flex-col items-start gap-1.5 px-3 py-3 text-xs",children:[(0,t.jsx)("span",{className:"text-destructive",children:p}),(0,t.jsx)("button",{type:"button",className:"text-muted-foreground hover:text-foreground underline",onClick:()=>k(e=>e+1),children:"Retry"})]}):(0,t.jsxs)(t.Fragment,{children:[!R&&(0,t.jsx)(M.CommandEmpty,{children:"No labels found"}),(0,t.jsx)(M.CommandGroup,{children:d.map(e=>(0,t.jsx)(M.CommandItem,{value:e.name,onSelect:()=>{r(e.id,e.name),y(!1)},children:e.name},e.id))}),R&&(0,t.jsx)(M.CommandGroup,{children:(0,t.jsxs)(M.CommandItem,{value:P,disabled:C,onSelect:()=>{C||q(P)},className:"text-foreground",children:[C?(0,t.jsx)(U.Loader2,{className:"h-3 w-3 mr-2 animate-spin"}):(0,t.jsx)(N.Plus,{className:"h-3 w-3 mr-2"}),"Create â",P,"â"]},"__create__")})]})})]})})]})}e.s(["MoveToFolderDropdown",0,O],175622);var B=e.i(172901),H=e.i(428605),G=e.i(229085),W=e.i(362597),X=e.i(595834),Y=e.i(414318),V=e.i(969878),J=e.i(560800),K=e.i(341256),Z=e.i(770703),Q=e.i(813387),ee=e.i(503116),et=e.i(82735),en=e.i(881335),ea=e.i(469550),er=e.i(324973),es=e.i(88494);function ei({placeholder:e="Reply..."}){return(0,t.jsx)("div",{className:"px-2 py-2 w-full","aria-hidden":!0,
1children:(0,t.jsxs)("div",{"data-composer":!0,className:"oat-surface rounded-2xl border border-card-border bg-[#FAF9F5] dark:bg-black",children:[(0,t.jsx)("div",{"data-composer-body":!0,className:"relative px-3.5 py-3.5",children:(0,t.jsx)("div",{"data-composer-placeholder":!0,className:"min-h-[2lh] text-base md:text-sm leading-relaxed text-muted-foreground",children:e})}),(0,t.jsxs)("div",{"data-composer-toolbar":!0,className:"flex items-center justify-between gap-2 px-3.5 py-3.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-0.5 text-muted-foreground",children:[(0,t.jsx)(el,{children:(0,t.jsx)(C.PeopleGroupIcon,{className:"h-4 w-4"})}),(0,t.jsx)(el,{children:(0,t.jsx)(et.Paperclip,{className:"h-4 w-4"})}),(0,t.jsx)(el,{children:(0,t.jsx)(en.GifIcon,{className:"h-4 w-4"})}),(0,t.jsx)(el,{children:(0,t.jsx)(ea.VideoNoteIcon,{className:"h-4 w-4"})}),(0,t.jsx)(el,{children:(0,t.jsx)(ee.Clock,{className:"h-4 w-4"})}),(0,t.jsx)(el,{children:(0,t.jsx)(er.TasksIcon,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"h-7 w-7 flex items-center justify-center rounded-full shadow-sm text-white opacity-40",style:{backgroundColor:"var(--ring)"},children:(0,t.jsx)(es.SendArrowIcon,{className:"h-3.5 w-3.5"})})]})]})})}function el({children:e}){return(0,t.jsx)("span",{className:"h-7 w-7 flex items-center justify-center rounded-xl [corner-shape:squircle]",children:e})}e.s(["ComposerShell",0,ei],145319);let eo=(0,Z.default)(()=>e.A(782405).then(e=>e.GmailInlineReply),{ssr:!1,loading:()=>(0,t.jsx)(ei,{})}),ec=new Map;async function ed(e,t="/api/gmail"){let n=ec.get(e);if(!(n&&Date.now()-n.ts<3e5))try{let n=await fetch(`${t}/threads/${e}?fast=1`);if(!n.ok)return;let a=await n.json();ec.set(e,{thread:a.thread,messages:a.messages||[],drafts:a.drafts||[],participantImages:a.participantImages||{},participantContactIds:a.participantContactIds||{},ts:Date.now()})}catch{}}function eu(e,t){let n=t.filter(e=>e.id.startsWith("opt-sent-"));return 0===n.length?e:[...e.filter(e=>{if(!0!==e.is_sent)return!0;let t=new Date(e.internal_date||0).getTime(),a=e.from_email?.toLowerCase()||"";return!n.some(e=>{let n=e.from_email?.toLowerCase()||"";return(!a||!n||a===n)&&t>=new Date(e.internal_date||0).getTime()-5e3})}),...n]}function em({subject:e}){let a=(0,n.useRef)(null),[r,s]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>s(e.scrollWidth>e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]);let i=(0,t.jsx)("h2",{ref:a,className:"flex-1 min-w-0 text-base font-semibold truncate",children:e});return r?(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:i}),(0,t.jsx)(w.TooltipContent,{side:"bottom",align:"start",className:"max-w-md text-sm",children:e})]}):i}e.s(["GmailThreadView",0,function({threadId:b,accountEmail:_,onBack:N,isModal:C,hideClose:S,initialThread:E,onPrev:T,onNext:M,canGoPrev:I=!1,canGoNext:P=!1,onStatusChange:R,onThreadRemoved:U,onThreadRestore:D,onThreadAction:F,onThreadTagOptimistic:z,onThreadTagRevert:Z,onSent:ee,onStarChange:et,onReplySent:en,onMarkRead:ea,skipMarkRead:er,isFrontCard:es,externalSearch:el,onExternalSearchChange:ed,onMoveToLabel:eh,mailApiBase:ep}){let ef=(0,g.useDefaultMailProvider)(),ex=ep??"/api/gmail",eg="/api/outlook"===ep?"outlook":"/api/gmail"===ep?"gmail":ef,ev=ec.get(b),ey=ev&&Date.now()-ev.ts<3e5,[ew,ej]=(0,n.useState)(ey?ev.thread:E||null),[ek,eb]=(0,n.useState)(ey?ev.messages:[]),[e_,eN]=(0,n.useState)(ey?ev.drafts:[]),[eC,eS]=(0,n.useState)(ey?ev.participantImages:{}
1),[eE,eT]=(0,n.useState)(ey&&ev.participantContactIds||{}),[eM,eI]=(0,n.useState)(!ey),[eP,eL]=(0,n.useState)(void 0),eA=_||eP,eR=(0,n.useMemo)(()=>{let e=eA?.toLowerCase();for(let[t,n]of Object.entries(eE))if(t&&t!==e&&n)return n;return null},[eE,eA]),[eq,e$]=(0,n.useState)(!1),[eU,eD]=(0,n.useState)(null),[eF,ez]=(0,n.useState)(null),[eO,eB]=(0,n.useState)(null),[eH,eG]=(0,n.useState)(!1),[eW,eX]=(0,n.useState)(!1),[eY,eV]=(0,n.useState)(!1),[eJ,eK]=(0,n.useState)(""),[eZ,eQ]=(0,n.useState)(!1),[e0,e1]=(0,n.useState)(!1),[e2,e5]=(0,n.useState)(()=>ey?new Set(ev.messages.filter(e=>e.id.startsWith("opt-sent-")).map(e=>e.id)):new Set),{effectiveDefaultHtml:e3}=(0,J.useMailSignatures)("/api/outlook"===ex?"outlook":"gmail","/api/outlook"===ex&&E?E.gmail_account_id:void 0),e4=(0,n.useRef)(null),e6=(0,n.useRef)(null),e7=void 0!==el,e8=e7?el:eJ,e9=e7?ed??(()=>{}):eK,te=(0,n.useRef)(null),tt=(0,n.useRef)(null),tn=(0,n.useRef)(null),{containerRef:ta}=function(e,t,{threshold:a=50,enabled:r=!0}={}){let s=(0,n.useRef)(null),i=(0,n.useRef)(null),l=(0,n.useRef)(null),o=(0,n.useRef)(0),c=(0,n.useRef)(0),d=(0,n.useRef)(!1),u=(0,n.useCallback)((e,t,n)=>{if(n?e.style.transition="transform 0.25s cubic-bezier(.2,.8,.3,1), opacity 0.25s ease-out":e.style.transition="none",0===t)e.style.transform="",e.style.opacity="",e.style.willChange="";else{let n=Math.min(1,Math.abs(t)/250);e.style.transform=`translateX(${t}px)`,e.style.opacity=String(1-.3*n),e.style.willChange="transform, opacity"}},[]),m=(0,n.useCallback)((e,t)=>new Promise(n=>{let a=!1,r=()=>{a||(a=!0,e.removeEventListener("transitionend",s),n())},s=t=>{t.target===e&&r()};e.addEventListener("transitionend",s),setTimeout(r,t)}),[]);return(0,n.useEffect)(()=>{let n=s.current;if(!n||!r||!e&&!t)return;let h=e=>{if(d.current)return;let t=e.touches[0];t.clientX<24||t.clientX>window.innerWidth-24||e.target?.closest?.("[data-swipe-reply]")||(i.current={x:t.clientX,y:t.clientY,t:Date.now()},l.current=null,o.current=0,n.style.transition="none",n.style.transform="",n.style.opacity="",n.style.willChange="transform, opacity")},p=a=>{if(!i.current||d.current)return;let r=a.touches[0],s=r.clientX-i.current.x,m=r.clientY-i.current.y;if(!l.current){(Math.abs(s)>12||Math.abs(m)>12)&&(l.current=Math.abs(m)>.8*Math.abs(s)?"v":"h");return}if("v"===l.current)return;a.preventDefault();let h=s;s>0&&!e&&(h=.12*s),s<0&&!t&&(h=.12*s),o.current=h,cancelAnimationFrame(c.current),c.current=requestAnimationFrame(()=>{u(n,h,!1)})},f=async()=>{if(!i.current||d.current)return;let r=i.current.t;i.current=null,cancelAnimationFrame(c.current);let s=o.current,l=Math.abs(s),h=Date.now()-r;if(l>=a||h<180&&l>35){let a=s>0,r=a?e:t;if(r){d.current=!0,u(n,a?.6*window.innerWidth:-(.6*window.innerWidth),!0),await m(n,280),r(),n.style.transition="none";let e=a?-(.35*window.innerWidth):.35*window.innerWidth;n.style.transform=`translateX(${e}px)`,n.style.opacity="0",n.offsetHeight,u(n,0,!0),await m(n,280),n.style.transition="",n.style.transform="",n.style.opacity="",n.style.willChange="",d.current=!1;return}}u(n,0,!0),o.current=0;let p=()=>{n.style.willChange="",n.removeEventListener("transitionend",p)};n.addEventListener("transitionend",p,{once:!0}),setTimeout(()=>{n.style.willChange=""},300)};return n.addEventListener("touchstart",h,{passive:!0}),n.addEventListener("touchmove",p,{passive:!1}),n.addEventListener("touchend",f,{passive:!0}),()=>{n.removeEventListener("touchstart",h),n.removeEventListener("touchmove",p),n.removeEventListener("touchend",f),cancelAnimationFrame(c.current)}},[r,e,t,a,u,m]),{containerRef:s}}(I?T:void 0,P?M:void 0,{enabled:!!C}),tr=(0,n.useCallback)(async()=>{if(!ew)return;let e=!ew.is_starred;eX(!0),ej(t=>t?{...t,is_starred:e}:t);let t=ec.get(b);t&&ec.set(b,{...t,thread:{...t.thread,is_starred:e},ts:Date.now()}),et?.(b,e);try{if(!(await fetch(`${ex}/threads/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:[b],action:e?"star":"unstar"})})).ok)throw Error();L.toast.success(e?"Starred":"Removed star"),F?.()}catch{L.toast.error("Failed to update star"),ej(t=>t?{...t,is_starred:!e}:t);let t=ec.get(b);t&&ec.set(b,{...t,thread:{...t.thread,is_starred:!e},ts:Date.now()}),et?.(b,!e)}finally{eX(!1)}},[b,ew,F,et]),ts=(0,n.useCallback)(e=>{eG(!0),(0,W.deleteWithUndo)({message:"archive"===e?"Archived":"Moved to trash",onOptimistic:()=>{U?.(b),N(),eG(!1)},onUndo:()=>D?.(b),onError:()=>{L.toast.error(`Failed to ${e} thread`),D?.(b)},commit:async()=>
1{if(!(await fetch(`${ex}/threads/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:[b],action:e})})).ok)throw Error("Action failed")}})},[b,N,U,D,ex]),ti=(0,n.useCallback)(async(e,t)=>{if(eh)return void eh(b,e,t);eG(!0),U?.(b),N();try{if(!(await fetch(`${ex}/threads/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:[b],action:"move_to_label",labelId:e})})).ok)throw Error();L.toast.success(`Moved to ${t}`)}catch{L.toast.error("Failed to move thread"),D?.(b)}finally{eG(!1)}},[b,N,U,D,eh]),tl=(0,n.useCallback)(async()=>{eG(!0),ej(e=>e?{...e,is_read:!1}:e);let e=ec.get(b);e&&ec.set(b,{...e,thread:{...e.thread,is_read:!1},ts:Date.now()}),N();try{if(!(await fetch(`${ex}/threads/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:[b],action:"mark_unread"})})).ok)throw Error();L.toast.success("Marked as unread"),F?.()}catch{L.toast.error("Failed to mark as unread"),ej(e=>e?{...e,is_read:!0}:e)}finally{eG(!1)}},[b,N,F]),to=(0,n.useCallback)(e=>{ej(t=>t?{...t,status_id:e}:t),R?.(b,e)},[b,R]),tc=(0,n.useRef)(!0),td=(0,n.useRef)(!1),tu=(0,n.useRef)(0),tm=(0,n.useRef)([]),th=(0,n.useCallback)(async(e={})=>{let{fast:t=!1,background:n=!1}=e;n||t||!tc.current||eI(!0);try{let e=t?`${ex}/threads/${b}?fast=1`:`${ex}/threads/${b}`,a=await fetch(e);if(!a.ok){n||eI(!1);return}let r=await a.json();r.accountEmail&&eL(r.accountEmail),ej(r.thread);let s=r.messages||[],i=n?eu(s,tm.current):s;eb(i),eN(r.drafts||[]),eS(r.participantImages||{}),eT(r.participantContactIds||{}),ec.set(b,{thread:r.thread,messages:i,drafts:r.drafts||[],participantImages:r.participantImages||{},participantContactIds:r.participantContactIds||{},ts:Date.now()}),t&&(eI(!1),tc.current=!1,th({fast:!1,background:!0}))}catch{}finally{t||n||eI(!1),tc.current=!1}},[b]);(0,n.useEffect)(()=>{e.A(782405)},[]),(0,n.useEffect)(()=>{tm.current=ek},[ek]),(0,n.useEffect)(()=>{tc.current=!0,td.current=!1,tu.current=0;let e=ec.get(b);e&&Date.now()-e.ts<3e5?(ej(e.thread),eb(eu(e.messages,tm.current)),eN(e.drafts),eS(e.participantImages),eT(e.participantContactIds||{}),eI(!1),th({fast:!1,background:!0})):(eb([]),eN([]),th({fast:!0}))},[b,th]);let tp=(0,n.useRef)(ea);(0,n.useEffect)(()=>{tp.current=ea},[ea]);let tf=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!ew||ew.is_read||er)return;let e=`${b}:${ew.last_message_at??""}:${ew.message_count}`;tf.current!==e&&(tf.current=e,fetch(`${ex}/threads/${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({is_read:!0})}).catch(()=>{}),tp.current?.(b))},[ew,er,b,ex]),(0,Y.useOnEmailRefresh)(()=>{b&&th({fast:!1,background:!0})});let tx=(0,n.useRef)(!0),tg=(0,n.useRef)(!1),tv=eM&&0===ek.length&&0===e_.length?null:b,ty=(0,V.useScrollPinBottom)(te,tt,tx,tv),tw=(0,n.useCallback)(()=>{let e=te.current;e&&(tx.current=e.scrollHeight-e.scrollTop-e.clientHeight<200)},[]);(0,n.useEffect)(()=>{if(eM)return;let e=te.current,t=tt.current;if(!e||!t||ek.length+e_.length===0||tg.current)return;tg.current=!0,td.current=!0,tu.current=ek.length+e_.length,e.scrollTop=e.scrollHeight;let n=!1,a=new ResizeObserver(()=>{if(n)return;let e=te.current;e&&tx.current&&(e.scrollTop=e.scrollHeight)});a.observe(e),a.observe(t);let r=window.setTimeout(()=>{n=!0,a.disconnect()},3e3);return()=>{n=!0,a.disconnect(),clearTimeout(r)}},[eM,ek.length,e_.length]),(0,n.useEffect)(()=>{let e=te.current;if(!e||eM)return;let t=ek.length+e_.length,n=tu.current>0&&t>tu.current;tu.current=t,n&&td.current&&tx.current&&(e.scrollTop=e.scrollHeight)},[ek.length,e_.length,eM]);let tj=(0,n.useRef)(!!es);(0,n.useLayoutEffect)(()=>{if(void 0===es||!es||tj.current)return;let e=te.current;e&&(tx.current=!0,e.scrollTop=e.scrollHeight)},[es]),(0,n.useEffect)(()=>{let e=tj.current;if(tj.current=!!es,void 0===es||!es||e)return;let t=te.current,n=tt.current;if(!t)return;tx.current=!0;let a=!1,r=()=>{if(a)return;let e=te.current;e&&(e.scrollTop=e.scrollHeight,tx.current=!0)},s=new ResizeObserver(r);s.observe(t),n&&s.observe(n);let i=[window.setTimeout(r,380),window.setTimeout(r,900)],l=window.setTimeout(()=>
1{a=!0,s.disconnect(),i.forEach(clearTimeout)},1500);return()=>{a=!0,s.disconnect(),i.forEach(clearTimeout),clearTimeout(l)}},[es]),(0,n.useEffect)(()=>{if(!es)return;let e=()=>e1(!0);return document.addEventListener("email-card-swipe-down-action",e),()=>document.removeEventListener("email-card-swipe-down-action",e)},[es]);let tk=(0,n.useMemo)(()=>{let e=[...ek,...eF?e_.filter(e=>e.id!==eF.id):e_];return e.sort((e,t)=>(e.internal_date?new Date(e.internal_date).getTime():0)-(t.internal_date?new Date(t.internal_date).getTime():0)),e},[ek,e_,eF]),tb=(0,n.useMemo)(()=>{let e=e8.trim().toLowerCase();return e?tk.filter(t=>!!(t.from_name?.toLowerCase().includes(e)||t.from_email?.toLowerCase().includes(e)||t.snippet?.toLowerCase().includes(e))||(t.body_text||(t.body_html?(0,G.htmlToPlainText)(t.body_html):"")).toLowerCase().includes(e)):tk},[tk,e8]),t_=(0,n.useMemo)(()=>{let e=new Map,t=0;for(let n of tk){let a=(n.from_email||"").toLowerCase();a&&a!==eA?.toLowerCase()&&(e.has(a)||e.set(a,t++))}return e},[tk,eA]),tN=(0,n.useMemo)(()=>{let e,t;return e=eA?.toLowerCase(),t=new Set,(tk.forEach(e=>{e.from_email&&t.add(e.from_email.toLowerCase())}),t.size<=2||e&&(t.has(e)||tk.some(t=>[...t.to_emails.map(e=>e.email?.toLowerCase()),...t.cc_emails.map(e=>e.email?.toLowerCase())].includes(e))))?tk.map(()=>({isSubConvo:!1,label:""})):tk.map(e=>{let n=e.from_email?.toLowerCase(),a=new Set([...e.to_emails.map(e=>e.email.toLowerCase()),...e.cc_emails.map(e=>e.email.toLowerCase())]),r=0;for(let e of t)e!==n&&!a.has(e)&&r++;if(0===r)return{isSubConvo:!1,label:""};let s=e.to_emails.map(e=>e.email.toLowerCase()===eA?.toLowerCase()?"you":e.name?.split(" ")[0]||e.email.split("@")[0]);return{isSubConvo:!0,label:`â ${s.join(", ")}`}})},[tk,eA]),tC=(0,n.useMemo)(()=>(0,X.learnSignatures)(tk),[tk]),tS=function(e){let[t,a]=(0,n.useState)({}),r=(0,n.useRef)("");return(0,n.useEffect)(()=>{let t=e.sort().join(",");if(!t||t===r.current)return;r.current=t;let n=!1;return async function(){try{let e=await fetch(`/api/track/message-stats?message_ids=${encodeURIComponent(t)}`);if(!e.ok)return;let r=await e.json();n||a(r.stats??{})}catch{}}(),()=>{n=!0}},[e]),t}((0,n.useMemo)(()=>tk.filter(e=>e.is_sent||e.from_email?.toLowerCase()===eA?.toLowerCase()).map(e=>e.message_id).filter(Boolean),[tk,eA])),tE=(0,n.useMemo)(()=>(0,k.computeGapContexts)(tk,eA),[tk,eA]),tT=(0,n.useMemo)(()=>{for(let e of ek)if(e.body_html){let t=(0,G.extractUnsubscribeUrl)(e.body_html);if(t)return t}return null},[ek]),tM=(0,n.useCallback)(e=>{eD(e)},[]),tI=(0,n.useCallback)(e=>{eB([e])},[]),tP=(0,n.useCallback)(()=>{eD(null)},[]),tL=(0,n.useCallback)(e=>{eb(t=>[...t,e])},[]),tA=(0,n.useCallback)(e=>{eb(t=>t.filter(t=>t.id!==e)),e5(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),tR=(0,n.useCallback)(e=>{e5(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),tq=(0,n.useCallback)(e=>{eD(null),ez(e),requestAnimationFrame(()=>{tn.current?.scrollIntoView({behavior:"smooth",block:"end"})})},[]),t$=(0,n.useCallback)(()=>{ez(null)},[]),tU=(0,n.useCallback)(()=>{if(!eF)return;let e=eF.id;eN(t=>t.filter(t=>t.id!==e)),ec.delete(b),ez(null)},[eF,b]),tD=(0,n.useCallback)(async e=>{let t=e.draft_id;if(!t)return void L.toast.error("Cannot delete this draft");if("/api/outlook"===ex)return void L.toast.error("Drafts are not supported for Outlook in this view yet");let n=[];(0,W.deleteWithUndo)({message:"Draft deleted",onOptimistic:()=>eN(e=>(n=e,e.filter(e=>e.draft_id!==t))),onUndo:()=>eN(n),onCommitted:()=>ec.delete(b),onError:()=>{eN(n),L.toast.error("Failed to delete draft")},commit:async()=>{if(!(await fetch(`${ex}/drafts?id=${encodeURIComponent(t)}`,{method:"DELETE"})).ok)throw Error("Delete failed")}})},[b,ex]);return ew||eM?(0,t.jsxs)("div",{ref:ta,className:"flex flex-col flex-1 min-h-0","data-gmail-thread-view":!0,
1children:[(0,t.jsx)(w.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("div",{className:"@container flex flex-col border-b shrink-0 min-w-0","data-gmail-toolbar":!0,children:[(0,t.jsxs)("div",{className:"hidden @[600px]:flex flex-nowrap items-center gap-2 px-4 py-2 min-w-0 relative overflow-hidden",children:[!C&&(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",onClick:N,className:"h-8 w-8 rounded-3xl shrink-0",children:(0,t.jsx)(r.ArrowLeft,{className:"h-4 w-4"})}),(0,t.jsx)("span",{className:"inline-flex shrink-0",children:(0,t.jsx)(x.MailProviderSquircle,{provider:eg,className:"h-5 w-5"})}),(0,t.jsx)("div",{className:"block flex-1 min-w-0",children:(0,t.jsx)(em,{subject:ew?(0,H.decodeHtmlEntities)(ew.subject??"")||"(No subject)":""})}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0 ml-auto",children:[(0,t.jsx)("span",{className:"inline-flex mr-1 min-w-0",children:(0,t.jsx)(B.EmailStatusBadge,{statusId:ew?.status_id??null,onChange:to,highlighted:!0,className:"shrink min-w-0 overflow-hidden whitespace-nowrap text-ellipsis"})}),(0,t.jsx)($.GmailTagManager,{selectedThreadIds:[b],onTagged:()=>{th(),F?.()},onTaggedOptimistic:z,onTaggedRevert:Z,compact:!0}),(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH||!ek.length,onClick:()=>{ek.length&&eB(ek)},children:(0,t.jsx)(h.Forward,{className:"h-4 w-4"})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:"Forward thread"})]}),(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH,onClick:tl,children:(0,t.jsx)(u.MailPlus,{className:"h-4 w-4"})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:"Mark as unread"})]}),(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH,onClick:()=>ts("archive"),children:(0,t.jsx)(c.Archive,{className:"h-4 w-4"})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:"Archive"})]}),(0,t.jsx)(O,{disabled:eH,onMove:ti,tooltip:"Move to folder",trigger:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH,"aria-label":"Move to folder",children:(0,t.jsx)(m.FolderInput,{className:"h-4 w-4"})})}),(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl text-muted-foreground hover:text-destructive",disabled:eH,onClick:()=>ts("trash"),children:(0,t.jsx)(K.TrashIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:"Delete"})]}),!e7&&(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:`h-8 w-8 rounded-3xl ${eY?"bg-muted":""}`,onClick:()=>{eV(!0),setTimeout(()=>e6.current?.focus(),50)},children:(0,t.jsx)(d.Search,{className:"h-4 w-4"})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:"Search in thread"})]}),(0,t.jsx)("span",{className:"block w-px h-4 bg-border mx-0.5"}),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:`h-8 w-8 rounded-3xl ${eq?"bg-muted":""}`,onClick:()=>e$(!eq),children:(0,t.jsx)(l.PanelRight,{className:"h-4 w-4"})}),(0,t.jsxs)(w.Tooltip,{children:[(0,t.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",onClick:tr,disabled:eH||eW,children:(0,t.jsx)(s.Star,{className:`h-4 w-4 transition-colors ${ew?.is_starred?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})})}),(0,t.jsx)(w.TooltipContent,{side:"bottom",children:ew?.is_starred?"Remove star":"Star"})]}),C&&!S&&(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",onClick:N,className:"h-8 w-8 rounded-3xl",children:(0,t.jsx)(i.X,{className:"h-4 w-4"})})]}),!e7&&(0,t.jsx)("div",{className:`absolute inset-y-0 right-4 flex items-center bg-card pl-4 transition-transform duration-300 ease-out ${eY?"translate-x-0":"translate-x-[calc(100%+1rem)] pointer-events-none"}`,"aria-hidden":!eY,children:(0,t.jsxs)("div",{className:"flex items-center gap-1 w-[220px] h-8 pl-2.5 pr-1 search-pill roun
1ded-full bg-white border border-[oklch(0.85_0.01_60)] dark:bg-black dark:border-transparent",children:[(0,t.jsx)(d.Search,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("input",{ref:e6,value:e8,onChange:e=>e9(e.target.value),placeholder:"Search in thread...",tabIndex:eY?void 0:-1,className:"flex-1 min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground/60",onBlur:()=>{e8.trim()||eV(!1)},onKeyDown:e=>{"Escape"===e.key&&(e9(""),eV(!1))}}),e8&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground shrink-0 tabular-nums",children:[tb.length,"/",tk.length]}),(0,t.jsx)("button",{type:"button",tabIndex:eY?void 0:-1,className:"shrink-0 p-0.5 rounded-full text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{e9(""),eV(!1)},children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]})})]}),(0,t.jsxs)("div",{className:"@[600px]:hidden flex items-center gap-1.5 px-3 py-1.5 min-w-0 relative overflow-hidden",children:[(0,t.jsx)(x.MailProviderSquircle,{provider:eg,className:"h-5 w-5 shrink-0"}),(0,t.jsx)("h2",{className:`text-sm font-semibold truncate min-w-0 ${eY?"shrink max-w-[40%]":"flex-1"}`,children:ew?(0,H.decodeHtmlEntities)(ew.subject??"")||"(No subject)":""}),!e7&&(eY?(0,t.jsxs)("div",{className:"flex-1 flex items-center gap-1 min-w-0 ml-1 pl-2 pr-1 h-8 search-pill rounded-full bg-white border border-[oklch(0.85_0.01_60)] dark:bg-black dark:border-transparent",children:[(0,t.jsx)(d.Search,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,t.jsx)("input",{ref:e4,value:e8,onChange:e=>e9(e.target.value),placeholder:"Search...",className:"flex-1 min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground/60",onKeyDown:e=>{"Escape"===e.key&&(e9(""),eV(!1))}}),e8&&tb.length<tk.length&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground shrink-0 tabular-nums",children:[tb.length,"/",tk.length]}),(0,t.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>{e9(""),eV(!1)},children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]}):(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-3xl",onClick:()=>{eV(!0),setTimeout(()=>e4.current?.focus(),50)},children:(0,t.jsx)(d.Search,{className:"h-4 w-4"})})),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-3xl",onClick:()=>eQ(!0),"aria-label":"Show actions",children:(0,t.jsx)(p.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)(O,{align:"center",disabled:eH,onMove:ti,open:e0,onOpenChange:e1,trigger:(0,t.jsx)("button",{type:"button","aria-hidden":"true",tabIndex:-1,className:"absolute left-1/2 -translate-x-1/2 bottom-0 w-0 h-0 p-0 m-0 border-0 bg-transparent pointer-events-none"})}),C&&!S&&(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",onClick:N,className:"h-8 w-8 shrink-0 rounded-3xl",children:(0,t.jsx)(i.X,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:`absolute inset-0 flex items-center gap-0.5 px-3 bg-card transition-transform duration-300 ease-out ${eZ?"translate-x-0":"translate-x-full pointer-events-none"}`,"aria-hidden":!eZ,children:[(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-3xl",onClick:()=>eQ(!1),"aria-label":"Hide actions",children:(0,t.jsx)(f.ChevronRight,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"flex-1 flex items-center justify-end gap-0.5 min-w-0 overflow-hidden",children:[(0,t.jsx)("span",{className:"inline-flex min-w-0",children:(0,t.jsx)(B.EmailStatusBadge,{statusId:ew?.status_id??null,onChange:to,highlighted:!0,className:"shrink min-w-0 overflow-hidden whitespace-nowrap text-ellipsis"})}),(0,t.jsx)($.GmailTagManager,{selectedThreadIds:[b],onTagged:()=>{th(),F?.()},onTaggedOptimistic:z,onTaggedRevert:Z,compact:!0}),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH,onClick:tl,"aria-label":"Mark as unread",children:(0,t.jsx)(u.MailPlus,{className:"h-4 w-4"})}),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",disabled:eH,onClick:()=>e1(!0),"aria-label":"Move to folder",children:(0,t.jsx)(m.FolderInput,{className:"h-4 w-4"})}),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl text-muted-foreground hover:text-destructive",disabled:eH,onClick:()=>ts("trash"),"aria-label":"Delete",children:(0,t.jsx)(K.TrashIcon,{className:"h-4 w-4"})}),(0,t.jsx)(y.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-3xl",onClick:tr,disabled:eH||eW,"aria-label":ew?.is_starred?"Remove star":"Star",children:(0,t.jsx)(s.Star,{className:`h-4 w-4 transition-colors ${ew?.is_starred?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})})]})]})]})]})}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col sm:flex-row min-h-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"flex-1 min-h-0 relative flex flex-col",children:[!ty&&!(eM&&0===ek.length)&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 bg-card pointer-events-none flex flex-col overflow-hidden",children:(0,t.jsx)(v.MessageListSkeleton,{alignTop:!0})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden",ref:te,onScroll:tw,"data-gmail-thread-scroll":!0,style:{overflowAnchor:"none"},children:eM&&0===ek.length?(0,t.jsx)(v.MessageListSkeleton,{alignTop:!0}):(0,t.jsxs)("div",{ref:tt,className:`${a.THREAD_GUTTER_X} py-4 sm:py-6`,children:[(ek.length>1||tT)&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-4",children:[ek.length>1&&(0,t.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[ek.length," messages in this thread"]}),tT&&(0,t.jsxs)("a",{href:tT,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground border rounded-full px-2.5 py-0.5 hover:bg-muted transition-colors",children:[(0,t.jsx)(o.BellOff,{className:"h-3 w-3"}),"Unsubscribe"]})]}),(0,t.jsx)("div",{className:"space-y-1",children:(e8.trim()?tb:tk).map((e,a,r)=>{let s=r[a-1],i=e8.trim()?void 0:tE.get(String(e.id)),l=!!s&&!!e.internal_date&&!!s.internal_date&&new Date(e.internal_date).toDateString()!==new Date(s.internal_date).toDateString(),o=tk.indexOf(e),c="string"==typeof e.id&&e.id.startsWith("opt-sent-")&&!e2.has(e.id);return(0,t.jsxs)(n.Fragment,{children:[i&&i.length>0&&(0,t.jsxs)("div",{className:"mb-3 pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-border/50"}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground italic",children:"Earlier in this thread"}),(0,t.jsx)("div",{className:"flex-1 h-px bg-border/50"})]}),(0,t.jsx)("div",{className:"rounded-xl bg-muted/30 border border-border/40 px-3 py-2.5",children:(0,t.jsx)(j.QuotedThreadChat,{msgs:i,accountEmail:eA})})]}),l&&e.internal_date&&(0,t.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-border/50"}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground font-medium",children:function(e){let t=new Date(e),n=new Date;if(t.toDateString()===n.toDateString())return"Today";let a=new Date(n);return(a.setDate(a.getDate()-1),t.toDateString()===a.toDateString())?"Yesterday":t.toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:t.getFullYear()!==n.getFullYear()?"numeric":void 0})}(e.internal_date)}),(0,t.jsx)("div",{className:"flex-1 h-px bg-border/50"})]}),(0,t.jsx)("div",{"data-thread-message":!0,className:`transition-opacity duration-500 ${c?"opacity-60":"opacity-100"}`,children:(0,t.jsx)(j.GmailMessageCard,{message:e,accountEmail:eA,avatarUrl:e.from_email?eC[e.from_email.toLowerCase()]:void 0,contactId:e.from_email?eE[e.from_email.toLowerCase()]:void 0,isSubConversation:tN[o]?.isSubConvo,subConvoLabel:tN[o]?.label,learnedSignature:e.from_email?tC.get(e.from_email.toLowerCase()):void 0,userSignature:e3,onReplyClick:e.is_draft?void 0:tM,onForwardClick:e.is_draft?void 0:tI,isDraft:!!e.is_draft,onDeleteDraft:e.is_draft&&e.draft_id?tD:void 0,onEditDraft:e.is_draft&&e.draft_id?tq:void 0,trackingStats:e.message_id?tS[e.message_id]:void 0,senderColorIndex:e.from_email?t_.get(e.from_email.toLowerCase())??0:0,threadAlreadyDisplayed:a>0||tE.has(String(e.id)),searchQuery:e8.trim()||void 0})})]},e.id)})}),(0,t.jsx)("div",{ref:tn})]})})]}),(0,t.jsx)("div",{className:"shrink-0 border-t bg-card","data-gmail-reply-area":!0,children:(0,t.jsx)(q.FollowUpProvider,{channel:"email",conversationRef:b,contactId:eR,emailProvider:"/api/outlook"===ex?"outlook":"gmail",children:ew?(0,t.jsx)(eo,{thread:ew,messages:ek,accountEmail:eA,participantImages:eC,mailApiBase:ex,onSent:e=>{tP(),tU(),th({background:!0}),ee?.(),e?.snippet&&en?.(b,e)},onOptimisticSent:tL,onSentRevert:tA,onSentConfirmed:tR,replyToMessage:eU,onClearReplyTo:tP,editingDraft:eF,onClearEditingDraft:t$}):(0,t.jsx)(ei,{})})})]}),eq&&(0,t.jsx)("div",{className:"sm:w-64 sm:border-l border-t sm:border-t-0 overflow-y-auto shrink-0 max-h-[40vh] sm:max-h-none",children:(0,t.jsx)(A,{threadId:b})})]}),eO&&(0,t.jsx)(Q.GmailCompose,{open:!!eO,onOpenChange:e=>{e||eB(null)},forwardMessages:eO,accountEmail:eA,sendAccountId:ew?.gmail_account_id??void 0,mailApiBase:ex,onSent:()=>{eB(null),ee?.()}})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Thread not found"})},"preloadThread",0,ed],747250)},459648,e=>{"use strict";var t=e.i(843476),n=e.i(901230);e.s(["AddPersonIcon",0,function(e){return(0,t.jsx)(n.BadgedPerson,{...e,badge:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("line",{x1:n.BADGE.cx,y1:n.BADGE.cy-n.BADGE.half,x2:n.BADGE.cx,y2:n.BADGE.cy+n.BADGE.half}),(0,t.jsx)("line",{x1:n.BADGE.cx-n.BADGE.half,y1:n.BADGE.cy,x2:n.BADGE.cx+n.BADGE.half,y2:n.BADGE.cy})]})})}])},903336,e=>{"use strict";var t=e.i(843476),n=e.i(271645);let a=e=>e<0?0:e>1?1:e,r=Math.PI/2;function s(e){let t=Math.min(1,e/.8),n=a((e-.8)/.19999999999999996),s=r*t,i=.9*Math.sin(Math.PI*t),l=.18*Math.sin(Math.PI*t*.85),o=-50*n*n,c=8*Math.cos(l),d=8*Math.sin(l),u=(e,t)=>
1{let n=52/(52-((i<1e-4?e*Math.sin(s):16.2/i*(Math.cos(s)-Math.cos(s+i*e/16.2)))+o+t*d));return[12+t*c*n,12+((i<1e-4?4.9+e*Math.cos(s):4.9+16.2/i*(Math.sin(s+i*e/16.2)-Math.sin(s)))-12)*n]},m=e=>`${e[0].toFixed(2)} ${e[1].toFixed(2)}`,h=(e,t)=>{let n=[],a=[];for(let r=0;r<=12;r++){let s=e+(t-e)*r/12;n.push(u(s,-1)),a.push(u(s,1))}let r=[...n,...a].map(e=>e[1]);return{d:`M${n.map(m).join("L")}L${a.reverse().map(m).join("L")}Z`,lo:Math.max(...r),hi:Math.min(...r),nearLeft:n[n.length-1],nearRight:a[0]}},p=h(0,5.1),f=h(5.1,16.2),x=Math.max(p.lo,f.lo),g=Math.min(p.hi,f.hi),v=a((21.1-f.lo)/3.4),y=1.1+2.2*v,w=e=>`${e[0].toFixed(2)} ${(e[1]+y).toFixed(2)}`;return{path:f.d,band:p.d,rule:`M${m(u(5.1,-1))}L${m(u(5.1,1))}`,shade:`${p.d} ${f.d}`,cast:`M${m(f.nearLeft)}L${m(f.nearRight)}L${w(f.nearRight)}L${w(f.nearLeft)}Z`,lift:v,curl:Math.sin(Math.PI*t),onPad:n>0?0:a((f.lo-4.9)/2.6),pageThin:f.lo-f.hi,bandThin:p.lo-p.hi,overTop:(g+x)/2<4.9,behind:n>0}}let i=s(0),l=[[0,.04],[.4,.2],[.63,.05],[.86,.46],[1,.3]];function o({day:e,flip:r=!1,...c}){var d;let[u,m]=(0,n.useState)(null),h=(0,n.useRef)(null),p=`cal-shade-${(0,n.useId)().replace(/:/g,"")}`;(0,n.useEffect)(()=>{void 0===e&&m(new Date().getDate())},[e]);let f=void 0===e?u:e;return d=r&&null!==f,(0,n.useEffect)(()=>{if(!d)return;let e=h.current,t=e?.closest(".sq-tile");if(!e||!t||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=e.querySelector(".cal-cover-sheet"),r=e.querySelector(".cal-cover-band"),i=e.querySelector(".cal-cover-rule"),l=e.querySelector(".cal-cover-shade"),o=e.querySelector(".cal-cover-cast"),c=e.querySelector(".cal-cover-num"),u=e.querySelector(".cal-cover-gate");if(!n||!r||!i||!l||!o||!c||!u)return;let m=0,p=0,f=0,x=0,g=()=>{c.style.opacity=String(1-a(m/.18));let e=function(e){let t=(e,t,n)=>{let a=1-n;return 3*a*a*n*e+3*a*n*n*t+n*n*n};if(e<=0)return 0;if(e>=1)return 1;let n=0,a=1;for(let r=0;r<20;r++){let r=(n+a)/2;t(.35,.75,r)<e?n=r:a=r}return t(.1,.7,(n+a)/2)}(a((m-.18)/.8200000000000001)),t=s(e);n.setAttribute("d",t.path),r.setAttribute("d",t.band),i.setAttribute("d",t.rule),l.setAttribute("d",t.shade),o.setAttribute("d",t.cast),u.setAttribute("height",String(t.behind?12.9:32));let d=Math.min(1,9*e),h=e=>String(d*Math.max(.25,a(e/2.4)));n.style.strokeOpacity=h(t.pageThin),r.style.strokeOpacity=h(t.bandThin),l.style.opacity=String(d*(.42+.58*t.curl)),o.style.opacity=String(t.lift*t.onPad);let p=t.overTop?l.dataset.shadeOver:l.dataset.shade;p&&l.getAttribute("fill")!==p&&l.setAttribute("fill",p)},v=e=>{let t=x?e-x:16;x=e;let n=t/(p>m?760:560);m=p>m?Math.min(p,m+n):Math.max(p,m-n),g(),f=m===p?0:requestAnimationFrame(v)},y=e=>{p=e,f||m===p||(x=0,f=requestAnimationFrame(v))},w=()=>{t.closest(".app-card-anchor")?.hasAttribute("data-suppress-hover")||y(1)},j=()=>
1{if(m>=1){cancelAnimationFrame(f),f=0,m=0,p=0,g();return}y(0)};return t.addEventListener("mouseenter",w),t.addEventListener("mouseleave",j),()=>{t.removeEventListener("mouseenter",w),t.removeEventListener("mouseleave",j),cancelAnimationFrame(f)}},[h,d]),(0,t.jsxs)("svg",{ref:h,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...c,children:[(0,t.jsx)("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",fill:"var(--sq-page, none)",stroke:"none"}),(0,t.jsx)("path",{d:"M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v4H3z",fill:"var(--sq-clay, none)",stroke:"none"}),(0,t.jsx)("path",{d:"M3 10h18"}),null!==f&&!r&&(0,t.jsx)("text",{x:"12",y:"16.5",textAnchor:"middle",dominantBaseline:"central",stroke:"none",fill:"var(--sq-ink, currentColor)",fontSize:"8.5",fontWeight:"600",children:f}),null!==f&&r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("defs",{children:[(0,t.jsx)("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:l.map(([e,n])=>(0,t.jsx)("stop",{offset:e,stopColor:"#000",stopOpacity:n},e))}),(0,t.jsxs)("linearGradient",{id:`${p}-cast`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0",stopColor:"#000",stopOpacity:.34}),(0,t.jsx)("stop",{offset:"0.55",stopColor:"#000",stopOpacity:.12}),(0,t.jsx)("stop",{offset:"1",stopColor:"#000",stopOpacity:0})]}),(0,t.jsx)("linearGradient",{id:`${p}-over`,x1:"0",y1:"1",x2:"0",y2:"0",children:l.map(([e,n])=>(0,t.jsx)("stop",{offset:e,stopColor:"#000",stopOpacity:n},e))}),(0,t.jsx)("clipPath",{id:`${p}-gate`,children:(0,t.jsx)("rect",{className:"cal-cover-gate",x:"-4",y:-8,width:"32",height:"32"})})]}),(0,t.jsx)("text",{className:"cal-page-num",x:"12",y:"16.5",textAnchor:"middle",dominantBaseline:"central",stroke:"none",fill:"var(--sq-ink, currentColor)",fontSize:"8.5",fontWeight:"600",children:f}),(0,t.jsx)("path",{className:"cal-cover-cast",d:i.cast,fill:`url(#${p}-cast)`,stroke:"none",opacity:0}),(0,t.jsxs)("g",{className:"cal-cover",clipPath:`url(#${p}-gate)`,children:[(0,t.jsx)("path",{className:"cal-cover-sheet",d:i.path,fill:"var(--sq-page, none)",stroke:"currentColor",strokeWidth:1.35,strokeOpacity:0,strokeLinejoin:"round"}),(0,t.jsx)("path",{className:"cal-cover-band",d:i.band,fill:"var(--sq-clay, none)",stroke:"currentColor",strokeWidth:1.35,strokeOpacity:0,strokeLinejoin:"round"}),(0,t.jsx)("path",{className:"cal-cover-rule",d:i.rule,fill:"none"}),(0,t.jsx)("text",{className:"cal-cover-num",x:"12",y:"16.5",textAnchor:"middle",dominantBaseline:"central",stroke:"none",fill:"var(--sq-ink, currentColor)",fontSize:"8.5",fontWeight:"600",children:f}),(0,t.jsx)("path",{className:"cal-cover-shade",d:i.shade,fill:`url(#${p})`,"data-shade":`url(#${p})`,"data-shade-over":`url(#${p}-over)`,stroke:"none",opacity:0})]})]}),(0,t.jsx)("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),(0,t.jsx)("path",{d:"M8 2v4"}),(0,t.jsx)("path",{d:"M16 2v4"})]})}e.s(["CalendarDateIcon",0,o,"CalendarNavIcon",0,function(e){return(0,t.jsx)(o,{flip:!0,...e})}])},20504,e=>{"use strict";var t=e.i(843476);e.s(["GoogleMeetIcon",0,function(e){return(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -22.5 256 256",preserveAspectRatio:"xMidYMid",...e,children:(0,t.jsxs)("g",{children:[(0,t.jsx)("polygon",{fill:"#00832D",points:"144.822496 105.321856 169.778926 133.848796 203.341343 155.294133 209.178931 105.50196 203.341343 56.8331137 169.136495 75.6715889"}),(0,t.jsx)("path",{d:"M0.000557021739,150.659712 L0.000557021739,193.089915 C0.000557021739,202.77838 7.86384724,210.643527 17.5541688,210.643527 L59.9843714,210.643527 L68.7704609,178.585069 L59.9843714,150.659712 L30.8744153,141.873623 L0.000557021739,150.659712 Z",fill:"#0066DA"}),(0,t.jsx)("polygon",{fill:"#E94235",points:"59.9838143 9.9475983e-14 0 59.9838143 30.875715 68.7494798 59.9838143 59.9838143 68.6102243 32.4390893"}),(0,t.jsx)("polygon",{fill:"#2684FC",points:"0.000557021739 150.679394 59.9843714 150.679394 59.9843714 59.9832573 0.000557021739 59.9832573"}),(0,t.jsx)("path",{d:"M241.658683,25.3977775 L203.341157,56.8342278 L203.341157,155.29339 L241.818362,186.852385 C247.577967,191.364261 256.003849,187.251584 256.003849,179.930462 L256.003849,32.1785888 C256.003849,24.7757699 247.377439,20.6835169 241.658683,25.3977775",fill:"#00AC47"}),(0,t.jsx)("path",{d:"M144.822496,105.321856 L144.822496,150.659712 L59.9843714,150.659712 L59.9843714,210.643527 L185.787731,210.643527 C195.478053,210.643527 203.341343,202.77838 203.341343,193.089915 L203.341343,155.294133 L144.822496,105.321856 Z",fill:"#00AC47"}),(0,t.jsx)("path",{d:"M185.787731,0 L59.9843714,0 L59.9843714,59.9838143 L144.822496,59.9838143 L144.822496,105.32167 L203.341343,56.832928 L203.341343,17.5536117 C203.341343,7.86329022 195.478053,0 185.787731,0",fill:"#FFBA00"})]})})}])},901230,e=>{"use strict";var t=e.i(843476),n=e.i(773993);e.s(["BADGE",0,{cx:19.4,cy:8.8,half:2.9},"BadgedPerson",0,function({badge:e,...a}){return(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...a,children:[(0,t.jsxs)("g",{transform:"translate(-1.4 1.9) scale(0.8)",strokeWidth:2.5,children:[(0,t.jsx)("path",{d:n.HEAD,fill:"var(--sq-plane-skin, none)"}),n.SHOULDERS.map(e=>(0,t.jsx)("path",{d:e},e))]}),e]})}])},400236,e=>{"use strict";var t=e.i(843476),n=e.i(901230);e.s(["RemovePersonIcon",0,function(e){return(0,t.jsx)(n.BadgedPerson,{...e,badge:(0,t.jsx)("line",{x1:n.BADGE.cx-n.BADGE.half,y1:n.BADGE.cy,x2:n.BADGE.cx+n.BADGE.half,y2:n.BADGE.cy})})}])},300566,e=>{"use strict";var t=e.i(843476);e.s(["SendMailIcon",0,function(e){return(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"var(--sq-plane-sky, currentColor)",...e,children:(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4685918,3.4486694c-.276062-.4232178-.7411499-.6759033-1.2441406-.6759033-.1889648,0-.3743896.0357056-.5512085.1061401L3.0777837,7.8930664c-.40271.1603394-.6936035.5178223-.7687378.9447021s.0762329.8622437.4000244,1.1503906l2.4732056,2.2012329v4.2337646c0,.6617432.793457,1.0004272,1.2713013.5426636l1.9723511-1.8895264,2.0613403,1.8346558c.2311401.2056885.52771.3162842.8310547.3162842.088501,0,.1775513-.0094604.2657471-.0286255.390625-.0849609.71698-.3516235.8781738-.7174683l5.12
107275-11.6225586c.2032471-.4614868.1604614-.9884644-.1143799-1.4099121ZM16.4390508,4.3546143l-5.1207275,11.6225586-3.963623-3.52771,5.2460327-5.0794067c.064209-.065918.0716553-.168457.0177002-.243042-.0568237-.0785522-.1638184-.1014404-.2478638-.0530396l-6.562439,3.9990234-2.2680054-2.0185547,12.5956421-5.0142822c.0299683-.0119019.0598755-.017395.0886841-.017395.15979,0,.2867432.1680908.2145996.3318481Z"})})}])},786223,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(373375),r=e.i(16715),s=e.i(555436),i=e.i(37727),l=e.i(572377),o=e.i(167881),c=e.i(728231),d=e.i(63270),u=e.i(922083),m=e.i(213788),h=e.i(399513),p=e.i(488854),f=e.i(245092),x=e.i(521338),g=e.i(194976),v=e.i(920755),y=e.i(196587),w=e.i(414318),j=e.i(957639),k=e.i(25394),b=e.i(109688),_=e.i(797873),N=e.i(875527),C=e.i(862594),S=e.i(747250),E=e.i(534344);e.i(90267);var T=e.i(268252),M=e.i(250566),I=e.i(695064);function P({postUrn:e,contactId:a,contactName:r}){let[s,i]=(0,n.useState)(null),[l,o]=(0,n.useState)(!!a),[c,d]=(0,n.useState)(!1),u=(0,n.useCallback)(async()=>{if(!a)return;let t=new URLSearchParams({contactIds:a,postUrn:e});try{let e=await fetch(`/api/linkedin/comment-feed?${t.toString()}`),n=await e.json();i((n.entries||[])[0]??null)}catch(e){console.error("[lc-thread] load error:",e)}finally{o(!1)}},[a,e]);(0,n.useEffect)(()=>{u()},[u]),(0,n.useEffect)(()=>{s&&fetch("/api/linkedin/comment-thread",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({postUrn:e})}).catch(()=>{})},[s,e]);let m=(0,n.useRef)(null),h=(0,n.useRef)(u);return((0,n.useEffect)(()=>{h.current=u},[u]),(0,n.useEffect)(()=>{a&&m.current!==a&&(m.current=a,d(!0),(0,I.syncContactSharedComments)(a).then(()=>{m.current===a&&h.current()}).catch(e=>console.error("[lc-thread] sync error:",e)).finally(()=>{m.current===a&&d(!1)}))},[a]),(l||c)&&!s)?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto p-3",children:(0,t.jsxs)("div",{className:"rounded-[20px] border border-card-border bg-[#FAF9F5] dark:bg-background p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"h-12 w-12 squircle bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,t.jsx)("div",{className:"h-3 w-1/3 bg-muted rounded animate-pulse"}),(0,t.jsx)("div",{className:"h-3 w-1/4 bg-muted rounded animate-pulse"})]})]}),(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("div",{className:"h-3 w-full bg-muted rounded animate-pulse"}),(0,t.jsx)("div",{className:"h-3 w-5/6 bg-muted rounded animate-pulse"})]})]})}):s?(0,t.jsx)("div",{className:"flex flex-col flex-1 min-h-0",children:(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-3",children:(0,t.jsx)(T.RecordKnownProvider,{children:(0,t.jsx)(M.LinkedInInteractionCard,{entry:s,fallbackName:r||"this person"})})})}):(0,t.jsx)("div",{className:"flex flex-col items-center justify-center flex-1 gap-3 text-muted-foreground py-20 text-sm",children:(0,t.jsx)("p",{children:"Post not cached yet."})})}var L=e.i(182352),A=e.i(723987),R=e.i(327147),q=e.i(48589),$=e.i(770703),U=e.i(459648),D=e.i(158061),F=e.i(145319);function z(){return(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsx)(D.MessageListSkeleton,{}),(0,t.jsx)("div",{className:"border-t shrink-0 bg-card",children:(0,t.jsx)(F.ComposerShell,{placeholder:"Message..."})})]})}let O=(0,$.default)(()=>e.A(103025).then(e=>e.MessagesThreadPanel),{loadableGenerated:{modules:[642723]},ssr:!1,loading:z}),B=(0,$.default)(()=>e.A(788733).then(e=>e.WhatsAppChatPanel),{loadableGenerated:{modules:[68526]},ssr:!1,loading:z}),H=(0,$.default)(()=>e.A(741715).then(e=>e.SmsChatPanel),{loadableGenerated:{modules:[599598]},ssr:!1,loading:z}),G=(0,$.default)(()=>e.A(189734).then(e=>e.IMessageChatPanel),{loadableGenerated:{modules:[13016]},ssr:!1,loading:z}),W=(0,$.default)(()=>e.A(147487).then(e=>e.SlackChatPanel),{loadableGenerated:{modules:[898091]},ssr:!1,loading:z}),X=(0,$.default)(()=>e.A(210376).then(e=>e.ChatPanel),{loadableGenerated:{modules:[447869]},ssr:!1,loading:z}),Y=(0,$.default)(()=>e.A(329547).then(e=>
1e.ChatChatPanel),{loadableGenerated:{modules:[243083]},ssr:!1,loading:z}),V=(0,$.default)(()=>e.A(21039).then(e=>e.XChatPanel),{loadableGenerated:{modules:[48191]},ssr:!1,loading:z}),J=(0,$.default)(()=>e.A(3587).then(e=>e.XEntityChatPanel),{loadableGenerated:{modules:[654442]},ssr:!1,loading:z}),K=(0,$.default)(()=>e.A(238961).then(e=>e.RedditChatPanel),{loadableGenerated:{modules:[697505]},ssr:!1,loading:z}),Z=(0,$.default)(()=>e.A(189620).then(e=>e.RedditEntityChatPanel),{loadableGenerated:{modules:[361343]},ssr:!1,loading:z});e.A(169964),e.A(906059),e.s(["ConversationPanel",0,function({contactId:T,contactName:M,contactImageUrl:I,companyName:$,companyDomain:D,companyLogoUrl:F,channel:z,sourceChannel:Q,conversationRef:ee,workspaceId:et,accountEmail:en,onBack:ea,isModal:er,onPrev:es,onNext:ei,canGoPrev:el=!1,canGoNext:eo=!1,hideSidebar:ec=!1,hideHeader:ed=!1,flush:eu=!1,skipMarkRead:em=!1,isFrontCard:eh,autoFocusComposer:ep,onMoveToLabel:ef,emailProvider:ex,onContactLinked:eg}){let ev="outlook"===ex?"/api/outlook":"/api/gmail";(0,n.useEffect)(()=>{if(ee)return(0,b.setActiveConversation)(ee),()=>(0,b.clearActiveConversation)(ee)},[ee]);let[ey,ew]=(0,n.useState)(null),[ej,ek]=(0,n.useState)(!1),eb=T??ey,[e_,eN]=(0,n.useState)(void 0),[eC,eS]=(0,n.useState)(!1),[eE,eT]=(0,n.use
1State)(null),[eM,eI]=(0,n.useState)(null),[eP,eL]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if("slack"!==z||!ee)return void eL(!1);let e=!1;return(0,v.createClient)().from("slack_conversations").select("conversation_type").eq("id",ee).maybeSingle().then(({data:t})=>{e||eL(!!t&&"dm"!==t.conversation_type)}),()=>{e=!0}},[z,ee]);let eA=(0,p.useSlackGroupCompanies)(eP?et:null,eP?[ee]:[]),eR="slack"===z&&eP?(0,h.slackAvatarMarks)({company_name:$,company_logo_url:F,company_domain:D},eA[ee])??[]:[],[eq,e$]=(0,n.useState)(null),[eU,eD]=(0,n.useState)("inline"),[eF,ez]=(0,n.useState)(""),[eO,eB]=(0,n.useState)(0),[eH,eG]=(0,n.useState)(!1),[eW,eX]=(0,n.useState)(!1),[eY,eV]=(0,n.useState)(""),eJ=(0,n.useRef)(null),[eK,eZ]=(0,n.useState)(null);(0,n.useEffect)(()=>{eX(!1),eV(""),ez(""),ew(null),eZ(null)},[ee]);let eQ=(0,n.useCallback)(()=>{eb&&(0,v.createClient)().from("contacts").select("linkedin_urn, job_title, image_url, nickname, first_name, company:companies!contacts_company_id_fkey(name, domain, logo_url)").eq("id",eb).single().then(({data:e})=>{e?.linkedin_urn&&eN(e.linkedin_urn),e?.job_title&&eT(e.job_title),eZ((0,q.preferredFirstName)({nickname:e?.nickname,firstName:e?.first_name})||null),e$(e?.image_url??null);let t=e?.company;eI(t?{name:t.name,domain:t.domain,logoUrl:t.logo_url}:null),eS(!0)})},[eb]);(0,n.useEffect)(()=>{eb?(eS(!1),eQ()):eI(null)},[eb,eQ]),(0,n.useEffect)(()=>{if(eb)return(0,j.onBusEvent)("entity",()=>eQ())},[eb,eQ]);let e0=(0,k.useLinkedInParticipantUrns)((0,n.useMemo)(()=>"linkedin"===z&&ee?[ee]:[],[z,ee])),e1=ee?e0[ee]??null:null,e2=(0,k.useLinkedInPresence)("linkedin"===z?e_??e1:null),e5=e2?(0,u.presenceNotch)({size:32}):void 0,e3=e2?(0,t.jsx)(u.PresenceDot,{online:"online"===e2,size:32}):null,e4=I??eq,e6=eM?.name??$??null,e7=eM?.domain??D??null,e8=eM?.logoUrl??F??null;(0,n.useEffect)(()=>{"email"===z||"linkedin_comments"===z||!ee||em||((0,w.dispatchConversationRead)({channel:z,conversationId:ee}),fetch("/api/inbox/mark-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:"messages"===z?Q??"imessage":z,conversationId:ee,is_read:!0})}).then(()=>(0,w.scheduleInboxRefresh)()).catch(()=>{}))},[z,Q,ee,em]),(0,n.useEffect)(()=>{if("linkedin"!==z||!ee)return;let t=!1,n=setTimeout(async()=>{let n=(0,v.createClient)(),a=null;if(eb){let{data:e}=await n.from("contacts").select("linkedin_urn").eq("id",eb).single();a=e?.linkedin_urn??null}if(!a){let{data:e}=await n.from("linkedin_conversations").select("participant_linkedin_urn").eq("id",ee).single();a=e?.participant_linkedin_urn??null}if(!a||t)return;let{data:r}=await n.from("linkedin_profiles").select("cached_at, headline").eq("linkedin_urn",a).maybeSingle(),s=r?.cached_at,i=r?.headline;if(!(!s||!i||Date.now()-new Date(s).getTime()>6048e5)||t)return;let{cacheLinkedInProfileByUrn:l}=await e.A(19801);l(a)},1500);return()=>{t=!0,clearTimeout(n)}},[z,ee,eb]),(0,n.useEffect)(()=>{if(!es&&!ei)return;let e=e=>{let t=e.target,n=t?.tagName;if("INPUT"===n||"TEXTAREA"===n){if(t.value)return}else if(t?.isContentEditable&&t.textContent)return;"ArrowUp"===e.key&&el?(e.preventDefault(),es?.()):"ArrowDown"===e.key&&eo&&(e.preventDefault(),ei?.())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[es,ei,el,eo]);let e9=eK||M?.split(" ")[0]||M||"Unknown",te=(M||"?").split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),tt=eR.length>0?(0,t.jsx)(h.CompanyLogoStack,{companies:eR,size:32}):(0,t.jsxs)(d.Avatar,{className:"h-8 w-8 hover:ring-2 hover:ring-primary/30 transition-shadow cursor-pointer",style:e5,children:[e4&&(0,t.jsx)(d.AvatarImage,{src:e4}),(0,t.jsx)(d.AvatarFallback,{className:"text-[10px] bg-foreground
1/8 text-foreground/60 font-medium",children:te})]});async function tn(){if(!ej&&ee){ek(!0);try{let e=await (0,y.addLinkedInParticipantContact)(ee);e&&(ew(e.contactId),eg?.(e))}finally{ek(!1)}}}let ta="linkedin"!==z||eb?null:(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",className:"rounded-full h-7 px-2.5 gap-1.5 text-xs shrink-0",disabled:ej,onClick:tn,children:[ej?(0,t.jsx)(R.ButtonSpinner,{}):(0,t.jsx)(U.AddPersonIcon,{className:"h-3.5 w-3.5"}),(0,t.jsx)(R.ShimmerLabel,{active:ej,children:"Add"})]})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Add to Everything"})]}),tr="linkedin"===z?(0,t.jsx)(l.LinkedInSquircle,{className:"h-5 w-5"}):"linkedin_comments"===z?(0,t.jsx)(l.LinkedInCommentsSquircle,{className:"h-5 w-5"}):"email"===z?(0,t.jsx)(l.MailProviderSquircle,{provider:ex??void 0,className:"h-5 w-5"}):"whatsapp"===z?(0,t.jsx)(l.WhatsAppSquircle,{className:"h-5 w-5"}):"sms"===z?(0,t.jsx)(l.SmsSquircle,{className:"h-5 w-5"}):"imessage"===z||"messages"===z?(0,t.jsx)(l.IMessageSquircle,{className:"h-5 w-5"}):"slack"===z?(0,t.jsx)(l.SlackSquircle,{className:"h-5 w-5"}):"chat"===z?(0,t.jsx)(l.ChatSquircle,{className:"h-5 w-5"}):"x"===z?(0,t.jsx)(l.XSquircle,{className:"h-5 w-5"}):"reddit"===z?(0,t.jsx)(l.RedditSquircle,{className:"h-5 w-5"}):null,ts={linkedin:"LinkedIn",linkedin_comments:"LinkedIn Comments",email:"Email",whatsapp:"WhatsApp",sms:"SMS",imessage:"iMessage",messages:E.MESSAGES_CHANNEL_LABEL,slack:"Slack",chat:"Chat",x:"X",reddit:"Reddit"},ti=ep??(!er&&!em&&!ed),tl="messages"===z?Q??"imessage":z,to="email"===z?(0,t.jsx)(S.GmailThreadView,{threadId:ee,accountEmail:en,mailApiBase:ev,onBack:ea,isModal:er||ed,hideClose:er||ed,onPrev:el?es:void 0,onNext:eo?ei:void 0,canGoPrev:el,canGoNext:eo,isFrontCard:eh,onMoveToLabel:ef,...er?{externalSearch:eY,onExternalSearchChange:eV}:{}},ee):(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:["whatsapp"===z&&(eb||ee)&&(0,t.jsx)(B,{contactId:eb||"",contactName:e9,workspaceId:et,hideHeader:!0,externalSearchQuery:eF,autoFocusComposer:ti,directConversationId:ee||void 0,preferOpenMostRecentDirectThread:!!eb,onBack:er?ea:void 0}),"sms"===z&&eb&&(0,t.jsx)(H,{contactId:eb,contactName:e9,workspaceId:et,hideHeader:!0,externalSearchQuery:eF,autoFocusComposer:ti}),"imessage"===z&&ee&&(0,t.jsx)(G,{conversationId:ee,contactName:e9,contactId:eb,hideHeader:!0,externalSearchQuery:eF,autoFocusComposer:ti}),"messages"===z&&(eb||ee)&&(0,t.jsx)(O,{contactId:eb,contactName:e9,conversationId:ee||null,channel:Q??null,hideHeader:!0,externalSearchQuery:eF,autoFocusComposer:ti,onBack:er?ea:void 0}),"slack"===z&&(eb||ee)&&(0,t.jsx)(W,{contactId:eb||"",contactName:e9,workspaceId:et,hideHeader:!0,externalSearchQuery:eF,directConversationId:ee||void 0,preferOpenMostRecentDirectThread:!1,autoFocusComposer:ti,onBack:er?ea:void 0}),"linkedin"===z&&(eb||ee)&&(0,t.jsx)(X,{contactId:eb||"",contactName:e9,profileUrn:e_,workspaceId:et,embedded:!0,hideHeader:!0,externalSearchQuery:eF,directConversationId:ee,autoFocusComposer:ti}),"linkedin_comments"===z&&ee&&(0,t.jsx)(P,{postUrn:ee,contactId:eb,contactName:M,contactImageUrl:e4,workspaceId:et}),"chat"===z&&ee&&(0,t.jsx)(Y,{directConversationId:ee,workspaceId:et,contactName:e9,hideHeader:!0,embeddedInPanel:!0,autoFocusComposer:ti}),"x"===z&&ee&&(0,t.jsx)(V,{conversationId:ee,hideHeader:!0,externalSearchQuery:eF,contactName:M,contactImageUrl:e4,autoFocusComposer:ti}),"x"===z&&!ee&&eb&&(0,t.jsx)(J,{contactId:eb,contactName:M,contactImageUrl:e4,workspaceId:et,hideHeader:!0,autoFocusComposer:ti}),"reddit"===z&&ee&&(0,t.jsx)(K,{conversationId:ee,hideHeader:!0,externalSearchQuery:eF,contactName:M,contactImageUrl:e4,autoFocusComposer:ti}),"reddit"===z&&!ee&&eb&&(0,t.jsx)(Z,{contactId:eb,contactName:M,contactImageUrl:e4,hideHeader:!0,autoFocusComposer:ti})]},`${z}-${ee}-${eO}`),tc=(0,t.jsx)(N.FollowUpProvider,{channel:tl,conversationRef:ee,contactId:eb??null,emailProvider:"email"===z?ex??"gmail":null,children:to}),td=(0,t.jsxs)("div",{className:"lg:hidden flex items-center gap-2.5 px-3 py-2.5 border-b shrink-0",children:[(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0 shrink-0",onClick:ea,children:(0,t.jsx)(a.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsxs)("a",{href:eb?`/people/${eb}`:"#",className:"relative shrink-0",children:[tt,e3]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate leading-tight",children:M||"Unknown"}),(eE||e6)&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground truncate leading-tight",children:[(0,t.jsx)("span",{className:"truncate",children:eE&&e6?`${eE} at ${e6}`:eE||e6}),e6&&(e7||e8)&&(0,t.jsx)(m.CompanyLogo,{domain:e7,logoUrl:e8,companyName:e6||void 0,size:"xs",className:"!h-3.5 !w-3.5 shrink-0"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[ta,(0,t.jsx)(A.ChatHeaderSlot,{}),(0,t.jsx)(C.ConversationQuickActions,{contactId:eb??null}),(0,t.jsx)(x.ConversationStarButton,{channel:z,conversationRef:ee}),"email"!==z&&(0,t.jsx)(f.MessageSearchPill,{value:eF,onChange:ez}),"email"!==z&&(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>{eG(!0),eB(e=>e+1),setTimeout(()=>eG(!1),2e3)},children:eH?(0,t.jsx)(R.ButtonSpinner,{}):(0,t.jsx)(r.RefreshCw,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Refresh"})]}),(0,t.jsx)(g.ChatExpandButtons,{expansion:eU,onChange:eD})]})]}),tu=(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 border-b shrink-0",children:[(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0 shrink-0",onClick:ea,children:(0,t.jsx)(a.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[tr,(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:ts[z]??"Messages"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-auto",children:[ta,(0,t.jsx)(A.ChatHeaderSlot,{}),(0,t.jsx)(C.ConversationQuickActions,{contactId:eb??null}),"chat"===z&&ee&&(0,t.jsx)("div",{className:"flex items-center gap-1.5 mr-1 min-w-0 overflow-hidden",children:(0,t.jsx)(L.ThreadMetaBar,{conversationId:ee,channel:"chat",className:"flex items-center gap-1.5",showStatusOnMobile:!0})}),(0,t.jsx)(x.ConversationStarButton,{channel:z,conversationRef:ee}),"email"!==z&&(0,t.jsx)(f.MessageSearchPill,{value:eF,onChange:ez}),"email"!==z&&(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>{eG(!0),eB(e=>e+1),setTimeout(()=>eG(!1),2e3)},children:eH?(0,t.jsx)(R.ButtonSpinner,{}):(0,t.jsx)(r.RefreshCw,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Refresh"})]}),(0,t.jsx)(g.ChatExpandButtons,{expansion:eU,onChange:eD})]})]});return"inline"!==eU?(0,t.jsx)(g.ChatExpandedSurface,{expansion:eU,title:M||"Conversation",onCollapse:()=>eD("inline"),children:(0,t.jsx)(A.ChatHeaderSlotProvider,{children:(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b shrink-0",children:[(0,t.jsxs)("a",{href:eb?`/people/${eb}`:"#",className:"relative shrink-0",children:[tt,e3]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("a",{href:eb?`/people/${eb}`:"#",className:"hover:underline",children:(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:M||"Unknown"})}),(eE||e6)&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground truncate",children:[(0,t.jsx)("span",{className:"truncate",children:eE&&e6?`${eE} at ${e6}`:eE||e6}),e6&&(e7||e8)&&(0,t.jsx)(m.CompanyLogo,{domain:e7,logoUrl:e8,companyName:e6||void 0,size:"xs",className:"!h-3.5 !w-3.5 shrink-0"})]})]}),ta,(0,t.jsx)(A.ChatHeaderSlot,{}),(0,t.jsx)(C.ConversationQuickActions,{contactId:eb??null}),"email"!==z&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.MessageSearchPill,{value:eF,onChange:ez}),(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>{eG(!0),eB(e=>e+1),setTimeout(()=>eG(!1),2e3)},children:eH?(0,t.jsx)(R.ButtonSpinner,{}):(0,t.jsx)(r.RefreshCw,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Refresh"})]})]}),(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>eD("inline"),children:(0,t.jsx)(i.X,{className:"h-4 w-4"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Close"})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden","data-conversation-embedded":!0,children:tc})]})})}):er?(0,t.jsx)(A.ChatHeaderSlotProvider,{children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden","data-conversation-embedded":!0,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 border-b shrink-0",children:[(0,t.jsxs)("a",{href:eb?`/people/${eb}`:"#",className:"relative shrink-0",children:[tt,e3]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate leading-tight",children:M||"Unknown"}),(eE||e6)&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground truncate leading-tight",children:[(0,t.jsx)("span",{className:"truncate",children:eE&&e6?`${eE} at ${e6}`:eE||e6}),e6&&(e7||e8)&&(0,t.jsx)(m.CompanyLogo,{domain:e7,logoUrl:e8,companyName:e6||void 0,size:"xs",className:"!h-3.5 !w-3.5 shrink-0"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[ta,(0,t.jsx)(A.ChatHeaderSlot,{}),(0,t.jsx)(C.ConversationQuickActions,{contactId:eb??null}),"email"!==z&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.MessageSearchPill,{value:eF,onChange:ez}),(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>{eG(!0),eB(e=>e+1),setTimeout(()=>eG(!1),2e3)},children:eH?(0,t.jsx)(R.ButtonSpinner,{}):(0,t.jsx)(r.RefreshCw,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Refresh"})]})]}),"email"===z&&(0,t.jsx)("div",{className:`flex items-center overflow-hidden transition-[width] duration-200 ease-out ${eW?"w-[200px] min-w-[200px] pl-2.5 pr-1 gap-1 h-7 search-pill roun
1ded-full border bg-white border-[oklch(0.85_0.01_60)] dark:bg-black dark:border-transparent":"w-7 min-w-7 justify-center"}`,children:eW?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Search,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("input",{ref:eJ,value:eY,onChange:e=>eV(e.target.value),placeholder:"Search...",className:"flex-1 min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground/60",onBlur:()=>{eY.trim()||eX(!1)},onKeyDown:e=>{"Escape"===e.key&&(eV(""),eX(!1))}}),(0,t.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>{eV(""),eX(!1)},children:(0,t.jsx)(i.X,{className:"h-3 w-3"})})]}):(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:()=>{eX(!0),setTimeout(()=>eJ.current?.focus(),50)},children:(0,t.jsx)(s.Search,{className:"h-4 w-4"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Search in thread"})]})}),(0,t.jsxs)(c.Tooltip,{children:[(0,t.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0",onClick:ea,children:(0,t.jsx)(i.X,{className:"h-4 w-4"})})}),(0,t.jsx)(c.TooltipContent,{side:"bottom",children:"Close"})]})]})]}),"email"!==z&&!(er&&("slack"===z||"whatsapp"===z))&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b shrink-0",children:[(0,t.jsx)(o.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-6 w-6 p-0 shrink-0",onClick:ea,children:(0,t.jsx)(a.ChevronLeft,{className:"h-3.5 w-3.5"})}),tr,(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:ts[z]??"Messages"}),ee&&"chat"===z&&(0,t.jsx)("span",{className:"ml-auto flex items-center gap-1.5 shrink-0 overflow-hidden","data-card-status-trigger":!0,children:(0,t.jsx)(L.ThreadMetaBar,{conversationId:ee,channel:"chat",className:"flex items-center gap-1.5",showStatusOnMobile:!0})}),ee&&"chat"!==z&&"x"!==z&&(0,t.jsx)("span",{className:"ml-auto sm:hidden min-w-0 flex items-center overflow-hidden","data-card-status-trigger":!0,children:(0,t.jsx)(L.ConversationStatusSlot,{conversationId:ee,channel:"messages"===z?Q??"imessage":z})})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:tc})]})}):ed?(0,t.jsx)("div",{className:`flex flex-col flex-1 min-h-0 ${"email"===z?"":"overflow-hidden"}`,"data-conversation-embedded":!0,children:tc}):(0,t.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-w-0 min-h-0",children:[(0,t.jsxs)(A.ChatHeaderSlotProvider,{children:[td,(0,t.jsx)("div",{className:"lg:hidden flex-1 min-h-0 flex flex-col overflow-hidden","data-conversation-embedded":!0,children:tc})]}),(0,t.jsx)(A.ChatHeaderSlotProvider,{children:(0,t.jsx)("div",{className:`hidden lg:flex flex-1 min-h-0 flex-col overflow-hidden ${eu?"":"p-3"}`,children:(0,t.jsxs)("div",{className:`flex-1 min-h-0 flex flex-col overflow-hidden bg-card ${eu?"":"border rounded-xl"}`,children:["email"!==z&&tu,(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden","data-conversation-embedded":!0,children:tc})]})})})]}),eb&&!ec&&(0,t.jsx)("div",{className:"hidden lg:block w-[22rem] shrink-0 overflow-hidden",children:(0,t.jsx)(_.ConversationProfileSidebar,{contactId:eb})})]})}],786223)},797873,862594,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(522016),r=e.i(346897),s=e.i(941388),i=e.i(300566),l=e.i(903336),o=e.i(788042),c=e.i(846696),d=e.i(957639),u=e.i(167881),m=e.i(728231),h=e.i(463415),p=e.i(813387),f=e.i(572377),x=e.i(524076),g=e.i(85757),v=e.i(458029),y=e.i(611423),w=e.i(548106),j=e.i(867299),k=e.i(746703),b=e.i(471438),_=e.i(750791),N=e.i(920755);function C(){return(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto p-3 space-y-3 detail-sidebar-cards",role:"status","aria-label":"Loading profile",children:[(0,t.jsxs)("div",{className:"border rounded-xl bg-card p-4 space-y-3",children:[(0,t.jsx)(y.Skeleton,{className:"h-20 w-20 squircle"}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(y.Skeleton,{className:"h-4 w-36"}),(0,t.jsx)(y.Skeleton,{className:"h-3.5 w-44"}),(0,t.jsx)(y.Skeleton,{className:"h-3 w-24"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:[0,1,2,3].map(e=>(0,t.jsx)(y.Skeleton,{className:"h-8 w-8 rounded-full"},e))})]}),(0,t.jsxs)("div",{className:"border rounded-xl bg-card p-4 space-y-3",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Experience"}),(0,t.jsx)(v.ProfileEntrySkeletonRows,{rows:2})]})]})}e.s(["ConversationProfileSidebar",0,function({contactId:y}
1){let S,[E,T]=(0,n.useState)(null),[M,I]=(0,n.useState)([]),[P,L]=(0,n.useState)(null),[A,R]=(0,n.useState)([]),[q,$]=(0,n.useState)(!1),[U,D]=(0,n.useState)(!1),[F,z]=(0,n.useState)(!1),O=(0,x.useDefaultMailProvider)(),B=(0,n.useCallback)(()=>{let e=(0,N.createClient)();e.from("contacts").select("id, name, email, job_title, location, image_url, linkedin_url, x_handle, twitter_url, phone, company_id, company:companies!contacts_company_id_fkey(id, name, logo_url, domain)").eq("id",y).single().then(({data:e})=>{e&&T(e)}),e.from("person_experiences").select("*").eq("contact_id",y).order("start_date",{ascending:!1}).then(({data:t})=>{I(t??[]),L(y);let n=[...new Set((t??[]).map(e=>e.company_id).filter(Boolean))];n.length>0&&e.from("companies").select("*").in("id",n).then(({data:e})=>{e&&R(e)})})},[y]);(0,n.useEffect)(()=>{B()},[B]),(0,n.useEffect)(()=>(0,d.onBusEvent)("entity",()=>B()),[B]);let H=E?.id===y?E:null,G=P!==y;if(!H)return(0,t.jsx)(C,{});let W=G?[]:(0,g.groupByCompany)(M,A);async function X(){if(!H?.phone)return void c.toast.error("No phone number available");let{requestGlobalCall:t}=await e.A(456437);t({toNumber:H.phone,contactId:H.id,contactName:H.name,companyId:H.company_id,record:!0})}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto p-3 space-y-3 detail-sidebar-cards",children:[(0,t.jsxs)("div",{className:"border rounded-xl bg-card p-4 space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(a.default,{href:`/people/${H.id}`,className:"block",children:(0,t.jsx)("div",{className:"flex h-20 w-20 shrink-0 items-center justify-center squircle bg-muted avatar-border text-2xl font-medium hover:ring-2 hover:ring-inset hover:ring-primary/30 transition-shadow cursor-pointer",children:H.image_url?(0,t.jsx)(w.SafeImage,{src:H.image_url,alt:H.name,className:"h-full w-full object-cover",fallback:H.name.charAt(0).toUpperCase()}):H.name.charAt(0).toUpperCase()})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(a.default,{href:`/people/${H.id}`,className:"hover:underline",children:(0,t.jsx)("p",{className:"text-base font-semibold",children:H.name})}),H.linkedin_url&&(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("a",{href:H.linkedin_url,target:"_blank",rel:"noopener noreferrer",className:"flex h-5 w-5 shrink-0 items-center justify-center squircle bg-[#0A66C2]",children:(0,t.jsx)(f.LinkedInGlyph,{className:"h-3 w-3 text-white"})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:"View LinkedIn profile"})]}),(S=H.x_handle?`https://x.com/${H.x_handle}`:H.twitter_url||null)?(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"flex h-5 w-5 shrink-0 items-center justify-center squircle bg-black",children:(0,t.jsx)(f.XGlyph,{className:"h-2.5 w-2.5 text-white"})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:H.x_handle?`View @${H.x_handle} on X`:"View X profile"})]}):null]}),(H.job_title||H.company)&&(0,t.jsx)("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:(0,t.jsxs)("span",{className:"truncate",children:[H.job_title,H.job_title&&H.company&&" at ",H.company&&(0,t.jsx)(a.default,{href:`/companies/${H.company.id}`,className:"hover:text-foreground transition-colors",children:H.company.name})]})}),H.location&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,t.jsx)(r.MapPin,{className:"h-3 w-3 shrink-0"}),H.location]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(h.DropdownMenu,{children:[(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(h.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(u.Button,{variant:"default",size:"icon-sm",className:"rounded-full","aria-label":"Send message",children:(0,t.jsx)(i.SendMailIcon,{className:"size-4"})})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:"Send message"})]}),(0,t.jsxs)(h.DropdownMenuContent,{align:"start",className:"min-w-[140px]",children:[(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>z(!0),children:[(0,t.jsx)(f.MailProviderSquircle,{className:"!h-3.5 !w-3.5 mr-2.5 shrink-0"})," Email"]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{window.location.href=`/people/${H.id}?tab=linkedin-messages`},children:[(0,t.jsx)(f.LinkedInSquircle,{className:"!h-3.5 !w-3.5 mr-2.5 shrink-0"})," LinkedIn"]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{window.location.href=`/people/${H.id}?tab=whatsapp`},children:[(0,t.jsx)(f.WhatsAppSquircle,{className:"!h-3.5 !w-3.5 mr-2.5 shrink-0"})," WhatsApp"]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>{window.location.href=`/people/${H.id}?tab=sms`},children:[(0,t.jsx)(f.SmsSquircle,{className:"!h-3.5 !w-3.5 mr-2.5 shrink-0"})," SMS"]})]})]}),H.phone&&(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(u.Button,{variant:"default",size:"icon-sm",className:"rounded-full",onClick:X,children:(0,t.jsx)(o.IPhoneIcon,{className:"size-3.5"})})}),(0,t.jsxs)(m.TooltipContent,{side:"bottom",children:["Call ",H.phone]})]}),(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(u.Button,{variant:"default",size:"icon-sm",className:"rounded-full",onClick:()=>D(!0),children:(0,t.jsx)(l.CalendarDateIcon,{className:"size-3.5"})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:"Schedule meeting"})]}),(0,t.jsx)(_.SequenceEnrollPicker,{contactIds:[y],tooltip:"Add to sequence",children:(0,t.jsx)(u.Button,{variant:"default",size:"icon-sm",className:"rounded-full","aria-label":"Add to sequence",children:(0,t.jsx)(j.SequencesIcon,{className:"size-3.5"})})}),(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(u.Button,{variant:"default",size:"icon-sm",className:"rounded-full",onClick:()=>$(!0),children:(0,t.jsx)(s.Plus,{className:"size-3.5"})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:"Create task"})]})]})]}),G&&(0,t.jsxs)("div",{className:"border rounded-xl bg-card p-4 space-y-3",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Experience"}),(0,t.jsx)(v.ProfileEntrySkeletonRows,{rows:2,label:"Loading experience"})]}),!G&&W.length>0&&(0,t.jsxs)("div",{className:"border rounded-xl bg-card p-4 space-y-3",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Experience"}),(0,t.jsx)("div",{className:"space-y-4",children:W.map((e,n)=>(0,t.jsx)(g.CompanyExperienceGroup,{group:e,onEdit:()=>{},onDelete:()=>{},onSetPrimary:()=>{}},`${e.companyId||e.companyName}-${n}`))})]})]}),(0,t.jsx)(k.TaskCreateDialog,{open:q,onOpenChange:$,onCreated:()=>c.toast.success("Task created"),initialEntityId:y,initialEntityType:"contact"}),(0,t.jsx)(b.ScheduleMeetingDialog,{open:U,onOpenChange:D,defaultAttendees:H.email?[{email:H.email,displayName:H.name}]:[]}),H.email&&(0,t.jsx)(p.GmailCompose,{open:F,onOpenChange:z,prefillTo:H.email,mailApiBase:"outlook"===O?"/api/outlook":"/api/gmail",onSent:()=>z(!1)})]})}],797873);var S=e.i(324973),E=e.i(414318);e.s(["ConversationQuickActions",0,function({contactId:e}
1){let[a,r]=(0,n.useState)(!1);return e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.SequenceEnrollPicker,{contactIds:[e],tooltip:"Add to sequence",align:"end",children:(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0","aria-label":"Add to sequence",children:(0,t.jsx)(j.SequencesIcon,{className:"h-3.5 w-3.5"})})}),(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0","aria-label":"Create task",onClick:()=>r(!0),children:(0,t.jsx)(S.TasksIcon,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:"Create task"})]}),(0,t.jsx)(k.TaskCreateDialog,{open:a,onOpenChange:r,initialEntityId:e,initialEntityType:"contact",onCreated:()=>{c.toast.success("Task created"),(0,E.dispatchAppRefresh)()}})]}):null}],862594)},521338,196587,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(870273),r=e.i(846696),s=e.i(167881),i=e.i(728231),l=e.i(920755),o=e.i(287751);async function c(e){try{let t=await fetch("/api/linkedin/messaging/add-participant-contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.contactId)return r.toast.error(n.error||"Failed to add to Everything"),null;let a=n.contact?.name||"Contact";return r.toast.success(n.isNew?`Saved ${a} to Everything`:`${a} is already in Everything`,{action:{label:"Open",onClick:()=>window.open(`/people/${n.contactId}`,"_blank")}}),n}catch{return r.toast.error("Failed to add to Everything"),null}}e.s(["ConversationStarButton",0,function({channel:e,conversationRef:c}
1){let[d,u]=(0,n.useState)(null),[m,h]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if("email"===e||!c)return;let t=!1;return(async()=>{let n=(0,l.createClient)(),{data:a}=await n.auth.getUser(),r=a.user?.id;if(!r||t)return;let{data:s}=await n.from("conversation_stars").select("id").eq("user_id",r).eq("channel",e).eq("conversation_ref",c).maybeSingle();t||u(!!s)})(),()=>{t=!0}},[e,c]),"email"===e||!c)return null;async function p(){if(m)return;let t=!d;h(!0),u(t);let n=await fetch("/api/inbox/star",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationIds:[c],channel:e,starred:t})});if(h(!1),!n.ok){u(!t),r.toast.error(t?"Could not star":"Could not unstar");return}(0,o.invalidate)(e=>e.startsWith("/api/inbox/feed"))}return(0,t.jsxs)(i.Tooltip,{children:[(0,t.jsx)(i.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(s.Button,{variant:"ghost",size:"sm",className:"rounded-3xl h-7 w-7 p-0","aria-label":d?"Unstar conversation":"Star conversation",onClick:p,children:(0,t.jsx)(a.Star,{className:`h-3.5 w-3.5 ${d?"fill-yellow-400 text-yellow-500":""}`})})}),(0,t.jsx)(i.TooltipContent,{side:"bottom",children:d?"Unstar":"Star"})]})}],521338),e.s(["addLinkedInParticipantContact",0,c],196587)},983528,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(778917),r=e.i(416788),s=e.i(439468),i=e.i(25394),l=e.i(63270),o=e.i(922083),c=e.i(625959),d=e.i(416363),u=e.i(870273),m=e.i(934088),h=e.i(172901),p=e.i(572377),f=e.i(524076),x=e.i(407909),g=e.i(327147),v=e.i(783618),y=e.i(459648),w=e.i(399513);let j={linkedin:{label:"LinkedIn",Squircle:p.LinkedInSquircle},linkedin_comments:{label:"LinkedIn Comments",Squircle:p.LinkedInCommentsSquircle},x:{label:"X",Squircle:p.XSquircle},reddit:{label:"Reddit",Squircle:p.RedditSquircle},whatsapp:{label:"WhatsApp",Squircle:p.WhatsAppSquircle},sms:{label:"SMS",Squircle:p.SmsSquircle},imessage:{label:"iMessage",Squircle:p.IMessageSquircle},messages:{label:"iMessage/SMS",Squircle:p.IMessageSquircle},slack:{label:"Slack",Squircle:p.SlackSquircle},chat:{label:"Chat",Squircle:p.ChatSquircle}},k={imessage:{color:"#0A84FF",title:"Last message went over iMessage"},text:{color:"#34C759",title:"Last message went over text (RCS/SMS)"}},b=(0,n.memo)(function({name:e,imageUrl:b,senderLogoUrl:_,channel:N,snippet:C,senderPrefix:S,date:E,isRead:T=!0,unreadCount:M,subtitle:I,companyId:P,companyName:L,companyDomain:A,companyLogoUrl:R,statusId:q,tags:$,isStarred:U,onToggleStar:D,onStatusChanged:F,channelBadge:z,isSelected:O,isFocused:B,rowId:H,onToggleCheck:G,onClick:W,onMouseEnter:X,onVisible:Y,visibleDelayMs:V=800,chipLines:J=2,isGroup:K,avatarStack:Z,hideChannelPill:Q,emailProvider:ee,externalUrl:et,externalUrlLabel:en="Open profile",onAddContact:ea,addingContact:er,transport:es,linkedinUrn:ei}){let el=!T,eo=(0,i.useLinkedInPresence)(ei??null),ec=Z&&Z.length>0?Z:null,ed=!K&&!!eo,eu=ed?(0,o.presenceNotch)({size:40}):void 0,em=(0,s.useDomainLogo)(b||_?null:A),eh=_??em,ep="email"===N?null:j[N],ef=es?k[es]:null,ex=(0,f.useDefaultMailProvider)(),eg=ee??ex,ev=(e||"?").split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),ey="";O?ey="bg-[#F9F9F5] dark:bg-white/[0.06]":B&&(ey="bg-[#F9F9F5] dark:bg-white/[0.06]");let ew=`${v.PILL_SIZES.default} inline-flex items-center rounded-full sq-capsule border entity-chip text-foreground/80`,ej=(0,n.useRef)(null),[ek,eb]=(0,n.useState)(0),e_=(0,n.useRef)(()=>{});e_.current=()=>{let e=ej.current;if(!e)return;let t=Array.from(e.children).filter(e=>!e.dataset.overflowCounter);if(t.forEach(e=>e.classList.remove("!hidden")),0===t.length)return void eb(0);e.offsetHeight;let n=t[0],a=n.offsetHeight,r=parseFloat(getComputedStyle(e).gap)||4,s=n.offsetTop+(a+r)*J,i=e.getBoundingClientRect().right,l=0;for(let e=t.length-1;e>=0;e--){let n=t[e],a=n.offsetTop>=s,r=n.getBoundingClientRect().right>i+1;(a||r)&&(n.classList.add("!hidden"),l++)}let o=e.querySelector("[data-overflow-counter]");if(o)for(let n=t.length-1;n>=0&&(!(o.getBoundingClientRect().right<=i+1)||!(o.offsetTop<s));n--){let a=t[n];a.classList.contains("!hidden")||(a.classList.add("!hidden"),l++,e.offsetHeight)}eb(l)},(0,n.useLayoutEffect)(()=>{e_.current()},[$,q,L,N,J,ek]),(0,n.useEffect)(()=>{let e=()=>e_.current();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let eN=(0,n.useRef)(null),eC=(0,n.useRef)(!1),eS=(0,n.useRef)(Y);eS.current=Y;let eE=!!Y;return(0,n.useEffect)(()=>
1{if(!eE)return;let e=eN.current;if(!e)return;let t=null,n=new IntersectionObserver(([e])=>{!eC.current&&(e.isIntersecting?t=setTimeout(()=>{eC.current||(eC.current=!0,eS.current?.(),n.disconnect())},V):t&&(clearTimeout(t),t=null))},{threshold:0,rootMargin:"1200px 0px"});return n.observe(e),()=>{n.disconnect(),t&&clearTimeout(t)}},[eE,V]),(0,t.jsxs)("div",{ref:eN,"data-feed-row":H??"","data-feed-focused":B?"":void 0,"data-row-lit":ey?"":void 0,className:`group flex items-start sm:items-center gap-2.5 px-3 py-2 mb-px rounded-lg cursor-pointer ${ey} ${!ey?"hover:bg-[#F9F9F5] dark:hover:bg-white/[0.04]":""}`,onClick:W,onMouseEnter:X,children:[(0,t.jsx)("div",{className:"w-1.5 shrink-0 flex justify-center self-center",children:el&&"email"===N&&(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-[#A6BFD0] dark:bg-[#7AC8F0]"})}),G&&(0,t.jsx)("div",{className:"shrink-0",onClick:e=>{e.stopPropagation(),G(e)},children:(0,t.jsx)(c.Checkbox,{checked:O,className:"h-3.5 w-3.5"})}),(0,t.jsxs)("div",{className:"relative shrink-0",children:[ec?(0,t.jsx)(w.CompanyLogoStack,{companies:ec,size:40}):b?(0,t.jsxs)(l.Avatar,{className:"h-10 w-10",style:eu,children:[(0,t.jsx)(l.AvatarImage,{src:b}),(0,t.jsx)(l.AvatarFallback,{className:"text-[9px] bg-foreground
1/8 text-foreground/60 font-medium",children:K?(0,t.jsx)(r.PeopleGroupIcon,{className:"h-4 w-4"}):ev})]}):eh?(0,t.jsx)("div",{style:eu,className:`relative h-10 w-10 avatar-border p-1.5 bg-muted dark:bg-white/[0.06] group-hover:bg-white dark:group-hover:bg-white/15 group-data-[row-lit]:bg-white dark:group-data-[row-lit]:bg-white/15 ${eu?"":"squircle overflow-hidden"}`,children:(0,t.jsx)("img",{src:eh,alt:"",className:"h-full w-full object-contain"})}):(0,t.jsx)(l.Avatar,{className:"h-10 w-10",style:eu,children:(0,t.jsx)(l.AvatarFallback,{className:"text-[9px] bg-foreground/8 text-foreground/60 font-medium",children:K?(0,t.jsx)(r.PeopleGroupIcon,{className:"h-4 w-4"}):ev})}),K&&!ec&&(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-background ring-1 ring-border",children:(0,t.jsx)(r.PeopleGroupIcon,{className:"h-2.5 w-2.5 text-muted-foreground"})}),ed&&(0,t.jsx)(o.PresenceDot,{online:"online"===eo,size:40})]}),(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 ${el?"font-semibold text-foreground":"font-normal text-foreground/80"}`,children:e||"Unknown"}),ea&&(0,t.jsxs)("button",{type:"button","aria-label":"Add to Everything",title:"Add to Everything",disabled:er,onClick:e=>{e.stopPropagation(),ea()},className:"shrink-0 inline-flex items-center gap-1 rounded-full border border-border bg-white dark:bg-white/10 px-2 py-px text-[11px] font-medium leading-4 text-foreground/70 transition-colors hover:bg-foreground
1/10 hover:text-foreground disabled:pointer-events-none disabled:opacity-60",children:[er?(0,t.jsx)(g.ButtonSpinner,{}):(0,t.jsx)(y.AddPersonIcon,{className:"h-3 w-3"}),(0,t.jsx)(g.ShimmerLabel,{active:er,children:"Add"})]}),ef&&(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:ef.color},title:ef.title,"aria-label":ef.title}),et&&(0,t.jsx)("a",{href:et,target:"_blank",rel:"noopener noreferrer","aria-label":en,title:en,onClick:e=>e.stopPropagation(),className:"shrink-0 text-muted-foreground/60 hover:text-foreground transition-colors",children:(0,t.jsx)(a.ExternalLink,{className:"h-3 w-3"})})]}),I&&(0,t.jsx)("p",{className:`text-xs truncate ${el?"text-foreground/70":"text-muted-foreground"}`,children:I}),(0,t.jsxs)("p",{className:"text-[11px] text-muted-foreground/60 truncate",children:[S&&(0,t.jsxs)("span",{className:"text-muted-foreground/80",children:[S,": "]}),(0,t.jsx)(x.FormattedText,{text:C||"",preview:!0})]}),(0,t.jsxs)("div",{ref:ej,className:"mt-1 flex items-center gap-1 flex-wrap [&>*]:flex [&>*]:items-center [&>*]:shrink-0 [&>*]:whitespace-nowrap",children:[L&&(0,t.jsx)(d.CompanyChip,{id:P||"",name:L,domain:A,logoUrl:R}),void 0!==q&&(0,t.jsx)("span",{"data-feed-status":H,children:(0,t.jsx)(h.EmailStatusBadge,{statusId:q??null,onChange:F?e=>F(e):void 0})}),z,!Q&&(0,t.jsx)("span",{className:ew,children:"email"===N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.MailProviderSquircle,{provider:eg,className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:"outlook"===eg?"Outlook":"Gmail"})]}):ep?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ep.Squircle,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:ep.label})]}):null}),$?.map(e=>(0,t.jsx)(m.TagChip,{tag:e},e.id)),ek>0&&(0,t.jsxs)("span",{"data-overflow-counter":!0,className:"inline-flex items-center rounded-full bg-muted/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:["+",ek]})]})]}),(0,t.jsxs)("div",{className:"shrink-0 self-stretch flex flex-col items-end gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[U&&(0,t.jsx)("button",{type:"button","aria-label":"Unstar conversation",title:"Unstar",disabled:!D,onClick:e=>{e.stopPropagation(),D?.()},className:`shrink-0 rounded-full ${D?"":"pointer-events-none"}`,children:(0,t.jsx)(u.Star,{className:"h-3.5 w-3.5 fill-yellow-400 text-yellow-500"})}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground tabular-nums",children:function(e){if(!e)return"";let t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),r=Math.floor(n/36e5),s=Math.floor(n/864e5);return a<1?"now":a<60?`${a}m`:r<24?`${r}h`:s<7?`${s}d`:t.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}(E)})]}),"email"!==N&&null!=M&&M>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:M>99?"99+":M})]})]})});e.s(["FeedRow",0,b])},640223,e=>{"use strict";var t=e.i(843476),n=e.i(476819);e.s(["SidebarForwardArrowIcon",0,function(e){let{width:a=14,height:r=11,...s}=e,i="number"==typeof a?a:Number.parseFloat(a)||14,l="number"==typeof r?r:Number.parseFloat(r)||11;return(0,t.jsx)("svg",{width:a,height:r,style:{width:(0,n.designPx)(i),height:(0,n.designPx)(l)},viewBox:"0 0 18 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,...s,children:(0,t.jsx)("path",{d:"M1 7H17M17 7L11 13M17 7L11 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}])},250566,695064,e=>{"use strict";var t=e.i(843476),n=e.i(271645);e.i(90267);var a=e.i(246314),r=e.i(974841);function s({entry:e,fallbackName:n}){let a=e.contactName||n,{theyCommented:o,youCommented:c,theirReaction:d,myReaction:u,post:m}=e,h=d?(0,t.jsx)(r.ReactionIcon,{type:l(d.type),size:14}):null;return m.authorIsMe?o?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[a," commented on your post",d&&(0,t.jsxs)(t.Fragment,{children:[" and ",h," ",i(d.type,"it")]})]}):d?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[h," ",a," ",i(d.type,"your post")]}):(0,t.jsx)("span",{children:"On your post"}):m.authorIsContact?c?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["You commented on ",a,"'s post",u&&(0,t.jsxs)(t.Fragment,{children:[" and ",(0,t.jsx)(r.ReactionIcon,{type:l(u.type),size:14})," ",i(u.type,"it")]})]}):u?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsx)(r.ReactionIcon,{type:l(u.type),size:14})," ","You ",i(u.type,`${a}'s post`)]}):(0,t.jsxs)("span",{children:["On ",a,"'s post"]}):o&&c?(0,t.jsxs)("span",{children:["You and ",a," both commented"]}):(0,t.jsx)("span",{children:o?`${a} commented`:"You commented"})}function i(e,t){switch(e?.toUpperCase()){case"PRAISE":case"CELEBRATE":return`celebrated ${t}`;case"EMPATHY":case"LOVE":return`loved ${t}`;case"INTEREST":case"INSIGHTFUL":return`found ${t} insightful`;case"APPRECIATION":case"SUPPORT":return`appreciated ${t}`;case"ENTERTAINMENT":case"FUNNY":return`found ${t} funny`;case"MAYBE":return`was curious about ${t}`;default:return`liked ${t}`}}function l(e){let t=(e||"").toUpperCase();switch(t){case"PRAISE":return"CELEBRATE";case"EMPATHY":return"LOVE";case"INTEREST":return"INSIGHTFUL";case"ENTERTAINMENT":return"FUNNY";case"APPRECIATION":return"SUPPORT";default:return["LIKE","CELEBRATE","SUPPORT","LOVE","INSIGHTFUL","FUNNY","MAYBE"].includes(t)?t:"LIKE"}}e.s(["LinkedInInteractionCard",0,function({entry:e,fallbackName:r}){let i=(0,n.useMemo)(()=>{var t,n;let a,r,s,i,l,o;return t=e.post,n=e.comments,a=t.postedAt?new Date(t.postedAt).getTime():null,{urn:t.urn,ugcPostUrn:t.ugcPostUrn,socialDetailUrn:t.socialDetailUrn,contextHeader:null,author:{urn:t.authorProfileUrn,name:t.authorName,headline:t.authorHeadline,vanityName:t.authorVanity,pictureUrl:t.authorPictureUrl},text:t.text,attributes:Array.isArray(t.attributes)?t.attributes:[],media:Array.isArray(t.media)?t.media:[],resharedPostUrn:null,resharedPost:t.resharedPost??null,inlineComments:n,postedAt:null!==a&&Number.isFinite(a)?a:null,postedAgeText:t.postedAt?(r=new Date(t.postedAt),i=Math.floor((s=Date.now()-r.getTime())/6e4),l=Math.floor(s/36e5),o=Math.floor(s/864e5),i<1?"now":i<60?`${i}m`:l<24?`${l}h`:o<7?`${o}d`:r.toLocaleDateString("en-GB",{day:"numeric",month:"short"})):null,reactionsCount:t.reactionsCount,commentsCount:t.commentsCount,sharesCount:t.sharesCount,impressionsCount:null,raw:null}},[e]);return(0,t.jsx)(a.LinkedInPostCard,{post:i,initialShowComments:!0,contextSlot:(0,t.jsx)(s,{entry:e,fallbackName:r})})}],250566);var o=e.i(514511),c=e.i(694533),d=e.i(618548),u=e.i(920755);async function m(){let e=await (0,d.getOwnLinkedInUrn)();return e.ok&&e.ownLinkedinUrn?(await fetch("/api/linkedin/sync-shared-comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({ownLinkedinUrn:e.ownLinkedinUrn})}),{urn:e.ownLinkedinUrn}):{urn:null,error:e.error||"extension returned no URN"}}async function h(e){let t=(0,u.createClient)(),[{data:n},{data:a}]=await Promise.all([t.from("contacts").select("linkedin_urn, linkedin_id, linkedin_url").eq("id",e).maybeSingle(),t.from("profiles").select("own_linkedin_urn").single()]),r
1=function(e){if(!e)return null;let t=e.linkedin_urn?.trim();if(t&&/^urn:li:fsd_profile:/i.test(t))return t;let n=(0,c.extractLinkedinProfileOpaqueId)(e.linkedin_urn??"")??(0,c.extractLinkedinProfileOpaqueId)(e.linkedin_id??"")??(0,c.extractLinkedinProfileOpaqueId)(e.linkedin_url??"");return n?`urn:li:fsd_profile:${n}`:null}(n);if(!r)throw Error("Contact has no LinkedIn opaque ID - open their LinkedIn profile via the extension first to capture it");let s=a?.own_linkedin_urn??null;if(!s){let e=await m();if(!e.urn)throw Error(`Could not detect your LinkedIn identity: ${e.error||"unknown error"}`);s=e.urn}return p({contactProfileUrn:r,ownLinkedinUrn:s})}async function p(e){let t=await (0,d.syncSharedCommentsRaw)({contactProfileUrn:e.contactProfileUrn,ownProfileUrn:e.ownLinkedinUrn,pagesPerSide:5,perPage:20});if(!t.ok)throw Error(t.error||"sync failed");let n=t.contactPages||[],a=t.ownPages||[],r=new Map;for(let e of n)for(let t of(0,o.decodePostsResponse)(e).posts)r.has(t.urn)||r.set(t.urn,t);let s=new Map;for(let e of a)for(let t of(0,o.decodePostsResponse)(e).posts)s.has(t.urn)||s.set(t.urn,t);let i=new Map;for(let e of t.commentTrees||[]){let t=(0,o.decodeCommentsResponse)(e.raw).comments;i.set(e.activityUrn,t)}let l=new Map;for(let e of t.contactReactionPages||[])for(let t of(0,o.decodePostsResponse)(e).posts)l.has(t.urn)||l.set(t.urn,t);let u=new Set([...r.keys(),...s.keys(),...l.keys()]),m=new Map,h=new Map;for(let t of u){let n=s.get(t)||r.get(t)||l.get(t),a=n.author?.urn??null,o=!!a&&(0,c.linkedinUrnsReferToSameEntity)(a,e.contactProfileUrn),d=!!a&&(0,c.linkedinUrnsReferToSameEntity)(a,e.ownLinkedinUrn),u=i.get(t),p=u&&u.length>0?u:[...r.get(t)?.inlineComments||[],...s.get(t)?.inlineComments||[]],f=new Map;for(let e of p)e.commentUrn&&f.set(e.commentUrn,e);let x=p.some(t=>t.commenter?.urn&&(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.ownLinkedinUrn)),g=p.some(t=>t.commenter?.urn&&(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.contactProfileUrn));if(d&&l.has(t)&&h.set(t,function(e){let t=(e||"").toLowerCase();return t.includes("celebrat")?"PRAISE":t.includes("love")?"EMPATHY":t.includes("insight")?"INTEREST":t.includes("support")||t.includes("funny")||t.includes("laugh")?"ENTERTAINMENT":t.includes("curious")?"MAYBE":"LIKE"}(l.get(t).contextHeader)),o&&(x||s.has(t))){m.set(t,{post:n,comments:p,reason:"you-commented-on-their-post"});continue}if(d&&(g||r.has(t))){m.set(t,{post:n,comments:p,reason:"they-commented-on-your-post"});continue}if(d&&h.has(t)){m.set(t,{post:n,comments:p,reason:"they-reacted-to-your-post"});continue}if(p.some(t=>{if(!t.parentCommentUrn||!t.commenter?.urn)return!1;let n=f.get(t.parentCommentUrn),a=n?.commenter?.urn;if(!a)return!1;let r=(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.ownLinkedinUrn),s=(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.contactProfileUrn),i=(0,c.linkedinUrnsReferToSameEntity)(a,e.ownLinkedinUrn),l=(0,c.linkedinUrnsReferToSameEntity)(a,e.contactProfileUrn);return r&&l||s&&i})){m.set(t,{post:n,comments:p,reason:"reply-chain"});continue}p.some(t=>{if(!t.commenter?.urn||!t.mentions?.length)return!1;let n=(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.ownLinkedinUrn),a=(0,c.linkedinUrnsReferToSameEntity)(t.commenter.urn,e.contactProfileUrn);return t.mentions.some(t=>!!t.urn&&!!(n&&(0,c.linkedinUrnsReferToSameEntity)(t.urn,e.contactProfileUrn)||a&&(0,c.linkedinUrnsReferToSameEntity)(t.urn,e.ownLinkedinUrn)))})&&m.set(t,{post:n,comments:p,reason:"mention"})}for(let[e,t]of[...m.entries()].filter(([e,t])=>!i.has(e)&&!!t.post.socialDetailUrn))try{let n=await (0,d.fetchLinkedInPostComments)({socialDetailUrn:t.post.socialDetailUrn,count:50,numReplies:5,sortOrder:"CHRON"}),a=n.data??n,r=(0,o.decodeCommentsResponse)(a).comments;r.length&&m.set(e,{...t,comments:r})}catch(t){console.warn("[sync-shared-comments] tree fetch failed for",e,t)}let p={contact:r.size,own:s.size};if(console.info("[sync-shared-comments]",{scanned:p,candidates:u.size,qualifying:m.size,treeCount:i.size,reasons:[...m.values()].reduce((e,t)=>(e[t.reason]=(e[t.reason]||0)+1,e),{})}),0===m.size)return{cached:{posts:0,comments:0},sharedCount:0,scanned:p};let f=[...m.keys()].map(e=>{let t=m.get(e).post;return{urn:t.urn,ugcPostUrn:t.ugcPostUrn,socialDetailUrn:t.socialDetailUrn,author:{urn:t.author?.urn||null,name:t.author?.name||null,headline:t.author?.headline||null,vanityName:t.author?.vanityName||null,pictureUrl:t.author?.pictureUrl||null},text:t.text,attributes:t.attributes,media:t.media,postedAt:t.postedAt,reactionsCount:t.reactionsCount,commentsCount:t.commentsCount,sharesCount:t.sharesCount}}),x=[...m.entries()].map(([e,t])=>{let n=new Set;return{postUrn:e,comments:t.comments.filter(e=>!(!e.commentUrn||n.has(e.commentUrn))&&(n.add(e.commentUrn),!0)).map(e=>({commentUrn:e.commentUrn,parentCommentUrn:e.parentCommentUrn,commenter:{urn:e.commenter?.urn||null,name:e.commenter?.name||null,headline:e.commenter?.headline||null,vanityName:e.commenter?.vanityName||null,pictureUrl:e.commenter?.pictureUrl||null},text:e.text,attributes:e.attributes,reactionsCount:e.reactionsCount,repliesCount:e.repliesCount,postedAt:e.postedAt,pinned:e.pinned}))}}),g=[...r.values(),...l.values()].map(e=>e.author).find(t=>t?.urn&&(0,c.linkedinUrnsReferToSameEntity)(t.urn,e.contactProfileUrn))??null,v=[...h.entries()].map(([t,n])=>({postUrn:t,reactionType:n,reactor:{urn:e.contactProfileUrn,name:g?.name??null,headline:g?.headline??null,vanityName:g?.vanityName??null,pictureUrl:g?.pictureUrl??null}})),y=await fetch("/api/linkedin/sync-shared-comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ownLinkedinUrn:e.ownLinkedinUrn,posts:f,commentsByPost:x,reactions:v})});return{cached:(await y.json()).cached,sharedCount:m.size,scanned:p}}e.s(["syncContactSharedComments",0,h],695064)},974841,e=>{"use strict";var t=e.i(843476),n=e.i(400417),a=e.i(503783),a=a,r=e.i(149685),s=e.i(790597),i=e.i(341240),l=e.i(497960),o=e.i(267331),c=e.i(476819);let d={LIKE:{bg:"#0a66c2",label:"Like"},CELEBRATE:{bg:"#6dae4f",label:"Celebrate"},SUPPORT:{bg:"#df704d",label:"Support"},LOVE:{bg:"#df3550",label:"Love"},INSIGHTFUL:{bg:"#f5bb54",label:"Insightful"},FUNNY:{bg:"#1ea8a5",label:"Funny"},APPRECIATION:{bg:"#df704d",label:"Appreciation"}
1,INTEREST:{bg:"#0a66c2",label:"Interest"},MAYBE:{bg:"#9CA3AF",label:"Maybe"},EMPATHY:{bg:"#df3550",label:"Empathy"},ENTERTAINMENT:{bg:"#f5bb54",label:"Entertainment"}};function u({type:e}){let c="h-[60%] w-[60%]";switch(e){case"LIKE":default:return(0,t.jsx)(n.ThumbsUp,{className:c,strokeWidth:2,fill:"white"});case"CELEBRATE":return(0,t.jsx)(a.default,{className:c,strokeWidth:2});case"SUPPORT":case"APPRECIATION":return(0,t.jsx)(r.Handshake,{className:c,strokeWidth:2});case"LOVE":case"EMPATHY":return(0,t.jsx)(s.Heart,{className:c,strokeWidth:2,fill:"white"});case"INSIGHTFUL":case"INTEREST":return(0,t.jsx)(i.Lightbulb,{className:c,strokeWidth:2,fill:"white"});case"FUNNY":case"ENTERTAINMENT":return(0,t.jsx)(l.Smile,{className:c,strokeWidth:2});case"MAYBE":return(0,t.jsx)(o.HelpCircle,{className:c,strokeWidth:2})}}e.s(["PICKABLE_REACTIONS",0,["LIKE","CELEBRATE","SUPPORT","LOVE","INSIGHTFUL","FUNNY"],"ReactionIcon",0,function({type:e,size:n=18,className:a}){let r=e in d?e:"LIKE",s=d[r];return(0,t.jsx)("span",{title:s.label,"aria-label":s.label,className:`inline-flex items-center justify-center rounded-full text-white shrink-0 ${a||""}`,style:{width:(0,c.designPx)(n),height:(0,c.designPx)(n),backgroundColor:s.bg},children:(0,t.jsx)(u,{type:r})})},"reactionColor",0,function(e){let t=e in d?e:"LIKE";return d[t].bg},"reactionLabel",0,function(e){let t=e in d?e:"LIKE";return d[t].label}],974841)},407909,23199,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(428605);let r={"+1":"ð","-1":"ð",thumbsup:"ð",thumbsdown:"ð",clap:"ð",wave:"ð",raised_hands:"ð",ok_hand:"ð",handshake:"ð¤",v:"âï¸",metal:"ð¤",call_me_hand:"ð¤",love_you_gesture:"ð¤",writing_hand:"âï¸",pray:"ð",muscle:"ðª",point_up:"âï¸",point_down:"ð",point_left:"ð",point_right:"ð",middle_finger:"ð",raised_hand:"â",raised_back_of_hand:"ð¤",open_hands:"ð",palms_up_together:"ð¤²",fist:"â",facepunch:"ð",punch:"ð",left_facing_fist:"ð¤",right_facing_fist:"ð¤",pinching_hand:"ð¤",pinched_fingers:"ð¤",crossed_fingers:"ð¤",i_love_you_hand_sign:"ð¤",smile:"ð",smiley:"ð",grinning:"ð",laughing:"ð",sweat_smile:"ð
",rofl:"ð¤£",wink:"ð",blush:"ð",innocent:"ð",slightly_smiling_face:"ð",upside_down_face:"ð",stuck_out_tongue:"ð",stuck_out_tongue_winking_eye:"ð",stuck_out_tongue_closed_eyes:"ð",yum:"ð",relieved:"ð",heart_eyes:"ð",star_struck:"ð¤©",kissing_heart:"ð",kissing:"ð",kissing_smiling_eyes:"ð",kissing_closed_eyes:"ð",sunglasses:"ð",nerd_face:"ð¤",monocle_face:"ð§",confused:"ð",worried:"ð",slightly_frowning_face:"ð",frowning_face:"â¹ï¸",open_mouth:"ð®",hushed:"ð¯",astonished:"ð²",flushed:"ð³",pleading_face:"ð¥º",sleeping:"ð´",drooling_face:"ð¤¤",grimacing:"ð¬",zipper_mouth_face:"ð¤",nauseated_face:"ð¤¢",money_mouth_face:"ð¤",hugging_face:"ð¤",shushing_face:"ð¤«",lying_face:"ð¤¥",face_with_hand_over_mouth:"ð¤",face_with_monocle:"ð§",zany_face:"ð¤ª",face_with_raised_eyebrow:"ð¤¨",exploding_head:"ð¤¯",hot_face:"ð¥µ",cold_face:"ð¥¶",woozy_face:"ð¥´",partying_face:"ð¥³",smirk:"ð",unamused:"ð",disappointed:"ð",pensive:"ð",expressionless:"ð",neutral_face:"ð",no_mouth:"ð¶",face_in_clouds:"ð¶âð«ï¸",smiling_face_with_tear:"ð¥²",yawning_face:"ð¥±",triumph:"ð¤",angry:"ð ",rage:"ð¡",persevere:"ð£",confounded:"ð",tired_face:"ð«",weary:"ð©",cry:"ð¢",loudly_crying_face:"ð",face_with_steam_from_nose:"ð¤",pouting_face:"ð¡",cursing_face:"ð¤¬",face_with_symbols_on_mouth:"ð¤¬",joy:"ð",sob:"ð",thinking_face:"ð¤",thinking:"ð¤",skull:"ð",skull_and_crossbones:"â ï¸",poop:"ð©",hankey:"ð©",clown_face:"ð¤¡",ghost:"ð»",alien:"ð½",robot_face:"ð¤",see_no_evil:"ð",hear_no_evil:"ð",speak_no_evil:"ð",heart:"â¤ï¸",orange_heart:"ð§¡",yellow_heart:"ð",green_heart:"ð",blue_heart:"ð",purple_heart:"ð",black_heart:"ð¤",brown_heart:"ð¤",white_heart:"ð¤",broken_heart:"ð",two_hearts:"ð",revolving_hearts:"ð",heartbeat:"ð",heartpulse:"ð",sparkling_heart:"ð",cupid:"ð",gift_heart:"ð",heart_decoration:"ð",heavy_heart_exclamation_mark_ornament:"â£ï¸",love_letter:"ð",fire:"ð¥",star:"â",star2:"ð",sparkles:"â¨",zap:"â¡",boom:"ð¥",collision:"ð¥",dizzy:"ð«",sweat_drops:"ð¦",dash:"ð¨",hole:"ð³ï¸",bomb:"ð£",speech_balloon:"ð¬",thought_balloon:"ð",zzz:"ð¤",anger:"ð¢",100:"ð¯",white_check_mark:"â
",heavy_check_mark:"âï¸",x:"â",negative_squared_cross_mark:"â",heavy_plus_sign:"â",heavy_minus_sign:"â",warning:"â ï¸",bangbang:"â¼ï¸",question:"â",exclamation:"â",interrobang:"âï¸",grey_exclamation:"â",grey_question:"â",no_entry_sign:"ð«",underage:"ð",red_circle:"ð´",large_blue_circle:"ðµ",white_circle:"âª",black_circle:"â«",green_circle:"ð¢",yellow_circle:"ð¡",orange_circle:"ð ",purple_circle:"ð£",brown_circle:"ð¤",large_blue_diamond:"ð·",small_blue_diamond:"ð¹",large_orange_diamond:"ð¶",small_orange_diamond:"ð¸",crown:"ð",gem:"ð",trophy:"ð",medal:"ð
",party_popper:"ð",confetti_ball:"ð",balloon:"ð",gift:"ð",christmas_tree:"ð",rocket:"ð",tada:"ð",bulb:"ð¡",memo:"ð",book:"ð",link:"ð",email:"ð§","e-mail":"ð§",phone:"ð",telephone_receiver:"ð",computer:"ð»",desktop_computer:"ð¥ï¸",keyboard:"â¨ï¸",chart_with_upwards_trend:"ð",chart_with_downwards_trend:"ð",lock:"ð",unlock:"ð",ke
1y:"ð",money_with_wings:"ð¸",dollar:"ðµ",moneybag:"ð°",credit_card:"ð³",briefcase:"ð¼",file_folder:"ð",open_file_folder:"ð",page_facing_up:"ð",clipboard:"ð",calendar:"ð
",date:"ð
",spiral_calendar_pad:"ðï¸",pushpin:"ð",round_pushpin:"ð",paperclip:"ð",scissors:"âï¸",pencil2:"âï¸",pen_ballpoint:"ðï¸",mag:"ð",mag_right:"ð",checkered_flag:"ð",triangular_flag_on_post:"ð©",construction:"ð§",no_entry:"â",stop_sign:"ð",white_flag:"ð³ï¸",black_flag:"ð´",coffee:"â",tea:"ðµ",beer:"ðº",beers:"ð»",wine_glass:"ð·",cocktail:"ð¸",tropical_drink:"ð¹",champagne:"ð¾",pizza:"ð",hamburger:"ð",taco:"ð®",burrito:"ð¯",fries:"ð",hotdog:"ð",popcorn:"ð¿",ice_cream:"ð¨",doughnut:"ð©",cookie:"ðª",cake:"ð",pie:"ð¥§",apple:"ð",green_apple:"ð",avocado:"ð¥",dog:"ð¶",cat:"ð±",unicorn_face:"ð¦",unicorn:"ð¦",bear:"ð»",panda_face:"ð¼",penguin:"ð§",chicken:"ð",butterfly:"ð¦",bee:"ð",bug:"ð",snake:"ð",turtle:"ð¢",octopus:"ð",monkey_face:"ðµ",gorilla:"ð¦",fox_face:"ð¦",lion_face:"ð¦",wolf:"ðº",frog:"ð¸",whale:"ð³",dolphin:"ð¬",fish:"ð",eagle:"ð¦
",owl:"ð¦",bat:"ð¦",sunny:"âï¸",cloud:"âï¸",umbrella:"âï¸",rainbow:"ð",snowflake:"âï¸",ocean:"ð",sun_with_face:"ð",crescent_moon:"ð",full_moon:"ð",new_moon:"ð",earth_americas:"ð",earth_africa:"ð",earth_asia:"ð",deciduous_tree:"ð³",evergreen_tree:"ð²",palm_tree:"ð´",cactus:"ðµ",seedling:"ð±",herb:"ð¿",shamrock:"âï¸",four_leaf_clover:"ð",cherry_blossom:"ð¸",rose:"ð¹",sunflower:"ð»",tulip:"ð·",man:"ð¨",woman:"ð©",boy:"ð¦",girl:"ð§",baby:"ð¶",older_man:"ð´",older_woman:"ðµ",person_frowning:"ð",person_with_pouting_face:"ð",raising_hand:"ð",person_bowing:"ð",dancer:"ð",man_dancing:"ðº",walking:"ð¶",runner:"ð",running:"ð",couple:"ð«",family:"ðª",eyes:"ð",eye:"ðï¸",tongue:"ð
",lips:"ð",brain:"ð§ ",bone:"ð¦´",car:"ð",red_car:"ð",taxi:"ð",bus:"ð",airplane:"âï¸",helicopter:"ð",ship:"ð¢",sailboat:"âµ",train:"ð",metro:"ð",bike:"ð²",bicycle:"ð²",house:"ð ",house_with_garden:"ð¡",office:"ð¢",hospital:"ð¥",school:"ð£",hotel:"ð¨",soccer:"â½",basketball:"ð",football:"ð",baseball:"â¾",tennis:"ð¾",golf:"â³",ping_pong:"ð",dart:"ð¯",bowling:"ð³",video_game:"ð®",slot_machine:"ð°",game_die:"ð²",musical_note:"ðµ",notes:"ð¶",microphone:"ð¤",headphones:"ð§",guitar:"ð¸",trumpet:"ðº",violin:"ð»",drum_with_drumsticks:"ð¥",drum:"ð¥",art:"ð¨",movie_camera:"ð¥",camera:"ð·",tv:"ðº",radio:"ð»",thumbsup_all:"ð",aw_yeah:"ð",parrot:"ð¦","party-b":"ð",shipit:"ð",troll:"ð§",this:"ð",nothingtodohere:"ð¶",nope:"ð
",yep:"ð",ditto:"ð"},s={...r},i={};for(let[e,t]of Object.entries(r))i[t]=e;let l=!1,o=null,c=new Set;function d(){return o||(o=e.A(950814).then(({EMOJI_CATEGORIES:e})=>{for(let t of Object.values(e))if(Array.isArray(t))for(let e of t){let t=e.name;s[t]||(s[t]=e.emoji),i[e.emoji]||(i[e.emoji]=t)}for(let e of(l=!0,c))e()})),o}function u(e){return c.add(e),()=>{c.delete(e)}}function m(){return(0,n.useSyncExternalStore)(u,()=>l,()=>!1)}function h(e){return e.replace(/:([a-z0-9_+-]+):/g,(e,t)=>s[t.split("::")[0]]||e)}e.s(["loadComprehensiveEmoji",0,d,"replaceSlackEmoji",0,h,"slackEmojiToUnicode",0,function(e){let t=e.split("::")[0];return s[t]||`:${t}:`},"unicodeToSlackName",0,function(e){return i[e]||e},"useComprehensiveEmoji",0,m],23199);var p=e.i(138108);let f=(0,n.memo)(function({text:e,linkify:r=!1,preview:s=!1}){let i=m();(0,n.useEffect)(()=>{/:[a-z0-9_+-]+:/.test(h(e))&&d()},[e]);let l=(0,n.useMemo)(()=>{var n,i;let l;return function e(n,a){let r=[],s="",i=0,l=()=>{s&&(r.push(a?(0,t.jsx)(p.MessageText,{text:s},i++):s),s="")},o=0;for(;o<n.length;){let d=n[o];if("*"===d||"_"===d||"~"===d||"`"===d){let s=function(e,t,n){var a;if("`"!==n&&!(t<=0)&&/[\w]/.test(e[t-1]))return -1;if("`"===n&&e.startsWith("```",t)){let n=e.indexOf("```",t+3);return -1===n?-1:n+2}let r=e[t+1];if(void 0===r||" "===r||"\n"===r||r===n)return -1;for(let r=t+1;r<e.length&&"\n"!==e[r];
1r++)if(e[r]===n){if(" "===e[r-1]||e[r-1]===n||(a=r,"`"!==n&&!(a+1>=e.length)&&/[\w]/.test(e[a+1])))return -1;return r}return -1}(n,o,d);if(-1!==s){var c;l();let u=e(("`"===d&&n.startsWith("```",o)?n.slice(o+3,s-2):n.slice(o+1,s)).replace(/^\n|\n$/g,""),a);r.push((c=i++,"*"===d?(0,t.jsx)("strong",{className:"font-semibold",children:u},c):"_"===d?(0,t.jsx)("em",{children:u},c):"~"===d?(0,t.jsx)("s",{children:u},c):a?(0,t.jsx)("code",{className:"rounded bg-foreground/[0.06] px-1 py-px font-mono text-[0.92em]",children:u},c):(0,t.jsx)("span",{children:u},c))),o=s+1;continue}}s+=d,o++}return l(),r}((n=e,i=s,l=h((0,a.decodeHtmlEntities)(n).replace(/<#[A-Z0-9]+\|([^>]*)>/g,(e,t)=>t?`#${t}`:"#channel").replace(/<@([A-Z0-9]+)(?:\|([^>]*))?>/g,(e,t,n)=>`@${(n||"").trim()||t}`).replace(/<!(here|channel|everyone)>/g,"@$1").replace(/<((?:https?|mailto):[^|>]+)\|([^>]*)>/g,(e,t,n)=>(n||"").trim()||t).replace(/<((?:https?|mailto):[^>]+)>/g,"$1")),i&&(l=l.replace(/\s*\n+\s*/g," ").replace(/[ \t]{2,}/g," ").trim()),l),r)},[e,r,s,i]);return e.trim()?(0,t.jsx)(t.Fragment,{children:l}):null});e.s(["FormattedText",0,f],407909)},138108,813387,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(643531),r=e.i(174886),s=e.i(846696),i=e.i(428605),l=e.i(852861),o=e.i(783618),c=e.i(300566);let d=(0,e.i(770703).default)(()=>e.A(480382).then(e=>e.GmailCompose),{loadableGenerated:{modules:[837267]},ssr:!1});e.s(["GmailCompose",0,d],813387);let u=/https?:\/\/[^\s<>"']+|(?<![/@\w.\-])(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.(?![A-Z]))+[a-zA-Z]{2,}(?:\/[^\s<>"')\]]*)?/g,m=/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g,h=(0,o.pillClass)("icon","flex-nowrap whitespace-nowrap align-middle no-underline max-w-full overflow-hidden hover:text-foreground"),p=(0,o.pillClass)("icon","flex-nowrap whitespace-nowrap align-middle max-w-full overflow-hidden pr-1.5");function f(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function x({email:e}
1){let i,l,[o,u]=(0,n.useState)(!1),[m,h]=(0,n.useState)(!1);return(0,t.jsxs)("span",{className:p,title:e,children:[(0,t.jsx)("span",{className:"flex items-center justify-center h-5 w-5 squircle bg-foreground/10 text-[9px] font-medium shrink-0",children:(l=(i=e.split("@")[0]).split(/[._\-+]/)).length>=2&&l[0]&&l[1]?(l[0][0]+l[1][0]).toUpperCase():(i[0]||"?").toUpperCase()}),(0,t.jsx)("span",{className:"truncate max-w-[220px] min-w-0 [overflow-wrap:normal] [word-break:keep-all]",children:e}),(0,t.jsxs)("span",{className:"ml-0.5 flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)("button",{type:"button",title:"Copy email","aria-label":`Copy ${e}`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{u(!0),s.toast.success("Copied"),window.setTimeout(()=>u(!1),1500)}).catch(()=>s.toast.error("Couldn't copy"))},className:"flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground",children:o?(0,t.jsx)(a.Check,{className:"h-3 w-3 text-success"}):(0,t.jsx)(r.Copy,{className:"h-3 w-3"})}),(0,t.jsx)("button",{type:"button",title:"Send message","aria-label":"Send message",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),h(!0)},className:"flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground transition-colors hover:bg-primary/90",children:(0,t.jsx)(c.SendMailIcon,{className:"size-2.5"})})]}),m&&(0,t.jsx)(d,{open:!0,onOpenChange:h,prefillTo:e,onSent:()=>h(!1)})]})}function g({url:e}){let n,a=f(e),r=function(e){try{return new URL(f(e)).hostname.replace(/^www\./,"")}catch{return null}}(e),s=r?r.length>36?r.slice(0,35)+"â¦":r:e,i=r?(n=(0,l.getApexDomain)(r)??r,`https://www.google.com/s2/favicons?domain=${encodeURIComponent(n)}&sz=32`):null;return(0,t.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:h,title:a,children:[i&&(0,t.jsx)("img",{src:i,alt:"",className:"h-5 w-5 squircle bg-foreground
1/5 shrink-0 object-cover",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("span",{className:"truncate max-w-[260px] min-w-0 [overflow-wrap:normal] [word-break:keep-all]",children:s})]})}let v=(0,n.memo)(function({text:e}){let a=(0,n.useMemo)(()=>{let n=(0,i.decodeHtmlEntities)(e),a=function(e){let t=[];for(let n of e.matchAll(m))t.push({type:"email",start:n.index,end:n.index+n[0].length,value:n[0]});for(let n of e.matchAll(u)){let a=n.index,r=a+n[0].length;!t.some(e=>"email"===e.type&&a<e.end&&r>e.start)&&(!/^https?:\/\//i.test(n[0])&&/^\s*@/.test(e.slice(r))||t.push({type:"url",start:a,end:r,value:n[0]}))}return t.sort((e,t)=>e.start-t.start),t}(n),r=[],s=0;return a.forEach((e,a)=>{e.start>s&&r.push(n.slice(s,e.start)),r.push("email"===e.type?(0,t.jsx)(x,{email:e.value},a):(0,t.jsx)(g,{url:e.value},a)),s=e.end}),s<n.length&&r.push(n.slice(s)),r},[e]);return(0,t.jsx)(t.Fragment,{children:a})});e.s(["MessageText",0,v,"extractFirstUrl",0,function(e){let t=e.match(/https?:\/\/[^\s<>"{}|\\^`[\]]+/);return t?t[0]:null}],138108)},85757,e=>{"use strict";var t=e.i(843476),n=e.i(522016),a=e.i(870273),r=e.i(788699),s=e.i(167881),i=e.i(213788),l=e.i(257088),o=e.i(647163),c=e.i(341256);function d(e,t,n){let a=e=>new Date(e+"T00:00:00").toLocaleDateString("en-GB",{month:"short",year:"numeric"}),r=(0,l.formatDuration)(e,t,n);if(!e&&!t&&!n)return{range:"",duration:r};let s=e?a(e):"",i=n?"Present":t?a(t):"",o="";return s&&i?o=`${s} â ${i}`:s?o=`${s} â Present`:i&&(o=i),{range:o,duration:r}}function u(e,t){if(e.is_primary&&!t.is_primary)return -1;if(!e.is_primary&&t.is_primary)return 1;if(e.is_current&&!t.is_current)return -1;if(!e.is_current&&t.is_current)return 1;let n=e.start_date||"";return(t.start_date||"").localeCompare(n)}function m({companyId:e,domain:a,companyName:r,logoUrl:s}){let l=(0,t.jsx)(i.CompanyLogo,{domain:a,companyName:r,logoUrl:s,size:"sm"});return e?(0,t.jsx)(n.default,{href:`/companies/${e}`,className:"hover:opacity-80 transition-opacity",children:l}):l}function h({companyId:e,companyName:a,className:r}){return e?(0,t.jsx)(n.default,{href:`/companies/${e}`,className:(0,o.cn)("text-sm text-muted-foreground hover:text-foreground hover:underline transition-colors block",r),children:a}):(0,t.jsx)("p",{className:(0,o.cn)("text-sm text-muted-foreground",r),children:a})}function p({range:e,duration:n}){return e||n?(0,t.jsxs)("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:[e,n&&e?` \xb7 ${n}`:n]}):null}function f(){return(0,t.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-success ring-2 ring-card z-10",title:"Primary role"})}function x({exp:e,onEdit:n,onDelete:i,onSetPrimary:l}){return(0,t.jsxs)("div",{className:"absolute top-0 right-0 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity bg-card/80 backdrop-blur-sm rounded-md",children:[!e.is_primary&&(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-xs",className:"rounded-md text-success hover:text-success-dark",onClick:l,title:"Set as primary role",children:(0,t.jsx)(a.Star,{})}),(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-xs",className:"rounded-md",onClick:n,children:(0,t.jsx)(r.Pencil,{})}),(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-xs",className:"rounded-md text-destructive hover:text-destructive",onClick:i,children:(0,t.jsx)(c.TrashIcon,{})})]})}e.s(["CompanyExperienceGroup",0,function({group:e,onEdit:n,onDelete:a,onSetPrimary:r}){let s;if(1===e.roles.length){let s=e.roles[0],{range:i,duration:l}=d(s.start_date,s.end_date,s.is_current);return(0,t.jsxs)("div",{className:"group relative flex items-start gap-3",children:[(0,t.jsxs)("div",{className:"relative shrink-0",children:[s.is_primary&&(0,t.jsx)(f,{}),(0,t.jsx)(m,{companyId:e.companyId,domain:e.domain,companyName:e.companyName,logoUrl:e.logoUrl})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"min-w-0 overflow-hidden pr-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium line-clamp-2 break-words",title:s.title,children:s.title}),(0,t.jsx)(h,{companyId:e.companyId,companyName:e.companyName}),(0,t.jsx)(p,{range:i,duration:l}),s.location&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground
1/70",children:s.location}),s.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s.description})]}),(0,t.jsx)(x,{exp:s,onEdit:()=>n(s),onDelete:()=>a(s.id),onSetPrimary:()=>r(s)})]})})]})}return(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center relative",children:[e.roles.some(e=>e.is_primary)&&(0,t.jsx)(f,{}),(0,t.jsx)(m,{companyId:e.companyId,domain:e.domain,companyName:e.companyName,logoUrl:e.logoUrl}),(0,t.jsx)("div",{className:"w-px flex-1 bg-muted-foreground/30 mt-1.5"})]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(h,{companyId:e.companyId,companyName:e.companyName,className:"font-medium"}),(s=function(e){let t=e.map(e=>e.start_date).filter(Boolean);if(0===t.length)return null;let n=t.sort()[0],a=e.some(e=>e.is_current),r=e.map(e=>e.end_date).filter(Boolean),s=a?null:r.length>0?r.sort().reverse()[0]:null;return(0,l.formatDuration)(n,s,a)}(e.roles))?(0,t.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-3",children:s}):(0,t.jsx)("div",{className:"mb-3"}),(0,t.jsx)("div",{className:"relative",children:e.roles.map((s,i)=>{let{range:l,duration:c}=d(s.start_date,s.end_date,s.is_current),u=i===e.roles.length-1;return(0,t.jsxs)("div",{className:"group relative flex gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center pt-1.5",children:[(0,t.jsx)("div",{className:"h-2 w-2 rounded-full bg-muted-foreground/40 shrink-0"}),!u&&(0,t.jsx)("div",{className:"w-px flex-1 bg-muted-foreground/30 mt-0.5"})]}),(0,t.jsx)("div",{className:(0,o.cn)("min-w-0 flex-1",!u&&"pb-4"),children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"min-w-0 overflow-hidden pr-1",children:[(0,t.jsx)("p",{className:"text-sm font-medium line-clamp-2 break-words",title:s.title,children:s.title}),(0,t.jsx)(p,{range:l,duration:c}),s.location&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/70",children:s.location}),s.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s.description})]}),(0,t.jsx)(x,{exp:s,onEdit:()=>n(s),onDelete:()=>a(s.id),onSetPrimary:()=>r(s)})]})})]},s.id)})})]})]})},"groupByCompany",0,function(e,t){let n=[...e].sort((e,t)=>(t.start_date||"").localeCompare(e.start_date||"")),a=[],r=new Map;for(let e of n){let n=(e.company_id||e.company_name).toLowerCase(),s=r.get(n),i=!1;if(s){for(let t of s)if(function(e,t){let n=(e,t)=>t?Date.now():e?new Date(e+"T00:00:00").getTime():null,a=n(t.start_date,!1),r=n(t.end_date,t.is_current);if(null===a&&null===r)return!0;for(let t of e){let e=n(t.start_date,!1),s=n(t.end_date,t.is_current);if(null===e&&null===s||5184e6>=Math.max(0,Math.max(a??r,e??s)-Math.min(r??a,s??e)))return!0}return!1}(a[t].roles,e)){a[t].roles.push(e),i=!0;break}}if(!i){let i=e.company_id?t.find(t=>t.id===e.company_id):t.find(t=>t.name.toLowerCase()===e.company_name.toLowerCase()),l=a.length;s?s.push(l):r.set(n,[l]),a.push({companyName:e.company_name,companyId:e.company_id,domain:i?.domain??null,logoUrl:i?.logo_url??null,roles:[e]})}}for(let e of a){e.roles.sort(u);let t=e.roles.find(e=>e.company_logo_url)?.company_logo_url;t&&(e.logoUrl=t)}return a.sort((e,t)=>{let n=e.roles.some(e=>e.is_primary),a=t.roles.some(e=>e.is_primary);if(n&&!a)return -1;if(!n&&a)return 1;let r=e.roles.some(e=>e.is_current),s=t.roles.some(e=>e.is_current);if(r&&!s)return -1;if(!r&&s)return 1;let i=e.roles.reduce((e,t)=>t.start_date&&t.start_date>e?t.start_date:e,"");return t.roles.reduce((e,t)=>t.start_date&&t.start_date>e?t.start_date:e,"").localeCompare(i)}),a}])},458029,e=>{"use strict";var t=e.i(843476),n=e.i(611423),a=e.i(647163);let r=[["w-32","w-24","w-20"],["w-28","w-20","w-16"],["w-36","w-24","w-14"]];e.s(["ProfileEntrySkeletonRows",0,function({rows:e=3,label:s,className:i}){return(0,t.jsx)("div",{className:(0,a.cn)("space-y-3",i),role:"status","aria-label":s,children:Array.from({length:e}).map((e,s)=>{let[i,l,o]=r[s%r.length];return(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(n.Skeleton,{className:"h-8 w-8 shrink-0 squircle"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5 pt-0.5",children:[(0,t.jsx)(n.Skeleton,{className:(0,a.cn)("h-3.5",i)}),(0,t.jsx)(n.Skeleton,{className:(0,a.cn)("h-3",l)}),(0,t.jsx)(n.Skeleton,{className:(0,a.cn)("h-3",o)})]})]},s)})})}])},311199,e=>{"use strict";var t=e.i(843476),n=e.i(572377),a=e.i(656766),r=e.i(503116),s=e.i(955716);let i={send_email:n.MailProviderSquircle,manual_email:n.MailProviderSquircle,reply_email:n.MailProviderSquircle,manual_reply_email:n.MailProviderSquircle,linkedin_connect:n.LinkedInSquircle,linkedin_withdraw:n.LinkedInSquircle,linkedin_profile_view:n.LinkedInSquircle,linkedin_message:n.LinkedInSquircle,linkedin_inmail:n.LinkedInSquircle,linkedin_voice_note:function(e){return(0,n.VoiceNoteSquircle)({...e,color:"#0A66C2"})},linkedin_video:function(e){return(0,n.VideoSquircle)({...e,color:"#0A66C2"})},linkedin_post:n.LinkedInSquircle,linkedin_post_comment:n.LinkedInSquircle,linkedin_post_react:n.LinkedInSquircle,x_dm:n.XSquircle,x_follow:n.XSquircle,x_post:n.XSquircle,x_post_reply:n.XSquircle,x_post_like:n.XSquircle,x_post_repost:n.XSquircle,reddit_dm:n.RedditSquircle,reddit_post:n.RedditSquircle,reddit_comment:n.RedditSquircle,reddit_upvote:n.RedditSquircle,send_whatsapp:n.WhatsAppSquircle,manual_whatsapp:n.WhatsAppSquircle,whatsapp_voice_note:function(e){return(0,n.VoiceNoteSquircle)({...e,color:"#25D366"})},whatsapp_video:function(e){return(0,n.VideoSquircle)({...e,color:"#25D366"})},send_sms:n.SmsSquircle,send_message:n.IMessageSquircle,call:n.CallSquircle,custom:n.CustomTaskSquircle,ai_step:a.AgentStepSquircle},l={delay:{bg:"#F3F4F6",fg:"#6B7280",Icon:r.Clock},condition:{bg:"#FFF7ED",fg:"#F97316",Icon:s.GitBranch}};e.s(["StepIcon",0,function({stepType:e,size:n="sm"}){let a="md"===n?"h-9 w-9":"xs"===n?"h-5 w-5":"h-7 w-7",r=i[e];if(r)return(0,t.jsx)(r,{className:a});let s=l[e];
1if(s){let{bg:e,fg:r,Icon:i}=s;return(0,t.jsx)("div",{className:`flex ${a} shrink-0 items-center justify-center squircle`,style:{backgroundColor:e,color:r},children:(0,t.jsx)(i,{className:"md"===n?"h-4 w-4":"xs"===n?"h-2.5 w-2.5":"h-3.5 w-3.5"})})}return null}])},217437,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(846696),r=e.i(286536),s=e.i(788699),i=e.i(89128),l=e.i(367240),o=e.i(630374),c=e.i(167881),d=e.i(10708),u=e.i(23750),m=e.i(184762);e.i(807567);var h=e.i(611423),p=e.i(63270),f=e.i(647163),x=e.i(311199),g=e.i(533377),v=e.i(734531);e.s(["PersonalizeSequenceDialog",0,function({open:e,onOpenChange:y,sequenceId:w,sequenceName:j,targets:k,initialOverrides:b,onConfirm:_,confirmLabel:N="Save"}){let[C,S]=(0,n.useState)([]),[E,T]=(0,n.useState)(!0),[M,I]=(0,n.useState)(k[0]?.id??null),[P,L]=(0,n.useState)(()=>b??{}),[A,R]=(0,n.useState)(null),[q,$]=(0,n.useState)(!1),[U,D]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!e)return;let t=!1;return fetch(`/api/sequences/${w}/steps`).then(e=>e.json()).then(e=>{t||S((e??[]).filter(e=>(0,v.getStepContentFields)(e.step_type).length>0))}).catch(()=>{t||a.toast.error("Could not load the sequence steps")}).finally(()=>{t||T(!1)}),()=>{t=!0}},[e,w]);let F=k.find(e=>e.id===M)??null,z=(0,n.useMemo)(()=>M?P[M]??{}:{},[P,M]),O=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(e&&q&&M)return O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{let e=k.find(e=>e.id===M);fetch(`/api/sequences/${w}/preview`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contact_id:M,enrollment_id:e?.enrollmentId,template_overrides:z})}).then(e=>e.json()).then(e=>{let t={};for(let n of e.steps??[])t[n.step_id]=n;R(t)}).catch(()=>{})},350),()=>{O.current&&clearTimeout(O.current)}},[e,q,M,z,w,k]);let B=(0,n.useCallback)((e,t,n)=>{M&&L(a=>({...a,[M]:{...a[M]??{},[e]:{...a[M]?.[e]??{},[t]:n}}}))},[M]),H=(0,n.useCallback)(e=>{M&&L(t=>{let n={...t[M]??{}};return delete n[e],{...t,[M]:n}})},[M]),G=(0,n.useCallback)(e=>Object.values(P[e]??{}).filter(e=>Object.values(e).some(e=>"string"==typeof e&&""!==e.trim())).length,[P]);async function W(){D(!0);try{await _(P),y(!1)}catch(e){a.toast.error(e instanceof Error?e.message:"Could not save")}finally{D(!1)}}let X=k.length>1;return(0,t.jsx)(o.Dialog,{open:e,onOpenChange:y,children:(0,t.jsxs)(o.DialogContent,{className:"max-w-4xl p-0 gap-0 overflow-hidden",children:[(0,t.jsxs)(o.DialogHeader,{className:"px-5 pt-5 pb-3",children:[(0,t.jsxs)(o.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(s.Pencil,{className:"size-4"}),"Personalize",j?` \xb7 ${j}`:""]}),(0,t.jsx)(o.DialogDescription,{children:X?`Edit the copy for any of these ${k.length} people. Anything left alone sends the sequence's own template.`:"Edit the copy this person gets. Anything left alone sends the sequenceâs own template."})]}),(0,t.jsxs)("div",{className:"flex border-t min-h-[26rem] max-h-[60vh]",children:[X&&(0,t.jsx)("div",{className:"w-56 shrink-0 border-r overflow-y-auto",children:(0,t.jsx)("div",{className:"p-2 space-y-0.5",children:k.map(e=>{let n=G(e.id);return(0,t.jsxs)("button",{type:"button",onClick:()=>I(e.id),className:(0,f.cn)("w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors",e.id===M?"bg-accent":"hover:bg-accent/50"),children:[(0,t.jsxs)(p.Avatar,{className:"size-6",children:[(0,t.jsx)(p.AvatarImage,{src:e.image_url??void 0}),(0,t.jsx)(p.AvatarFallback,{className:"text-[10px]",children:e.name.split(" ").filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()).join("")})]}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.name}),n>0&&(0,t.jsx)("span",{className:"text-[10px] tabular-nums text-muted-foreground",children:n})]},e.id)})})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsxs)("div",{className:"p-5 space-y-4",children:[X&&F&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Editing ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:F.name})]}),E?(0,t.jsx)("div",{className:"space-y-4",children:[1,2].map(e=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(h.Skeleton,{className:"h-5 w-40"}),(0,t.jsx)(h.Skeleton,{className:"h-8 w-full"}),(0,t.jsx)(h.Skeleton,{className:"h-20 w-full"})]},e))}):0===C.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No steps in this sequence carry copy that can be personalized."}):C.map((e,n)=>{let a=g.STEP_TYPE_CONFIG[e.step_type],r=(0,v.getStepContentFields)(e.step_type),s=z[e.id]??{},o=A?.[e.id],h=Object.values(s).some(e=>"string"==typeof e&&""!==e.trim());return(0,t.jsxs)("div",{className:"space-y-2 rounded-lg border p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground tabular-nums font-medium",children:n+1}),(0,t.jsx)(x.StepIcon,{stepType:e.step_type,size:"xs"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:a?.label??e.step_type}),h&&(0,t.jsx)("span",{className:"text-[10px] rounded-full bg-primary/10 text-primary px-1.5 py-0.5",children:"edited"}),(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",children:h&&(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"size-6",title:"Revert to the sequence template",onClick:()=>H(e.id),children:(0,t.jsx)(l.RotateCcw,{className:"size-3"})})})]}),q&&o?.missing_variables.length?(0,t.jsxs)("p",{className:"flex items-start gap-1.5 text-[11px] text-amber-600 dar
1k:text-amber-500",children:[(0,t.jsx)(i.TriangleAlert,{className:"size-3 mt-px shrink-0"}),(0,t.jsxs)("span",{children:["Empty for this person, so it sends as a gap:"," ",o.missing_variables.map(e=>`{{${e}}}`).join(", ")]})]}):null,r.map(n=>{let a=e.config?.[n]??"",r=s[n]??a,i="subject"!==n;return q?(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(d.Label,{className:"text-[11px] capitalize text-muted-foreground",children:n.replace("_"," ")}),(0,t.jsx)("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm whitespace-pre-wrap min-h-8",children:o?.rendered[n]||(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"empty"})})]},n):(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(d.Label,{className:"text-[11px] capitalize text-muted-foreground",children:n.replace("_"," ")}),i?(0,t.jsx)(m.Textarea,{variant:"default",value:r,onChange:t=>B(e.id,n,t.target.value),rows:"body"===n?5:3,className:"text-sm"}):(0,t.jsx)(u.Input,{variant:"default",value:r,onChange:t=>B(e.id,n,t.target.value),className:"text-sm"})]},n)})]},e.id)})]})})]}),(0,t.jsxs)(o.DialogFooter,{className:"px-5 py-3 border-t sm:justify-between",children:[(0,t.jsxs)(c.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>$(e=>!e),disabled:0===C.length,children:[(0,t.jsx)(r.Eye,{className:"size-3.5 mr-1.5"}),q?"Back to editing":"Preview merged"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(c.Button,{type:"button",variant:"outline",onClick:()=>y(!1),children:"Cancel"}),(0,t.jsx)(c.Button,{type:"button",onClick:W,disabled:U,children:U?"Savingâ¦":N})]})]})]})})}])},750791,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(846696),r=e.i(37727),s=e.i(867299),i=e.i(59377),l=e.i(753751),o=e.i(994179),c=e.i(167881),d=e.i(788699),u=e.i(217437),m=e.i(728231),h=e.i(667379);e.s(["SequenceEnrollPicker",0,function({children:e,contactIds:p=[],onEnrolled:f,align:x="start",tooltip:g,successMessage:v,resolveContactIds:y,contacts:w}){let[j,k]=(0,n.useState)(!1),[b,_]=(0,n.useState)([]),[N,C]=(0,n.useState)(!1),[S,E]=(0,n.useState)(null),[T,M]=(0,n.useState)(null),I=!y&&p.length>0,P=w&&w.length>0?w:p.map(e=>({id:e,name:"This person"}));async function L(e,t){if((0!==p.length||y)&&!S){E(e);try{let n=p;if(y&&(k(!1),n=await y(),0===n.length))return void a.toast.error("Nothing was added to the sequence");let r=await fetch(`/api/sequences/${e}/enroll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contact_ids:n,...t&&Object.keys(t).length>0?{per_contact_overrides:t}:{}})});if(!r.ok){let e=await r.json();throw Error(e.error||"Failed to enroll")}let s=await r.json(),i=b.find(t=>t.id===e);a.toast.success(v?v({sequenceName:i?.name??"sequence",enrolled:s.enrolled??0,skipped:s.skipped??0,total:n.length}):s.message||"Added to sequence"),k(!1),f?.()}catch(e){a.toast.error(e instanceof Error?e.message:"Failed to add")}finally{E(null)}}}return(0,n.useEffect)(()=>{j&&(C(!0),fetch("/api/sequences").then(e=>e.json()).then(e=>{_(e.filter(e=>"active"===e.status))}).catch(()=>{}).finally(()=>C(!1)))},[j]),(0,t.jsxs)(i.Popover,{open:j,onOpenChange:k,children:[g?(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(i.PopoverTrigger,{asChild:!0,children:e})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",children:g})]}):(0,t.jsx)(i.PopoverTrigger,{asChild:!0,children:e}),(0,t.jsx)(i.PopoverContent,{className:"w-72 p-0",align:x,sideOffset:6,children:(0,t.jsxs)(l.Command,{children:[(0,t.jsxs)("div",{className:"flex items-center border-b pr-1",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(l.CommandInput,{placeholder:"Search sequences...",className:"border-0"})}),(0,t.jsx)("button",{type:"button",onClick:()=>k(!1),className:"sm:hidden squircle p-1.5 text-muted-foreground hover:bg-muted","aria-label":"Close",children:(0,t.jsx)(r.X,{className:"size-4"})})]}),(0,t.jsx)(l.CommandList,{className:"max-h-64",children:N?(0,t.jsx)("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loadingâ¦"}):0===b.length?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1.5 py-6 px-3 text-center",children:[(0,t.jsx)(s.SequencesIcon,{className:"h-6 w-6 text-muted-foreground"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"No active sequences"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.CommandEmpty,{children:"No sequences found."}),(0,t.jsx)(l.CommandGroup,{children:b.map(e=>{let n=e.tags?.[0],a=e.owner?.full_name||e.owner?.email||"",r=a[0]?.toUpperCase(),s=!!(e.owner?.avatar_url||r);return(0,t.jsxs)(l.CommandItem,{value:`${e.name} ${n?.name??""} ${e.id}`,disabled:null!==S,onSelect:()=>L(e.id),className:"gap-2",children:[(0,t.jsx)(h.SequenceIcon,{icon_url:e.icon_url,icon_key:e.icon_key,icon_color:e.icon_color,size:28}),(0,t.jsx)("span",{className:"truncate text-sm flex-1 min-w-0",children:e.name}),n&&(0,t.jsxs)(o.Badge,{variant:"outline",className:"shrink-0 border-border bg-card px-1.5 py-0 text-[10px] font-normal gap-1",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full shrink-0",style:{backgroundColor:n.color}}),n.name]}),s&&(0,t.jsx)("div",{className:"flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted",children:e.owner?.avatar_url?(0,t.jsx)("img",{src:e.owner.avatar_url,alt:"",className:"size-full object-cover"}):(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground",children:r})}),I&&(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"size-5 shrink-0 text-muted-foreground",title:"Edit the copy before adding them",onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),k(!1),M(e)},children:(0,t.jsx)(d.Pencil,{className:"size-3"})})]},e.id)})})]})})]})}),T&&(0,t.jsx)(u.PersonalizeSequenceDialog,{open:!0,onOpenChange:e=>{e||M(null)},sequenceId:T.id,sequenceName:T.name,targets:P,confirmLabel:"Add to sequence",onConfirm:async e=>{await L(T.id,e),M(null)}})]})}])},922083,e=>{"use strict";var t=e.i(843476),n=e.i(955194);e.i(362623);var a=e.i(476819),r=e.i(647163);let s=59.2525/64;function i({size:e,dot:t=10,gap:n=2,offset:a}){let r=a??e*s+t/2-e,l=e+r-t/2;return{dot:t,gap:n,offset:r,cx:l,cy:l,r:t/2+n}}e.s(["PresenceDot",0,function({online:e,className:n,...s}){let{dot:l,offset:o}=i(s);return(0,t.jsx)("span",{title:e?"Active now":"Offline",className:(0,r.cn)("pointer-events-none absolute rounded-full",e?"bg-success":"bg-muted-foreground
1/40",n),style:{width:(0,a.designPx)(l),height:(0,a.designPx)(l),right:(0,a.designPx)(-o),bottom:(0,a.designPx)(-o)}})},"presenceNotch",0,function(e){let{size:t}=e,{cx:a,cy:r,r:s}=i(e),l=s/t*100,o=`radial-gradient(ellipse ${l}% ${l}% at ${a/t*100}% ${r/t*100}%, transparent 99%, #000 100%)`,c=`${n.SQUIRCLE_MASK}, ${o}`;return{WebkitMaskImage:c,maskImage:c,WebkitMaskPosition:"0 0, 0 0",maskPosition:"0 0, 0 0",WebkitMaskSize:"100% 100%, 100% 100%",maskSize:"100% 100%, 100% 100%",WebkitMaskRepeat:"no-repeat, no-repeat",maskRepeat:"no-repeat, no-repeat",WebkitMaskComposite:"source-in",maskComposite:"intersect",overflow:"visible"}}])},723987,e=>{"use strict";var t=e.i(843476),n=e.i(271645);let a=(0,n.createContext)(null);e.s(["ChatHeaderSlot",0,function(){let e=(0,n.useContext)(a);return e?(0,t.jsx)("span",{ref:e.setEl,className:"contents"}):null},"ChatHeaderSlotProvider",0,function({children:e}){let[r,s]=(0,n.useState)(null),i=(0,n.useMemo)(()=>({el:r,setEl:s}),[r]);return(0,t.jsx)(a.Provider,{value:i,children:e})},"useChatHeaderSlot",0,function(){return(0,n.useContext)(a)?.el??null}])},92375,e=>{"use strict";var t=e.i(271645);let n=new Map;e.s(["useEmailStatuses",0,function(e){let[a,r]=(0,t.useState)({}),[s,i]=(0,t.useState)(!1),l=(0,t.useRef)("");return(0,t.useEffect)(()=>{let t=e.map(e=>e.trim().toLowerCase()).filter(e=>e.includes("@"));if(0===t.length)return;let a=t.sort().join(",");if(a===l.current)return;l.current=a;let s=Date.now(),o={},c=[];for(let e of t){let t=n.get(e);t&&s-t.fetchedAt<3e5?o[e]=t.status:c.push(e)}0===c.length?r(o):(i(!0),r(o),fetch("/api/verify-email/batch-check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({emails:c})}).then(e=>e.json()).then(e=>{let t=Date.now(),a={...o};for(let r of e.results||[]){let e=r.status;a[r.email]=e,n.set(r.email,{status:e,fetchedAt:t})}r(a)}).catch(()=>{r(o)}).finally(()=>i(!1)))},[e]),{statuses:a,loading:s}}])},560800,e=>{"use strict";var t=e.i(271645);let n=new Map,a={signatures:[],syncedGmailHtml:null,loaded:!1},r="mail-signatures-updated";function s(e,t){return`${e}:${t||"default"}`}function i(e){let t=n.get(e);return t||(t={state:a,promise:null},n.set(e,t)),t}async function l(e,t){let n=new URLSearchParams({provider:e});t&&n.set("accountId",t);let a=fetch(`/api/mail/signatures?${n}`).then(e=>e.ok?e.json():null).catch(()=>null),r="gmail"===e?fetch(`/api/gmail/signature${t?`?accountId=${encodeURIComponent(t)}`:""}`).then(e=>e.ok?e.json():null).then(e=>e?.signature?.trim()||null).catch(()=>null):Promise.resolve(null),[s,i]=await Promise.all([a,r]);return{signatures:s?.signatures??[],syncedGmailHtml:i,loaded:!0}}function o(e,t,n){let a=i(e);return a.promise||(a.promise=l(t,n).then(e=>(a.state=e,a.promise=null,e))),a.promise}e.s(["notifyMailSignaturesUpdated",0,function(e,t){let a=s(e,t);n.delete(a),n.delete(s(e,null)),window.dispatchEvent(new CustomEvent(r,{detail:{provider:e}}))},"useMailSignatures",0,function(e,a){let l=i(s(e,a)),[c,d]=(0,t.useState)(l.state),u=(0,t.useCallback)(()=>(n.delete(s(e,a)),o(s(e,a),e,a).then(d)),[e,a]);(0,t.useEffect)(()=>{let t=s(e,a),n=i(t);n.state.loaded?d(n.state):o(t,e,a).then(d);let l=n=>{let r=n.detail;r?.provider&&r.provider!==e||o(t,e,a).then(d)};return window.addEventListener(r,l),()=>window.removeEventListener(r,l)},[e,a]);let m=c.signatures.find(e=>e.is_default&&e.html.trim())??null,h=m?.html??c.syncedGmailHtml;return{signatures:c.signatures,syncedGmailHtml:c.syncedGmailHtml,defaultSignature:m,effectiveDefaultHtml:h,loaded:c.loaded,refetch:u}}])},618548,e=>{"use strict";var t=e.i(875704);let n=0;function a(){return!("u"<typeof document)&&"true"===document.documentElement.getAttribute("data-boring-linkedin-ext")}async function r(e,t,n){let a;try{let n=await fetch("/api/linkedin/tunnel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,args:t})});if(!n.ok){let e=await n.json().catch(()=>({}));return{ok:!1,error:e.error||`tunnel enqueue HTTP ${n.status}`}}let r=await n.json();if(!r.id)return{ok:!1,error:"tunnel enqueue returned no id"};a=r.id}catch(e){return{ok:!1,error:e instanceof Error?e.message:"tunnel enqueue failed"}}let r=Date.now(),s=600;for(;Date.now()-r<n;){await new Promise(e=>setTimeout(e,s)),s=Math.min(1.2*s,2500);try{let e=await fetch(`/api/linkedin/tunnel?id=${encodeURIComponent(a)}`);if(!e.ok)continue;let t=await e.json();if("completed"===t.status)return t.result??{ok:!0,data:void 0};if("failed"===t.status||"skipped"===t.status)return{ok:!1,error:t.error||`tunnel ${t.status}`}}catch{}}return{ok:!1,error:"tunnel timeout - is your desktop extension running?"}}function s(e,i={},l=3e4){return a()?new Promise(a=>{let s=(n=n+1&0x7fffffff,`${Date.now().toString(36)}-${n.toString(36)}`),o=setTimeout(()=>{window.removeEventListener("boring-linkedin-action-response",c),a({ok:!1,error:"extension timeout"})},l);function c(n){let d=n.detail||{};if(d.id!==s)return;if(clearTimeout(o),window.removeEventListener("boring-linkedin-action-response",c),(0,t.isDeadBridgeResponse)(d))return void a(r(e,i,l));let{id:u,...m}=d;a(m)}window.addEventListener("boring-linkedin-action-response",c),window.dispatchEvent(new CustomEvent("boring-linkedin-action",{detail:{id:s,action:e,payload:i}}))}):r(e,i,l)}async function i(e){return e.profileUrn?s("linkedin_posts_for_profile",{profileUrn:e.profileUrn,count:e.count,paginationToken:e.paginationToken,kind:e.kind||"posts"}):e.organizationalPageUrn?s("linkedin_posts_for_company",{organizationalPageUrn:e.organizationalPageUrn,count:e.count,paginationToken:e.paginationToken,moduleKey:e.moduleKey}):{ok:!1,error:"must pass profileUrn or organizationalPageUrn"}}e.s(["commentOnLinkedInPost",0,function(e){return s("linkedin_post_comment",e)},"composeLinkedInPost",0,function(e){return s("linkedin_compose_post",e,2e4)},"createLinkedInPost",0,function(e){return s("linkedin_create_post",e,3e4)},"deleteLinkedInComment",0,function(e){return s("linkedin_post_delete_comment",e)},"editLinkedInComment",0,function(e){return s("linkedin_edit_comment",e)},"editLinkedInPost",0,function(e){return s("linkedin_edit_post",e,3e4)},"fetchLinkedInCommentReplies",0,function(e){return s("linkedin_comment_replies",e)},"fetchLinkedInPostComments",0,function(e){return s("linkedin_post_comments",e)},"fetchLinkedInPostReactions",0,function(e){return s("linkedin_post_reactions",e)},"fetchLinkedInPosts",0,i,"getOwnLinkedInUrn",0,function(){return s("linkedin_get_own_urn",{},15e3)}
1,"isExtensionInstalled",0,a,"reactToLinkedInPost",0,function(e){return s("linkedin_post_react",e)},"syncSharedCommentsRaw",0,function(e){return s("linkedin_sync_shared_comments",e,9e4)},"triggerSocialPostsSync",0,function(){return s("social_posts_sync_now",{},5e3)},"unreactLinkedInPost",0,function(e){return s("linkedin_post_unreact",e)}])},182082,e=>{"use strict";var t=e.i(271645),n=e.i(395913),a=e.i(104401);e.s(["useExtensionStatus",0,function(){let[e,r]=(0,t.useState)(()=>(0,n.isExtensionInstalled)()),[s,i]=(0,t.useState)(!1),[l,o]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{let e=!1;return(async()=>{let[t,s]=await Promise.all([(0,n.isExtensionInstalled)()?Promise.resolve(!0):(0,n.waitForExtension)(3e3),(0,a.hasDesktopExtension)()]);e||(r(t),i(s),o(!1))})(),()=>{e=!0}},[]),{localInstalled:e,desktopInstalled:s,available:e||s,loading:l}}])},969878,e=>{"use strict";var t=e.i(271645);let n=new Set;e.s(["useScrollPinBottom",0,function(e,a,r,s){let[i,l]=(0,t.useState)(()=>null!=s&&n.has(s));return(0,t.useLayoutEffect)(()=>{let t=e.current;if(!t)return;t.scrollTop=t.scrollHeight;let n=requestAnimationFrame(()=>{let t=e.current;t&&(t.scrollTop=t.scrollHeight),requestAnimationFrame(()=>{let t=e.current;t&&(t.scrollTop=t.scrollHeight)})});return()=>cancelAnimationFrame(n)},[e,s]),(0,t.useEffect)(()=>{let t=null!=s&&n.has(s),r=e.current,i=a.current,o=e=>{e.scrollTop=e.scrollHeight};if(t){r&&(o(r),requestAnimationFrame(()=>{r&&o(r)}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{r&&o(r)})})),l(!0);return}if(l(!1),!r||!i)return void l(!0);let c=!1,d=!1,u=()=>{r.scrollTop=r.scrollHeight},m=()=>{if(c||d)return;d=!0,u();let e=!1,t=()=>{c||e||(e=!0,u(),h.disconnect(),null!=s&&n.add(s),l(!0))};requestAnimationFrame(t),setTimeout(t,150)},h=new ResizeObserver(u);h.observe(i),h.observe(r);let p=setTimeout(m,4e3),f=(e,t)=>new Promise(n=>{let a=()=>{e.removeEventListener(t,a),e.removeEventListener("error",a),n()};e.addEventListener(t,a,{once:!0}),e.addEventListener("error",a,{once:!0})}),x=e=>{let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();return n.bottom>=t.top-300&&n.top<=t.bottom+300},g=()=>({imgs:Array.from(i.querySelectorAll("img")).filter(e=>!e.complete&&("lazy"!==e.loading||x(e))),vids:Array.from(i.querySelectorAll("video")).filter(e=>e.readyState<1&&!!e.currentSrc&&x(e))}),v=g();if(0===v.imgs.length&&0===v.vids.length)u(),m();else{let e=async()=>{let e=0;for(;!c&&e<2;){let{imgs:t,vids:n}=g();if(0===t.length&&0===n.length){e++,await new Promise(e=>setTimeout(e,80));continue}e=0,await Promise.race([Promise.all([...t.map(e=>f(e,"load")),...n.map(e=>f(e,"loadedmetadata"))]),new Promise(e=>setTimeout(e,250))])}c||m()};u(),e()}return()=>{c=!0,h.disconnect(),clearTimeout(p)}},[e,a,s]),i}])},831377,e=>{"use strict";var t=e.i(271645);e.s(["useSwipeReply",0,function(e,{threshold:n=60,maxDrag:a=80}={}){let r=(0,t.useRef)(null),s=(0,t.useRef)(null),[i,l]=(0,t.useState)(0),[o,c]=(0,t.useState)(!1),[d,u]=(0,t.useState)(!1),m=(0,t.useCallback)(t=>{if(!e)return;let n=t.touches[0];r.current={x:n.clientX,y:n.clientY},s.current=null,u(!1)},[e]),h=(0,t.useCallback)(t=>{if(!r.current||!e)return;let n=t.touches[0],i=n.clientX-r.current.x,o=n.clientY-r.current.y;if(!s.current){(Math.abs(i)>10||Math.abs(o)>10)&&(s.current=Math.abs(o)>Math.abs(i)?"vertical":"horizontal");return}if("vertical"===s.current)return;let d=Math.max(0,Math.min(a,i));l(d),c(d>0)},[e,a]),p=(0,t.useCallback)(()=>{r.current&&(r.current=null,i>=n&&e&&e(),u(!0),l(0),c(!1),setTimeout(()=>u(!1),200))},[i,n,e]);return{onTouchStart:m,onTouchMove:h,onTouchEnd:p,style:{transform:i>0?`translateX(${i}px)`:void 0,transition:d?"transform 0.2s ease-out":void 0},swipeProgress:Math.min(1,i/n),isSwiping:o}}])},362623,e=>{"use strict";var t=e.i(271645),n=e.i(476819);e.s(["useUiScale",0,function(){let[e,a]=(0,t.useState)(1);return(0,t.useEffect)(()=>{let e=()=>a((0,n.currentUiScale)());return e(),window.addEventListener("ui-unit-change",e),window.addEventListener("resize",e),()=>{window.removeEventListener("ui-unit-change",e),window.removeEventListener("resize",e)}},[]),e}])},109688,e=>{"use strict";let t=null;e.s(["clearActiveConversation",0,function(e){t===e&&(t=null)},"isWatchingConversation",0,function(e){return t===e&&("u"<typeof document||"visible"===document.visibilityState&&document.hasFocus())},"setActiveConversation",0,function(e){t=e}])},597576,e=>{"use strict";function t(e){return(e??"").trim().split(/\s+/)[0]||""}function n(e,n,a){return e&&a&&e!==a?t(n)||"Teammate":"You"}e.s(["conversationSenderLabel",0,function(e,a){return e.last_sender_is_outbound?n(e.last_sender_user_id,e.last_sender_name,a):t(e.is_group?e.last_sender_name:e.contact_name)},"feedSenderPrefix",0,function(e,t){return e.last_sender_is_outbound?n(e.last_sender_user_id,e.last_sender_name,t):null},"isTeammateSender",0,function(e,t){return!!(e&&t&&e!==t)},"outboundSenderLabel",0,n])},694533,e=>{"use strict";function t(e){return e.trim()}function n(e){let t=e.trim(),n=t.match(/ACo[A-Za-z0-9_-]+/i)?.[0];return n||t.match(/ACw[A-Za-z0-9_-]+/i)?.[0]||null}function a(e){return e.replace(/[-_]/g,"").toLowerCase()}e.s(["extractLinkedinMemberNumericId",0,function(e){let n=t(e).match(/^urn:li:member:(\d+)$/i);
1return n?n[1]:null},"extractLinkedinProfileOpaqueId",0,n,"linkedinUrnsReferToSameEntity",0,function(e,r){let s=t(e),i=t(r);if(!s||!i)return!1;if(s===i)return!0;let l=n(s),o=n(i);return!!l&&!!o&&a(l)===a(o)},"normalizeLinkedinProfileUrnForMatch",0,function(e){if(!e||"string"!=typeof e)return null;let t=e.trim();if(!t)return null;if(/urn:li:fsd_company:/i.test(t)||/urn:li:fs_company:/i.test(t)||/urn:li:organization:/i.test(t))return t;let a=t.match(/^urn:li:fs_miniProfile:([A-Za-z0-9_-]+)$/i);if(a)return`urn:li:fsd_profile:${a[1]}`;let r=t.match(/^urn:li:fs_salesProfile:\(([^)]*)\)/i);if(r){let e=n(r[1].split(",")[0].trim())||n(r[1]);if(e&&(e.startsWith("ACo")||e.startsWith("ACw")))return`urn:li:fsd_profile:${e}`}return t},"personUrnLookupKey",0,function(e){let t=n(e);return t?`opaque:${a(t)}`:null},"trimLinkedinUrn",0,t])},934296,e=>{"use strict";var t=e.i(920755),n=e.i(489681);async function a(e,t=8e3){await Promise.race([r(e),new Promise(e=>setTimeout(e,t))])}async function r(e){try{let a=(0,t.createClient)(),r={id:e.contactId,linkedin_url:e.linkedinUrl,...e.linkedinUrn?{linkedin_urn:e.linkedinUrn}:{},...e.name?{name:e.name}:{},...e.pictureUrl?{image_url:e.pictureUrl}:{}};e.companyKnown&&s(e.contactId,e.linkedinUrl),await (0,n.autoEnrichPerson)(a,e.contactId,{silent:!0,contact:r})&&s(e.contactId,e.linkedinUrl)}catch(e){console.warn("[post-add-enrichment] post-add enrichment failed",e)}}function s(e,t){fetch("/api/enrich-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contactId:e,linkedinUrl:t})}).catch(e=>console.warn("[post-add-enrichment] email enrichment failed",e))}e.s(["triggerPostAddEnrichment",0,r,"waitForPostAddProfile",0,a])},25394,e=>{"use strict";var t=e.i(395913),n=e.i(104401),a=e.i(417955),r=e.i(920755),s=e.i(271645);let i=0,l=new Map,o=new Map,c=null,d=null,u=!1,m=!1,h=new Set,p=null,f=0;function x(){p||(p=setTimeout(()=>{p=null,(0,t.isExtensionInstalled)()&&0!==l.size&&(function(e,t,n=1e4){return new Promise(a=>{let r=`presence-${++f}-${Date.now()}`,s=setTimeout(()=>{window.removeEventListener("boring-linkedin-action-response",i),a({ok:!1})},n);function i(e){let t=e.detail||{};t.id===r&&(clearTimeout(s),window.removeEventListener("boring-linkedin-action-response",i),a(t))}window.addEventListener("boring-linkedin-action-response",i),window.dispatchEvent(new CustomEvent("boring-linkedin-action",{detail:{id:r,action:e,payload:t}}))})})("linkedin_presence_subscribe",{profileUrns:[...l.keys()]}).then(e=>{m=!!e?.live})},250))}function g(e){let t=e.detail;if(t)if("linkedinSSEEvent"===t.action&&t.data?.type==="presence_update"){let{profileUrn:e,availability:n}=t.data;if("string"!=typeof e||!e||!n)return;m=!0,h.delete(e),v(e,"ONLINE"===n?"online":"offline")}else if("linkedinSSEDisconnect"===t.action)for(let e of(m=!1,l.keys()))h.add(e);else"linkedinSSEConnected"===t.action&&(x(),w())}function v(e,t){o.set(e,t);let n=l.get(e);if(n)for(let e of[...n])e(t)}async function y(){if(u||0===l.size||"u">typeof document&&document.hidden)return;let e=(0,t.isExtensionInstalled)()||(0,t.hasNativeLinkedInProxy)();if(!e){if(!await (0,n.hasDesktopExtension)())return;let e=Date.now()-i>=6e4,t=[...l.keys()].some(e=>h.has(e));if(!e&&!t)return}let r=m?[...l.keys()].filter(e=>h.has(e)):[...l.keys()];if(0!==r.length){u=!0,e||(i=Date.now());try{let e=await (0,a.fetchPresenceStatuses)(r);for(let t of r){h.delete(t);let n=e.get(t);n&&v(t,"ONLINE"===n.availability?"online":"offline")}}catch{}finally{u=!1}}}function w(){d||(d=setTimeout(()=>{d=null,y()},250))}function j(){document.hidden||w()}let k=new Map,b=0,_=new Set;function N(e){return _.add(e),()=>_.delete(e)}e.s(["useLinkedInParticipantUrns",0,function(e){let t=e.join("\n");(0,s.useEffect)(()=>{let e=(t?t.split("\n"):[]).filter(e=>e&&!k.has(e));if(0===e.length)return;let n=!1;return(0,r.createClient)().from("linkedin_conversations").select("id, participant_linkedin_urn").in("id",e).then(({data:t})=>{if(!n){for(let t of e)k.set(t,null);for(let e of t??[])e.participant_linkedin_urn&&k.set(e.id,e.participant_linkedin_urn);for(let e of(b+=1,[..._]))e()}}),()=>{n=!0}},[t]);
1let n=(0,s.useSyncExternalStore)(N,()=>b,()=>0);return(0,s.useMemo)(()=>{let e={};for(let n of t?t.split("\n"):[]){let t=k.get(n);t&&(e[n]=t)}return e},[t,n])},"useLinkedInPresence",0,function(e){let t=(0,s.useCallback)(t=>(function(e,t){if(!e)return()=>{};let n=l.get(e);n||(n=new Set,l.set(e,n),h.add(e),x()),n.add(t);let a=o.get(e);a&&t(a),c||(c=setInterval(()=>void y(),3e4),document.addEventListener("visibilitychange",j),window.addEventListener("boring-linkedin-sse-event",g)),w();let r=!1;return()=>{if(r)return;r=!0;let n=l.get(e);n&&(n.delete(t),0===n.size&&(l.delete(e),h.delete(e))),0===l.size&&c&&(clearInterval(c),c=null,document.removeEventListener("visibilitychange",j),window.removeEventListener("boring-linkedin-sse-event",g))}})(e,t),[e]),n=(0,s.useCallback)(()=>e?o.get(e)??null:null,[e]);return(0,s.useSyncExternalStore)(t,n,()=>null)}])},48589,e=>{"use strict";function t(e){return(e||"").trim().split(/\s+/)[0]||""}e.s(["preferredFirstName",0,function(e){let n=e.nickname?.trim();if(n)return n;let a=e.firstName?.trim();return a||t(e.fullName)},"replyDisplayName",0,function(e){let n=e.nickname?.trim();if(n)return n;let a=e.firstName?.trim();if(a)return t(a);let r=t(e.fullName);if(r)return r;let s=e.email?.trim();return s?.includes("@")?s.split("@")[0]:s||""}])},734531,e=>{"use strict";let t={send_email:{reads:["subject","body"],requires:["body"]},reply_email:{reads:["subject","body"],requires:["body"]},manual_email:{reads:["subject","body"]},manual_reply_email:{reads:["subject","body"]},linkedin_connect:{reads:["connection_note"]},linkedin_profile_view:{reads:["message","body"]},linkedin_message:{reads:["message"],requires:["message"]},linkedin_inmail:{reads:["subject","message"]},linkedin_voice_note:{reads:["message"],requires:["media_url"]},linkedin_video:{reads:["message"],requires:["media_url"]},linkedin_post:{reads:["content_template","body"],requires:["content_template","body"]},linkedin_post_comment:{reads:["message","body"]},linkedin_post_react:{reads:[]},x_dm:{reads:["message"],requires:["message"]},x_follow:{reads:[]},x_post:{reads:["content_template","body"],requires:["content_template","body"]},x_post_reply:{reads:["message","body"]},x_post_like:{reads:[]},x_post_repost:{reads:[]},reddit_dm:{reads:["subject","content_template"]},reddit_post:{reads:["content_template"]},reddit_comment:{reads:["content_template"]},reddit_upvote:{reads:[]},send_whatsapp:{reads:["message"],requires:["message"]},send_sms:{reads:["message"],requires:["message"]},send_message:{reads:["message"],requires:["message"]},manual_whatsapp:{reads:["message"]},whatsapp_voice_note:{reads:["message"]},whatsapp_video:{reads:["message"]},call:{reads:["message","body"]},custom:{reads:["message","body"]},delay:{reads:[]},condition:{reads:[]}},n=["subject","body","message","connection_note"];e.s(["getStepContentFields",0,function(e){let a=t[e];if(!a)return[];let r=new Set(a.reads);return n.filter(e=>r.has(e))}])},533377,e=>{"use strict";var t=e.i(263488),n=e.i(740573),a=e.i(551348),r=e.i(514764),s=e.i(686311),i=e.i(343432),l=e.i(656272),o=e.i(503116),c=e.i(955716),d=e.i(387951),u=e.i(278716),m=e.i(931091),h=e.i(194983),p=e.i(981997),f=e.i(790597),x=e.i(102008),g=e.i(257995),v=e.i(975558),y=e.i(286536),w=e.i(283086),j=e.i(459648),k=e.i(400236);let b={send_email:{value:"send_email",label:"New Email",icon:t.Mail,channel:"email",defaultMode:"automatic",color:"#EA4335"},manual_email:{value:"manual_email",label:"New Email",icon:n.MailOpen,channel:"email",defaultMode:"manual",color:"#EA4335"},reply_email:{value:"reply_email",label:"Reply Email",icon:t.Mail,channel:"email",defaultMode:"automatic",color:"#EA4335"},manual_reply_email:{value:"manual_reply_email",label:"Reply Email",icon:n.MailOpen,channel:"email",defaultMode:"manual",color:"#EA4335"},linkedin_connect:{value:"linkedin_connect",label:"LinkedIn Connection",icon:j.AddPersonIcon,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_withdraw:{value:"linkedin_withdraw",label:"Withdraw Connection",icon:k.RemovePersonIcon,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_profile_view:{value:"linkedin_profile_view",label:"View Profile",icon:y.Eye,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_message:{value:"linkedin_message",label:"LinkedIn Message",icon:a.Linkedin,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_inmail:{value:"linkedin_inmail",label:"LinkedIn InMail",icon:a.Linkedin,channel:"linkedin",defaultMode:"manual",color:"#0A66C2"},linkedin_voice_note:{value:"linkedin_voice_note",label:"LinkedIn Voice Note",icon:d.Mic,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_video:{value:"linkedin_video",label:"LinkedIn Video",icon:u.Video,channel:"linkedin",defaultMode:"automatic",color:"#0A66C2"},linkedin_post:{value:"linkedin_post",label:"LinkedIn Post",icon:m.Megaphone,channel:"linkedin",defaultMode:"manual",color:"#0A66C2"},linkedin_post_comment:{value:"linkedin_post_comment",label:"Comment on Post",icon:h.MessageCircle,channel:"linkedin",defaultMode:"manual",color:"#0A66C2"},linkedin_post_react:{value:"linkedin_post_react",label:"React to Post",icon:f.Heart,channel:"linkedin",defaultMode:"manual",color:"#0A66C2"},x_dm:{value:"x_dm",label:"X Message (DM)",icon:g.AtSign,channel:"x",defaultMode:"automatic",color:"#0F1419"},x_follow:{value:"x_follow",label:"X Follow",icon:j.AddPersonIcon,channel:"x",defaultMode:"automatic",color:"#0F1419"},x_post:{value:"x_post",label:"X Post",icon:m.Megaphone,channel:"x",defaultMode:"manual",color:"#0F1419"},x_post_reply:{value:"x_post_reply",label:"Reply to X Post",icon:h.MessageCircle,channel:"x",defaultMode:"manual",color:"#0F1419"},x_post_like:{value:"x_post_like",label:"Like X Post",icon:f.Heart,channel:"x",defaultMode:"manual",color:"#0F1419"},x_post_repost:{value:"x_post_repost",label:"Repost on X",icon:x.Repeat2,channel:"x",defaultMode:"manual",color:"#0F1419"},reddit_dm:{value:"reddit_dm",label:"Reddit Message (PM)",icon:g.AtSign,channel:"reddit",defaultMode:"manual",color:"#FF4500"},reddit_post:{value:"reddit_post",label:"Reddit Post",icon:m.Megaphone,channel:"reddit",defaultMode:"manual",color:"#FF4500"},reddit_comment:{value:"reddit_comment",label:"Comment on Post",icon:h.MessageCircle,channel:"reddit",defaultMode:"manual",color:"#FF4500"},reddit_upvote:{value:"reddit_upvote",label:"Upvote Post",icon:v.ArrowUp,channel:"reddit",defaultMode:"manual",color:"#FF4500"},send_whatsapp:{value:"send_whatsapp",label:"WhatsApp Message",icon:r.Send,channel:"whatsapp",defaultMode:"automatic",color:"#25D366"},manual_whatsapp:{value:"manual_whatsapp",label:"WhatsApp Message",icon:r.Send,channel:"whatsapp",defaultMode:"manual",color:"#25D366"},whatsapp_voice_note:{value:"whatsapp_voice_note",label:"WhatsApp Voice Note",icon:d.Mic,channel:"whatsapp",defaultMode:"manual",color:"#25D366"},whatsapp_video:{value:"whatsapp_video",label:"WhatsApp Video",icon:u.Video,channel:"whatsapp",defaultMode:"manual",color:"#25D366"},send_sms:{value:"send_sms",label:"Send SMS",icon:s.MessageSquare,channel:"phone",defaultMode:"automatic",color:"#10B981"},send_message:{value:"send_message",label:"Send iMessage/SMS",icon:p.MessagesSquare,channel:"phone",defaultMode:"automatic",color:"#0B84FF"},call:{value:"call",label:"Call",icon:i.Phone,channel:"phone",defaultMode:"manual",color:"#F59E0B"},custom:{value:"custom",label:"Custom Task",icon:l.CheckSquare,channel:"other",defaultMode:"manual",color:"#8B5CF6"},delay:{value:"delay",label:"Wait / Delay",icon:o.Clock,channel:"other",defaultMode:"automatic",color:"#6B7280"},ai_step:{value:"ai_step",label:"Ask the Agent",icon:w.Sparkles,channel:"other",defaultMode:"automatic",color:"#A855F7"},condition:{value:"condition",label:"Condition",icon:c.GitBranch,channel:"other",defaultMode:"automatic",color:"#F97316"}},_=["send_email","reply_email","linkedin_connect","linkedin_withdraw","linkedin_profile_view","linkedin_message","linkedin_voice_note","linkedin_video","linkedin_post_comment","linkedin_post_react","x_dm","x_follow","x_post_reply","x_post_like","x_post_repost","reddit_dm","reddit_comment","reddit_upvote","send_whatsapp","whatsapp_voice_note","whatsapp_video","send_message","send_sms","call","custom","delay","ai_step","condition"],N=["linkedin_post","linkedin_post_comment","linkedin_post_react","x_post","x_post_reply","x_post_like","x_post_repost","reddit_post","reddit_comment","reddit_upvote","delay"],C=["linkedin_connect","linkedin_withdraw","linkedin_profile_view","linkedin_message","linkedin_voice_note","linkedin_video","linkedin_post","linkedin_post_comment","linkedin_post_react","x_dm","x_follow","x_post","x_post_reply","x_post_like","x_post_repost","reddit_comment","reddit_upvote"];e.s(["STEP_TYPE_CONFIG",0,b,"STEP_TYPE_PAIRS",0,{send_email:"manual_email",manual_email:"send_email",reply_email:"manual_reply_email",manual_reply_email:"reply_email",send_whatsapp:"manual_whatsapp",manual_whatsapp:"send_whatsapp"},"formatDelay",0,function(e){if(e<60)return`${e}m`;if(e<1440){let t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}let t=Math.floor(e/1440),n=Math.floor(e%1440/60);return n>0?`${t}d ${n}h`:`${t}d`},"paletteForKind",0,function(e){return"linkedin_engagement"===e?N:_},"requiresOwnExtension",0,function(e){return C.includes(e)}])},488854,e=>{"use strict";var t=e.i(271645),n=e.i(920755);let a=new Map;async function r(e,t){let a=(0,n.createClient)(),{data:r}=await a.from("profiles").select("email").eq("workspace_id",e),s=new Set((r??[]).map(e=>e.email?.toLowerCase()).filter(e=>!!e)),{data:i}=await a.from("slack_messages").select("conversation_id, sender_slack_id").in("conversation_id",t).eq("is_outbound",!1).not("sender_slack_id","is",null).order("sent_at",{ascending:!1}).limit(2e3),l=new Map,o=new Set;for(let e of i??[]){if(!e.sender_slack_id)continue;let t=l.get(e.conversation_id)??[];
1t.includes(e.sender_slack_id)||t.push(e.sender_slack_id),l.set(e.conversation_id,t),o.add(e.sender_slack_id)}let c=new Map,d=[...o];if(d.length>0){let{data:t}=await a.from("slack_user_contacts").select("slack_user_id, email, contact:contacts!inner(email, company:companies!contacts_company_id_fkey(id, name, logo_url, domain))").eq("workspace_id",e).in("slack_user_id",d);for(let e of t??[]){let t=Array.isArray(e.contact)?e.contact[0]:e.contact,n=(e.email||t?.email||"").toLowerCase();if(n&&s.has(n))continue;let a=t?.company,r=Array.isArray(a)?a[0]:a;r?.id&&c.set(e.slack_user_id,{id:r.id,name:r.name,logoUrl:r.logo_url,domain:r.domain})}}let{data:u}=await a.from("slack_conversations").select("id, company_id").in("id",t),m=[...new Set((u??[]).map(e=>e.company_id).filter(e=>!!e))],h=new Map;if(m.length>0){let{data:e}=await a.from("companies").select("id, name, logo_url, domain").in("id",m);for(let t of e??[])h.set(t.id,{name:t.name,logoUrl:t.logo_url,domain:t.domain})}let p={};for(let e of t){let t=new Set,n=[];for(let a of l.get(e)??[]){let e=c.get(a);!e||t.has(e.id)||(t.add(e.id),n.push({name:e.name,logoUrl:e.logoUrl,domain:e.domain}))}if(0===n.length){let t=(u??[]).find(t=>t.id===e),a=t?.company_id?h.get(t.company_id):void 0;a&&n.push(a)}n.length>0&&(p[e]=n.slice(0,3))}return p}e.s(["useSlackGroupCompanies",0,function(e,n){let s=[...new Set(n.filter(Boolean))].sort().join(","),i=e&&s?`${e}:${s}`:"",[l,o]=(0,t.useState)(()=>i?a.get(i)??{}:{});return(0,t.useEffect)(()=>{if(!i)return void o({});let t=a.get(i);t&&o(t);let n=!1;return r(e,s.split(",")).then(e=>{n||(a.set(i,e),o(e))}),()=>{n=!0}},[e,s,i]),l}])},955194,e=>{"use strict";e.s(["SQUIRCLE_MASK",0,"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' preserveAspectRatio='none'%3E%3Cpath d='M32,0 C43.75,0 49.15,0 53.65,1.44 C58.15,2.88 61.12,5.85 62.56,10.35 C64,14.85 64,20.25 64,32 C64,43.75 64,49.15 62.56,53.65 C61.12,58.15 58.15,61.12 53.65,62.56 C49.15,64 43.75,64 32,64 C20.25,64 14.85,64 10.35,62.56 C5.85,61.12 2.88,58.15 1.44,53.65 C0,49.15 0,43.75 0,32 C0,20.25 0,14.85 1.44,10.35 C2.88,5.85 5.85,2.88 10.35,1.44 C14.85,0 20.25,0 32,0Z' fill='white'/%3E%3C/svg%3E\")"])},193343,e=>{"use strict";var t=e.i(625015),t=t,n=e.i(178583),a=e.i(63804),r=e.i(263488);let s={doc:{kind:"doc",label:"Document",hint:"A doc, opened with this task beside it. For research and anything written.",Icon:n.FileText,openLabel:"Open the doc",createLabel:"Start the doc"},meeting:{kind:"meeting",label:"Meeting",hint:"A calendar event at the time this task is due, with the record on it.",Icon:t.default,openLabel:"Open the calendar",createLabel:"Put it on the calendar"},email:{kind:"email",label:"Email draft",hint:"A draft addressed to the person on this task, waiting in your mail.",Icon:r.Mail,openLabel:"Open your drafts",createLabel:"Start the draft"},plan:{kind:"plan",label:"Plan",hint:"A shared plan, for a task that is really several steps and other people.",Icon:a.ListChecks,openLabel:"Open the plan",createLabel:"Start the plan"}};async function i(e,t){let n=t.title?.trim()||"Untitled task";if("doc"===e){let e=await fetch("/api/docs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n})});if(!e.ok)throw Error("Could not create the doc");let t=await e.json();if(!t.id)throw Error("Could not create the doc");return t.id}if("plan"===e){let e=await fetch("/api/plans",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,description:t.description??null,company_id:t.company_id??null,deal_id:t.deal_id??null,with_default_stages:!0})});if(!e.ok)throw Error("Could not create the plan");let a=await e.json();if(!a.plan?.id)throw Error("Could not create the plan");return a.plan.id}if("meeting"===e){let e=new Date(t.due_at?t.due_at:Date.now()+36e5),a=new Date(e.getTime()+36e5),r=t.contact?.email?[t.contact.email]:[],s=await fetch("/api/calendar/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,description:t.description??void 0,start:e.toISOString(),end:a.toISOString(),attendees:r,addGoogleMeet:!0})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??"Could not create the meeting");return(await s.json()).id??""}let a=t.contact?.email;if(!a)throw Error("This task has no email address to draft to");let r=await fetch("/api/gmail/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:[a],subject:n,content:""})});if(!r.ok)throw Error("Could not create the draft");let s=await r.json();if(!s.draftId)throw Error("Could not create the draft");return s.draftId}e.s(["TASK_OUTPUT_CONFIG",0,s,"TASK_OUTPUT_ORDER",0,["doc","meeting","email","plan"],"createTaskOutput",0,i,"readTaskOutput",0,function(e){var t;let n=e.metadata??{};return{kind:"string"==typeof(t=n.output)&&t in s?n.output:null,id:"string"==typeof n.output_id&&n.output_id?n.output_id:null}},"taskOutputHref",0,function(e,t,n){switch(e){case"doc":return`/docs/${t}`;case"plan":return`/plans/${t}`;case"meeting":{let e=n.due_at?`&date=${n.due_at.slice(0,10)}`:"";return`/calendar?event=${encodeURIComponent(t)}${e}`}case"email":return`/inbox?threadId=${encodeURIComponent(t)}`}}],193343)},340024,e=>{"use strict";e.s(["THREAD_GUTTER_X",0,"px-8"])},257088,e=>{"use strict";e.s(["formatDuration",0,function(e,t,n){if(!e)return null;let a=new Date(e+"T00:00:00"),r=n||!t?new Date:new Date(t+"T00:00:00");
1if(isNaN(a.getTime())||isNaN(r.getTime())||r<a)return null;let s=(r.getFullYear()-a.getFullYear())*12+(r.getMonth()-a.getMonth());if(r.getDate()>=a.getDate()&&(s+=1),s<=0)return"Less than a month";let i=Math.floor(s/12),l=s%12,o=[];return i>0&&o.push(`${i} yr${i>1?"s":""}`),l>0&&o.push(`${l} mo${l>1?"s":""}`),o.join(" ")||"Less than a month"}])},82453,e=>{"use strict";var t=e.i(418196),n=e.i(234662),a=e.i(861643);e.s(["differenceInMinutes",0,function(e,r,s){let i=(0,a.differenceInMilliseconds)(e,r)/n.millisecondsInMinute;return(0,t.getRoundingMethod)(s?.roundingMethod)(i)}])},615629,e=>{"use strict";let t=(0,e.i(475254).default)("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);e.s(["default",0,t])},722915,e=>{"use strict";var t=e.i(615629);e.s(["Archive",()=>t.default])},49310,e=>{"use strict";let t=(0,e.i(475254).default)("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);e.s(["default",0,t])},257995,e=>{"use strict";var t=e.i(49310);e.s(["AtSign",()=>t.default])},626455,135286,e=>{"use strict";var t=e.i(910154);e.s(["BellOff",()=>t.default],626455);var n=e.i(843476),a=e.i(271645),r=e.i(174080),s=e.i(86906),i=e.i(63270);let l="transform 320ms cubic-bezier(0.16, 1, 0.3, 1), opacity 320ms ease-out";function o(e,t=0){let n=Math.max(0,e-t);return`translateX(${8*n}px) translateY(${6*n}px) scale(${1-.025*n}) rotate(${1.5*n}deg)`}function c(e,t=0){let n=Math.max(0,e-t);return`translateX(${-(8*n)}px) translateY(${6*n}px) scale(${1-.025*n}) rotate(${-(1.5*n)}deg)`}function d(e,t=0){return Math.max(0,1-.15*Math.max(0,e-t))}function u({item:e}){let t=e.name||"Unknown";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"px-4 pt-3 pb-2.5 border-b border-border/50",children:(0,n.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,n.jsxs)(i.Avatar,{className:"h-8 w-8 shrink-0",children:[e.imageUrl&&(0,n.jsx)(i.AvatarImage,{src:e.imageUrl}),(0,n.jsx)(i.AvatarFallback,{className:"text-[10px] bg-foreground
1/8 text-foreground/60 font-medium",children:t.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium truncate text-foreground/70",children:t}),e.company&&(0,n.jsx)("p",{className:"text-xs truncate text-muted-foreground/60",children:e.company})]})]})}),(0,n.jsxs)("div",{className:"px-4 pt-3 space-y-2.5 opacity-30",children:[(0,n.jsx)("div",{className:"h-2.5 bg-foreground/8 rounded w-[85%]"}),(0,n.jsx)("div",{className:"h-2.5 bg-foreground/8 rounded w-[70%]"}),(0,n.jsx)("div",{className:"h-2.5 bg-foreground/8 rounded w-[60%]"})]})]})}let m=(0,a.memo)(function({render:e,index:t,item:a,isFront:r,isContent:s}){return s?(0,n.jsx)("div",{className:"flex flex-col flex-1 min-h-0",children:e(t,r)}):(0,n.jsx)(u,{item:a})});e.s(["InboxCardStack",0,function({open:e,items:t,currentIndex:i,onNavigate:u,onClose:h,children:p,onPreload:f,totalCount:x,onArchive:g}){let v,y,w=(0,s.usePaneContainer)(),j=(0,a.useDeferredValue)(i),k=(0,a.useRef)(null),b=(0,a.useRef)(null),_=(0,a.useRef)(null),N=(0,a.useRef)(0),C=(0,a.useRef)(0),S=(0,a.useRef)(null),E=(0,a.useRef)(!1),T=(0,a.useRef)(!1),M=(0,a.useRef)(!1),I=(0,a.useRef)(0),P=(0,a.useRef)(0),L=(0,a.useRef)(!1),A=(0,a.useRef)(i);A.current=i;let R=(0,a.useRef)(t);R.current=t;let q=(0,a.useRef)(u);q.current=u;let $=(0,a.useRef)(g);$.current=g,(0,a.useEffect)(()=>{f&&[i+2,i-2,i+3,i-3,i+4,i-4].filter(e=>e>=0&&e<t.length).forEach(e=>f(e))},[i,t.length,f]),(0,a.useEffect)(()=>{if(!e||w)return;let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[e,w]);let U=(0,a.useCallback)((e,t)=>{let n=k.current;if(!n?.parentElement)return;let a=window.innerWidth,r=t?"transform 0.32s cubic-bezier(.2,.8,.25,1), opacity 0.32s ease-out":"none",s=1-Math.min(.08,Math.abs(e)/a*.12);n.style.transition=r,n.style.transform=0===e?"none":`translateX(${e}px) scale(${s}) rotate(${e/a*6}deg)`,n.style.opacity=0===e?"1":String(1-Math.min(.3,Math.abs(e)/a*.4));let i=Math.min(1,Math.abs(e)/200),l=0===e?null:e<0?"right":"left";n.parentElement.querySelectorAll("[data-behind-card]").forEach(e=>{let t=parseInt(e.dataset.behindCard||"1",10),n=e.dataset.cardSide||"right";e.style.transition=r;let a=l&&n===l,s=a?i:0;e.style.transform="right"===n?o(t,s):c(t,s);let u=l&&!a?1-Math.min(1,1.3*i):1;e.style.opacity=String(d(t,s)*u),e.style.zIndex=String((50-t)*2+ +!!a)})},[]),D=(0,a.useCallback)((e,t)=>{let n=k.current;if(!n)return;let a=window.innerHeight,r=Math.min(1,Math.abs(e)/110);n.style.transition=t?"transform 0.32s cubic-bezier(.2,.8,.25,1), opacity 0.32s ease-out":"none",n.style.transform=0===e?"none":`translateY(${e}px) scale(${1-.06*r})`,n.style.opacity=0===e?"1":String(1-Math.min(.35,Math.abs(e)/(.7*a)))},[]),F=(0,a.useCallback)(()=>{let e=k.current;e&&(e.style.transition="none",e.style.transform="none",e.style.opacity="1",e.parentElement?.querySelectorAll("[data-behind-card]").forEach(e=>{let t=parseInt(e.dataset.behindCard||"1",10),n=e.dataset.cardSide||"right";e.style.transition="none",e.style.transform="right"===n?o(t):c(t),e.style.opacity=String(d(t)),e.style.zIndex=String((50-t)*2)}))},[]);if((0,a.useEffect)(()=>{let t=k.current;if(!t||!e)return;let n=e=>{if(L.current)return;let n=e.touches[0];n.clientX<20||n.clientX>window.innerWidth-20||e.target?.closest?.("[data-swipe-reply]")||e.target?.closest?.("[data-owns-horizontal-swipe]")||(S.current=function(e,t){let n=e;for(;n&&n!==t;){if(n.scrollHeight>n.clientHeight+1){let e=window.getComputedStyle(n).overflowY;if("auto"===e||"scroll"===e)return n}n=n.parentElement}return null}(e.target,t),T.current=function(e){if(!e)return!1;let t=e.closest?.("[data-gmail-reply-area]");if(t){let e=t.querySelector(".ProseMirror");if(e)return""===(e.textContent||"").trim();let n=t.querySelector("textarea");return!(n instanceof HTMLTextAreaElement)||""===n.value.trim()}let n=e.closest?.("[data-swipe-down-origin]");if(n){let e=n.querySelector(".ProseMirror");if(e)return""===(e.textContent||"").trim();let t=n.querySelector("textarea");if(t instanceof HTMLTextAreaElement)return""===t.value.trim();let a=n.querySelector('input[type="text"]');return!(a instanceof HTMLInputElement)||""===a.value.trim()}return!1}(e.target),M.current=function(e){let t=e?.closest?.('textarea, input, [contenteditable=""], [contenteditable="true"], .ProseMirror');if(!t)return!1;let n=document.activeElement;return!!n&&(t===n||t.contains(n))}(e.target),b.current={x:n.clientX,y:n.clientY,t:Date.now()},_.current=null,N.current=0,C.current=0,E.current=!1)},a=e=>{if(!b.current||L.current)return;let t=e.touches[0],n=t.clientX-b.current.x,a=t.clientY-b.current.y;if(!_.current){(Math.abs(n)>10||Math.abs(a)>10)&&(Math.abs(a)>.8*Math.abs(n)?_.current="v":M.current||(_.current="h",I.current=t.clientY));return}let r=R.current[A.current];
1if("h"===_.current&&t.clientY-I.current<-30&&$.current&&r?.archivable&&(cancelAnimationFrame(P.current),U(0,!0),N.current=0,_.current="v",E.current=!0),"v"===_.current){let t=R.current[A.current];if(a<0){if(!$.current||!t?.archivable)return;if(!E.current){let e=S.current;if(e&&e.scrollTop<e.scrollHeight-e.clientHeight-1)return}e.preventDefault(),C.current=a,cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>D(a,!1));return}if(!T.current)return;e.preventDefault(),C.current=a,cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>D(a,!1));return}e.preventDefault();let s=A.current,i=R.current.length,l=n;n>0&&s<=0&&(l=.15*n),n<0&&s>=i-1&&(l=.15*n),N.current=l,cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>U(l,!1))},r=()=>{if(!b.current||L.current)return;let e=b.current.t,n="v"===_.current;if(b.current=null,cancelAnimationFrame(P.current),n){let n=C.current,a=Math.abs(n),r=Date.now()-e,s=R.current[A.current];if(n>0){if(a>=110||r<200&&a>60){if(D(0,!0),C.current=0,"u">typeof navigator&&"function"==typeof navigator.vibrate)try{navigator.vibrate(8)}catch{}if(s?.archivable)document.dispatchEvent(new CustomEvent("email-card-swipe-down-action"));else{let e=t.querySelector("[data-card-status-trigger] button");e?.click()}setTimeout(()=>{L.current=!1},350);return}D(0,!0),C.current=0,setTimeout(()=>{L.current=!1},350);return}if(n<0&&(a>=110||r<200&&a>60)&&$.current&&s?.archivable){L.current=!0;let e=window.innerHeight;t.style.transition=l,t.style.transform=`translateY(-${e+120}px) scale(0.92)`,t.style.opacity="0";let n=t.parentElement;if(n&&n.querySelectorAll("[data-behind-card]").forEach(e=>{let t=parseInt(e.dataset.behindCard||"1",10),n=e.dataset.cardSide||"right";e.style.transition=l,e.style.transform="right"===n?o(Math.max(0,t-1)):c(Math.max(0,t-1)),e.style.opacity=String(d(Math.max(0,t-1)))}),"u">typeof navigator&&"function"==typeof navigator.vibrate)try{navigator.vibrate(12)}catch{}setTimeout(()=>{let e=R.current[A.current],t=e?.archiveId??e?.id;t&&$.current?.(t),L.current=!1},320);return}D(0,!0),C.current=0,setTimeout(()=>{L.current=!1},350);return}let a=N.current,r=Math.abs(a),s=Date.now()-e;if(r>=80||s<200&&r>40){let e=a>0,n=A.current;if(e?n>0:n<R.current.length-1){L.current=!0;let n=window.innerWidth,a=e?.35*n:-(.35*n);t.style.transition="transform 0.3s cubic-bezier(.2,.8,.25,1), opacity 0.3s ease-out",t.style.transform=`translateX(${a}px) scale(0.88) rotate(${a/n*5}deg)`,t.style.opacity="0";let r=t.parentElement;if(r){let t=e?"left":"right";r.querySelectorAll("[data-behind-card]").forEach(e=>{let n=parseInt(e.dataset.behindCard||"1",10),a=e.dataset.cardSide||"right";e.style.transition="transform 0.3s cubic-bezier(.2,.8,.25,1), opacity 0.3s ease-out",a===t&&(e.style.transform="right"===a?o(n-1):c(n-1),e.style.opacity=String(d(n-1)))})}setTimeout(()=>{let t=e?A.current-1:A.current+1;q.current(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{F(),L.current=!1})})})},320);return}}U(0,!0),N.current=0,setTimeout(()=>{L.current=!1},350)};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",r,{passive:!0}),t.addEventListener("touchcancel",r,{passive:!0}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",r),t.removeEventListener("touchcancel",r),cancelAnimationFrame(P.current)}},[e,i,t[i]?.id,U,D,F]),(0,a.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&h()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,h]),!e||!t[i])return null;let z=[];for(let e=-2;e<=3;e++){let n=i+e;n>=0&&n<t.length&&z.push({item:t[n],offset:e})}let O=i>0,B=i<t.length-1;return(0,r.createPortal)((0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-end justify-center",style:{perspective:"1200px"},children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:h}),(y=Math.min(i+1,v=Math.max(t.length,x??0)),v>1?(0,n.jsx)("div",{className:"absolute inset-x-0 top-0 z-[60] flex items-center justify-center pointer-events-none",style:{height:46},children:(0,n.jsxs)("div",{className:"text-xs font-medium text-white/90 bg-black/40 backdrop-blur-sm rounded-full px-2.5 py-1 tabular-nums",children:[y," / ",v]})}):null),(0,n.jsx)("div",{className:"relative w-full",style:{height:"calc(100dvh - 64px + 18px)",marginLeft:8+16*!!O,marginRight:8+24*!!B},children:z.map(({item:e,offset:t})=>{let a=0===t,r=Math.abs(t),s=t<0?"left":"right",l=i+t,u=r<=1||2>=Math.abs(l-j),h=a?"none":"right"===s?o(r):c(r);return(0,n.jsx)("div",{ref:a?k:void 0,...!a?{"data-behind-card":r,"data-card-side":s}:{"data-inbox-card-stack-front":!0},className:`absolute inset-x-0 top-0 rounded-2xl bg-card border border-border overflow-hidden flex flex-col ${a?"shadow-2xl":"shadow-lg pointer-events-none"}`,style:{height:"calc(100dvh - 64px)",transform:h,opacity:a?1:d(r),zIndex:(50-r)*2,transformOrigin:"center center",willChange:r<=1?"transform, opacity":"auto"},children:(0,n.jsx)(m,{render:p,index:l,item:e,isFront:a,isContent:u})},e.id)})})]}),w??document.body)},"useCardStackItems",0,function(e,t){let n=(0,a.useRef)(new Map);return(0,a.useMemo)(()=>{let a=new Map,r=e.map(e=>{let r={id:e.id,name:e.contact_name,imageUrl:e.contact_image_url,company:e.company_name,archivable:t?e.channel===t:void 0,archiveId:e.conversation_ref},s=n.current.get(e.id),i=s&&s.name===r.name&&s.imageUrl===r.imageUrl&&s.company===r.company&&s.archivable===r.archivable&&s.archiveId===r.archiveId?s:r;return a.set(e.id,i),i});return n.current=a,r},[e,t])}],135286)},489853,e=>{"use strict";var t=e.i(690210);e.s(["CalendarDays",()=>t.default])},625015,e=>{"use strict";let t=(0,e.i(475254).default)("calendar-plus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);e.s(["default",0,t])},703708,e=>{"use strict";let t=(0,e.i(475254).default)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);e.s(["default",0,t])},794771,e=>{"use strict";var t=e.i(703708);e.s(["CheckCheck",()=>t.default])},23737,e=>{"use strict";let t=(0,e.i(475254).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},267331,e=>{"use strict";var t=e.i(23737);e.s(["HelpCircle",()=>t.default])},872382,e=>{"use strict";let t=(0,e.i(475254).default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);e.s(["default",0,t])},730896,e=>{"use strict";var t=e.i(872382);e.s(["FileIcon",()=>t.default])},411733,e=>{"use strict";let t=(0,e.i(475254).default)("folder-input",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);e.s(["default",0,t])},289626,e=>{"use strict";var t=e.i(411733);e.s(["FolderInput",()=>t.default])},538550,e=>{"use strict";let t=(0,e.i(475254).default)("forward",[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);e.s(["default",0,t])},199053,e=>{"use strict";var t=e.i(538550);e.s(["Forward",()=>t.default])},68426,e=>{"use strict";let t=(0,e.i(475254).default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);e.s(["default",0,t])},955716,e=>{"use strict";var t=e.i(68426);e.s(["GitBranch",()=>t.default])},554956,e=>{"use strict";let t=(0,e.i(475254).default)("linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);e.s(["default",0,t])},551348,e=>{"use strict";var t=e.i(554956);e.s(["Linkedin",()=>t.default])},372064,e=>{"use strict";let t=(0,e.i(475254).default)("mail-plus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);e.s(["default",0,t])},566408,e=>{"use strict";var t=e.i(372064);e.s(["MailPlus",()=>t.default])},923960,e=>{"use strict";let t=(0,e.i(475254).default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);e.s(["default",0,t])},398361,e=>{"use strict";var t=e.i(923960);e.s(["Maximize2",()=>t.default])},169549,e=>{"use strict";let t=(0,e.i(475254).default)("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]);e.s(["default",0,t])},981997,e=>{"use strict";var t=e.i(169549);e.s(["MessagesSquare",()=>t.default])},756217,e=>{"use strict";let t=(0,e.i(475254).default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);e.s(["default",0,t])},726336,e=>{"use strict";var t=e.i(756217);e.s(["Minimize2",()=>t.default])},413036,e=>{"use strict";let t=(0,e.i(475254).default)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);e.s(["default",0,t])},647780,e=>{"use strict";var t=e.i(413036);e.s(["Palette",()=>t.default])},309789,e=>{"use strict";let t=(0,e.i(475254).default)("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);e.s(["default",0,t])},534158,e=>{"use strict";let t=(0,e.i(475254).default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);e.s(["default",0,t])},503783,e=>{"use strict";let t=(0,e.i(475254).default)("party-popper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);e.s(["default",0,t])},333037,e=>{"use strict";let t=(0,e.i(475254).default)("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);e.s(["default",0,t])},102008,e=>{"use strict";var t=e.i(333037);e.s(["Repeat2",()=>t.default])},664113,e=>{"use strict";let t=(0,e.i(475254).default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",ke
1y:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);e.s(["default",0,t])},329006,e=>{"use strict";var t=e.i(664113);e.s(["Reply",()=>t.default])},587867,e=>{"use strict";let t=(0,e.i(475254).default)("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);e.s(["default",0,t])},497960,e=>{"use strict";var t=e.i(587867);e.s(["Smile",()=>t.default])},576144,e=>{"use strict";let t=(0,e.i(475254).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["default",0,t])},283086,e=>{"use strict";var t=e.i(576144);e.s(["Sparkles",()=>t.default])},300299,e=>{"use strict";let t=(0,e.i(475254).default)("thumbs-up",[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]]);e.s(["default",0,t])},400417,e=>{"use strict";var t=e.i(300299);e.s(["ThumbsUp",()=>t.default])},582458,e=>{"use strict";let t=(0,e.i(475254).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},89128,e=>{"use strict";var t=e.i(582458);e.s(["TriangleAlert",()=>t.default])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.