@zenith-open/zenithcms-admin 1.0.0-beta.1 → 1.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/assets/{ApiExplorerPage-UJpoKRI0.js → ApiExplorerPage-85UWt1EW.js} +1 -1
  2. package/dist/assets/{ApiExplorerPage-UJpoKRI0.js.map → ApiExplorerPage-85UWt1EW.js.map} +1 -1
  3. package/dist/assets/{AuditLogPage-8xYlRl1I.js → AuditLogPage-CwULx1tr.js} +1 -1
  4. package/dist/assets/{AuditLogPage-8xYlRl1I.js.map → AuditLogPage-CwULx1tr.js.map} +1 -1
  5. package/dist/assets/{BlockBuilderPage-DcOo3Vnt.js → BlockBuilderPage-XD1IjOgx.js} +1 -1
  6. package/dist/assets/{BlockBuilderPage-DcOo3Vnt.js.map → BlockBuilderPage-XD1IjOgx.js.map} +1 -1
  7. package/dist/assets/{CollectionHooksPage-Dn_ujtlp.js → CollectionHooksPage-DIaSrKDj.js} +1 -1
  8. package/dist/assets/{CollectionHooksPage-Dn_ujtlp.js.map → CollectionHooksPage-DIaSrKDj.js.map} +1 -1
  9. package/dist/assets/{CollectionsPage-BSPHf7H2.js → CollectionsPage-CL_t5JRI.js} +1 -1
  10. package/dist/assets/{CollectionsPage-BSPHf7H2.js.map → CollectionsPage-CL_t5JRI.js.map} +1 -1
  11. package/dist/assets/{ComponentBuilderPage-CT6S12LA.js → ComponentBuilderPage-C58Rr1cu.js} +1 -1
  12. package/dist/assets/{ComponentBuilderPage-CT6S12LA.js.map → ComponentBuilderPage-C58Rr1cu.js.map} +1 -1
  13. package/dist/assets/{DashboardBuilder-Cbi9Ddiu.js → DashboardBuilder-Chjyqyb7.js} +1 -1
  14. package/dist/assets/{DashboardBuilder-Cbi9Ddiu.js.map → DashboardBuilder-Chjyqyb7.js.map} +1 -1
  15. package/dist/assets/{PluginsPage-5YRpbP-N.js → PluginsPage-DAR4Fsz-.js} +1 -1
  16. package/dist/assets/{PluginsPage-5YRpbP-N.js.map → PluginsPage-DAR4Fsz-.js.map} +1 -1
  17. package/dist/assets/{RedirectsPage-D_4jAdaI.js → RedirectsPage-DfMTJsac.js} +1 -1
  18. package/dist/assets/{RedirectsPage-D_4jAdaI.js.map → RedirectsPage-DfMTJsac.js.map} +1 -1
  19. package/dist/assets/{SchemaBuilderPage-EFA5XIAa.js → SchemaBuilderPage-BYprOkEv.js} +1 -1
  20. package/dist/assets/{SchemaBuilderPage-EFA5XIAa.js.map → SchemaBuilderPage-BYprOkEv.js.map} +1 -1
  21. package/dist/assets/{SettingsPage-BRpcMw48.js → SettingsPage-B2r_uNVc.js} +1 -1
  22. package/dist/assets/{SettingsPage-BRpcMw48.js.map → SettingsPage-B2r_uNVc.js.map} +1 -1
  23. package/dist/assets/SetupWizard-CBA43yJr.js +62 -0
  24. package/dist/assets/SetupWizard-CBA43yJr.js.map +1 -0
  25. package/dist/assets/SpatialEditor-BohlovfE.js +3 -0
  26. package/dist/assets/SpatialEditor-BohlovfE.js.map +1 -0
  27. package/dist/assets/{TemplatesPage-B-nNYv3o.js → TemplatesPage-BplB2ksb.js} +1 -1
  28. package/dist/assets/{TemplatesPage-B-nNYv3o.js.map → TemplatesPage-BplB2ksb.js.map} +1 -1
  29. package/dist/assets/{TrashPage-Ccusal1w.js → TrashPage-BIhKrs5x.js} +1 -1
  30. package/dist/assets/{TrashPage-Ccusal1w.js.map → TrashPage-BIhKrs5x.js.map} +1 -1
  31. package/dist/assets/index-Umj4hIVD.css +1 -0
  32. package/dist/assets/{index-ChcKY5Xe.js → index-yE_3fruG.js} +3 -3
  33. package/dist/assets/index-yE_3fruG.js.map +1 -0
  34. package/dist/index.html +48 -6
  35. package/dist/manifest.webmanifest +1 -0
  36. package/dist/sw.js +1 -1
  37. package/dist/sw.js.map +1 -1
  38. package/dist/{workbox-9c191d2f.js → workbox-2fbc6a65.js} +3 -3
  39. package/dist/workbox-2fbc6a65.js.map +1 -0
  40. package/package.json +4 -4
  41. package/dist/assets/SetupWizard-D57HIkrs.js +0 -62
  42. package/dist/assets/SetupWizard-D57HIkrs.js.map +0 -1
  43. package/dist/assets/SpatialEditor-CPgS7Zrd.js +0 -3
  44. package/dist/assets/SpatialEditor-CPgS7Zrd.js.map +0 -1
  45. package/dist/assets/index-ChcKY5Xe.js.map +0 -1
  46. package/dist/assets/index-CxhwdV2K.css +0 -1
  47. package/dist/workbox-9c191d2f.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{B as t,Jn as n,Jt as r,Kn as i,Kt as a,Ln as o,Mt as s,Rn as c,St as l,Tt as u,Wt as d,_n as f,c as p,cn as m,d as h,ir as g,mr as _,rr as v,u as y,vr as b,xr as x,yn as S}from"./vendor-react-DQVTOTFO.js";import{a as C,o as w,t as T}from"./utils-fgvbH6CB.js";var E=e(x(),1),D=b(),O=[{id:`javascript`,label:`JavaScript`},{id:`typescript`,label:`TypeScript`},{id:`nextjs`,label:`Next.js`},{id:`curl`,label:`curl`}];function k(e,t,n){let r=n.replace(/\/$/,``);switch(e){case`javascript`:return`// zenith.js
2
+ const ZENITH_URL = '${r}';
3
+ const ZENITH_KEY = '${t}';
4
+
5
+ async function getContent(collection, query = {}) {
6
+ const params = new URLSearchParams(query);
7
+ const res = await fetch(\`\${ZENITH_URL}/api/v1/\${collection}?\${params}\`, {
8
+ headers: { 'x-api-key': ZENITH_KEY }
9
+ });
10
+ if (!res.ok) throw new Error('Zenith API error: ' + res.status);
11
+ return res.json();
12
+ }
13
+
14
+ // Usage
15
+ const { data: posts } = await getContent('posts', { status: 'published' });`;case`typescript`:return`// lib/zenith.ts
16
+ const BASE = '${r}/api/v1';
17
+ const KEY = process.env.ZENITH_API_KEY!; // '${t}'
18
+
19
+ type ZenithResponse<T> = { data: T; meta?: { total: number; page: number } };
20
+
21
+ export const zenith = {
22
+ get: <T = any>(collection: string, query: Record<string, string> = {}): Promise<ZenithResponse<T>> =>
23
+ fetch(\`\${BASE}/\${collection}?\${new URLSearchParams(query)}\`, {
24
+ headers: { 'x-api-key': KEY, 'Content-Type': 'application/json' },
25
+ }).then(r => { if (!r.ok) throw new Error(r.statusText); return r.json(); }),
26
+ };
27
+
28
+ // Usage
29
+ const { data: posts } = await zenith.get<Post[]>('posts', { status: 'published' });`;case`nextjs`:return`// lib/zenith.ts
30
+ export const zenith = {
31
+ get: (collection: string, query: Record<string, string> = {}, revalidate = 60) =>
32
+ fetch(\`${r}/api/v1/\${collection}?\${new URLSearchParams(query)}\`, {
33
+ headers: { 'x-api-key': process.env.ZENITH_API_KEY! },
34
+ next: { revalidate }, // ISR — refresh every 60s
35
+ }).then(r => r.json()),
36
+ };
37
+
38
+ // .env.local
39
+ // ZENITH_API_KEY=${t}
40
+
41
+ // app/blog/page.tsx
42
+ import { zenith } from '@/lib/zenith';
43
+ export default async function BlogPage() {
44
+ const { data: posts } = await zenith.get('posts', { status: 'published' });
45
+ return (
46
+ <main>
47
+ {posts.map((p: any) => <h2 key={p._id}>{p.title}</h2>)}
48
+ </main>
49
+ );
50
+ }`;case`curl`:return`# Fetch all published posts
51
+ curl '${r}/api/v1/posts?status=published' \\
52
+ -H 'x-api-key: ${t}'
53
+
54
+ # Fetch a single document by ID
55
+ curl '${r}/api/v1/posts/DOCUMENT_ID' \\
56
+ -H 'x-api-key: ${t}'
57
+
58
+ # Create a document (requires editor or admin key)
59
+ curl -X POST '${r}/api/v1/posts' \\
60
+ -H 'x-api-key: ${t}' \\
61
+ -H 'Content-Type: application/json' \\
62
+ -d '{"title":"Hello World","status":"published"}'`;default:return``}}function A({apiKey:e,publicUrl:t,theme:i}){let[a,c]=(0,E.useState)(`javascript`),[l,u]=(0,E.useState)(!1),[d,f]=(0,E.useState)(!1),[p,h]=(0,E.useState)(`idle`),g=i===`dark`,_=k(a,e,t);return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(`div`,{className:`flex gap-1 border-b border-z-border`,children:O.map(e=>(0,D.jsx)(`button`,{onClick:()=>c(e.id),className:T(`px-4 py-2 text-sm font-semibold border-b-2 -mb-px transition-all`,a===e.id?`border-z-border text-z-secondary`:`border-transparent text-z-secondary hover:text-z-secondary`),children:e.label},e.id))}),(0,D.jsxs)(`div`,{className:T(`relative rounded-none-none border overflow-hidden`,g?`bg-app border-z-border`:`bg-z-accent border-z-border`),children:[(0,D.jsx)(`pre`,{className:`overflow-x-auto p-5 text-sm font-mono text-z-secondary leading-relaxed`,children:(0,D.jsx)(`code`,{children:_})}),(0,D.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(_),u(!0),setTimeout(()=>u(!1),2500)},className:T(`absolute top-3 right-3 p-2 border rounded-none-none text-sm font-semibold transition-all`,l?`border-z-border text-z-secondary bg-z-panel`:`border-z-border text-z-muted hover:border-z-border bg-app/40`),children:l?(0,D.jsx)(m,{size:13}):(0,D.jsx)(r,{size:13})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsxs)(`button`,{onClick:async()=>{f(!0),h(`idle`);try{await w.get(`/system/health`,{headers:{"x-api-key":e}}),h(`ok`)}catch{h(`error`)}finally{f(!1)}},disabled:d||!e,className:T(`flex items-center gap-2 px-5 py-2.5 border text-sm font-semibold rounded-none-none transition-all`,g?`border-z-border text-z-muted hover:border-z-border/40 hover:text-z-secondary`:`border-z-border text-z-secondary hover:border-z-border-strong`),children:[d?(0,D.jsx)(o,{size:13,className:`animate-spin`}):(0,D.jsx)(s,{size:13}),`Test Connection`]}),p===`ok`&&(0,D.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold text-z-secondary `,children:[(0,D.jsx)(n,{size:13}),` Connected successfully`]}),p===`error`&&(0,D.jsxs)(`div`,{className:`text-sm font-semibold text-red-400 space-y-1`,children:[(0,D.jsx)(`p`,{children:`Connection failed. Check that:`}),(0,D.jsxs)(`ul`,{className:`list-disc list-inside text-z-secondary normal-case not- font-medium space-y-0.5`,children:[(0,D.jsxs)(`li`,{children:[`Your CMS is running at `,(0,D.jsx)(`code`,{className:`text-z-secondary`,children:t})]}),(0,D.jsx)(`li`,{children:`The API key is not expired or revoked`}),(0,D.jsx)(`li`,{children:`This origin is in Settings → Allowed Origins`})]})]})]})]})}var j=8,M=[{id:`website`,label:`Website`,icon:`🌐`,collections:[`pages`,`posts`,`media`,`categories`]},{id:`agency`,label:`Agency`,icon:`🏢`,collections:[`pages`,`services`,`projects`,`team`]},{id:`ecommerce`,label:`E-Commerce`,icon:`🛍️`,collections:[`products`,`categories`,`orders`,`customers`]},{id:`blog`,label:`Blog / Media`,icon:`📰`,collections:[`posts`,`categories`,`authors`,`media`]},{id:`saas`,label:`Application`,icon:`💻`,collections:[`pages`,`features`,`team`,`faqs`]},{id:`podcast`,label:`Podcast`,icon:`🎙️`,collections:[`episodes`,`guests`,`sponsors`,`media`]},{id:`realestate`,label:`Real Estate`,icon:`🏠`,collections:[`properties`,`agents`,`locations`,`inquiries`]},{id:`portfolio`,label:`Portfolio`,icon:`🎨`,collections:[`projects`,`skills`,`testimonials`]},{id:`custom`,label:`Custom`,icon:`🛠️`,collections:[]}],N=[{id:`pages`,label:`Pages`,icon:`📄`},{id:`posts`,label:`Blog Posts`,icon:`📝`},{id:`media`,label:`Media`,icon:`🖼️`},{id:`products`,label:`Products`,icon:`📦`},{id:`categories`,label:`Categories`,icon:`📁`},{id:`projects`,label:`Projects`,icon:`🚀`},{id:`services`,label:`Services`,icon:`🤝`},{id:`properties`,label:`Properties`,icon:`🏡`},{id:`episodes`,label:`Episodes`,icon:`🎧`},{id:`team`,label:`Team Members`,icon:`👥`},{id:`faqs`,label:`FAQs`,icon:`❓`}];function P(){let{theme:e}=C(),b=_(),[x,O]=(0,E.useState)(0),[k,P]=(0,E.useState)(!1),[F,I]=(0,E.useState)({projectName:``,projectType:``,publicUrl:``,selectedCollections:[],keyName:`My Website`,generatedKey:``,keyCopied:!1,dbDialect:`mongodb`,dbUri:`mongodb://localhost:27017/zenith`,dbTestStatus:`idle`,dbTestMessage:``,dbSaved:!1,adminName:``,adminEmail:``,adminPassword:``,adminPasswordConfirm:``,adminCreated:!1,adminError:``,openRouterApiKey:``,openaiApiKey:``,anthropicApiKey:``,xaiApiKey:``}),L=e=>I(t=>({...t,...e})),R=async(e,t)=>{await w.post(`/system/onboarding`,{currentStep:e,answers:t}).catch(()=>{})},z=async()=>{await R(x+1,F),O(e=>Math.min(e+1,j-1))},B=()=>O(e=>Math.max(e-1,0)),V=async()=>{await w.post(`/system/onboarding`,{skipped:!0}).catch(()=>{}),b(`/login`)},H=async()=>{L({dbTestStatus:`testing`,dbTestMessage:``});try{let e=await w.post(`/system/db/test-connection`,{uri:F.dbUri,dialect:F.dbDialect});if(e.data?.success)L({dbTestStatus:`success`,dbTestMessage:`Connection successful!`}),p.success(`Database connection verified!`);else throw Error(e.data?.error?.message||`Verification failed`)}catch(e){let t=e.response?.data?.error?.message||(e instanceof Error?e.message:String(e))||`Database verification failed`;L({dbTestStatus:`failed`,dbTestMessage:t}),p.error(t)}},U=async()=>{try{let e=await w.post(`/system/db/save-connection`,{uri:F.dbUri,dialect:F.dbDialect});if(e.data?.success)L({dbSaved:!0}),p.success(`Database configuration saved to .env!`);else throw Error(e.data?.error?.message||`Save failed`)}catch(e){let t=e.response?.data?.error?.message||(e instanceof Error?e.message:String(e))||`Database save failed`;p.error(t)}},W=async()=>{P(!0);try{await w.post(`/system/onboarding`,{currentStep:x,answers:F}).catch(()=>{}),F.adminEmail&&F.adminPassword&&!F.adminCreated&&await w.post(`/auth/register`,{name:F.adminName||`Super Admin`,email:F.adminEmail,password:F.adminPassword,role:`admin`}).catch(()=>{}),L({generatedKey:(await w.post(`/system/onboarding/complete`,{keyName:F.keyName})).data?.data?.apiKey||``}),await z()}catch{p.error(`Failed to generate API key. Please try again.`)}finally{P(!1)}},G=()=>{navigator.clipboard.writeText(F.generatedKey),L({keyCopied:!0}),p.success(`API key copied!`),setTimeout(()=>L({keyCopied:!1}),3e3)},K=e===`dark`,q=K?`bg-z-hover border-z-border text-z-primary placeholder:text-z-muted focus:border-z-border`:`bg-z-panel border-z-border text-z-primary placeholder:text-z-muted focus:border-z-border`,J=[{title:`Welcome to Zenith`,subtitle:`Let's get your CMS set up in under 2 minutes.`,icon:(0,D.jsx)(y,{size:28,className:`text-z-secondary`}),content:(0,D.jsxs)(`div`,{className:`space-y-6`,children:[(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Your Project Name`}),(0,D.jsx)(`input`,{value:F.projectName,onChange:e=>L({projectName:e.target.value}),placeholder:`e.g. Acme Corp CMS`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)}),(0,D.jsx)(`p`,{className:`text-sm text-z-secondary`,children:`This will appear in your admin panel header.`})]}),(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Your Website URL`}),(0,D.jsx)(`input`,{value:F.publicUrl,onChange:e=>L({publicUrl:e.target.value}),placeholder:`https://mywebsite.com`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)}),(0,D.jsx)(`p`,{className:`text-sm text-z-secondary`,children:`Where your website or app is hosted. Used to configure CORS.`})]})]}),canNext:F.projectName.trim().length>=2},{title:`What are you building?`,subtitle:`We'll pre-select relevant content types for you.`,icon:(0,D.jsx)(s,{size:28,className:`text-z-secondary`}),content:(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 sm:grid-cols-3 gap-3`,children:M.map(e=>(0,D.jsxs)(`button`,{onClick:()=>{L({projectType:e.id,selectedCollections:e.collections})},className:T(`flex flex-col items-center gap-3 p-5 border rounded-none-none transition-all text-center`,F.projectType===e.id?`border-z-border bg-z-panel`:K?`border-z-border hover:border-z-border`:`border-z-border shadow-sm hover:border-z-border`),children:[(0,D.jsx)(`span`,{className:`text-2xl`,children:e.icon}),(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:e.label})]},e.id))}),canNext:!!F.projectType},{title:`Choose your content types`,subtitle:`Select the collections you want to start with.`,icon:(0,D.jsx)(c,{size:28,className:`text-z-secondary`}),content:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:N.map(e=>{let t=F.selectedCollections.includes(e.id);return(0,D.jsxs)(`button`,{onClick:()=>{L({selectedCollections:t?F.selectedCollections.filter(t=>t!==e.id):[...F.selectedCollections,e.id]})},className:T(`flex items-center gap-3 px-4 py-3 border rounded-none-none text-left transition-all`,t?`border-z-border bg-z-panel`:K?`border-z-border hover:border-z-border`:`border-z-border shadow-sm hover:border-z-border`),children:[(0,D.jsx)(`span`,{children:e.icon}),(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:e.label}),t&&(0,D.jsx)(m,{size:12,className:`text-z-secondary ml-auto shrink-0`})]},e.id)})}),F.selectedCollections.length===0&&(0,D.jsx)(`p`,{className:`text-sm text-amber-500 font-semibold text-center py-2`,children:`No collections selected — you can add them later from the Collections menu.`})]}),canNext:!0},{title:`Database Setup`,subtitle:`Configure your database connection and write it to .env.`,icon:(0,D.jsx)(d,{size:28,className:`text-z-secondary`}),content:(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Database Dialect`}),(0,D.jsx)(`div`,{className:`flex gap-2`,children:[`mongodb`,`postgres`].map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>{L({dbDialect:e,dbUri:e===`mongodb`?`mongodb://localhost:27017/zenith`:`postgres://postgres:postgres@localhost:5432/zenith`,dbTestStatus:`idle`,dbTestMessage:``,dbSaved:!1})},className:T(`flex-1 py-3 border text-sm font-semibold rounded-none-none transition-all`,F.dbDialect===e?`border-z-border bg-z-panel text-z-primary`:`border-z-border hover:border-z-border text-z-muted`),children:e===`mongodb`?`MongoDB / Mongoose`:`PostgreSQL / Drizzle`},e))})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Connection URL`}),(0,D.jsx)(`input`,{value:F.dbUri,onChange:e=>L({dbUri:e.target.value,dbTestStatus:`idle`,dbSaved:!1}),placeholder:F.dbDialect===`mongodb`?`mongodb://localhost:27017/zenith`:`postgresql://postgres:postgres@localhost:5432/zenith`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:H,disabled:F.dbTestStatus===`testing`,className:`flex-1 py-3 border border-z-border hover:border-z-border text-sm font-semibold rounded-none-none transition-all flex items-center justify-center gap-2`,children:[F.dbTestStatus===`testing`?(0,D.jsx)(o,{size:12,className:`animate-spin`}):(0,D.jsx)(m,{size:12}),`Test Connection`]}),(0,D.jsx)(`button`,{type:`button`,onClick:U,disabled:F.dbTestStatus!==`success`||F.dbSaved,className:T(`flex-1 py-3 text-sm font-semibold rounded-none-none transition-all flex items-center justify-center gap-2`,F.dbTestStatus===`success`&&!F.dbSaved?`bg-z-accent hover:bg-z-base text-z-primary shadow-lg shadow-[var(--z-border)]`:`bg-z-hover border border-z-border text-z-secondary cursor-not-allowed`),children:`Save Configuration`})]}),F.dbTestStatus!==`idle`&&(0,D.jsxs)(`div`,{className:T(`p-4 border rounded-none-none text-sm font-bold tracking-wide `,F.dbTestStatus===`success`?`bg-z-hover border-z-border/20 text-z-secondary`:F.dbTestStatus===`testing`?`bg-z-hover border-z-border/10 text-z-secondary`:`bg-red-500/5 border-red-500/20 text-red-400`),children:[F.dbTestStatus===`testing`&&`Testing database connectivity...`,F.dbTestStatus===`success`&&` Connection verified! Click Save to apply to .env.`,F.dbTestStatus===`failed`&&` ${F.dbTestMessage}`]})]}),canNext:!0},{title:`AI Integration Engine`,subtitle:`Integrate state-of-the-art AI features natively into your CMS.`,icon:(0,D.jsx)(a,{size:28,className:`text-z-secondary`}),content:(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`OpenRouter API Key`}),(0,D.jsxs)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noreferrer`,className:`text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5`,children:[`Get Key `,(0,D.jsx)(i,{size:8})]})]}),(0,D.jsx)(`input`,{type:`password`,value:F.openRouterApiKey,onChange:e=>L({openRouterApiKey:e.target.value}),placeholder:`sk-or-...`,className:T(`w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`OpenAI API Key`}),(0,D.jsxs)(`a`,{href:`https://platform.openai.com/api-keys`,target:`_blank`,rel:`noreferrer`,className:`text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5`,children:[`Get Key `,(0,D.jsx)(i,{size:8})]})]}),(0,D.jsx)(`input`,{type:`password`,value:F.openaiApiKey,onChange:e=>L({openaiApiKey:e.target.value}),placeholder:`sk-proj-...`,className:T(`w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Anthropic API Key`}),(0,D.jsxs)(`a`,{href:`https://console.anthropic.com/settings/keys`,target:`_blank`,rel:`noreferrer`,className:`text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5`,children:[`Get Key `,(0,D.jsx)(i,{size:8})]})]}),(0,D.jsx)(`input`,{type:`password`,value:F.anthropicApiKey,onChange:e=>L({anthropicApiKey:e.target.value}),placeholder:`sk-ant-...`,className:T(`w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`xAI (Grok) API Key`}),(0,D.jsxs)(`a`,{href:`https://console.x.ai`,target:`_blank`,rel:`noreferrer`,className:`text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5`,children:[`Get Key `,(0,D.jsx)(i,{size:8})]})]}),(0,D.jsx)(`input`,{type:`password`,value:F.xaiApiKey,onChange:e=>L({xaiApiKey:e.target.value}),placeholder:`xai-...`,className:T(`w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors`,q)})]})]}),(0,D.jsxs)(`div`,{className:`p-3 border border-z-border/20 bg-z-border/[0.03] rounded-none-none flex items-start gap-2.5`,children:[(0,D.jsx)(u,{size:14,className:`text-z-secondary shrink-0 mt-0.5`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-z-secondary`,children:`Free AI Keys Available`}),(0,D.jsxs)(`p`,{className:`text-sm text-z-muted leading-normal mt-1`,children:[`Need keys? Get a key from`,` `,(0,D.jsx)(`a`,{href:`https://openrouter.ai`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-z-primary`,children:`OpenRouter`}),`. They offer free models (like Llama 3 and Gemma 2) that can power all of Zenith's features completely free of charge.`]})]})]}),(0,D.jsxs)(`div`,{className:`pt-2`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-z-secondary mb-2`,children:`NATIVE AI CAPABILITIES INTEGRATED`}),(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[{title:`Schema Architect`,desc:`Autogenerate rich collection structures via prompts`,icon:`️`},{title:`SEO Analyzer`,desc:`Real-time keyword density & readability auditing`,icon:``},{title:`Alt-Text Generator`,desc:`Auto semantic accessibility description for media uploads`,icon:`️`},{title:`Metadata Optimizer`,desc:`Auto CTR optimized SEO title and description generator`,icon:``}].map((e,t)=>(0,D.jsxs)(`div`,{className:`p-2.5 border border-z-border bg-z-panel rounded-none-none flex gap-2`,children:[(0,D.jsx)(`span`,{className:`text-base`,children:e.icon}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold leading-none`,children:e.title}),(0,D.jsx)(`p`,{className:`text-[7.5px] text-z-secondary leading-tight mt-1`,children:e.desc})]})]},t))})]})]}),canNext:!0},{title:`Create your Admin Account`,subtitle:`Set up the Super Admin credentials you will use to log into Zenith.`,icon:(0,D.jsx)(l,{size:28,className:`text-z-secondary`}),content:(0,D.jsx)(`div`,{className:`space-y-5`,children:F.adminCreated?(0,D.jsxs)(`div`,{className:T(`flex items-center gap-3 p-4 border rounded-none`,K?`bg-green-950/20 border-green-900/40 text-green-400`:`bg-green-50 border-green-200 text-green-700`),children:[(0,D.jsx)(n,{size:18}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-bold`,children:`Admin account created successfully!`}),(0,D.jsx)(`p`,{className:`text-xs mt-0.5 opacity-80`,children:F.adminEmail})]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Full Name`}),(0,D.jsx)(`input`,{value:F.adminName,onChange:e=>L({adminName:e.target.value}),placeholder:`e.g. Jane Smith`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Admin Email`}),(0,D.jsx)(`input`,{type:`email`,value:F.adminEmail,onChange:e=>L({adminEmail:e.target.value,adminError:``}),placeholder:`admin@yourcompany.com`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Password`}),(0,D.jsx)(`input`,{type:`password`,value:F.adminPassword,onChange:e=>L({adminPassword:e.target.value,adminError:``}),placeholder:`Minimum 8 characters`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Confirm Password`}),(0,D.jsx)(`input`,{type:`password`,value:F.adminPasswordConfirm,onChange:e=>L({adminPasswordConfirm:e.target.value,adminError:``}),placeholder:`Re-enter your password`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)})]}),F.adminError&&(0,D.jsx)(`p`,{className:`text-sm text-red-500 font-medium`,children:F.adminError}),(0,D.jsxs)(`button`,{disabled:k||!F.adminEmail||!F.adminPassword||F.adminPassword!==F.adminPasswordConfirm,onClick:async()=>{if(F.adminPassword!==F.adminPasswordConfirm){L({adminError:`Passwords do not match.`});return}if(F.adminPassword.length<8){L({adminError:`Password must be at least 8 characters.`});return}P(!0);try{await w.post(`/auth/register`,{name:F.adminName||`Super Admin`,email:F.adminEmail,password:F.adminPassword,role:`admin`}),L({adminCreated:!0,adminError:``}),p.success(`Admin account created!`)}catch(e){let t=e.response?.data?.error?.message||`Failed to create admin account.`;L({adminError:t}),p.error(t)}finally{P(!1)}},className:`w-full flex items-center justify-center gap-2 px-4 py-3 bg-z-accent hover:opacity-90 text-z-primary text-sm font-semibold rounded-none transition-all disabled:opacity-40 disabled:cursor-not-allowed`,children:[k?(0,D.jsx)(o,{size:16,className:`animate-spin`}):(0,D.jsx)(n,{size:16}),`Create Admin Account`]})]})}),canNext:F.adminCreated||!!F.adminEmail&&!!F.adminPassword&&F.adminPassword===F.adminPasswordConfirm&&F.adminPassword.length>=8},{title:`Generate your API key`,subtitle:`This key lets your website fetch content from Zenith.`,icon:(0,D.jsx)(l,{size:28,className:`text-z-secondary`}),content:(0,D.jsx)(`div`,{className:`space-y-5`,children:F.generatedKey?(0,D.jsx)(`div`,{className:`space-y-4`,children:(0,D.jsxs)(`div`,{className:T(`p-4 border rounded-none-none space-y-3`,K?`bg-z-hover border-z-border/20`:`bg-[var(--z-bg-input)] border-z-border`),children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-z-secondary `,children:`Key generated — copy it now. It will not be shown again.`}),(0,D.jsxs)(`div`,{className:T(`flex items-center gap-3 p-3 border rounded-none-none font-mono text-sm break-all`,K?`bg-app border-z-border`:`bg-[var(--z-bg-hover)] border-z-border`),children:[(0,D.jsx)(`span`,{className:`flex-1`,children:F.generatedKey}),(0,D.jsx)(`button`,{onClick:G,className:T(`shrink-0 px-3 py-1.5 border rounded-none-none text-sm font-semibold transition-all`,F.keyCopied?`border-z-border text-z-secondary `:K?`border-z-border hover:border-z-border`:`border-z-border-strong hover:border-z-border`),children:F.keyCopied?(0,D.jsx)(m,{size:13}):(0,D.jsx)(r,{size:13})})]})]})}):(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`label`,{className:`text-sm font-semibold text-z-muted`,children:`Key Name`}),(0,D.jsx)(`input`,{value:F.keyName,onChange:e=>L({keyName:e.target.value}),placeholder:`My Website`,className:T(`w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors`,q)}),(0,D.jsx)(`p`,{className:`text-sm text-z-secondary`,children:`Give it a name so you can identify it later (e.g. "Production Site").`})]}),(0,D.jsxs)(`button`,{onClick:W,disabled:k,className:`w-full flex items-center justify-center gap-3 py-4 bg-z-accent hover:bg-z-base text-z-primary text-sm font-semibold rounded-none-none transition-all shadow-lg shadow-[var(--z-border)]`,children:[k?(0,D.jsx)(o,{size:16,className:`animate-spin`}):(0,D.jsx)(l,{size:16}),k?`Generating...`:`Generate API Key`]})]})}),canNext:!!F.generatedKey},{title:`Connect your app`,subtitle:`Use these snippets to start pulling content from Zenith.`,icon:(0,D.jsx)(t,{size:28,className:`text-z-secondary`}),content:(0,D.jsx)(A,{apiKey:F.generatedKey,publicUrl:``.replace(/\/api\/v1\/?$/,``),theme:e}),canNext:!0}],Y=J[x],X=x;return(0,D.jsxs)(`div`,{className:T(`flex w-full min-h-screen`,K?`bg-[#080808] text-z-primary`:`bg-gray-50 text-z-primary`),children:[(0,D.jsxs)(`aside`,{className:T(`hidden lg:flex flex-col w-72 shrink-0 border-r h-screen sticky top-0`,K?`bg-[#0a0a0a] border-z-border`:`bg-white border-gray-200`),children:[(0,D.jsx)(`div`,{className:T(`px-8 py-8 border-b`,K?`border-z-border`:`border-gray-100`),children:(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:T(`w-8 h-8 rounded flex items-center justify-center text-xs font-black`,K?`bg-z-accent text-z-logo-text`:`bg-z-accent text-white`),children:`Z`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-bold tracking-tight`,children:`Zenith CMS`}),(0,D.jsx)(`p`,{className:T(`text-[11px] font-medium`,K?`text-z-muted`:`text-gray-400`),children:`Setup Wizard`})]})]})}),(0,D.jsx)(`nav`,{className:`flex-1 px-4 py-6 space-y-1 overflow-y-auto`,children:[{label:`Project Setup`,desc:`Name & URL`},{label:`Project Type`,desc:`What you are building`},{label:`Content Types`,desc:`Starter collections`},{label:`Database`,desc:`Connection & adapter`},{label:`AI Configuration`,desc:`Optional AI keys`},{label:`Admin Account`,desc:`Super Admin credentials`},{label:`API Key`,desc:`Authorize your frontend`},{label:`Connect App`,desc:`Integration snippets`}].map((e,t)=>{let n=t<X,r=t===x;return(0,D.jsxs)(`div`,{className:T(`flex items-center gap-3 px-4 py-3 rounded transition-all`,r?K?`bg-z-panel border border-z-border`:`bg-gray-50 border border-gray-200`:`border border-transparent`),children:[(0,D.jsx)(`div`,{className:T(`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 transition-all`,n?`bg-emerald-500 text-white`:r?K?`bg-z-accent text-z-logo-text`:`bg-z-accent text-white`:K?`bg-z-hover text-z-muted border border-z-border`:`bg-gray-100 text-gray-400 border border-gray-200`),children:n?(0,D.jsx)(m,{size:10,strokeWidth:3}):t+1}),(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:T(`text-[13px] font-semibold truncate`,r?``:K?`text-z-muted`:`text-gray-500`),children:e.label}),(0,D.jsx)(`p`,{className:T(`text-[11px] truncate`,K?`text-z-muted/60`:`text-gray-400`),children:e.desc})]})]},t)})}),(0,D.jsx)(`div`,{className:T(`px-8 py-6 border-t`,K?`border-z-border`:`border-gray-100`),children:(0,D.jsx)(`button`,{onClick:V,className:T(`text-[12px] font-medium hover:underline transition-colors`,K?`text-z-muted hover:text-z-secondary`:`text-gray-400 hover:text-gray-600`),children:`Skip setup and go to login`})})]}),(0,D.jsxs)(`main`,{className:`flex-1 flex flex-col min-h-screen overflow-y-auto`,children:[(0,D.jsxs)(`header`,{className:T(`sticky top-0 z-10 flex items-center justify-between px-8 py-4 border-b backdrop-blur-sm`,K?`bg-[#080808]/80 border-z-border`:`bg-white/80 border-gray-200`),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:T(`flex gap-1 lg:hidden`),children:J.map((e,t)=>(0,D.jsx)(`div`,{className:T(`h-1 rounded-full transition-all duration-300`,t<=x?`w-5 bg-z-accent`:`w-2 bg-z-hover`)},t))}),(0,D.jsxs)(`span`,{className:T(`text-[13px] font-semibold hidden lg:block`,K?`text-z-muted`:`text-gray-500`),children:[`Step `,x+1,` of `,j,` — `,(0,D.jsx)(`span`,{className:K?`text-z-primary`:`text-gray-900`,children:Y.title})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsxs)(`div`,{className:T(`hidden sm:flex items-center gap-2`),children:[(0,D.jsx)(`div`,{className:T(`w-32 h-1.5 rounded-full overflow-hidden`,K?`bg-z-hover`:`bg-gray-200`),children:(0,D.jsx)(`div`,{className:`h-full bg-z-accent rounded-full transition-all duration-500`,style:{width:`${(x+1)/j*100}%`}})}),(0,D.jsxs)(`span`,{className:T(`text-[12px] font-bold tabular-nums`,K?`text-z-muted`:`text-gray-400`),children:[Math.round((x+1)/j*100),`%`]})]}),(0,D.jsxs)(`button`,{onClick:V,className:T(`lg:hidden flex items-center gap-1 text-[12px] font-semibold`,K?`text-z-muted`:`text-gray-400`),children:[`Skip `,(0,D.jsx)(h,{size:11})]})]})]}),(0,D.jsx)(`div`,{className:`flex-1 flex flex-col justify-center px-8 py-10 max-w-2xl w-full mx-auto`,children:(0,D.jsx)(g,{mode:`wait`,children:(0,D.jsxs)(v.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.22,ease:`easeOut`},className:`space-y-8`,children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-5`,children:[(0,D.jsx)(`div`,{className:T(`w-14 h-14 rounded-xl flex items-center justify-center shrink-0 border`,K?`bg-z-panel border-z-border`:`bg-white border-gray-200 shadow-sm`),children:Y.icon}),(0,D.jsxs)(`div`,{className:`pt-1`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight leading-tight`,children:Y.title}),(0,D.jsx)(`p`,{className:T(`text-[14px] mt-1.5`,K?`text-z-muted`:`text-gray-500`),children:Y.subtitle})]})]}),(0,D.jsx)(`div`,{className:T(`rounded-xl border p-6`,K?`bg-[#0d0d0d] border-z-border`:`bg-white border-gray-200 shadow-sm`),children:Y.content})]},x)})}),(0,D.jsxs)(`footer`,{className:T(`sticky bottom-0 border-t px-8 py-4 flex items-center justify-between backdrop-blur-sm`,K?`bg-[#080808]/90 border-z-border`:`bg-white/90 border-gray-200`),children:[(0,D.jsxs)(`button`,{onClick:B,disabled:x===0,className:T(`flex items-center gap-2 px-5 py-2.5 border rounded text-sm font-semibold transition-all`,x===0?`opacity-20 cursor-not-allowed border-z-border`:K?`border-z-border hover:bg-z-hover`:`border-gray-200 hover:bg-gray-50 text-gray-700`),children:[(0,D.jsx)(S,{size:14}),` Back`]}),(0,D.jsx)(`div`,{className:`flex items-center gap-3`,children:x===j-1?(0,D.jsxs)(`button`,{onClick:()=>{b(`/login`)},className:`flex items-center gap-2 px-8 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-white text-sm font-bold rounded transition-all shadow-md`,children:[(0,D.jsx)(n,{size:15}),` Enter Admin Dashboard`]}):(0,D.jsxs)(`button`,{onClick:z,disabled:!Y.canNext,className:T(`flex items-center gap-2 px-8 py-2.5 text-sm font-bold rounded transition-all shadow-md`,Y.canNext?`bg-z-accent hover:opacity-90 text-z-primary`:`opacity-30 cursor-not-allowed bg-z-accent text-z-primary`),children:[`Continue `,(0,D.jsx)(f,{size:14})]})})]})]})]})}export{P as default};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetupWizard-CBA43yJr.js","names":[],"sources":["../../src/components/ConnectSnippet.tsx","../../src/pages/SetupWizard.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { Copy, Check, CheckCircle2, Loader2, Globe } from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport api from '../lib/api'\n\ninterface Props {\n apiKey: string\n publicUrl: string\n theme: 'dark' | 'light'\n}\n\ntype Lang = 'javascript' | 'typescript' | 'nextjs' | 'curl'\n\nconst TABS: { id: Lang; label: string }[] = [\n { id: 'javascript', label: 'JavaScript' },\n { id: 'typescript', label: 'TypeScript' },\n { id: 'nextjs', label: 'Next.js' },\n { id: 'curl', label: 'curl' },\n]\n\nfunction buildSnippet(lang: Lang, apiKey: string, publicUrl: string): string {\n const url = publicUrl.replace(/\\/$/, '')\n switch (lang) {\n case 'javascript':\n return `// zenith.js\nconst ZENITH_URL = '${url}';\nconst ZENITH_KEY = '${apiKey}';\n\nasync function getContent(collection, query = {}) {\n const params = new URLSearchParams(query);\n const res = await fetch(\\`\\${ZENITH_URL}/api/v1/\\${collection}?\\${params}\\`, {\n headers: { 'x-api-key': ZENITH_KEY }\n });\n if (!res.ok) throw new Error('Zenith API error: ' + res.status);\n return res.json();\n}\n\n// Usage\nconst { data: posts } = await getContent('posts', { status: 'published' });`\n\n case 'typescript':\n return `// lib/zenith.ts\nconst BASE = '${url}/api/v1';\nconst KEY = process.env.ZENITH_API_KEY!; // '${apiKey}'\n\ntype ZenithResponse<T> = { data: T; meta?: { total: number; page: number } };\n\nexport const zenith = {\n get: <T = any>(collection: string, query: Record<string, string> = {}): Promise<ZenithResponse<T>> =>\n fetch(\\`\\${BASE}/\\${collection}?\\${new URLSearchParams(query)}\\`, {\n headers: { 'x-api-key': KEY, 'Content-Type': 'application/json' },\n }).then(r => { if (!r.ok) throw new Error(r.statusText); return r.json(); }),\n};\n\n// Usage\nconst { data: posts } = await zenith.get<Post[]>('posts', { status: 'published' });`\n\n case 'nextjs':\n return `// lib/zenith.ts\nexport const zenith = {\n get: (collection: string, query: Record<string, string> = {}, revalidate = 60) =>\n fetch(\\`${url}/api/v1/\\${collection}?\\${new URLSearchParams(query)}\\`, {\n headers: { 'x-api-key': process.env.ZENITH_API_KEY! },\n next: { revalidate }, // ISR — refresh every 60s\n }).then(r => r.json()),\n};\n\n// .env.local\n// ZENITH_API_KEY=${apiKey}\n\n// app/blog/page.tsx\nimport { zenith } from '@/lib/zenith';\nexport default async function BlogPage() {\n const { data: posts } = await zenith.get('posts', { status: 'published' });\n return (\n <main>\n {posts.map((p: any) => <h2 key={p._id}>{p.title}</h2>)}\n </main>\n );\n}`\n\n case 'curl':\n return `# Fetch all published posts\ncurl '${url}/api/v1/posts?status=published' \\\\\n -H 'x-api-key: ${apiKey}'\n\n# Fetch a single document by ID\ncurl '${url}/api/v1/posts/DOCUMENT_ID' \\\\\n -H 'x-api-key: ${apiKey}'\n\n# Create a document (requires editor or admin key)\ncurl -X POST '${url}/api/v1/posts' \\\\\n -H 'x-api-key: ${apiKey}' \\\\\n -H 'Content-Type: application/json' \\\\\n -d '{\"title\":\"Hello World\",\"status\":\"published\"}'`\n\n default:\n return ''\n }\n}\n\nexport default function ConnectSnippet({ apiKey, publicUrl, theme }: Props) {\n const [tab, setTab] = useState<Lang>('javascript')\n const [copied, setCopied] = useState(false)\n const [testing, setTesting] = useState(false)\n const [testResult, setTestResult] = useState<'idle' | 'ok' | 'error'>('idle')\n const isDark = theme === 'dark'\n\n const snippet = buildSnippet(tab, apiKey, publicUrl)\n\n const copySnippet = () => {\n navigator.clipboard.writeText(snippet)\n setCopied(true)\n setTimeout(() => setCopied(false), 2500)\n }\n\n const testConnection = async () => {\n setTesting(true)\n setTestResult('idle')\n try {\n await api.get('/system/health', { headers: { 'x-api-key': apiKey } })\n setTestResult('ok')\n } catch {\n setTestResult('error')\n } finally {\n setTesting(false)\n }\n }\n\n return (\n <div className=\"space-y-4\">\n {/* Tab bar */}\n <div className=\"flex gap-1 border-b border-z-border\">\n {TABS.map((t) => (\n <button\n key={t.id}\n onClick={() => setTab(t.id)}\n className={cn(\n 'px-4 py-2 text-sm font-semibold border-b-2 -mb-px transition-all',\n tab === t.id\n ? 'border-z-border text-z-secondary'\n : 'border-transparent text-z-secondary hover:text-z-secondary'\n )}\n >\n {t.label}\n </button>\n ))}\n </div>\n\n {/* Code block */}\n <div\n className={cn(\n 'relative rounded-none-none border overflow-hidden',\n isDark ? 'bg-app border-z-border' : 'bg-z-accent border-z-border'\n )}\n >\n <pre className=\"overflow-x-auto p-5 text-sm font-mono text-z-secondary leading-relaxed\">\n <code>{snippet}</code>\n </pre>\n <button\n onClick={copySnippet}\n className={cn(\n 'absolute top-3 right-3 p-2 border rounded-none-none text-sm font-semibold transition-all',\n copied\n ? 'border-z-border text-z-secondary bg-z-panel'\n : 'border-z-border text-z-muted hover:border-z-border bg-app/40'\n )}\n >\n {copied ? <Check size={13} /> : <Copy size={13} />}\n </button>\n </div>\n\n {/* Live test */}\n <div className=\"flex items-center gap-3\">\n <button\n onClick={testConnection}\n disabled={testing || !apiKey}\n className={cn(\n 'flex items-center gap-2 px-5 py-2.5 border text-sm font-semibold rounded-none-none transition-all',\n isDark\n ? 'border-z-border text-z-muted hover:border-z-border/40 hover:text-z-secondary'\n : 'border-z-border text-z-secondary hover:border-z-border-strong'\n )}\n >\n {testing ? <Loader2 size={13} className=\"animate-spin\" /> : <Globe size={13} />}\n Test Connection\n </button>\n\n {testResult === 'ok' && (\n <span className=\"flex items-center gap-2 text-sm font-semibold text-z-secondary \">\n <CheckCircle2 size={13} /> Connected successfully\n </span>\n )}\n {testResult === 'error' && (\n <div className=\"text-sm font-semibold text-red-400 space-y-1\">\n <p>Connection failed. Check that:</p>\n <ul className=\"list-disc list-inside text-z-secondary normal-case not- font-medium space-y-0.5\">\n <li>\n Your CMS is running at <code className=\"text-z-secondary\">{publicUrl}</code>\n </li>\n <li>The API key is not expired or revoked</li>\n <li>This origin is in Settings → Allowed Origins</li>\n </ul>\n </div>\n )}\n </div>\n </div>\n )\n}\n","import { useState } from 'react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { useNavigate } from 'react-router-dom'\nimport { toast } from 'react-hot-toast'\nimport {\n ArrowRight,\n ArrowLeft,\n CheckCircle2,\n Loader2,\n Copy,\n Globe,\n Database,\n Key,\n Zap,\n Layers,\n Check,\n X,\n Server,\n Cpu,\n Info,\n HelpCircle,\n} from 'lucide-react'\nimport api from '../lib/api'\nimport { cn } from '../lib/utils'\nimport { useTheme } from '../context/ThemeContext'\nimport ConnectSnippet from '../components/ConnectSnippet'\n\nconst TOTAL_STEPS = 8\n\nconst PROJECT_TYPES = [\n { id: 'website', label: 'Website', icon: '🌐', collections: ['pages', 'posts', 'media', 'categories'] },\n { id: 'agency', label: 'Agency', icon: '🏢', collections: ['pages', 'services', 'projects', 'team'] },\n { id: 'ecommerce', label: 'E-Commerce', icon: '🛍️', collections: ['products', 'categories', 'orders', 'customers'] },\n { id: 'blog', label: 'Blog / Media', icon: '📰', collections: ['posts', 'categories', 'authors', 'media'] },\n { id: 'saas', label: 'Application', icon: '💻', collections: ['pages', 'features', 'team', 'faqs'] },\n { id: 'podcast', label: 'Podcast', icon: '🎙️', collections: ['episodes', 'guests', 'sponsors', 'media'] },\n { id: 'realestate', label: 'Real Estate', icon: '🏠', collections: ['properties', 'agents', 'locations', 'inquiries'] },\n { id: 'portfolio', label: 'Portfolio', icon: '🎨', collections: ['projects', 'skills', 'testimonials'] },\n { id: 'custom', label: 'Custom', icon: '🛠️', collections: [] },\n]\n\nconst STARTER_COLLECTIONS = [\n { id: 'pages', label: 'Pages', icon: '📄' },\n { id: 'posts', label: 'Blog Posts', icon: '📝' },\n { id: 'media', label: 'Media', icon: '🖼️' },\n { id: 'products', label: 'Products', icon: '📦' },\n { id: 'categories', label: 'Categories', icon: '📁' },\n { id: 'projects', label: 'Projects', icon: '🚀' },\n { id: 'services', label: 'Services', icon: '🤝' },\n { id: 'properties', label: 'Properties', icon: '🏡' },\n { id: 'episodes', label: 'Episodes', icon: '🎧' },\n { id: 'team', label: 'Team Members', icon: '👥' },\n { id: 'faqs', label: 'FAQs', icon: '❓' },\n]\n\ninterface WizardState {\n projectName: string\n projectType: string\n publicUrl: string\n selectedCollections: string[]\n keyName: string\n generatedKey: string\n keyCopied: boolean\n\n // Database\n dbDialect: 'mongodb' | 'postgres'\n dbUri: string\n dbTestStatus: 'idle' | 'testing' | 'success' | 'failed'\n dbTestMessage: string\n dbSaved: boolean\n\n // Admin Account\n adminName: string\n adminEmail: string\n adminPassword: string\n adminPasswordConfirm: string\n adminCreated: boolean\n adminError: string\n\n // AI keys\n openRouterApiKey: string\n openaiApiKey: string\n anthropicApiKey: string\n xaiApiKey: string\n}\n\nexport default function SetupWizard() {\n const { theme } = useTheme()\n const navigate = useNavigate()\n const [step, setStep] = useState(0)\n const [loading, setLoading] = useState(false)\n const [state, setState] = useState<WizardState>({\n projectName: '',\n projectType: '',\n publicUrl: '',\n selectedCollections: [],\n keyName: 'My Website',\n generatedKey: '',\n keyCopied: false,\n\n dbDialect: 'mongodb',\n dbUri: 'mongodb://localhost:27017/zenith',\n dbTestStatus: 'idle',\n dbTestMessage: '',\n dbSaved: false,\n\n adminName: '',\n adminEmail: '',\n adminPassword: '',\n adminPasswordConfirm: '',\n adminCreated: false,\n adminError: '',\n\n openRouterApiKey: '',\n openaiApiKey: '',\n anthropicApiKey: '',\n xaiApiKey: '',\n })\n\n const patch = (updates: Partial<WizardState>) => setState((s) => ({ ...s, ...updates }))\n\n // Persist step to backend\n const persistStep = async (currentStep: number, answers: Partial<WizardState>) => {\n await api.post('/system/onboarding', { currentStep, answers }).catch(() => {})\n }\n\n const next = async () => {\n await persistStep(step + 1, state)\n setStep((s) => Math.min(s + 1, TOTAL_STEPS - 1))\n }\n const back = () => setStep((s) => Math.max(s - 1, 0))\n\n const skip = async () => {\n await api.post('/system/onboarding', { skipped: true }).catch(() => {})\n navigate('/login')\n }\n\n const testDbConnection = async () => {\n patch({ dbTestStatus: 'testing', dbTestMessage: '' })\n try {\n const res = await api.post('/system/db/test-connection', {\n uri: state.dbUri,\n dialect: state.dbDialect,\n })\n if (res.data?.success) {\n patch({ dbTestStatus: 'success', dbTestMessage: 'Connection successful!' })\n toast.success('Database connection verified!')\n } else {\n throw new Error(res.data?.error?.message || 'Verification failed')\n }\n } catch (e: any) {\n const msg = e.response?.data?.error?.message || (e instanceof Error ? e.message : String(e)) || 'Database verification failed'\n patch({ dbTestStatus: 'failed', dbTestMessage: msg })\n toast.error(msg)\n }\n }\n\n const saveDbConnection = async () => {\n try {\n const res = await api.post('/system/db/save-connection', {\n uri: state.dbUri,\n dialect: state.dbDialect,\n })\n if (res.data?.success) {\n patch({ dbSaved: true })\n toast.success('Database configuration saved to .env!')\n } else {\n throw new Error(res.data?.error?.message || 'Save failed')\n }\n } catch (e: any) {\n const msg = e.response?.data?.error?.message || (e instanceof Error ? e.message : String(e)) || 'Database save failed'\n toast.error(msg)\n }\n }\n\n const handleComplete = async () => {\n setLoading(true)\n try {\n // First save onboarding answers so the complete endpoint gets all state answers (including DB and AI keys)\n await api.post('/system/onboarding', { currentStep: step, answers: state }).catch(() => {})\n\n // Attempt to create admin user via the register endpoint\n if (state.adminEmail && state.adminPassword && !state.adminCreated) {\n await api.post('/auth/register', {\n name: state.adminName || 'Super Admin',\n email: state.adminEmail,\n password: state.adminPassword,\n role: 'admin',\n }).catch(() => {})\n }\n\n const r = await api.post('/system/onboarding/complete', { keyName: state.keyName })\n patch({ generatedKey: r.data?.data?.apiKey || '' })\n await next()\n } catch {\n toast.error('Failed to generate API key. Please try again.')\n } finally {\n setLoading(false)\n }\n }\n\n const copyKey = () => {\n navigator.clipboard.writeText(state.generatedKey)\n patch({ keyCopied: true })\n toast.success('API key copied!')\n setTimeout(() => patch({ keyCopied: false }), 3000)\n }\n\n const isDark = theme === 'dark'\n const bg = isDark ? 'bg-app text-z-primary' : 'bg-[var(--z-bg-input)] text-z-primary'\n const card = isDark ? 'bg-[#0a0a0a] border-z-border' : 'bg-z-panel border-z-border shadow-sm shadow-sm'\n const input = isDark\n ? 'bg-z-hover border-z-border text-z-primary placeholder:text-z-muted focus:border-z-border'\n : 'bg-z-panel border-z-border text-z-primary placeholder:text-z-muted focus:border-z-border'\n\n const STEPS = [\n {\n title: 'Welcome to Zenith',\n subtitle: \"Let's get your CMS set up in under 2 minutes.\",\n icon: <Zap size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-6\">\n <div className=\"space-y-3\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Your Project Name\n </label>\n <input\n value={state.projectName}\n onChange={(e) => patch({ projectName: e.target.value })}\n placeholder=\"e.g. Acme Corp CMS\"\n className={cn(\n 'w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors',\n input\n )}\n />\n <p className=\"text-sm text-z-secondary\">This will appear in your admin panel header.</p>\n </div>\n <div className=\"space-y-3\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Your Website URL\n </label>\n <input\n value={state.publicUrl}\n onChange={(e) => patch({ publicUrl: e.target.value })}\n placeholder=\"https://mywebsite.com\"\n className={cn(\n 'w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors',\n input\n )}\n />\n <p className=\"text-sm text-z-secondary\">\n Where your website or app is hosted. Used to configure CORS.\n </p>\n </div>\n </div>\n ),\n canNext: state.projectName.trim().length >= 2,\n },\n {\n title: 'What are you building?',\n subtitle: \"We'll pre-select relevant content types for you.\",\n icon: <Globe size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"grid grid-cols-1 md:grid-cols-2 sm:grid-cols-3 gap-3\">\n {PROJECT_TYPES.map((pt) => (\n <button\n key={pt.id}\n onClick={() => {\n patch({ projectType: pt.id, selectedCollections: pt.collections })\n }}\n className={cn(\n 'flex flex-col items-center gap-3 p-5 border rounded-none-none transition-all text-center',\n state.projectType === pt.id\n ? 'border-z-border bg-z-panel'\n : isDark\n ? 'border-z-border hover:border-z-border'\n : 'border-z-border shadow-sm hover:border-z-border'\n )}\n >\n <span className=\"text-2xl\">{pt.icon}</span>\n <span className=\"text-sm font-semibold\">{pt.label}</span>\n </button>\n ))}\n </div>\n ),\n canNext: !!state.projectType,\n },\n {\n title: 'Choose your content types',\n subtitle: 'Select the collections you want to start with.',\n icon: <Layers size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-3\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-2\">\n {STARTER_COLLECTIONS.map((col) => {\n const selected = state.selectedCollections.includes(col.id)\n return (\n <button\n key={col.id}\n onClick={() => {\n patch({\n selectedCollections: selected\n ? state.selectedCollections.filter((c) => c !== col.id)\n : [...state.selectedCollections, col.id],\n })\n }}\n className={cn(\n 'flex items-center gap-3 px-4 py-3 border rounded-none-none text-left transition-all',\n selected\n ? 'border-z-border bg-z-panel'\n : isDark\n ? 'border-z-border hover:border-z-border'\n : 'border-z-border shadow-sm hover:border-z-border'\n )}\n >\n <span>{col.icon}</span>\n <span className=\"text-sm font-semibold\">{col.label}</span>\n {selected && <Check size={12} className=\"text-z-secondary ml-auto shrink-0\" />}\n </button>\n )\n })}\n </div>\n {state.selectedCollections.length === 0 && (\n <p className=\"text-sm text-amber-500 font-semibold text-center py-2\">\n No collections selected — you can add them later from the Collections menu.\n </p>\n )}\n </div>\n ),\n canNext: true,\n },\n {\n title: 'Database Setup',\n subtitle: 'Configure your database connection and write it to .env.',\n icon: <Database size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Database Dialect\n </label>\n <div className=\"flex gap-2\">\n {['mongodb', 'postgres'].map((dialect) => (\n <button\n key={dialect}\n type=\"button\"\n onClick={() => {\n const defaultUri =\n dialect === 'mongodb'\n ? 'mongodb://localhost:27017/zenith'\n : 'postgres://postgres:postgres@localhost:5432/zenith'\n patch({\n dbDialect: dialect as any,\n dbUri: defaultUri,\n dbTestStatus: 'idle',\n dbTestMessage: '',\n dbSaved: false,\n })\n }}\n className={cn(\n 'flex-1 py-3 border text-sm font-semibold rounded-none-none transition-all',\n state.dbDialect === dialect\n ? 'border-z-border bg-z-panel text-z-primary'\n : 'border-z-border hover:border-z-border text-z-muted'\n )}\n >\n {dialect === 'mongodb' ? 'MongoDB / Mongoose' : 'PostgreSQL / Drizzle'}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Connection URL\n </label>\n <input\n value={state.dbUri}\n onChange={(e) => patch({ dbUri: e.target.value, dbTestStatus: 'idle', dbSaved: false })}\n placeholder={\n state.dbDialect === 'mongodb'\n ? 'mongodb://localhost:27017/zenith'\n : 'postgresql://postgres:postgres@localhost:5432/zenith'\n }\n className={cn(\n 'w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors',\n input\n )}\n />\n </div>\n\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={testDbConnection}\n disabled={state.dbTestStatus === 'testing'}\n className=\"flex-1 py-3 border border-z-border hover:border-z-border text-sm font-semibold rounded-none-none transition-all flex items-center justify-center gap-2\"\n >\n {state.dbTestStatus === 'testing' ? (\n <Loader2 size={12} className=\"animate-spin\" />\n ) : (\n <Check size={12} />\n )}\n Test Connection\n </button>\n <button\n type=\"button\"\n onClick={saveDbConnection}\n disabled={state.dbTestStatus !== 'success' || state.dbSaved}\n className={cn(\n 'flex-1 py-3 text-sm font-semibold rounded-none-none transition-all flex items-center justify-center gap-2',\n state.dbTestStatus === 'success' && !state.dbSaved\n ? 'bg-z-accent hover:bg-z-base text-z-primary shadow-lg shadow-[var(--z-border)]'\n : 'bg-z-hover border border-z-border text-z-secondary cursor-not-allowed'\n )}\n >\n Save Configuration\n </button>\n </div>\n\n {state.dbTestStatus !== 'idle' && (\n <div\n className={cn(\n 'p-4 border rounded-none-none text-sm font-bold tracking-wide ',\n state.dbTestStatus === 'success'\n ? 'bg-z-hover border-z-border/20 text-z-secondary'\n : state.dbTestStatus === 'testing'\n ? 'bg-z-hover border-z-border/10 text-z-secondary'\n : 'bg-red-500/5 border-red-500/20 text-red-400'\n )}\n >\n {state.dbTestStatus === 'testing' && 'Testing database connectivity...'}\n {state.dbTestStatus === 'success' && ' Connection verified! Click Save to apply to .env.'}\n {state.dbTestStatus === 'failed' && ` ${state.dbTestMessage}`}\n </div>\n )}\n </div>\n ),\n canNext: true,\n },\n {\n title: 'AI Integration Engine',\n subtitle: 'Integrate state-of-the-art AI features natively into your CMS.',\n icon: <Cpu size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <div className=\"flex justify-between items-center\">\n <label className=\"text-sm font-semibold text-z-muted\">\n OpenRouter API Key\n </label>\n <a\n href=\"https://openrouter.ai/keys\"\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5\"\n >\n Get Key <HelpCircle size={8} />\n </a>\n </div>\n <input\n type=\"password\"\n value={state.openRouterApiKey}\n onChange={(e) => patch({ openRouterApiKey: e.target.value })}\n placeholder=\"sk-or-...\"\n className={cn(\n 'w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors',\n input\n )}\n />\n </div>\n\n <div className=\"space-y-2\">\n <div className=\"flex justify-between items-center\">\n <label className=\"text-sm font-semibold text-z-muted\">\n OpenAI API Key\n </label>\n <a\n href=\"https://platform.openai.com/api-keys\"\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5\"\n >\n Get Key <HelpCircle size={8} />\n </a>\n </div>\n <input\n type=\"password\"\n value={state.openaiApiKey}\n onChange={(e) => patch({ openaiApiKey: e.target.value })}\n placeholder=\"sk-proj-...\"\n className={cn(\n 'w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors',\n input\n )}\n />\n </div>\n\n <div className=\"space-y-2\">\n <div className=\"flex justify-between items-center\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Anthropic API Key\n </label>\n <a\n href=\"https://console.anthropic.com/settings/keys\"\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5\"\n >\n Get Key <HelpCircle size={8} />\n </a>\n </div>\n <input\n type=\"password\"\n value={state.anthropicApiKey}\n onChange={(e) => patch({ anthropicApiKey: e.target.value })}\n placeholder=\"sk-ant-...\"\n className={cn(\n 'w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors',\n input\n )}\n />\n </div>\n\n <div className=\"space-y-2\">\n <div className=\"flex justify-between items-center\">\n <label className=\"text-sm font-semibold text-z-muted\">\n xAI (Grok) API Key\n </label>\n <a\n href=\"https://console.x.ai\"\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm font-bold text-z-secondary hover:underline flex items-center gap-0.5\"\n >\n Get Key <HelpCircle size={8} />\n </a>\n </div>\n <input\n type=\"password\"\n value={state.xaiApiKey}\n onChange={(e) => patch({ xaiApiKey: e.target.value })}\n placeholder=\"xai-...\"\n className={cn(\n 'w-full px-3 py-2.5 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-sm font-mono transition-colors',\n input\n )}\n />\n </div>\n </div>\n\n <div className=\"p-3 border border-z-border/20 bg-z-border/[0.03] rounded-none-none flex items-start gap-2.5\">\n <Info size={14} className=\"text-z-secondary shrink-0 mt-0.5\" />\n <div>\n <p className=\"text-sm font-semibold text-z-secondary\">\n Free AI Keys Available\n </p>\n <p className=\"text-sm text-z-muted leading-normal mt-1\">\n Need keys? Get a key from{' '}\n <a\n href=\"https://openrouter.ai\"\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"underline hover:text-z-primary\"\n >\n OpenRouter\n </a>\n . They offer free models (like Llama 3 and Gemma 2) that can power all of Zenith's features\n completely free of charge.\n </p>\n </div>\n </div>\n\n <div className=\"pt-2\">\n <p className=\"text-sm font-semibold text-z-secondary mb-2\">\n NATIVE AI CAPABILITIES INTEGRATED\n </p>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n {[\n {\n title: 'Schema Architect',\n desc: 'Autogenerate rich collection structures via prompts',\n icon: '️',\n },\n {\n title: 'SEO Analyzer',\n desc: 'Real-time keyword density & readability auditing',\n icon: '',\n },\n {\n title: 'Alt-Text Generator',\n desc: 'Auto semantic accessibility description for media uploads',\n icon: '️',\n },\n {\n title: 'Metadata Optimizer',\n desc: 'Auto CTR optimized SEO title and description generator',\n icon: '',\n },\n ].map((feat, i) => (\n <div key={i} className=\"p-2.5 border border-z-border bg-z-panel rounded-none-none flex gap-2\">\n <span className=\"text-base\">{feat.icon}</span>\n <div>\n <p className=\"text-sm font-semibold leading-none\">{feat.title}</p>\n <p className=\"text-[7.5px] text-z-secondary leading-tight mt-1\">{feat.desc}</p>\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n ),\n canNext: true,\n },\n {\n title: 'Create your Admin Account',\n subtitle: 'Set up the Super Admin credentials you will use to log into Zenith.',\n icon: <Key size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-5\">\n {state.adminCreated ? (\n <div className={cn('flex items-center gap-3 p-4 border rounded-none', isDark ? 'bg-green-950/20 border-green-900/40 text-green-400' : 'bg-green-50 border-green-200 text-green-700')}>\n <CheckCircle2 size={18} />\n <div>\n <p className=\"text-sm font-bold\">Admin account created successfully!</p>\n <p className=\"text-xs mt-0.5 opacity-80\">{state.adminEmail}</p>\n </div>\n </div>\n ) : (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">Full Name</label>\n <input\n value={state.adminName}\n onChange={(e) => patch({ adminName: e.target.value })}\n placeholder=\"e.g. Jane Smith\"\n className={cn('w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors', input)}\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">Admin Email</label>\n <input\n type=\"email\"\n value={state.adminEmail}\n onChange={(e) => patch({ adminEmail: e.target.value, adminError: '' })}\n placeholder=\"admin@yourcompany.com\"\n className={cn('w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors', input)}\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">Password</label>\n <input\n type=\"password\"\n value={state.adminPassword}\n onChange={(e) => patch({ adminPassword: e.target.value, adminError: '' })}\n placeholder=\"Minimum 8 characters\"\n className={cn('w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors', input)}\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">Confirm Password</label>\n <input\n type=\"password\"\n value={state.adminPasswordConfirm}\n onChange={(e) => patch({ adminPasswordConfirm: e.target.value, adminError: '' })}\n placeholder=\"Re-enter your password\"\n className={cn('w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors', input)}\n />\n </div>\n {state.adminError && (\n <p className=\"text-sm text-red-500 font-medium\">{state.adminError}</p>\n )}\n <button\n disabled={loading || !state.adminEmail || !state.adminPassword || state.adminPassword !== state.adminPasswordConfirm}\n onClick={async () => {\n if (state.adminPassword !== state.adminPasswordConfirm) {\n patch({ adminError: 'Passwords do not match.' })\n return\n }\n if (state.adminPassword.length < 8) {\n patch({ adminError: 'Password must be at least 8 characters.' })\n return\n }\n setLoading(true)\n try {\n await api.post('/auth/register', {\n name: state.adminName || 'Super Admin',\n email: state.adminEmail,\n password: state.adminPassword,\n role: 'admin',\n })\n patch({ adminCreated: true, adminError: '' })\n toast.success('Admin account created!')\n } catch (e: any) {\n const msg = e.response?.data?.error?.message || 'Failed to create admin account.'\n patch({ adminError: msg })\n toast.error(msg)\n } finally {\n setLoading(false)\n }\n }}\n className=\"w-full flex items-center justify-center gap-2 px-4 py-3 bg-z-accent hover:opacity-90 text-z-primary text-sm font-semibold rounded-none transition-all disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n {loading ? <Loader2 size={16} className=\"animate-spin\" /> : <CheckCircle2 size={16} />}\n Create Admin Account\n </button>\n </>\n )}\n </div>\n ),\n canNext: state.adminCreated || (!!state.adminEmail && !!state.adminPassword && state.adminPassword === state.adminPasswordConfirm && state.adminPassword.length >= 8),\n },\n {\n title: 'Generate your API key',\n subtitle: 'This key lets your website fetch content from Zenith.',\n icon: <Key size={28} className=\"text-z-secondary\" />,\n content: (\n <div className=\"space-y-5\">\n {!state.generatedKey ? (\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Key Name\n </label>\n <input\n value={state.keyName}\n onChange={(e) => patch({ keyName: e.target.value })}\n placeholder=\"My Website\"\n className={cn(\n 'w-full px-4 py-3 border rounded-none-none outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black text-[13px] font-medium transition-colors',\n input\n )}\n />\n <p className=\"text-sm text-z-secondary\">\n Give it a name so you can identify it later (e.g. \"Production Site\").\n </p>\n </div>\n <button\n onClick={handleComplete}\n disabled={loading}\n className=\"w-full flex items-center justify-center gap-3 py-4 bg-z-accent hover:bg-z-base text-z-primary text-sm font-semibold rounded-none-none transition-all shadow-lg shadow-[var(--z-border)]\"\n >\n {loading ? <Loader2 size={16} className=\"animate-spin\" /> : <Key size={16} />}\n {loading ? 'Generating...' : 'Generate API Key'}\n </button>\n </div>\n ) : (\n <div className=\"space-y-4\">\n <div\n className={cn(\n 'p-4 border rounded-none-none space-y-3',\n isDark\n ? 'bg-z-hover border-z-border/20'\n : 'bg-[var(--z-bg-input)] border-z-border'\n )}\n >\n <p className=\"text-sm font-semibold text-z-secondary \">\n Key generated — copy it now. It will not be shown again.\n </p>\n <div\n className={cn(\n 'flex items-center gap-3 p-3 border rounded-none-none font-mono text-sm break-all',\n isDark ? 'bg-app border-z-border' : 'bg-[var(--z-bg-hover)] border-z-border'\n )}\n >\n <span className=\"flex-1\">{state.generatedKey}</span>\n <button\n onClick={copyKey}\n className={cn(\n 'shrink-0 px-3 py-1.5 border rounded-none-none text-sm font-semibold transition-all',\n state.keyCopied\n ? 'border-z-border text-z-secondary '\n : isDark\n ? 'border-z-border hover:border-z-border'\n : 'border-z-border-strong hover:border-z-border'\n )}\n >\n {state.keyCopied ? <Check size={13} /> : <Copy size={13} />}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n ),\n canNext: !!state.generatedKey,\n },\n {\n title: 'Connect your app',\n subtitle: 'Use these snippets to start pulling content from Zenith.',\n icon: <Server size={28} className=\"text-z-secondary\" />,\n content: (\n <ConnectSnippet\n apiKey={state.generatedKey}\n publicUrl={(import.meta.env.VITE_API_URL || '').replace(\n /\\/api\\/v1\\/?$/,\n ''\n )}\n theme={theme}\n />\n ),\n canNext: true,\n },\n ]\n\n const current = STEPS[step]\n const completedSteps = step\n\n const STEP_LABELS = [\n { label: 'Project Setup', desc: 'Name & URL' },\n { label: 'Project Type', desc: 'What you are building' },\n { label: 'Content Types', desc: 'Starter collections' },\n { label: 'Database', desc: 'Connection & adapter' },\n { label: 'AI Configuration', desc: 'Optional AI keys' },\n { label: 'Admin Account', desc: 'Super Admin credentials' },\n { label: 'API Key', desc: 'Authorize your frontend' },\n { label: 'Connect App', desc: 'Integration snippets' },\n ]\n\n return (\n <div className={cn('flex w-full min-h-screen', isDark ? 'bg-[#080808] text-z-primary' : 'bg-gray-50 text-z-primary')}>\n\n {/* ── LEFT SIDEBAR ── */}\n <aside className={cn(\n 'hidden lg:flex flex-col w-72 shrink-0 border-r h-screen sticky top-0',\n isDark ? 'bg-[#0a0a0a] border-z-border' : 'bg-white border-gray-200'\n )}>\n {/* Brand */}\n <div className={cn('px-8 py-8 border-b', isDark ? 'border-z-border' : 'border-gray-100')}>\n <div className=\"flex items-center gap-3\">\n <div className={cn('w-8 h-8 rounded flex items-center justify-center text-xs font-black', isDark ? 'bg-z-accent text-z-logo-text' : 'bg-z-accent text-white')}>Z</div>\n <div>\n <p className=\"text-sm font-bold tracking-tight\">Zenith CMS</p>\n <p className={cn('text-[11px] font-medium', isDark ? 'text-z-muted' : 'text-gray-400')}>Setup Wizard</p>\n </div>\n </div>\n </div>\n\n {/* Step Navigator */}\n <nav className=\"flex-1 px-4 py-6 space-y-1 overflow-y-auto\">\n {STEP_LABELS.map((s, i) => {\n const isCompleted = i < completedSteps\n const isActive = i === step\n return (\n <div\n key={i}\n className={cn(\n 'flex items-center gap-3 px-4 py-3 rounded transition-all',\n isActive\n ? (isDark ? 'bg-z-panel border border-z-border' : 'bg-gray-50 border border-gray-200')\n : 'border border-transparent'\n )}\n >\n <div className={cn(\n 'w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 transition-all',\n isCompleted\n ? 'bg-emerald-500 text-white'\n : isActive\n ? (isDark ? 'bg-z-accent text-z-logo-text' : 'bg-z-accent text-white')\n : (isDark ? 'bg-z-hover text-z-muted border border-z-border' : 'bg-gray-100 text-gray-400 border border-gray-200')\n )}>\n {isCompleted ? <Check size={10} strokeWidth={3} /> : i + 1}\n </div>\n <div className=\"min-w-0\">\n <p className={cn('text-[13px] font-semibold truncate', isActive ? '' : (isDark ? 'text-z-muted' : 'text-gray-500'))}>{s.label}</p>\n <p className={cn('text-[11px] truncate', isDark ? 'text-z-muted/60' : 'text-gray-400')}>{s.desc}</p>\n </div>\n </div>\n )\n })}\n </nav>\n\n {/* Footer */}\n <div className={cn('px-8 py-6 border-t', isDark ? 'border-z-border' : 'border-gray-100')}>\n <button\n onClick={skip}\n className={cn('text-[12px] font-medium hover:underline transition-colors', isDark ? 'text-z-muted hover:text-z-secondary' : 'text-gray-400 hover:text-gray-600')}\n >\n Skip setup and go to login\n </button>\n </div>\n </aside>\n\n {/* ── MAIN CONTENT ── */}\n <main className=\"flex-1 flex flex-col min-h-screen overflow-y-auto\">\n\n {/* Top Bar */}\n <header className={cn(\n 'sticky top-0 z-10 flex items-center justify-between px-8 py-4 border-b backdrop-blur-sm',\n isDark ? 'bg-[#080808]/80 border-z-border' : 'bg-white/80 border-gray-200'\n )}>\n <div className=\"flex items-center gap-3\">\n {/* Mobile progress indicator */}\n <div className={cn('flex gap-1 lg:hidden')}>\n {STEPS.map((_, i) => (\n <div\n key={i}\n className={cn(\n 'h-1 rounded-full transition-all duration-300',\n i <= step ? 'w-5 bg-z-accent' : 'w-2 bg-z-hover'\n )}\n />\n ))}\n </div>\n <span className={cn('text-[13px] font-semibold hidden lg:block', isDark ? 'text-z-muted' : 'text-gray-500')}>\n Step {step + 1} of {TOTAL_STEPS} — <span className={isDark ? 'text-z-primary' : 'text-gray-900'}>{current.title}</span>\n </span>\n </div>\n\n {/* Progress % */}\n <div className=\"flex items-center gap-3\">\n <div className={cn('hidden sm:flex items-center gap-2')}>\n <div className={cn('w-32 h-1.5 rounded-full overflow-hidden', isDark ? 'bg-z-hover' : 'bg-gray-200')}>\n <div\n className=\"h-full bg-z-accent rounded-full transition-all duration-500\"\n style={{ width: `${((step + 1) / TOTAL_STEPS) * 100}%` }}\n />\n </div>\n <span className={cn('text-[12px] font-bold tabular-nums', isDark ? 'text-z-muted' : 'text-gray-400')}>\n {Math.round(((step + 1) / TOTAL_STEPS) * 100)}%\n </span>\n </div>\n <button\n onClick={skip}\n className={cn('lg:hidden flex items-center gap-1 text-[12px] font-semibold', isDark ? 'text-z-muted' : 'text-gray-400')}\n >\n Skip <X size={11} />\n </button>\n </div>\n </header>\n\n {/* Step Content */}\n <div className=\"flex-1 flex flex-col justify-center px-8 py-10 max-w-2xl w-full mx-auto\">\n\n <AnimatePresence mode=\"wait\">\n <motion.div\n key={step}\n initial={{ opacity: 0, y: 16 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -16 }}\n transition={{ duration: 0.22, ease: 'easeOut' }}\n className=\"space-y-8\"\n >\n {/* Step Header */}\n <div className=\"flex items-start gap-5\">\n <div className={cn(\n 'w-14 h-14 rounded-xl flex items-center justify-center shrink-0 border',\n isDark ? 'bg-z-panel border-z-border' : 'bg-white border-gray-200 shadow-sm'\n )}>\n {current.icon}\n </div>\n <div className=\"pt-1\">\n <h1 className=\"text-2xl font-bold tracking-tight leading-tight\">{current.title}</h1>\n <p className={cn('text-[14px] mt-1.5', isDark ? 'text-z-muted' : 'text-gray-500')}>{current.subtitle}</p>\n </div>\n </div>\n\n {/* Step Body */}\n <div className={cn(\n 'rounded-xl border p-6',\n isDark ? 'bg-[#0d0d0d] border-z-border' : 'bg-white border-gray-200 shadow-sm'\n )}>\n {current.content}\n </div>\n </motion.div>\n </AnimatePresence>\n </div>\n\n {/* Footer Navigation */}\n <footer className={cn(\n 'sticky bottom-0 border-t px-8 py-4 flex items-center justify-between backdrop-blur-sm',\n isDark ? 'bg-[#080808]/90 border-z-border' : 'bg-white/90 border-gray-200'\n )}>\n <button\n onClick={back}\n disabled={step === 0}\n className={cn(\n 'flex items-center gap-2 px-5 py-2.5 border rounded text-sm font-semibold transition-all',\n step === 0\n ? 'opacity-20 cursor-not-allowed border-z-border'\n : isDark\n ? 'border-z-border hover:bg-z-hover'\n : 'border-gray-200 hover:bg-gray-50 text-gray-700'\n )}\n >\n <ArrowLeft size={14} /> Back\n </button>\n\n <div className=\"flex items-center gap-3\">\n {step === TOTAL_STEPS - 1 ? (\n <button\n onClick={() => { navigate('/login') }}\n className=\"flex items-center gap-2 px-8 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-white text-sm font-bold rounded transition-all shadow-md\"\n >\n <CheckCircle2 size={15} /> Enter Admin Dashboard\n </button>\n ) : (\n <button\n onClick={next}\n disabled={!current.canNext}\n className={cn(\n 'flex items-center gap-2 px-8 py-2.5 text-sm font-bold rounded transition-all shadow-md',\n current.canNext\n ? 'bg-z-accent hover:opacity-90 text-z-primary'\n : 'opacity-30 cursor-not-allowed bg-z-accent text-z-primary'\n )}\n >\n Continue <ArrowRight size={14} />\n </button>\n )}\n </div>\n </footer>\n </main>\n </div>\n )\n}\n"],"mappings":"kVAaM,EAAsC,CAC3C,CAAE,GAAI,aAAc,MAAO,YAAa,EACxC,CAAE,GAAI,aAAc,MAAO,YAAa,EACxC,CAAE,GAAI,SAAU,MAAO,SAAU,EACjC,CAAE,GAAI,OAAQ,MAAO,MAAO,CAC7B,EAEA,SAAS,EAAa,EAAY,EAAgB,EAA2B,CAC5E,IAAM,EAAM,EAAU,QAAQ,MAAO,EAAE,EACvC,OAAQ,EAAR,CACA,IAAK,aACL,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