import { S as reactExports, J as jsxRuntimeExports } from "./server-BiCSmoPr.js";
import { h as createLucideIcon, D as DEFAULT_HOMEPAGE_CONTENT, t as readStoredHomepageContent, L as Link, p as motion, f as clearHomepageContent, x as saveHomepageContent, n as mergeHomepageContent } from "./router-K1srMTuI.js";
import { A as ArrowLeft } from "./arrow-left-DOE61fAZ.js";
import { E as Eye, U as Upload } from "./upload-BWmUxVIq.js";
import { D as Download } from "./download-DZtVm_yI.js";
import "node:async_hooks";
import "node:stream/web";
import "node:stream";
const __iconNode$3 = [
  [
    "path",
    {
      d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
      key: "1oefj6"
    }
  ],
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
  [
    "path",
    { d: "M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1", key: "1oajmo" }
  ],
  [
    "path",
    { d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1", key: "mpwhp6" }
  ]
];
const FileBraces = createLucideIcon("file-braces", __iconNode$3);
const __iconNode$2 = [
  ["rect", { width: "7", height: "9", x: "3", y: "3", rx: "1", key: "10lvy0" }],
  ["rect", { width: "7", height: "5", x: "14", y: "3", rx: "1", key: "16une8" }],
  ["rect", { width: "7", height: "9", x: "14", y: "12", rx: "1", key: "1hutg5" }],
  ["rect", { width: "7", height: "5", x: "3", y: "16", rx: "1", key: "ldoo1y" }]
];
const LayoutDashboard = createLucideIcon("layout-dashboard", __iconNode$2);
const __iconNode$1 = [
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
];
const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$1);
const __iconNode = [
  [
    "path",
    {
      d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
      key: "1c8476"
    }
  ],
  ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
  ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
];
const Save = createLucideIcon("save", __iconNode);
const SECTIONS = [{
  key: "header",
  label: "Header & Menu",
  helper: "Navigation links and mobile menu metadata."
}, {
  key: "hero",
  label: "Hero",
  helper: "First-screen headline, body, buttons, and scroll prompt."
}, {
  key: "who",
  label: "Who We Are",
  helper: "Company position, intro copy, and value pillars."
}, {
  key: "thesis",
  label: "Thesis",
  helper: "Strategic thesis intro and stacked story cards."
}, {
  key: "ecosystem",
  label: "Ecosystem",
  helper: "Seven verticals, details, tabs, and principle blocks."
}, {
  key: "portfolio",
  label: "Portfolio",
  helper: "Portfolio card copy and hover descriptions."
}, {
  key: "dashboard",
  label: "Dashboard",
  helper: "Metric counters, chart labels, and allocation rows."
}, {
  key: "founders",
  label: "Founders",
  helper: "Founder bios, quotes, and milestone timelines."
}, {
  key: "leadership",
  label: "Leadership",
  helper: "Leadership card names, roles, and details."
}, {
  key: "roadmap",
  label: "Roadmap",
  helper: "Year-by-year roadmap content."
}, {
  key: "investor",
  label: "Investor Preview",
  helper: "Investor Desk CTA and document preview list."
}, {
  key: "partnership",
  label: "Partnership CTA",
  helper: "Contact section copy and button links."
}, {
  key: "footer",
  label: "Footer",
  helper: "Footer intro, columns, links, and legal links."
}];
function TextField({
  label,
  value,
  onChange,
  multiline = false
}) {
  const baseClass = "w-full rounded-lg border border-white/10 bg-black/35 px-4 py-3 text-sm text-white outline-none transition focus:border-mint-soft/45 focus:ring-1 focus:ring-mint-soft/30";
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mb-2 block text-[10px] uppercase tracking-[0.22em] text-white/45", children: label }),
    multiline ? /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { rows: 4, value, onChange: (event) => onChange(event.target.value), className: `${baseClass} resize-y leading-6` }) : /* @__PURE__ */ jsxRuntimeExports.jsx("input", { value, onChange: (event) => onChange(event.target.value), className: baseClass })
  ] });
}
function JsonEditor({
  label,
  value,
  onChange
}) {
  const [draft, setDraft] = reactExports.useState(() => JSON.stringify(value, null, 2));
  const [error, setError] = reactExports.useState("");
  reactExports.useEffect(() => {
    setDraft(JSON.stringify(value, null, 2));
    setError("");
  }, [value]);
  function applyJson() {
    try {
      onChange(JSON.parse(draft));
      setError("");
    } catch (err) {
      setError(err instanceof Error ? err.message : "Invalid JSON.");
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[10px] uppercase tracking-[0.22em] text-white/45", children: label }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", onClick: applyJson, className: "inline-flex items-center justify-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-4 py-2 text-[10px] uppercase tracking-[0.18em] text-white transition hover:border-mint-soft/35 hover:bg-white/[0.07]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(FileBraces, { className: "h-3.5 w-3.5" }),
        " Apply JSON"
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { value: draft, onChange: (event) => setDraft(event.target.value), spellCheck: false, rows: 14, className: "w-full rounded-lg border border-white/10 bg-black/50 px-4 py-3 font-mono text-xs leading-5 text-white/82 outline-none transition focus:border-mint-soft/45 focus:ring-1 focus:ring-mint-soft/30" }),
    error ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-2 text-sm text-destructive", children: error }) : null
  ] });
}
function ContentAdmin() {
  const [content, setContent] = reactExports.useState(DEFAULT_HOMEPAGE_CONTENT);
  const [activeSection, setActiveSection] = reactExports.useState("header");
  const [status, setStatus] = reactExports.useState("");
  const [importDraft, setImportDraft] = reactExports.useState("");
  const [importError, setImportError] = reactExports.useState("");
  const activeMeta = reactExports.useMemo(() => SECTIONS.find((section) => section.key === activeSection) ?? SECTIONS[0], [activeSection]);
  reactExports.useEffect(() => {
    setContent(readStoredHomepageContent());
  }, []);
  function updateSection(key, value) {
    setContent((current) => ({
      ...current,
      [key]: value
    }));
    setStatus("");
  }
  function updateHero(key, value) {
    updateSection("hero", {
      ...content.hero,
      [key]: value
    });
  }
  function updateSimpleSection(section, key, value) {
    updateSection(section, {
      ...content[section],
      [key]: value
    });
  }
  function save() {
    saveHomepageContent(content);
    setStatus("Saved. Homepage content updates immediately in this browser.");
  }
  function reset() {
    clearHomepageContent();
    setContent(DEFAULT_HOMEPAGE_CONTENT);
    setStatus("Reset to default content.");
  }
  function exportJson() {
    navigator.clipboard?.writeText(JSON.stringify(content, null, 2));
    setStatus("Content JSON copied to clipboard.");
  }
  function importJson() {
    setImportError("");
    try {
      const nextContent = mergeHomepageContent(JSON.parse(importDraft));
      setContent(nextContent);
      saveHomepageContent(nextContent);
      setStatus("Imported and saved content JSON.");
      setImportDraft("");
    } catch (err) {
      setImportError(err instanceof Error ? err.message : "Invalid JSON.");
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("main", { className: "min-h-screen bg-background px-6 pb-24 pt-32 text-white", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mx-auto max-w-7xl", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-9 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Link, { to: "/", className: "inline-flex items-center gap-2 text-[10px] uppercase tracking-[0.25em] text-muted-foreground transition-colors hover:text-foreground", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowLeft, { className: "h-3 w-3" }),
        " Back to homepage"
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { href: "/", className: "inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-4 py-2 text-[10px] uppercase tracking-[0.18em] transition hover:border-mint-soft/35 hover:bg-white/[0.07]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-3.5 w-3.5" }),
          " Preview"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", onClick: exportJson, className: "inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-4 py-2 text-[10px] uppercase tracking-[0.18em] transition hover:border-mint-soft/35 hover:bg-white/[0.07]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Download, { className: "h-3.5 w-3.5" }),
          " Export"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", onClick: reset, className: "inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-4 py-2 text-[10px] uppercase tracking-[0.18em] transition hover:border-destructive/45 hover:bg-destructive/10", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "h-3.5 w-3.5" }),
          " Reset"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", onClick: save, className: "premium-button inline-flex items-center gap-2 rounded-lg px-5 py-2 text-[10px] uppercase tracking-[0.18em]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "h-3.5 w-3.5" }),
          " Save"
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(motion.div, { initial: {
      opacity: 0,
      y: 16
    }, animate: {
      opacity: 1,
      y: 0
    }, transition: {
      duration: 0.55
    }, className: "mb-10", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 inline-flex items-center gap-3 text-[10px] uppercase tracking-[0.35em] text-mint-soft/75", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutDashboard, { className: "h-4 w-4" }),
        " CMS Admin"
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-display max-w-4xl text-[clamp(2.4rem,6vw,5rem)] leading-[1]", children: "Homepage content editor." }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-5 max-w-2xl text-sm leading-7 text-muted-foreground md:text-base", children: "Edit public homepage copy, header links, menu text, footer links, repeated cards, and section data. Save stores the content in browser storage for the current deployment." }),
      status ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-4 text-sm text-mint-soft", children: status }) : null
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-6 lg:grid-cols-[18rem_minmax(0,1fr)]", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("aside", { className: "premium-card rounded-lg p-3 lg:sticky lg:top-28 lg:self-start", children: SECTIONS.map((section) => /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => setActiveSection(section.key), className: `flex w-full items-center justify-between rounded-lg px-4 py-3 text-left text-sm transition ${activeSection === section.key ? "bg-mint-soft/[0.12] text-white" : "text-white/62 hover:bg-white/[0.05] hover:text-white"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: section.label }) }, section.key)) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "premium-card rounded-lg p-5 sm:p-7", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-7 border-b border-white/10 pb-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[10px] uppercase tracking-[0.28em] text-mint-soft/75", children: activeMeta.label }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: activeMeta.helper })
        ] }),
        activeSection === "header" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Mobile menu kicker", value: content.header.menuKicker, onChange: (value) => updateSection("header", {
            ...content.header,
            menuKicker: value
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Mobile menu meta", value: content.header.menuMeta, onChange: (value) => updateSection("header", {
            ...content.header,
            menuMeta: value
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(JsonEditor, { label: "Navigation items", value: content.header.navItems, onChange: (value) => updateSection("header", {
            ...content.header,
            navItems: value
          }) })
        ] }) : null,
        activeSection === "hero" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Headline words", value: content.hero.words.join("\n"), onChange: (value) => updateHero("words", value.split("\n").filter(Boolean)), multiline: true }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Accent word", value: content.hero.accent, onChange: (value) => updateHero("accent", value) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Body", value: content.hero.body, onChange: (value) => updateHero("body", value), multiline: true }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Scroll prompt", value: content.hero.scrollPrompt, onChange: (value) => updateHero("scrollPrompt", value) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Primary CTA", value: content.hero.primaryCta, onChange: (value) => updateHero("primaryCta", value) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Primary link", value: content.hero.primaryHref, onChange: (value) => updateHero("primaryHref", value) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Secondary CTA", value: content.hero.secondaryCta, onChange: (value) => updateHero("secondaryCta", value) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Secondary link", value: content.hero.secondaryHref, onChange: (value) => updateHero("secondaryHref", value) })
        ] }) : null,
        ["who", "thesis", "portfolio", "leadership", "roadmap", "investor"].includes(activeSection) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Section label", value: content[activeSection].label, onChange: (value) => updateSimpleSection(activeSection, "label", value) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Accent phrase", value: content[activeSection].accent, onChange: (value) => updateSimpleSection(activeSection, "accent", value) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Title", value: content[activeSection].title, onChange: (value) => updateSimpleSection(activeSection, "title", value), multiline: true }),
          "body" in content[activeSection] ? /* @__PURE__ */ jsxRuntimeExports.jsx(TextField, { label: "Body", value: content[activeSection].body, onChange: (value) => updateSimpleSection(activeSection, "body", value), multiline: true }) : null,
          /* @__PURE__ */ jsxRuntimeExports.jsx(JsonEditor, { label: "Detailed section data", value: content[activeSection], onChange: (value) => updateSection(activeSection, value) })
        ] }) : null,
        ["ecosystem", "dashboard", "founders", "partnership", "footer"].includes(activeSection) ? /* @__PURE__ */ jsxRuntimeExports.jsx(JsonEditor, { label: "Complete editable data", value: content[activeSection], onChange: (value) => updateSection(activeSection, value) }) : null,
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-10 rounded-lg border border-white/10 bg-black/35 p-5", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-3 flex items-center gap-2 text-[10px] uppercase tracking-[0.22em] text-white/45", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Upload, { className: "h-3.5 w-3.5" }),
            " Import Content JSON"
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { value: importDraft, onChange: (event) => setImportDraft(event.target.value), rows: 5, placeholder: "Paste exported homepage JSON here", className: "w-full rounded-lg border border-white/10 bg-black/45 px-4 py-3 font-mono text-xs leading-5 text-white outline-none focus:border-mint-soft/45" }),
          importError ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-2 text-sm text-destructive", children: importError }) : null,
          /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", onClick: importJson, className: "mt-4 inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.04] px-4 py-2 text-[10px] uppercase tracking-[0.18em] transition hover:border-mint-soft/35 hover:bg-white/[0.07]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Upload, { className: "h-3.5 w-3.5" }),
            " Import & Save"
          ] })
        ] })
      ] })
    ] })
  ] }) });
}
export {
  ContentAdmin as component
};
