1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2f8467ed-b8c2-4ff7-99bf-58a7e0b179a0",e._sentryDebugIdIdentifier="sentry-dbid-2f8467ed-b8c2-4ff7-99bf-58a7e0b179a0")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16347],{16347:(e,t,r)=>{r.r(t),r.d(t,{MarketingAssetsWidget:()=>I});var n=r(95155),a=r(12115),o=r(47650),l=r(71408),i=r(80455),s=r(35299),d=r(85921),c=r(42196),u=r(61362),m=r(18085),x=r(65229),p=r(93499),b=r(55275),h=r(67161),f=r(67333),g=r(20508),v=r(19408),y=r(27209),w=r(39867),j=r(18720),k=r(80344),N=r(94719),C=r(64767);let A=new Set(["completed","success","failed","cancelled"]),_={promo_video:"Promo video",elevator_pitch_video:"Elevator pitch",founder_update_video:"Founder update",branding_hero:"Brand hero",branding_mockup:"Product mockup",social_post_image:"Social post",generated_image:"Generated image",carousel_slide:"Carousel slide"};function I(e){var t,r;let{chatId:o,instagramConnected:l,onConnectInstagram:i,linkedinConnected:x=!1,onConnectLinkedIn:p}=e,[b,h]=(0,a.useState)([]),[f,g]=(0,a.useState)(!0),[v,y]=(0,a.useState)({}),[w,I]=(0,a.useState)({}),[S,T]=(0,a.useState)({}),[U,M]=(0,a.useState)({}),[R,z]=(0,a.useState)([]),[D,F]=(0,a.useState)(null),[O,V]=(0,a.useState)(null),[G,B]=(0,a.useState)(null),[W,$]=(0,a.useState)(""),[q,H]=(0,a.useState)({}),K=(0,a.useCallback)(async()=>{try{var e,t;let r=await fetch("/api/report/".concat(encodeURIComponent(o),"/marketing-assets"),{cache:"no-store"});if(!r.ok)return;let n=await r.json(),a=null!=(t=null==n||null==(e=n.data)?void 0:e.assets)?t:[];h(a)}catch(e){}finally{g(!1)}},[o]);(0,a.useEffect)(()=>{K();let e=window.setInterval(()=>{K()},6e4);return()=>window.clearInterval(e)},[K]);let{items:J}=function(e,t){let r=(0,a.useRef)((0,C.supabaseBrowser)()).current,[n,o]=(0,a.useState)([]),l=(0,a.useRef)(t);l.current=t;let i=(0,a.useRef)(!1),s=(0,a.useCallback)(e=>{let t=function(e){var t;if(!e)return null;let r=String(e.status||"").toLowerCase(),n=String(e.video_status||"").toLowerCase(),a=Number(e.progress)||0,o="elevator_pitch_video"===e.job_type,l=!A.has(r)&&("pending"===n||"running"===n),i=o&&!A.has(r)&&a<100;return l||i?{id:e.id,kind:o?"elevator_pitch":"promo",label:o?"Elevator pitch":"Promo video",echo:null!=(t=e.echo)?t:null,progress:a}:null}(e);o(r=>{let n=r.filter(t=>t.id!==(null==e?void 0:e.id));return t?[t,...n]:n})},[]);return(0,a.useEffect)(()=>{if(!e)return;let t=!1,n=async()=>{try{let r=await fetch("/api/report/".concat(encodeURIComponent(e),"/video-status"),{cache:"no-store"});if(!r.ok)return;let n=await r.json();if(t)return;o(Array.isArray(null==n?void 0:n.active)?n.active:[])}catch(e){}};n();let a=setInterval(()=>void n(),15e3),l=r.channel("video_status:chat_id=".concat(e)).on("postgres_changes",{event:"*",schema:"public",table:"generation_jobs",filter:"chat_id=eq.".concat(e)},e=>{if(!t){if("DELETE"===e.eventType){var r;let t=null==(r=e.old)?void 0:r.id;t&&o(e=>e.filter(e=>e.id!==t));return}s(e.new)}}).subscribe();return()=>{t=!0,clearInterval(a),r.removeChannel(l)}},[e,r,s]),(0,a.useEffect)(()=>{let e=n.length>0;if(i.current&&!e){var t;null==(t=l.current)||t.call(l)}i.current=e},[n]),{items:n,generating:n.length>0}}(o,(0,a.useCallback)(()=>{K(),window.setTimeout(()=>{K()},3e3),window.setTimeout(()=>{K()},8e3)},[K]));(0,a.useEffect)(()=>{if(!O)return;let e=e=>{"Escape"===e.key&&V(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[O]);let Q=(0,a.useCallback)(async(e,t)=>{if(v[e.id])return;let r=w[e.id];if(r)return void window.open(r,"_blank","noopener,noreferrer");y(t=>({...t,[e.id]:!0}));try{var n;let r=(null!=t?t:"").trim(),a=await k.ApiClient.post("/api/composio/instagram/publish-asset",{chatId:o,mediaUrl:e.url,mediaType:e.kind,caption:r.length>0?r:void 0}),l=await a.json().catch(()=>({}));if(!a.ok){if(409===a.status&&(null==l?void 0:l.code)==="INSTAGRAM_NOT_CONNECTED")return void j.toast.error("Instagram is not connected for this workspace.",{action:i?{label:"Connect",onClick:i}:void 0});j.toast.error((0,N.N)(l,"Failed to post to Instagram."));return}let s=null!=(n=null==l?void 0:l.permalink)?n:null;I(t=>
1({...t,[e.id]:s})),j.toast.success("Posted to Instagram!",{description:e.label,action:s?{label:"View post",onClick:()=>window.open(s,"_blank","noopener,noreferrer")}:void 0})}catch(e){j.toast.error((0,N.N)(e,"Failed to post to Instagram."))}finally{y(t=>({...t,[e.id]:!1}))}},[o,v,w,i]);(0,a.useEffect)(()=>{if(!x)return void z([]);let e=!1;return(async()=>{try{let t=await k.ApiClient.get("/api/composio/linkedin/orgs?chatId=".concat(encodeURIComponent(o)));if(!t.ok)return;let r=await t.json().catch(()=>({}));!e&&Array.isArray(null==r?void 0:r.orgs)&&z(r.orgs)}catch(e){}})(),()=>{e=!0}},[o,x]);let X=(0,a.useCallback)(async(e,t,r,n)=>{if(!S[e.id]){T(t=>({...t,[e.id]:!0}));try{var a;let l=(null!=n?n:"").trim(),i=await k.ApiClient.post("/api/composio/linkedin/publish-asset",{chatId:o,mediaUrl:e.url,mediaType:e.kind,caption:l.length>0?l:void 0,target:t,organizationId:r}),s=await i.json().catch(()=>({}));if(!i.ok){if(409===i.status&&(null==s?void 0:s.code)==="LINKEDIN_NOT_CONNECTED")return void j.toast.error("LinkedIn is not connected for this workspace.",{action:p?{label:"Connect",onClick:p}:void 0});j.toast.error((0,N.N)(s,"Failed to post to LinkedIn."));return}let d=null!=(a=null==s?void 0:s.permalink)?a:null;M(t=>({...t,[e.id]:d})),j.toast.success("Posted to LinkedIn!",{description:e.label,action:d?{label:"View post",onClick:()=>window.open(d,"_blank","noopener,noreferrer")}:void 0})}catch(e){j.toast.error((0,N.N)(e,"Failed to post to LinkedIn."))}finally{T(t=>({...t,[e.id]:!1}))}}},[o,S,p]),Y=(0,a.useCallback)((e,t)=>{let r=U[e.id];return r?void window.open(r,"_blank","noopener,noreferrer"):"video"===e.kind?void j.toast.error("LinkedIn video uploads aren't supported yet â post an image instead."):R.length>0?void F(e):void X(e,"person",void 0,t)},[U,R,X]);if(f&&0===J.length)return(0,n.jsxs)("div",{className:"h-full flex flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-sm",children:[(0,n.jsx)("div",{className:"flex items-center justify-between gap-2 px-4 py-2.5 border-b border-border/70",children:(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Marketing assets"})}),(0,n.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground",children:[(0,n.jsx)(s.A,{className:"w-3.5 h-3.5 animate-spin","aria-hidden":"true"}),"Loadingâ¦"]})]});if(0===b.length&&0===J.length)return(0,n.jsxs)("div",{className:"h-full flex flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-sm",children:[(0,n.jsx)("div",{className:"flex items-center justify-between gap-2 px-4 py-2.5 border-b border-border/70",children:(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Marketing assets"})}),(0,n.jsx)("p",{className:"px-4 py-3 text-[11px] text-muted-foreground leading-relaxed",children:"No videos or images yet. Generate a promo video or branding kit and they'll show up here."})]});let Z=b.length+J.length,ee=b.slice(0,3);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"h-full w-full min-w-0 flex flex-col self-stretch overflow-hidden rounded-2xl border border-border bg-background shadow-sm",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 px-4 py-2.5 border-b border-border/70",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Marketing assets"}),(0,n.jsxs)("span",{className:"shrink-0 text-[10px] text-muted-foreground tabular-nums",children:[Z," ",1===Z?"item":"items"]})]}),J.length>0&&(0,n.jsx)("div",{className:"border-b border-border/60 px-4 py-2","aria-live":"polite",children:J.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,n.jsxs)("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-foreground
1/30 opacity-60"}),(0,n.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-foreground/50"})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("p",{className:"truncate text-xs font-medium text-foreground",children:[e.label," rendering"]}),(0,n.jsx)("p",{className:"truncate text-[10px] text-muted-foreground",children:"Usually 2â5 minutes"})]}),(0,n.jsx)(s.A,{className:"shrink-0 w-3.5 h-3.5 text-muted-foreground animate-spin","aria-hidden":"true"})]},"generating-".concat(e.id)))}),(0,n.jsx)("ul",{className:"divide-y divide-border/60",children:ee.map(e=>{var t,r,a;let o=null!=(t=w[e.id])?t:null,l=null!=(r=U[e.id])?r:null,i="video"===e.kind,x=null!=(a=_[e.source])?a:e.source,p=!!o||!!l,b=!!v[e.id]||!!S[e.id];return(0,n.jsx)("li",{children:(0,n.jsxs)("div",{className:"group flex min-w-0 items-center gap-2.5 px-4 py-2 hover:bg-muted/50 transition-colors",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>V(e),className:"flex min-w-0 flex-1 items-center gap-2.5 text-left",title:"Preview ".concat(e.label),children:[(0,n.jsx)("div",{className:"relative shrink-0 w-10 h-10 rounded-md overflow-hidden bg-muted",children:(()=>{let t=!!q[e.id],r=()=>H(t=>({...t,[e.id]:!0}));if(i){var a;return(0,n.jsxs)(n.Fragment,{children:[e.thumbnailUrl&&!t?(0,n.jsx)("img",{src:e.thumbnailUrl,alt:"",className:"w-full h-full object-cover",onError:r}):(0,n.jsx)("video",{src:(a=e.url).includes("#")?a:"".concat(a,"#t=0.1"),className:"w-full h-full object-cover",muted:!0,playsInline:!0,preload:"metadata"}),(0,n.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:(0,n.jsx)(d.A,{className:"w-3 h-3 text-white","aria-hidden":"true"})})]})}return e.thumbnailUrl&&!t?(0,n.jsx)("img",{src:e.thumbnailUrl,alt:"",className:"w-full h-full object-cover",onError:r}):(0,n.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,n.jsx)(c.A,{className:"w-3.5 h-3.5 text-muted-foreground","aria-hidden":"true"})})})()}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-foreground",title:e.label,children:e.label}),p&&(0,n.jsx)("span",{className:"shrink-0 rounded-pill bg-emerald-500/15 px-1.5 py-0.5 text-[9px] font-semibold text-emerald-600 dark:text-emerald-400",children:"Live"})]}),(0,n.jsx)("p",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:x})]})]}),(0,n.jsx)("button",{type:"button",disabled:b,onClick:()=>{if(p){let e=null!=o?o:l;e&&window.open(e,"_blank","noopener,noreferrer");return}B(e),$("")},className:"shrink-0 rounded-full p-1.5 transition-all disabled:opacity-50 ".concat(p?"text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/10":"text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-muted hover:text-foreground"),title:p?"View live post":"Post to socials",children:b?(0,n.jsx)(s.A,{className:"w-3.5 h-3.5 animate-spin","aria-hidden":"true"}):p?(0,n.jsx)(u.A,{className:"w-3.5 h-3.5","aria-hidden":"true"}):(0,n.jsx)(m.A,{className:"w-3.5 h-3.5","aria-hidden":"true"})})]})},e.id)})}),b.length>3&&(0,n.jsxs)("p",{className:"border-t border-border/60 px-4 py-1.5 text-[10px] font-medium text-muted-foreground",children:["+",b.length-3," more assets"]})]}),(0,n.jsx)(L,{asset:O,onClose:()=>V(null)}),(0,n.jsx)(E,{asset:D,orgs:R,onClose:()=>F(null),onPick:(e,t)=>{F(null),D&&X(D,e,t,W)}}),(0,n.jsx)(P,{asset:G,caption:W,onCaptionChange:$,onClose:()=>B(null),instagramConnected:l,linkedinConnected:x,igPosting:!!G&&!!v[G.id],liPosting:!!G&&!!S[G.id],igPermalink:G&&null!=(t=w[G.id])?t:null,liPermalink:G&&null!=(r=U[G.id])?r:null,onPostInstagram:()=>G&&void Q(G,W),onConnectInstagram:i,onPostLinkedIn:()=>G&&Y(G,W),onConnectLinkedIn:p})]})}function P(e){let{asset:t,caption:r,onCaptionChange:d,onClose:c,instagramConnected:m,linkedinConnected:g,igPosting:v,liPosting:y,igPermalink:w,liPermalink:j,onPostInstagram:k,onConnectInstagram:N,onPostLinkedIn:C,onConnectLinkedIn:A}=e;(0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&c()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,c]);let _=(null==t?void 0:t.kind)==="video",I=!!t&&!_;return(0,o.createPortal)((0,n.jsx)(l.N,{children:t&&(0,n.jsx)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[99999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:c,role:"dialog","aria-modal":"true","aria-label":"Post ".concat(t.label),children:(0,n.jsxs)(i.P.div,{initial:{opacity:0,scale:.96,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:8},transition:{duration:.2,ease:[.4,0,.2,1]},className:"relative w-full max-w-md rounded-2xl border border-border bg-card shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Post to socials"}),(0,n.jsx)("button",{type:"button",onClick:c,className:"w-7 h-7 rounded-full bg-muted hover:bg-muted/70 flex items-center justify-center text-muted-foreground hover:text-foreground transition","aria-label":"Close",children:(0,n.jsx)(x.A,{className:"w-3.5 h-3.5"})})]}),(0,n.jsxs)("div",{className:"p-4 flex flex-col gap-3 overflow-y-auto",children:[(0,n.jsx)("div",{className:"rounded-xl overflow-hidden border border-border bg-muted/40 flex items-center justify-center max-h-56",children:_?(0,n.jsx)("video",{src:t.url,className:"w-full max-h-56 object-contain",controls:!0,playsInline:!0}):(0,n.jsx)("img",{src:t.url,alt:t.label,className:"w-full max-h-56 object-contain"})}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("label",{htmlFor:"composer-caption",className:"text-[11px] font-medium text-foreground",children:["Caption ",(0,n.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,n.jsx)("textarea",{id:"composer-caption",value:r,onChange:e=>d(e.target.value.slice(0,2200)),rows:3,placeholder:"Write a caption for this postâ¦",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-ring resize-none"})]})]}),(0,n.jsxs)("div",{className:"px-4 py-3 border-t border-border flex flex-col gap-2",children:[w?(0,n.jsxs)("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-lg border border-emerald-500/40 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400 px-3 py-2 text-sm font-medium hover:bg-emerald-500/10 transition",children:[(0,n.jsx)(u.A,{className:"w-4 h-4","aria-hidden":"true"}),"Posted to Instagram â View",(0,n.jsx)(p.A,{className:"w-3.5 h-3.5 opacity-70","aria-hidden":"true"})]}):m?(0,n.jsxs)("button",{type:"button",onClick:k,disabled:v,className:"inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-3 py-2 text-sm font-semibold text-background hover:bg-foreground
1/90 transition-colors disabled:opacity-50",children:[v?(0,n.jsx)(s.A,{className:"w-4 h-4 animate-spin","aria-hidden":"true"}):(0,n.jsx)(h.A,{className:"w-4 h-4","aria-hidden":"true"}),v?"Postingâ¦":"Post to Instagram"]}):(0,n.jsxs)("button",{type:"button",onClick:()=>null==N?void 0:N(),disabled:!N,className:"inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground hover:bg-muted transition disabled:opacity-50",children:[(0,n.jsx)(b.A,{className:"w-4 h-4","aria-hidden":"true"}),"Connect Instagram"]}),I&&(j?(0,n.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-lg border border-emerald-500/40 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400 px-3 py-2 text-sm font-medium hover:bg-emerald-500/10 transition",children:[(0,n.jsx)(u.A,{className:"w-4 h-4","aria-hidden":"true"}),"Posted to LinkedIn â View",(0,n.jsx)(p.A,{className:"w-3.5 h-3.5 opacity-70","aria-hidden":"true"})]}):g?(0,n.jsxs)("button",{type:"button",onClick:C,disabled:y,className:"inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm font-semibold text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:[y?(0,n.jsx)(s.A,{className:"w-4 h-4 animate-spin","aria-hidden":"true"}):(0,n.jsx)(f.A,{className:"w-4 h-4","aria-hidden":"true"}),y?"Postingâ¦":"Post to LinkedIn"]}):(0,n.jsxs)("button",{type:"button",onClick:()=>null==A?void 0:A(),disabled:!A,className:"inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground hover:bg-muted transition disabled:opacity-50",children:[(0,n.jsx)(b.A,{className:"w-4 h-4","aria-hidden":"true"}),"Connect LinkedIn"]}))]})]})})}),document.body)}function E(e){let{asset:t,orgs:r,onClose:a,onPick:s}=e;return(0,o.createPortal)((0,n.jsx)(l.N,{children:t&&(0,n.jsx)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[99999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:a,role:"dialog","aria-modal":"true","aria-label":"Choose where to post on LinkedIn",children:(0,n.jsxs)(i.P.div,{initial:{opacity:0,scale:.96,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:8},transition:{duration:.2,ease:[.4,0,.2,1]},className:"relative w-full max-w-sm rounded-2xl border border-border bg-card shadow-2xl overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Post to LinkedIn"}),(0,n.jsx)("button",{type:"button",onClick:a,className:"w-7 h-7 rounded-full bg-muted hover:bg-muted/70 flex items-center justify-center text-muted-foreground hover:text-foreground transition","aria-label":"Close",children:(0,n.jsx)(x.A,{className:"w-3.5 h-3.5"})})]}),(0,n.jsxs)("div",{className:"p-3 flex flex-col gap-1.5",children:[(0,n.jsx)("p",{className:"px-1 pb-1 text-[11px] text-muted-foreground truncate",title:t.label,children:t.label}),(0,n.jsxs)("button",{type:"button",onClick:()=>s("person"),className:"flex items-center gap-2.5 rounded-xl border border-border bg-background px-3 py-2.5 text-left hover:bg-muted transition",children:[(0,n.jsx)(g.A,{className:"w-4 h-4 text-muted-foreground shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Personal profile"})]}),r.map(e=>{var t;return(0,n.jsxs)("button",{type:"button",onClick:()=>s("organization",e.id),className:"flex items-center gap-2.5 rounded-xl border border-border bg-background px-3 py-2.5 text-left hover:bg-muted transition",children:[(0,n.jsx)(v.A,{className:"w-4 h-4 text-muted-foreground shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:null!=(t=e.name)?t:"Company page ".concat(e.id)})]},e.id)})]})]})})}),document.body)}function L(e){var t;let{asset:r,onClose:d}=e,[u,m]=(0,a.useState)(!1),b=(0,a.useCallback)(async()=>{if(r&&!u){m(!0);try{let e=await fetch(r.url);if(!e.ok)throw Error("HTTP ".concat(e.status));let t=await e.blob(),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download=function(e){let t=e.label.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")||e.source,r="video"===e.kind?"mp4":"png";try{let t=new URL(e.url).pathname.match(/\.([a-z0-9]{2,5})$/i);t&&(r=t[1].toLowerCase())}catch(e){}return"".concat(t,".").concat(r)}(r),document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(n)}catch(e){window.open(r.url,"_blank","noopener,noreferrer"),j.toast.error("Couldn't download directly â opened the file in a new tab.")}finally{m(!1)}}},[r,u]);return(0,o.createPortal)((0,n.jsx)(l.N,{children:r&&(0,n.jsx)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[99999] flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",onClick:d,role:"dialog","aria-modal":"true","aria-label":r.label,children:(0,n.jsxs)(i.P.div,{initial:{opacity:0,scale:.96,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:8},transition:{duration:.2,ease:[.4,0,.2,1]},className:"relative w-full max-w-3xl rounded-2xl border border-border bg-card shadow-2xl overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:r.label,children:r.label}),(0,n.jsxs)("p",{className:"text-[11px] text-muted-foreground inline-flex items-center gap-1",children:["video"===r.kind?(0,n.jsx)(y.A,{className:"w-3 h-3"}):(0,n.jsx)(c.A,{className:"w-3 h-3"}),null!=(t=_[r.source])?t:r.source]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,n.jsxs)("button",{type:"button",onClick:b,disabled:u,className:"inline-flex items-center gap-1 rounded-md border border-border bg-background px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition disabled:opacity-50",title:"Download",children:[u?(0,n.jsx)(s.A,{className:"w-3 h-3 animate-spin","aria-hidden":"true"}):(0,n.jsx)(w.A,{className:"w-3 h-3","aria-hidden":"true"}),"Download"]}),(0,n.jsxs)("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md border border-border bg-background px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition",title:"Open in new tab",children:[(0,n.jsx)(p.A,{className:"w-3 h-3","aria-hidden":"true"}),"Open"]}),(0,n.jsx)("button",{type:"button",onClick:d,className:"w-8 h-8 rounded-full bg-muted hover:bg-muted/70 flex items-center justify-center text-muted-foreground hover:text-foreground transition",title:"Close preview","aria-label":"Close preview",children:(0,n.jsx)(x.A,{className:"w-4 h-4"})})]})]}),(0,n.jsx)("div",{className:"flex items-center justify-center bg-black/90 max-h-[75vh]",children:"video"===r.kind?(0,n.jsx)("video",{src:r.url,className:"max-h-[75vh] w-full object-contain",controls:!0,autoPlay:!0,playsInline:!0}):(0,n.jsx)("img",{src:r.url,alt:r.label,className:"max-h-[75vh] w-full object-contain"})})]})})}),document.body)}},18085:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(55129).A)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},27209:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(55129).A)("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]])},67161:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(55129).A)("instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]])}}]);
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.