@zenith-open/zenithcms-admin 1.0.0-beta.4 → 1.0.0-beta.5

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 (37) hide show
  1. package/dist/assets/{ApiExplorerPage-UJpoKRI0.js → ApiExplorerPage-CLsHG-Ke.js} +1 -1
  2. package/dist/assets/{ApiExplorerPage-UJpoKRI0.js.map → ApiExplorerPage-CLsHG-Ke.js.map} +1 -1
  3. package/dist/assets/{AuditLogPage-8xYlRl1I.js → AuditLogPage-Bp2Nvabr.js} +1 -1
  4. package/dist/assets/{AuditLogPage-8xYlRl1I.js.map → AuditLogPage-Bp2Nvabr.js.map} +1 -1
  5. package/dist/assets/{BlockBuilderPage-DcOo3Vnt.js → BlockBuilderPage-CeVMk5Ns.js} +1 -1
  6. package/dist/assets/{BlockBuilderPage-DcOo3Vnt.js.map → BlockBuilderPage-CeVMk5Ns.js.map} +1 -1
  7. package/dist/assets/{CollectionHooksPage-Dn_ujtlp.js → CollectionHooksPage-EFkVZNrc.js} +1 -1
  8. package/dist/assets/{CollectionHooksPage-Dn_ujtlp.js.map → CollectionHooksPage-EFkVZNrc.js.map} +1 -1
  9. package/dist/assets/{CollectionsPage-BSPHf7H2.js → CollectionsPage-D-N_ykJz.js} +1 -1
  10. package/dist/assets/{CollectionsPage-BSPHf7H2.js.map → CollectionsPage-D-N_ykJz.js.map} +1 -1
  11. package/dist/assets/{ComponentBuilderPage-CT6S12LA.js → ComponentBuilderPage-C3mhOLPs.js} +1 -1
  12. package/dist/assets/{ComponentBuilderPage-CT6S12LA.js.map → ComponentBuilderPage-C3mhOLPs.js.map} +1 -1
  13. package/dist/assets/{DashboardBuilder-Cbi9Ddiu.js → DashboardBuilder-Beiurp0v.js} +1 -1
  14. package/dist/assets/{DashboardBuilder-Cbi9Ddiu.js.map → DashboardBuilder-Beiurp0v.js.map} +1 -1
  15. package/dist/assets/{PluginsPage-5YRpbP-N.js → PluginsPage-BjPoOvBl.js} +1 -1
  16. package/dist/assets/{PluginsPage-5YRpbP-N.js.map → PluginsPage-BjPoOvBl.js.map} +1 -1
  17. package/dist/assets/{RedirectsPage-D_4jAdaI.js → RedirectsPage-GIZCbEll.js} +1 -1
  18. package/dist/assets/{RedirectsPage-D_4jAdaI.js.map → RedirectsPage-GIZCbEll.js.map} +1 -1
  19. package/dist/assets/{SchemaBuilderPage-EFA5XIAa.js → SchemaBuilderPage-3CDbJi28.js} +1 -1
  20. package/dist/assets/{SchemaBuilderPage-EFA5XIAa.js.map → SchemaBuilderPage-3CDbJi28.js.map} +1 -1
  21. package/dist/assets/{SettingsPage-BRpcMw48.js → SettingsPage-DYYNnxkV.js} +1 -1
  22. package/dist/assets/{SettingsPage-BRpcMw48.js.map → SettingsPage-DYYNnxkV.js.map} +1 -1
  23. package/dist/assets/{SpatialEditor-CPgS7Zrd.js → SpatialEditor-DlyP5PPa.js} +1 -1
  24. package/dist/assets/{SpatialEditor-CPgS7Zrd.js.map → SpatialEditor-DlyP5PPa.js.map} +1 -1
  25. package/dist/assets/{TemplatesPage-B-nNYv3o.js → TemplatesPage-DfeCDCe_.js} +1 -1
  26. package/dist/assets/{TemplatesPage-B-nNYv3o.js.map → TemplatesPage-DfeCDCe_.js.map} +1 -1
  27. package/dist/assets/{TrashPage-Ccusal1w.js → TrashPage-DGi-7RPl.js} +1 -1
  28. package/dist/assets/{TrashPage-Ccusal1w.js.map → TrashPage-DGi-7RPl.js.map} +1 -1
  29. package/dist/assets/{index-ChcKY5Xe.js → index-C4J6QNLn.js} +3 -3
  30. package/dist/assets/index-C4J6QNLn.js.map +1 -0
  31. package/dist/assets/index-Umj4hIVD.css +1 -0
  32. package/dist/index.html +45 -3
  33. package/dist/sw.js +1 -1
  34. package/dist/sw.js.map +1 -1
  35. package/package.json +2 -2
  36. package/dist/assets/index-ChcKY5Xe.js.map +0 -1
  37. package/dist/assets/index-CxhwdV2K.css +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";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X,CAEH,CAAC,GACD,SAAC,EAAD,CAAO,KAAK,IAAI,SAAS,SAAC,GAAD,CAAU,GAAG,IAAI,UAAS,EAAI,EAChD,GACE,EACO,EACF,EACC,EAEf,EACO,GACO,EACO,GAEP,EACA,GC/ThB,eAAe,IAAY,CACzB,GAAI,CAEF,IAAM,GAAU,MADE,EAAI,IAAI,iBAAiB,GACvB,MAAM,MAAQ,CAAC,EAGnC,IAAK,IAAM,KAAU,EACf,EAAO,SAAW,EAAO,QAAQ,MACnC,QAAQ,IAAI,4BAA4B,EAAO,KAAK,IAAI,EAAO,OAAO,IAAI,EAAE,EAC5E,MAAM,IAAI,SAAS,EAAS,IAAW,CACrC,IAAM,EAAS,SAAS,cAAc,QAAQ,EAC9C,EAAO,KAAO,SACd,EAAO,IAAM,EAAO,OAAO,IAC3B,EAAO,OAAS,EAChB,EAAO,YAAgB,CACrB,QAAQ,MAAM,0CAA0C,EAAO,OAAO,KAAK,EAC3E,EAAQ,IAAI,CACd,EACA,SAAS,KAAK,YAAY,CAAM,CAClC,CAAC,EAGP,OAAS,EAAK,CACZ,QAAQ,MAAM,kDAAmD,CAAG,CACtE,CAEA,GAAS,WAAW,SAAS,eAAe,MAAM,CAAE,CAAC,CAAC,QACpD,WAAO,WAAP,WACE,SAAC,GAAD,CAAM,EACU,EACpB,CACF,CAEA,GAAU","names":[],"ignoreList":[],"sources":["../../src/store/authStore.ts","../../src/hooks/useNetworkStatus.ts","../../src/lib/siteStore.ts","../../src/components/GlassDropdown.tsx","../../src/components/SiteSelector.tsx","../../src/hooks/useQueries.ts","../../src/components/GlobalSearch.tsx","../../src/components/Logo.tsx","../../src/context/BrandContext.tsx","../../src/lib/plugin-registry.ts","../../src/layouts/DashboardLayout.tsx","../../src/lib/validators.ts","../../src/pages/LoginPage.tsx","../../src/pages/ForgotPasswordPage.tsx","../../src/pages/ResetPasswordPage.tsx","../../src/pages/SitePicker.tsx","../../src/store/confirmStore.ts","../../src/pages/CollectionListBulkToolbar.tsx","../../src/pages/CollectionListImportModal.tsx","../../src/components/ui/PageHeader.tsx","../../src/components/ui/Card.tsx","../../src/pages/CollectionList.tsx","../../src/pages/editor/unifiedBlocks.ts","../../src/hooks/useBlockLibrary.ts","../../src/hooks/useCustomComponents.ts","../../src/pages/editor/constants.ts","../../src/context/BlockLibraryContext.tsx","../../src/store/modalStore.ts","../../src/hooks/useFocusTrap.ts","../../src/components/GlobalComponentPickerModal.tsx","../../src/pages/editor/components/ConfirmDialog.tsx","../../src/components/GlobalConfirmDialog.tsx","../../src/App.tsx","../../src/main.tsx"],"sourcesContent":["import { create } from 'zustand'\nimport api from '../lib/api'\n\ninterface User {\n id: string\n email: string\n name?: string\n role: 'admin' | 'editor' | 'viewer'\n twoFactorEnabled?: boolean\n}\n\ninterface AuthState {\n user: User | null\n isAuthenticated: boolean\n isLoading: boolean\n siteId: string | null\n setUser: (user: User | null) => void\n setSiteId: (siteId: string | null) => void\n login: (email: string, password: string) => Promise<void>\n logout: () => Promise<void>\n checkAuth: () => Promise<void>\n}\n\nexport const useAuthStore = create<AuthState>((set) => ({\n user: null,\n isAuthenticated: false,\n isLoading: true,\n siteId: null,\n\n setUser: (user) => set({ user, isAuthenticated: !!user }),\n\n setSiteId: (siteId) => set({ siteId }),\n\n login: async (email, password) => {\n try {\n const res = await api.post('/auth/login', { email, password })\n const { user } = res.data.data\n set({ user, isAuthenticated: true })\n } catch (error) {\n console.error('Login failed', error)\n throw error\n }\n },\n\n logout: async () => {\n try {\n await api.post('/auth/logout')\n } finally {\n localStorage.removeItem('zenith_auth_state')\n localStorage.removeItem('activeSiteId')\n set({ user: null, isAuthenticated: false, siteId: null })\n window.location.href = '/login'\n }\n },\n\n checkAuth: async () => {\n set({ isLoading: true })\n try {\n const res = await api.get('/auth/me')\n set({ user: res.data.data, isAuthenticated: true })\n } catch {\n set({ user: null, isAuthenticated: false })\n } finally {\n set({ isLoading: false })\n }\n },\n}))\n","import { useState, useEffect } from 'react'\n\nexport function useNetworkStatus() {\n const [isOnline, setIsOnline] = useState<boolean>(\n typeof navigator !== 'undefined' ? navigator.onLine : true\n )\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleOnline = () => setIsOnline(true)\n const handleOffline = () => setIsOnline(false)\n\n window.addEventListener('online', handleOnline)\n window.addEventListener('offline', handleOffline)\n\n return () => {\n window.removeEventListener('online', handleOnline)\n window.removeEventListener('offline', handleOffline)\n }\n }, [])\n\n return isOnline\n}\n","import { create } from 'zustand';\n\ninterface SiteState {\n activeWorkspaceId: string | null;\n activeSiteId: string | null;\n setActiveWorkspaceId: (id: string | null) => void;\n setActiveSiteId: (id: string | null) => void;\n}\n\nfunction safeGetItem(key: string): string | null {\n try {\n if (typeof window === 'undefined') return null;\n return localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeSetItem(key: string, value: string): void {\n try {\n if (typeof window === 'undefined') return;\n localStorage.setItem(key, value);\n } catch {\n // localStorage may be full or disabled\n }\n}\n\nfunction safeRemoveItem(key: string): void {\n try {\n if (typeof window === 'undefined') return;\n localStorage.removeItem(key);\n } catch {\n // ignore\n }\n}\n\nexport const useSiteStore = create<SiteState>((set) => ({\n activeWorkspaceId: safeGetItem('activeWorkspaceId'),\n activeSiteId: safeGetItem('activeSiteId'),\n setActiveWorkspaceId: (id) => {\n if (id) {\n safeSetItem('activeWorkspaceId', id);\n } else {\n safeRemoveItem('activeWorkspaceId');\n }\n set({ activeWorkspaceId: id });\n },\n setActiveSiteId: (id) => {\n if (id) {\n safeSetItem('activeSiteId', id);\n } else {\n safeRemoveItem('activeSiteId');\n }\n set({ activeSiteId: id });\n },\n}));\n","import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { createPortal } from 'react-dom';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { ChevronDown } from 'lucide-react';\nimport { useTheme } from '../context/ThemeContext';\nimport { cn } from '../lib/utils';\n\nexport interface DropdownOption<T = any> {\n value: T;\n label: string;\n icon?: React.ReactNode;\n description?: string;\n [key: string]: any; // Allow extra fields\n}\n\ninterface GlassDropdownProps<T = any> {\n options: DropdownOption<T>[];\n value: T;\n onChange: (value: T) => void;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n triggerClassName?: string;\n menuClassName?: string;\n headerText?: string;\n footerAction?: React.ReactNode;\n isSidebarOpen?: boolean; // For sidebar toggle layouts\n renderTrigger?: (selectedOption: DropdownOption<T> | null, isOpen: boolean, toggle: () => void) => React.ReactNode;\n renderOption?: (option: DropdownOption<T>, isSelected: boolean) => React.ReactNode;\n}\n\nexport const GlassDropdown = <T,>({\n options,\n value,\n onChange,\n placeholder = 'Select...',\n disabled = false,\n className,\n triggerClassName,\n menuClassName,\n headerText,\n footerAction,\n isSidebarOpen = true,\n renderTrigger,\n renderOption,\n}: GlassDropdownProps<T>) => {\n const { theme } = useTheme();\n const [isOpen, setIsOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n const [menuPos, setMenuPos] = useState<{ top: number; left: number; width: number } | null>(null);\n\n const selectedOption = options.find((opt) => opt.value === value) || null;\n\n const updatePosition = useCallback(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n const menuWidth = isSidebarOpen ? rect.width : 240;\n setMenuPos({\n top: rect.bottom + 4 + window.scrollY,\n left: isSidebarOpen ? rect.left + window.scrollX : rect.left - menuWidth + window.scrollX,\n width: menuWidth,\n });\n }, [isSidebarOpen]);\n\n // Update position on scroll/resize while open\n useEffect(() => {\n if (!isOpen) return;\n updatePosition();\n window.addEventListener('scroll', updatePosition, true);\n window.addEventListener('resize', updatePosition);\n return () => {\n window.removeEventListener('scroll', updatePosition, true);\n window.removeEventListener('resize', updatePosition);\n };\n }, [isOpen, updatePosition]);\n\n // Handle click outside to close the dropdown\n useEffect(() => {\n if (!isOpen) return;\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (triggerRef.current?.contains(target)) return;\n if (containerRef.current?.contains(target)) return;\n setIsOpen(false);\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, [isOpen]);\n\n const handleSelect = (option: DropdownOption<T>) => {\n if (disabled) return;\n onChange(option.value);\n setIsOpen(false);\n };\n\n const toggle = () => {\n if (!disabled) {\n setIsOpen(!isOpen);\n }\n };\n\n const defaultTrigger = (\n <button\n type=\"button\"\n onClick={toggle}\n disabled={disabled}\n className={cn(\n \"w-full flex items-center justify-between text-left transition-all duration-300 p-2.5\",\n \"relative overflow-hidden shadow-sm\",\n theme === 'dark'\n ? \"bg-z-panel backdrop-blur-[12px] text-z-primary border border-z-border hover:border-z-border/50 hover:bg-app/85\"\n : \"bg-z-panel/65 backdrop-blur-[12px] text-z-primary border border-z-border hover:border-z-border/30 hover:bg-z-panel/85\",\n isSidebarOpen ? \"rounded-none-none\" : \"rounded-none-none p-2 justify-center\",\n \"hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-z-active-border disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100\",\n triggerClassName\n )}\n >\n <div className={cn(\"flex items-center min-w-0 z-10\", isSidebarOpen ? \"gap-3\" : \"gap-0 justify-center\")}>\n {selectedOption?.icon && (\n <div className={cn(\n \"rounded-none-none flex items-center justify-center text-lg flex-shrink-0 transition-colors duration-300\",\n theme === 'dark' ? \"bg-z-panel text-z-secondary\" : \"bg-[var(--z-bg-input)] text-z-secondary\",\n isSidebarOpen ? \"w-8 h-8\" : \"w-10 h-10\"\n )}>\n {selectedOption.icon}\n </div>\n )}\n\n {isSidebarOpen && (\n <div className=\"flex flex-col min-w-0\">\n {selectedOption?.description && (\n <span className=\"text-sm font-semibold text-z-secondary dark:text-z-muted font-mono leading-none mb-1\">\n {selectedOption.description}\n </span>\n )}\n <span className=\"text-xs font-semibold tracking-wide truncate leading-none\">\n {selectedOption ? selectedOption.label : placeholder}\n </span>\n </div>\n )}\n </div>\n\n {isSidebarOpen && (\n <motion.div\n animate={{ rotate: isOpen ? 180 : 0 }}\n transition={{ duration: 0.2 }}\n className=\"text-z-muted flex-shrink-0 z-10 ml-2\"\n >\n <ChevronDown size={14} />\n </motion.div>\n )}\n </button>\n );\n\n return (\n <div className={cn(\"relative transition-all duration-300\", className)}>\n <div ref={triggerRef} onClick={() => { if (!disabled) { if (!isOpen) updatePosition(); setIsOpen(!isOpen); } }}>\n {renderTrigger ? renderTrigger(selectedOption, isOpen, toggle) : defaultTrigger}\n </div>\n\n {isOpen && menuPos && createPortal(\n <AnimatePresence>\n <motion.div\n ref={containerRef}\n initial={{ opacity: 0, y: 10, scale: 0.95 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, y: 10, scale: 0.95 }}\n transition={{ duration: 0.15, ease: \"easeOut\" }}\n style={{\n position: 'absolute',\n top: menuPos.top,\n left: menuPos.left,\n width: isSidebarOpen ? menuPos.width : undefined,\n zIndex: 9999,\n backgroundColor: 'var(--z-border)',\n backdropFilter: 'blur(12px)',\n WebkitBackdropFilter: 'blur(12px)',\n boxShadow: '0 4px 30px rgba(0, 0, 0, 0.1)'\n }}\n className={cn(\n \"rounded-none overflow-hidden border\",\n theme === 'dark'\n ? \"border-z-border text-z-primary\"\n : \"border-z-border text-z-primary\",\n menuClassName\n )}\n >\n {headerText && (\n <div className={cn(\n \"px-4 py-2.5 border-b bg-z-panel/[0.01]\",\n theme === 'dark' ? \"border-z-border\" : \"border-z-border\"\n )}>\n <span className=\"text-sm font-semibold text-z-muted font-mono\">\n {headerText}\n </span>\n </div>\n )}\n\n <div className=\"max-h-[220px] overflow-y-auto py-1 scrollbar-thin\">\n {options.map((option) => {\n const isSelected = option.value === value;\n if (renderOption) {\n return (\n <div key={String(option.value)} onClick={() => handleSelect(option)} className=\"cursor-pointer\">\n {renderOption(option, isSelected)}\n </div>\n );\n }\n return (\n <button\n key={String(option.value)}\n type=\"button\"\n onClick={() => handleSelect(option)}\n className={cn(\n \"w-full px-4 py-2.5 flex items-center justify-between text-left transition-colors duration-200\",\n theme === 'dark' ? \"hover:bg-z-hover\" : \"hover:bg-app/[0.02]\",\n isSelected && (theme === 'dark' ? \"bg-z-panel text-z-secondary\" : \"bg-[var(--z-bg-input)] text-z-secondary\")\n )}\n >\n <div className=\"flex items-center gap-3 min-w-0\">\n {option.icon && <span className=\"text-base flex-shrink-0\">{option.icon}</span>}\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-xs font-bold truncate\">{option.label}</span>\n {option.description && (\n <span className=\"text-sm text-z-muted font-mono\">\n {option.description}\n </span>\n )}\n </div>\n </div>\n {isSelected && (\n <span className=\"w-1.5 h-1.5 rounded-none-none bg-z-border shadow-[0_0_8px_rgba(99,102,241,0.8)]\" />\n )}\n </button>\n );\n })}\n\n {options.length === 0 && (\n <div className=\"px-4 py-6 text-center text-z-secondary text-xs\">\n No options found.\n </div>\n )}\n </div>\n\n {footerAction && (\n <div className={cn(\n \"border-t bg-z-panel\",\n theme === 'dark' ? \"border-z-border\" : \"border-z-border\"\n )}>\n {footerAction}\n </div>\n )}\n </motion.div>\n </AnimatePresence>,\n document.body\n )}\n </div>\n );\n};\n","import React, { useEffect, useState, useRef } from 'react';\nimport { Link } from 'react-router-dom';\nimport { ChevronDown, Sliders, Briefcase } from 'lucide-react';\nimport { motion } from 'framer-motion';\nimport api from '../lib/api';\nimport { useSiteStore } from '../lib/siteStore';\nimport { useTenantStore } from '../lib/tenantStore';\nimport { useTheme } from '../context/ThemeContext';\nimport { toast } from 'react-hot-toast';\nimport { cn } from '../lib/utils';\nimport { GlassDropdown, type DropdownOption } from './GlassDropdown';\nimport { useShallow } from 'zustand/react/shallow'\n\ninterface SiteSelectorProps {\n isSidebarOpen?: boolean;\n}\n\nexport const SiteSelector: React.FC<SiteSelectorProps> = ({ isSidebarOpen = true }) => {\n const { theme } = useTheme();\n const { activeWorkspaceId, setActiveWorkspaceId, activeSiteId, setActiveSiteId } = useSiteStore(useShallow(state => ({ activeWorkspaceId: state.activeWorkspaceId, setActiveWorkspaceId: state.setActiveWorkspaceId, activeSiteId: state.activeSiteId, setActiveSiteId: state.setActiveSiteId })));\n const [workspaces, setWorkspaces] = useState<any[]>([]);\n const [sites, setSites] = useState<any[]>([]);\n const initialized = useRef(false);\n\n // 1. Fetch workspaces and sites on mount only\n useEffect(() => {\n if (initialized.current) return;\n initialized.current = true;\n\n const initData = async () => {\n try {\n // Fetch workspaces\n const wsRes = await api.get('/workspaces');\n const fetchedWorkspaces = wsRes.data?.data || [];\n setWorkspaces(fetchedWorkspaces);\n\n // Only use stored IDs; never call setters from effect to avoid loops\n const storedWsId = activeWorkspaceId || fetchedWorkspaces[0]?._id || fetchedWorkspaces[0]?.id;\n if (storedWsId && storedWsId !== activeWorkspaceId) {\n setActiveWorkspaceId(storedWsId);\n }\n\n if (storedWsId) {\n // Fetch sites for active workspace\n const sitesRes = await api.get(`/sites?workspaceId=${encodeURIComponent(storedWsId)}`);\n const fetchedSites = sitesRes.data?.data || [];\n setSites(fetchedSites);\n }\n } catch (err) {\n toast.error('Failed to load workspaces and sites');\n }\n };\n\n initData();\n // Only run on mount — store setters are intentionally excluded\n \n }, []);\n\n const fetchSitesForWorkspace = async (wsId: string): Promise<any[]> => {\n const sitesRes = await api.get(`/sites?workspaceId=${encodeURIComponent(wsId)}`);\n const fetchedSites = sitesRes.data?.data || [];\n setSites(fetchedSites);\n return fetchedSites;\n };\n\n const handleSelectWorkspace = async (wsId: string) => {\n if (wsId === activeWorkspaceId) return;\n\n try {\n setActiveWorkspaceId(wsId);\n\n // Fetch sites for the new workspace\n const fetchedSites = await fetchSitesForWorkspace(wsId);\n const wsName = workspaces.find(w => (w._id || w.id) === wsId)?.name;\n\n if (fetchedSites.length > 0) {\n const firstSite = fetchedSites[0];\n const firstSiteId = firstSite._id || firstSite.id;\n setActiveSiteId(firstSiteId);\n useTenantStore.getState().setActiveSiteId(firstSiteId, firstSite.name);\n localStorage.setItem('activeSiteName', firstSite.name);\n localStorage.setItem('activeSiteSlug', firstSite.slug);\n api.defaults.headers['x-zenith-site-id'] = firstSiteId;\n toast.success(`Switched to workspace: ${wsName}`);\n setTimeout(() => {\n window.location.href = '/';\n }, 500);\n } else {\n setActiveSiteId(null);\n useTenantStore.getState().setActiveSiteId('');\n localStorage.removeItem('activeSiteName');\n localStorage.removeItem('activeSiteSlug');\n delete api.defaults.headers['x-zenith-site-id'];\n toast.success(`Switched to workspace: ${wsName} (no sites)`);\n setTimeout(() => {\n window.location.href = '/';\n }, 500);\n }\n } catch (err) {\n toast.error('Failed to switch workspace');\n }\n };\n\n const handleSelectSite = (siteId: string) => {\n const site = sites.find((s) => (s._id || s.id) === siteId);\n if (!site) return;\n if ((site._id || site.id) === activeSiteId) return;\n\n const actualId = site._id || site.id;\n setActiveSiteId(actualId);\n useTenantStore.getState().setActiveSiteId(actualId, site.name);\n localStorage.setItem('activeSiteName', site.name);\n localStorage.setItem('activeSiteSlug', site.slug);\n api.defaults.headers['x-zenith-site-id'] = actualId;\n toast.success(`Switched to site: ${site.name}`);\n setTimeout(() => {\n window.location.href = '/';\n }, 500);\n };\n\n const activeWorkspace = workspaces.find((w) => (w._id || w.id) === activeWorkspaceId) || {\n name: 'Default Workspace',\n };\n\n const activeSite = sites.find((s) => (s._id || s.id) === activeSiteId) || {\n name: localStorage.getItem('activeSiteName') || 'Default Site',\n icon: '',\n };\n\n // Map workspaces to DropdownOptions\n const workspaceOptions: DropdownOption[] = workspaces.map((ws) => ({\n value: ws._id || ws.id,\n label: ws.name,\n icon: <Briefcase size={16} className=\"text-[var(--z-accent)]\" />,\n slug: ws.slug,\n }));\n\n // Map sites to DropdownOptions\n const siteOptions: DropdownOption[] = sites.map((site) => ({\n value: site._id || site.id,\n label: site.name,\n icon: <span className=\"text-[var(--z-accent)]\">{site.icon || ''}</span>,\n slug: site.slug,\n }));\n\n // Render trigger for Workspace\n const renderWorkspaceTrigger = (selected: DropdownOption | null, isOpen: boolean, toggle: () => void) => {\n const activeLabel = selected ? selected.label : activeWorkspace.name;\n return (\n <button\n type=\"button\"\n onClick={toggle}\n className={cn(\n \"w-full flex items-center justify-between text-left transition-all duration-300 p-2.5\",\n \"relative overflow-hidden shadow-sm\",\n theme === 'dark' \n ? \"bg-app/65 backdrop-blur-[12px] text-z-primary border border-z-border hover:border-[var(--z-accent)]/50 hover:bg-app/85 shadow-[0_4px_30px_rgba(0,0,0,0.1)]\" \n : \"bg-z-panel/65 backdrop-blur-[12px] text-z-primary border border-z-border hover:border-[var(--z-accent)]/30 hover:bg-z-panel/85\",\n isSidebarOpen ? \"rounded-none\" : \"rounded-none p-2 justify-center\",\n \"hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-z-active-border\"\n )}\n title={!isSidebarOpen ? activeLabel : undefined}\n >\n <div className={cn(\"flex items-center min-w-0 z-10\", isSidebarOpen ? \"gap-3\" : \"gap-0 justify-center\")}>\n <div className={cn(\n \"rounded-none-none flex items-center justify-center flex-shrink-0 transition-colors duration-300\",\n theme === 'dark' ? \"bg-[var(--z-accent)]/10 text-[var(--z-accent)]\" : \"bg-[var(--z-accent)]/5 text-[var(--z-accent)]\",\n isSidebarOpen ? \"w-8 h-8\" : \"w-10 h-10\"\n )}>\n <Briefcase size={16} />\n </div>\n \n {isSidebarOpen && (\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-sm font-semibold text-[var(--z-accent)] font-mono leading-none mb-1\">\n WORKSPACE\n </span>\n <span className=\"text-xs font-semibold tracking-wide truncate leading-none\">\n {activeLabel}\n </span>\n </div>\n )}\n </div>\n\n {isSidebarOpen && (\n <motion.div\n animate={{ rotate: isOpen ? 180 : 0 }}\n transition={{ duration: 0.2 }}\n className=\"text-z-sidebar-text flex-shrink-0 z-10 ml-2\"\n >\n <ChevronDown size={14} />\n </motion.div>\n )}\n </button>\n );\n };\n\n // Render trigger for Site\n const renderSiteTrigger = (selected: DropdownOption | null, isOpen: boolean, toggle: () => void) => {\n const activeIcon = selected ? selected.icon : <span>{activeSite.icon || ''}</span>;\n const activeLabel = selected ? selected.label : activeSite.name;\n return (\n <button\n type=\"button\"\n onClick={toggle}\n className={cn(\n \"w-full flex items-center justify-between text-left transition-all duration-300 p-2.5\",\n \"relative overflow-hidden shadow-sm\",\n theme === 'dark' \n ? \"bg-app/65 backdrop-blur-[12px] text-z-primary border border-z-border hover:border-[var(--z-accent)]/50 hover:bg-app/85 shadow-[0_4px_30px_rgba(0,0,0,0.1)]\" \n : \"bg-z-panel/65 backdrop-blur-[12px] text-z-primary border border-z-border hover:border-[var(--z-accent)]/30 hover:bg-z-panel/85\",\n isSidebarOpen ? \"rounded-none\" : \"rounded-none p-2 justify-center\",\n \"hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-z-active-border\"\n )}\n title={!isSidebarOpen ? activeLabel : undefined}\n >\n <div className={cn(\"flex items-center min-w-0 z-10\", isSidebarOpen ? \"gap-3\" : \"gap-0 justify-center\")}>\n <div className={cn(\n \"rounded-none flex items-center justify-center flex-shrink-0 transition-colors duration-300\",\n theme === 'dark' ? \"bg-[var(--z-accent)]/10 text-[var(--z-accent)]\" : \"bg-[var(--z-accent)]/5 text-[var(--z-accent)]\",\n isSidebarOpen ? \"w-8 h-8\" : \"w-10 h-10\"\n )}>\n {activeIcon}\n </div>\n \n {isSidebarOpen && (\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-sm font-semibold text-[var(--z-accent)] font-mono leading-none mb-1\">\n TENANT / SITE\n </span>\n <span className=\"text-xs font-semibold tracking-wide truncate leading-none\">\n {activeLabel}\n </span>\n </div>\n )}\n </div>\n\n {isSidebarOpen && (\n <motion.div\n animate={{ rotate: isOpen ? 180 : 0 }}\n transition={{ duration: 0.2 }}\n className=\"text-z-sidebar-text flex-shrink-0 z-10 ml-2\"\n >\n <ChevronDown size={14} />\n </motion.div>\n )}\n </button>\n );\n };\n\n const renderWorkspaceOption = (option: any, isSelected: boolean) => {\n return (\n <button\n type=\"button\"\n className={cn(\n \"w-full px-4 py-2.5 flex items-center justify-between text-left transition-colors duration-200\",\n theme === 'dark' ? \"hover:bg-z-hover\" : \"hover:bg-app/[0.02]\",\n isSelected && (theme === 'dark' ? \"bg-[var(--z-accent)]/10 text-[var(--z-accent)]\" : \"bg-[var(--z-accent)]/5 text-[var(--z-accent)]\")\n )}\n >\n <div className=\"flex items-center gap-3 min-w-0\">\n <span className=\"text-base flex-shrink-0\">{option.icon}</span>\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-xs font-bold truncate\">{option.label}</span>\n <span className=\"text-sm text-z-sidebar-text font-mono\">/{option.slug}</span>\n </div>\n </div>\n {isSelected && (\n <span className=\"w-1.5 h-1.5 rounded-none-none bg-[var(--z-accent)] shadow-sm\" />\n )}\n </button>\n );\n };\n\n const renderSiteOption = (option: any, isSelected: boolean) => {\n return (\n <button\n type=\"button\"\n className={cn(\n \"w-full px-4 py-2.5 flex items-center justify-between text-left transition-colors duration-200\",\n theme === 'dark' ? \"hover:bg-z-hover\" : \"hover:bg-app/[0.02]\",\n isSelected && (theme === 'dark' ? \"bg-[var(--z-accent)]/10 text-[var(--z-accent)]\" : \"bg-[var(--z-accent)]/5 text-[var(--z-accent)]\")\n )}\n >\n <div className=\"flex items-center gap-3 min-w-0\">\n <span className=\"text-base flex-shrink-0\">{option.icon}</span>\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-xs font-bold truncate\">{option.label}</span>\n <span className=\"text-sm text-z-sidebar-text font-mono\">/{option.slug}</span>\n </div>\n </div>\n {isSelected && (\n <span className=\"w-1.5 h-1.5 rounded-none-none bg-[var(--z-accent)] shadow-sm\" />\n )}\n </button>\n );\n };\n\n const workspaceFooterAction = (\n <Link\n to=\"/sites\"\n className={cn(\n \"w-full px-4 py-3 flex items-center justify-center gap-2 text-sm font-semibold font-mono transition-colors\",\n theme === 'dark' \n ? \"text-z-sidebar-text hover:text-z-primary hover:bg-z-hover\" \n : \"text-z-sidebar-text hover:text-z-primary hover:bg-app/[0.02]\"\n )}\n >\n <Sliders size={12} className=\"text-[var(--z-accent)]\" />\n Manage Workspaces & Tenants\n </Link>\n );\n\n return (\n <div \n className={cn(\n \"py-3 flex flex-col gap-3 transition-all duration-300\",\n isSidebarOpen ? \"px-4\" : \"px-2\",\n theme === 'dark' ? 'bg-app/10' : 'bg-[var(--z-bg-input)]/20'\n )}\n >\n {/* Workspace Select */}\n <GlassDropdown\n options={workspaceOptions}\n value={activeWorkspaceId || ''}\n onChange={handleSelectWorkspace}\n isSidebarOpen={isSidebarOpen}\n headerText=\"Switch Workspace\"\n footerAction={workspaceFooterAction}\n renderTrigger={renderWorkspaceTrigger}\n renderOption={renderWorkspaceOption}\n menuClassName={isSidebarOpen ? \"left-0 right-0\" : \"left-12 w-[240px]\"}\n />\n\n {/* Site Select */}\n <GlassDropdown\n options={siteOptions}\n value={activeSiteId || ''}\n onChange={handleSelectSite}\n isSidebarOpen={isSidebarOpen}\n headerText=\"Switch Tenant / Site\"\n renderTrigger={renderSiteTrigger}\n renderOption={renderSiteOption}\n menuClassName={isSidebarOpen ? \"left-0 right-0\" : \"left-12 w-[240px]\"}\n />\n </div>\n );\n};\n","import useSWR from 'swr'\nimport api from '../lib/api'\nimport { useTenantStore } from '../lib/tenantStore'\n\n/**\n * Hook to fetch the health/metadata for the current site.\n */\nexport function useSystemMetadata() {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n \n return useSWR(activeSiteId ? ['systemMetadata', activeSiteId] : null, async () => {\n const [healthRes, schemasRes] = await Promise.all([\n api.get('/system/health').catch(() => ({ data: { data: {} } })),\n api.get('/schemas').catch(() => ({ data: { data: [] } }))\n ])\n const health = healthRes.data?.data || {}\n \n const schemas = Array.isArray(schemasRes.data?.data) ? schemasRes.data.data : []\n \n return {\n ...health,\n collections: schemas.filter((s: any) => !s.isGlobal),\n globals: schemas.filter((s: any) => s.isGlobal)\n }\n }, {\n dedupingInterval: 5 * 60 * 1000,\n })\n}\n\n/**\n * Hook to fetch a paginated list of items for a collection\n */\nexport function useCollectionItems(slug: string, page: number, viewMode: 'active' | 'trash' = 'active') {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n\n return useSWR(\n slug ? ['collectionItems', activeSiteId, slug, viewMode, page] : null,\n async () => {\n const endpoint = viewMode === 'trash' ? `/${slug}/trash?page=${page}` : `/${slug}?page=${page}`\n const response = await api.get(endpoint)\n return {\n items: response.data?.data || [],\n total: response.data?.meta?.pagination?.total || response.data?.data?.length || 0\n }\n }\n )\n}\n\n/**\n * Hook to fetch a single document and its versions\n */\nexport function useDocumentData(collectionSlug: string, id: string, isGlobal: boolean) {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n const isNew = id === 'new'\n\n return useSWR(\n (collectionSlug && id && !isNew) ? ['documentData', activeSiteId, collectionSlug, id] : null,\n async () => {\n const endpoint = isGlobal ? `/globals/${id}` : `/${collectionSlug}/${id}`\n const response = await api.get(endpoint)\n return response.data?.data || null\n }\n )\n}\n\nexport function useDocumentHistory(collectionSlug: string, id: string, isGlobal: boolean) {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n const isNew = id === 'new'\n\n return useSWR(\n (collectionSlug && id && !isNew) ? ['documentHistory', activeSiteId, collectionSlug, id] : null,\n async () => {\n const collType = isGlobal ? 'globals' : collectionSlug\n const response = await api.get(`/versions/${collType}/${id}`)\n return response.data?.data || []\n }\n )\n}\n\nexport function useReleases() {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n\n return useSWR(\n activeSiteId ? ['releases', activeSiteId] : null,\n async () => {\n const response = await api.get('/releases')\n return response.data?.data || []\n }\n )\n}\n","import React, { useState, useEffect, useRef, useMemo } from 'react'\nimport { useNavigate } from 'react-router-dom'\nimport {\n Search,\n X,\n FileText,\n Database,\n Settings,\n Zap,\n Clock,\n Layout,\n Shield,\n Mail,\n Key,\n Sparkles,\n Palette,\n Users,\n} from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport api from '../lib/api'\n\nconst GlobalSearch: React.FC = () => {\n const navigate = useNavigate()\n const [query, setQuery] = useState('')\n const [isFocused, setIsFocused] = useState(false)\n const [results, setResults] = useState<any[]>([])\n const [isSearching, setIsSearching] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setIsFocused(false)\n }\n }\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [])\n\n useEffect(() => {\n const delayDebounceFn = setTimeout(async () => {\n if (query.length >= 2) {\n setIsSearching(true)\n try {\n const res = await api.get(`/system/search?q=${encodeURIComponent(query)}`)\n setResults(res.data.data)\n } catch {\n console.error('Search failed')\n setResults([])\n } finally {\n setIsSearching(false)\n }\n } else {\n setResults([])\n }\n }, 300)\n\n return () => clearTimeout(delayDebounceFn)\n }, [query])\n\n const highlightMatch = (text: string, match: string) => {\n if (!match || !text) return text || ''\n const escapedMatch = match.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n const parts = text.split(new RegExp(`(${escapedMatch})`, 'gi'))\n return parts.map((part, i) =>\n part.toLowerCase() === match.toLowerCase() ? (\n <span\n key={i}\n className=\"text-z-secondary font-semibold underline decoration-2 underline-offset-2\"\n >\n {part}\n </span>\n ) : (\n part\n )\n )\n }\n\n const handleSelect = (path: string) => {\n navigate(path)\n setIsFocused(false)\n setQuery('')\n }\n\n const commands = useMemo(() => [\n { label: 'Dashboard', path: '/', icon: Layout, sub: 'System Overview' },\n { label: 'General Settings', path: '/settings?tab=general', icon: Settings, sub: 'Site Name, URL, Maintenance' },\n { label: 'Maintenance Mode', path: '/settings?tab=general', icon: Zap, sub: 'Protocol Override' },\n { label: 'Security Protocols', path: '/settings?tab=security', icon: Shield, sub: 'Session Lifespan & Auth' },\n { label: 'SMTP Relay', path: '/settings?tab=notifications', icon: Mail, sub: 'Email Configuration' },\n { label: 'Operator Registry', path: '/settings?tab=users', icon: Users, sub: 'User Management' },\n { label: 'API Credentials', path: '/settings?tab=keys', icon: Key, sub: 'Access Tokens' },\n { label: 'Infrastructure Stats', path: '/settings?tab=database', icon: Database, sub: 'DB Health & Cache' },\n { label: 'AI Intelligence', path: '/settings?tab=ai', icon: Sparkles, sub: 'Neural Bridge Config' },\n { label: 'Custom Styles', path: '/settings?tab=appearance', icon: Palette, sub: 'CSS Overrides' },\n { label: 'Audit Logs', path: '/audit-logs', icon: Clock, sub: 'Security Events' },\n { label: 'Plugin Marketplace', path: '/plugins', icon: Zap, sub: 'Modular Extensions' },\n ], [])\n\n const filteredCommands = useMemo(\n () => commands.filter(\n (cmd) =>\n cmd.label.toLowerCase().includes(query.toLowerCase()) ||\n cmd.sub.toLowerCase().includes(query.toLowerCase())\n ),\n [commands, query]\n )\n\n return (\n <div ref={containerRef} className=\"relative z-[100]\">\n <motion.div\n animate={{ width: isFocused ? 360 : 280 }}\n className={cn(\n 'flex items-center gap-2 px-4 py-2.5 rounded-none-none transition-all border',\n isFocused\n ? 'bg-z-panel border-z-border text-z-primary shadow-md ring-4 ring-z-active-border dark:bg-app dark:ring-z-active-border'\n : 'bg-z-panel border-z-border text-z-secondary hover:bg-[var(--z-bg-input)] shadow-sm dark:bg-app/50 dark:border-z-border dark:text-z-muted dark:hover:bg-z-hover'\n )}\n >\n <Search\n size={16}\n className={cn('transition-colors', isFocused ? 'text-z-secondary ' : 'text-z-muted ')}\n />\n <input\n type=\"text\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n onFocus={() => setIsFocused(true)}\n placeholder=\"SEARCH SYSTEM...\"\n className=\"bg-transparent border-none text-sm font-semibold flex-1 placeholder:text-z-muted dark:placeholder:text-z-secondary focus:outline-none focus:ring-0 rounded-none-none px-1\"\n />\n {query && (\n <button onClick={() => setQuery('')} className=\"p-1 hover:bg-[var(--z-bg-hover)] dark:hover:bg-[var(--z-bg-hover)] rounded-none-none transition-colors\">\n <X size={14} className=\"text-z-secondary\" />\n </button>\n )}\n {!isFocused && !query && (\n <div className=\"flex items-center gap-1 px-1.5 py-0.5 rounded-none-none border border-z-border dark:border-z-border bg-[var(--z-bg-input)] dark:bg-app/40 text-sm font-semibold text-z-secondary \">\n <span>⌘</span>\n <span>K</span>\n </div>\n )}\n </motion.div>\n\n <AnimatePresence>\n {isFocused && (query.length > 0 || results.length > 0) && (\n <motion.div\n initial={{ opacity: 0, y: 10, scale: 0.98 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, y: 10, scale: 0.98 }}\n transition={{ duration: 0.2, ease: \"easeOut\" }}\n className=\"absolute top-full left-0 right-0 mt-3 bg-z-panel border border-z-border dark:bg-[#0a0a0a] dark:border-z-border rounded-none-none shadow-2xl overflow-hidden flex flex-col text-z-primary \"\n >\n <div className=\"max-h-[400px] overflow-y-auto p-2\">\n {results.length > 0 && (\n <div className=\"space-y-0.5 mb-2\">\n <div className=\"px-3 py-2 text-sm font-semibold text-z-muted \">\n Database Nodes\n </div>\n {results.map((res: any) => (\n <button\n key={res.id}\n onClick={() => handleSelect(`/collections/${res.collection}/${res.id}`)}\n className=\"w-full flex items-center gap-3 p-2.5 rounded-none-none hover:bg-[var(--z-bg-input)] dark:hover:bg-z-hover transition-all text-left group\"\n >\n <div className=\"w-8 h-8 rounded-none-none bg-[var(--z-bg-input)] dark:bg-z-panel flex items-center justify-center text-z-secondary flex-shrink-0 border border-z-border /20 group-hover:scale-105 transition-transform\">\n <FileText size={14} />\n </div>\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-sm font-semibold truncate text-z-primary \">\n {highlightMatch(res.title, query)}\n </span>\n <span className=\"text-sm font-bold text-z-muted \">\n {res.collectionLabel}\n </span>\n </div>\n </button>\n ))}\n </div>\n )}\n\n {/* System Protocols & Settings Deep Search */}\n <div className=\"pt-2 border-t border-z-border border-z-border space-y-0.5\">\n <div className=\"px-3 py-2 text-sm font-semibold text-z-muted \">\n System Protocols\n </div>\n {(() => {\n if (\n results.length === 0 &&\n filteredCommands.length === 0 &&\n query.length >= 2 &&\n !isSearching\n ) {\n return (\n <div className=\"py-10 text-center flex flex-col items-center justify-center gap-2\">\n <Search size={20} className=\"text-z-secondary dark:text-z-primary\" />\n <span className=\"text-sm font-semibold text-z-muted dark:text-z-secondary\">\n No matching records found\n </span>\n </div>\n )\n }\n\n return filteredCommands.map((cmd) => (\n <button\n key={cmd.label}\n onClick={() => handleSelect(cmd.path)}\n className=\"w-full flex items-center gap-3 p-2.5 rounded-none-none hover:bg-[var(--z-bg-input)] dark:hover:bg-z-hover transition-all text-left group\"\n >\n <div className=\"w-8 h-8 rounded-none-none bg-[var(--z-bg-hover)] dark:bg-z-hover flex items-center justify-center text-z-secondary flex-shrink-0 group-hover:bg-z-border group-hover:text-z-primary dark:group-hover:bg-z-border dark:group-hover:text-z-primary transition-all group-hover:scale-105 border border-transparent border-z-border\">\n <cmd.icon size={14} />\n </div>\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-sm font-semibold truncate text-z-primary \">\n {highlightMatch(cmd.label, query)}\n </span>\n <span className=\"text-sm font-bold text-z-muted truncate\">\n {highlightMatch(cmd.sub, query)}\n </span>\n </div>\n </button>\n ))\n })()}\n </div>\n </div>\n\n <div className=\"px-4 py-2.5 bg-[var(--z-bg-input)] dark:bg-app border-t border-z-border dark:border-z-border flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-z-secondary \">\n Core_Intelligence_Stream\n </span>\n <div className=\"flex items-center gap-2\">\n <div className=\"w-1.5 h-1.5 bg-z-border rounded-none-none animate-pulse shadow-sm\" />\n <span className=\"text-sm font-semibold text-z-secondary \">\n Sync_Active\n </span>\n </div>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n )\n}\n\nexport default GlobalSearch\n","import React from 'react'\nimport { cn } from '../lib/utils'\n\ninterface LogoProps {\n className?: string\n size?: 'sm' | 'md' | 'lg' | number\n}\n\nconst Logo: React.FC<LogoProps> = ({ className, size = 'md' }) => {\n const sizeMap = {\n sm: 'w-6 h-6',\n md: 'w-8 h-8',\n lg: 'w-12 h-12',\n }\n\n const sizeClass = typeof size === 'number' ? `w-[${size}px] h-[${size}px]` : sizeMap[size]\n const inlineStyle = typeof size === 'number' ? { width: size, height: size } : {}\n\n return (\n <div\n className={cn(\n 'bg-current', // Inherits the text color\n sizeClass,\n className\n )}\n style={{\n ...inlineStyle,\n maskImage: 'url(\"/logo/zenith.svg\")',\n maskRepeat: 'no-repeat',\n maskPosition: 'center',\n maskSize: 'contain',\n WebkitMaskImage: 'url(\"/logo/zenith.svg\")',\n WebkitMaskRepeat: 'no-repeat',\n WebkitMaskPosition: 'center',\n WebkitMaskSize: 'contain',\n }}\n />\n )\n}\n\nexport default Logo\n","import React, { createContext, useCallback, useContext, useEffect, useState } from 'react'\n\n// ── Theme Preset Schema ───────────────────────────────────────────────────────\nexport interface ThemePreset {\n id: string\n name: string\n version?: string\n description?: string\n category?: 'builtin' | 'custom' | 'community'\n tags?: string[]\n author?: string\n designStyle?: 'glass' | 'classic'\n\n // ── Primary accent ──────────────────────────────────────────\n accent: string // HSL e.g. \"160 84% 39%\"\n accentHex: string // Hex e.g. \"var(--z-accent)\"\n\n // ── Active / selected state ─────────────────────────────────\n activeBg: string // rgba(R,G,B,0.10–0.15)\n activeBorder: string // rgba(R,G,B,0.30–0.40)\n activeText: string // rgb(R+50,G+50,B+50)\n activeGlow: string // box-shadow glow\n\n // ── Sidebar badge ───────────────────────────────────────────\n logoIconBg: string\n logoIconText: string\n\n sidebarBg?: string\n layoutVariant?: string\n\n // ── Optional background overrides (full theme) ──────────────\n // When set, these override the mode default --z-bg-* vars.\n // Leave undefined to inherit the dark/light mode defaults.\n bgBase?: string // Main canvas e.g. \"#02000A\"\n bgSidebar?: string // Sidebar panel\n bgHeader?: string // Top header\n bgPanel?: string // Cards/panels\n bgInput?: string // Form inputs\n bgHover?: string // Hover overlay\n\n // ── Optional border/text overrides ──────────────────────────\n borderColor?: string // default border\n borderStrong?: string // strong border\n textPrimary?: string // primary text\n textSecondary?: string // secondary text\n textMuted?: string // muted text\n\n // ── Optional design tokens ──────────────────────────────────\n fontFamily?: string\n borderRadius?: 'none' | 'sm' | 'md' | 'lg'\n customCSS?: string\n}\n\n// ── Built-in presets ──────────────────────────────────────────────────────────\nexport const BUILTIN_PRESETS: ThemePreset[] = [\n {\n id: 'zenith',\n name: 'Zenith Dark',\n category: 'builtin',\n description: 'The default Zenith dark experience with emerald accents.',\n tags: ['dark', 'green', 'default'],\n accent: '160 84% 39%',\n accentHex: 'var(--z-accent)',\n sidebarBg: 'rgba(0,0,0,0.65)',\n activeBg: 'rgba(16,185,129,0.1)',\n activeBorder: 'rgba(16,185,129,0.3)',\n activeText: 'rgb(52,211,153)',\n activeGlow: '0 0 20px rgba(16,185,129,0.15)',\n logoIconBg: 'var(--z-accent)',\n logoIconText: '#000',\n },\n {\n id: 'classic-enterprise',\n name: 'Classic Enterprise',\n category: 'builtin',\n description: 'Solid panels, no blur. Traditional SaaS enterprise layout.',\n tags: ['dark', 'blue', 'classic', 'enterprise', 'solid'],\n designStyle: 'classic',\n accent: '215 100% 50%',\n accentHex: '#0066FF',\n activeBg: 'rgba(0,102,255,0.15)',\n activeBorder: 'rgba(0,102,255,0.40)',\n activeText: 'rgb(51,153,255)',\n activeGlow: '0 0 10px rgba(0,102,255,0.20)',\n logoIconBg: '#0066FF',\n logoIconText: '#fff',\n bgBase: '#050505',\n bgSidebar: '#0A1120',\n bgHeader: '#0A1120',\n bgPanel: '#111827',\n borderColor: 'rgba(255,255,255,0.12)',\n borderRadius: 'md',\n },\n {\n id: 'violet',\n name: 'Violet Studio',\n category: 'builtin',\n description: 'Creative purple palette for design-focused teams.',\n tags: ['dark', 'purple', 'creative'],\n accent: '263 70% 50%',\n accentHex: 'var(--z-accent)',\n sidebarBg: 'rgba(0,0,0,0.65)',\n activeBg: 'rgba(139,92,246,0.1)',\n activeBorder: 'rgba(139,92,246,0.3)',\n activeText: 'rgb(167,139,250)',\n activeGlow: '0 0 20px rgba(139,92,246,0.15)',\n logoIconBg: 'var(--z-accent)',\n logoIconText: '#fff',\n },\n {\n id: 'midnight',\n name: 'Midnight Blue',\n category: 'builtin',\n description: 'Deep blue tones for a calm, focused workspace.',\n tags: ['dark', 'blue', 'calm'],\n accent: '217 91% 60%',\n accentHex: '#3B82F6',\n sidebarBg: 'rgba(0,4,20,0.8)',\n activeBg: 'rgba(59,130,246,0.1)',\n activeBorder: 'rgba(59,130,246,0.3)',\n activeText: 'rgb(96,165,250)',\n activeGlow: '0 0 20px rgba(59,130,246,0.15)',\n logoIconBg: '#3B82F6',\n logoIconText: '#fff',\n },\n {\n id: 'sunset',\n name: 'Sunset',\n category: 'builtin',\n description: 'Warm orange tones — high energy, high impact.',\n tags: ['dark', 'orange', 'warm'],\n accent: '21 90% 58%',\n accentHex: '#F97316',\n sidebarBg: 'rgba(10,2,0,0.75)',\n activeBg: 'rgba(249,115,22,0.1)',\n activeBorder: 'rgba(249,115,22,0.3)',\n activeText: 'rgb(251,146,60)',\n activeGlow: '0 0 20px rgba(249,115,22,0.15)',\n logoIconBg: '#F97316',\n logoIconText: '#fff',\n },\n {\n id: 'rose',\n name: 'Rose Quartz',\n category: 'builtin',\n description: 'Bold red-pink for brands that demand attention.',\n tags: ['dark', 'red', 'bold'],\n accent: '346 77% 49%',\n accentHex: '#E11D48',\n sidebarBg: 'rgba(8,0,4,0.75)',\n activeBg: 'rgba(225,29,72,0.1)',\n activeBorder: 'rgba(225,29,72,0.3)',\n activeText: 'rgb(251,113,133)',\n activeGlow: '0 0 20px rgba(225,29,72,0.15)',\n logoIconBg: '#E11D48',\n logoIconText: '#fff',\n },\n {\n id: 'forest',\n name: 'Forest',\n category: 'builtin',\n description: 'Deep forest greens for a grounded, earthy feel.',\n tags: ['dark', 'green', 'nature'],\n accent: '142 70% 35%',\n accentHex: '#15803D',\n sidebarBg: 'rgba(0,8,2,0.75)',\n activeBg: 'rgba(21,128,61,0.1)',\n activeBorder: 'rgba(21,128,61,0.3)',\n activeText: 'rgb(74,222,128)',\n activeGlow: '0 0 20px rgba(21,128,61,0.15)',\n logoIconBg: '#15803D',\n logoIconText: '#fff',\n },\n {\n id: 'gold',\n name: 'Gold Rush',\n category: 'builtin',\n description: 'Premium amber-gold for luxury brands.',\n tags: ['dark', 'gold', 'premium'],\n accent: '38 92% 50%',\n accentHex: '#F59E0B',\n sidebarBg: 'rgba(8,5,0,0.8)',\n activeBg: 'rgba(245,158,11,0.1)',\n activeBorder: 'rgba(245,158,11,0.3)',\n activeText: 'rgb(252,211,77)',\n activeGlow: '0 0 20px rgba(245,158,11,0.15)',\n logoIconBg: '#F59E0B',\n logoIconText: '#000',\n },\n {\n id: 'arctic',\n name: 'Arctic Cyan',\n category: 'builtin',\n description: 'Ice-cold cyan for tech-first, data-driven teams.',\n tags: ['dark', 'cyan', 'tech'],\n accent: '188 94% 43%',\n accentHex: '#06B6D4',\n sidebarBg: 'rgba(0,4,8,0.8)',\n activeBg: 'rgba(6,182,212,0.1)',\n activeBorder: 'rgba(6,182,212,0.3)',\n activeText: 'rgb(34,211,238)',\n activeGlow: '0 0 20px rgba(6,182,212,0.15)',\n logoIconBg: '#06B6D4',\n logoIconText: '#000',\n },\n]\n\n// ── Community themes (pre-made, read-only, install to custom) ─────────────────\nexport const COMMUNITY_PRESETS: ThemePreset[] = [\n {\n id: 'neon-tokyo',\n name: 'Neon Tokyo',\n category: 'community',\n author: 'Zenith Team',\n description: 'Vibrant neon pink inspired by Tokyo nightlife.',\n tags: ['neon', 'pink', 'cyberpunk'],\n accent: '330 100% 60%',\n accentHex: '#FF2D78',\n sidebarBg: 'rgba(5,0,10,0.85)',\n activeBg: 'rgba(255,45,120,0.12)',\n activeBorder: 'rgba(255,45,120,0.4)',\n activeText: 'rgb(255,100,160)',\n activeGlow: '0 0 25px rgba(255,45,120,0.25)',\n logoIconBg: '#FF2D78',\n logoIconText: '#fff',\n },\n {\n id: 'deep-space',\n name: 'Deep Space',\n category: 'community',\n author: 'Zenith Team',\n description: 'Cosmic indigo, built for long night sessions.',\n tags: ['dark', 'indigo', 'space'],\n accent: '240 80% 60%',\n accentHex: '#6366F1',\n sidebarBg: 'rgba(2,0,12,0.9)',\n activeBg: 'rgba(99,102,241,0.12)',\n activeBorder: 'rgba(99,102,241,0.35)',\n activeText: 'rgb(129,140,248)',\n activeGlow: '0 0 25px rgba(99,102,241,0.2)',\n logoIconBg: '#6366F1',\n logoIconText: '#fff',\n },\n {\n id: 'matrix',\n name: 'Matrix',\n category: 'community',\n author: 'Zenith Team',\n description: 'Classic green-on-black terminal aesthetic.',\n tags: ['dark', 'green', 'hacker', 'mono'],\n accent: '120 100% 40%',\n accentHex: '#00CC44',\n sidebarBg: 'rgba(0,6,0,0.92)',\n activeBg: 'rgba(0,204,68,0.08)',\n activeBorder: 'rgba(0,204,68,0.3)',\n activeText: 'rgb(0,255,85)',\n activeGlow: '0 0 20px rgba(0,204,68,0.2)',\n logoIconBg: '#00CC44',\n logoIconText: '#000',\n },\n {\n id: 'sakura',\n name: 'Sakura',\n category: 'community',\n author: 'Zenith Team',\n description: 'Soft pink blossom theme — elegant and refined.',\n tags: ['light', 'pink', 'minimal'],\n accent: '340 75% 70%',\n accentHex: '#F48FB1',\n sidebarBg: 'rgba(0,0,0,0.65)',\n activeBg: 'rgba(244,143,177,0.12)',\n activeBorder: 'rgba(244,143,177,0.4)',\n activeText: 'rgb(249,168,212)',\n activeGlow: '0 0 20px rgba(244,143,177,0.2)',\n logoIconBg: '#F48FB1',\n logoIconText: '#fff',\n },\n {\n id: 'obsidian',\n name: 'Obsidian',\n category: 'community',\n author: 'Zenith Team',\n description: 'Minimal monochrome for distraction-free work.',\n tags: ['dark', 'mono', 'minimal'],\n accent: '0 0% 80%',\n accentHex: '#CCCCCC',\n sidebarBg: 'rgba(0,0,0,0.7)',\n activeBg: 'rgba(200,200,200,0.08)',\n activeBorder: 'rgba(200,200,200,0.2)',\n activeText: 'rgb(229,229,229)',\n activeGlow: '0 0 15px rgba(200,200,200,0.1)',\n logoIconBg: '#333',\n logoIconText: '#fff',\n },\n {\n id: 'lava',\n name: 'Lava',\n category: 'community',\n author: 'Zenith Team',\n description: 'Intense red-orange for power users.',\n tags: ['dark', 'red', 'intense'],\n accent: '15 95% 55%',\n accentHex: '#F73B10',\n sidebarBg: 'rgba(10,2,0,0.85)',\n activeBg: 'rgba(247,59,16,0.1)',\n activeBorder: 'rgba(247,59,16,0.35)',\n activeText: 'rgb(253,109,84)',\n activeGlow: '0 0 22px rgba(247,59,16,0.2)',\n logoIconBg: '#F73B10',\n logoIconText: '#fff',\n },\n]\n\n// ── Brand Config ──────────────────────────────────────────────────────────────\nexport interface BrandConfig {\n appName: string\n appTagline: string\n logoUrl: string\n faviconUrl: string\n themePresetId: string\n customCSS: string\n primaryColor: string\n fontFamily: string\n}\n\nconst DEFAULTS: BrandConfig = {\n appName: 'Zenith',\n appTagline: 'v1.0 Beta',\n logoUrl: '',\n faviconUrl: '',\n themePresetId: 'zenith',\n customCSS: '',\n primaryColor: 'var(--z-accent)',\n fontFamily: 'Inter',\n}\n\ninterface BrandContextType {\n brand: BrandConfig\n preset: ThemePreset\n allPresets: ThemePreset[] // builtin + custom installed\n customThemes: ThemePreset[] // user-created themes\n setBrand: (b: Partial<BrandConfig>) => void\n applyPreset: (id: string) => void\n saveCustomTheme: (t: ThemePreset) => void\n deleteCustomTheme: (id: string) => void\n exportTheme: (t: ThemePreset) => void\n importTheme: (json: string) => ThemePreset | null\n}\n\nconst BrandContext = createContext<BrandContextType | undefined>(undefined)\n\nconst BRAND_KEY = 'zenith_brand_config'\nconst CUSTOM_THEMES_KEY = 'zenith_custom_themes'\n\nfunction loadBrand(): BrandConfig {\n try {\n const raw = localStorage.getItem(BRAND_KEY)\n if (raw) return { ...DEFAULTS, ...JSON.parse(raw) }\n } catch {}\n return DEFAULTS\n}\n\nfunction loadCustomThemes(): ThemePreset[] {\n try {\n const raw = localStorage.getItem(CUSTOM_THEMES_KEY)\n if (raw) return JSON.parse(raw)\n } catch {}\n return []\n}\n\n// ── Exported for use outside context ─────────────────────────────────────────\nexport const THEME_PRESETS = BUILTIN_PRESETS\n\nexport const BrandProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const [brand, setBrandState] = useState<BrandConfig>(loadBrand)\n const [customThemes, setCustomThemesState] = useState<ThemePreset[]>(loadCustomThemes)\n\n const allPresets = [...BUILTIN_PRESETS, ...customThemes]\n const preset = allPresets.find((p) => p.id === brand.themePresetId) || BUILTIN_PRESETS[0]\n\n useEffect(() => {\n const root = document.documentElement\n const set = (v: string, val: string) => root.style.setProperty(v, val)\n const unset = (v: string) => root.style.removeProperty(v)\n\n // ── Structural Design Style ────────────────────────────────\n root.setAttribute('data-design-style', preset.designStyle || 'glass')\n\n // ── Brand accent tokens (always set) ─────────────────────\n set('--z-accent', preset.accentHex)\n set('--z-accent-hsl', preset.accent)\n set('--z-active-bg', preset.activeBg)\n set('--z-active-border', preset.activeBorder)\n set('--z-active-text', preset.activeText)\n set('--z-active-glow', preset.activeGlow)\n set('--z-logo-bg', preset.logoIconBg)\n set('--z-logo-text', preset.logoIconText)\n // Scrollbar uses accent\n set('--z-scrollbar', `${preset.activeBg}`)\n set('--z-scrollbar-hover', `${preset.activeBorder}`)\n\n // ── Legacy compat (old --brand-* vars) ───────────────────\n set('--brand-accent', preset.accentHex)\n set('--brand-accent-hsl', preset.accent)\n set('--brand-active-bg', preset.activeBg)\n set('--brand-active-border', preset.activeBorder)\n set('--brand-active-text', preset.activeText)\n set('--brand-logo-bg', preset.logoIconBg)\n set('--brand-logo-text', preset.logoIconText)\n\n // ── Optional background overrides ────────────────────────\n // These let a theme fully override the dark/light defaults.\n if (preset.bgBase) set('--z-bg-base', preset.bgBase)\n else unset('--z-bg-base')\n if (preset.bgSidebar) set('--z-bg-sidebar', preset.bgSidebar)\n else unset('--z-bg-sidebar')\n if (preset.bgHeader) set('--z-bg-header', preset.bgHeader)\n else unset('--z-bg-header')\n if (preset.bgPanel) set('--z-bg-panel', preset.bgPanel)\n else unset('--z-bg-panel')\n if (preset.bgInput) set('--z-bg-input', preset.bgInput)\n else unset('--z-bg-input')\n if (preset.bgHover) set('--z-bg-hover', preset.bgHover)\n else unset('--z-bg-hover')\n\n // ── Optional border/text overrides ───────────────────────\n if (preset.borderColor) set('--z-border', preset.borderColor)\n else unset('--z-border')\n if (preset.borderStrong) set('--z-border-strong', preset.borderStrong)\n else unset('--z-border-strong')\n if (preset.textPrimary) set('--z-text-primary', preset.textPrimary)\n else unset('--z-text-primary')\n if (preset.textSecondary) set('--z-text-secondary', preset.textSecondary)\n else unset('--z-text-secondary')\n if (preset.textMuted) set('--z-text-muted', preset.textMuted)\n else unset('--z-text-muted')\n\n // ── Favicon ──────────────────────────────────────────────\n if (brand.faviconUrl) {\n let link = document.querySelector<HTMLLinkElement>('link[rel~=\"icon\"]')\n if (!link) {\n link = document.createElement('link')\n link.rel = 'icon'\n document.head.appendChild(link)\n }\n link.href = brand.faviconUrl\n }\n if (brand.appName) document.title = brand.appName\n\n // ── Font ─────────────────────────────────────────────────\n const fontToLoad = preset.fontFamily || brand.fontFamily\n if (fontToLoad && fontToLoad !== 'Inter') {\n const id = 'zenith-brand-font'\n let el = document.getElementById(id)\n if (!el) {\n el = document.createElement('link')\n el.id = id\n ;(el as HTMLLinkElement).rel = 'stylesheet'\n document.head.appendChild(el)\n }\n ;(el as HTMLLinkElement).href =\n `https://fonts.googleapis.com/css2?family=${encodeURIComponent(fontToLoad)}:wght@400;700;900&display=swap`\n set('--brand-font', `'${fontToLoad}', sans-serif`)\n } else {\n unset('--brand-font')\n }\n\n // ── Custom CSS ───────────────────────────────────────────\n const combined = [preset.customCSS || '', brand.customCSS || ''].filter(Boolean).join('\\n')\n let styleEl = document.getElementById('zenith-custom-css') as HTMLStyleElement\n if (!styleEl) {\n styleEl = document.createElement('style')\n styleEl.id = 'zenith-custom-css'\n document.head.appendChild(styleEl)\n }\n styleEl.textContent = combined\n }, [brand, preset])\n\n const setBrand = useCallback((partial: Partial<BrandConfig>) => {\n setBrandState((prev) => {\n const next = { ...prev, ...partial }\n localStorage.setItem(BRAND_KEY, JSON.stringify(next))\n return next\n })\n }, [])\n\n const applyPreset = useCallback(\n (id: string) => {\n const all = [...BUILTIN_PRESETS, ...loadCustomThemes()]\n const p = all.find((t) => t.id === id)\n if (!p) return\n setBrand({ themePresetId: id, primaryColor: p.accentHex })\n },\n [setBrand]\n )\n\n const saveCustomTheme = useCallback((t: ThemePreset) => {\n setCustomThemesState((prev) => {\n const idx = prev.findIndex((x) => x.id === t.id)\n const next = idx >= 0 ? prev.map((x, i) => (i === idx ? t : x)) : [...prev, t]\n localStorage.setItem(CUSTOM_THEMES_KEY, JSON.stringify(next))\n return next\n })\n }, [])\n\n const deleteCustomTheme = useCallback((id: string) => {\n setCustomThemesState((prev) => {\n const next = prev.filter((x) => x.id !== id)\n localStorage.setItem(CUSTOM_THEMES_KEY, JSON.stringify(next))\n return next\n })\n }, [])\n\n const exportTheme = useCallback((t: ThemePreset) => {\n const blob = new Blob([JSON.stringify(t, null, 2)], { type: 'application/json' })\n const a = document.createElement('a')\n a.href = URL.createObjectURL(blob)\n a.download = `zenith-theme-${t.id}.json`\n a.click()\n }, [])\n\n const importTheme = useCallback(\n (json: string): ThemePreset | null => {\n try {\n const t = JSON.parse(json) as ThemePreset\n if (!t.id || !t.name || !t.accentHex) return null\n const imported = { ...t, id: `custom_${Date.now()}`, category: 'custom' as const }\n saveCustomTheme(imported)\n return imported\n } catch {\n return null\n }\n },\n [saveCustomTheme]\n )\n\n return (\n <BrandContext.Provider\n value={{\n brand,\n preset,\n allPresets,\n customThemes,\n setBrand,\n applyPreset,\n saveCustomTheme,\n deleteCustomTheme,\n exportTheme,\n importTheme,\n }}\n >\n {children}\n </BrandContext.Provider>\n )\n}\n\n \nexport const useBrand = () => {\n const ctx = useContext(BrandContext)\n if (!ctx) throw new Error('useBrand must be used within BrandProvider')\n return ctx\n}\n","/**\n * Zenith UI Plugin Registry\n *\n * This is the central hub for all UI plugins. A plugin package registers\n * itself here with its routes, sidebar items, and settings tabs.\n *\n * USAGE (from a plugin's index.ts):\n *\n * import { pluginRegistry } from '@zenith-open/zenithcms-admin/plugin-registry'\n * pluginRegistry.register({\n * id: 'my-plugin',\n * name: 'My Plugin',\n * routes: [{ path: '/my-plugin', component: () => import('./MyPage') }],\n * sidebarItems: [{ label: 'My Feature', path: '/my-plugin', icon: 'Puzzle' }],\n * })\n *\n * INTERNAL USAGE (in App.tsx):\n *\n * import { pluginRegistry } from './lib/plugin-registry'\n * const routes = pluginRegistry.getRoutes()\n * const sidebarItems = pluginRegistry.getSidebarItems()\n */\n\nexport interface ZenithPluginRoute {\n path: string\n /** Lazy-loaded React component, e.g. () => import('./MyPage') */\n component: () => Promise<{ default: React.ComponentType<any> }>\n /** Whether the route requires authentication (default: true) */\n protected?: boolean\n}\n\nexport interface ZenithPluginSidebarItem {\n label: string\n path: string\n /** lucide-react icon name (string) or React node */\n icon?: string | React.ReactNode\n group?: string\n order?: number\n}\n\nexport interface ZenithPluginSettingsTab {\n id: string\n label: string\n icon?: React.ReactNode\n component: React.ComponentType<any>\n}\n\nexport interface ZenithUIPlugin {\n id: string\n name: string\n version?: string\n routes?: ZenithPluginRoute[]\n sidebarItems?: ZenithPluginSidebarItem[]\n settingsTabs?: ZenithPluginSettingsTab[]\n}\n\nclass PluginRegistry {\n private plugins = new Map<string, ZenithUIPlugin>()\n\n /**\n * Register a UI plugin. Called by plugin packages at module init time.\n * Safe to call multiple times — duplicate IDs are de-duped with a warning.\n */\n register(plugin: ZenithUIPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`[ZenithRegistry] Plugin \"${plugin.id}\" is already registered. Skipping duplicate.`)\n return\n }\n this.plugins.set(plugin.id, plugin)\n if (import.meta.env.DEV) {\n console.log(`[ZenithRegistry] ✓ Plugin registered: ${plugin.name} (${plugin.id})`)\n }\n }\n\n /** Unregister a plugin (useful for hot-reload in dev) */\n unregister(pluginId: string): void {\n this.plugins.delete(pluginId)\n }\n\n /** Get all registered plugins */\n getAll(): ZenithUIPlugin[] {\n return Array.from(this.plugins.values())\n }\n\n /** Collect all routes from all registered plugins */\n getRoutes(): ZenithPluginRoute[] {\n return this.getAll().flatMap((p) => p.routes ?? [])\n }\n\n /** Collect all sidebar items from all registered plugins, sorted by order */\n getSidebarItems(): ZenithPluginSidebarItem[] {\n return this.getAll()\n .flatMap((p) => p.sidebarItems ?? [])\n .sort((a, b) => (a.order ?? 999) - (b.order ?? 999))\n }\n\n /** Collect all settings tabs from all registered plugins */\n getSettingsTabs(): ZenithPluginSettingsTab[] {\n return this.getAll().flatMap((p) => p.settingsTabs ?? [])\n }\n\n /** Check if a plugin is registered */\n isRegistered(pluginId: string): boolean {\n return this.plugins.has(pluginId)\n }\n\n /** Get plugin by ID */\n get(pluginId: string): ZenithUIPlugin | undefined {\n return this.plugins.get(pluginId)\n }\n}\n\n/** Global singleton registry — import this anywhere to register or read plugins */\nexport const pluginRegistry = new PluginRegistry()\n\n// ── Auto-discovery: import known workspace plugins if they are installed ────────\n// Each plugin self-registers in its own index.ts. We attempt to import them here.\n// If a package is not installed, the dynamic import fails silently.\nconst WORKSPACE_PLUGINS = [\n '@zenithcms/plugin-workflows-ui',\n '@zenithcms/plugin-ai-architect-ui',\n '@zenithcms/plugin-multiplayer-crdt',\n]\n\nfor (const pkg of WORKSPACE_PLUGINS) {\n import(pkg).catch(() => {\n // Plugin not installed — this is expected and intentional (Zero-Bloat)\n // No noise in production logs\n })\n}\n","import { AnimatePresence, motion, Reorder } from 'framer-motion'\nimport {\n Box,\n Command,\n Database,\n Eye,\n EyeOff,\n GripVertical,\n Layout,\n LayoutDashboard,\n Inbox,\n LogOut,\n Menu,\n Moon,\n Network,\n Puzzle,\n Settings,\n ShieldCheck,\n Sparkles,\n Sun,\n Upload,\n X,\n WifiOff,\n} from 'lucide-react'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Link, Outlet, useLocation } from 'react-router-dom'\nimport { useNetworkStatus } from '../hooks/useNetworkStatus'\nimport { SiteSelector } from '../components/SiteSelector'\nimport { useTheme } from '../context/ThemeContext'\nimport { useSystemMetadata } from '../hooks/useQueries'\nimport { useTenantStore } from '../lib/tenantStore'\nimport { cn } from '../lib/utils'\nimport { useAuthStore } from '../store/authStore'\n\nimport { useShallow } from 'zustand/react/shallow'\nimport GlobalSearch from '../components/GlobalSearch'\nimport Logo from '../components/Logo'\nimport { useBrand } from '../context/BrandContext'\nimport { pluginRegistry } from '../lib/plugin-registry'\n\ninterface RegistryItem {\n slug: string\n name: string\n [key: string]: any\n}\n\ninterface HealthData {\n maintenanceMode?: boolean\n collections?: RegistryItem[]\n globals?: RegistryItem[]\n registry?: {\n collections?: RegistryItem[]\n globals?: RegistryItem[]\n }\n [key: string]: any\n}\n\nconst DashboardLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n const { logout, user } = useAuthStore(\n useShallow((state) => ({ logout: state.logout, user: state.user }))\n )\n const { theme, toggleTheme } = useTheme()\n const isOnline = useNetworkStatus()\n const { brand, preset, applyPreset } = useBrand()\n const activeSiteName = useTenantStore((state) => state.activeSiteName)\n const activeSiteId = useTenantStore((state) => state.activeSiteId)\n const [isSidebarOpen, setSidebarOpen] = useState(true)\n const [isMobile, setIsMobile] = useState(false)\n const [, setCommandPaletteOpen] = useState(false)\n const [showThemePicker, setShowThemePicker] = useState(false)\n\n // ── Preset-driven active styles ───────────────────────────────────────\n const activeLink = (isActive: boolean): React.CSSProperties =>\n isActive\n ? {\n background: preset.activeBg,\n borderColor: preset.activeBorder,\n color: preset.activeText,\n boxShadow: preset.activeGlow,\n }\n : {}\n const activeDot = (isActive: boolean): React.CSSProperties =>\n isActive ? { background: preset.activeText } : {}\n\n const navBase = (dark: boolean, open: boolean) =>\n cn(\n 'relative flex items-center w-full px-4 py-2.5 transition-all outline-none rounded-none-none',\n open ? 'justify-start gap-3' : 'justify-center',\n 'text-z-sidebar-text hover:text-z-sidebar-text-hover hover:bg-[var(--z-bg-hover)] group'\n )\n const dotBase = 'w-2 h-2 transition-all flex-shrink-0'\n\n const envMode = import.meta.env.MODE || 'development'\n let envConfig = {\n bg: 'bg-z-hover',\n border: 'border-z-border/10',\n dot: 'bg-z-border',\n shadow: 'shadow-[0_0_8px_#6b7280]',\n text: 'text-z-sidebar-text ',\n }\n if (envMode === 'development') {\n envConfig = {\n bg: 'bg-z-accent/5',\n border: 'border-z-accent/10',\n dot: 'bg-z-accent',\n shadow: '',\n text: 'text-z-accent dark:text-z-active-text',\n }\n } else if (envMode === 'production') {\n envConfig = {\n bg: 'bg-purple-500/5',\n border: 'border-purple-500/10',\n dot: 'bg-purple-500',\n shadow: 'shadow-sm',\n text: 'text-purple-600 dark:text-purple-500',\n }\n } else if (envMode === 'test') {\n envConfig = {\n bg: 'bg-amber-500/5',\n border: 'border-amber-500/10',\n dot: 'bg-amber-500',\n shadow: 'shadow-sm',\n text: 'text-amber-600 dark:text-amber-500',\n }\n }\n\n // React Query Hook for metadata\n const { data: health } = useSystemMetadata()\n const collections = (health?.collections || []).filter((c: any) => {\n if ((user as any)?.role === 'admin') return true\n if (!(user as any)?.specialAccess || (user as any).specialAccess.length === 0) return true\n return (user as any).specialAccess.includes(`col:${c.slug}`)\n })\n const globals = (health?.globals || []).filter((g: any) => {\n if ((user as any)?.role === 'admin') return true\n if (!(user as any)?.specialAccess || (user as any).specialAccess.length === 0) return true\n return (user as any).specialAccess.includes(`glb:${g.slug}`)\n })\n\n const [isCustomizing, setIsCustomizing] = useState(false)\n const [sidebarConfig, setSidebarConfig] = useState<\n { name: string; path: string; visible: boolean }[]\n >(() => {\n try {\n const saved = localStorage.getItem('zenith_sidebar_config')\n return saved ? JSON.parse(saved) : []\n } catch {\n return []\n }\n })\n const location = useLocation()\n\n const pluginNavItems = pluginRegistry.getSidebarItems().map(item => ({\n name: item.label,\n path: item.path,\n icon: Puzzle, // Fallback icon for plugins\n }))\n\n const defaultNavItems = [\n { name: 'System Overview', path: '/', icon: LayoutDashboard },\n ...pluginNavItems,\n { name: 'Templates', path: '/templates', icon: Layout },\n { name: 'Plugins', path: '/plugins', icon: Puzzle },\n ]\n\n const saveSidebarConfig = useCallback(\n (items: { name: string; path: string; visible: boolean }[]) => {\n setSidebarConfig(items)\n localStorage.setItem('zenith_sidebar_config', JSON.stringify(items))\n },\n []\n )\n\n const toggleItemVisibility = useCallback(\n (name: string) => {\n saveSidebarConfig(\n sidebarConfig.map((item) =>\n item.name === name ? { ...item, visible: !item.visible } : item\n )\n )\n },\n [sidebarConfig, saveSidebarConfig]\n )\n\n const reorderSidebar = useCallback(\n (reordered: { name: string; path: string; visible: boolean }[]) => {\n saveSidebarConfig(reordered)\n },\n [saveSidebarConfig]\n )\n\n // Initialize sidebar config from defaults if not yet saved\n useEffect(() => {\n if (sidebarConfig.length === 0) {\n saveSidebarConfig(defaultNavItems.map(({ name, path }) => ({ name, path, visible: true })))\n }\n }, []) \n\n // Merge saved config with default nav items (preserving order and visibility)\n const navItems =\n sidebarConfig.length > 0\n ? sidebarConfig\n .filter((c) => defaultNavItems.some((d) => d.name === c.name))\n .map((c) => ({ ...c, icon: defaultNavItems.find((d) => d.name === c.name)!.icon }))\n .concat(\n defaultNavItems\n .filter((d) => !sidebarConfig.some((c) => c.name === d.name))\n .map((d) => ({ name: d.name, path: d.path, visible: true, icon: d.icon }))\n )\n : defaultNavItems.map((d) => ({ ...d, visible: true }))\n\n // RESPONSIVE SCREEN ADJUSTMENTS & AUTO-COLLAPSE\n useEffect(() => {\n const handleResize = () => {\n const mobile = window.innerWidth < 768\n setIsMobile(mobile)\n if (window.innerWidth < 1024) {\n setSidebarOpen(false)\n } else {\n setSidebarOpen(true)\n }\n }\n handleResize()\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n useEffect(() => {\n // TENANT THEME INJECTION\n const updateTheme = () => {\n let link = document.getElementById('theme-stylesheet') as HTMLLinkElement\n if (!link) {\n link = document.createElement('link')\n link.id = 'theme-stylesheet'\n link.rel = 'stylesheet'\n document.head.appendChild(link)\n }\n const timestamp = new Date().getTime()\n const baseUrl = import.meta.env.VITE_API_URL || '/api/v1'\n link.href = `${baseUrl}/system/settings/theme${activeSiteId ? `?siteId=${activeSiteId}&t=${timestamp}` : `?t=${timestamp}`}`\n }\n\n updateTheme()\n\n // KEYBOARD INTERRUPTS\n const handleKeyDown = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 'k') {\n e.preventDefault()\n setCommandPaletteOpen((prev) => !prev)\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown)\n }\n }, [activeSiteId])\n\n const isTopNav = preset.layoutVariant === 'topnav' && !isMobile // Fallback to sidebar on mobile\n\n if (isTopNav) {\n return (\n <div\n className=\"flex flex-col h-full w-full font-sans\"\n style={{ background: 'var(--z-bg-base)', color: 'var(--z-text-primary)' }}\n >\n <header\n className=\"h-16 flex items-center justify-between px-6 border-b z-50 shrink-0\"\n style={{\n background: preset.sidebarBg,\n borderColor: 'var(--z-border)',\n backdropFilter: 'blur(12px)',\n WebkitBackdropFilter: 'blur(12px)',\n }}\n >\n {/* Logo & Brand */}\n <div className=\"flex items-center gap-4 border-r border-z-border pr-4 h-full\">\n <div\n className=\"w-8 h-8 flex items-center justify-center font-semibold text-xs\"\n style={{\n background: preset.logoIconBg,\n color: preset.logoIconText,\n borderRadius:\n preset.borderRadius === 'sm'\n ? '2px'\n : preset.borderRadius === 'md'\n ? '4px'\n : preset.borderRadius === 'lg'\n ? '6px'\n : '0px',\n }}\n >\n {brand.logoUrl ? (\n <img\n src={brand.logoUrl}\n alt={brand.appName}\n className=\"w-full h-full object-contain\"\n />\n ) : (\n <Logo size=\"sm\" />\n )}\n </div>\n <div className=\"flex flex-col\">\n <span className=\"text-sm font-semibold leading-none\">\n {brand.appName || 'Zenith'}\n </span>\n <span className=\"text-sm font-semibold text-z-sidebar-text leading-none mt-1\">\n {brand.appTagline || 'v1.0'}\n </span>\n </div>\n </div>\n\n {/* Site Selector (Inline) */}\n <div className=\"mx-4 flex-shrink-0\">\n <div className=\"text-sm font-semibold text-z-sidebar-text mb-1\">Active Scope</div>\n <div className=\"text-sm font-semibold text-z-primary\">\n {activeSiteName || 'System Root'}\n </div>\n </div>\n\n {/* Horizontal Navigation */}\n <nav className=\"flex-1 overflow-x-auto hidden md:flex items-center gap-1 px-4 h-full\">\n {navItems\n .filter((n) => n.visible)\n .map((item) => {\n const isActive = location.pathname === item.path\n const Icon = item.icon\n return (\n <Link\n key={item.name}\n to={item.path}\n className={cn(\n 'flex items-center gap-2 px-3 py-2 border transition-all whitespace-nowrap border-transparent hover:bg-z-hover text-z-sidebar-text hover:text-z-primary'\n )}\n style={{\n ...activeLink(isActive),\n borderRadius:\n preset.borderRadius === 'sm'\n ? '2px'\n : preset.borderRadius === 'md'\n ? '4px'\n : preset.borderRadius === 'lg'\n ? '6px'\n : '0px',\n }}\n >\n <Icon size={14} />\n <span className=\"text-sm font-semibold\">{item.name}</span>\n </Link>\n )\n })}\n </nav>\n\n {/* Right Utilities */}\n <div className=\"flex items-center gap-4 pl-4 border-l border-z-border h-full\">\n <GlobalSearch />\n <div\n className={cn(\n 'hidden lg:flex items-center gap-2 px-2 py-1 border',\n envConfig.bg,\n envConfig.border\n )}\n >\n <div className={cn('w-1.5 h-1.5 animate-pulse', envConfig.dot, envConfig.shadow)} />\n <span className={cn('text-sm font-semibold ', envConfig.text)}>{envMode}</span>\n </div>\n <Link\n to=\"/settings\"\n className=\"p-1.5 hover:bg-z-hover text-z-sidebar-text hover:text-z-primary transition-all\"\n >\n <Settings size={14} />\n </Link>\n <button\n onClick={toggleTheme}\n className=\"p-1.5 hover:bg-z-hover text-z-sidebar-text hover:text-z-primary transition-all\"\n >\n {theme === 'dark' ? <Sun size={14} /> : <Moon size={14} />}\n </button>\n <button\n onClick={logout}\n className=\"p-1.5 hover:bg-red-500/20 text-red-500 hover:text-red-600 transition-all ml-2 border border-red-500/20\"\n >\n <LogOut size={14} />\n </button>\n </div>\n </header>\n\n {/* Main Content */}\n <main\n className=\"flex-1 flex flex-col min-w-0 relative h-full overflow-auto\"\n style={{ background: 'var(--z-bg-base)' }}\n >\n {children || <Outlet />}\n </main>\n </div>\n )\n }\n\n return (\n <div\n className=\"flex h-full w-full font-sans\"\n style={{ background: 'var(--z-bg-base)', color: 'var(--z-text-primary)' }}\n >\n {/* Mobile Sidebar Overlay */}\n <AnimatePresence>\n {isMobile && isSidebarOpen && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n onClick={() => setSidebarOpen(false)}\n className=\"fixed inset-0 z-40 bg-[var(--z-bg-modal)] backdrop-blur-sm\"\n />\n )}\n </AnimatePresence>\n\n {/* ️ Compact Sidebar */}\n <motion.aside\n initial={false}\n animate={{\n width: isMobile ? 260 : isSidebarOpen ? 260 : 70,\n x: isMobile ? (isSidebarOpen ? 0 : -260) : 0,\n }}\n transition={{ duration: 0.25, ease: [0.4, 0, 0.2, 1] }}\n className={cn(\n 'h-full flex-shrink-0 flex flex-col z-50',\n isMobile ? 'fixed inset-y-0 left-0 shadow-2xl' : 'relative'\n )}\n style={{\n background: 'var(--z-bg-sidebar)',\n borderRight: '1px solid var(--z-border)',\n backdropFilter: 'blur(12px)',\n WebkitBackdropFilter: 'blur(12px)',\n }}\n >\n {/* Workspace */}\n <div\n className={cn(\n 'h-20 flex items-center border-b border-z-border',\n isSidebarOpen ? 'justify-between px-6' : 'justify-center px-0'\n )}\n >\n <div\n className={cn('flex items-center gap-3 min-w-0', !isSidebarOpen && 'justify-center')}\n >\n <div\n className={cn(\n 'w-9 h-9 flex items-center justify-center flex-shrink-0 transition-all relative overflow-hidden font-semibold text-sm'\n )}\n style={{ background: preset.logoIconBg, color: preset.logoIconText }}\n >\n {brand.logoUrl ? (\n <img\n src={brand.logoUrl}\n alt={brand.appName}\n className=\"w-full h-full object-contain\"\n />\n ) : (\n <Logo size=\"sm\" />\n )}\n {/* SYSTEM PULSE */}\n <motion.div\n animate={{ opacity: [0.1, 0.4, 0.1], scale: [1, 1.2, 1] }}\n transition={{ duration: 2, repeat: Infinity }}\n className=\"absolute inset-0 bg-z-hover border-z-border-strong\"\n />\n </div>\n <AnimatePresence>\n {isSidebarOpen && (\n <motion.div\n initial={{ opacity: 0, x: -5 }}\n animate={{ opacity: 1, x: 0 }}\n className=\"flex flex-col min-w-0\"\n >\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg font-semibold leading-none\">\n {brand.appName || 'Zenith'}\n </span>\n <div className=\"w-1 h-1 bg-z-border animate-pulse\" />\n </div>\n <span className=\"text-sm font-semibold text-z-sidebar-text leading-none mt-1.5\">\n {brand.appTagline || 'v1.0 Beta'}\n </span>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n </div>\n\n {/* Active Site Workspace Indicator / Switcher */}\n <SiteSelector isSidebarOpen={isSidebarOpen} />\n\n {/* Navigation Core */}\n <div className=\"flex-1 overflow-y-auto py-8 px-4 space-y-10\">\n <nav className=\"space-y-1.5\">\n {(() => {\n const visibleItems = isCustomizing ? navItems : navItems.filter((n) => n.visible)\n return (\n <div>\n <div\n className={cn(\n 'mb-4 flex items-center',\n isSidebarOpen ? 'px-3 justify-between' : 'justify-center'\n )}\n >\n {isSidebarOpen && (\n <span className=\"text-sm font-semibold text-z-sidebar-text leading-none\">\n Navigation\n </span>\n )}\n <div className=\"flex items-center gap-1\">\n <button\n onClick={() => setIsCustomizing(!isCustomizing)}\n className={cn(\n 'p-1 border rounded-none-none transition-all',\n isCustomizing\n ? 'bg-z-hover border-z-border-strong border-z-border/40 text-z-sidebar-text'\n : 'border-transparent text-z-sidebar-text hover:text-z-sidebar-text'\n )}\n title={isCustomizing ? 'Done' : 'Customize'}\n >\n <Settings size={10} />\n </button>\n <Command size={10} className=\"text-z-sidebar-text\" />\n </div>\n </div>\n\n {isCustomizing ? (\n <Reorder.Group\n axis=\"y\"\n values={visibleItems}\n onReorder={reorderSidebar}\n className=\"space-y-0.5\"\n >\n {visibleItems.map((item) => {\n const Icon = item.icon\n return (\n <Reorder.Item\n key={item.name}\n value={item}\n as=\"div\"\n className={cn(\n 'flex items-center gap-4 px-4 py-3 rounded-none-none border group cursor-grab active:cursor-grabbing border-z-border shadow-sm text-z-sidebar-text hover:bg-z-hover hover:text-z-primary'\n )}\n >\n <GripVertical size={12} className=\"text-z-sidebar-text shrink-0\" />\n <Icon size={16} strokeWidth={1.5} className=\"shrink-0\" />\n {isSidebarOpen && (\n <span className=\"flex-1 text-sm font-semibold tracking-wide leading-none truncate\">\n {item.name}\n </span>\n )}\n <button\n onClick={(e) => {\n e.stopPropagation()\n toggleItemVisibility(item.name)\n }}\n className=\"p-1 hover:text-z-primary transition-colors shrink-0\"\n title={item.visible ? 'Hide' : 'Show'}\n >\n {item.visible ? (\n <Eye size={10} />\n ) : (\n <EyeOff size={10} className=\"text-z-sidebar-text\" />\n )}\n </button>\n </Reorder.Item>\n )\n })}\n </Reorder.Group>\n ) : (\n <div className=\"space-y-0.5\">\n {visibleItems.map((item) => {\n const isActive = location.pathname === item.path\n const Icon = item.icon\n return (\n <Link\n key={item.name}\n to={item.path}\n style={activeLink(isActive)}\n className={cn(navBase(theme === 'dark', isSidebarOpen))}\n >\n <Icon\n size={16}\n strokeWidth={isActive ? 3 : 1.5}\n className={cn(\n 'transition-transform relative z-10',\n isActive ? 'scale-110' : 'group-hover:scale-110'\n )}\n />\n {isSidebarOpen && (\n <span className=\"text-sm font-semibold tracking-wide relative z-10 leading-none truncate\">\n {item.name}\n </span>\n )}\n {isActive && !isSidebarOpen && (\n <motion.div\n layoutId=\"nav-glow-mini\"\n style={{ background: preset.activeText }}\n className=\"absolute left-0 w-1 h-4\"\n />\n )}\n </Link>\n )\n })}\n </div>\n )}\n </div>\n )\n })()}\n </nav>\n\n <nav className=\"space-y-1.5 pt-4 border-t border-z-border\">\n <div className=\"px-3 mb-2 flex items-center justify-end\">\n <ShieldCheck size={10} className=\"text-z-sidebar-text opacity-50\" />\n </div>\n\n <div className=\"space-y-0.5\">\n {globals.map((global) => {\n const isActive = location.pathname.startsWith(`/globals/${global.slug}`)\n return (\n <Link\n key={global.slug}\n to={`/globals/${global.slug}`}\n style={activeLink(isActive)}\n className={cn(\n navBase(theme === 'dark', isSidebarOpen),\n theme === 'dark' ? 'border-z-border' : 'border-z-border shadow-sm'\n )}\n >\n <div\n className={cn(dotBase, 'shadow-[0_0_6px_currentColor]')}\n style={isActive ? activeDot(true) : {}}\n />\n {isSidebarOpen && (\n <span className=\"text-sm font-semibold truncate\">\n {global.name.replace(/-/g, ' ').replace(/_/g, ' ')}\n </span>\n )}\n </Link>\n )\n })}\n </div>\n </nav>\n\n <nav className=\"space-y-1.5\">\n <div\n className={cn(\n 'mb-2 flex items-center',\n isSidebarOpen ? 'px-4 justify-start gap-2' : 'justify-center'\n )}\n >\n <Database size={14} className=\"text-z-sidebar-text opacity-50\" />\n {isSidebarOpen && (\n <span className=\"text-xs font-semibold text-z-sidebar-text leading-none\">\n Content Collections\n </span>\n )}\n </div>\n\n <div className=\"space-y-0.5\">\n {collections.map((col) => {\n const isActive = location.pathname.startsWith(`/collections/${col.slug}`)\n return (\n <Link\n key={col.slug}\n to={`/collections/${col.slug}`}\n style={activeLink(isActive)}\n className={cn(\n navBase(theme === 'dark', isSidebarOpen),\n theme === 'dark' ? 'border-z-border' : 'border-z-border shadow-sm',\n 'overflow-hidden'\n )}\n >\n <div\n className={cn(\n dotBase,\n isActive\n ? 'scale-110 shadow-[0_0_6px_currentColor]'\n : 'bg-z-base/40 group-hover:bg-z-border'\n )}\n style={activeDot(isActive)}\n />\n {isSidebarOpen && (\n <span className=\"text-sm font-semibold truncate\">\n {col.slug?.replace(/-/g, ' ').replace(/_/g, ' ')}\n </span>\n )}\n </Link>\n )\n })}\n </div>\n </nav>\n\n {/* ️ System Administration Category */}\n <nav className=\"space-y-1.5 pt-4 border-t border-z-border\">\n <div className=\"px-4 mb-2 flex items-center justify-start gap-2\">\n <Settings size={14} className=\"text-z-sidebar-text opacity-50\" />\n <span className=\"text-xs font-semibold text-z-sidebar-text leading-none\">\n System Administration\n </span>\n </div>\n\n <div className=\"space-y-0.5\">\n {[\n { to: '/audit-log', label: 'Audit Logs' },\n { to: '/schema-builder', label: 'Schema Builder' },\n { to: '/block-builder', label: 'Block Builder' },\n { to: '/component-builder', label: 'Component Builder' },\n { to: '/redirects', label: 'Redirects' },\n { to: '/trash', label: 'Trash' },\n ].map(({ to, label }) => {\n const isActive = location.pathname === to\n return (\n <Link\n key={to}\n to={to}\n style={activeLink(isActive)}\n className={cn(\n navBase(theme === 'dark', isSidebarOpen),\n theme === 'dark' ? 'border-z-border' : 'border-z-border shadow-sm',\n 'overflow-hidden'\n )}\n >\n <div\n className={cn(\n dotBase,\n isActive\n ? 'scale-110 shadow-[0_0_6px_currentColor]'\n : 'bg-z-base/40 group-hover:bg-z-border'\n )}\n style={activeDot(isActive)}\n />\n {isSidebarOpen && (\n <span className=\"text-sm font-semibold truncate\">{label}</span>\n )}\n </Link>\n )\n })}\n </div>\n </nav>\n </div>\n\n {/* Footer */}\n <div className=\"p-4 border-t border-z-border bg-z-hover\">\n <button\n onClick={logout}\n className={cn(\n 'w-full flex items-center gap-4 py-3.5 transition-all group border border-transparent hover:border-red-500/20 shadow-sm',\n isSidebarOpen ? 'justify-start px-4' : 'justify-center',\n theme === 'dark'\n ? 'bg-red-500/5 text-red-400 hover:bg-red-500/10'\n : 'bg-red-50 text-red-600 hover:bg-red-100'\n )}\n >\n <LogOut size={16} className=\"group-hover:-translate-x-1 transition-transform\" />\n {isSidebarOpen && <span className=\"text-sm font-semibold\">Logout</span>}\n </button>\n </div>\n </motion.aside>\n\n {/* Dynamic Main Node */}\n <main\n role=\"main\"\n className=\"flex-1 flex flex-col min-w-0 relative h-full overflow-hidden\"\n style={{ background: 'var(--z-bg-base)' }}\n >\n <div className=\"flex-1 flex flex-col overflow-hidden\">\n {!isOnline && (\n <div className=\"bg-red-500 text-white text-sm font-semibold px-4 py-2 flex items-center justify-center gap-2 relative z-50 shadow-md\">\n <WifiOff size={16} />\n You are currently offline. Some features may be unavailable.\n </div>\n )}\n <header\n role=\"banner\"\n className=\"h-20 flex items-center justify-between px-4 md:px-8 z-40 shrink-0\"\n style={{\n background: 'var(--z-bg-header)',\n borderBottom: '1px solid var(--z-border)',\n backdropFilter: 'blur(20px)',\n WebkitBackdropFilter: 'blur(20px)',\n }}\n >\n <div className=\"flex items-center gap-4\">\n <button\n onClick={() => setSidebarOpen(!isSidebarOpen)}\n title={isSidebarOpen ? 'Collapse Sidebar' : 'Expand Sidebar'}\n aria-expanded={isSidebarOpen}\n aria-label=\"Toggle Sidebar\"\n className=\"p-2 transition-all\"\n style={{\n background: 'var(--z-bg-hover)',\n border: '1px solid var(--z-border)',\n color: 'var(--z-text-secondary)',\n }}\n >\n {isSidebarOpen ? <X size={18} /> : <Menu size={18} />}\n </button>\n <GlobalSearch />\n </div>\n\n <div className=\"flex items-center gap-5\">\n <Link\n to=\"/settings\"\n title=\"System Settings\"\n className=\"p-2 transition-all\"\n style={{\n background: 'var(--z-bg-hover)',\n border: '1px solid var(--z-border)',\n color: 'var(--z-text-secondary)',\n }}\n >\n <Settings size={16} />\n </Link>\n\n <button\n onClick={toggleTheme}\n title=\"Light/Dark\"\n className=\"p-2 transition-all\"\n style={{\n background: 'var(--z-bg-hover)',\n border: '1px solid var(--z-border)',\n color: theme === 'dark' ? '#fbbf24' : 'var(--z-text-secondary)',\n }}\n >\n {theme === 'dark' ? <Sun size={16} /> : <Moon size={16} />}\n </button>\n </div>\n </header>\n\n {/* Scrollable Content Area */}\n <div className=\"flex-1 overflow-y-auto relative p-0 m-0\">{children || <Outlet />}</div>\n </div>\n </main>\n </div>\n )\n}\n\nexport default DashboardLayout\n","import { z } from 'zod'\n\n// ── Auth Schemas ──────────────────────────────────────────────────────────────\n\nexport const loginSchema = z.object({\n email: z.string().email('Invalid email address'),\n password: z.string().min(8, 'Password must be at least 8 characters'),\n})\n\nexport type LoginFormValues = z.infer<typeof loginSchema>\n\nexport const forgotPasswordSchema = z.object({\n email: z.string().email('Invalid email address'),\n})\n\nexport type ForgotPasswordFormValues = z.infer<typeof forgotPasswordSchema>\n\nexport const resetPasswordSchema = z\n .object({\n password: z.string().min(8, 'Password must be at least 8 characters'),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: 'Passwords do not match',\n path: ['confirmPassword'],\n })\n\nexport type ResetPasswordFormValues = z.infer<typeof resetPasswordSchema>\n\nexport const changePasswordSchema = z\n .object({\n currentPassword: z.string().min(1, 'Current password is required'),\n newPassword: z.string().min(8, 'Password must be at least 8 characters'),\n confirmPassword: z.string(),\n })\n .refine((data) => data.newPassword === data.confirmPassword, {\n message: 'Passwords do not match',\n path: ['confirmPassword'],\n })\n\nexport type ChangePasswordFormValues = z.infer<typeof changePasswordSchema>\n\nexport const inviteUserSchema = z.object({\n email: z.string().email('Invalid email address'),\n role: z.enum(['admin', 'editor', 'viewer']),\n})\n\nexport type InviteUserFormValues = z.infer<typeof inviteUserSchema>\n\n// ── Settings Schemas ──────────────────────────────────────────────────────────\n\nexport const siteSchema = z.object({\n name: z.string().min(1, 'Site name is required'),\n slug: z.string().min(1, 'Slug is required').regex(/^[a-z0-9-]+$/, 'Slug must be lowercase alphanumeric with hyphens'),\n description: z.string().optional(),\n})\n\nexport type SiteFormValues = z.infer<typeof siteSchema>\n\nexport const webhookSchema = z.object({\n url: z.string().url('Must be a valid URL'),\n events: z.array(z.string()).min(1, 'Select at least one event'),\n enabled: z.boolean().default(true),\n})\n\nexport type WebhookFormValues = z.infer<typeof webhookSchema>\n\n// ── Field Schemas ─────────────────────────────────────────────────────────────\n\nexport const fieldOptionSchema = z.object({\n label: z.string().min(1, 'Label is required'),\n value: z.string().min(1, 'Value is required'),\n})\n\nexport type FieldOption = z.infer<typeof fieldOptionSchema>\n\n// ── Reusable Validators ───────────────────────────────────────────────────────\n\nexport const emailValidator = z.string().email('Invalid email address')\nexport const slugValidator = z.string().regex(/^[a-z0-9-]+$/, 'Slug must be lowercase alphanumeric with hyphens')\nexport const urlValidator = z.string().url('Must be a valid URL')\nexport const hexColorValidator = z.string().regex(/^#[0-9a-fA-F]{6}$/, 'Must be a valid hex color (e.g. #FF5733)')\n\n/** Validate a password strength score (returns errors array, empty = strong) */\nexport function validatePasswordStrength(password: string): string[] {\n const errors: string[] = []\n if (password.length < 8) errors.push('At least 8 characters')\n if (!/[A-Z]/.test(password)) errors.push('At least one letter')\n if (!/[a-z]/.test(password)) errors.push('At least one lowercase letter')\n if (!/[0-9]/.test(password)) errors.push('At least one number')\n if (!/[^A-Za-z0-9]/.test(password)) errors.push('At least one special character')\n return errors\n}\n\n/** Check if a value looks like a valid MongoDB ObjectId */\nexport function isValidObjectId(id: string): boolean {\n return /^[0-9a-fA-F]{24}$/.test(id)\n}\n\n/** Check if a value looks like a valid UUID */\nexport function isValidUUID(id: string): boolean {\n return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id)\n}\n","import React, { useState } from 'react'\nimport { useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useNavigate, Link } from 'react-router-dom'\nimport { useAuthStore } from '../store/authStore'\nimport {\n Lock,\n Mail,\n Loader2,\n AlertCircle,\n Sun,\n Moon,\n ArrowRight,\n Info,\n Eye,\n EyeOff,\n MousePointer2,\n WifiOff,\n ShieldCheck,\n} from 'lucide-react'\nimport { useTheme } from '../context/ThemeContext'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport Logo from '../components/Logo'\nimport { cn } from '../lib/utils'\nimport { loginSchema, type LoginFormValues } from '../lib/validators'\nimport api from '../lib/api'\nimport { useShallow } from 'zustand/react/shallow'\n\nconst LoginPage: React.FC = () => {\n const navigate = useNavigate()\n const { login, setUser } = useAuthStore(useShallow(state => ({ login: state.login, setUser: state.setUser })))\n const { theme, toggleTheme } = useTheme()\n const [error, setError] = useState<{\n message: string\n type: 'auth' | 'network'\n data?: { attemptsLeft?: number; locked?: boolean; remainingMin?: number; maxAttempts?: number }\n } | null>(null)\n const [isSubmitting, setIsSubmitting] = useState(false)\n const [showPassword, setShowPassword] = useState(false)\n const [needsSetup, setNeedsSetup] = useState(false)\n const [tempToken, setTempToken] = useState<string | null>(null)\n const [twoFactorToken, setTwoFactorToken] = useState('')\n\n React.useEffect(() => {\n // Check if the system requires initial administrator provisioning\n api\n .get('/auth/setup-status')\n .then((res) => {\n if (res.data?.data?.needsSetup) {\n setNeedsSetup(true)\n }\n })\n .catch(() => {})\n }, [])\n\n const {\n register,\n handleSubmit,\n setValue,\n formState: { errors },\n } = useForm<LoginFormValues>({\n resolver: zodResolver(loginSchema),\n })\n\n const onSubmit = async (data: LoginFormValues) => {\n setIsSubmitting(true)\n setError(null)\n try {\n if (needsSetup) {\n // Provision the initial administrator account\n const res = await api.post('/auth/setup', {\n email: data.email,\n password: data.password,\n })\n const { user } = res.data.data\n setUser(user)\n navigate('/setup')\n } else if (tempToken) {\n if (!twoFactorToken) {\n setError({ message: '2FA token required', type: 'auth' })\n setIsSubmitting(false)\n return\n }\n const res = await api.post('/auth/2fa/verify-login', { tempToken, token: twoFactorToken })\n const { user } = res.data.data\n setUser(user)\n navigate('/')\n } else {\n try {\n await login(data.email, data.password)\n navigate('/')\n } catch (err: any) {\n if (err.response?.data?.data?.require2FA) {\n setTempToken(err.response.data.data.tempToken)\n setError(null)\n } else {\n throw err\n }\n }\n }\n } catch (err: any) {\n if ((err as { code?: string }).code === 'ERR_NETWORK' || !err.response) {\n setError({ message: 'Kernel Offline: Connection Refused', type: 'network' })\n } else {\n const errData = err.response?.data?.data as { attemptsLeft?: number; locked?: boolean; remainingMin?: number; maxAttempts?: number } | undefined\n setError({\n message:\n err.response?.data?.message || 'Access Denied: Invalid Username or Password',\n type: 'auth',\n data: errData,\n })\n }\n } finally {\n setIsSubmitting(false)\n }\n }\n\n return (\n <div className=\"flex-1 w-full min-h-0 flex flex-col p-4 md:p-6 relative overflow-y-auto overflow-x-hidden font-sans antialiased bg-app text-z-primary\">\n {/* Background elements */}\n <div className=\"fixed top-[-10%] left-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500 z-0 bg-z-hover\" />\n <div className=\"fixed bottom-[-10%] right-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500 z-0 bg-z-hover\" />\n\n <div className=\"w-full max-w-[400px] relative z-10 flex flex-col gap-6 md:gap-8 py-4 my-auto mx-auto\">\n {/* Branding Module */}\n <motion.div\n initial={{ opacity: 0, y: 20 }}\n animate={{ opacity: 1, y: 0 }}\n className=\"flex flex-col items-center text-center\"\n >\n <div className=\"w-14 h-14 mb-6 rounded-none-none flex items-center justify-center shadow-2xl relative group cursor-pointer overflow-hidden transition-all duration-500 hover:scale-105 bg-z-panel text-z-primary\">\n <Logo size=\"sm\" className=\"scale-75\" />\n </div>\n <h1 className=\"text-4xl font-semibold leading-none transition-colors text-z-primary\">\n ZENITH\n </h1>\n <p className=\"mt-3 text-sm font-semibold text-z-muted\">\n Admin_Management_Interface\n </p>\n </motion.div>\n\n {/* Login Container */}\n <motion.div\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n className=\"p-8 relative transition-all duration-500 rounded-none-none border bg-z-panel backdrop-blur-[12px] border-z-border shadow-sm\"\n >\n <div className=\"flex items-center justify-between mb-8\">\n <div className=\"flex flex-col\">\n <h2 className=\"text-xl font-semibold transition-colors text-z-primary\">\n {needsSetup ? 'Setup Admin' : tempToken ? 'Two-Factor Auth' : 'Sign In'}\n </h2>\n <p className=\"text-sm text-z-muted font-bold leading-none mt-1\">\n {needsSetup ? 'Initialize Workstation' : tempToken ? 'Verify Identity' : 'Access Controlled'}\n </p>\n </div>\n </div>\n\n <form onSubmit={handleSubmit(onSubmit)} className=\"space-y-6\">\n <AnimatePresence mode=\"wait\">\n {error && (\n <motion.div\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n className=\"border rounded-none-none p-4 mb-6 overflow-hidden transition-colors bg-red-500/10 border-red-500/20 text-red-400\"\n >\n <div className=\"flex items-center gap-3\">\n {error.type === 'network' ? (\n <WifiOff size={14} className=\"shrink-0\" />\n ) : error.data?.locked ? (\n <Lock size={14} className=\"shrink-0\" />\n ) : (\n <AlertCircle size={14} className=\"shrink-0\" />\n )}\n <span className=\"text-sm font-bold tracking-wide\">\n {error.message}\n </span>\n </div>\n {error.data?.locked && error.data.remainingMin && (\n <div className=\"mt-3 space-y-1.5\">\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-1 h-1.5 bg-z-panel/10 rounded-none-none overflow-hidden\">\n <motion.div\n initial={{ width: '100%' }}\n animate={{ width: `${Math.max(5, (error.data.remainingMin / 15) * 100)}%` }}\n transition={{ duration: 1 }}\n className=\"h-full bg-current rounded-none-none\"\n />\n </div>\n <span className=\"text-sm font-semibold tabular-nums\">\n {error.data.remainingMin}m\n </span>\n </div>\n <p className=\"text-sm font-bold opacity-70\">\n Cooldown remaining\n </p>\n </div>\n )}\n {error.type === 'auth' && !error.data?.locked && error.data?.attemptsLeft !== undefined && (\n <div className=\"mt-2 flex items-center gap-2\">\n <div className=\"flex gap-1\">\n {Array.from({ length: error.data.maxAttempts || 5 }).map((_, i) => (\n <div\n key={i}\n className={cn(\n 'w-2 h-2 rounded-none-none transition-colors',\n i < (error.data?.attemptsLeft || 0)\n ? 'bg-current/30'\n : 'bg-current'\n )}\n />\n ))}\n </div>\n <span className=\"text-sm font-bold opacity-70\">\n {error.data.attemptsLeft} of {error.data.maxAttempts || 5} remaining\n </span>\n </div>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n\n {needsSetup && (\n <div className=\"p-3 border border-z-border/20 bg-z-border/[0.03] text-[9.5px] leading-relaxed text-z-muted font-bold\">\n No administrative users detected. Create your root administrator account below to provision this Zenith workstation.\n </div>\n )}\n\n {tempToken ? (\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-semibold text-z-muted px-1\">\n 6-Digit Authenticator Code\n </label>\n <div className=\"relative group\">\n <ShieldCheck\n className=\"absolute left-4 top-1/2 -translate-y-1/2 transition-colors text-z-primary/20\"\n size={16}\n />\n <input\n type=\"text\"\n placeholder=\"000000\"\n maxLength={6}\n value={twoFactorToken}\n onChange={(e) => setTwoFactorToken(e.target.value.replace(/\\D/g, ''))}\n className=\"w-full border rounded-none-none py-3 pl-12 pr-4 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all text-center bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border\"\n />\n </div>\n </div>\n ) : (\n <div className=\"space-y-4\">\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-semibold text-z-muted px-1\">\n Email Address\n </label>\n <div className=\"relative group\">\n <Mail\n className=\"absolute left-4 top-1/2 -translate-y-1/2 transition-colors text-z-primary/20 group-focus-within:text-z-secondary dark:text-z-muted\"\n size={16}\n />\n <input\n {...register('email')}\n autoComplete=\"email\"\n type=\"email\"\n placeholder=\"admin@zenith.com\"\n className=\"w-full border rounded-none-none py-3 pl-12 pr-4 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border\"\n />\n </div>\n {errors.email && (\n <p className=\"text-sm text-red-500 font-bold mt-1 px-1\">\n {errors.email.message}\n </p>\n )}\n </div>\n\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between px-1\">\n <label className=\"text-sm font-semibold text-z-muted\">\n Account Password\n </label>\n {!needsSetup && (\n <Link\n to=\"/forgot-password\"\n className=\"text-sm font-semibold hover:underline text-z-muted hover:text-z-primary\"\n >\n Forgot Password?\n </Link>\n )}\n </div>\n <div className=\"relative group\">\n <Lock\n className=\"absolute left-4 top-1/2 -translate-y-1/2 transition-colors text-z-primary/20 group-focus-within:text-z-secondary dark:text-z-muted\"\n size={16}\n />\n <input\n {...register('password')}\n autoComplete=\"current-password\"\n type={showPassword ? 'text' : 'password'}\n placeholder=\"••••••••\"\n className=\"w-full border rounded-none-none py-3 pl-12 pr-12 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border\"\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-4 top-1/2 -translate-y-1/2 p-1 rounded-none-none transition-colors text-z-primary/20 hover:text-z-primary\"\n >\n {showPassword ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n </div>\n {errors.password && (\n <p className=\"text-sm text-red-500 font-bold mt-1 px-1\">\n {errors.password.message}\n </p>\n )}\n </div>\n </div>\n )}\n\n <div className=\"flex flex-col gap-1.5 mt-8\">\n <button\n type=\"submit\"\n disabled={isSubmitting || (tempToken !== null && twoFactorToken.length !== 6)}\n className=\"w-full bg-z-panel text-z-primary hover:bg-[var(--z-border)] disabled:bg-z-panel/20 disabled:text-z-primary/40 px-6 py-4 text-sm font-semibold flex items-center justify-center gap-2 transition-all duration-300 shadow-sm rounded-none-none font-mono\"\n >\n {isSubmitting ? (\n <Loader2 size={18} className=\"animate-spin\" />\n ) : (\n <>\n <span>{needsSetup ? 'Provision Root Admin' : 'Sign In to Station'}</span>\n <ArrowRight\n size={16}\n className=\"group-hover:translate-x-1 transition-transform\"\n />\n </>\n )}\n </button>\n </div>\n </form>\n\n {/* SSO/OAuth Provider Module */}\n {!needsSetup && (\n <div className=\"mt-6 pt-6 border-t border-z-border space-y-4\">\n <div className=\"text-center relative\">\n <span className={cn(\n 'text-sm font-semibold px-2 relative z-10',\n theme === 'dark' ? 'bg-app text-z-muted' : 'bg-z-panel text-z-muted'\n )}>\n Or Sign In With Single Sign-On (SSO)\n </span>\n <div className=\"absolute top-1/2 left-0 right-0 h-[1px] bg-z-hover z-0\" />\n </div>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n <button\n type=\"button\"\n onClick={async () => {\n setIsSubmitting(true)\n try {\n // Shim Okta Auth Pipeline\n await login('sso.admin@zenithcms.com', 'password123')\n navigate('/')\n } catch (e) {\n setError({ message: 'SAML Authentication Assertion Failed', type: 'auth' })\n } finally {\n setIsSubmitting(false)\n }\n }}\n className={cn(\n 'border rounded-none-none py-2 px-3 flex items-center justify-center gap-2 text-sm font-semibold transition-all hover:scale-[1.02]',\n theme === 'dark'\n ? 'bg-z-hover border-z-border text-z-primary hover:bg-[var(--z-bg-hover)]'\n : 'bg-z-input border-z-border shadow-sm text-z-primary hover:bg-[var(--z-bg-hover)]'\n )}\n >\n <span>SAML Okta</span>\n </button>\n\n <button\n type=\"button\"\n onClick={async () => {\n setIsSubmitting(true)\n try {\n // Shim Google Workspace OAuth Pipeline\n await login('oauth.developer@zenithcms.com', 'password123')\n navigate('/')\n } catch (e) {\n setError({ message: 'Google OAuth Verification Failed', type: 'auth' })\n } finally {\n setIsSubmitting(false)\n }\n }}\n className={cn(\n 'border rounded-none-none py-2 px-3 flex items-center justify-center gap-2 text-sm font-semibold transition-all hover:scale-[1.02]',\n theme === 'dark'\n ? 'bg-z-hover border-z-border text-z-primary hover:bg-[var(--z-bg-hover)]'\n : 'bg-z-input border-z-border shadow-sm text-z-primary hover:bg-[var(--z-bg-hover)]'\n )}\n >\n <span>Google OAuth</span>\n </button>\n </div>\n </div>\n )}\n </motion.div>\n\n <p className=\"text-center text-sm font-bold text-z-muted\">\n Authorized Personnel Only • Zenith CMS Engine\n </p>\n </div>\n </div>\n )\n}\n\nexport default LoginPage\n","import React, { useState } from 'react'\nimport { useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useNavigate, Link } from 'react-router-dom'\nimport {\n Mail,\n Loader2,\n AlertCircle,\n CheckCircle,\n ArrowRight,\n ArrowLeft,\n Sun,\n Moon,\n} from 'lucide-react'\nimport { useTheme } from '../context/ThemeContext'\nimport { motion } from 'framer-motion'\nimport Logo from '../components/Logo'\nimport { cn } from '../lib/utils'\nimport { forgotPasswordSchema, type ForgotPasswordFormValues } from '../lib/validators'\nimport api from '../lib/api'\n\nconst ForgotPasswordPage: React.FC = () => {\n const navigate = useNavigate()\n const { theme, toggleTheme } = useTheme()\n const [error, setError] = useState<string | null>(null)\n const [success, setSuccess] = useState<string | null>(null)\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n const {\n register,\n handleSubmit,\n formState: { errors },\n } = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n })\n\n const onSubmit = async (data: ForgotPasswordFormValues) => {\n setIsSubmitting(true)\n setError(null)\n setSuccess(null)\n try {\n const response = await api.post('/auth/forgot-password', { email: data.email })\n setSuccess(response.data?.data?.message || 'Verification token dispatched successfully.')\n } catch (err: any) {\n setError(err.response?.data?.error?.message || 'Failed to dispatch recovery token.')\n } finally {\n setIsSubmitting(false)\n }\n }\n\n return (\n <div\n className={cn(\n 'min-h-screen flex items-center justify-center p-6 relative overflow-hidden font-sans antialiased transition-colors duration-500',\n theme === 'dark' ? 'bg-app text-z-primary' : 'bg-[#fafafa] text-[#111827]'\n )}\n >\n {/* ️ Professional Minimalist Background */}\n <div\n className={cn(\n 'absolute top-[-10%] left-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500',\n theme === 'dark' ? 'bg-z-panel/5' : 'bg-z-border/[0.03]'\n )}\n ></div>\n <div\n className={cn(\n 'absolute bottom-[-10%] right-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500',\n theme === 'dark' ? 'bg-z-panel/5' : 'bg-z-border/[0.02]'\n )}\n ></div>\n\n <div className=\"w-full max-w-[400px] relative z-10 flex flex-col gap-8\">\n {/* Branding Module */}\n <motion.div\n initial={{ opacity: 0, y: 20 }}\n animate={{ opacity: 1, y: 0 }}\n className=\"flex flex-col items-center text-center\"\n >\n <div\n className={cn(\n 'w-14 h-14 mb-6 rounded-none-none flex items-center justify-center shadow-2xl relative group cursor-pointer overflow-hidden transition-all duration-500 hover:scale-105',\n 'bg-z-primary text-z-inverse'\n )}\n >\n <Logo size=\"sm\" className=\"scale-75\" />\n </div>\n <h1\n className={cn(\n 'text-4xl font-semibold leading-none transition-colors',\n 'text-z-primary'\n )}\n >\n ZENITH\n </h1>\n <p className=\"mt-3 text-sm font-semibold text-z-muted\">\n Access_Recovery_Interface\n </p>\n </motion.div>\n\n {/* Form Container */}\n <motion.div\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n className={cn(\n 'border rounded-none-none p-8 shadow-2xl relative transition-all duration-500',\n 'bg-z-panel border-z-border shadow-sm'\n )}\n >\n <div className=\"flex items-center justify-between mb-8\">\n <div className=\"flex flex-col\">\n <h2\n className={cn(\n 'text-xl font-semibold transition-colors',\n 'text-z-primary'\n )}\n >\n Recover Password\n </h2>\n <p className=\"text-sm text-z-muted font-bold leading-none mt-1\">\n Credentials Verification\n </p>\n </div>\n\n {/* Theme Toggle */}\n <div\n className={cn(\n 'p-1 rounded-none-none border flex items-center gap-1 transition-all',\n theme === 'dark' ? 'bg-z-hover border-z-border' : 'bg-[var(--z-bg-hover)] border-z-border'\n )}\n >\n <button\n onClick={() => theme !== 'light' && toggleTheme()}\n className={cn(\n 'w-7 h-7 flex items-center justify-center rounded-none-none transition-all',\n theme === 'light'\n ? 'bg-z-panel text-z-primary shadow-sm'\n : 'text-z-muted hover:text-z-primary'\n )}\n >\n <Sun size={14} />\n </button>\n <button\n onClick={() => theme !== 'dark' && toggleTheme()}\n className={cn(\n 'w-7 h-7 flex items-center justify-center rounded-none-none transition-all',\n theme === 'dark'\n ? 'bg-z-accent text-z-primary shadow-sm'\n : 'text-z-muted hover:text-z-primary'\n )}\n >\n <Moon size={14} />\n </button>\n </div>\n </div>\n\n {success ? (\n <div className=\"space-y-6 text-center\">\n <div className=\"flex justify-center\">\n <CheckCircle className=\"text-z-secondary w-12 h-12\" />\n </div>\n <p\n className={cn(\n 'text-xs font-bold tracking-wide px-2 leading-relaxed',\n theme === 'dark' ? 'text-z-secondary' : 'text-z-secondary'\n )}\n >\n {success}\n </p>\n <button\n onClick={() => navigate('/login')}\n className={cn(\n 'w-full rounded-none-none py-4 flex items-center justify-center gap-3 text-xs font-semibold shadow-xl transition-all group',\n theme === 'dark'\n ? 'bg-z-panel text-z-primary hover:bg-[var(--z-bg-hover)] shadow-[var(--z-border)]'\n : 'bg-z-accent text-z-primary hover:bg-app shadow-[var(--z-border)]'\n )}\n >\n <ArrowLeft size={16} />\n <span>Return to Login</span>\n </button>\n </div>\n ) : (\n <form onSubmit={handleSubmit(onSubmit)} className=\"space-y-6\">\n {error && (\n <div\n className={cn(\n 'border rounded-none-none p-4 flex items-center gap-3 mb-6 overflow-hidden transition-colors',\n theme === 'dark'\n ? 'bg-red-500/10 border-red-500/20 text-red-400'\n : 'bg-red-50 border-red-100 text-red-600'\n )}\n >\n <AlertCircle size={14} className=\"shrink-0\" />\n <span className=\"text-sm font-bold tracking-wide\">{error}</span>\n </div>\n )}\n\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-semibold text-z-muted px-1\">\n Email Address\n </label>\n <div className=\"relative group\">\n <Mail\n className={cn(\n 'absolute left-4 top-1/2 -translate-y-1/2 transition-colors',\n theme === 'dark'\n ? 'text-z-primary/20 group-focus-within:text-z-secondary'\n : 'text-z-secondary group-focus-within:text-z-secondary'\n )}\n size={16}\n />\n <input\n {...register('email')}\n type=\"email\"\n placeholder=\"Enter your email\"\n className={cn(\n 'w-full border rounded-none-none py-3 pl-12 pr-4 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all',\n theme === 'dark'\n ? 'bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border'\n : 'bg-z-input border-z-border shadow-sm text-z-primary focus:bg-z-panel focus:ring-2 focus:ring-z-active-border'\n )}\n />\n </div>\n {errors.email && (\n <p className=\"text-sm text-red-500 font-bold mt-1 px-1\">\n {errors.email.message}\n </p>\n )}\n </div>\n\n <button\n type=\"submit\"\n disabled={isSubmitting}\n className={cn(\n 'w-full rounded-none-none py-4 flex items-center justify-center gap-3 text-xs font-semibold shadow-xl transition-all group disabled:opacity-50 disabled:pointer-events-none',\n theme === 'dark'\n ? 'bg-z-panel text-z-primary hover:bg-[var(--z-bg-hover)] shadow-[var(--z-border)]'\n : 'bg-z-accent text-z-primary hover:bg-app shadow-[var(--z-border)]'\n )}\n >\n {isSubmitting ? (\n <Loader2 size={18} className=\"animate-spin\" />\n ) : (\n <>\n <span>Dispatch Recovery Node</span>\n <ArrowRight\n size={16}\n className=\"group-hover:translate-x-1 transition-transform\"\n />\n </>\n )}\n </button>\n\n <div className=\"text-center pt-2\">\n <Link\n to=\"/login\"\n className={cn(\n 'text-sm font-semibold hover:underline flex items-center justify-center gap-2 transition-colors',\n theme === 'dark'\n ? 'text-z-secondary hover:text-z-secondary'\n : 'text-z-secondary hover:text-z-primary'\n )}\n >\n <ArrowLeft size={10} />\n <span>Return to Login</span>\n </Link>\n </div>\n </form>\n )}\n </motion.div>\n\n <p className=\"text-center text-sm font-bold text-z-muted\">\n Authorized Personnel Only • Zenith CMS Engine\n </p>\n </div>\n </div>\n )\n}\n\nexport default ForgotPasswordPage\n","import React, { useState } from 'react'\nimport { useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useNavigate, useSearchParams, Link } from 'react-router-dom'\nimport {\n Lock,\n Loader2,\n AlertCircle,\n CheckCircle,\n ArrowRight,\n ArrowLeft,\n Sun,\n Moon,\n Eye,\n EyeOff,\n} from 'lucide-react'\nimport { useTheme } from '../context/ThemeContext'\nimport { motion } from 'framer-motion'\nimport Logo from '../components/Logo'\nimport { cn } from '../lib/utils'\nimport { resetPasswordSchema, type ResetPasswordFormValues } from '../lib/validators'\nimport api from '../lib/api'\n\nconst ResetPasswordPage: React.FC = () => {\n const navigate = useNavigate()\n const [searchParams] = useSearchParams()\n const token = searchParams.get('token')\n\n const { theme, toggleTheme } = useTheme()\n const [error, setError] = useState<string | null>(null)\n const [success, setSuccess] = useState<string | null>(null)\n const [isSubmitting, setIsSubmitting] = useState(false)\n const [showPassword, setShowPassword] = useState(false)\n\n const {\n register,\n handleSubmit,\n formState: { errors },\n } = useForm<ResetPasswordFormValues>({\n resolver: zodResolver(resetPasswordSchema),\n })\n\n const onSubmit = async (data: ResetPasswordFormValues) => {\n if (!token) {\n setError('Invalid or expired reset token in address.')\n return\n }\n\n setIsSubmitting(true)\n setError(null)\n setSuccess(null)\n try {\n const response = await api.post('/auth/reset-password', {\n token,\n password: data.password,\n })\n setSuccess(\n response.data?.data?.message ||\n 'Password updated successfully. Login with your new credentials.'\n )\n } catch (err: any) {\n setError(err.response?.data?.error?.message || 'Failed to reset password.')\n } finally {\n setIsSubmitting(false)\n }\n }\n\n return (\n <div\n className={cn(\n 'min-h-screen flex items-center justify-center p-6 relative overflow-hidden font-sans antialiased transition-colors duration-500',\n theme === 'dark' ? 'bg-app text-z-primary' : 'bg-[#fafafa] text-[#111827]'\n )}\n >\n {/* ️ Professional Minimalist Background */}\n <div\n className={cn(\n 'absolute top-[-10%] left-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500',\n theme === 'dark' ? 'bg-z-panel/5' : 'bg-z-border/[0.03]'\n )}\n ></div>\n <div\n className={cn(\n 'absolute bottom-[-10%] right-[-10%] w-[50%] h-[50%] rounded-none-none blur-[120px] pointer-events-none transition-all duration-500',\n theme === 'dark' ? 'bg-z-panel/5' : 'bg-z-border/[0.02]'\n )}\n ></div>\n\n <div className=\"w-full max-w-[400px] relative z-10 flex flex-col gap-8\">\n {/* Branding Module */}\n <motion.div\n initial={{ opacity: 0, y: 20 }}\n animate={{ opacity: 1, y: 0 }}\n className=\"flex flex-col items-center text-center\"\n >\n <div\n className={cn(\n 'w-14 h-14 mb-6 rounded-none-none flex items-center justify-center shadow-2xl relative group cursor-pointer overflow-hidden transition-all duration-500 hover:scale-105',\n 'bg-z-primary text-z-inverse'\n )}\n >\n <Logo size=\"sm\" className=\"scale-75\" />\n </div>\n <h1\n className={cn(\n 'text-4xl font-semibold leading-none transition-colors',\n 'text-z-primary'\n )}\n >\n ZENITH\n </h1>\n <p className=\"mt-3 text-sm font-semibold text-z-muted\">\n Access_Recovery_Interface\n </p>\n </motion.div>\n\n {/* Form Container */}\n <motion.div\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n className={cn(\n 'border rounded-none-none p-8 shadow-2xl relative transition-all duration-500',\n 'bg-z-panel border-z-border shadow-sm'\n )}\n >\n <div className=\"flex items-center justify-between mb-8\">\n <div className=\"flex flex-col\">\n <h2\n className={cn(\n 'text-xl font-semibold transition-colors',\n 'text-z-primary'\n )}\n >\n Reset Password\n </h2>\n <p className=\"text-sm text-z-muted font-bold leading-none mt-1\">\n Initialize New Password\n </p>\n </div>\n\n {/* Theme Toggle */}\n <div\n className={cn(\n 'p-1 rounded-none-none border flex items-center gap-1 transition-all',\n theme === 'dark' ? 'bg-z-hover border-z-border' : 'bg-[var(--z-bg-hover)] border-z-border'\n )}\n >\n <button\n onClick={() => theme !== 'light' && toggleTheme()}\n className={cn(\n 'w-7 h-7 flex items-center justify-center rounded-none-none transition-all',\n theme === 'light'\n ? 'bg-z-panel text-z-primary shadow-sm'\n : 'text-z-muted hover:text-z-primary'\n )}\n >\n <Sun size={14} />\n </button>\n <button\n onClick={() => theme !== 'dark' && toggleTheme()}\n className={cn(\n 'w-7 h-7 flex items-center justify-center rounded-none-none transition-all',\n theme === 'dark'\n ? 'bg-z-accent text-z-primary shadow-sm'\n : 'text-z-muted hover:text-z-primary'\n )}\n >\n <Moon size={14} />\n </button>\n </div>\n </div>\n\n {!token ? (\n <div className=\"space-y-6 text-center\">\n <div className=\"flex justify-center\">\n <AlertCircle className=\"text-red-500 w-12 h-12 animate-bounce\" />\n </div>\n <p\n className={cn(\n 'text-xs font-bold tracking-wide px-2 leading-relaxed text-red-500'\n )}\n >\n Token Verification Failure: Missing or Expired Security Payload in URL.\n </p>\n <button\n onClick={() => navigate('/forgot-password')}\n className={cn(\n 'w-full rounded-none-none py-4 flex items-center justify-center gap-3 text-xs font-semibold shadow-xl transition-all group',\n theme === 'dark'\n ? 'bg-z-panel text-z-primary hover:bg-[var(--z-bg-hover)] shadow-[var(--z-border)]'\n : 'bg-z-accent text-z-primary hover:bg-app shadow-[var(--z-border)]'\n )}\n >\n <ArrowLeft size={16} />\n <span>Recover Password Again</span>\n </button>\n </div>\n ) : success ? (\n <div className=\"space-y-6 text-center\">\n <div className=\"flex justify-center\">\n <CheckCircle className=\"text-z-secondary w-12 h-12 animate-pulse\" />\n </div>\n <p\n className={cn(\n 'text-xs font-bold tracking-wide px-2 leading-relaxed',\n theme === 'dark' ? 'text-z-secondary' : 'text-z-secondary'\n )}\n >\n {success}\n </p>\n <button\n onClick={() => navigate('/login')}\n className={cn(\n 'w-full rounded-none-none py-4 flex items-center justify-center gap-3 text-xs font-semibold shadow-xl transition-all group',\n theme === 'dark'\n ? 'bg-z-panel text-z-primary hover:bg-[var(--z-bg-hover)] shadow-[var(--z-border)]'\n : 'bg-z-accent text-z-primary hover:bg-app shadow-[var(--z-border)]'\n )}\n >\n <span>Proceed to Login</span>\n <ArrowRight size={16} className=\"group-hover:translate-x-1 transition-transform\" />\n </button>\n </div>\n ) : (\n <form onSubmit={handleSubmit(onSubmit)} className=\"space-y-6\">\n {error && (\n <div\n className={cn(\n 'border rounded-none-none p-4 flex items-center gap-3 mb-6 overflow-hidden transition-colors',\n theme === 'dark'\n ? 'bg-red-500/10 border-red-500/20 text-red-400'\n : 'bg-red-50 border-red-100 text-red-600'\n )}\n >\n <AlertCircle size={14} className=\"shrink-0\" />\n <span className=\"text-sm font-bold tracking-wide\">{error}</span>\n </div>\n )}\n\n <div className=\"space-y-4\">\n {/* Password field */}\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-semibold text-z-muted px-1\">\n New Password\n </label>\n <div className=\"relative group\">\n <Lock\n className={cn(\n 'absolute left-4 top-1/2 -translate-y-1/2 transition-colors',\n theme === 'dark'\n ? 'text-z-primary/20 group-focus-within:text-z-secondary'\n : 'text-z-secondary group-focus-within:text-z-secondary'\n )}\n size={16}\n />\n <input\n {...register('password')}\n type={showPassword ? 'text' : 'password'}\n placeholder=\"••••••••\"\n className={cn(\n 'w-full border rounded-none-none py-3 pl-12 pr-12 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all',\n theme === 'dark'\n ? 'bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border'\n : 'bg-z-input border-z-border shadow-sm text-z-primary focus:bg-z-panel focus:ring-2 focus:ring-z-active-border'\n )}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className={cn(\n 'absolute right-4 top-1/2 -translate-y-1/2 p-1 rounded-none-none transition-colors',\n theme === 'dark'\n ? 'text-z-primary/20 hover:text-z-primary'\n : 'text-z-secondary hover:text-z-primary'\n )}\n >\n {showPassword ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n </div>\n {errors.password && (\n <p className=\"text-sm text-red-500 font-bold mt-1 px-1\">\n {errors.password.message}\n </p>\n )}\n </div>\n\n {/* Confirm Password field */}\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-semibold text-z-muted px-1\">\n Confirm Password\n </label>\n <div className=\"relative group\">\n <Lock\n className={cn(\n 'absolute left-4 top-1/2 -translate-y-1/2 transition-colors',\n theme === 'dark'\n ? 'text-z-primary/20 group-focus-within:text-z-secondary'\n : 'text-z-secondary group-focus-within:text-z-secondary'\n )}\n size={16}\n />\n <input\n {...register('confirmPassword')}\n type=\"password\"\n placeholder=\"••••••••\"\n className={cn(\n 'w-full border rounded-none-none py-3 pl-12 pr-4 text-xs font-bold outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all',\n theme === 'dark'\n ? 'bg-z-hover border-z-border text-z-primary focus:bg-z-panel/10 focus:ring-2 focus:ring-z-active-border'\n : 'bg-z-input border-z-border shadow-sm text-z-primary focus:bg-z-panel focus:ring-2 focus:ring-z-active-border'\n )}\n />\n </div>\n {errors.confirmPassword && (\n <p className=\"text-sm text-red-500 font-bold mt-1 px-1\">\n {errors.confirmPassword.message}\n </p>\n )}\n </div>\n </div>\n\n <button\n type=\"submit\"\n disabled={isSubmitting}\n className={cn(\n 'w-full rounded-none-none py-4 flex items-center justify-center gap-3 text-xs font-semibold shadow-xl transition-all group disabled:opacity-50 disabled:pointer-events-none',\n theme === 'dark'\n ? 'bg-z-panel text-z-primary hover:bg-[var(--z-bg-hover)] shadow-[var(--z-border)]'\n : 'bg-z-primary text-z-inverse hover:brightness-110 shadow-[var(--z-border)]'\n )}\n >\n {isSubmitting ? (\n <Loader2 size={18} className=\"animate-spin\" />\n ) : (\n <>\n <span>Commit New Password</span>\n <ArrowRight\n size={16}\n className=\"group-hover:translate-x-1 transition-transform\"\n />\n </>\n )}\n </button>\n\n <div className=\"text-center pt-2\">\n <Link\n to=\"/login\"\n className={cn(\n 'text-sm font-semibold hover:underline flex items-center justify-center gap-2 transition-colors',\n theme === 'dark'\n ? 'text-z-secondary hover:text-z-secondary'\n : 'text-z-secondary hover:text-z-primary'\n )}\n >\n <ArrowLeft size={10} />\n <span>Return to Login</span>\n </Link>\n </div>\n </form>\n )}\n </motion.div>\n\n <p className=\"text-center text-sm font-bold text-z-muted\">\n Authorized Personnel Only • Zenith CMS Engine\n </p>\n </div>\n </div>\n )\n}\n\nexport default ResetPasswordPage\n","import React, { useEffect, useState } from 'react'\nimport { useNavigate } from 'react-router-dom'\nimport { Cpu, Plus, Globe, LogOut, Loader2, ArrowRight, Briefcase } from 'lucide-react'\nimport toast from 'react-hot-toast'\nimport api from '../lib/api'\nimport { useAuthStore } from '../store/authStore'\nimport { useTenantStore } from '../lib/tenantStore'\n\ninterface Site {\n _id: string\n id?: string\n name: string\n slug: string\n icon: string\n domain?: string\n description?: string\n ownerId: string\n workspaceId?: string\n}\n\ninterface Workspace {\n _id?: string\n id?: string\n name: string\n slug: string\n ownerId: string\n}\n\nexport default function SitePicker() {\n const navigate = useNavigate()\n const logout = useAuthStore((state) => state.logout)\n const user = useAuthStore((state) => state.user)\n const setActiveSiteId = useTenantStore((state) => state.setActiveSiteId)\n const [workspaces, setWorkspaces] = useState<Workspace[]>([])\n const [sites, setSites] = useState<Site[]>([])\n const [activeWorkspaceId, setActiveWorkspaceId] = useState<string | null>(null)\n const [loading, setLoading] = useState(true)\n const [creating, setCreating] = useState(false)\n\n // Workspace Creation Form State\n const [showNewWorkspaceModal, setShowNewWorkspaceModal] = useState(false)\n const [showDeleteWorkspaceModal, setShowDeleteWorkspaceModal] = useState(false)\n const [wsName, setWsName] = useState('')\n const [wsSlug, setWsSlug] = useState('')\n\n // Site Creation Form State\n const [name, setName] = useState('')\n const [slug, setSlug] = useState('')\n const [icon, setIcon] = useState('')\n const [description, setDescription] = useState('')\n\n const activeWorkspace = workspaces.find((w) => (w._id || w.id) === activeWorkspaceId)\n const isWorkspaceOwner = activeWorkspace && activeWorkspace.ownerId === user?.id\n\n const fetchData = async () => {\n setLoading(true)\n try {\n // 1. Fetch workspaces\n const wsResponse = await api.get('/workspaces')\n const wsList = wsResponse.data?.data || []\n setWorkspaces(wsList)\n\n // Resolve active workspace ID\n let selectedWsId = localStorage.getItem('activeWorkspaceId')\n if (selectedWsId && !wsList.some((w: any) => (w._id || w.id) === selectedWsId)) {\n selectedWsId = null\n }\n if (!selectedWsId && wsList.length > 0) {\n selectedWsId = wsList[0]._id || wsList[0].id\n }\n setActiveWorkspaceId(selectedWsId)\n if (selectedWsId) {\n localStorage.setItem('activeWorkspaceId', selectedWsId)\n }\n\n // 2. Fetch sites\n const sitesResponse = await api.get('/sites')\n setSites(sitesResponse.data?.data || [])\n } catch (err: any) {\n toast.error('Failed to load workspaces and sites.')\n } finally {\n setLoading(false)\n }\n }\n\n useEffect(() => {\n fetchData()\n }, [])\n\n const handleSelectSite = (site: Site) => {\n const wsId = site.workspaceId || activeWorkspaceId\n if (wsId) {\n localStorage.setItem('activeWorkspaceId', wsId)\n }\n const siteId = site._id || site.id || ''\n localStorage.setItem('activeSiteId', siteId)\n localStorage.setItem('activeSiteName', site.name)\n localStorage.setItem('activeSiteSlug', site.slug)\n localStorage.setItem('activeSiteDomain', site.domain || '')\n \n // Update Zustand store\n setActiveSiteId(siteId, site.name)\n \n // Explicitly update default headers to ensure immediate accuracy\n api.defaults.headers['x-zenith-site-id'] = siteId\n \n toast.success(`Entering site: ${site.name}`)\n // Use navigate (not window.location.href) so the React tree stays alive\n // and React Query handles cache invalidation and refetching\n navigate('/')\n }\n\n const handleCreateWorkspace = async (e: React.FormEvent) => {\n e.preventDefault()\n if (!wsName || !wsSlug) {\n toast.error('Workspace name and slug are required.')\n return\n }\n\n try {\n const res = await api.post('/workspaces', {\n name: wsName,\n slug: wsSlug.toLowerCase(),\n })\n const newWs = res.data?.data\n toast.success('Workspace created successfully!')\n \n setWorkspaces((prev) => [...prev, newWs])\n const newWsId = newWs._id || newWs.id\n setActiveWorkspaceId(newWsId)\n localStorage.setItem('activeWorkspaceId', newWsId)\n\n setWsName('')\n setWsSlug('')\n setShowNewWorkspaceModal(false)\n } catch (err: any) {\n toast.error(err.response?.data?.error?.message || 'Failed to create workspace.')\n }\n }\n\n const handleCreateSite = async (e: React.FormEvent) => {\n e.preventDefault()\n if (!name || !slug) {\n toast.error('Name and slug are required fields.')\n return\n }\n if (!activeWorkspaceId) {\n toast.error('Please select or create a workspace first.')\n return\n }\n\n setCreating(true)\n try {\n const response = await api.post('/sites', {\n name,\n slug: slug.toLowerCase(),\n icon,\n description,\n workspaceId: activeWorkspaceId,\n })\n\n const newSite = response.data?.data\n toast.success('Site tenant created successfully!')\n\n // Append new site to state\n setSites((prev) => [...prev, newSite])\n setName('')\n setSlug('')\n setDescription('')\n setIcon('')\n\n // Auto select and navigate to new site\n handleSelectSite(newSite)\n } catch (err: any) {\n toast.error(err.response?.data?.error?.message || 'Failed to create site.')\n } finally {\n setCreating(false)\n }\n }\n\n const handleLogout = () => {\n logout()\n navigate('/login')\n }\n\n // Filter sites belonging to the active workspace tab\n const filteredSites = sites.filter(\n (site) => site.workspaceId === activeWorkspaceId\n )\n\n return (\n <div className=\"flex-1 w-full min-h-0 bg-app text-z-primary flex flex-col justify-between overflow-y-auto overflow-x-hidden\">\n {/* Sleek Minimal Top Navigation Header */}\n <header className=\"border-b border-z-border px-8 py-6 flex items-center justify-between backdrop-blur-md bg-z-header sticky top-0 z-50\">\n <div className=\"flex items-center gap-4\">\n <div className=\"relative flex items-center justify-center w-8 h-8 rounded-none-none border border-z-border bg-z-hover\">\n <Loader2 size={16} className=\"text-z-primary animate-spin opacity-80\" strokeWidth={1.5} />\n <div className=\"absolute inset-0 blur-lg bg-z-hover rounded-none-none\"></div>\n </div>\n <div>\n <span className=\"text-sm font-semibold text-z-primary\">\n Zenith\n </span>\n <span className=\"text-sm font-medium text-z-secondary block -mt-1 font-mono\">\n Platform Nucleus\n </span>\n </div>\n </div>\n\n <button\n onClick={handleLogout}\n className=\"flex items-center gap-2 px-4 py-2 border border-z-border bg-z-panel hover:bg-[var(--z-bg-hover)] text-sm font-semibold text-z-primary/60 hover:text-z-primary transition-all duration-300 font-mono\"\n >\n <LogOut size={12} />\n Sign Out\n </button>\n </header>\n\n {/* Cosmic Launchpad Core */}\n <main className=\"max-w-6xl w-full mx-auto px-6 py-12 flex-grow flex flex-col justify-start\">\n <div className=\"max-w-2xl mb-12\">\n <div className=\"inline-flex items-center gap-2 px-3 py-1 border border-z-border bg-z-hover text-sm font-semibold text-z-primary/50 mb-4 rounded-none-none font-mono\">\n <Globe size={10} className=\"animate-spin-slow\" /> Hierarchical Workspace & Tenant Select\n </div>\n <h1 className=\"text-4xl md:text-5xl font-semibold leading-[1.1] mb-4\">\n Select Site Tenant\n </h1>\n <p className=\"text-z-secondary text-[13px] leading-relaxed\">\n Welcome to Zenith multi-tenant launchpad. Isolate sites, media libraries, roles, and\n schema collections by selecting a Workspace, then choosing a Site.\n </p>\n </div>\n\n {loading ? (\n <div className=\"flex flex-col items-center justify-center py-24 gap-4\">\n <Loader2 size={32} className=\"animate-spin text-z-secondary\" />\n <p className=\"text-sm font-bold text-z-secondary font-mono\">\n Querying active workspaces...\n </p>\n </div>\n ) : (\n <div className=\"flex flex-col gap-8\">\n {/* Workspace Selector Tabs */}\n <div className=\"border border-z-border bg-z-panel p-6 rounded-none-none backdrop-blur-[12px]\">\n <div className=\"flex items-center justify-between mb-4\">\n <span className=\"text-sm font-semibold text-z-primary/40 font-mono\">\n Workspaces\n </span>\n </div>\n <div className=\"flex flex-wrap gap-3\">\n {workspaces.map((ws) => {\n const wsId = ws._id || ws.id\n const isActive = activeWorkspaceId === wsId\n return (\n <button\n key={wsId}\n onClick={() => {\n setActiveWorkspaceId(wsId || null)\n if (wsId) {\n localStorage.setItem('activeWorkspaceId', wsId)\n }\n }}\n className={`flex items-center gap-3 px-5 py-3 transition-all duration-300 border ${\n isActive\n ? 'border-[var(--z-active-border)] bg-[var(--z-active-bg)] text-[var(--z-active-text)] shadow-sm'\n : 'border-z-border bg-z-panel text-z-secondary hover:border-z-border hover:text-z-primary'\n } rounded-none-none`}\n >\n <Briefcase size={14} className={isActive ? 'text-[var(--z-active-text)]' : 'text-z-secondary'} />\n <div className=\"text-left\">\n <span className=\"text-xs font-semibold block leading-tight\">\n {ws.name}\n </span>\n <span className=\"text-sm font-mono text-z-secondary block font-bold\">\n /{ws.slug}\n </span>\n </div>\n </button>\n )\n })}\n\n {isWorkspaceOwner && (\n <button\n onClick={() => setShowDeleteWorkspaceModal(true)}\n className=\"flex items-center gap-2 px-5 py-3 border border-red-900/30 hover:border-red-500/50 hover:bg-red-950/10 text-sm font-semibold text-red-500/50 hover:text-red-500 transition-all duration-300 font-mono rounded-none-none\"\n >\n Delete Workspace\n </button>\n )}\n <button\n onClick={() => setShowNewWorkspaceModal(true)}\n className=\"flex items-center gap-2 px-5 py-3 border border-dashed border-z-border hover:border-[var(--z-active-border)] text-sm font-semibold text-z-primary/50 hover:text-[var(--z-active-text)] transition-all duration-300 font-mono rounded-none-none\"\n >\n <Plus size={14} />\n New Workspace\n </button>\n </div>\n </div>\n\n {/* Sites Grid & Tenant Creation Split View */}\n <div className=\"grid grid-cols-1 md:grid-cols-3 gap-6 items-start\">\n {/* Left Column: Filtered list of Sites */}\n <div className=\"md:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4\">\n {filteredSites.map((site) => {\n const siteId = site._id || site.id || ''\n return (\n <div\n key={siteId}\n onClick={() => handleSelectSite(site)}\n className=\"group relative border border-z-border bg-z-panel hover:border-[var(--z-active-border)] p-6 flex flex-col justify-between h-full min-h-[12rem] cursor-pointer transition-all duration-500 overflow-hidden rounded-none-none shadow-sm\"\n >\n {/* Glassmorph glow on hover */}\n <div className=\"absolute inset-0 bg-z-panel group-hover:bg-z-hover transition-colors duration-500\"></div>\n <div className=\"absolute -right-16 -bottom-16 w-32 h-32 bg-z-hover rounded-none-none blur-3xl opacity-0 group-hover:opacity-100 transition-opacity duration-500\"></div>\n\n <div className=\"relative z-10 flex items-start justify-between gap-4\">\n <span className=\"text-3xl filter saturate-50 group-hover:saturate-100 transition-all duration-300 flex-shrink-0\">\n {site.icon || ''}\n </span>\n <span className=\"text-sm font-bold text-z-secondary font-mono bg-z-hover px-2 py-1 truncate max-w-[60%]\">\n {site.slug}\n </span>\n </div>\n\n <div className=\"relative z-10 mt-6 flex-grow\">\n <h3 className=\"text-lg font-semibold group-hover:text-[var(--z-active-text)] transition-colors duration-300 break-words line-clamp-3\">\n {site.name}\n </h3>\n <p className=\"text-z-secondary text-sm mt-1 line-clamp-3 leading-relaxed break-words\">\n {site.description || 'No description provided.'}\n </p>\n </div>\n\n <div className=\"relative z-10 flex items-center justify-between border-t border-z-border pt-3 mt-4\">\n <span className=\"text-sm font-semibold text-z-primary/30 group-hover:text-z-primary/80 transition-colors duration-300 flex items-center gap-1 font-mono\">\n Enter Site{' '}\n <ArrowRight\n size={10}\n className=\"transform group-hover:translate-x-1 transition-transform\"\n />\n </span>\n </div>\n </div>\n )\n })}\n\n {filteredSites.length === 0 && (\n <div className=\"col-span-2 border border-dashed border-z-border p-12 text-center flex flex-col items-center justify-center gap-4 rounded-none-none\">\n <Globe size={40} className=\"text-z-secondary\" />\n <div>\n <h3 className=\"text-sm font-semibold\">\n No sites inside workspace\n </h3>\n <p className=\"text-z-secondary text-sm mt-1 max-w-xs mx-auto\">\n Create your first site tenant on the right to start building under this workspace.\n </p>\n </div>\n </div>\n )}\n </div>\n\n {/* Right Column: Panel for Creating New Site inside active workspace */}\n <div className=\"p-8 shadow-sm bg-z-panel backdrop-blur-xl border border-z-border\">\n <div className=\"flex items-center gap-2 mb-6\">\n <Plus size={16} className=\"text-[var(--z-active-text)]\" />\n <h2 className=\"text-sm font-semibold\">New Site Tenant</h2>\n </div>\n\n <form onSubmit={handleCreateSite} className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Site Name\n </label>\n <input\n type=\"text\"\n required\n value={name}\n onChange={(e) => {\n setName(e.target.value)\n if (!slug) {\n setSlug(e.target.value.toLowerCase().replace(/[^a-z0-9]+/g, '-'))\n }\n }}\n placeholder=\"e.g. Zenith E-Commerce\"\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-4 py-3 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none placeholder:text-z-secondary text-z-primary\"\n />\n </div>\n\n <div>\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Unique Slug / Identifier\n </label>\n <input\n type=\"text\"\n required\n value={slug}\n onChange={(e) =>\n setSlug(e.target.value.toLowerCase().replace(/[^a-z0-9]+/g, '-'))\n }\n placeholder=\"e.g. zenith-commerce\"\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-4 py-3 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none placeholder:text-z-secondary text-z-primary\"\n />\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-2\">\n <div className=\"col-span-1\">\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Icon\n </label>\n <select\n value={icon}\n onChange={(e) => setIcon(e.target.value)}\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-2 py-3 text-[14px] focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none text-z-primary\"\n >\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n <option value=\"\" className=\"bg-z-base text-z-primary\"></option>\n </select>\n </div>\n <div className=\"col-span-3\">\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Description\n </label>\n <input\n type=\"text\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"e.g. Storefront platform\"\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-4 py-3 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none placeholder:text-z-secondary text-z-primary\"\n />\n </div>\n </div>\n\n <button\n type=\"submit\"\n disabled={creating || !activeWorkspaceId}\n className=\"w-full bg-z-panel text-z-primary hover:bg-z-panel/90 disabled:bg-z-hover disabled:text-z-secondary px-6 py-3.5 text-sm font-semibold flex items-center justify-center gap-2 transition-all duration-300 font-mono shadow-sm\"\n >\n {creating ? (\n <>\n <Loader2 size={12} className=\"animate-spin\" />\n Creating...\n </>\n ) : (\n <>Create Site Tenant</>\n )}\n </button>\n </form>\n </div>\n </div>\n </div>\n )}\n </main>\n\n {/* Workspace Creation Modal */}\n {showNewWorkspaceModal && (\n <div className=\"fixed inset-0 z-[100] flex items-center justify-center bg-[var(--z-bg-modal)] backdrop-blur-md\">\n <div className=\"w-full max-w-md p-8 relative overflow-hidden shadow-sm bg-z-panel backdrop-blur-xl border border-z-border\">\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-2\">\n <Briefcase size={16} className=\"text-[var(--z-active-text)]\" />\n <h2 className=\"text-sm font-semibold\">New Workspace</h2>\n </div>\n <button\n onClick={() => setShowNewWorkspaceModal(false)}\n className=\"text-z-secondary hover:text-z-primary text-xs font-mono\"\n >\n [CLOSE]\n </button>\n </div>\n\n <form onSubmit={handleCreateWorkspace} className=\"space-y-4\">\n <div>\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Workspace Name\n </label>\n <input\n type=\"text\"\n required\n value={wsName}\n onChange={(e) => {\n setWsName(e.target.value)\n if (!wsSlug) {\n setWsSlug(e.target.value.toLowerCase().replace(/[^a-z0-9]+/g, '-'))\n }\n }}\n placeholder=\"e.g. Zenith Studio\"\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-4 py-3 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none placeholder:text-z-secondary text-z-primary\"\n />\n </div>\n\n <div>\n <label className=\"block text-sm font-semibold text-z-primary/40 mb-1.5 font-mono\">\n Unique Slug / Identifier\n </label>\n <input\n type=\"text\"\n required\n value={wsSlug}\n onChange={(e) =>\n setWsSlug(e.target.value.toLowerCase().replace(/[^a-z0-9]+/g, '-'))\n }\n placeholder=\"e.g. zenith-studio\"\n className=\"w-full bg-z-panel border border-z-border focus:border-[var(--z-accent)]/50 px-4 py-3 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-colors rounded-none-none placeholder:text-z-secondary text-z-primary\"\n />\n </div>\n\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={() => setShowNewWorkspaceModal(false)}\n className=\"flex-1 border border-z-border hover:bg-z-hover px-6 py-3.5 text-sm font-semibold text-z-primary transition-colors duration-300 font-mono\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n className=\"flex-1 bg-[var(--z-accent)] text-z-primary hover:bg-[#059669] px-6 py-3.5 text-sm font-semibold transition-colors duration-300 font-mono shadow-sm\"\n >\n Create\n </button>\n </div>\n </form>\n </div>\n </div>\n )}\n\n {/* Workspace Deletion Modal */}\n {showDeleteWorkspaceModal && (\n <div className=\"fixed inset-0 z-[100] flex items-center justify-center bg-[var(--z-bg-modal)] backdrop-blur-md\">\n <div className=\"w-full max-w-md p-8 relative overflow-hidden shadow-sm bg-z-panel backdrop-blur-xl border border-red-900/30\">\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-2\">\n <Briefcase size={16} className=\"text-red-500\" />\n <h2 className=\"text-sm font-semibold text-red-500\">Delete Workspace</h2>\n </div>\n <button\n onClick={() => setShowDeleteWorkspaceModal(false)}\n className=\"text-z-secondary hover:text-z-primary text-xs font-mono\"\n >\n [CLOSE]\n </button>\n </div>\n \n <div className=\"space-y-6\">\n <p className=\"text-sm text-z-secondary leading-relaxed\">\n Are you absolutely sure you want to permanently delete this workspace and all of its associated sites, content, and media? This action cannot be undone.\n </p>\n <div className=\"flex gap-3 pt-2\">\n <button\n type=\"button\"\n onClick={() => setShowDeleteWorkspaceModal(false)}\n className=\"flex-1 border border-z-border hover:bg-z-hover px-6 py-3.5 text-sm font-semibold text-z-primary transition-colors duration-300 font-mono\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={() => {\n api.delete(`/workspaces/${activeWorkspaceId}`).then(() => {\n toast.success('Workspace deleted')\n setShowDeleteWorkspaceModal(false)\n fetchData()\n }).catch((err: any) => {\n toast.error(err.response?.data?.error?.message || 'Failed to delete workspace')\n })\n }}\n className=\"flex-1 bg-red-950/20 text-red-500 border border-red-900/30 hover:bg-red-500 hover:text-z-logo-text px-6 py-3.5 text-sm font-semibold transition-colors duration-300 font-mono shadow-sm\"\n >\n Permanently Delete\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n\n\n {/* Footer */}\n <footer className=\"border-t border-z-border px-8 py-6 flex flex-col md:flex-row items-center justify-between text-sm font-bold text-z-primary/35 font-mono\">\n <div>Zenith Engine v2.4.0-CORE-OS</div>\n <div className=\"flex items-center gap-6 mt-4 md:mt-0\">\n <a href=\"#\" className=\"hover:text-z-primary transition-colors\">\n Documentation\n </a>\n <a href=\"#\" className=\"hover:text-z-primary transition-colors\">\n API Reference\n </a>\n <a href=\"#\" className=\"hover:text-z-primary transition-colors\">\n Enterprise Nucleus\n </a>\n </div>\n </footer>\n </div>\n )\n}\n","import { create } from 'zustand'\n\ninterface ConfirmOptions {\n title?: string\n message?: string\n confirmText?: string\n cancelText?: string\n variant?: 'danger' | 'warning' | 'info'\n}\n\ninterface ConfirmStore {\n isOpen: boolean\n title: string\n message: string\n confirmText: string\n cancelText: string\n variant: 'danger' | 'warning' | 'info'\n resolve: ((value: boolean) => void) | null\n open: (options: ConfirmOptions) => Promise<boolean>\n close: (result: boolean) => void\n}\n\nexport const useConfirmStore = create<ConfirmStore>((set) => ({\n isOpen: false,\n title: 'Confirm',\n message: '',\n confirmText: 'Confirm',\n cancelText: 'Cancel',\n variant: 'info',\n resolve: null,\n\n open: (options) => {\n return new Promise<boolean>((resolve) => {\n set({\n isOpen: true,\n title: options.title || 'Confirm',\n message: options.message || '',\n confirmText: options.confirmText || 'Confirm',\n cancelText: options.cancelText || 'Cancel',\n variant: options.variant || 'info',\n resolve,\n })\n })\n },\n\n close: (result) => {\n const { resolve } = useConfirmStore.getState()\n if (resolve) resolve(result)\n set({ isOpen: false, resolve: null })\n },\n}))\n\nexport async function confirm(options: ConfirmOptions): Promise<boolean> {\n return await useConfirmStore.getState().open(options)\n}\n","import React from 'react'\nimport { Send, Archive, Trash2, X, Loader2 } from 'lucide-react'\nimport { motion } from 'framer-motion'\nimport { cn } from '../lib/utils'\n\ninterface CollectionListBulkToolbarProps {\n selectedIds: Set<string>\n bulkProcessing: boolean\n theme: 'light' | 'dark'\n onClearSelection: () => void\n onBulkAction: (action: 'delete' | 'publish' | 'unpublish') => void\n}\n\nconst CollectionListBulkToolbar: React.FC<CollectionListBulkToolbarProps> = ({\n selectedIds, bulkProcessing, theme, onClearSelection, onBulkAction,\n}) => {\n return (\n <motion.div\n initial={{ opacity: 0, y: -10, height: 0 }}\n animate={{ opacity: 1, y: 0, height: 'auto' }}\n exit={{ opacity: 0, y: -10, height: 0 }}\n transition={{ duration: 0.2 }}\n className={cn(\n 'border rounded-none-none px-6 py-3 flex items-center justify-between gap-4 shadow-lg',\n theme === 'dark' ? 'bg-z-panel/5 border-z-border' : 'bg-z-input border-z-border'\n )}\n >\n <div className=\"flex items-center gap-3\">\n <span className=\"text-sm font-semibold text-z-secondary\">\n {selectedIds.size} Selected\n </span>\n <button onClick={onClearSelection} className=\"p-1 text-z-secondary hover:text-z-primary transition-colors\" title=\"Clear selection\">\n <X size={12} />\n </button>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() => onBulkAction('publish')}\n disabled={bulkProcessing}\n className={cn(\n 'px-4 py-2 rounded-none-none font-semibold text-sm transition-all flex items-center gap-2 border',\n theme === 'dark' ? 'bg-z-panel/5 border-z-border text-z-secondary hover:bg-z-hover border-z-border-strong' : 'bg-z-input border-z-border text-z-secondary hover:bg-[var(--z-bg-hover)]'\n )}\n >\n <Send size={11} /> Publish\n </button>\n <button\n onClick={() => onBulkAction('unpublish')}\n disabled={bulkProcessing}\n className={cn(\n 'px-4 py-2 rounded-none-none font-semibold text-sm transition-all flex items-center gap-2 border',\n theme === 'dark' ? 'bg-amber-500/10 border-amber-500/20 text-amber-400 hover:bg-amber-500/20' : 'bg-amber-50 border-amber-200 text-amber-600 hover:bg-amber-100'\n )}\n >\n <Archive size={11} /> Unpublish\n </button>\n <button\n onClick={() => onBulkAction('delete')}\n disabled={bulkProcessing}\n className={cn(\n 'px-4 py-2 rounded-none-none font-semibold text-sm transition-all flex items-center gap-2 border',\n theme === 'dark' ? 'bg-red-500/10 border-red-500/20 text-red-400 hover:bg-red-500/20' : 'bg-red-50 border-red-200 text-red-600 hover:bg-red-100'\n )}\n >\n {bulkProcessing ? <Loader2 size={11} className=\"animate-spin\" /> : <Trash2 size={11} />} Delete\n </button>\n </div>\n </motion.div>\n )\n}\n\nexport default CollectionListBulkToolbar\n","import React, { useState } from 'react'\nimport { Upload, X, FileJson, FileSpreadsheet, AlertCircle, CheckCircle2, Loader2 } from 'lucide-react'\nimport { motion } from 'framer-motion'\nimport { cn } from '../lib/utils'\nimport api from '../lib/api'\nimport toast from 'react-hot-toast'\n\ninterface CollectionListImportModalProps {\n slug: string\n theme: 'light' | 'dark'\n onClose: () => void\n onImported: () => void\n}\n\nconst CollectionListImportModal: React.FC<CollectionListImportModalProps> = ({ slug, theme, onClose, onImported }) => {\n const [importFormat, setImportFormat] = useState<'csv' | 'json'>('csv')\n const [importText, setImportText] = useState('')\n const [importFile, setImportFile] = useState<File | null>(null)\n const [importing, setImporting] = useState(false)\n const [importResult, setImportResult] = useState<{ imported: number; total: number; errors: { row: number; error: string }[] } | null>(null)\n const [dragOver, setDragOver] = useState(false)\n\n const handleImport = async () => {\n setImporting(true)\n setImportResult(null)\n try {\n let data: string\n if (importFile) {\n data = await importFile.text()\n } else if (importText.trim()) {\n data = importText.trim()\n } else {\n toast.error('Upload a file or paste data')\n setImporting(false)\n return\n }\n const res = await api.post(`/import-export/${slug}?format=${importFormat}`, { data })\n const result = res.data.data\n setImportResult(result)\n toast.success(result.message || `Imported ${result.imported} records`)\n if (result.imported > 0) onImported()\n } catch (err: any) {\n toast.error(err.response?.data?.message || 'Import failed')\n } finally {\n setImporting(false)\n }\n }\n\n return (\n <div className=\"fixed inset-0 z-[1000] flex items-center justify-center p-4 bg-z-panel backdrop-blur-md\">\n <motion.div\n initial={{ opacity: 0, scale: 0.98, y: 15 }}\n animate={{ opacity: 1, scale: 1, y: 0 }}\n exit={{ opacity: 0, scale: 0.98, y: 15 }}\n className={cn(\n 'border rounded-none-none w-full max-w-2xl shadow-2xl flex flex-col overflow-hidden',\n 'bg-z-panel border-z-border text-z-primary shadow-sm'\n )}\n >\n {/* Header */}\n <div className=\"px-8 py-6 border-b flex justify-between items-center\" style={{ borderColor: theme === 'dark' ? 'rgba(255,255,255,0.05)' : '#f3f4f6' }}>\n <div className=\"flex items-center gap-4\">\n <div className=\"w-9 h-9 bg-z-accent rounded-none-none flex items-center justify-center text-z-primary shadow-lg\">\n <Upload size={16} />\n </div>\n <div className=\"flex flex-col\">\n <h3 className=\"text-xs font-semibold\">Import Data</h3>\n <p className=\"text-sm font-bold text-z-muted mt-1\">{slug} collection</p>\n </div>\n </div>\n <button onClick={onClose} className=\"w-8 h-8 flex items-center justify-center bg-[var(--z-bg-input)] hover:bg-[var(--z-bg-hover)] dark:bg-z-hover dark:hover:bg-[var(--z-bg-hover)] rounded-none-none transition-colors\">\n <X size={14} className=\"text-z-muted\" />\n </button>\n </div>\n\n {/* Body */}\n <div className=\"p-8 space-y-6\">\n {/* Format selector */}\n <div className=\"flex items-center gap-3\">\n <span className=\"text-sm font-semibold text-z-secondary\">Format:</span>\n <button\n onClick={() => { setImportFormat('csv'); setImportResult(null); }}\n className={cn(\n 'px-4 py-2 rounded-none-none font-semibold text-sm transition-all flex items-center gap-2 border',\n importFormat === 'csv' ? 'bg-z-accent border-z-border text-z-primary' :\n theme === 'dark' ? 'bg-z-hover border-z-border text-z-muted hover:text-z-primary' : 'bg-z-panel border-z-border text-z-secondary hover:text-z-primary'\n )}\n >\n <FileSpreadsheet size={12} /> CSV\n </button>\n <button\n onClick={() => { setImportFormat('json'); setImportResult(null); }}\n className={cn(\n 'px-4 py-2 rounded-none-none font-semibold text-sm transition-all flex items-center gap-2 border',\n importFormat === 'json' ? 'bg-z-accent border-z-border text-z-primary' :\n theme === 'dark' ? 'bg-z-hover border-z-border text-z-muted hover:text-z-primary' : 'bg-z-panel border-z-border text-z-secondary hover:text-z-primary'\n )}\n >\n <FileJson size={12} /> JSON\n </button>\n </div>\n\n {/* Drop zone */}\n <div\n onDragOver={(e) => { e.preventDefault(); setDragOver(true); }}\n onDragLeave={() => setDragOver(false)}\n onDrop={(e) => {\n e.preventDefault()\n setDragOver(false)\n const file = e.dataTransfer.files[0]\n if (file) { setImportFile(file); setImportText(''); setImportResult(null) }\n }}\n className={cn(\n 'border-2 border-dashed rounded-none-none p-8 text-center transition-all cursor-pointer',\n dragOver ? 'border-z-border bg-z-hover' :\n theme === 'dark' ? 'border-z-border hover:border-z-border' : 'border-z-border hover:border-z-border-strong'\n )}\n onClick={() => {\n const input = document.createElement('input')\n input.type = 'file'\n input.accept = importFormat === 'csv' ? '.csv' : '.json'\n input.onchange = (e: any) => {\n const file = e.target.files?.[0]\n if (file) { setImportFile(file); setImportText(''); setImportResult(null) }\n }\n input.click()\n }}\n >\n {importFile ? (\n <div className=\"flex flex-col items-center gap-3\">\n {importFormat === 'csv' ? <FileSpreadsheet size={32} className=\"text-z-secondary \" /> : <FileJson size={32} className=\"text-z-secondary \" />}\n <span className=\"text-sm font-semibold text-z-secondary\">{importFile.name}</span>\n <span className=\"text-sm font-bold text-z-secondary\">{(importFile.size / 1024).toFixed(1)} KB — Click to change</span>\n </div>\n ) : (\n <div className=\"flex flex-col items-center gap-3\">\n <Upload size={32} className=\"text-z-secondary/40\" />\n <span className=\"text-sm font-semibold text-z-secondary\">Drop {importFormat.toUpperCase()} file here or click to browse</span>\n <span className=\"text-sm font-bold text-z-muted\">Or paste data in the text area below</span>\n </div>\n )}\n </div>\n\n {/* Text area */}\n <div className=\"space-y-2\">\n <label className=\"text-sm font-semibold text-z-secondary\">Or paste {importFormat.toUpperCase()} data:</label>\n <textarea\n value={importText}\n onChange={(e) => { setImportText(e.target.value); setImportFile(null); setImportResult(null); }}\n rows={6}\n className={cn(\n 'w-full border rounded-none-none px-4 py-3 text-xs font-mono outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black transition-all resize-y',\n theme === 'dark' ? 'bg-z-hover border-z-border text-z-primary focus:border-z-border/50' : 'bg-z-input border-z-border focus:border-z-border'\n )}\n placeholder={importFormat === 'csv'\n ? 'name,title,price\\nProduct A,Title A,29.99\\nProduct B,Title B,49.99'\n : '[\\n {\"name\": \"Product A\", \"title\": \"Title A\", \"price\": 29.99},\\n {\"name\": \"Product B\", \"title\": \"Title B\", \"price\": 49.99}\\n]'\n }\n />\n </div>\n\n {/* Result */}\n {importResult && (\n <div className={cn(\n 'border rounded-none-none p-5 space-y-3',\n importResult.errors.length === 0\n ? theme === 'dark' ? 'bg-z-hover border-z-border/20' : 'bg-z-input border-z-border'\n : theme === 'dark' ? 'bg-amber-500/5 border-amber-500/20' : 'bg-amber-50 border-amber-200'\n )}>\n <div className=\"flex items-center gap-3\">\n {importResult.errors.length === 0 ? <CheckCircle2 size={16} className=\"text-z-secondary \" /> : <AlertCircle size={16} className=\"text-amber-500\" />}\n <span className=\"text-sm font-semibold\">\n {importResult.imported} of {importResult.total} records imported\n {importResult.errors.length > 0 && ` (${importResult.errors.length} errors)`}\n </span>\n </div>\n {importResult.errors.length > 0 && (\n <div className=\"max-h-32 overflow-y-auto space-y-1\">\n {importResult.errors.map((err, i) => (\n <div key={i} className=\"text-sm font-mono text-red-400\">Row {err.row}: {err.error}</div>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"px-8 py-6 border-t flex justify-end gap-3\" style={{ borderColor: theme === 'dark' ? 'rgba(255,255,255,0.05)' : '#f3f4f6', background: theme === 'dark' ? 'rgba(255,255,255,0.02)' : '#f9fafb' }}>\n <button onClick={onClose} className={cn('px-6 py-3 font-semibold text-sm transition-all ', theme === 'dark' ? 'bg-z-hover text-z-muted hover:text-z-primary' : 'bg-z-panel border border-z-border shadow-sm text-z-muted hover:text-z-primary')}>Cancel</button>\n <button\n onClick={handleImport}\n disabled={importing || (!importFile && !importText.trim())}\n className={cn('px-8 py-3 rounded-none-none font-semibold text-sm shadow-xl transition-all flex items-center gap-2 disabled:opacity-40', theme === 'dark' ? 'bg-z-accent hover:bg-z-base text-z-primary shadow-[var(--z-border)]' : 'bg-z-accent hover:bg-z-base text-z-primary')}\n >\n {importing ? <Loader2 size={12} className=\"animate-spin\" /> : <Upload size={12} />}\n {importing ? 'Importing...' : 'Import'}\n </button>\n </div>\n </motion.div>\n </div>\n )\n}\n\nexport default CollectionListImportModal\n","import React from 'react';\nimport { cn } from '../../lib/utils';\nimport { useTheme } from '../../context/ThemeContext';\n\nexport interface PageHeaderProps {\n title: React.ReactNode;\n description?: React.ReactNode;\n icon?: React.ReactNode;\n actions?: React.ReactNode;\n className?: string;\n backLink?: { to: string; label: string };\n breadcrumbs?: any;\n}\n\nexport function PageHeader({ title, description, icon, actions, className, backLink }: PageHeaderProps) {\n const { theme } = useTheme();\n\n return (\n <div className={cn(\n \"px-6 py-4 border-b flex items-center justify-between transition-colors\",\n theme === 'dark' ? 'bg-[var(--z-bg-modal)] backdrop-blur-md border-z-border' : 'bg-z-panel/80 backdrop-blur-md border-z-border',\n className\n )}>\n <div className=\"flex items-center gap-4\">\n {backLink && (\n <a href={backLink.to} className=\"flex items-center justify-center p-2 rounded-none border border-transparent hover:border-z-border hover:bg-z-hover transition-all text-z-secondary\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"lucide lucide-arrow-left\"><path d=\"m12 19-7-7 7-7\"/><path d=\"M19 12H5\"/></svg>\n </a>\n )}\n {icon && (\n <div className={cn(\n \"p-2.5 rounded-none-none border\",\n theme === 'dark' ? 'bg-z-panel border-z-border text-z-active-text' : 'bg-z-input border-z-border text-z-accent'\n )}>\n {icon}\n </div>\n )}\n <div>\n <h1 className={cn(\n \"text-xl font-semibold leading-none\",\n 'text-z-primary'\n )}>\n {title}\n </h1>\n {description && (\n <p className={cn(\n \"text-xs mt-1\",\n theme === 'dark' ? 'text-z-muted' : 'text-z-secondary'\n )}>\n {description}\n </p>\n )}\n </div>\n </div>\n \n {actions && (\n <div className=\"flex items-center gap-3\">\n {actions}\n </div>\n )}\n </div>\n );\n}\n","import React from 'react';\nimport { cn } from '../../lib/utils';\nimport { useTheme } from '../../context/ThemeContext';\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n padding?: 'none' | 'sm' | 'md' | 'lg';\n interactive?: boolean;\n}\n\nexport function Card({ \n className, \n children, \n padding = 'md', \n interactive = false, \n ...props \n}: CardProps) {\n const { theme } = useTheme();\n\n const paddingClass = {\n none: 'p-0',\n sm: 'p-3',\n md: 'p-6',\n lg: 'p-8',\n }[padding];\n\n return (\n <div\n className={cn(\n \"relative rounded-none border transition-all duration-200 overflow-hidden\",\n theme === 'dark' \n ? 'bg-z-panel backdrop-blur-md border-z-border shadow-sm' \n : 'bg-z-panel border-z-border shadow-sm',\n interactive && (theme === 'dark' ? 'hover:border-z-accent/50 hover:bg-app/80' : 'hover:border-z-accent/50 hover:bg-[var(--z-bg-input)]'),\n paddingClass,\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport function CardHeader({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const { theme } = useTheme();\n return (\n <div\n className={cn(\n \"flex flex-row items-center justify-between border-b px-6 py-4\",\n theme === 'dark' ? 'border-z-border bg-z-panel' : 'border-z-border bg-[var(--z-bg-input)]/50',\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport function CardTitle({ className, children, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {\n const { theme } = useTheme();\n return (\n <h3\n className={cn(\n \"text-sm font-semibold \",\n theme === 'dark' ? 'text-z-secondary' : 'text-z-primary',\n className\n )}\n {...props}\n >\n {children}\n </h3>\n );\n}\n\nexport function CardContent({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div className={cn(\"p-6\", className)} {...props}>\n {children}\n </div>\n );\n}\n","import React, { useEffect, useState, useCallback } from 'react'\nimport { useParams, Link, useNavigate } from 'react-router-dom'\nimport {\n Plus, Search, ChevronLeft, ChevronRight, Loader2, Edit, Trash2, Send, Archive,\n Database, Download, Layers, Activity as ActivityIcon, KeyRound,\n ShieldCheck, CheckSquare, Square, Upload, LayoutList, LayoutGrid, Kanban\n} from 'lucide-react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { cn } from '../lib/utils'\nimport { confirm } from '../store/confirmStore'\nimport api from '../lib/api'\nimport toast from 'react-hot-toast'\nimport { useTheme } from '../context/ThemeContext'\nimport CollectionListBulkToolbar from './CollectionListBulkToolbar'\nimport CollectionListImportModal from './CollectionListImportModal'\nimport { useSystemMetadata, useCollectionItems } from '../hooks/useQueries'\nimport { useTenantStore } from '../lib/tenantStore'\nimport { useSWRConfig } from 'swr'\nimport { PageHeader } from '../components/ui/PageHeader'\nimport { Card, CardContent } from '../components/ui/Card'\nimport { Badge } from '../components/ui/Badge'\n\nconst EmptyCollectionState = ({ slug, theme }: { slug: string, theme: string }) => {\n return (\n <div className={cn(\"py-24 px-6 text-center border-dashed border-2 rounded-none-none flex flex-col items-center justify-center gap-6 my-10 mx-auto max-w-2xl\", theme === 'dark' ? 'border-z-border bg-z-panel' : 'border-z-border/20 bg-[var(--z-bg-input)]/50')}>\n <div className={cn(\"w-16 h-16 rounded-none-none flex items-center justify-center\", theme === 'dark' ? 'bg-z-hover text-z-secondary' : 'bg-[var(--z-bg-hover)] text-z-secondary')}>\n <Database size={28} />\n </div>\n <div>\n <h3 className=\"text-lg font-semibold mb-2\">Collection is Empty</h3>\n <p className={cn(\"text-sm max-w-sm mx-auto font-medium\", theme === 'dark' ? 'text-z-muted' : 'text-z-secondary')}>\n This collection doesn't have any records yet. Initialize the first record to launch the page builder.\n </p>\n </div>\n <Link \n to={`/collections/${slug}/new`}\n className={cn(\"px-8 py-4 rounded-none-none font-semibold text-sm shadow-xl transition-all leading-none flex items-center gap-3\", 'bg-z-panel border border-z-border text-z-primary hover:bg-z-hover shadow-sm')}\n >\n <Plus size={16} strokeWidth={3} /> Launch Page Builder\n </Link>\n </div>\n )\n}\n\nconst CollectionList: React.FC = () => {\n const { slug } = useParams<{ slug: string }>()\n const navigate = useNavigate()\n const { theme } = useTheme()\n const { mutate } = useSWRConfig()\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n \n const [data, setData] = useState<any[]>([])\n const [page, setPage] = useState(1)\n const [total, setTotal] = useState(0)\n const [viewMode, setViewMode] = useState<'active' | 'trash'>('active')\n \n const { data: health, isLoading: isHealthLoading } = useSystemMetadata()\n const { data: collectionData, isLoading: isItemsLoading } = useCollectionItems(slug || '', page, viewMode)\n const loading = isHealthLoading || isItemsLoading\n const [searchQuery, setSearchQuery] = useState('')\n const [layout, setLayout] = useState<'table' | 'cards' | 'kanban'>('table')\n const [config, setConfig] = useState<any>(null)\n const filteredData = data.filter((item) => {\n const searchStr = searchQuery.toLowerCase()\n return Object.values(item).some((val) => String(val).toLowerCase().includes(searchStr))\n })\n const [visibleColumns, setVisibleColumns] = useState<string[]>(['name', 'title', 'price', 'category', '_status', 'updatedAt'])\n const [availableColumns, setAvailableColumns] = useState<string[]>([])\n const [columnMenuOpen, setColumnMenuOpen] = useState(false)\n const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set())\n const [bulkProcessing, setBulkProcessing] = useState(false)\n const [importModalOpen, setImportModalOpen] = useState(false)\n\n useEffect(() => {\n if (!health || !slug) return\n const globals = health.globals || []\n const collections = health.collections || []\n const isGlobal = globals.some((g: any) => g.slug === slug)\n const colConfig = collections.find((c: any) => c.slug === slug)\n setConfig(colConfig)\n const isSingleton = colConfig?.singleton || isGlobal\n if (isSingleton) {\n navigate(isGlobal ? `/globals/${slug}` : `/collections/${slug}/singleton`)\n }\n }, [health, slug, navigate])\n\n useEffect(() => {\n if (collectionData) {\n setData(collectionData.items)\n setTotal(collectionData.total)\n if (collectionData.items.length > 0) {\n const keys = Array.from(new Set(collectionData.items.flatMap((item: any) => Object.keys(item)))).filter(\n (k) => typeof k === 'string' && !k.startsWith('_') && k !== 'id' && k !== '__v'\n ) as string[]\n setAvailableColumns(keys)\n }\n }\n }, [collectionData])\n\n const handleDelete = async (id: string, hard = false) => {\n if (!await confirm({ message: hard ? 'Permanently delete this record? This cannot be undone.' : 'Confirm deletion?' })) return\n try {\n if (hard) {\n await api.delete(`/${slug}/${id}/hard`)\n toast.success('Record permanently purged')\n } else {\n await api.delete(`/${slug}/${id}`)\n toast.success('Record purged')\n }\n setData(data.filter((item) => (item._id || item.id) !== id))\n setTotal((prev) => prev - 1)\n mutate(['collectionItems', activeSiteId, slug, viewMode, page])\n } catch { toast.error('Purge failure') }\n }\n\n const handleRestore = async (id: string) => {\n if (!await confirm({ message: 'Restore this record?' })) return\n try {\n await api.post(`/${slug}/${id}/restore`)\n toast.success('Record restored')\n setData(data.filter((item) => (item._id || item.id) !== id))\n setTotal((prev) => prev - 1)\n mutate(['collectionItems', activeSiteId, slug, viewMode, page])\n } catch { toast.error('Restore failure') }\n }\n\n const toggleSelect = useCallback((id: string) => {\n setSelectedIds((prev) => {\n const next = new Set(prev)\n if (next.has(id)) next.delete(id); else next.add(id)\n return next\n })\n }, [])\n\n const toggleSelectAll = useCallback(() => {\n setSelectedIds((prev) => {\n if (prev.size === filteredData.length) return new Set()\n return new Set(filteredData.map((item: any) => item._id || item.id))\n })\n }, [filteredData])\n\n const clearSelection = useCallback(() => { setSelectedIds(new Set()) }, [])\n\n const hasSpatialEditor = slug === 'pages' || (config?.fields?.some((f: any) => f.type === 'blocks' || f.type === 'dynamicZone' || f.name === 'sections') || false);\n\n const handleBulkAction = async (action: 'delete' | 'publish' | 'unpublish') => {\n const ids = Array.from(selectedIds)\n if (ids.length === 0) return\n const confirmMsg: Record<string, string> = {\n delete: `Delete ${ids.length} selected record(s)? This cannot be undone.`,\n publish: `Publish ${ids.length} selected record(s)?`,\n unpublish: `Unpublish ${ids.length} selected record(s)?`,\n }\n if (!await confirm({ message: confirmMsg[action] })) return\n setBulkProcessing(true)\n try {\n if (action === 'delete') {\n await api.post(`/${slug}/bulk/delete`, { ids })\n toast.success(`${ids.length} records deleted`)\n setData((prev) => prev.filter((item) => !selectedIds.has(item._id || item.id)))\n setTotal((prev) => prev - ids.length)\n } else if (action === 'publish') {\n await api.post(`/${slug}/bulk/publish`, { ids })\n toast.success(`${ids.length} records published`)\n setData((prev) => prev.map((item) => selectedIds.has(item._id || item.id) ? { ...item, _status: 'published' } : item))\n } else if (action === 'unpublish') {\n await api.post(`/${slug}/bulk/unpublish`, { ids })\n toast.success(`${ids.length} records unpublished`)\n setData((prev) => prev.map((item) => selectedIds.has(item._id || item.id) ? { ...item, _status: 'draft' } : item))\n }\n setSelectedIds(new Set())\n mutate(['collectionItems', activeSiteId, slug, viewMode, page])\n } catch { toast.error(`Bulk ${action} failed`) }\n finally { setBulkProcessing(false) }\n }\n\n const handleQuickStatusToggle = async (itemId: string, currentStatus: string) => {\n const action = currentStatus === 'draft' ? 'publish' : 'unpublish'\n const originalItem = data.find((item) => (item._id || item.id) === itemId)\n if (!originalItem) return\n\n // Optimistic UI update\n setData((prev) => prev.map((item) => (item._id || item.id) === itemId ? { ...item, _status: action === 'publish' ? 'published' : 'draft' } : item))\n\n try {\n await api.post(`/${slug}/bulk/${action}`, { ids: [itemId] })\n toast.success(`Record ${action}ed`)\n } catch {\n toast.error(`Failed to ${action} record`)\n // Revert optimistic update\n setData((prev) => prev.map((item) => (item._id || item.id) === itemId ? { ...item, _status: currentStatus } : item))\n }\n }\n\n const exportCSV = () => {\n if (data.length === 0) return\n const headers = Object.keys(data[0]).filter((k) => !k.startsWith('_')).join(',')\n const rows = data.map((item) =>\n Object.entries(item)\n .filter(([k]) => !k.startsWith('_'))\n .map(([, v]) => `\"${String(v).replace(/\"/g, '\"\"')}\"`)\n .join(',')\n )\n const csv = [headers, ...rows].join('\\n')\n const blob = new Blob([csv], { type: 'text/csv' })\n const url = window.URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.setAttribute('hidden', '')\n a.setAttribute('href', url)\n a.setAttribute('download', `${slug}_export_${Date.now()}.csv`)\n document.body.appendChild(a)\n a.click()\n document.body.removeChild(a)\n toast.success('CSV_EXPORT_COMPLETE')\n }\n\n const handleImportRefreshed = async () => {\n mutate(['collectionItems', activeSiteId, slug, viewMode, page])\n }\n\n return (\n <div className={cn('pb-10 min-h-screen transition-colors duration-500', theme === 'dark' ? 'bg-app text-z-primary' : 'bg-[#fafafa] text-z-primary')}>\n {/* Header */}\n <PageHeader \n title={slug?.replace(/-/g, '_')}\n description={`Manage ${slug} • ${total} Total Records`}\n icon={<Layers size={24} />}\n actions={\n <div className=\"flex items-center gap-6\">\n <Link to={`/collections/${slug}/new`} className={cn('px-8 py-4 rounded-none-none font-semibold text-sm shadow-xl transition-all leading-none flex items-center gap-3', theme === 'dark' ? 'bg-white/15 text-white hover:bg-white/20' : 'bg-z-primary text-z-inverse hover:brightness-110 shadow-sm')}>\n <Plus size={18} strokeWidth={3} /> {hasSpatialEditor ? 'Launch Page Builder' : 'New Record'}\n </Link>\n </div>\n }\n />\n\n <div className=\"p-10 space-y-10\">\n\n {/* Dashboard-Style Stats Bar */}\n <div className=\"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6\">\n <div className=\"flex flex-col justify-between gap-2 p-5 border transition-colors z-panel backdrop-blur-md shadow-sm\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-z-secondary\">Total Records</span>\n <Database size={13} className=\"text-z-secondary\" />\n </div>\n <span className=\"text-2xl font-semibold leading-none tabular-nums text-z-primary dark:text-z-primary\">\n {total}\n </span>\n </div>\n\n <div className=\"flex flex-col justify-between gap-2 p-5 border transition-colors z-panel backdrop-blur-md shadow-sm\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-z-secondary\">Collection ID</span>\n <KeyRound size={13} className=\"text-z-secondary\" />\n </div>\n <span className=\"text-2xl font-semibold leading-none tabular-nums text-z-primary dark:text-z-primary uppercase\">\n {slug?.substring(0, 8)}\n </span>\n </div>\n\n <div className=\"flex flex-col justify-between gap-2 p-5 border transition-colors z-panel backdrop-blur-md shadow-sm\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-z-secondary\">Search Filter</span>\n <Search size={13} className=\"text-z-secondary\" />\n </div>\n <span className=\"text-2xl font-semibold leading-none tabular-nums text-z-primary dark:text-z-primary\">\n {searchQuery ? 'Active' : 'None'}\n </span>\n </div>\n\n <div className=\"flex flex-col justify-between gap-2 p-5 border transition-colors z-panel backdrop-blur-md shadow-sm\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-z-secondary\">View Mode</span>\n <Layers size={13} className=\"text-z-secondary\" />\n </div>\n <span className=\"text-2xl font-semibold leading-none tabular-nums text-z-primary dark:text-z-primary capitalize\">\n {viewMode}\n </span>\n </div>\n </div>\n\n {/* Bulk Toolbar */}\n <AnimatePresence>\n {selectedIds.size > 0 && (\n <CollectionListBulkToolbar\n selectedIds={selectedIds}\n bulkProcessing={bulkProcessing}\n theme={theme}\n onClearSelection={clearSelection}\n onBulkAction={handleBulkAction}\n />\n )}\n </AnimatePresence>\n\n {/* View Mode Tabs */}\n {config?.softDelete && (\n <div className=\"flex items-center gap-4 border-b border-z-border dark:border-z-border mb-4 pb-2\">\n <button\n onClick={() => { setViewMode('active'); setPage(1); }}\n className={cn(\"px-4 py-2 text-sm font-semibold transition-colors\", viewMode === 'active' ? 'text-z-secondary border-b-2 border-z-border' : 'text-z-secondary hover:text-z-primary dark:hover:text-z-primary')}\n >\n Active Records\n </button>\n <button\n onClick={() => { setViewMode('trash'); setPage(1); }}\n className={cn(\"px-4 py-2 text-sm font-semibold transition-colors flex items-center gap-2\", viewMode === 'trash' ? 'text-red-500 border-b-2 border-red-500' : 'text-z-secondary hover:text-red-400')}\n >\n <Trash2 size={12} /> Recycle Bin\n </button>\n </div>\n )}\n\n {/* Data Registry */}\n <Card padding=\"none\">\n <div className={cn('px-6 py-4 border-b flex items-center justify-between', theme === 'dark' ? 'bg-z-panel/5 border-z-border' : 'bg-[var(--z-bg-input)]/20')}>\n <div className=\"relative w-full max-w-sm\">\n <Search className=\"absolute left-4 top-1/2 -translate-y-1/2 text-z-secondary\" size={14} />\n <input type=\"text\" value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} placeholder=\"Search records...\"\n className={cn('w-full border rounded-none-none py-2.5 pl-10 pr-4 text-sm font-semibold focus:ring-4 transition-all outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black ', 'bg-z-input border-z-border text-z-primary focus:border-z-active-border')}\n />\n </div>\n <div className=\"flex items-center gap-2 relative\">\n <div className=\"flex items-center gap-2 mr-4\">\n <span className=\"text-sm font-semibold text-z-secondary\">{filteredData.length} Matches</span>\n </div>\n <div className=\"relative\">\n <button onClick={() => setColumnMenuOpen(!columnMenuOpen)} className=\"p-2.5 border rounded-none-none text-z-secondary hover:text-z-secondary transition-colors\">\n <Layers size={14} />\n </button>\n <AnimatePresence>\n {columnMenuOpen && (\n <motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: 10 }}\n className={cn('absolute right-0 top-full mt-2 w-64 border rounded-none-none shadow-2xl z-50 p-4 backdrop-blur-3xl', 'bg-z-popover border-z-border shadow-sm')}\n >\n <h4 className=\"text-sm font-semibold mb-4 text-z-secondary \">Visible Columns</h4>\n <div className=\"space-y-2 max-h-64 overflow-y-auto\">\n {availableColumns.map((col) => (\n <button key={col} onClick={() => setVisibleColumns((prev) => prev.includes(col) ? prev.filter((c) => c !== col) : [...prev, col])}\n className=\"w-full flex items-center justify-between p-2 rounded-none-none hover:bg-z-hover transition-all group\"\n >\n <span className=\"text-sm font-bold text-z-secondary group-hover:text-z-primary\">{col.replace(/_/g, ' ')}</span>\n <div className={cn('w-3 h-3 rounded-none-none border transition-all', visibleColumns.includes(col) ? 'bg-z-border border-z-border' : 'border-z-border')} />\n </button>\n ))}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n <button onClick={exportCSV} className=\"p-2.5 border rounded-none-none text-z-secondary hover:text-z-secondary transition-colors\" title=\"Export\"><Download size={14} /></button>\n <button onClick={() => setImportModalOpen(true)} className=\"p-2.5 border rounded-none-none text-z-secondary hover:text-z-secondary transition-colors\" title=\"Import\"><Upload size={14} /></button>\n <div className=\"w-px h-6 bg-[var(--z-border)] mx-2\" />\n <div className=\"flex bg-[var(--z-bg-hover)] dark:bg-z-hover border border-z-border dark:border-z-border rounded-none-none p-0.5\">\n <button onClick={() => setLayout('table')} className={cn('p-2 transition-all', layout === 'table' ? 'bg-z-panel dark:bg-app shadow-sm text-z-secondary ' : 'text-z-secondary hover:text-z-primary dark:hover:text-z-primary')} title=\"Table View\"><LayoutList size={14} /></button>\n <button onClick={() => setLayout('cards')} className={cn('p-2 transition-all', layout === 'cards' ? 'bg-z-panel dark:bg-app shadow-sm text-z-secondary ' : 'text-z-secondary hover:text-z-primary dark:hover:text-z-primary')} title=\"Cards View\"><LayoutGrid size={14} /></button>\n <button onClick={() => setLayout('kanban')} className={cn('p-2 transition-all', layout === 'kanban' ? 'bg-z-panel dark:bg-app shadow-sm text-z-secondary ' : 'text-z-secondary hover:text-z-primary dark:hover:text-z-primary')} title=\"Kanban View\"><Kanban size={14} /></button>\n </div>\n </div>\n </div>\n\n {layout === 'table' && (\n <div className=\"overflow-x-auto\">\n <div className=\"overflow-x-auto min-w-full pb-4\"><table className=\"w-full\">\n <thead>\n <tr className={cn('border-b text-left text-sm font-semibold text-z-secondary ', 'border-z-border')}>\n <th className=\"px-4 py-4 w-10\">\n <button onClick={(e) => { e.stopPropagation(); toggleSelectAll(); }} className=\"flex items-center justify-center\" title={selectedIds.size === filteredData.length && filteredData.length > 0 ? 'Deselect all' : 'Select all'}>\n {selectedIds.size === filteredData.length && filteredData.length > 0 ? <CheckSquare size={14} className=\"text-z-secondary \" /> : <Square size={14} className={cn('text-z-secondary', selectedIds.size > 0 && 'text-z-secondary')} />}\n </button>\n </th>\n <th className=\"px-6 py-4\">ID</th>\n {availableColumns.filter((c) => visibleColumns.includes(c)).map((col) => (<th key={col} className=\"px-6 py-4\">{col.toUpperCase()}</th>))}\n <th className=\"px-6 py-4 text-right\">Actions</th>\n </tr>\n </thead>\n <tbody className={cn('divide-y', theme === 'dark' ? 'divide-z-border' : 'divide-z-border')}>\n {loading ? (\n <tr><td colSpan={visibleColumns.length + 3} className=\"py-20 text-center\"><Loader2 size={24} className=\"animate-spin mx-auto text-z-secondary opacity-20\" /></td></tr>\n ) : filteredData.length === 0 ? (\n <tr><td colSpan={visibleColumns.length + 3} className=\"py-10\"><EmptyCollectionState slug={slug || ''} theme={theme} /></td></tr>\n ) : filteredData.map((item: any) => {\n const itemId = item._id || item.id\n const isSelected = selectedIds.has(itemId)\n return (\n <tr key={itemId} className={cn(\"hover:bg-z-border/[0.02] transition-colors group cursor-pointer border-b border-z-border\", isSelected && 'bg-z-border/[0.06]')}\n onClick={() => navigate(`/collections/${slug}/${itemId}`)}\n >\n <td className=\"px-4 py-4\">\n <button onClick={(e) => { e.stopPropagation(); toggleSelect(itemId); }} className=\"flex items-center justify-center\">\n {isSelected ? <CheckSquare size={14} className=\"text-z-secondary \" /> : <Square size={14} className=\"text-z-secondary group-hover:text-z-muted\" />}\n </button>\n </td>\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center gap-2\">\n <div className={cn(\"w-1.5 h-1.5 rounded-none-none\", isSelected ? 'bg-z-input' : 'bg-z-border')} />\n <span className=\"text-sm font-semibold text-z-secondary \">#{String(itemId).slice(-6)}</span>\n </div>\n </td>\n {availableColumns.filter((c) => visibleColumns.includes(c)).map((col) => (\n <td key={col} className=\"px-6 py-4\">\n <span className={cn('text-sm font-semibold ', col === '_status' && item[col] === 'published' ? 'text-z-secondary' : col === '_status' && item[col] === 'draft' ? 'text-amber-400' : '')}>\n {typeof item[col] === 'object' ? '[Complex_Object]' : String(item[col] || '—')}\n </span>\n </td>\n ))}\n <td className=\"px-6 py-4 text-right\">\n <div className=\"flex items-center justify-end gap-2 opacity-0 group-hover:opacity-100 transition-all\">\n {viewMode === 'active' ? (\n <>\n {item._status && (\n <button\n onClick={(e) => { e.stopPropagation(); handleQuickStatusToggle(itemId, item._status); }}\n className={cn('p-2 rounded-none-none border', item._status === 'draft' ? 'hover:text-z-secondary hover:border-z-border' : 'hover:text-amber-500 hover:border-amber-500')}\n title={item._status === 'draft' ? 'Publish' : 'Unpublish'}\n >\n {item._status === 'draft' ? <Send size={12} /> : <Archive size={12} />}\n </button>\n )}\n <button onClick={(e) => { e.stopPropagation(); navigate(`/collections/${slug}/${itemId}`) }} className=\"p-2 rounded-none-none border hover:text-z-secondary \"><Edit size={12} /></button>\n <button onClick={(e) => { e.stopPropagation(); handleDelete(itemId); }} className=\"p-2 rounded-none-none border hover:text-red-500\"><Trash2 size={12} /></button>\n </>\n ) : (\n <>\n <button onClick={(e) => { e.stopPropagation(); handleRestore(itemId); }} className=\"px-3 py-1 rounded-none-none border hover:bg-z-border hover:text-z-primary hover:border-z-border text-sm font-bold transition-all\">Restore</button>\n <button onClick={(e) => { e.stopPropagation(); handleDelete(itemId, true); }} className=\"px-3 py-1 rounded-none-none border hover:bg-red-500 hover:text-z-primary hover:border-red-500 text-sm font-bold transition-all\">Delete Forever</button>\n </>\n )}\n </div>\n </td>\n </tr>\n )\n })}\n </tbody>\n </table></div>\n </div>\n )}\n\n {layout === 'cards' && (\n <div className=\"p-6\">\n {loading ? (\n <div className=\"py-20 flex justify-center\"><Loader2 size={24} className=\"animate-spin text-z-secondary opacity-20\" /></div>\n ) : filteredData.length === 0 ? (\n <div className=\"py-20 text-center opacity-20 text-sm font-semibold\">No_Records_Found</div>\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6\">\n {filteredData.map((item: any) => {\n const itemId = item._id || item.id\n const isSelected = selectedIds.has(itemId)\n return (\n <div key={itemId} onClick={() => navigate(`/collections/${slug}/${itemId}`)} className={cn(\"border rounded-none-none p-5 flex flex-col gap-4 cursor-pointer transition-all hover:-translate-y-1 hover:shadow-xl\", theme === 'dark' ? 'bg-z-panel border-z-border hover:border-z-border' : 'bg-z-panel border-z-border shadow-sm hover:border-z-border/20', isSelected && (theme === 'dark' ? 'border-z-border/50 bg-z-hover' : 'border-z-border/50 bg-[var(--z-bg-input)]'))}>\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-3\">\n <button onClick={(e) => { e.stopPropagation(); toggleSelect(itemId); }}>\n {isSelected ? <CheckSquare size={14} className=\"text-z-secondary \" /> : <Square size={14} className=\"text-z-muted\" />}\n </button>\n <span className=\"text-sm font-semibold text-z-secondary \">#{String(itemId).slice(-8)}</span>\n </div>\n <div className=\"flex gap-2\">\n {viewMode === 'active' ? (\n <>\n {item._status && (\n <button\n onClick={(e) => { e.stopPropagation(); handleQuickStatusToggle(itemId, item._status); }}\n className={item._status === 'draft' ? 'text-z-muted hover:text-z-secondary ' : 'text-z-muted hover:text-amber-500'}\n title={item._status === 'draft' ? 'Publish' : 'Unpublish'}\n >\n {item._status === 'draft' ? <Send size={12} /> : <Archive size={12} />}\n </button>\n )}\n <button onClick={(e) => { e.stopPropagation(); navigate(`/collections/${slug}/${itemId}`) }} className=\"text-z-muted hover:text-z-secondary \"><Edit size={12} /></button>\n <button onClick={(e) => { e.stopPropagation(); handleDelete(itemId); }} className=\"text-z-muted hover:text-red-500\"><Trash2 size={12} /></button>\n </>\n ) : (\n <button onClick={(e) => { e.stopPropagation(); handleRestore(itemId); }} className=\"text-sm font-bold text-z-secondary \">Restore</button>\n )}\n </div>\n </div>\n <div className=\"space-y-3\">\n {availableColumns.filter((c) => visibleColumns.includes(c)).slice(0, 4).map((col) => (\n <div key={col} className=\"flex flex-col\">\n <span className=\"text-sm font-semibold text-z-secondary\">{col.replace(/_/g, ' ')}</span>\n <span className={cn('text-xs font-medium truncate', col === '_status' && item[col] === 'published' ? 'text-z-secondary ' : '')}>\n {typeof item[col] === 'object' ? '[Object]' : String(item[col] || '—')}\n </span>\n </div>\n ))}\n </div>\n </div>\n )\n })}\n </div>\n )}\n </div>\n )}\n\n {layout === 'kanban' && (\n <div className=\"p-6 overflow-x-auto\">\n {loading ? (\n <div className=\"py-20 flex justify-center\"><Loader2 size={24} className=\"animate-spin text-z-secondary opacity-20\" /></div>\n ) : filteredData.length === 0 ? (\n <div className=\"py-20 text-center opacity-20 text-sm font-semibold\">No_Records_Found</div>\n ) : (\n <div className=\"flex gap-6 min-w-max pb-4\">\n {(() => {\n const hasStatus = availableColumns.includes('_status') || availableColumns.includes('status')\n const statusField = hasStatus ? (availableColumns.includes('_status') ? '_status' : 'status') : null\n \n const groups: Record<string, any[]> = {}\n if (statusField) {\n filteredData.forEach(item => {\n const st = String(item[statusField] || 'Draft').toLowerCase()\n if (!groups[st]) groups[st] = []\n groups[st].push(item)\n })\n } else {\n groups['Uncategorized'] = filteredData\n }\n\n return Object.entries(groups).map(([status, items]) => (\n <div key={status} className={cn(\"w-80 flex flex-col border rounded-none-none\", 'bg-z-panel border-z-border shadow-sm')}>\n <div className=\"p-4 flex items-center justify-between border-b border-inherit\">\n <span className=\"text-sm font-semibold flex items-center gap-2\">\n <div className={cn(\"w-2 h-2 rounded-none-none shadow-[0_0_8px_currentColor]\", status === 'published' ? 'bg-z-border text-z-secondary ' : status === 'draft' ? 'bg-amber-500 text-amber-500' : 'bg-z-border text-z-secondary')} />\n {status}\n </span>\n <span className=\"text-sm font-bold text-z-secondary bg-z-hover px-2 py-0.5 rounded-none-none\">{items.length}</span>\n </div>\n <div className=\"p-4 flex flex-col gap-3 h-full max-h-[60vh] overflow-y-auto\">\n {items.map(item => {\n const itemId = item._id || item.id\n const isSelected = selectedIds.has(itemId)\n return (\n <div key={itemId} onClick={() => navigate(`/collections/${slug}/${itemId}`)} className={cn(\"p-4 border rounded-none-none cursor-pointer transition-all hover:shadow-lg\", theme === 'dark' ? 'bg-[#0a0a0a] border-z-border hover:border-z-border' : 'bg-z-panel border-z-border hover:border-z-border/30', isSelected && 'ring-1 ring-z-active-border')}>\n <div className=\"flex items-center justify-between mb-3\">\n <span className=\"text-sm font-semibold text-z-secondary\">#{String(itemId).slice(-6)}</span>\n <button onClick={(e) => { e.stopPropagation(); toggleSelect(itemId); }}>\n {isSelected ? <CheckSquare size={12} className=\"text-z-secondary \" /> : <Square size={12} className=\"text-z-muted\" />}\n </button>\n </div>\n {availableColumns.filter((c) => visibleColumns.includes(c) && c !== statusField).slice(0, 2).map((col) => (\n <div key={col} className=\"mb-1\">\n <div className=\"text-sm font-bold text-z-secondary\">{col}</div>\n <div className=\"text-xs truncate text-ellipsis\">{String(item[col] || '—')}</div>\n </div>\n ))}\n </div>\n )\n })}\n </div>\n </div>\n ))\n })()}\n </div>\n )}\n </div>\n )}\n\n <div className={cn('p-4 border-t flex items-center justify-between text-sm font-semibold text-z-secondary ', 'border-z-border')}>\n <div className=\"flex items-center gap-2\"><KeyRound size={10} /><span>{slug?.toUpperCase()}</span></div>\n <div className=\"flex items-center gap-3\">\n <button disabled={page === 1} onClick={() => setPage(page - 1)} className=\"p-1.5 border rounded-none-none disabled:opacity-20\"><ChevronLeft size={14} /></button>\n <span className={cn('px-3 py-1 rounded-none-none text-z-primary', theme === 'dark' ? 'bg-z-panel/10' : 'bg-z-accent')}>{page}</span>\n <button disabled={data.length < 10} onClick={() => setPage(page + 1)} className=\"p-1.5 border rounded-none-none disabled:opacity-20\"><ChevronRight size={14} /></button>\n </div>\n </div>\n </Card>\n </div>\n\n {/* Import Modal */}\n <AnimatePresence>\n {importModalOpen && (\n <CollectionListImportModal\n slug={slug!}\n theme={theme}\n onClose={() => setImportModalOpen(false)}\n onImported={handleImportRefreshed}\n />\n )}\n </AnimatePresence>\n </div>\n )\n}\n\nexport default CollectionList\n","import type { FieldDefinition } from './constants'\n\nexport interface UnifiedBlockDefinition {\n type: string\n iconName: string\n title: string\n description: string\n category: 'Layout' | 'Content' | 'Commerce' | 'Media' | 'Social' | 'General' | 'Advanced'\n fields: FieldDefinition[]\n defaultContent: any\n}\n\nexport const STANDARD_STYLE_FIELDS: FieldDefinition[] = [\n { name: 'anchorId', type: 'text', placeholder: 'e.g. section-id', label: 'Anchor ID' },\n {\n name: 'theme',\n type: 'select',\n options: [\n { label: 'Default', value: 'default' },\n { label: 'Light', value: 'light' },\n { label: 'Dark', value: 'dark' },\n { label: 'Cyber-Purple Gradient', value: 'cyber-gray' },\n { label: 'Glassmorphic Translucent', value: 'glassmorphic' }\n ],\n placeholder: 'Select Theme',\n label: 'Theme'\n },\n {\n name: 'paddingY',\n type: 'select',\n options: [\n { label: 'None', value: 'none' },\n { label: 'Small', value: 'small' },\n { label: 'Medium', value: 'medium' },\n { label: 'Large', value: 'large' }\n ],\n placeholder: 'Select Vertical Padding',\n label: 'Vertical Padding'\n },\n {\n name: 'containerWidth',\n type: 'select',\n options: [\n { label: 'Boxed', value: 'boxed' },\n { label: 'Full Width', value: 'full-width' }\n ],\n placeholder: 'Select Container Width',\n label: 'Container Width'\n },\n { name: 'bgImage', type: 'media', label: 'Background Image' }\n]\n\nexport const STANDARD_STYLE_DEFAULTS = {\n anchorId: '',\n theme: 'default',\n paddingY: 'medium',\n containerWidth: 'boxed',\n bgImage: null\n}\n\nconst BASE_BLOCK_LIBRARY: UnifiedBlockDefinition[] = [\n {\n type: 'hero',\n iconName: 'Star',\n title: 'Hero Module',\n description: 'Impactful entry with background & CTA',\n category: 'Layout',\n fields: [\n { name: 'headline', type: 'text', placeholder: 'Future Engine' },\n { name: 'subheadline', type: 'text', placeholder: 'Modular architecture for visionaries.' },\n { name: 'callToAction', type: 'text', placeholder: 'Launch Protocol' },\n { name: 'backgroundImage', type: 'media' },\n ],\n defaultContent: {\n headline: 'Future Engine',\n subheadline: 'Modular architecture for visionaries.',\n callToAction: 'Launch Protocol',\n backgroundImage: null,\n },\n },\n {\n type: 'features',\n iconName: 'Grid',\n title: 'Feature Grid',\n description: 'Grid-based feature comparison',\n category: 'Layout',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Core Capabilities' },\n {\n name: 'featureList',\n type: 'array',\n fields: [\n { name: 'title', type: 'text', placeholder: 'Title' },\n { name: 'description', type: 'text', placeholder: 'Description' },\n ],\n },\n {\n name: 'featureContent',\n type: 'dz',\n label: 'Feature Content',\n },\n ],\n defaultContent: {\n heading: 'Core Capabilities',\n featureList: [\n { title: 'Velocity', description: 'Near-zero latency lookups.' },\n { title: 'Security', description: 'End-to-end encryption.' },\n ],\n featureContent: [],\n },\n },\n {\n type: 'stats',\n iconName: 'BarChart4',\n title: 'Stats Counter',\n description: 'Animated performance metrics',\n category: 'Content',\n fields: [\n {\n name: 'items',\n type: 'array',\n fields: [\n { name: 'label', type: 'text', placeholder: 'Uptime' },\n { name: 'value', type: 'text', placeholder: '99.9%' },\n ],\n },\n ],\n defaultContent: {\n items: [\n { label: 'Uptime', value: '99.9%' },\n { label: 'Latency', value: '12ms' },\n ],\n },\n },\n {\n type: 'testimonials',\n iconName: 'MessageSquare',\n title: 'Testimonials',\n description: 'Customer testimonials & reviews',\n category: 'Social',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Global Voices' },\n {\n name: 'items',\n type: 'array',\n fields: [\n { name: 'quote', type: 'text', placeholder: 'Quote' },\n { name: 'author', type: 'text', placeholder: 'Author' },\n { name: 'role', type: 'text', placeholder: 'Role' },\n ],\n },\n ],\n defaultContent: {\n heading: 'Global Voices',\n items: [\n {\n quote: 'Zenith changed the scale of our deployment.',\n author: 'Alex_Vander',\n role: 'Architect',\n },\n ],\n },\n },\n {\n type: 'newsletter',\n iconName: 'Mail',\n title: 'Newsletter',\n description: 'Email signup & list building',\n category: 'Social',\n fields: [\n { name: 'title', type: 'text', placeholder: 'Join The Network' },\n { name: 'description', type: 'text', placeholder: 'Stay updated.' },\n { name: 'buttonText', type: 'text', placeholder: 'Subscribe' },\n ],\n defaultContent: {\n title: 'Join The Network',\n description: 'Stay updated with the latest manifests.',\n buttonText: 'Subscribe',\n },\n },\n {\n type: 'pricing',\n iconName: 'CreditCard',\n title: 'Pricing Table',\n description: 'Feature comparison pricing',\n category: 'Commerce',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Parametric Plans' },\n {\n name: 'plans',\n type: 'array',\n fields: [\n { name: 'name', type: 'text', placeholder: 'Enterprise' },\n { name: 'price', type: 'text', placeholder: '$999/mo' },\n { name: 'features', type: 'text', placeholder: 'Unlimited Nodes' },\n ],\n },\n ],\n defaultContent: {\n heading: 'Parametric Plans',\n plans: [{ name: 'Enterprise', price: '$999/mo', features: 'Unlimited Nodes' }],\n },\n },\n {\n type: 'cta',\n iconName: 'Zap',\n title: 'Call to Action',\n description: 'Conversion-focused CTA banner',\n category: 'Content',\n fields: [\n { name: 'title', type: 'text', placeholder: 'Ready to scale?' },\n { name: 'description', type: 'text', placeholder: 'Join the next generation.' },\n { name: 'buttonText', type: 'text', placeholder: 'Connect Now' },\n ],\n defaultContent: {\n title: 'Ready to scale?',\n description: 'Join the next generation of architects.',\n buttonText: 'Connect Now',\n },\n },\n {\n type: 'richTextSection',\n iconName: 'FileText',\n title: 'Rich Text',\n description: 'WYSIWYG content block with inline widgets',\n category: 'Content',\n fields: [\n { name: 'content', type: 'richtext' },\n {\n name: 'inlineComponents',\n type: 'dz',\n label: 'Inline Components',\n components: ['callout', 'code', 'table', 'accordion', 'socialShare'],\n },\n ],\n defaultContent: {\n content: '<h2>Deep Architecture</h2><p>Refined prose for complex narratives.</p>',\n inlineComponents: [],\n },\n },\n {\n type: 'gallery',\n iconName: 'Layout',\n title: 'Gallery',\n description: 'Image gallery & portfolio grid',\n category: 'Media',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Project Exhibits' },\n {\n name: 'items',\n type: 'array',\n fields: [\n { name: 'image', type: 'media' },\n { name: 'caption', type: 'text', placeholder: 'System Node 01' },\n ],\n },\n ],\n defaultContent: {\n heading: 'Project Exhibits',\n items: [{ image: null, caption: 'System Node 01' }],\n },\n },\n {\n type: 'team',\n iconName: 'Users',\n title: 'Team Members',\n description: 'Staff directory & profiles',\n category: 'Social',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'System Architects' },\n {\n name: 'members',\n type: 'array',\n fields: [\n { name: 'name', type: 'text', placeholder: 'Name' },\n { name: 'role', type: 'text', placeholder: 'Role' },\n { name: 'bio', type: 'text', placeholder: 'Bio' },\n ],\n },\n ],\n defaultContent: {\n heading: 'System Architects',\n members: [{ name: 'Elena Kors', role: 'Lead Developer', bio: 'Neural network specialist.' }],\n },\n },\n {\n type: 'faq',\n iconName: 'MessageSquare',\n title: 'FAQ',\n description: 'Frequently asked questions',\n category: 'Content',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Protocol FAQ' },\n {\n name: 'items',\n type: 'array',\n fields: [\n { name: 'question', type: 'text', placeholder: 'Question' },\n { name: 'answer', type: 'text', placeholder: 'Answer' },\n ],\n },\n ],\n defaultContent: {\n heading: 'Protocol FAQ',\n items: [{ question: 'How secure is Zenith?', answer: 'AES-256 encryption at rest.' }],\n },\n },\n {\n type: 'callout',\n iconName: 'AlertCircle',\n title: 'Callout Box',\n description: 'Notice, warning, or tip alert box',\n category: 'General',\n fields: [\n {\n name: 'type',\n type: 'select',\n options: [\n { label: 'Info', value: 'info' },\n { label: 'Warning', value: 'warning' },\n { label: 'Success', value: 'success' },\n { label: 'Error', value: 'error' },\n ],\n placeholder: 'Select type'\n },\n { name: 'content', type: 'richtext', placeholder: 'Alert details...' }\n ],\n defaultContent: {\n type: 'info',\n content: '<p>Important notice for users.</p>'\n }\n },\n {\n type: 'code',\n iconName: 'Code',\n title: 'Code Snippet',\n description: 'Syntax-highlighted code editor',\n category: 'General',\n fields: [\n {\n name: 'language',\n type: 'select',\n options: ['javascript', 'typescript', 'html', 'css', 'json', 'python', 'rust', 'go', 'bash'],\n placeholder: 'Select language'\n },\n { name: 'code', type: 'code', placeholder: 'const x = 42;' }\n ],\n defaultContent: {\n language: 'javascript',\n code: 'console.log(\"Hello Zenith!\");'\n }\n },\n {\n type: 'table',\n iconName: 'Table',\n title: 'Data Table',\n description: 'Grid layout for comparative data',\n category: 'General',\n fields: [\n {\n name: 'headers',\n type: 'array',\n fields: [{ name: 'text', type: 'text', placeholder: 'Header text' }]\n },\n {\n name: 'rows',\n type: 'array',\n fields: [\n {\n name: 'cells',\n type: 'array',\n fields: [{ name: 'text', type: 'text', placeholder: 'Cell text' }]\n }\n ]\n }\n ],\n defaultContent: {\n headers: [{ text: 'Feature' }, { text: 'Zenith' }, { text: 'Others' }],\n rows: [\n { cells: [{ text: 'Customization' }, { text: 'High' }, { text: 'Medium' }] },\n { cells: [{ text: 'Speed' }, { text: 'Insane' }, { text: 'Average' }] }\n ]\n }\n },\n {\n type: 'accordion',\n iconName: 'MessageSquare',\n title: 'Accordion',\n description: 'Expandable content panels',\n category: 'Content',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Frequently Asked Questions' },\n {\n name: 'items',\n type: 'array',\n fields: [\n { name: 'title', type: 'text', placeholder: 'Item Title' },\n { name: 'content', type: 'richtext', placeholder: 'Item content details...' }\n ]\n }\n ],\n defaultContent: {\n heading: 'Frequently Asked Questions',\n items: [\n { title: 'What is Zenith?', content: '<p>Zenith is a premium decoupled hybrid CMS.</p>' },\n { title: 'How does it render?', content: '<p>Via high-performance visual canvas layers.</p>' }\n ]\n }\n },\n {\n type: 'logoGrid',\n iconName: 'Grid',\n title: 'Logo Grid',\n description: 'Client & partner showcase',\n category: 'Media',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Trusted by global teams' },\n {\n name: 'logos',\n type: 'array',\n fields: [\n { name: 'image', type: 'media' },\n { name: 'name', type: 'text', placeholder: 'Company Name' },\n { name: 'link', type: 'text', placeholder: 'https://company.com' }\n ]\n }\n ],\n defaultContent: {\n heading: 'Trusted by global teams',\n logos: [\n { image: null, name: 'Vanguard Inc', link: 'https://vanguard.io' },\n { image: null, name: 'Apex Ltd', link: 'https://apex.co' }\n ]\n }\n },\n {\n type: 'videoHero',\n iconName: 'Zap',\n title: 'Video Hero',\n description: 'Full-width video background hero',\n category: 'Layout',\n fields: [\n { name: 'headline', type: 'text', placeholder: 'Experience Velocity' },\n { name: 'subheadline', type: 'text', placeholder: 'Where performance meets elegance.' },\n { name: 'videoUrl', type: 'text', placeholder: 'https://assets.mixkit.co/videos/preview/mixkit-stars-in-space-background-1611-large.mp4' },\n { name: 'posterImage', type: 'media' },\n { name: 'autoplay', type: 'boolean' },\n { name: 'controls', type: 'boolean' }\n ],\n defaultContent: {\n headline: 'Experience Velocity',\n subheadline: 'Where performance meets elegance.',\n videoUrl: 'https://assets.mixkit.co/videos/preview/mixkit-stars-in-space-background-1611-large.mp4',\n posterImage: null,\n autoplay: true,\n controls: false\n }\n },\n {\n type: 'announcementBar',\n iconName: 'AlertCircle',\n title: 'Announcement Bar',\n description: 'Site-wide alert banner',\n category: 'General',\n fields: [\n { name: 'message', type: 'text', placeholder: 'Attention: Version 2.0 has been deployed.' },\n { name: 'link', type: 'text', placeholder: 'https://zenith.io/changelog' },\n { name: 'linkText', type: 'text', placeholder: 'Read Changelog' },\n { name: 'dismissible', type: 'boolean' }\n ],\n defaultContent: {\n message: 'Attention: Version 2.0 has been deployed.',\n link: 'https://zenith.io/changelog',\n linkText: 'Read Changelog',\n dismissible: true\n }\n },\n {\n type: 'contactForm',\n iconName: 'Mail',\n title: 'Contact Form',\n description: 'Standard contact & lead capture form',\n category: 'Commerce',\n fields: [\n { name: 'title', type: 'text', placeholder: 'Initiate Contact' },\n { name: 'description', type: 'text', placeholder: 'Send us a message and we will respond shortly.' },\n { name: 'emailRecipient', type: 'text', placeholder: 'leads@zenith.io' },\n { name: 'submitButtonText', type: 'text', placeholder: 'Send Message' }\n ],\n defaultContent: {\n title: 'Initiate Contact',\n description: 'Send us a message and we will respond shortly.',\n emailRecipient: 'leads@zenith.io',\n submitButtonText: 'Send Message'\n }\n },\n {\n type: 'socialShare',\n iconName: 'Users',\n title: 'Social Links',\n description: 'Social media link bar',\n category: 'Social',\n fields: [\n { name: 'heading', type: 'text', placeholder: 'Connect with our networks' },\n {\n name: 'platforms',\n type: 'array',\n fields: [\n {\n name: 'platform',\n type: 'select',\n options: [\n { label: 'Twitter/X', value: 'twitter' },\n { label: 'Facebook', value: 'facebook' },\n { label: 'LinkedIn', value: 'linkedin' },\n { label: 'GitHub', value: 'github' },\n { label: 'YouTube', value: 'youtube' }\n ],\n placeholder: 'Select Platform'\n },\n { name: 'url', type: 'text', placeholder: 'https://social.com/profile' }\n ]\n }\n ],\n defaultContent: {\n heading: 'Connect with our networks',\n platforms: [\n { platform: 'twitter', url: 'https://twitter.com/zenithcms' },\n { platform: 'github', url: 'https://github.com/zenithcms' }\n ]\n }\n },\n {\n type: 'customHtml',\n iconName: 'Code',\n title: 'Custom HTML',\n description: 'Raw HTML and inline CSS code block',\n category: 'Advanced',\n fields: [\n { name: 'htmlContent', type: 'code', placeholder: '<div class=\"custom\">...</div>' }\n ],\n defaultContent: {\n htmlContent: '<div style=\"padding: 2rem; text-align: center;\">\\n <h3>Custom Component</h3>\\n</div>'\n }\n },\n {\n type: 'pageEmbed',\n iconName: 'Copy',\n title: 'Page Embed',\n description: 'Embed another page or reusable component',\n category: 'Advanced',\n fields: [\n {\n name: 'reference',\n type: 'relation',\n relationTo: 'pages',\n label: 'Select Page to Embed'\n }\n ],\n defaultContent: {\n reference: null\n }\n }\n]\n\nexport const UNIFIED_BLOCK_LIBRARY: UnifiedBlockDefinition[] = BASE_BLOCK_LIBRARY.map(block => ({\n ...block,\n fields: [...block.fields, ...STANDARD_STYLE_FIELDS],\n defaultContent: { ...block.defaultContent, ...STANDARD_STYLE_DEFAULTS }\n}))\n","import { useState, useEffect } from 'react'\nimport api from '../lib/api'\nimport { useTenantStore } from '../lib/tenantStore'\n\ninterface BlockFieldDefinition {\n name: string\n label?: string\n type: string\n fields?: BlockFieldDefinition[]\n options?: (string | { label: string; value: any })[]\n placeholder?: string\n}\n\nexport interface BlockDefinition {\n slug: string\n labels?: { singular: string; plural: string }\n fields: BlockFieldDefinition[]\n admin?: {\n description?: string\n icon?: string\n imageURL?: string\n category?: string\n }\n}\n\nimport { UNIFIED_BLOCK_LIBRARY } from '../pages/editor/unifiedBlocks'\n\nconst humanize = (str: string) => {\n return str\n .replace(/^root:/, '')\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (s) => s.toUpperCase())\n}\n\nconst mapFields = (fields?: any[]): any[] => {\n if (!fields) return []\n return fields.map((f) => ({\n name: f.name,\n label: f.label || humanize(f.name),\n type: f.type,\n required: f.required,\n placeholder: f.placeholder,\n options: f.options,\n fields: mapFields(f.fields),\n hasMany: f.hasMany,\n hasMore: f.hasMore,\n language: f.language,\n layout: f.layout,\n dateFormat: f.dateFormat,\n components: f.components,\n description: f.description,\n admin: f.admin,\n }))\n}\n\nconst FALLBACK_BLOCKS: BlockDefinition[] = UNIFIED_BLOCK_LIBRARY.map((b) => ({\n slug: b.type,\n labels: { singular: b.title, plural: b.title + 's' },\n fields: mapFields(b.fields),\n admin: {\n description: b.description,\n category: b.category,\n icon: b.iconName,\n }\n}))\n\n// CRITICAL FIX: per-site cache to prevent cross-tenant block data leakage and memory leaks\nconst CACHE_LIMIT = 10\nconst siteCaches = new Map<string, { blocks: BlockDefinition[] | null; promise: Promise<BlockDefinition[]> | null }>()\n\nfunction evictCache() {\n if (siteCaches.size > CACHE_LIMIT) {\n const firstKey = siteCaches.keys().next().value\n if (firstKey) siteCaches.delete(firstKey)\n }\n}\n\nasync function fetchBlocksFromApi(siteId: string): Promise<BlockDefinition[]> {\n const entry = siteCaches.get(siteId)\n if (entry?.blocks) {\n // Move to end (LRU behavior)\n siteCaches.delete(siteId)\n siteCaches.set(siteId, entry)\n return entry.blocks\n }\n if (entry?.promise) return entry.promise\n\n const promise = (async () => {\n try {\n const res = await api.get<any>('/blocks')\n if (res.data?.data && Array.isArray(res.data.data) && res.data.data.length > 0) {\n siteCaches.set(siteId, { blocks: res.data.data as BlockDefinition[], promise: null })\n evictCache()\n return res.data.data as BlockDefinition[]\n }\n return FALLBACK_BLOCKS\n } catch (err: any) {\n return FALLBACK_BLOCKS\n }\n })()\n\n siteCaches.set(siteId, { blocks: null, promise })\n evictCache()\n \n try {\n const result = await promise\n if (siteCaches.has(siteId)) {\n siteCaches.set(siteId, { blocks: result, promise: null })\n }\n return result\n } catch (err: any) {\n siteCaches.delete(siteId)\n throw err\n }\n}\n\nexport function useBlockLibrary(): BlockDefinition[] {\n const activeSiteId = useTenantStore((s) => s.activeSiteId)\n const [blocks, setBlocks] = useState<BlockDefinition[]>(() => FALLBACK_BLOCKS)\n\n useEffect(() => {\n if (!activeSiteId) return\n\n const cached = siteCaches.get(activeSiteId)\n if (cached?.blocks) {\n setBlocks(cached.blocks)\n return\n }\n\n let isMounted = true\n\n fetchBlocksFromApi(activeSiteId)\n .then(fetchedBlocks => {\n if (isMounted) {\n setBlocks(fetchedBlocks)\n }\n })\n .catch(err => {\n if (isMounted) {\n console.error('Failed to fetch blocks', err)\n }\n })\n\n return () => {\n isMounted = false\n }\n }, [activeSiteId])\n\n return blocks\n}\n\nexport function clearBlockCache(siteId?: string) {\n if (siteId) {\n siteCaches.delete(siteId)\n } else {\n siteCaches.clear()\n }\n}\n\nexport { fetchBlocksFromApi, FALLBACK_BLOCKS }\n","import { useState, useEffect } from 'react'\nimport api from '../lib/api'\nimport type { FieldDefinition } from '../pages/editor/constants'\n\nexport interface CustomComponent {\n id: string\n slug: string\n displayName: string\n category: string\n icon: string\n description: string\n fields: FieldDefinition[]\n}\n\nlet cachedComponents: CustomComponent[] | null = null\nlet fetchPromise: Promise<CustomComponent[]> | null = null\n\nexport async function fetchCustomComponents(): Promise<CustomComponent[]> {\n if (cachedComponents) return cachedComponents\n if (fetchPromise) return fetchPromise\n\n fetchPromise = (async () => {\n try {\n const res = await api.get('/system/components')\n if (res.data?.data && Array.isArray(res.data.data)) {\n cachedComponents = res.data.data as CustomComponent[]\n return cachedComponents\n }\n return []\n } catch {\n return []\n }\n })()\n\n return fetchPromise\n}\n\nexport function invalidateCustomComponentsCache() {\n cachedComponents = null\n fetchPromise = null\n}\n\nexport function useCustomComponents(): CustomComponent[] {\n const [components, setComponents] = useState<CustomComponent[]>(() => cachedComponents || [])\n\n useEffect(() => {\n if (!cachedComponents) {\n fetchCustomComponents().then(setComponents)\n }\n }, [])\n\n return components\n}\n","import React from 'react'\nimport {\n Star,\n Grid,\n BarChart4,\n MessageSquare,\n Mail,\n CreditCard,\n Zap,\n FileText,\n Layout,\n Users,\n AlertCircle,\n Code,\n Table,\n Type,\n} from 'lucide-react'\n\nexport interface FieldDefinition {\n name: string\n label?: string\n required?: boolean\n type: 'text' | 'richtext' | 'lexical' | 'media' | 'relation' | 'number' | 'boolean' | 'select' | 'array' | 'group'\n | 'code' | 'collapsible' | 'join' | 'point' | 'radio' | 'row' | 'ui' | 'textarea' | 'checkbox' | 'date' | 'json'\n | 'dz' | 'email' | 'password' | 'uid' | 'color' | 'blocks' | 'tabs'\n fields?: FieldDefinition[]\n options?: (string | { label: string; value: any })[]\n placeholder?: string\n language?: string\n layout?: 'horizontal' | 'vertical'\n hasMany?: boolean\n hasMore?: boolean\n /** For date fields: 'date' (default), 'datetime', or 'time' */\n dateFormat?: 'date' | 'datetime' | 'time'\n /** For dz (dynamic zone) fields: list of available component types from BLOCK_LIBRARY */\n components?: string[]\n /** For blocks field: list of block definitions */\n blocks?: Array<{ slug: string; labels?: { singular: string; plural: string }; fields?: FieldDefinition[] }>\n /** For tabs field: tab group definitions */\n tabs?: Array<{ name: string; label?: string; fields?: FieldDefinition[] }>\n /** Relation target collection(s) */\n relationTo?: string | string[]\n /** Source field for slug auto-generation */\n sourceField?: string\n /** Block array limits */\n minRows?: number\n maxRows?: number\n /** Help text displayed below the field label */\n description?: string\n admin?: {\n components?: {\n Field?: React.ComponentType<any>\n }\n condition?: {\n field: string\n operator: 'equals' | 'not_equals' | 'in' | 'not_in' | 'contains' | 'exists'\n value?: any\n }\n }\n}\n\n// ── Typed sub-interfaces for complex field shapes ─────────────────────────────\n\n/** Asserts that a string is a valid FieldDefinition type. Use in switch default branches. */\nexport function assertFieldType(type: string): asserts type is FieldDefinition['type'] {\n const validTypes = new Set<string>([\n 'text', 'richtext', 'lexical', 'media', 'relation', 'number', 'boolean', 'select',\n 'array', 'group', 'code', 'collapsible', 'join', 'point', 'radio', 'row', 'ui',\n 'textarea', 'checkbox', 'date', 'json', 'dz', 'email', 'password', 'uid', 'color',\n 'blocks', 'tabs', 'link',\n ])\n if (!validTypes.has(type)) {\n throw new Error(\n `[Zenith] Unknown field type: \"${type}\". ` +\n `Add it to the FieldDefinition union in constants.ts and handle it in FieldRenderer.tsx.`\n )\n }\n}\n\n/** Array field — guaranteed to have sub-fields */\nexport type ArrayFieldDef = FieldDefinition & { type: 'array'; fields: FieldDefinition[] }\n\n/** Group field — guaranteed to have sub-fields */\nexport type GroupFieldDef = FieldDefinition & { type: 'group'; fields: FieldDefinition[] }\n\n/** Dynamic Zone field — guaranteed to have component slugs */\nexport type DynamicZoneFieldDef = FieldDefinition & { type: 'dz'; components: string[] }\n\n/** Blocks field — guaranteed to have block definitions */\nexport type BlocksFieldDef = FieldDefinition & {\n type: 'blocks'\n blocks: NonNullable<FieldDefinition['blocks']>\n}\n\nexport interface BlockDefinition {\n type: string\n icon: any\n title: string\n description: string\n category: string\n fields: FieldDefinition[]\n defaultContent: any\n}\n\nimport { UNIFIED_BLOCK_LIBRARY } from './unifiedBlocks'\n\nconst IconMap: any = {\n Star,\n Grid,\n BarChart4,\n MessageSquare,\n Mail,\n CreditCard,\n Zap,\n FileText,\n Layout,\n Users,\n AlertCircle,\n Code,\n Table,\n Type,\n}\n\nexport const BLOCK_LIBRARY: BlockDefinition[] = UNIFIED_BLOCK_LIBRARY.map((b) => ({\n type: b.type,\n icon: IconMap[b.iconName] || Zap,\n title: b.title,\n description: b.description,\n category: b.category,\n fields: b.fields,\n defaultContent: b.defaultContent,\n}))\n\n\nexport const humanize = (str: string) => {\n return str\n .replace(/^root:/, '')\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (s) => s.toUpperCase())\n}\n\nexport const detectFieldType = (key: string, val: any): string => {\n if (val && typeof val === 'object' && val.url) return 'media'\n if (key.toLowerCase().includes('image')) return 'media'\n if (key.toLowerCase().includes('email')) return 'email'\n if (key.toLowerCase().includes('content') || key.toLowerCase().includes('description') || key.toLowerCase().includes('body')) return 'richtext'\n if (Array.isArray(val)) return 'array'\n if (typeof val === 'object' && val !== null) return 'group'\n if (typeof val === 'number') return 'number'\n if (typeof val === 'boolean') return 'boolean'\n return 'text'\n}\n\nexport interface Section {\n id: string\n blockType: string\n title: string\n content: any\n align?: 'left' | 'center' | 'right'\n blockName?: string\n collapsed?: boolean\n}\n\nexport interface PageData {\n _status?: 'draft' | 'published'\n _version?: number\n title?: string\n heroDescription?: string\n sections: Section[]\n align?: 'left' | 'center' | 'right'\n meta?: any\n publishedAt?: string\n createdAt?: string\n updatedAt?: string\n siteId?: string\n}\n\n","import React, { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport {\n Star, Grid, BarChart4, MessageSquare, Mail, CreditCard, Zap,\n FileText, Layout, Users, AlertCircle, Code, Table, HelpCircle, Box,\n type LucideIcon,\n} from 'lucide-react'\nimport { useBlockLibrary } from '../hooks/useBlockLibrary'\nimport { useCustomComponents } from '../hooks/useCustomComponents'\nimport {\n type BlockDefinition as EditorBlockDefinition,\n type FieldDefinition,\n} from '../pages/editor/constants'\n\n// Map API icon strings to lucide components\nconst ICON_MAP: Record<string, LucideIcon> = {\n Star, Grid, BarChart4, MessageSquare, Mail, CreditCard, Zap,\n FileText, Layout, Users, AlertCircle, Code, Table, HelpCircle,\n}\n\nconst EditorBlockLibraryContext = createContext<EditorBlockDefinition[]>([])\n\nfunction mapApiFields(fields: any[]): FieldDefinition[] {\n if (!fields) return []\n return fields.map((f: any) => ({\n name: f.name,\n label: f.label,\n type: f.type,\n fields: f.fields ? mapApiFields(f.fields) : undefined,\n options: f.options,\n placeholder: f.placeholder,\n hasMany: f.hasMany,\n hasMore: f.hasMore,\n language: f.language,\n layout: f.layout,\n dateFormat: f.dateFormat,\n components: f.components,\n description: f.description,\n admin: f.admin,\n } satisfies FieldDefinition))\n}\n\nfunction normalizeDefaultContent(apiBlock: any): any {\n // Build minimal default content from field definitions\n const content: any = {}\n for (const f of apiBlock.fields || []) {\n if (f.type === 'text') content[f.name] = ''\n else if (f.type === 'richtext') content[f.name] = ''\n else if (f.type === 'media') content[f.name] = null\n else if (f.type === 'array') content[f.name] = []\n else if (f.type === 'number') content[f.name] = 0\n else if (f.type === 'boolean') content[f.name] = false\n else if (f.type === 'code') content[f.name] = ''\n else content[f.name] = null\n }\n return content\n}\n\nexport function BlockLibraryProvider({ children }: { children: ReactNode }) {\n const apiBlocks = useBlockLibrary()\n const customComponents = useCustomComponents()\n\n const enriched = useMemo(() => {\n const merged = apiBlocks.map((apiBlock) => {\n return {\n type: apiBlock.slug,\n icon: ICON_MAP[apiBlock.admin?.icon || ''] || Box,\n title: apiBlock.labels?.singular || apiBlock.slug,\n description: apiBlock.admin?.description || '',\n category: apiBlock.admin?.category || 'General',\n fields: mapApiFields(apiBlock.fields),\n defaultContent: normalizeDefaultContent(apiBlock),\n } satisfies EditorBlockDefinition\n })\n\n const customMapped = customComponents.map((comp) => {\n return {\n type: comp.slug,\n icon: ICON_MAP[comp.icon] || Box,\n title: comp.displayName,\n description: comp.description,\n category: comp.category,\n fields: comp.fields,\n defaultContent: normalizeDefaultContent({ fields: comp.fields }),\n } satisfies EditorBlockDefinition\n })\n\n return [...merged, ...customMapped]\n }, [apiBlocks, customComponents])\n\n return (\n <EditorBlockLibraryContext.Provider value={enriched}>\n {children}\n </EditorBlockLibraryContext.Provider>\n )\n}\n\nexport function useEditorBlocks(): EditorBlockDefinition[] {\n return useContext(EditorBlockLibraryContext)\n}\n","import { create } from 'zustand'\n\ninterface ModalState {\n templatesOpen: boolean\n mediaLibraryOpen: boolean\n seoOpen: boolean\n showLocaleDropdown: boolean\n showFieldIndicators: boolean\n relationsModalOpen: boolean\n blockPickerOpen: boolean\n /** Global component picker — can be opened from any context with a callback */\n componentPickerOpen: boolean\n componentPickerCallback: ((blockType: string) => void) | null\n componentPickerBlocks: any[] | null\n\n setTemplatesOpen: (open: boolean) => void\n setMediaLibraryOpen: (open: boolean) => void\n setSeoOpen: (open: boolean) => void\n setShowLocaleDropdown: (open: boolean) => void\n setShowFieldIndicators: (show: boolean) => void\n setRelationsModalOpen: (open: boolean) => void\n setBlockPickerOpen: (open: boolean) => void\n /** Open the global component picker with a callback invoked on selection */\n openComponentPicker: (callback: (blockType: string) => void, blocksOverride?: any[]) => void\n closeComponentPicker: () => void\n}\n\nconst EXCLUSIVE_MODALS = [\n 'templatesOpen',\n 'mediaLibraryOpen',\n 'seoOpen',\n 'relationsModalOpen',\n 'blockPickerOpen',\n 'componentPickerOpen',\n 'showLocaleDropdown',\n] as const\n\nfunction exclusiveSetter<K extends string>(key: K) {\n return (open: boolean) =>\n open\n ? {\n [key]: true,\n ...Object.fromEntries(\n EXCLUSIVE_MODALS.filter((m) => m !== key).map((m) => [m, false])\n ),\n }\n : { [key]: false }\n}\n\nexport const useModalStore = create<ModalState>((set) => ({\n templatesOpen: false,\n mediaLibraryOpen: false,\n seoOpen: false,\n showLocaleDropdown: false,\n showFieldIndicators: true,\n relationsModalOpen: false,\n blockPickerOpen: false,\n componentPickerOpen: false,\n componentPickerCallback: null,\n componentPickerBlocks: null,\n setTemplatesOpen: (open) => set(exclusiveSetter('templatesOpen')(open)),\n setMediaLibraryOpen: (open) => set(exclusiveSetter('mediaLibraryOpen')(open)),\n setSeoOpen: (open) => set(exclusiveSetter('seoOpen')(open)),\n setShowLocaleDropdown: (open) => set(exclusiveSetter('showLocaleDropdown')(open)),\n setShowFieldIndicators: (showFieldIndicators) => set({ showFieldIndicators }),\n setRelationsModalOpen: (open) => set(exclusiveSetter('relationsModalOpen')(open)),\n setBlockPickerOpen: (open) => set(exclusiveSetter('blockPickerOpen')(open)),\n openComponentPicker: (callback, blocksOverride = null) =>\n set({\n componentPickerOpen: true,\n componentPickerCallback: callback,\n componentPickerBlocks: blocksOverride,\n // close exclusive modals\n templatesOpen: false,\n mediaLibraryOpen: false,\n seoOpen: false,\n relationsModalOpen: false,\n blockPickerOpen: false,\n showLocaleDropdown: false,\n }),\n closeComponentPicker: () =>\n set({ componentPickerOpen: false, componentPickerCallback: null, componentPickerBlocks: null }),\n}))\n","import { useEffect, useRef } from 'react'\n\ninterface UseFocusTrapOptions {\n onEscape?: () => void\n containerRef?: React.RefObject<HTMLElement | null>\n}\n\n/**\n * Traps keyboard focus within a container element while active.\n * - Restores focus to the element that had focus before activation.\n * - Cycles Tab/Shift+Tab within the container.\n * - Calls onEscape when Escape is pressed.\n *\n * @param isActive - When true, focus trap is enabled.\n * @param options - Optional callbacks and container ref.\n */\nexport const useFocusTrap = (isActive: boolean, options: UseFocusTrapOptions = {}) => {\n const { onEscape, containerRef } = options\n const previousFocusRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!isActive) return\n\n // Store the currently focused element before we move focus\n previousFocusRef.current = document.activeElement as HTMLElement\n\n const container = containerRef?.current || document.body\n\n // Selectors for all focusable elements\n const focusableSelectors = [\n 'a[href]',\n 'button:not([disabled])',\n 'textarea:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n '[contenteditable=\"true\"]'\n ].join(', ')\n\n const getFocusableElements = () => {\n return Array.from(container.querySelectorAll<HTMLElement>(focusableSelectors)).filter(\n (el) => {\n // Ensure element is visible and not disabled/inert\n const style = window.getComputedStyle(el)\n const isVisible = style.visibility !== 'hidden' && style.display !== 'none' && el.offsetParent !== null\n return isVisible && !el.hasAttribute('disabled') && !el.hasAttribute('inert')\n }\n )\n }\n\n const focusableElements = getFocusableElements()\n\n // If there are focusable elements, focus the first one\n if (focusableElements.length > 0) {\n focusableElements[0].focus()\n }\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && onEscape) {\n onEscape()\n return\n }\n\n if (e.key === 'Tab') {\n if (focusableElements.length === 0) return\n\n const first = focusableElements[0]\n const last = focusableElements[focusableElements.length - 1]\n\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault()\n last.focus()\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault()\n first.focus()\n }\n }\n }\n }\n\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n // Restore focus to the element that was focused before activation\n if (previousFocusRef.current) {\n previousFocusRef.current.focus()\n }\n }\n }, [isActive, onEscape, containerRef])\n}\n","import React, { useState, useEffect, useRef, useMemo } from 'react'\nimport { Search, X, Plus } from 'lucide-react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { useModalStore } from '../store/modalStore'\nimport { useEditorBlocks } from '../context/BlockLibraryContext'\nimport { useTheme } from '../context/ThemeContext'\nimport { useFocusTrap } from '../hooks/useFocusTrap'\nimport { cn } from '../lib/utils'\n\n// ── Category gradient accents ─────────────────────────────────────────────────\nconst CATEGORY_GRADIENTS: Record<string, string> = {\n Layout: 'from-z-accent to-transparent',\n Content: 'from-z-accent to-transparent',\n Commerce: 'from-z-accent to-transparent',\n Media: 'from-rose-900/70 to-pink-900/40',\n Social: 'from-amber-900/70 to-orange-900/40',\n General: 'from-[#1a1a2e]/80 to-[#16213e]/60',\n}\n\nconst CATEGORY_ORDER = ['All', 'Layout', 'Content', 'Media', 'Social', 'Commerce', 'General']\n\n// ── Main Modal ────────────────────────────────────────────────────────────────\nexport const GlobalComponentPickerModal: React.FC = () => {\n const { theme } = useTheme()\n const { componentPickerOpen, componentPickerCallback, componentPickerBlocks, closeComponentPicker } = useModalStore()\n\n const BASE_LIBRARY = useEditorBlocks()\n \n const BLOCK_LIBRARY = useMemo(() => {\n if (!componentPickerBlocks || componentPickerBlocks.length === 0) return BASE_LIBRARY\n const overrideSlugs = new Set(componentPickerBlocks.map((b: any) => b.slug || b))\n return BASE_LIBRARY.filter(b => overrideSlugs.has(b.type))\n }, [BASE_LIBRARY, componentPickerBlocks])\n\n const [search, setSearch] = useState('')\n const [activeCategory, setCategory] = useState('All')\n const containerRef = useRef<HTMLDivElement>(null)\n const searchRef = useRef<HTMLInputElement>(null)\n\n // Reset state when closed\n useEffect(() => {\n if (!componentPickerOpen) {\n setSearch('')\n setCategory('All')\n } else {\n // Auto-focus search when opened\n setTimeout(() => searchRef.current?.focus(), 80)\n }\n }, [componentPickerOpen])\n\n useFocusTrap(componentPickerOpen, {\n containerRef,\n onEscape: closeComponentPicker,\n })\n\n // Derive visible categories from library\n const categories = useMemo(() => {\n const cats = new Set(BLOCK_LIBRARY.map((b) => b.category || 'General'))\n return CATEGORY_ORDER.filter((c) => c === 'All' || cats.has(c))\n }, [BLOCK_LIBRARY])\n\n // Filter blocks\n const filtered = useMemo(() => {\n const q = search.toLowerCase().trim()\n return BLOCK_LIBRARY.filter((b) => {\n const matchSearch =\n !q ||\n b.title.toLowerCase().includes(q) ||\n b.type.toLowerCase().includes(q) ||\n b.description.toLowerCase().includes(q)\n const matchCat = activeCategory === 'All' || (b.category || 'General') === activeCategory\n return matchSearch && matchCat\n })\n }, [BLOCK_LIBRARY, search, activeCategory])\n\n // Group filtered blocks by category\n const grouped = useMemo(() => {\n if (activeCategory !== 'All') return { [activeCategory]: filtered }\n const g: Record<string, typeof filtered> = {}\n filtered.forEach((b) => {\n const cat = b.category || 'General'\n if (!g[cat]) g[cat] = []\n g[cat].push(b)\n })\n return g\n }, [filtered, activeCategory])\n\n const handleSelect = (blockType: string) => {\n componentPickerCallback?.(blockType)\n closeComponentPicker()\n }\n\n const isDark = theme === 'dark'\n\n return (\n <AnimatePresence>\n {componentPickerOpen && (\n <div className=\"fixed inset-0 z-[900] flex items-center justify-center p-4 md:p-8\">\n {/* Backdrop */}\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.18 }}\n onClick={closeComponentPicker}\n className=\"absolute inset-0 bg-app/75 backdrop-blur-md\"\n />\n\n {/* Modal */}\n <motion.div\n ref={containerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Add a Component\"\n initial={{ opacity: 0, scale: 0.96, y: 16 }}\n animate={{ opacity: 1, scale: 1, y: 0 }}\n exit={{ opacity: 0, scale: 0.96, y: 16 }}\n transition={{ duration: 0.2, ease: [0.4, 0, 0.2, 1] }}\n className={cn(\n 'relative w-full max-w-3xl flex flex-col overflow-hidden rounded-none-none shadow-sm max-h-[90vh] border',\n isDark\n ? 'bg-[#08080a] border-z-border'\n : 'bg-z-panel border-z-border'\n )}\n style={{\n backdropFilter: 'blur(12px)',\n WebkitBackdropFilter: 'blur(12px)',\n }}\n >\n {/* Accent top bar */}\n <div className=\"absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-z-accent/70 to-transparent\" />\n\n {/* Header */}\n <div className={cn('px-6 pt-6 pb-4 border-b flex-shrink-0', isDark ? 'border-z-border' : 'border-z-border')}>\n <div className=\"flex items-start justify-between mb-5\">\n <div>\n <p className=\"text-sm font-semibold text-z-active-text mb-1.5\">\n Zenith Page Builder\n </p>\n <h3 className={cn('text-2xl font-semibold', isDark ? 'text-z-primary' : 'text-z-primary')}>\n Add a Component\n </h3>\n <p className={cn('text-sm mt-1', isDark ? 'text-z-muted' : 'text-z-secondary')}>\n Choose a component to add to your layout\n </p>\n </div>\n <button\n type=\"button\"\n onClick={closeComponentPicker}\n aria-label=\"Close component picker\"\n className={cn(\n 'w-9 h-9 flex items-center justify-center border rounded-none-none transition-all flex-shrink-0 mt-0.5',\n isDark\n ? 'bg-z-hover border-z-border text-z-primary hover:bg-z-panel hover:text-z-primary'\n : 'bg-[var(--z-bg-hover)] border-z-border text-z-primary hover:bg-app hover:text-z-primary'\n )}\n >\n <X size={15} />\n </button>\n </div>\n\n {/* Search */}\n <div className=\"relative mb-4\">\n <Search\n size={13}\n className={cn('absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none', isDark ? 'text-z-secondary' : 'text-z-muted')}\n />\n <input\n ref={searchRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search components...\"\n className={cn(\n 'w-full pl-10 pr-10 py-2.5 text-sm rounded-none-none border transition-all outline-none focus-visible:ring-2 focus-visible:ring-z-active-border focus-visible:ring-offset-1 focus-visible:ring-offset-black',\n isDark\n ? 'bg-z-hover border-z-border text-z-primary placeholder:text-z-muted focus:border-z-accent/40 focus:bg-z-panel/[0.06]'\n : 'bg-z-input border-z-border text-z-primary placeholder:text-z-muted focus:border-z-active-border'\n )}\n />\n {search && (\n <button\n onClick={() => setSearch('')}\n className={cn(\n 'absolute right-3 top-1/2 -translate-y-1/2 transition-colors',\n isDark ? 'text-z-secondary hover:text-z-primary' : 'text-z-muted hover:text-z-primary'\n )}\n >\n <X size={12} />\n </button>\n )}\n </div>\n\n {/* Category Tabs */}\n <div className=\"flex gap-1.5 overflow-x-auto no-scrollbar\">\n {categories.map((cat) => (\n <button\n key={cat}\n type=\"button\"\n onClick={() => setCategory(cat)}\n className={cn(\n 'px-3 py-1.5 text-sm font-semibold whitespace-nowrap flex-shrink-0 transition-all rounded-none-none border',\n activeCategory === cat\n ? 'bg-z-accent border-z-accent text-z-primary shadow-sm'\n : isDark\n ? 'bg-z-hover border-z-border text-z-muted hover:text-z-primary hover:border-z-active-border'\n : 'bg-z-input border-z-border text-z-secondary hover:text-z-primary hover:border-z-active-border/50'\n )}\n >\n {cat}\n </button>\n ))}\n </div>\n </div>\n\n {/* Grid */}\n <div className=\"overflow-y-auto flex-1 p-6 space-y-8 custom-editor-scrollbar\">\n {Object.keys(grouped).length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-16 gap-3 text-center\">\n <Search size={28} className={isDark ? 'text-z-primary' : 'text-z-secondary'} />\n <p className={cn('text-sm font-bold', isDark ? 'text-z-muted' : 'text-z-secondary')}>\n No results for \"{search}\"\n </p>\n <p className={cn('text-xs', isDark ? 'text-z-secondary' : 'text-z-muted')}>\n Try a different keyword or browse all categories\n </p>\n </div>\n ) : (\n Object.entries(grouped).map(([category, blocks]) => (\n <div key={category}>\n {activeCategory === 'All' && (\n <div className=\"flex items-center gap-3 mb-4\">\n <span className={cn('h-px flex-1', isDark ? 'bg-z-hover' : 'bg-[var(--z-bg-hover)]')} />\n <span className={cn('text-sm font-semibold ', isDark ? 'text-z-secondary' : 'text-z-muted')}>\n {category}\n </span>\n <span className={cn('h-px flex-1', isDark ? 'bg-z-hover' : 'bg-[var(--z-bg-hover)]')} />\n </div>\n )}\n <div className=\"grid grid-cols-2 sm:grid-cols-3 gap-3\">\n {blocks.map((block) => {\n const Icon = block.icon\n const grad = CATEGORY_GRADIENTS[block.category || 'General'] ?? CATEGORY_GRADIENTS.General\n return (\n <motion.button\n key={block.type}\n type=\"button\"\n whileHover={{ scale: 1.02 }}\n whileTap={{ scale: 0.97 }}\n onClick={() => handleSelect(block.type)}\n className={cn(\n 'flex flex-col text-left group border overflow-hidden rounded-none-none transition-all',\n isDark\n ? 'bg-z-panel border-z-border hover:border-z-accent/50 hover:shadow-sm'\n : 'bg-z-panel border-z-border hover:border-z-active-border hover:shadow-sm'\n )}\n >\n {/* Preview area */}\n <div className={cn('w-full h-20 flex items-center justify-center relative bg-gradient-to-br', grad)}>\n <div className=\"text-z-primary/30 group-hover:text-z-primary/70 transition-colors duration-300\" style={{ transform: 'scale(2.5)' }}>\n <Icon size={16} />\n </div>\n {block.category && (\n <span className=\"absolute top-2 left-2 px-1.5 py-0.5 text-sm font-semibold bg-app/50 backdrop-blur text-z-primary/80 rounded-none-none\">\n {block.category}\n </span>\n )}\n <div className=\"absolute bottom-0 right-0 p-1.5 opacity-0 group-hover:opacity-100 transition-opacity\">\n <div className=\"w-5 h-5 bg-z-accent flex items-center justify-center rounded-none-none\">\n <Plus size={10} className=\"text-z-primary\" />\n </div>\n </div>\n </div>\n\n {/* Info */}\n <div className={cn('p-3 flex-1 transition-colors', isDark ? 'group-hover:opacity-90/5' : 'group-hover:bg-z-active-bg/50')}>\n <p className={cn('text-sm font-semibold italic mb-0.5', isDark ? 'text-z-primary' : 'text-z-primary')}>\n {block.title}\n </p>\n <p className={cn('text-sm leading-relaxed line-clamp-2', isDark ? 'text-z-secondary' : 'text-z-muted')}>\n {block.description}\n </p>\n </div>\n </motion.button>\n )\n })}\n </div>\n </div>\n ))\n )}\n </div>\n\n {/* Footer */}\n <div className={cn('px-6 py-3 border-t flex items-center justify-between flex-shrink-0', isDark ? 'border-z-border bg-z-panel' : 'border-z-border bg-[var(--z-bg-input)]/50')}>\n <p className={cn('text-sm', isDark ? 'text-z-secondary' : 'text-z-muted')}>\n {filtered.length} component{filtered.length !== 1 ? 's' : ''} available\n </p>\n <p className={cn('text-sm', isDark ? 'text-z-secondary' : 'text-z-muted')}>\n Press{' '}\n <kbd className={cn('px-1.5 py-0.5 font-mono rounded-none-none text-sm border', isDark ? 'bg-z-hover border-z-border' : 'bg-z-panel border-z-border')}>\n Esc\n </kbd>{' '}\n to close\n </p>\n </div>\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n )\n}\n\nexport default GlobalComponentPickerModal\n","import React from 'react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { AlertTriangle, X } from 'lucide-react'\nimport { useTheme } from '../../../context/ThemeContext'\nimport { cn } from '../../../lib/utils'\nimport { useFocusTrap } from '../../../hooks/useFocusTrap'\nimport { useRef } from 'react'\n\ninterface ConfirmDialogProps {\n open: boolean\n title: string\n message: string\n confirmLabel?: string\n danger?: boolean\n onConfirm: () => void\n onCancel: () => void\n}\n\nexport const ConfirmDialog: React.FC<ConfirmDialogProps> = ({\n open,\n title,\n message,\n confirmLabel = 'Confirm',\n danger = false,\n onConfirm,\n onCancel,\n}) => {\n const { theme } = useTheme()\n const dialogRef = useRef<HTMLDivElement>(null)\n useFocusTrap(open, { onEscape: onCancel, containerRef: dialogRef })\n const dark = theme === 'dark'\n\n return (\n <AnimatePresence>\n {open && (\n <div\n className=\"fixed inset-0 z-[900] flex items-center justify-center bg-[var(--z-bg-modal)] backdrop-blur-sm\"\n onClick={(e) => { if (e.target === e.currentTarget) onCancel() }}\n >\n <motion.div\n ref={dialogRef}\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-label={title}\n initial={{ opacity: 0, scale: 0.95, y: 10 }}\n animate={{ opacity: 1, scale: 1, y: 0 }}\n exit={{ opacity: 0, scale: 0.95, y: 10 }}\n transition={{ duration: 0.15 }}\n className={cn(\n 'w-full max-w-sm border rounded-none-none shadow-2xl p-5',\n dark\n ? 'bg-app border-z-border text-z-primary'\n : 'bg-z-panel border-z-border text-z-primary'\n )}\n >\n <div className=\"flex items-start gap-3\">\n <div className={cn(\n 'w-9 h-9 rounded-none-none border flex items-center justify-center shrink-0',\n danger\n ? dark ? 'bg-rose-500/10 border-rose-500/20 text-rose-400' : 'bg-rose-50 border-rose-200 text-rose-500'\n : dark ? 'bg-amber-500/10 border-amber-500/20 text-amber-400' : 'bg-amber-50 border-amber-200 text-amber-500'\n )}>\n <AlertTriangle size={16} />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"text-sm font-semibold\">{title}</h3>\n <p className={cn('text-xs font-bold mt-1.5 leading-relaxed', dark ? 'text-z-muted' : 'text-z-secondary')}>\n {message}\n </p>\n </div>\n <button\n onClick={onCancel}\n aria-label=\"Cancel\"\n className={cn('shrink-0 p-1 transition-colors', dark ? 'text-z-secondary hover:text-z-primary' : 'text-z-muted hover:text-z-primary')}\n >\n <X size={14} />\n </button>\n </div>\n <div className=\"flex gap-2 mt-4\">\n <button\n onClick={onCancel}\n aria-label=\"Cancel action\"\n className={cn(\n 'flex-1 py-2 text-xs font-semibold border rounded-none-none transition-all',\n dark\n ? 'border-z-border text-z-muted hover:border-z-border hover:text-z-primary'\n : 'border-z-border text-z-secondary hover:border-z-border-strong hover:text-z-primary'\n )}\n >\n Cancel\n </button>\n <button\n onClick={onConfirm}\n aria-label={confirmLabel}\n className={cn(\n 'flex-1 py-2 text-xs font-semibold rounded-none-none transition-all',\n danger\n ? 'bg-rose-600 hover:bg-rose-500 text-z-primary'\n : 'bg-z-accent hover:bg-z-border text-z-primary'\n )}\n >\n {confirmLabel}\n </button>\n </div>\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n )\n}\n\nexport default ConfirmDialog\n","import React from 'react'\nimport { useConfirmStore } from '../store/confirmStore'\nimport { ConfirmDialog } from '../pages/editor/components/ConfirmDialog'\nimport { useShallow } from 'zustand/react/shallow'\n\nexport const GlobalConfirmDialog: React.FC = () => {\n const { isOpen, title, message, confirmText, variant, close } = useConfirmStore(useShallow(state => ({ isOpen: state.isOpen, title: state.title, message: state.message, confirmText: state.confirmText, variant: state.variant, close: state.close })))\n\n return (\n <ConfirmDialog\n open={isOpen}\n title={title}\n message={message}\n confirmLabel={confirmText}\n danger={variant === 'danger'}\n onConfirm={() => close(true)}\n onCancel={() => close(false)}\n />\n )\n}\n","import React, { useEffect, useState, lazy, Suspense } from 'react'\nimport type { ReactNode } from 'react'\n\n// ── Global error boundary — prevents white-screen crashes ─────────────────────\nclass ErrorBoundary extends React.Component<\n { children: ReactNode; fallback?: ReactNode },\n { hasError: boolean }\n> {\n constructor(props: { children: ReactNode; fallback?: ReactNode }) {\n super(props)\n this.state = { hasError: false }\n }\n static getDerivedStateFromError() {\n return { hasError: true }\n }\n render() {\n if (this.state.hasError) {\n return this.props.fallback ?? (\n <div className=\"min-h-screen flex flex-col items-center justify-center bg-app gap-6 p-8\">\n <div className=\"text-[80px] leading-none select-none text-z-primary/5 font-semibold font-mono\">\n 500\n </div>\n <p className=\"text-sm font-semibold text-red-500/60\">\n Unexpected Error\n </p>\n <p className=\"text-sm text-z-secondary font-bold\">\n An unexpected error occurred. Please refresh the page or contact support.\n </p>\n <button\n onClick={() => window.location.reload()}\n className=\"mt-4 px-6 py-2 border border-z-border text-sm font-semibold hover:border-red-500/30 hover:text-red-400 transition-all\"\n >\n Reload\n </button>\n </div>\n )\n }\n return this.props.children\n }\n}\nimport { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom'\n\nimport { useAuthStore } from './store/authStore'\nimport DashboardLayout from './layouts/DashboardLayout'\nimport LoginPage from './pages/LoginPage'\nimport ForgotPasswordPage from './pages/ForgotPasswordPage'\nimport ResetPasswordPage from './pages/ResetPasswordPage'\nimport SitePicker from './pages/SitePicker'\nimport CollectionList from './pages/CollectionList'\nimport { Cpu, Loader2 } from 'lucide-react'\nimport { Toaster } from 'react-hot-toast'\nimport api from './lib/api'\nimport { ThemeProvider } from './context/ThemeContext'\nimport { BrandProvider } from './context/BrandContext'\nimport { BlockLibraryProvider } from './context/BlockLibraryContext'\nimport { GlobalComponentPickerModal } from './components/GlobalComponentPickerModal'\nimport { GlobalConfirmDialog } from './components/GlobalConfirmDialog'\nimport { useShallow } from 'zustand/react/shallow'\n\n// ── Code-split page bundles ────────────────────────────────────────────────────\nconst CollectionsPage = lazy(() => import('./pages/CollectionsPage'))\nconst CollectionHooksPage = lazy(() => import('./pages/CollectionHooksPage'))\nconst AuditLogPage = lazy(() => import('./pages/AuditLogPage'))\nconst MediaLibrary = lazy(() => import('./pages/MediaLibrary'))\nconst SpatialEditor = lazy(() => import('./pages/SpatialEditor'))\nconst ComponentBuilderPage = lazy(() => import('./pages/ComponentBuilderPage'))\nconst SettingsPage = lazy(() => import('./pages/SettingsPage'))\nconst PluginsPage = lazy(() => import('./pages/PluginsPage'))\nconst SchemaBuilderPage = lazy(() => import('./pages/SchemaBuilderPage'))\nconst BlockBuilderPage = lazy(() => import('./pages/BlockBuilderPage'))\nconst DashboardBuilder = lazy(() => import('./pages/DashboardBuilder'))\nconst TemplatesPage = lazy(() => import('./pages/TemplatesPage'))\nconst SetupWizard = lazy(() => import('./pages/SetupWizard'))\nconst RedirectsPage = lazy(() => import('./pages/RedirectsPage'))\nconst TrashPage = lazy(() => import('./pages/TrashPage'))\nconst BuilderPage = lazy(() => import('./pages/BuilderPage'))\nconst ApiExplorerPage = lazy(() => import('./pages/ApiExplorerPage'))\nimport { pluginRegistry } from './lib/plugin-registry'\n\nconst PageLoader = () => (\n <div className=\"min-h-screen flex flex-col items-center justify-center bg-app gap-6\">\n <div className=\"relative flex items-center justify-center w-24 h-24\">\n <div className=\"absolute inset-0 rounded-full border-2 border-z-border border-z-border animate-spin\" />\n <Loader2 size={32} className=\"text-z-primary animate-spin opacity-50\" strokeWidth={1} style={{ animationDuration: '3s' }} />\n <div className=\"absolute inset-0 blur-3xl bg-z-panel/5 animate-pulse\" />\n </div>\n <p className=\"text-sm font-semibold text-z-primary/40 tracking-widest uppercase\">\n Loading\n </p>\n </div>\n)\n\nconst InnerPageLoader = () => (\n <div className=\"flex-1 flex flex-col items-center justify-center h-full gap-4 opacity-50\">\n <Loader2 size={28} className=\"text-z-secondary animate-spin\" strokeWidth={1.5} />\n <p className=\"text-xs font-semibold text-z-secondary uppercase tracking-wider\">Loading...</p>\n </div>\n)\n\n\n\n// Protected Route Wrapper\nconst ProtectedRoute = ({ children }: { children: React.ReactNode }) => {\n const { isAuthenticated, isLoading, checkAuth } = useAuthStore(useShallow(state => ({ isAuthenticated: state.isAuthenticated, isLoading: state.isLoading, checkAuth: state.checkAuth })))\n const [onboardingDone, setOnboardingDone] = useState<boolean | null>(null)\n const location = useLocation()\n\n useEffect(() => {\n checkAuth()\n }, [checkAuth])\n\n useEffect(() => {\n if (!isAuthenticated) return\n api\n .get('/system/onboarding')\n .then((r) => setOnboardingDone(!!r.data?.data?.completed))\n .catch(() => setOnboardingDone(true)) // fail open\n }, [isAuthenticated])\n\n if (isLoading || (isAuthenticated && onboardingDone === null)) {\n return (\n <div className=\"min-h-screen flex flex-col items-center justify-center bg-app gap-6\">\n <div className=\"relative flex items-center justify-center w-24 h-24\">\n <div className=\"absolute inset-0 rounded-full border-2 border-z-border border-z-border animate-spin\" />\n <Loader2 size={32} className=\"text-z-primary animate-spin opacity-50\" strokeWidth={1} style={{ animationDuration: '3s' }} />\n <div className=\"absolute inset-0 blur-3xl bg-z-panel/5 animate-pulse\"></div>\n </div>\n <p className=\"text-sm font-semibold text-z-primary/40 tracking-widest uppercase\">\n Initializing System\n </p>\n </div>\n )\n }\n\n if (!isAuthenticated) return <Navigate to=\"/login\" state={{ from: location }} replace />\n\n // Show wizard if onboarding incomplete (but not if already on /setup)\n if (!onboardingDone && location.pathname !== '/setup') {\n return <Navigate to=\"/setup\" replace />\n }\n\n // Ensure active site workspace is selected if onboarding is done\n const activeWorkspaceId = localStorage.getItem('activeWorkspaceId')\n const activeSiteId = localStorage.getItem('activeSiteId')\n if (\n onboardingDone &&\n (!activeWorkspaceId || !activeSiteId) &&\n location.pathname !== '/sites' &&\n location.pathname !== '/setup'\n ) {\n return <Navigate to=\"/sites\" replace />\n }\n\n return <>{children}</>\n}\n\nconst App: React.FC = () => {\n return (\n <ThemeProvider>\n <BrandProvider>\n\n <BlockLibraryProvider>\n <Toaster\n position=\"bottom-right\"\n toastOptions={{\n style: {\n background: '#000',\n color: '#fff',\n border: '1px solid rgba(255,255,255,0.05)',\n fontSize: '11px',\n fontWeight: '900',\n textTransform: '',\n letterSpacing: '0.2em',\n padding: '16px 24px',\n borderRadius: '0px',\n fontStyle: '',\n },\n }}\n />\n {/* Global component picker — available from all pages */}\n <GlobalComponentPickerModal />\n <GlobalConfirmDialog />\n <BrowserRouter>\n <Routes>\n <Route path=\"/login\" element={<LoginPage />} />\n <Route path=\"/forgot-password\" element={<ForgotPasswordPage />} />\n <Route path=\"/reset-password\" element={<ResetPasswordPage />} />\n <Route\n path=\"/setup\"\n element={\n <ProtectedRoute>\n <Suspense fallback={<PageLoader />}>\n <SetupWizard />\n </Suspense>\n </ProtectedRoute>\n }\n />\n <Route\n path=\"/sites\"\n element={\n <ProtectedRoute>\n <Suspense fallback={<PageLoader />}>\n <SitePicker />\n </Suspense>\n </ProtectedRoute>\n }\n />\n\n {/* Standalone Focused Spatial Architecture (No Sidebar) */}\n <Route\n path=\"/collections/:slug/new\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <Suspense fallback={<PageLoader />}>\n <SpatialEditor />\n </Suspense>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n <Route\n path=\"/collections/:slug/singleton\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <Suspense fallback={<PageLoader />}>\n <SpatialEditor />\n </Suspense>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n <Route\n path=\"/collections/:slug/:id\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <Suspense fallback={<PageLoader />}>\n <SpatialEditor />\n </Suspense>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n <Route\n path=\"/globals/:slug\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <Suspense fallback={<PageLoader />}>\n <SpatialEditor isGlobal />\n </Suspense>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n <Route\n path=\"/globals/:slug/:id\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <Suspense fallback={<PageLoader />}>\n <SpatialEditor isGlobal />\n </Suspense>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n\n {/* ️ Standard Operational Routes (Wrapped in DashboardLayout) */}\n <Route\n path=\"/*\"\n element={\n <ProtectedRoute>\n <ErrorBoundary>\n <DashboardLayout>\n <Suspense fallback={<InnerPageLoader />}>\n <Routes>\n <Route path=\"/\" element={<DashboardBuilder />} />\n <Route path=\"/collections\" element={<CollectionsPage />} />\n <Route path=\"/collections/:slug\" element={<CollectionList />} />\n <Route path=\"/collections/:slug/hooks\" element={<CollectionHooksPage />} />\n <Route path=\"/audit-log\" element={<AuditLogPage />} />\n <Route path=\"/media\" element={<MediaLibrary />} />\n <Route\n path=\"/members\"\n element={<Navigate to=\"/collections/members\" replace />}\n />\n <Route path=\"/templates\" element={<TemplatesPage />} />\n <Route path=\"/plugins\" element={<PluginsPage />} />\n <Route path=\"/schema-builder\" element={<SchemaBuilderPage />} />\n <Route path=\"/block-builder\" element={<BlockBuilderPage />} />\n <Route path=\"/settings\" element={<SettingsPage />} />\n <Route path=\"/api-explorer\" element={<ApiExplorerPage />} />\n <Route path=\"/redirects\" element={<RedirectsPage />} />\n <Route path=\"/trash\" element={<TrashPage />} />\n <Route path=\"/component-builder\" element={<ComponentBuilderPage />} />\n {/* ── Plugin-injected routes (seamlessly added after pnpm install) ── */}\n {pluginRegistry.getRoutes().map((route) => {\n const PluginPage = lazy(route.component)\n return (\n <Route\n key={route.path}\n path={route.path}\n element={\n <Suspense fallback={<InnerPageLoader />}>\n <PluginPage />\n </Suspense>\n }\n />\n )\n })}\n <Route path=\"*\" element={<Navigate to=\"/\" replace />} />\n </Routes>\n </Suspense>\n </DashboardLayout>\n </ErrorBoundary>\n </ProtectedRoute>\n }\n />\n </Routes>\n </BrowserRouter>\n </BlockLibraryProvider>\n\n </BrandProvider>\n </ThemeProvider>\n )\n}\n\nexport default App\n","import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App.tsx'\nimport './index.css'\nimport api from './lib/api'\nimport './lib/plugin-registry'\n\nasync function bootstrap() {\n try {\n const res = await api.get('/system/plugins')\n const plugins = res.data?.data || []\n \n // Inject plugin scripts\n for (const plugin of plugins) {\n if (plugin.enabled && plugin.config?.url) {\n console.log(`[Zenith] Loading Plugin: ${plugin.name} (${plugin.config.url})`)\n await new Promise((resolve, reject) => {\n const script = document.createElement('script')\n script.type = 'module'\n script.src = plugin.config.url\n script.onload = resolve\n script.onerror = () => {\n console.error(`[Zenith] Failed to load plugin script: ${plugin.config.url}`)\n resolve(null) // Resolve anyway to not block app boot\n }\n document.head.appendChild(script)\n })\n }\n }\n } catch (err) {\n console.error('[Zenith] Failed to fetch system plugins at boot', err)\n }\n\n ReactDOM.createRoot(document.getElementById('root')!).render(\n <React.StrictMode>\n <App />\n </React.StrictMode>\n )\n}\n\nbootstrap()\n"],"file":"index-ChcKY5Xe.js"}