1import{aa as k,ad as C,a9 as m,r as g,ab as j,ac as S,j as e,b$ as P,aP as u,au as T,bJ as I,E as F,B as L,an as q,bq as w,cH as E,cE as O,cG as R,cF as A,dO as K,cI as N,bv as y,bw as $}from"./vendor-BK3L2wXr.js";import{S as B}from"./skeleton-wRAdGMoi.js";import{b as D,c as M}from"./index-D3kTj3IA.js";import"./firebase-pkVJo0Dg.js";const v={tiktok:$,instagram:y,instagram_business:y,facebook:N,facebook_page:N,youtube:K,linkedin:A,twitter:R,threads:O,pinterest:E};function Q(s,i){try{return new Intl.DateTimeFormat(i,{dateStyle:"medium"}).format(new Date(s))}catch{return s}}function z({connectionIds:s,allConns:i}){const a=s.map(t=>i.find(d=>d.id===t)).filter(Boolean);if(a.length===0)return e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/5 border border-white/8 flex items-center justify-center flex-shrink-0",children:e.jsx(w,{className:"h-4 w-4 text-white/20"})});if(a.length===1){const t=v[a[0].platform];return e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/6 border border-white/8 flex items-center justify-center flex-shrink-0",children:t?e.jsx(t,{style:{width:17,height:17,color:"rgba(255,255,255,0.55)"}}):e.jsx(w,{className:"h-4 w-4 text-white/20"})})}return e.jsxs("div",{className:"flex -space-x-2 flex-shrink-0",children:[a.slice(0,3).map((t,d)=>{const l=v[t.platform];return e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-[#0f0f0f] bg-white/6 flex items-center justify-center",style:{zIndex:10-d},children:l?e.jsx(l,{style:{width:12,height:12,color:"rgba(255,255,255,0.5)"}}):null},t.id)}),a.length>3&&e.jsxs("div",{className:"w-8 h-8 rounded-full border-2 border-[#0f0f0f] bg-white/6 flex items-center justify-center text-[9px] text-white/35 font-mono",style:{zIndex:7},children:["+",a.length-3]})]})}function G({report:s}){const{t:i}=m(),a=i(`report_type_${s.reportType}`,{defaultValue:s.reportType});return s.status==="completed"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-0.5 rounded-full bg-[#a3e635]/10 border border-[#a3e635]/20 text-[#a3e635]/80 font-mono leading-none",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#a3e635]/70 flex-shrink-0"}),a]}):s.status==="processing"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-0.5 rounded-full bg-white/6 border border-white/12 text-white/55 font-mono leading-none",children:[e.jsx(u,{className:"h-2.5 w-2.5 animate-spin flex-shrink-0"}),a]}):s.status==="failed"?e.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-0.5 rounded-full bg-white/4 border border-white/8 text-white/35 font-mono leading-none line-through",children:a}):e.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] px-2.5 py-0.5 rounded-full bg-white/4 border border-white/8 text-white/35 font-mono leading-none",children:a})}function H({project:s,allConns:i,onClick:a}){const{t,i18n:d}=m(),l=s.reports.filter(n=>n.status==="completed").length,o=s.reports.filter(n=>n.status==="processing").length,x=s.reports.filter(n=>n.status==="failed").length,c=s.reports.length;return e.jsxs("button",{onClick:a,className:"w-full text-left group relative rounded-2xl border border-white/10 bg-white/[0.03] hover:bg-white/[0.05] hover:border-white/18 transition-all duration-200 overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-[#a3e635]/0 to-transparent group-hover:via-[#a3e635]/40 transition-all duration-300"}),e.jsxs("div",{className:"p-5 flex items-start gap-4",children:[e.jsx(z,{connectionIds:s.connectionIds,allConns:i}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-3 mb-2",children:[e.jsx("p",{className:"text-base font-bold text-white leading-tight truncate",children:s.name}),e.jsx("span",{className:"text-xs text-white/35 font-mono flex-shrink-0",children:Q(s.createdAt,d.language)})]}),c>0?e.jsxs("div",{className:"flex items-center gap-3 mb-2.5",children:[l>0&&e.jsxs("span",{className:"text-xs text-white/60 flex items-center gap-1",children:[e.jsx(F,{className:"h-3.5 w-3.5 text-[#a3e635]"}),t("projects_status_completed_count",{count:l})]}),o>0&&e.jsxs("span",{className:"text-xs text-white/60 flex items-center gap-1",children:[e.jsx(u,{className:"h-3.5 w-3.5 animate-spin"}),t("projects_status_processing_count",{count:o})]}),x>0&&e.jsxs("span",{className:"text-xs text-white/40 flex items-center gap-1",children:[e.jsx(L,{className:"h-3.5 w-3.5 text-white/40"}),t("projects_status_failed_count",{count:x})]})]}):e.jsx("p",{className:"text-xs text-white/35 mb-2.5",children:t("projects_no_reports")}),c>0&&e.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[s.reports.slice(0,4).map(n=>e.jsx(G,{report:n},n.id)),c>4&&e.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full bg-white/6 border border-white/10 text-white/35 font-mono leading-none",children:["+",c-4]})]})]}),e.jsx(q,{className:"h-4 w-4 text-white/25 group-hover:text-white/55 group-hover:translate-x-0.5 flex-shrink-0 transition-all duration-200 mt-1"})]})]})}function U(){const[,s]=k(),i=C(),{toast:a}=D(),{t}=m(),[d,l]=g.useState(!1),[o,x]=g.useState(""),{data:c,isLoading:n}=j({queryKey:["/api/projects"],staleTime:3e4}),{data:p}=j({queryKey:["/api/dashboard/connections"],staleTime:6e4}),_=(p==null?void 0:p.connections)||[],h=S({mutationFn:r=>M("POST","/api/projects",{name:r}),onSuccess:async r=>{const b=await r.json();i.invalidateQueries({queryKey:["/api/projects"]}
1),l(!1),x(""),b.project&&s(`/projects/${b.project.id}`)},onError:()=>{a({variant:"destructive",description:t("projects_create_error")})}}),f=(c==null?void 0:c.projects)||[];return e.jsxs("div",{className:"min-h-screen bg-[#0a0a0a] text-white",children:[e.jsx("div",{className:"border-b border-[#151515] px-4 sm:px-8 py-4 flex items-center justify-end",children:e.jsxs("button",{onClick:()=>l(r=>!r),className:"flex items-center gap-1.5 text-[12px] font-semibold text-[#0a0a0a] bg-[#a3e635] hover:bg-[#b8f040] px-3 py-1.5 rounded-xl transition-colors",children:[e.jsx(P,{className:"h-3.5 w-3.5"}),t("projects_new_project")]})}),e.jsxs("div",{className:"px-4 sm:px-8 lg:px-16 py-8 max-w-5xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-[10px] text-[#a3e635] uppercase tracking-[0.14em] mb-1.5",children:t("projects_page_label")}),e.jsx("h1",{className:"text-2xl font-extrabold tracking-tight",children:t("projects_page_title")}),e.jsx("p",{className:"text-sm text-white/50 mt-1.5",children:t("projects_page_subtitle")})]}),d&&e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-[#0f0f0f] p-4 space-y-3",children:[e.jsx("p",{className:"text-sm font-semibold text-white/80",children:t("projects_create_title")}),e.jsx("input",{type:"text",value:o,onChange:r=>x(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o.trim()&&h.mutate(o.trim())},placeholder:t("projects_name_placeholder"),autoFocus:!0,className:"w-full bg-[#1a1a1a] border border-white/8 rounded-xl px-4 py-2.5 text-sm text-white placeholder:text-white/25 outline-none focus:border-[#a3e635]/30 transition-all"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{l(!1),x("")},className:"flex-1 text-[12px] font-medium text-white/40 hover:text-white/60 py-2 rounded-xl border border-white/6 hover:border-white/10 transition-all",children:t("projects_cancel")}),e.jsx("button",{disabled:!o.trim()||h.isPending,onClick:()=>h.mutate(o.trim()),className:"flex-1 flex items-center justify-center gap-1.5 text-[12px] font-semibold text-[#0a0a0a] bg-[#a3e635] hover:bg-[#b8f040] disabled:opacity-40 py-2 rounded-xl transition-all",children:h.isPending?e.jsx(u,{className:"h-3.5 w-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"h-3.5 w-3.5"})," ",t("projects_create")]})})]})]}),n?e.jsx("div",{className:"space-y-3",children:[0,1,2].map(r=>e.jsx(B,{className:"h-28 rounded-2xl bg-white/4"},r))}):f.length===0?e.jsxs("div",{className:"flex flex-col items-center py-24 gap-5 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/4 border border-white/8 flex items-center justify-center",children:e.jsx(I,{className:"h-7 w-7 text-white/15"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white/50 text-base font-semibold mb-1",children:t("projects_empty_title")}),e.jsx("p",{className:"text-white/25 text-sm",children:t("projects_empty_subtitle")})]}),e.jsx("button",{onClick:()=>s("/dashboard"),className:"text-[12px] font-semibold text-[#0a0a0a] bg-[#a3e635] hover:bg-[#b8f040] px-5 py-2 rounded-xl transition-colors",children:t("projects_go_to_analysis")})]}):e.jsx("div",{className:"space-y-2",children:f.map(r=>e.jsx(H,{project:r,allConns:_,onClick:()=>s(`/projects/${r.id}`)},r.id))})]})]})}export{U as 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.