1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,591160,e=>{"use strict";var t=e.i(843476),a=e.i(271645),n=e.i(846932),r=e.i(88653),i=e.i(996874),s=e.i(259030),l=e.i(735490),o=e.i(427217),d=e.i(867056),c=e.i(91754),u=e.i(171387);function x({media:e,onClose:i}){(0,a.useEffect)(()=>{if(!e)return;function t(e){"Escape"===e.key&&i?.()}document.addEventListener("keydown",t);let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",t),document.body.style.overflow=a}},[e,i]);let s=e?.mimeType||"",l="application/pdf"===s,c=e?.type==="image"||e?.type==="gif"||s.startsWith("image/"),p=e?.type==="video"||s.startsWith("video/"),h=e?.type==="audio"||s.startsWith("audio/"),f=e?.name||e?.url?.split("/").pop()||"Attachment";return(0,t.jsx)(r.AnimatePresence,{children:e&&(0,t.jsxs)(n.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-[110] flex items-center justify-center p-3 sm:p-6",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-md",onClick:i}),(0,t.jsxs)(n.motion.div,{initial:{opacity:0,scale:.96,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:12},transition:{duration:.35,ease:[.25,.46,.45,.94]},className:"relative w-full max-w-5xl max-h-[92vh] flex flex-col rounded-2xl overflow-hidden safe-area-pt safe-area-pb",style:{background:"var(--panel-95)",backdropFilter:"blur(40px)",boxShadow:"0 40px 100px var(--shadow-ambient-2xl), 0 8px 24px var(--shadow-ambient-xl)"},onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-pink-500/60 via-orange-400/60 to-violet-500/60 z-20"}),(0,t.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-4 sm:px-5 py-3 border-b",style:{borderColor:"var(--border-subtle)"},children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-sm font-bold text-gray-900 dark:text-zinc-100 truncate",children:f}),s&&(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-zinc-500 mt-0.5 truncate",children:s})]}),(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"hidden sm:flex w-9 h-9 items-center justify-center rounded-xl transition-all duration-200 hover:scale-105 active:scale-95 flex-shrink-0",style:{background:"rgba(99,102,241,0.10)"},title:"Open in new tab","aria-label":"Open in new tab",children:(0,t.jsx)(u.ArrowTopRightOnSquareIcon,{className:"w-4 h-4",style:{color:"#6366F1"}})}),(0,t.jsx)("a",{href:e.url,download:f,className:"flex w-10 h-10 sm:w-9 sm:h-9 items-center justify-center rounded-xl transition-all duration-200 hover:scale-105 active:scale-95 flex-shrink-0",style:{background:"rgba(16,185,129,0.10)"},title:"Download","aria-label":"Download",children:(0,t.jsx)(d.ArrowDownTrayIcon,{className:"w-4 h-4",style:{color:"#10B981"}})}),(0,t.jsx)("button",{onClick:i,className:"flex w-10 h-10 sm:w-9 sm:h-9 items-center justify-center rounded-xl transition-all duration-200 hover:scale-105 active:scale-95 flex-shrink-0",style:{background:"var(--border-subtle)"},title:"Close","aria-label":"Close preview",children:(0,t.jsx)(o.XMarkIcon,{className:"w-5 h-5 text-gray-500 dark:text-zinc-400"})})]}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex items-center justify-center bg-black/5 overflow-hidden",children:[c&&(0,t.jsx)("img",{src:e.url,alt:f,className:"max-w-full max-h-full object-contain"}),p&&(0,t.jsx)("video",{src:e.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-full"}),h&&(0,t.jsx)("div",{className:"flex items-center justify-center w-full p-8",children:(0,t.jsx)("audio",{src:e.url,controls:!0,className:"w-full max-w-md"})}),l&&(0,t.jsx)("iframe",{src:e.url,title:f,className:"w-full h-full bg-white dark:bg-zinc-950"}),!c&&!p&&!h&&!l&&(0,t.jsx)(m,{name:f,mimeType:s,url:e.url})]})]})]},"preview")})}function m({name:e,mimeType:a,url:n}){let r=(()=>{if(e&&e.includes(".")){let t=e.split(".").pop();if(t&&t.length<=5)return t.toUpperCase()}return a?(a.split("/")[1]||"").split(".").pop().slice(0,5).toUpperCase():"FILE"})();return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center px-6 py-12 text-center max-w-md",children:[(0,t.jsxs)("div",{className:"w-20 h-20 rounded-2xl flex flex-col items-center justify-center mb-4 shadow-sm",style:{background:"linear-gradient(135deg, rgba(139,92,246,0.12), rgba(99,102,241,0.08))",border:"1px solid rgba(139,92,246,0.18)"},children:[(0,t.jsx)(c.DocumentIcon,{className:"w-8 h-8 text-violet-500"}),(0,t.jsx)("span",{className:"text-[9px] font-black tracking-wider text-violet-600 mt-1",children:r})]}),(0,t.jsx)("h3",{className:"text-base font-bold text-gray-900 dark:text-zinc-100 mb-1 break-all",children:e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mb-5",children:"This file type can't be previewed inline. Download it to open in the right app."}),(0,t.jsxs)("a",{href:n,download:e,className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-full text-sm font-semibold text-white transition-all duration-200 hover:scale-105 active:scale-95",style:{background:"linear-gradient(135deg, #F97316, #EC4899)",boxShadow:"0 4px 16px rgba(236,72,153,0.25)"},children:[(0,t.jsx)(d.ArrowDownTrayIcon,{className:"w-4 h-4"}),"Download"]})]})}let p={r:249,g:115,b:22},h={r:254,g:215,b:170},f={r:234,g:88,b:12};function g(e,t,a){return{r:e.r+(t.r-e.r)*a,g:e.g+(t.g-e.g)*a,b:e.b+(t.b-e.b)*a}}function b({cols:e=64,rows:n=32,spacing:r=18,intensity:i=.16,className:s=""}){let l=(0,a.useRef)(null),o=(0,a.useRef)(null),d=(0,a.useRef)(null),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>
1{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let t=l.current,a=o.current;if(!t||!a)return;let s=t.getContext("2d");if(!s)return;let u=Math.min(window.devicePixelRatio||1,2),x=0,m=0;function b(){let e=a.getBoundingClientRect();x=Math.max(1,e.width),m=Math.max(1,e.height),t.width=x*u,t.height=m*u,t.style.width=x+"px",t.style.height=m+"px",s.setTransform(u,0,0,u,0,0)}b();let y=new ResizeObserver(b);return y.observe(a),d.current=requestAnimationFrame(function t(a){c.current||(c.current=a);let l=(a-c.current)/1e3;s.clearRect(0,0,x,m);let o=.5*x,u=.95*m,b=[];for(let t=0;t<n;t++){b[t]=[];for(let a=0;a<e;a++){let n=(a-e/2)*r,i=t*r,s=20*Math.sin(.1*a+.8*l)+12*Math.sin(.08*t+.05*a+.5*l)+8*Math.cos(.03*a+.12*t+.35*l)+6*Math.sin(.07*a+.04*t+.6*l),d=.3153223623952687*i-.9489846193555862*s,c=500/(500+(.9489846193555862*i+.3153223623952687*s+150));b[t][a]={sx:o+n*c,sy:u-d*c,wave:s}}}for(let t=n-2;t>=0;t--)for(let a=0;a<e-1;a++){let r=b[t][a],l=b[t][a+1],o=b[t+1][a+1],d=b[t+1][a],c=Math.max(0,Math.min(1,((r.wave+l.wave+o.wave+d.wave)/4+46)/92)),u=c>.5?g(p,h,(c-.5)*2):g(f,p,2*c),x=Math.abs(a-e/2)/(e/2),m=i*(1-x*x*x)*Math.sin(t/(n-1)*M
1ath.PI*.85);m<.003||(s.beginPath(),s.moveTo(r.sx,r.sy),s.lineTo(l.sx,l.sy),s.lineTo(o.sx,o.sy),s.lineTo(d.sx,d.sy),s.closePath(),s.fillStyle=`rgba(${0|u.r},${0|u.g},${0|u.b},${m})`,s.fill())}d.current=requestAnimationFrame(t)}),()=>{cancelAnimationFrame(d.current),y.disconnect()}},[e,n,r,i]),(0,t.jsx)("div",{ref:o,"aria-hidden":"true",className:`pointer-events-none absolute inset-0 overflow-hidden ${s}`,children:(0,t.jsx)("canvas",{ref:l,style:{position:"absolute",inset:0,width:"100%",height:"100%"}})})}var y=e.i(140713),v=e.i(115200),j=e.i(864043),k=e.i(979259),w=e.i(460759),N=e.i(136604);let C=["â¤ï¸","ð¥","ð","ð","â
","ð","ð","ð¤"];function S({visible:e,isMine:i,onReact:s,onReply:l,onEdit:o,onDelete:d,canEdit:c,canDelete:u,taskTrigger:x,onCopyLink:m}){let[p,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1),v=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(p||b)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){v.current&&!v.current.contains(e.target)&&(h(!1),g(!1),y(!1))}},[p,b]);let j=e||p?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none";return(0,t.jsxs)("div",{ref:v,className:`absolute ${i?"right-0 -top-6":"left-0 -top-6"} flex items-center gap-0.5 z-20 ${j} transition-opacity duration-150`,children:[(0,t.jsx)("button",{onClick:()=>h(e=>!e),className:"w-6 h-6 flex items-center justify-center rounded-full transition-all duration-150 hover:scale-110",style:{background:"var(--surface-panel)",border:"1px solid var(--border-default)",boxShadow:"0 2px 8px var(--border-subtle)"},title:"React",children:(0,t.jsx)(N.FaceSmilePlusIcon,{})}),l&&(0,t.jsx)("button",{onClick:l,className:"w-6 h-6 flex items-center justify-center rounded-full transition-all duration-150 hover:scale-110",style:{background:"var(--surface-panel)",border:"1px solid var(--border-default)",boxShadow:"0 2px 8px var(--border-subtle)"},title:"Reply",children:(0,t.jsx)(N.ReplyIcon,{})}),x,m&&(0,t.jsx)("button",{type:"button",onClick:m,className:"w-6 h-6 flex items-center justify-center rounded-full transition-all duration-150 hover:scale-110",style:{background:"var(--surface-panel)",border:"1px solid rgba(99,102,241,0.18)",boxShadow:"0 2px 8px rgba(99,102,241,0.08)"},title:"Copy share link","aria-label":"Copy link to this message",children:(0,t.jsx)("svg",{className:"w-3 h-3 text-indigo-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 015.656 5.656l-3 3a4 4 0 01-5.656-5.656M10.172 13.828a4 4 0 01-5.656-5.656l3-3a4 4 0 015.656 5.656"})})}),c&&(0,t.jsx)("button",{onClick:o,className:"w-6 h-6 flex items-center justify-center rounded-full transition-all duration-150 hover:scale-110",style:{background:"var(--surface-panel)",border:"1px solid rgba(99,102,241,0.18)",boxShadow:"0 2px 8px rgba(99,102,241,0.08)"},title:"Edit","aria-label":"Edit message",children:(0,t.jsx)(k.PencilIcon,{className:"w-3 h-3 text-indigo-500"})}),u&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("button",{onClick:()=>y(e=>!e),className:"w-6 h-6 flex items-center justify-center rounded-full transition-all duration-150 hover:scale-110",style:{background:"var(--surface-panel)",border:"1px solid rgba(239,68,68,0.18)",boxShadow:"0 2px 8px rgba(239,68,68,0.08)"},title:"Delete","aria-label":"Delete message",children:(0,t.jsx)(w.TrashIcon,{className:"w-3 h-3 text-red-500"})}),(0,t.jsx)(r.AnimatePresence,{children:b&&(0,t.jsxs)(n.motion.div,{initial:{opacity:0,y:-2,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-2,scale:.96},transition:{duration:.14},className:`absolute top-full mt-1.5 ${i?"left-0":"right-0"} flex items-center gap-1 rounded-xl py-1 px-1.5 z-30 whitespace-nowrap`,style:{background:"var(--surface-panel)",backdropFilter:"blur(20px)",border:"1px solid var(--border-default)",boxShadow:"0 8px 24px var(--border-default), 0 2px 6px var(--surface-softer)"},children:[(0,t.jsx)("span",{className:"text-[10px] font-semibold text-gray-500 dark:text-zinc-400 px-1",children:"Delete?"}),(0,t.jsx)("button",{onClick:()=>{y(!1),d?.()},className:"text-[10px] font-bold text-white px-2 py-1 rounded-lg",style:{background:"linear-gradient(135deg, #EF4444, #F97316)"},children:"Yes"}),(0,t.jsx)("button",{onClick:()=>y(!1),className:"text-[10px] font-semibold text-gray-500 dark:text-zinc-400 px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-zinc-900",children:"Cancel"})]})})]}),(0,t.jsx)(r.AnimatePresence,{children:p&&(0,t.jsxs)(n.motion.div,{initial:{opacity:0,y:-2,scale:.96}
1,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-2,scale:.96},transition:{duration:.14},className:`absolute top-full mt-1.5 ${i?"left-0":"right-0"} flex items-center gap-0.5 rounded-full py-0.5 px-1`,style:{background:"var(--surface-panel)",backdropFilter:"blur(20px)",border:"1px solid var(--border-default)",boxShadow:"0 8px 24px var(--border-default), 0 2px 6px var(--surface-softer)"},children:[(f?C:C.slice(0,5)).map(e=>(0,t.jsx)("button",{onClick:()=>{s(e),h(!1)},className:"w-7 h-7 flex items-center justify-center rounded-full hover:bg-amber-50 hover:scale-125 transition-all duration-150 text-[15px] leading-none",title:`React ${e}`,children:e},e)),!f&&(0,t.jsx)("button",{onClick:()=>g(!0),className:"w-7 h-7 flex items-center justify-center rounded-full hover:bg-gray-100 dark:hover:bg-zinc-900 text-gray-400 dark:text-zinc-500 text-[12px] font-bold",title:"More",children:"+"})]})})]})}function z({media:e,onPreview:a,compact:n}){let r=e||{},i=r.mimeType||"",s="image"===r.type||"gif"===r.type||i.startsWith("image/"),l="video"===r.type||i.startsWith("video/"),o=n?180:240;function d(e){e.preventDefault(),e.stopPropagation(),a?.(r)}if(s)return(0,t.jsx)("button",{onClick:d,className:"block rounded-xl overflow-hidden hover:opacity-95 transition-opacity",style:{maxWidth:o},"aria-label":`Open ${r.name||"image"}`,children:(0,t.jsx)("img",{src:r.url,alt:r.name||"",className:"w-full h-auto block",loading:"lazy"})});if(l)return(0,t.jsxs)("button",{onClick:d,className:"block rounded-xl overflow-hidden relative group hover:opacity-95 transition-opacity",style:{maxWidth:o},"aria-label":`Open ${r.name||"video"}`,children:[(0,t.jsx)("video",{src:r.url,className:"w-full h-auto block",muted:!0,playsInline:!0,preload:"metadata"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-black/55 backdrop-blur flex items-center justify-center shadow-lg",children:(0,t.jsx)("svg",{className:"w-5 h-5 text-white ml-0.5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,t.jsx)("path",{d:"M8 5v14l11-7z"})})})})]});let u=(()=>{if(r.name&&r.name.includes(".")){let e=r.name.split(".").pop();if(e&&e.length<=5)return e.toUpperCase()}return i?(i.split("/")[1]||"").split(".").pop().slice(0,5).toUpperCase():"FILE"})();return(0,t.jsxs)("button",{onClick:d,className:"flex items-center gap-2.5 px-2.5 py-2 rounded-xl transition-all hover:shadow-sm active:scale-[0.99]",style:{background:"rgba(139,92,246,0.06)",border:"1px solid rgba(139,92,246,0.18)",maxWidth:o},"aria-label":`Open ${r.name||"attachment"}`,children:[(0,t.jsxs)("div",{className:"w-9 h-9 rounded-lg flex flex-col items-center justify-center flex-shrink-0",style:{background:"rgba(139,92,246,0.14)"},children:[(0,t.jsx)(c.DocumentIcon,{className:"w-4 h-4 text-violet-500"}),(0,t.jsx)("span",{className:"text-[7px] font-black text-violet-600 leading-none mt-0.5",children:u})]}),(0,t.jsx)("span",{className:"text-[12px] font-semibold text-gray-700 dark:text-zinc-300 truncate min-w-0 text-left",children:r.name||"Attachment"})]})}function T({readers:e,isMine:a}){if(!e||0===e.length)return null;let n=e.slice(0,4),r=e.length-n.length;return(0,t.jsxs)("div",{className:`flex items-center gap-1 mt-0.5 px-1 ${a?"justify-end":""}`,title:`Read by ${e.map(e=>e.name).join(", ")}`,children:[(0,t.jsx)("span",{className:"text-[9px] text-gray-400 dark:text-zinc-500 font-medium",children:"Seen"}),(0,t.jsx)("div",{className:"flex -space-x-1",children:n.map(e=>e.image?(0,t.jsx)("img",{src:e.image,alt:e.name||"",className:"w-3.5 h-3.5 rounded-full object-cover ring-1 ring-white dark:ring-zinc-950",loading:"lazy"},e._id):(0,t.jsx)("div",{className:`w-3.5 h-3.5 rounded-full bg-gradient-to-br ${(0,N.getAvatarGradient)(e.name)} flex items-center justify-center text-white ring-1 ring-white dark:ring-zinc-950`,style:{fontSize:7,fontWeight:700},children:(e.name||"?")[0].toUpperCase()},e._id))}),r>0&&(0,t.jsxs)("span",{className:"text-[9px] text-gray-400 dark:text-zinc-500 font-semibold",children:["+",r]})]})}var $=e.i(82291);function D({reply:e,replyToReply:n,currentUserId:r,isAdmin:i,onVideoActivate:s,onVideoDeactivate:l,onReact:o,onReply:d,onPreview:c,onEdit:u,onDelete:x}){var m;let[p,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)(e.text||""),[j,k]=(0,a.useState)(!1),w=(0,N.groupReactions)(e.reactions,r),C=e.user?._id?.toString()===r?.toString();async function T(){let t=b.trim();if(!t||t===e.text)return void g(!1);k(!0);try{await u?.(t),g(!1)}catch{}finally{k(!1)}}function A(){y(e.text||""),g(!1)}return(0,t.jsxs)("div",{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:"flex gap-2",children:[(0,t.jsx)($.default,{name:e.user?.name,image:e.user?.image,sizeClass:"w-5 h-5 mt-0.5",textClass:"text-[8px]"}),(0,t.jsxs)("div",{className:"flex flex-col items-start max-w-[90%] min-w-0",children:[n&&(0,t.jsxs)("div",{className:"flex items-center gap-1 px-1 mb-0.5 text-[9px] text-gray-400 dark:text-zinc-500",children:[(0,t.jsx)("span",{children:"â³ to"}),(0,t.jsxs)("span",{className:"font-semibold text-gray-500 dark:text-zinc-400",children:["@",n.user?.name||"user"]}),n.text&&(0,t.jsxs)("span",{className:"truncate max-w-[180px] italic opacity-80",children:['"',n.text,'"']})]}),(0,t.jsxs)("div",{className:"flex items-baseline gap-1.5 mb-0.5 px-1",children:[(0,t.jsx)("span",{className:"text-[10px] font-semibold text-gray-700 dark:text-zinc-300",children:e.user?.name||"Unknown"}),(0,t.jsx)("span",{className:"text-[9px] text-gray-400 dark:text-zinc-500",children:(0,N.timeAgo)(e.createdAt)})]}),(0,t.jsxs)("div",{className:"relative px-2.5 py-1 rounded-xl rounded-tl-md max-w-full",style:{background:"var(--surface-soft)",border:"1px solid var(--surface-softer)"},children:[(0,t.jsx)(S,{visible:p,isMine:!1,onReact:o,onReply:d,onEdit:C&&!f?()=>g(!0):void 0,onDelete:x,canEdit:C&&!f,canDelete:C||i}),f?(0,t.jsxs)("div",{className:"min-w-[160px]",children:[(0,t.jsx)("textarea",{autoFocus:!0,value:b,onChange:e=>y(e.target.value),onKeyDown:e=>
1{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),T()),"Escape"===e.key&&(e.preventDefault(),A())},rows:Math.min(4,Math.max(2,b.split("\n").length)),className:"w-full text-[12px] text-gray-700 dark:text-zinc-300 bg-white dark:bg-zinc-950 rounded-lg p-1.5 focus:outline-none focus:ring-2 focus:ring-orange-300/50 resize-none",style:{border:"1px solid var(--border-default)"},disabled:j}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(0,t.jsx)("button",{onClick:A,disabled:j,className:"text-[10px] font-semibold text-gray-500 dark:text-zinc-400 px-2 py-0.5 rounded-lg hover:bg-gray-100 dark:hover:bg-zinc-900",children:"Cancel"}),(0,t.jsx)("button",{onClick:T,disabled:j||!b.trim(),className:"text-[10px] font-bold text-white px-2 py-0.5 rounded-lg disabled:opacity-40",style:{background:"linear-gradient(135deg, #F97316, #EC4899)"},children:j?"Savingâ¦":"Save"})]})]}):(0,t.jsxs)(t.Fragment,{children:[e.text&&(0,t.jsxs)("div",{className:"text-[12px] text-gray-700 dark:text-zinc-300 leading-[1.4] whitespace-pre-wrap break-words",children:[(0,t.jsx)(v.default,{text:e.text,mentions:e.mentions,creatorMentions:e.creatorMentions,campaignMentions:e.campaignMentions,organizationMentions:e.organizationMentions,dealMentions:e.dealMentions,onVideoActivate:s,onVideoDeactivate:l}),(m=e,("boolean"==typeof m?.edited?m.edited:!!m?.updatedAt&&!!m?.createdAt&&new Date(m.updatedAt).getTime()-new Date(m.createdAt).getTime()>2e3)&&(0,t.jsx)("span",{className:"ml-1.5 text-[9px] font-medium text-gray-400 dark:text-zinc-500",title:`Edited ${(0,N.timeAgo)(e.updatedAt)}`,children:"(edited)"}))]}),e.media?.length>0&&(0,t.jsx)("div",{className:e.text?"mt-1.5 space-y-1":"",children:e.media.map((e,a)=>(0,t.jsx)(z,{media:e,onPreview:c,compact:!0},a))})]})]}),Object.values(w).length>0&&(0,t.jsx)("div",{className:"flex items-center flex-wrap gap-1 mt-0.5 px-1",children:Object.values(w).map(e=>(0,t.jsxs)("button",{onClick:()=>o(e.emoji),className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] transition-all hover:scale-105",style:e.mine?{background:"rgba(249,115,22,0.1)",border:"1px solid rgba(249,115,22,0.25)",color:"#C2410C"}:{background:"rgba(0,0,0,0.035)",border:"1px solid var(--border-subtle)",color:"var(--text-tertiary)"},title:e.users.join(", "),children:[(0,t.jsx)("span",{className:"text-[11px] leading-none",children:e.emoji}),(0,t.jsx)("span",{className:"font-semibold",children:e.count})]},e.emoji))})]})]})}var A=e.i(522016);function E({share:e}){let a=function(e){if(!e?.chat)return null;let t=`/dashboard/user/scout?chat=${encodeURIComponent(e.chat)}`;return e.token?`${t}&share=${encodeURIComponent(e.token)}`:t}(e);return a?(0,t.jsxs)(A.default,{href:a,onClick:e=>e.stopPropagation(),className:"group inline-flex items-center gap-2 rounded-xl pl-1.5 pr-3 py-1.5 max-w-full align-middle transition-all hover:opacity-95 active:scale-[0.98] no-underline",style:{background:"linear-gradient(135deg, rgba(236,72,153,0.14), rgba(249,115,22,0.14))",border:"1px solid rgba(236,72,153,0.35)"},title:`Open Scout chat: ${e.title||"conversation"}`,children:[(0,t.jsx)("span",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 text-white",style:{background:"linear-gradient(135deg,#ec4899,#f97316)"},"aria-hidden":"true",children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-3.5 h-3.5",children:(0,t.jsx)("path",{d:"M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0z"})})}),(0,t.jsxs)("span",{className:"min-w-0 flex flex-col leading-tight",children:[(0,t.jsxs)("span",{className:"text-[9px] font-bold uppercase tracking-[0.1em] text-pink-500 dark:text-pink-300",children:["Ask Scout",e.ownerName?` \xb7 ${e.ownerName}`:""]}),(0,t.jsx)("span",{className:"text-[12.5px] font-semibold text-gray-800 dark:text-zinc-100 truncate max-w-[220px]",children:e.title||"Shared conversation"})]}),(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",className:"w-3.5 h-3.5 flex-shrink-0 text-pink-500/70 dark:text-pink-300/70 group-hover:translate-x-0.5 transition-transform","aria-hidden":"true",children:(0,t.jsx)("polyline",{points:"9 18 15 12 9 6"})})]}):null}function M({shares:e}){return Array.isArray(e)&&0!==e.length?(0,t.jsx)("div",{className:"mt-1.5 flex flex-col gap-1.5",children:e.map((e,a)=>(0,t.jsx)(E,{share:e},e.chat?`${e.chat}-${a}`:a))}):null}var I=e.i(809182);function R({message:e,isMine:i,isAdmin:s,showHeader:l,isLastInGroup:o,showReadReceipts:d,readBy:c,currentUserId:u,highlighted:x,onVideoActivate:m,onVideoDeactivate:p,onReact:h,onReply:f,onReplyReact:g,onPreview:b,onEdit:k,onDelete:w,onEditReply:C,onDeleteReply:$,onCopyLink:A,onJumpToSubItem:E}){var I;let[P,F]=(0,a.useState)(!1),[U,O]=(0,a.useState)(!1);(0,a.useEffect)(()=>
1{if(!window.matchMedia)return;let e=window.matchMedia("(hover: none)"),t=()=>O(e.matches);return t(),e.addEventListener?.("change",t),()=>e.removeEventListener?.("change",t)},[]);let B=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(U&&P)return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)};function e(e){B.current?.contains(e.target)||F(!1)}},[U,P]);let[W,V]=(0,a.useState)(!1),[q,K]=(0,a.useState)(""),[H,J]=(0,a.useState)(null),[Y,G]=(0,a.useState)(!1),[X,Q]=(0,a.useState)(e.text||""),[Z,ee]=(0,a.useState)(!1),et=(0,N.groupReactions)(e.reactions,u),ea=d?(0,N.readersOf)(e,c):[],en=!!(0,y.extractUrls)(e.text||"").find(e=>(0,y.detectVideoEmbed)(e)),er=(0,a.useRef)(null);function ei(){q.trim()&&(f(q.trim(),H?.replyId||null),K(""),V(!1),J(null))}async function es(){let t=X.trim();if(!t||t===e.text)return void G(!1);ee(!0);try{await k?.(t),G(!1)}catch{}finally{ee(!1)}}function el(){Q(e.text||""),G(!1)}return(0,a.useEffect)(()=>{if(W)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){!er.current||er.current.contains(e.target)||(V(!1),K(""),J(null))}},[W]),(0,t.jsxs)(n.motion.div,{"data-comment-id":e._id,"data-message-id":e._id,variants:{hidden:{opacity:0,y:8,scale:.97},visible:{opacity:1,y:0,scale:1,transition:{duration:.4,ease:[.25,.46,.45,.94]}}},initial:"hidden",animate:"visible",ref:B,onMouseEnter:U?void 0:()=>F(!0),onMouseLeave:U?void 0:()=>F(!1),onClick:U?e=>{e.target.closest("button, a, input, textarea, video, [contenteditable]")||F(e=>!e)}:void 0,className:`relative flex gap-2.5 rounded-xl transition-shadow duration-300 ${i?"flex-row-reverse":""} ${l?"mt-4":"mt-2"} ${o?"mb-1":""} ${x?"ring-2 ring-orange-400/60 ring-offset-2 ring-offset-transparent shadow-lg shadow-orange-400/20":""}`,children:[(0,t.jsx)("div",{className:"w-7 flex-shrink-0",children:l&&(0,t.jsx)(L,{user:e.user,isMine:i})}),(0,t.jsxs)("div",{className:`flex flex-col ${i?"items-end":"items-start"} ${en?"flex-1 max-w-[95%]":Y?"max-w-[95%] w-full":"max-w-[78%]"} min-w-0`,children:[l&&(0,t.jsxs)("div",{className:`flex items-baseline gap-1.5 mb-1 px-1 ${i?"flex-row-reverse":""}`,children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-zinc-300",children:i?"You":e.user?.name||"Unknown"}),(0,t.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-zinc-500 font-medium",children:(0,N.timeAgo)(e.createdAt)})]}),(0,t.jsxs)("div",{className:`relative px-3 py-1.5 ${en||Y?"w-full":"max-w-full"} ${i?"rounded-2xl rounded-tr-md":"rounded-2xl rounded-tl-md"}`,style:i?{background:"rgba(249,115,22,0.06)",border:"1px solid rgba(249,115,22,0.12)"}:{background:"rgba(0,0,0,0.025)",border:"1px solid var(--surface-softer)"},children:[(0,t.jsx)(S,{visible:P,isMine:i,onReact:e=>h(e),onReply:()=>V(!0),onEdit:i&&!Y?()=>G(!0):void 0,onDelete:w,canEdit:i&&!Y,canDelete:i||s,onCopyLink:A,taskTrigger:e?._id?(0,t.jsx)(j.default,{context:{kind:"message",id:e._id,seedTitle:function(e){let t=(e?.text||"").trim();if(!t)return"";let a=t.replace(/@\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/g,"").replace(/\s+/g," ").trim();return a.length>80?`${a.slice(0,77)}â¦`:a}(e),label:"Created from a message"},variant:"icon"}):null}),e.quotedSubItem?.subItemId&&(0,t.jsxs)("button",{type:"button",onClick:E?t=>{t.stopPropagation(),E(e.quotedSubItem.subItemId)}:void 0,disabled:!E,className:`flex items-center gap-1.5 mb-1.5 -mx-1 px-2 py-1 rounded-md text-[11px] font-medium max-w-full ${E?"hover:bg-orange-50 dark:hover:bg-orange-500/10 transition-colors cursor-pointer":"cursor-default"}`,style:{background:"rgba(249,115,22,0.06)",borderLeft:"2px solid rgba(249,115,22,0.5)",color:"#C2410C"},title:E?"Jump to this subtask":void 0,children:[(0,t.jsx)("span",{className:"flex-shrink-0 opacity-70",children:"â³ on subtask:"}),(0,t.jsx)("span",{className:"font-semibold truncate italic",children:e.quotedSubItem.title||"(untitled)"})]}),Y?(0,t.jsxs)("div",{className:"w-full min-w-0",children:[(0,t.jsx)("textarea",{autoFocus:!0,value:X,onChange:e=>Q(e.target.value),onKeyDown:e=>
1{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),es()),"Escape"===e.key&&(e.preventDefault(),el())},rows:Math.min(5,Math.max(2,X.split("\n").length)),className:"w-full text-[13px] text-gray-800 dark:text-zinc-100 bg-white dark:bg-zinc-950 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-orange-300/50 resize-none",style:{border:"1px solid var(--border-default)"},disabled:Z}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1.5 mt-1.5",children:[(0,t.jsx)("button",{onClick:el,disabled:Z,className:"text-[10px] font-semibold text-gray-500 dark:text-zinc-400 px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-zinc-900",children:"Cancel"}),(0,t.jsx)("button",{onClick:es,disabled:Z||!X.trim(),className:"text-[10px] font-bold text-white px-2.5 py-1 rounded-lg disabled:opacity-40",style:{background:"linear-gradient(135deg, #F97316, #EC4899)"},children:Z?"Savingâ¦":"Save"})]})]}):(0,t.jsxs)(t.Fragment,{children:[e.text&&(0,t.jsxs)("div",{className:"text-[13px] text-gray-800 dark:text-zinc-100 leading-[1.45] whitespace-pre-wrap break-words",children:[(0,t.jsx)(v.default,{text:e.text,mentions:e.mentions,creatorMentions:e.creatorMentions,campaignMentions:e.campaignMentions,organizationMentions:e.organizationMentions,dealMentions:e.dealMentions,onVideoActivate:m,onVideoDeactivate:p}),(I=e,("boolean"==typeof I?.edited?I.edited:!!I?.updatedAt&&!!I?.createdAt&&new Date(I.updatedAt).getTime()-new Date(I.createdAt).getTime()>2e3)&&(0,t.jsx)("span",{className:"ml-1.5 text-[10px] font-medium text-gray-400 dark:text-zinc-500",title:`Edited ${(0,N.timeAgo)(e.updatedAt)}`,children:"(edited)"}))]}),e.media?.length>0&&(0,t.jsx)("div",{className:e.text?"mt-1.5 space-y-1":"",children:e.media.map((e,a)=>(0,t.jsx)(z,{media:e,onPreview:b},a))}),(0,t.jsx)(M,{shares:e.scoutChatShares}),e.spawnedTask&&(0,t.jsx)(_,{taskId:e.spawnedTask})]})]}),Object.values(et).length>0&&(0,t.jsx)("div",{className:`flex items-center flex-wrap gap-1 mt-1 px-1 ${i?"justify-end":""}`,children:Object.values(et).map(e=>(0,t.jsxs)("button",{onClick:()=>h(e.emoji),className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] transition-all duration-150 hover:scale-105",style:e.mine?{background:"rgba(249,115,22,0.1)",border:"1px solid rgba(249,115,22,0.25)",color:"#C2410C"}:{background:"rgba(0,0,0,0.035)",border:"1px solid var(--border-subtle)",color:"var(--text-tertiary)"},title:e.users.join(", "),children:[(0,t.jsx)("span",{className:"text-xs leading-none",children:e.emoji}),(0,t.jsx)("span",{className:"font-semibold",children:e.count})]},e.emoji))}),(0,t.jsx)(T,{readers:ea,isMine:i}),e.replies?.length>0&&(0,t.jsx)("div",{className:`mt-1.5 space-y-1.5 ${i?"self-end":"self-start"}`,style:{minWidth:240},children:e.replies.map(a=>{let n=a.replyTo?e.replies.find(e=>e._id?.toString()===a.replyTo?.toString()):null;return(0,t.jsx)(D,{reply:a,replyToReply:n,currentUserId:u,isAdmin:s,onVideoActivate:m,onVideoDeactivate:p,onReact:e=>g(a._id,e),onReply:()=>{J({replyId:a._id,name:a.user?.name||"user"}),V(!0)},onPreview:b,onEdit:e=>C?.(a._id,e),onDelete:()=>$?.(a._id)},a._id)})}),(0,t.jsx)(r.AnimatePresence,{children:W&&(0,t.jsxs)(n.motion.div,{ref:er,initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.18},className:`mt-2 ${i?"self-end":""}`,style:{minWidth:260},children:[H&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 px-2 py-1 rounded-full text-[10px] font-medium w-fit",style:{background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)",color:"#C2410C"},children:[(0,t.jsx)("span",{children:"â³ Replying to"}),(0,t.jsxs)("span",{className:"font-bold",children:["@",H.name]}),(0,t.jsx)("button",{type:"button",onClick:()=>J(null),className:"ml-0.5 opacity-60 hover:opacity-100",title:"Reply at top of thread instead",children:"â"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{autoFocus:!0,t
1ype:"text",value:q,onChange:e=>K(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ei(),"Escape"===e.key&&(V(!1),K(""),J(null))},placeholder:H?`Reply to ${H.name}â¦`:"Replyâ¦",className:"flex-1 text-xs px-3 py-1.5 rounded-full focus:outline-none focus:ring-2 focus:ring-orange-300/50",style:{background:"var(--surface-soft)",border:"1px solid var(--border-default)"}}),(0,t.jsx)("button",{onClick:ei,disabled:!q.trim(),className:"text-xs font-semibold px-3 py-1.5 text-white rounded-full disabled:opacity-40 transition-all",style:{background:"linear-gradient(135deg, #F97316, #EC4899)"},children:"Send"})]})]})})]})]})}function _({taskId:e}){let[n,r]=(0,a.useState)(null),[i,s]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{if(!e)return;let t=!1;return fetch(`/api/tasks/${e}`).then(e=>e.ok?e.json():null).then(e=>{t||(e?.task?r(e.task):s(!0))}).catch(()=>!t&&s(!0)),()=>{t=!0}},[e]),i)return null;let l=n?function(e){if(!e?._id)return null;let t=e=>e?._id?.toString?.()||e?.toString?.()||e;return e.linkedCampaign?`/dashboard/user/campaign/${t(e.linkedCampaign)}?tab=tasks&taskId=${e._id}`:e.linkedCreator?`/dashboard/user/creator/${t(e.linkedCreator)}?tab=tasks&taskId=${e._id}`:e.organization?`/dashboard/user/organization/${t(e.organization)}?tab=tasks&taskId=${e._id}`:e.linkedPost?`/dashboard/user/post/${t(e.linkedPost)}?taskId=${e._id}`:`/dashboard/user/tasks?taskId=${e._id}`}(n):null,o=n?.title||"Task",d=n?.status||"",c=(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 mt-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold transition-all hover:-translate-y-0.5",style:{background:"rgba(99,102,241,0.08)",border:"1px solid rgba(99,102,241,0.25)",color:"#4f46e5"},children:[(0,t.jsx)("span",{"aria-hidden":!0,children:"â"}),(0,t.jsx)("span",{className:"truncate max-w-[180px]",children:o}),d&&(0,t.jsxs)("span",{className:"text-[9px] uppercase tracking-wider opacity-70",children:["· ",d]})]});return l?(0,t.jsx)("a",{href:l,className:"block",onClick:e=>e.stopPropagation(),title:`Open ${o}`,children:c}):(0,t.jsx)("span",{className:"block",children:c})}function L({user:e,isMine:a}){let n=(0,I.useIsUserOnline)(a?null:e?._id);return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)($.default,{name:e?.name,image:e?.image,sizeClass:"w-7 h-7",textClass:"text-[10px]"}),n&&(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full",style:{background:"#10b981",boxShadow:"0 0 0 2px var(--surface-panel), 0 0 5px rgba(16,185,129,0.45)"},"aria-label":"Online",title:"Online"})]})}function P({mirror:e,onJumpToParent:a}){let r=(e.replyUser?.name||"?").trim()[0]?.toUpperCase()||"?";return(0,t.jsxs)(n.motion.button,{type:"button",onClick:a,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2},className:"w-full text-left mt-3 mb-1 mx-3 p-3 rounded-xl",style:{background:"var(--surface-soft)",border:"1px solid var(--border-subtle)",borderLeft:"2px solid #EC4899",width:"auto"},title:"Click to jump to the original comment",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.14em] text-pink-500 mb-1.5",children:[(0,t.jsx)("span",{children:"â³"}),(0,t.jsxs)("span",{className:"truncate",children:[(0,t.jsx)("strong",{className:"text-pink-600 dark:text-pink-400",children:e.replyUser?.name||"Someone"})," ","replied to"," ",(0,t.jsx)("strong",{className:"text-pink-600 dark:text-pink-400",children:e.parentUserName})]})]}),e.parentSnippet&&(0,t.jsxs)("div",{className:"text-[11px] italic text-gray-400 dark:text-zinc-500 truncate mb-2 pl-1 border-l-2",style:{borderColor:"var(--border-default)"},children:["â",e.parentSnippet,e.parentSnippet.length>=90?"â¦":"","â"]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 text-[10px] font-bold text-white",style:{background:e.replyUser?.image?`url(${e.replyUser.image}) center/cover`:"linear-gradient(135deg, #ec4899, #f97316)"},children:!e.replyUser?.image&&r}),(0,t.jsx)("span",{className:"text-[13px] leading-relaxed text-gray-700 dark:text-zinc-300 line-clamp-3 flex-1",children:e.replyText||(0,t.jsx)("span",{className:"italic text-gray-400 dark:text-zinc-500",children:"(attachment)"})})]})]})}function F({typers:e}){let a;if(!e||0===e.length)return null;let n=e.map(e=>e.name?.split(" ")[0]||"Someone");a=1===n.length?`${n[0]} is typing`:2===n.length?`${n[0]} and ${n[1]} are typing`:`${n[0]}, ${n[1]} and ${n.length-2} ${n.length-2==1?"other":"others"} are typing`;let r=e.slice(0,2);return(0,t.jsxs)("div",{className:"flex-shrink-0 px-4 sm:px-6 py-1.5 flex items-center gap-2","aria-live":"polite",style:{background:"var(--surface-panel)",borderTop:"1px solid var(--border-subtle)"}
1,children:[(0,t.jsx)("div",{className:"flex -space-x-1.5",children:r.map(e=>(0,t.jsx)($.default,{name:e.name,image:e.image,sizeClass:"w-5 h-5",textClass:"text-[8px]",ringClass:"ring-2 ring-[var(--surface-panel)]"},e._id))}),(0,t.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-zinc-400 font-medium truncate",children:a}),(0,t.jsxs)("span",{className:"inline-flex items-end gap-0.5 ml-0.5","aria-hidden":!0,children:[(0,t.jsx)("span",{className:"w-1 h-1 rounded-full bg-gray-400 dark:bg-zinc-500 animate-bounce",style:{animationDelay:"0ms",animationDuration:"1s"}}),(0,t.jsx)("span",{className:"w-1 h-1 rounded-full bg-gray-400 dark:bg-zinc-500 animate-bounce",style:{animationDelay:"150ms",animationDuration:"1s"}}),(0,t.jsx)("span",{className:"w-1 h-1 rounded-full bg-gray-400 dark:bg-zinc-500 animate-bounce",style:{animationDelay:"300ms",animationDuration:"1s"}})]})]})}e.s(["default",0,function({messages:e=[],currentUserId:o,isAdmin:d=!1,teamMembers:c=[],composerPlaceholder:u="Message your teamâ¦",composerCta:m="Send",highlightedMessageId:p,readBy:h=[],showReadReceipts:f=!0,onSubmit:g,onEditMessage:y,onDeleteMessage:v,onToggleReaction:j,onAddReply:k,onVideoActivate:w,onVideoDeactivate:N,senderName:C,senderImage:S,onComposerActivity:z,typers:T=[],buildCopyLinkHandler:D,suggestionBanner:A=null,mirrorRecentReplies:E=!0,pendingQuote:M,onClearQuote:I,onJumpToSubItem:_}){let L=(0,a.useRef)(null),U=(0,a.useRef)(null),O=(0,a.useRef)(0),B=(0,a.useRef)(null),W=(0,a.useRef)(0),[V,q]=(0,a.useState)(!1),[K,H]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let t=e.length+e.reduce((e,t)=>e+(t.replies?.length||0),0);if(t<=O.current){O.current=t;return}let a=0===O.current,n=L.current;if(O.current=t,n){if(a){n.scrollTo({top:n.scrollHeight,behavior:"auto"});let e=setTimeout(()=>{L.current&&L.current.scrollTo({top:L.current.scrollHeight,behavior:"auto"})},250);return()=>clearTimeout(e)}n.scrollHeight-n.scrollTop-n.clientHeight<120&&n.scrollTo({top:n.scrollHeight,behavior:"smooth"})}},[e]),(0,a.useEffect)(()=>{if(!p)return;let e=p.toString(),t=setTimeout(()=>{let t=document.querySelector(`[data-message-id="${e}"]`);if(!t)return;let a=t.parentElement;for(;a&&a!==document.body;){let e=getComputedStyle(a).overflowY;if("auto"===e||"scroll"===e)break;a=a.parentElement}if(a&&a!==document.body){let e=a.getBoundingClientRect(),n=t.getBoundingClientRect().top-e.top+a.scrollTop-a.clientHeight/2+t.offsetHeight/2;a.scrollTo({top:Math.max(0,n),behavior:"smooth"})}else t.scrollIntoView({behavior:"smooth",block:"center"})},80);return()=>clearTimeout(t)},[p,e.length]),(0,t.jsxs)("div",{className:"relative flex-1 min-h-0 flex flex-col",onDragEnter:function(e){e.dataTransfer?.types?.includes("Files")&&(e.preventDefault(),W.current+=1,q(!0))},onDragLeave:function(){W.current=Math.max(0,W.current-1),0===W.current&&q(!1)},onDragOver:function(e){e.dataTransfer?.types?.includes("Files")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDrop:function(e){e.dataTransfer?.files?.length&&(e.preventDefault(),W.current=0,q(!1),B.current?.uploadFiles(e.dataTransfer.files))},children:[(0,t.jsx)(r.AnimatePresence,{children:V&&(0,t.jsxs)(n.motion.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:[.25,.46,.45,.94]},className:"absolute inset-2 z-30 rounded-2xl flex flex-col items-center justify-center pointer-events-none",style:{background:"linear-gradient(135deg, rgba(249,115,22,0.10), rgba(236,72,153,0.10))",border:"2px dashed rgba(249,115,22,0.5)",backdropFilter:"blur(6px)"},children:[(0,t.jsx)("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-pink-100 to-orange-50 flex items-center justify-center mb-3 shadow-sm",children:(0,t.jsx)(i.ArrowUpTrayIcon,{className:"w-7 h-7 text-pink-400"})}),(0,t.jsx)("p",{className:"text-base font-bold text-gray-800 dark:text-zinc-100",children:"Drop to attach"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 dark:text-zinc-400 mt-1",children:"Images, videos, PDFs, docs â up to 20MB"})]},"panel-drop-overlay")}),(0,t.jsx)(x,{media:K,onClose:()=>H(null)}),(0,t.jsxs)("div",{className:"relative flex-1 min-h-0",children:[(0,t.jsx)(b,{}),(0,t.jsx)("div",{ref:L,className:"relative h-full overflow-y-auto px-4 sm:px-6 py-4",children:0===e.length?(0,t.jsxs)(n.motion.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.6,ease:[.25,.46,.45,.94]},className:"h-full flex flex-col items-center justify-center text-center px-6",children:[(0,t.jsx)("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-pink-100 to-orange-50 flex items-center justify-center mb-5 shadow-sm",children:(0,t.jsx)(s.ChatBubbleLeftIcon,{className:"w-8 h-8 text-pink-300"})}),(0,t.jsx)("h3",{className:"text-lg font-bold text-gray-800 dark:text-zinc-100 mb-2",children:"No messages yet"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 dark:text-zinc-400 max-w-xs",children:"Start the thread â your team will see it instantly."})]}):(0,t.jsxs)(n.motion.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:.04,delayChildren:.05}}},children:[e.map((a,n)=>{let r=e[n-1],i=e[n+1],s=r&&r.user?._id?.toString()===a.user?._id?.toString()&&new Date(a.createdAt).getTime()-new Date(r.createdAt).getTime()<3e5,l=i&&i.user?._id?.toString()===a.user?._id?.toString()&&new Date(i.createdAt).getTime()-new Date(a.createdAt).getTime()<3e5,c=a.user?._id?.toString()===o?.toString(),u=n===e.length-1;return(0,t.jsx)(R,{message:a,isMine:c,isAdmin:d,showHeader:!s,isLastInGroup:!l,showReadReceipts:f&&(u||!l),readBy:h,currentUserId:o,highlighted:p&&p.toString()===a._id?.toString(),onVideoActivate:w,onVideoDeactivate:N,onReact:e=>j?.(a._id,e,null),onReply:(e,t)=>k?.(a._id,e,t),onReplyReact:(e,t)=>j?.(a._id,t,e),onPreview:H,onCopyLink:D?()=>D(a._id):void 0,onEdit:e=>y?.(a._id,null,e),onDelete:()=>v?.(a._id,null),onEditReply:(e,t)=>y?.(a._id,e,t),onDeleteReply:e=>v?.(a._id,e),onJumpToSubItem:_},a._id)}),E&&(function(e){if(!Array.isArray(e)||0===e.length)return[];let t=e.reduce((e,t)=>{let a=new Date(t.createdAt).getTime();return a>e?a:e},0),a=new Set(e.slice(-2).map(e=>e._id?.toString?.()).filter(Boolean)),n=[];for(let r of e)for(let e of r.replies||[])!(new Date(e.createdAt).getTime()<=t)&&(a.has(r._id?.toString?.())||n.push({replyId:e._id?.toString?.(),replyUser:e.user||{},replyText:e.text||"",replyMedia:e.media||[],replyCreatedAt:e.createdAt,parentId:r._id?.toString?.(),parentUserName:r.user?.name||"someone",parentSnippet:(r.text||"").slice(0,90),parentCreatedAt:r.createdAt}));return n.sort((e,t)=>new Date(e.replyCreatedAt).getTime()-new Date(t.replyCreatedAt).getTime()),n})(e).map(e=>(0,t.jsx)(P,{mirror:e,onJumpToParent:()=>{let t=L.current?.querySelector(`[data-message-id="${e.parentId}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"})}},`mirror-${e.replyId}`)),(0,t.jsx)("div",{ref:U})]})})]}),A,(0,t.jsx)(F,{typers:T}),(0,t.jsx)("div",{className:"flex-shrink-0 px-4 sm:px-6 py-3 group/composer safe-area-pb",style:{background:"var(--surface-panel)",backdropFilter:"blur(20px)",borderTop:"1px solid var(--border-subtle)"},children:(0,t.jsxs)("div",{className:"relative flex items-start gap-2.5",children:[(0,t.jsx)("div",{"aria-hidden":!0,className:"absolute -inset-1 rounded-2xl opacity-0 blur-xl pointer-events-none transition-opacity duration-500 group-focus-within/composer:opacity-40",style:{background:"linear-gradient(120deg, rgba(236,72,153,0.5), rgba(249,115,22,0.45), rgba(139,92,246,0.4))"}}),(0,t.jsx)($.default,{name:C,image:S,sizeClass:"w-7 h-7 mt-0.5",textClass:"text-[10px]",ringClass:"shadow-pink-200/50"}),(0,t.jsxs)("div",{className:"relative flex-1 min-w-0",children:[M&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 px-2.5 py-1 rounded-full text-[11px] font-medium w-fit max-w-full",style:{background:"rgba(249,115,22,0.08)",border:"1px solid rgba(249,115,22,0.2)",color:"#C2410C"},children:[(0,t.jsx)("span",{className:"flex-shrink-0",children:"â³ Commenting on"}),(0,t.jsx)("span",{className:"font-bold truncate",children:M.title||"subtask"}),(0,t.jsx)("button",{type:"button",onClick:I,className:"ml-0.5 opacity-60 hover:opacity-100 flex-shrink-0",title:"Cancel â comment without quoting the subtask","aria-label":"Clear quoted subtask",children:"â"})]}),(0,t.jsx)(l.default,{ref:B,teamMembers:c,placeholder:u,ctaLabel:m,rows:1,onSubmit:e=>g?.({...e,quotedSubItem:M?{subItemId:M.subItemId,title:M.title}:null}),onActivity:z})]})]})})]})}],591160)},272857,e=>{"use strict";var t=e.i(271645);let a=null,n=null;async function r(){return a||n||(n=fetch("/api/agency-team").then(e=>e.ok?e.json():{users:[]}).then(e=>a=e?.users||[]).catch(()=>a=[]).finally(()=>{n=null}))}e.s(["default",0,function({enabled:e=!0}={}){let[n,i]=(0,t.useState)(()=>a||[]);return(0,t.useEffect)(()=>
1{if(!e)return;let t=!1;return r().then(e=>{t||i(e)}),()=>{t=!0}},[e]),n}])},313004,e=>{"use strict";var t=e.i(271645);e.s(["default",0,function({parent:e,selfUserId:a}){let[n,r]=(0,t.useState)([]),i=(0,t.useRef)({at:0,isTyping:!1});(0,t.useEffect)(()=>{if(e?.type&&e?.id)return window.addEventListener("ss-typing-event",t),()=>window.removeEventListener("ss-typing-event",t);function t(t){let n=t.detail||{};if(n.parent?.type!==e.type||n.parent.id?.toString?.()!==e.id?.toString?.())return;let i=n.user;!i?._id||a&&i._id.toString()===a.toString()||r(e=>{let t=e.filter(e=>e._id?.toString()!==i._id.toString());return n.isTyping?[...t,{_id:i._id,name:i.name,image:i.image,expiresAt:n.expiresAt||Date.now()+5e3}]:t})}},[e?.type,e?.id,a]),(0,t.useEffect)(()=>{if(0===n.length)return;let e=setInterval(()=>{let e=Date.now();r(t=>{let a=t.filter(t=>t.expiresAt>e);return a.length===t.length?t:a})},1e3);return()=>clearInterval(e)},[n.length]);let s=(0,t.useCallback)(t=>{e?.type&&e?.id&&fetch("/api/messages/typing",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:{type:e.type,id:e.id,rootId:e.rootId||null},isTyping:t})}).catch(()=>{})},[e?.type,e?.id,e?.rootId]),l=(0,t.useCallback)(()=>{let e=Date.now(),t=i.current;if(!t.isTyping||e-t.at>=4e3){i.current={at:e,isTyping:!0},s(!0);return}e-t.at>=3e3&&(i.current={at:e,isTyping:!0},s(!0))},[s]),o=(0,t.useCallback)(()=>{i.current.isTyping&&(i.current={at:Date.now(),isTyping:!1},s(!1))},[s]);return(0,t.useEffect)(()=>()=>{i.current.isTyping&&s(!1)},[s]),(0,t.useMemo)(()=>({typers:n,notifyTyping:l,clearTyping:o}),[n,l,o])}])}]);
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.