import{u as z,r,a as p,j as e,H as P,A as k,m as v,L as g}from"./app-vYFZLebK.js";import{A as L}from"./AuthenticatedLayout-dsnBHnD2.js";import{P as A}from"./ProBackground-HBykvu3f.js";import{L as D}from"./layout-grid-Ay3pGy7V.js";import{L as $}from"./list-BXGFkwwy.js";import{S as f,X as M}from"./x-5fjm0jEE.js";import{T as S}from"./trash-2-BGObRuXj.js";import{E}from"./external-link-BCJ81ubv.js";import{D as G}from"./NotificationDropdown-hhsBJy8C.js";import{S as T}from"./search-DsXnzbTV.js";import{P as B}from"./plus-Df4Mh6JJ.js";import{A as F}from"./activity-CppUmAwx.js";import{S as O}from"./save-Bzp-2mRa.js";import"./ThemeSwitcher-C0dt0hQX.js";import"./transition-6I0c9VKA.js";import"./mail-CgMp0qFW.js";function H({project:i}){const[s,o]=r.useState(null);r.useEffect(()=>{(async()=>{try{const l=await p.get(`/api/projects/${i.slug}`);o(l.data)}catch{}})()},[i.slug]);const a=r.useMemo(()=>s?`
            <!DOCTYPE html>
            <html>
            <head>
                <style>
                    html, body { background: #1d1e22; margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
                    ${s.code?.css||""}
                </style>
            </head>
            <body>${s.code?.html||""}</body>
            </html>
        `:"",[s]);return e.jsx("div",{className:"w-full h-full bg-[#1d1e22] relative overflow-hidden",children:s?e.jsx("div",{className:"absolute inset-0 w-full h-full group-hover:scale-110 transition-transform duration-[2s]",children:e.jsx("iframe",{srcDoc:a,title:"t",className:"border-none pointer-events-none absolute",style:{width:"400%",height:"400%",transform:"scale(0.25)",transformOrigin:"0 0"},sandbox:"allow-scripts"})}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-white/5",children:e.jsx("div",{className:"w-4 h-4 border-2 border-cyan-500/20 border-t-cyan-500 rounded-full animate-spin"})})})}function I({project:i,onClose:s,onUpdate:o}){const[a,n]=r.useState({is_public:i.is_public?1:0,category:i.category||"",tags:Array.isArray(i.tags)?i.tags.join(", "):"",meta_title:i.meta_title||"",meta_description:i.meta_description||"",meta_keywords:i.meta_keywords||""}),[l,u]=r.useState(!1),y=async d=>{d.preventDefault(),u(!0);try{const x=a.tags.split(",").map(b=>b.trim()).filter(Boolean),m=await p.put(`/api/projects/${i.id}`,{...a,tags:x,is_public:!!Number(a.is_public)});o(m.data),s()}catch{}finally{u(!1)}};return e.jsx(v.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:e.jsxs(v.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},className:"bg-[var(--bg-surface)] border border-[var(--border)] rounded-2xl w-full max-w-xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[e.jsxs("div",{className:"p-6 border-b border-[var(--border)] flex justify-between items-center bg-[var(--bg-elevated)]",children:[e.jsxs("h3",{className:"text-sm font-black text-[var(--text-main)] uppercase tracking-widest italic flex items-center",children:[e.jsx(f,{className:"mr-3 text-cyan-500",size:16})," Module Configuration"]}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] hover:text-[var(--text-main)]",children:e.jsx(M,{size:20})})]}),e.jsxs("form",{onSubmit:y,className:"p-8 space-y-6 overflow-y-auto custom-scrollbar text-left",children:[e.jsxs("div",{className:"bg-[var(--bg-elevated)] p-4 rounded border border-[var(--border)] flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-[10px] font-black text-[var(--text-main)] uppercase tracking-widest mb-1",children:"Access Protocol"}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] uppercase tracking-widest font-bold",children:a.is_public?"Global Network":"Secure local"})]}),e.jsxs("div",{className:"flex bg-[var(--bg-main)] rounded p-1 border border-[var(--border)]",children:[e.jsx("button",{type:"button",onClick:()=>n({...a,is_public:1}),className:`px-4 py-1.5 rounded text-[9px] font-black uppercase tracking-widest transition-all ${a.is_public?"bg-cyan-500 text-white dark:text-black shadow-lg":"text-[var(--text-muted)] hover:text-[var(--text-main)]"}`,children:"Public"}),e.jsx("button",{type:"button",onClick:()=>n({...a,is_public:0}),className:`px-4 py-1.5 rounded text-[9px] font-black uppercase tracking-widest transition-all ${a.is_public?"text-[var(--text-muted)] hover:text-[var(--text-main)]":"bg-rose-500 text-white shadow-lg"}`,children:"Private"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-[10px] font-black text-cyan-500 uppercase tracking-[0.3em] border-b border-[var(--border)] pb-2",children:"Categorization"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-[var(--text-muted)]",children:"Category"}),e.jsx("input",{type:"text",value:a.category,onChange:d=>n({...a,category:d.target.value}),className:"w-full bg-[var(--bg-main)] border border-[var(--border)] rounded p-3 text-[var(--text-main)] focus:border-cyan-500/50 focus:ring-0 text-[10px] font-bold uppercase tracking-widest"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-[var(--text-muted)]",children:"Tags"}),e.jsx("input",{type:"text",value:a.tags,onChange:d=>n({...a,tags:d.target.value}),className:"w-full bg-[var(--bg-main)] border border-[var(--border)] rounded p-3 text-[var(--text-main)] focus:border-cyan-500/50 focus:ring-0 text-[10px] font-bold"})]})]})]}),e.jsx("div",{className:"pt-4 flex justify-end sticky bottom-0 bg-[var(--bg-surface)] py-4 border-t border-[var(--border)]",children:e.jsxs("button",{type:"submit",disabled:l,className:"btn-primary w-full md:w-auto",children:[l?e.jsx(F,{className:"animate-spin mr-2 inline",size:14}):e.jsx(O,{className:"mr-2 inline",size:14})," Save_Configuration"]})})]})]})})}function ie(){const{auth:i}=z().props,[s,o]=r.useState([]),[a,n]=r.useState(!0),[l,u]=r.useState(""),[y,d]=r.useState(null),[x,m]=r.useState(null),[b,j]=r.useState("grid"),[h,_]=r.useState("ALL");r.useEffect(()=>{p.get("/api/projects").then(t=>o(t.data)).finally(()=>n(!1))},[]);const N=async t=>{if(confirm("Destroy module?"))try{await p.delete(`/api/projects/${t}`),o(s.filter(c=>c.id!==t))}catch{}},C=r.useMemo(()=>["ALL",...new Set(s.map(t=>t.category).filter(Boolean))],[s]),w=s.filter(t=>t.title.toLowerCase().includes(l.toLowerCase())&&(h==="ALL"||t.category===h));return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)] font-sans selection:bg-cyan-500/30 relative transition-colors duration-300 text-left",children:[e.jsx(A,{}),e.jsxs(L,{header:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center w-full gap-4 relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-2 bg-cyan-500/10 border border-cyan-500/20 rounded",children:e.jsx(G,{className:"text-cyan-500",size:20})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-black text-[var(--text-main)] uppercase italic leading-none",children:"Archives"}),e.jsx("p",{className:"text-[8px] text-cyan-500 font-bold uppercase tracking-[0.4em] mt-1",children:"Personal Memory Blocks"})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center w-full md:w-auto gap-4",children:[e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx(T,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-muted)]",size:14}),e.jsx("input",{type:"text",placeholder:"Filter_Data...",value:l,onChange:t=>u(t.target.value),className:"bg-[var(--bg-surface)] border border-[var(--border)] rounded pl-10 pr-4 py-2 text-[10px] font-bold uppercase tracking-widest focus:border-cyan-500/50 w-full"})]}),e.jsxs(g,{href:route("editor"),className:"btn-primary whitespace-nowrap",children:[e.jsx(B,{className:"mr-2 inline",size:14})," New_Module"]})]})]}),children:[e.jsx(P,{title:"My Neural Archives"}),e.jsx("div",{className:"relative min-h-screen p-6 md:p-12 overflow-y-auto",children:e.jsxs("div",{className:"max-w-7xl mx-auto relative z-10 space-y-10",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-6 bg-[var(--bg-surface)] border border-[var(--border)] p-6 rounded-lg shadow-xl",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(t=>e.jsx("button",{onClick:()=>_(t),className:`px-4 py-1.5 rounded text-[9px] font-bold uppercase tracking-widest transition-all border ${h===t?"bg-cyan-500 text-white dark:text-black border-cyan-500":"bg-[var(--bg-elevated)] text-[var(--text-muted)] border-[var(--border)] hover:text-[var(--text-main)]"}`,children:t},t))}),e.jsxs("div",{className:"flex bg-[var(--bg-elevated)] p-1 rounded border border-[var(--border)]",children:[e.jsx("button",{onClick:()=>j("grid"),className:`p-2 rounded ${b==="grid"?"bg-[var(--bg-main)] text-[var(--text-main)] shadow-sm":"text-[var(--text-muted)]"}`,children:e.jsx(D,{size:16})}),e.jsx("button",{onClick:()=>j("list"),className:`p-2 rounded ${b==="list"?"bg-[var(--bg-main)] text-[var(--text-main)] shadow-sm":"text-[var(--text-muted)]"}`,children:e.jsx($,{size:16})})]})]}),e.jsx(k,{mode:"wait",children:a?e.jsxs("div",{className:"py-48 flex flex-col items-center gap-4",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500/20 border-t-cyan-500 rounded-full animate-spin"}),e.jsx("span",{className:"text-[10px] font-bold text-cyan-500 uppercase tracking-widest",children:"Scanning..."})]}):b==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:w.map((t,c)=>e.jsxs(v.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:c*.05},className:"group bg-[var(--bg-surface)] border border-[var(--border)] rounded-lg overflow-hidden hover:border-cyan-500/30 transition-all shadow-lg text-left",children:[e.jsxs("div",{className:"aspect-video bg-black relative border-b border-[var(--border)] overflow-hidden",children:[e.jsx(H,{project:t}),e.jsx("div",{className:"absolute top-3 left-3 flex flex-wrap gap-2 z-20",children:t.category&&e.jsx("span",{className:"px-2 py-0.5 bg-black/60 border border-white/10 rounded text-[8px] font-bold uppercase text-cyan-400 tracking-widest",children:t.category})}),e.jsx("div",{className:`absolute top-3 right-3 px-2 py-0.5 rounded border text-[8px] font-bold uppercase tracking-widest z-20 ${t.is_public?"bg-cyan-500/10 border-cyan-500/30 text-cyan-500":"bg-rose-500/10 border-rose-500/30 text-rose-500"}`,children:t.is_public?"Global":"Secure"})]}),e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-black text-[var(--text-main)] uppercase italic tracking-tight group-hover:text-cyan-500 transition-colors mb-6 truncate",children:t.title}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{href:route("editor",{slug:t.slug}),className:"flex-1 btn-primary text-center",children:"Open"}),e.jsx("button",{onClick:()=>m(t),className:"p-2.5 bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-main)] rounded border border-[var(--border)] transition-all",children:e.jsx(f,{size:14})}),e.jsx("button",{onClick:()=>N(t.id),className:"p-2.5 bg-rose-500/5 text-rose-500 hover:bg-rose-500 hover:text-white rounded border border-rose-500/10 transition-all",children:e.jsx(S,{size:14})})]})]})]},t.id))}):e.jsx("div",{className:"bg-[var(--bg-surface)] border border-[var(--border)] rounded-lg overflow-hidden shadow-xl",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[var(--bg-elevated)] text-[9px] font-black uppercase tracking-[0.3em] text-[var(--text-muted)] border-b border-[var(--border)]",children:[e.jsx("th",{className:"px-6 py-4",children:"Module"}),e.jsx("th",{className:"px-6 py-4",children:"Sector"}),e.jsx("th",{className:"px-6 py-4",children:"Sync"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Uplink"})]})}),e.jsx("tbody",{className:"divide-y divide-[var(--border)]",children:w.map(t=>e.jsxs("tr",{className:"hover:bg-[var(--bg-elevated)] transition-colors",children:[e.jsx("td",{className:"px-6 py-4 font-bold uppercase italic text-sm text-[var(--text-main)]",children:t.title}),e.jsx("td",{className:"px-6 py-4 text-[10px] font-bold text-[var(--text-muted)]",children:t.category||"General"}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:`text-[9px] font-bold uppercase ${t.is_public?"text-cyan-500":"text-rose-500"}`,children:t.is_public?"Global":"Secure"})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g,{href:route("editor",{slug:t.slug}),className:"p-1.5 hover:text-cyan-500 transition-colors",children:e.jsx(E,{size:14})}),e.jsx("button",{onClick:()=>m(t),className:"p-1.5 hover:text-[var(--text-main)] transition-colors",children:e.jsx(f,{size:14})}),e.jsx("button",{onClick:()=>N(t.id),className:"p-1.5 hover:text-rose-500 transition-colors",children:e.jsx(S,{size:14})})]})})]},t.id))})]})})})]})})]}),e.jsx(k,{children:x&&e.jsx(I,{project:x,onClose:()=>m(null),onUpdate:t=>o(s.map(c=>c.id===t.id?t:c))})})]})}export{ie as default};
