1import{r as i,B as k,k as f,j as e,f as o}from"./index-BseVR5nP.js";import{B as j}from"./button-BUwGLm5M.js";import{L as y}from"./loader-circle-B0DX2VUr.js";import{Z as N}from"./zap-DhDUJ4so.js";import{N as S}from"./network-DJmjrrGk.js";import{C as E}from"./circle-check-DdfhjGxc.js";import{C as G}from"./circle-alert-q-dLqW1x.js";import{B as q}from"./book-open-BSDeZ9Uo.js";import{E as v}from"./external-link-BjSbGs-1.js";function T(){const[a,d]=i.useState(null),[n,c]=i.useState(null),[m,x]=i.useState(null),p=k(),{data:l=[],isLoading:C}=f({queryKey:["content-clusters"],queryFn:()=>o.entities.ContentCluster.filter({status:"active"})}),{data:w=[]}=f({queryKey:["cluster-templates"],queryFn:async()=>(await o.functions.invoke("generateContentCluster",{action:"list"})).data.clusters||[]}),u=async s=>{try{d(s===void 0?"all":s),x(null),c(null);const t=s!==void 0?{clusterIndex:s}:{},r=await o.functions.invoke("generateContentCluster",t);c(r.data),p.invalidateQueries({queryKey:["content-clusters"]}),p.invalidateQueries({queryKey:["blog-posts-published"]})}catch(t){x(t.message)}finally{d(null)}},g=["border-primary/30 bg-primary/5","border-accent/30 bg-accent/5","border-purple-500/30 bg-purple-500/5","border-blue-500/30 bg-blue-500/5","border-green-500/30 bg-green-500/5"];return e.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"flex items-start justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-black text-foreground mb-1",children:"SEO Content Clusters"}),e.jsx("p",{className:"text-muted-foreground text-sm max-w-xl",children:"Build topical authority with interlinking pillar + supporting post clusters. Each cluster targets a keyword theme with a parent pillar guide and 4â5 supporting articles, all cross-linked."})]}),e.jsxs(j,{onClick:()=>u(void 0),disabled:a!==null,className:"gap-2 shrink-0",children:[a==="all"?e.jsx(y,{className:"w-4 h-4 animate-spin"}):e.jsx(N,{className:"w-4 h-4"}),a==="all"?"Generating...":"Generate All Clusters"]})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-5 mb-8",children:[e.jsxs("h2",{className:"font-bold text-foreground text-sm mb-3 flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4 text-primary"})," How Clusters Work"]}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-4 text-sm",children:[{step:"1",title:"Pillar Post",desc:'One comprehensive parent guide targeting the main keyword (e.g. "Best Cannabis Dispensaries in Ontario").'},{step:"2",title:"Supporting Posts",desc:"4â6 focused articles targeting long-tail keywords, each linking back to the pillar and to each other."},{step:"3",title:"Topical Authority",desc:"Google sees the entire cluster as authoritative coverage of the topic â boosting all posts in the cluster."}].map(({step:s,title:t,desc:r})=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-6 h-6 bg-primary/10 border border-primary/20 rounded-full flex items-center justify-center text-primary text-xs font-bold shrink-0 mt-0.5",children:s}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground mb-0.5",children:t}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:r})]})]},s))})]}),n&&e.jsxs("div",{className:"bg-primary/5 border border-primary/20 rounded-xl p-5 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(E,{className:"w-4 h-4 text-primary"}),e.jsxs("span",{className:"font-semibold text-foreground",children:["Generation Complete â ",n.total_created," posts created"]})]}),n.results?.map((s,t)=>e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[e.jsxs("span",{className:"text-foreground font-medium",children:[s.cluster,":"]})," ",s.created," new posts"]},t))]}),m&&e.jsxs("div",{className:"bg-destructive/10 border border-destructive/30 rounded-xl p-4 mb-6 flex gap-3",children:[e.jsx(G,{className:"w-5 h-5 text-destructive shrink-0"}),e.jsx("p",{className:"text-sm text-destructive",children:m})]}),e.jsx("div",{className:"space-y-5",children:w.map((s,t)=>{const r=l.find(b=>b.slug===s.parentSlug?.replace("-2026","")+"-cluster"||b.name===s.name),h=a===t;return e.jsxs("div",{className:`border rounded-xl p-5 ${g[t%g.length]}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:["Cluster ",t+1]}),r&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary border border-primary/20 px-2 py-0.5 rounded-full",children:"Active"})]}),e.jsx("h3",{className:"font-display font-bold text-foreground text-lg",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Topic: ",e.jsx("strong",{children:s.topic})," · ",s.supportingCount+1," total posts"]})]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>u(t),disabled:a!==null,className:"shrink-0 gap-1.5",children:[h?e.jsx(y,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(N,{className:"w-3.5 h-3.5"}),h?"Generating...":r?"Regenerate":"Generate"]})]}),e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-3.5 h-3.5 text-primary shrink-0"}),e.jsxs("a",{href:`/blog/${s.parentSlug}`,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-semibold text-foreground hover:text-primary transition-colors flex items-center gap-1",children:[s.parentSlug,e.jsx(v,{className:"w-3 h-3"})]}),e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded",children:"Pillar"})]})})]},t)})}),!C&&l.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsx("h2",{className:"font-bold text-foreground mb-4",children:"Active Cluster
1s in Database"}),e.jsx("div",{className:"bg-card border border-border rounded-xl overflow-hidden",children:e.jsx("div",{className:"divide-y divide-border",children:l.map(s=>e.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground text-sm",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[(s.supporting_slugs?.length||0)+1," posts · ",s.topic]})]}),e.jsxs("a",{href:`/blog/${s.parent_slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View pillar ",e.jsx(v,{className:"w-3 h-3"})]})]},s.id))})})]})]})}export{T 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.