1import{j as e,m as t,A as y}from"./vendor-motion-DeqZC-4t.js";import{r as l}from"./vendor-react-DhMA_kEV.js";import{s as j}from"./index-WqAUWWUN.js";import{c as v}from"./App-CVGAgymZ.js";import{aR as o,aS as g}from"./vendor-icons-xAlReevQ.js";import{M as p}from"./index-CG3MEsji.js";import"./vendor-supabase-CHGq0V2O.js";import"./vendor-query-cy1x5wk5.js";import"./vendor-charts-DKUbyPp_.js";import"./logChunkLoadFailure-BWuYLh8E.js";function E({slug:m,title:x,summary:u,vibeScore:i,cachedData:f}){var d;const[s,b]=l.useState(f||null),[a,c]=l.useState(!1),h=async()=>{c(!0);try{const{data:n,error:r}=await j.functions.invoke("topic-autopsy",{body:{slug:m,title:x,summary:u,vibe_score:i}});if(r)throw r;b(n)}catch{v.error("Failed to generate autopsy")}c(!1)};return i>7?null:e.jsxs("div",{className:"brutal-card bg-card overflow-hidden",children:[e.jsx("div",{className:"p-5 border-b-3 border-foreground/10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o,{className:"w-5 h-5 text-vibe-red"}),e.jsx("h3",{className:"font-display font-bold text-lg",children:"Topic Autopsy"}),e.jsxs("span",{className:"font-mono text-[11px] uppercase tracking-widest text-muted-foreground ml-2",children:["Vibe: ",i,"/10"]})]}),!s&&!a&&e.jsxs(t.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:h,className:"px-4 py-1.5 bg-vibe-red text-primary-foreground font-display font-bold text-xs uppercase rounded-sm",children:[e.jsx(g,{className:"w-3 h-3 inline mr-1"}),"Autopsy"]})]})}),e.jsxs(y,{mode:"wait",children:[a&&e.jsxs(t.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"p-8 flex flex-col items-center",children:[e.jsx(t.div,{animate:{y:[0,-5,0]},transition:{duration:1.5,repeat:1/0},children:e.jsx(o,{className:"w-10 h-10 text-vibe-red"})}),e.jsx("p",{className:"font-display font-bold text-sm mt-3",children:"Performing forensic analysisâ¦"})]}),!a&&s&&e.jsxs(t.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"p-5 space-y-4",children:[e.jsxs("div",{className:"bg-vibe-red/5 border-2 border-vibe-red/20 rounded-sm p-4",children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-widest text-vibe-red",children:"Cause of Death"}),e.jsx("p",{className:"font-display font-bold text-base mt-1",children:s.cause})]}),e.jsxs("div",{className:"bg-vibe-green/5 border-2 border-vibe-green/20 rounded-sm p-4",children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-widest text-vibe-green",children:"Peak Moment"}),e.jsx("div",{className:"font-body text-sm mt-1 prose prose-sm max-w-none",children:e.jsx(p,{children:s.peak})})]}),e.jsxs("div",{className:"bg-vibe-orange/5 border-2 border-vibe-orange/20 rounded-sm p-4",children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-widest text-vibe-orange",children:"The Decline"}),e.jsx("div",{className:"font-body text-sm mt-1 prose prose-sm max-w-none",children:e.jsx(p,{children:s.decline})})]}),((d=s.successors)==null?void 0:d.length)>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-widest text-muted-foreground",children:"Spiritual Successors"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:s.successors.map((n,r)=>e.jsx("span",{className:"px-3 py-1 bg-vibe-purple/10 text-vibe-purple font-display font-bold text-xs uppercase rounded-sm",children:n},r))})]})]}),!a&&!s&&e.jsxs(t.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"p-8 text-center text-muted-foreground",children:[e.jsx(o,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),e.jsx("p",{className:"font-body text-sm",children:"Forensic analysis of why this trend peaked and declined"})]})]})]})}export{E 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.