admin-lib-cms 1.2.0 → 1.2.1

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.
package/dist/index.mjs CHANGED
@@ -422,14 +422,14 @@ function useSubmit(formId) {
422
422
 
423
423
  // src/editable.tsx
424
424
  import { createElement, useEffect as useEffect3 } from "react";
425
- import { jsx as jsx4 } from "react/jsx-runtime";
426
- function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength) {
425
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
426
+ function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search) {
427
427
  const ctx = useCmsOptional();
428
428
  useEffect3(() => {
429
429
  if (!ctx) return;
430
- ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength });
430
+ ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search });
431
431
  return () => ctx.unregisterEditable(id);
432
- }, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength]);
432
+ }, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search]);
433
433
  return ctx;
434
434
  }
435
435
  function editableClasses(active, selected) {
@@ -452,6 +452,8 @@ function EditableText({
452
452
  const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? "") : children;
453
453
  const active = !!ctx?.editMode;
454
454
  const selected = ctx?.selectedId === id;
455
+ const isEmpty = !value || String(value).trim() === "";
456
+ const renderValue = active && isEmpty ? `[Empty: ${label || id}]` : value;
455
457
  const onClick = (e) => {
456
458
  if (!active || !ctx) return;
457
459
  e.preventDefault();
@@ -461,11 +463,15 @@ function EditableText({
461
463
  return createElement(
462
464
  as,
463
465
  {
464
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
466
+ className: [
467
+ className,
468
+ editableClasses(active, selected),
469
+ active && isEmpty ? "opacity-50" : ""
470
+ ].filter(Boolean).join(" "),
465
471
  "data-cms-id": id,
466
472
  onClick: active ? onClick : void 0
467
473
  },
468
- value
474
+ renderValue
469
475
  );
470
476
  }
471
477
  function EditableImage({
@@ -578,6 +584,9 @@ function EditableLink({
578
584
  const isExternal = hrefValue.startsWith("http");
579
585
  const computedTarget = target || (isExternal ? "_blank" : void 0);
580
586
  const computedRel = computedTarget === "_blank" ? "noopener noreferrer" : void 0;
587
+ const content = typeof children !== "undefined" ? children : textValue;
588
+ const isEmpty = !content || String(content).trim() === "";
589
+ const renderContent = active && isEmpty ? `[Empty Link: ${label || id}]` : content;
581
590
  return /* @__PURE__ */ jsx4(
582
591
  "a",
583
592
  {
@@ -586,8 +595,12 @@ function EditableLink({
586
595
  rel: computedRel,
587
596
  "data-cms-id": id,
588
597
  onClick: active ? onClick : void 0,
589
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
590
- children: typeof children !== "undefined" ? children : textValue
598
+ className: [
599
+ className,
600
+ editableClasses(active, selected),
601
+ active && isEmpty ? "opacity-50" : ""
602
+ ].filter(Boolean).join(" "),
603
+ children: renderContent
591
604
  }
592
605
  );
593
606
  }
@@ -602,9 +615,10 @@ function EditableList({
602
615
  itemSchema,
603
616
  fixedLength,
604
617
  className,
605
- listClassName
618
+ listClassName,
619
+ search
606
620
  }) {
607
- const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength);
621
+ const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength, search);
608
622
  const rawValue = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : initialItems;
609
623
  const value = Array.isArray(rawValue) ? rawValue : initialItems;
610
624
  const active = !!ctx?.editMode;
@@ -615,13 +629,20 @@ function EditableList({
615
629
  e.stopPropagation();
616
630
  ctx.setSelectedId(id);
617
631
  };
618
- return /* @__PURE__ */ jsx4(
632
+ return /* @__PURE__ */ jsxs3(
619
633
  "div",
620
634
  {
621
635
  "data-cms-id": id,
622
636
  onClick: active ? onClick : void 0,
623
637
  className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
624
- children: renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) })
638
+ children: [
639
+ renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) }),
640
+ active && value.length === 0 && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
641
+ "Empty List ",
642
+ label ? `(${label})` : "",
643
+ " \u2014 Click to add items"
644
+ ] })
645
+ ]
625
646
  }
626
647
  );
627
648
  }
@@ -657,7 +678,7 @@ import {
657
678
  ExternalLink as ExternalLink2
658
679
  } from "lucide-react";
659
680
  import { CreditCard as CreditCard2 } from "lucide-react";
660
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
681
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
661
682
  async function handleImageFile(file, onUrl, uploadImage) {
662
683
  if (uploadImage) {
663
684
  try {
@@ -704,7 +725,7 @@ function AdminAppContent() {
704
725
  const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
705
726
  const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
706
727
  if (authChecking) {
707
- return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
728
+ return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
708
729
  /* @__PURE__ */ jsx5("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
709
730
  "Authenticating Admin..."
710
731
  ] }) });
@@ -715,23 +736,23 @@ function AdminAppContent() {
715
736
  if (!isSubscriptionActive) {
716
737
  return /* @__PURE__ */ jsx5("div", { className: "flex flex-col lg:flex-row h-screen w-full overflow-hidden bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900", children: /* @__PURE__ */ jsx5(SubscriptionPage, {}) });
717
738
  }
718
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
739
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
719
740
  daysOverdue > 0 && daysOverdue <= 15 && /* @__PURE__ */ jsx5("div", { className: "bg-amber-400 text-amber-950 px-4 py-2.5 text-center text-sm font-semibold shadow-sm z-50", children: "Your account has an overdue balance. Please update your payment." }),
720
741
  daysOverdue > 15 && daysOverdue < 30 && /* @__PURE__ */ jsx5("div", { className: "bg-rose-600 text-white px-4 py-2.5 text-center text-sm font-bold shadow-sm z-50", children: "Attention: If you do not settle your balance, your account will be suspended soon." }),
721
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
722
- /* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
742
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
743
+ /* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
723
744
  ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
724
745
  /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
725
746
  ] }) }),
726
- /* @__PURE__ */ jsxs3("aside", { className: "flex w-full lg:w-64 shrink-0 flex-col border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/80 backdrop-blur-xl shadow-sm z-10 overflow-hidden", children: [
727
- /* @__PURE__ */ jsxs3("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
728
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 mb-1", children: [
747
+ /* @__PURE__ */ jsxs4("aside", { className: "flex w-full lg:w-64 shrink-0 flex-col border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/80 backdrop-blur-xl shadow-sm z-10 overflow-hidden", children: [
748
+ /* @__PURE__ */ jsxs4("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
749
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-1", children: [
729
750
  ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
730
751
  /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
731
752
  ] }),
732
753
  /* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
733
754
  ] }),
734
- /* @__PURE__ */ jsxs3("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: [
755
+ /* @__PURE__ */ jsxs4("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: [
735
756
  /* @__PURE__ */ jsx5(
736
757
  SideItem,
737
758
  {
@@ -787,12 +808,12 @@ function AdminAppContent() {
787
808
  }
788
809
  )
789
810
  ] }),
790
- /* @__PURE__ */ jsxs3("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
791
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
811
+ /* @__PURE__ */ jsxs4("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
812
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
792
813
  /* @__PURE__ */ jsx5("span", { children: "Storage Adapter" }),
793
814
  /* @__PURE__ */ jsx5("span", { className: "font-semibold px-2 py-0.5 rounded-full bg-slate-200 text-slate-700", children: ctx.adapter.name })
794
815
  ] }),
795
- /* @__PURE__ */ jsxs3(
816
+ /* @__PURE__ */ jsxs4(
796
817
  "button",
797
818
  {
798
819
  onClick: async () => {
@@ -808,7 +829,7 @@ function AdminAppContent() {
808
829
  )
809
830
  ] })
810
831
  ] }),
811
- /* @__PURE__ */ jsxs3("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
832
+ /* @__PURE__ */ jsxs4("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
812
833
  section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
813
834
  section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
814
835
  section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
@@ -825,7 +846,7 @@ function SideItem({
825
846
  icon,
826
847
  children
827
848
  }) {
828
- return /* @__PURE__ */ jsxs3(
849
+ return /* @__PURE__ */ jsxs4(
829
850
  "button",
830
851
  {
831
852
  onClick,
@@ -837,24 +858,80 @@ function SideItem({
837
858
  }
838
859
  );
839
860
  }
861
+ function PageListItem({
862
+ p,
863
+ selected,
864
+ onSelect,
865
+ depth = 0
866
+ }) {
867
+ const [expanded, setExpanded] = useState4(false);
868
+ if (p.isSeparator) {
869
+ return /* @__PURE__ */ jsx5("li", { className: "my-2 border-t border-slate-200/60" });
870
+ }
871
+ const hasChildren = p.children && p.children.length > 0;
872
+ const isSelected = selected?.id === p.id;
873
+ const hasSelectedChild = hasChildren && p.children?.some((child) => child.id === selected?.id);
874
+ useEffect4(() => {
875
+ if (hasSelectedChild) {
876
+ setExpanded(true);
877
+ }
878
+ }, [hasSelectedChild]);
879
+ return /* @__PURE__ */ jsxs4("li", { className: "shrink-0 lg:w-full", children: [
880
+ /* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
881
+ "button",
882
+ {
883
+ onClick: () => {
884
+ if (hasChildren) {
885
+ setExpanded(!expanded);
886
+ }
887
+ if (p.path || !hasChildren) {
888
+ onSelect(p);
889
+ }
890
+ },
891
+ className: `flex-1 w-full rounded-lg py-2.5 text-left text-sm transition-all duration-200 ${depth === 0 ? "px-3" : "px-3 ml-2"} ${isSelected ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
892
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
893
+ /* @__PURE__ */ jsx5(
894
+ "div",
895
+ {
896
+ className: `truncate ${isSelected ? "text-slate-900" : "text-slate-700"}`,
897
+ children: p.name
898
+ }
899
+ ),
900
+ hasChildren && /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx5(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx5(ChevronDown, { size: 14 }) })
901
+ ] })
902
+ }
903
+ ) }),
904
+ hasChildren && expanded && /* @__PURE__ */ jsx5("ul", { className: `mt-1 space-y-1 ${depth === 0 ? "ml-4 border-l-2 border-slate-100 pl-1" : "ml-2"}`, children: p.children.map((child) => /* @__PURE__ */ jsx5(
905
+ PageListItem,
906
+ {
907
+ p: child,
908
+ selected,
909
+ onSelect,
910
+ depth: depth + 1
911
+ },
912
+ child.id
913
+ )) })
914
+ ] });
915
+ }
840
916
  function PagesSection() {
841
917
  const ctx = useCmsContext();
842
918
  const [selected, setSelected] = useState4(
843
919
  ctx.config.pages[0] ?? null
844
920
  );
845
921
  const [showList, setShowList] = useState4(true);
846
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row h-full", children: [
847
- showList && /* @__PURE__ */ jsxs3("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
922
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
923
+ showList && /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
848
924
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
849
- /* @__PURE__ */ jsxs3("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
850
- ctx.config.pages.map((p) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
851
- "button",
925
+ /* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
926
+ ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
927
+ PageListItem,
852
928
  {
853
- onClick: () => setSelected(p),
854
- className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selected?.id === p.id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
855
- children: /* @__PURE__ */ jsx5("div", { className: `truncate ${selected?.id === p.id ? "text-slate-900" : "text-slate-700"}`, children: p.name })
856
- }
857
- ) }, p.id)),
929
+ p,
930
+ selected,
931
+ onSelect: setSelected
932
+ },
933
+ p.id
934
+ )),
858
935
  ctx.config.pages.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No pages registered." })
859
936
  ] })
860
937
  ] }),
@@ -917,21 +994,21 @@ function PageEditor({ page, showList, onToggleList }) {
917
994
  );
918
995
  const selectedMeta = registered.find((r) => r.id === selectedId) ?? null;
919
996
  const [viewMode, setViewMode] = useState4("desktop");
920
- return /* @__PURE__ */ jsxs3("div", { className: "flex h-full flex-col", children: [
921
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-slate-200 bg-white/80 backdrop-blur px-4 py-3 shadow-sm z-10 shrink-0", children: [
922
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
997
+ return /* @__PURE__ */ jsxs4("div", { className: "flex h-full flex-col", children: [
998
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-slate-200 bg-white/80 backdrop-blur px-4 py-3 shadow-sm z-10 shrink-0", children: [
999
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
923
1000
  /* @__PURE__ */ jsx5("button", { onClick: onToggleList, className: "text-slate-400 hover:text-slate-700 p-1 hidden lg:block", title: "Toggle Pages Menu", children: showList ? /* @__PURE__ */ jsx5(PanelLeftClose, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx5(PanelLeftOpen, { className: "w-5 h-5" }) }),
924
1001
  /* @__PURE__ */ jsx5("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
925
1002
  /* @__PURE__ */ jsx5("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
926
1003
  /* @__PURE__ */ jsx5("span", { className: "text-slate-500 font-mono text-[10px] md:text-xs bg-slate-100 px-2 py-1 rounded hidden sm:inline-block", children: page.path })
927
1004
  ] }),
928
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 overflow-x-auto w-full sm:w-auto pb-1 sm:pb-0 hide-scrollbar shrink-0", children: [
929
- /* @__PURE__ */ jsxs3("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
1005
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 overflow-x-auto w-full sm:w-auto pb-1 sm:pb-0 hide-scrollbar shrink-0", children: [
1006
+ /* @__PURE__ */ jsxs4("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
930
1007
  /* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("desktop"), className: `p-1.5 rounded-md transition-all ${viewMode === "desktop" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Desktop View", children: /* @__PURE__ */ jsx5(Monitor, { className: "w-4 h-4" }) }),
931
1008
  /* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("tablet"), className: `p-1.5 rounded-md transition-all ${viewMode === "tablet" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Tablet View", children: /* @__PURE__ */ jsx5(Tablet, { className: "w-4 h-4" }) }),
932
1009
  /* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("mobile"), className: `p-1.5 rounded-md transition-all ${viewMode === "mobile" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Mobile View", children: /* @__PURE__ */ jsx5(Smartphone, { className: "w-4 h-4" }) })
933
1010
  ] }),
934
- /* @__PURE__ */ jsxs3(
1011
+ /* @__PURE__ */ jsxs4(
935
1012
  "button",
936
1013
  {
937
1014
  onClick: () => setPreview((v) => !v),
@@ -942,7 +1019,7 @@ function PageEditor({ page, showList, onToggleList }) {
942
1019
  ]
943
1020
  }
944
1021
  ),
945
- /* @__PURE__ */ jsxs3(
1022
+ /* @__PURE__ */ jsxs4(
946
1023
  "a",
947
1024
  {
948
1025
  href: page.path,
@@ -955,7 +1032,7 @@ function PageEditor({ page, showList, onToggleList }) {
955
1032
  ]
956
1033
  }
957
1034
  ),
958
- /* @__PURE__ */ jsxs3(
1035
+ /* @__PURE__ */ jsxs4(
959
1036
  "button",
960
1037
  {
961
1038
  onClick: () => ctx.reset(),
@@ -967,7 +1044,7 @@ function PageEditor({ page, showList, onToggleList }) {
967
1044
  ]
968
1045
  }
969
1046
  ),
970
- /* @__PURE__ */ jsxs3(
1047
+ /* @__PURE__ */ jsxs4(
971
1048
  "button",
972
1049
  {
973
1050
  onClick: () => ctx.save(),
@@ -981,7 +1058,7 @@ function PageEditor({ page, showList, onToggleList }) {
981
1058
  )
982
1059
  ] })
983
1060
  ] }),
984
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
1061
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
985
1062
  /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden bg-slate-100/80 p-2 sm:p-4 flex flex-col items-center", children: /* @__PURE__ */ jsx5("div", { className: `flex-1 rounded-xl overflow-hidden border border-slate-200 bg-white shadow-lg ring-1 ring-slate-900/5 min-h-[300px] transition-all duration-300 w-full ${viewMode === "mobile" ? "max-w-[375px]" : viewMode === "tablet" ? "max-w-[768px]" : "w-full"}`, children: /* @__PURE__ */ jsx5(
986
1063
  "iframe",
987
1064
  {
@@ -992,11 +1069,11 @@ function PageEditor({ page, showList, onToggleList }) {
992
1069
  },
993
1070
  src
994
1071
  ) }) }),
995
- /* @__PURE__ */ jsxs3("aside", { className: `w-full sm:w-[320px] lg:w-[360px] shrink-0 overflow-y-auto border-t sm:border-t-0 sm:border-l border-slate-200 bg-white shadow-[-4px_0_15px_-3px_rgba(0,0,0,0.05)] z-10 hide-scrollbar transition-all duration-300 ${drawerState === "min" ? "max-h-[52px] sm:max-h-none" : drawerState === "full" ? "max-h-[85vh] sm:max-h-none" : "max-h-[50vh] sm:max-h-none"}`, children: [
996
- /* @__PURE__ */ jsxs3("div", { className: "sticky top-0 bg-white/90 backdrop-blur border-b border-slate-200 px-5 py-3 md:py-4 z-10 flex items-center justify-between", children: [
1072
+ /* @__PURE__ */ jsxs4("aside", { className: `w-full sm:w-[320px] lg:w-[360px] shrink-0 overflow-y-auto border-t sm:border-t-0 sm:border-l border-slate-200 bg-white shadow-[-4px_0_15px_-3px_rgba(0,0,0,0.05)] z-10 hide-scrollbar transition-all duration-300 ${drawerState === "min" ? "max-h-[52px] sm:max-h-none" : drawerState === "full" ? "max-h-[85vh] sm:max-h-none" : "max-h-[50vh] sm:max-h-none"}`, children: [
1073
+ /* @__PURE__ */ jsxs4("div", { className: "sticky top-0 bg-white/90 backdrop-blur border-b border-slate-200 px-5 py-3 md:py-4 z-10 flex items-center justify-between", children: [
997
1074
  /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
998
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
999
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 sm:hidden", children: [
1075
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
1076
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 sm:hidden", children: [
1000
1077
  /* @__PURE__ */ jsx5(
1001
1078
  "button",
1002
1079
  {
@@ -1019,7 +1096,7 @@ function PageEditor({ page, showList, onToggleList }) {
1019
1096
  selectedMeta && /* @__PURE__ */ jsx5("button", { onClick: () => setSelectedId(null), className: "sm:hidden text-slate-400 hover:text-slate-700 text-xs font-bold uppercase tracking-widest", children: "Close" })
1020
1097
  ] })
1021
1098
  ] }),
1022
- /* @__PURE__ */ jsxs3("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
1099
+ /* @__PURE__ */ jsxs4("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
1023
1100
  !selectedMeta && /* @__PURE__ */ jsx5("div", { className: "px-5 mt-1 mb-2", children: /* @__PURE__ */ jsx5("p", { className: "text-[10px] md:text-xs text-slate-400", children: "Select an element on the left to edit it." }) }),
1024
1101
  selectedMeta ? /* @__PURE__ */ jsx5(
1025
1102
  FieldEditor,
@@ -1041,20 +1118,38 @@ function PageEditor({ page, showList, onToggleList }) {
1041
1118
  },
1042
1119
  onClose: () => setSelectedId(null)
1043
1120
  }
1044
- ) : /* @__PURE__ */ jsx5(
1045
- SectionAccordion,
1046
- {
1047
- registered,
1048
- onSelect: (id) => {
1049
- setSelectedId(id);
1050
- setDrawerState((prev) => prev === "min" ? "half" : prev);
1051
- iframeRef.current?.contentWindow?.postMessage(
1052
- { __cms: true, type: "cms:select", id },
1053
- "*"
1054
- );
1121
+ ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1122
+ page.hideable && /* @__PURE__ */ jsxs4("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
1123
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3", children: [
1124
+ /* @__PURE__ */ jsx5(
1125
+ "input",
1126
+ {
1127
+ type: "checkbox",
1128
+ id: `page-visible-toggle-${page.id}`,
1129
+ checked: ctx.overrides[`page-${page.id}-visible`] !== false,
1130
+ onChange: (e) => updateOverride(`page-${page.id}-visible`, e.target.checked),
1131
+ className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1132
+ }
1133
+ ),
1134
+ /* @__PURE__ */ jsx5("label", { htmlFor: `page-visible-toggle-${page.id}`, className: "text-sm font-medium text-slate-800 cursor-pointer flex-1", children: "Page is Visible" })
1135
+ ] }),
1136
+ /* @__PURE__ */ jsx5("p", { className: "text-[11px] text-slate-500 mt-1.5 pl-8", children: "If unchecked, this page will be hidden from navigation and URL access." })
1137
+ ] }),
1138
+ /* @__PURE__ */ jsx5(
1139
+ SectionAccordion,
1140
+ {
1141
+ registered,
1142
+ onSelect: (id) => {
1143
+ setSelectedId(id);
1144
+ setDrawerState((prev) => prev === "min" ? "half" : prev);
1145
+ iframeRef.current?.contentWindow?.postMessage(
1146
+ { __cms: true, type: "cms:select", id },
1147
+ "*"
1148
+ );
1149
+ }
1055
1150
  }
1056
- }
1057
- )
1151
+ )
1152
+ ] })
1058
1153
  ] })
1059
1154
  ] })
1060
1155
  ] })
@@ -1066,7 +1161,7 @@ function SectionAccordion({
1066
1161
  }) {
1067
1162
  const [expanded, setExpanded] = useState4({});
1068
1163
  if (registered.length === 0) {
1069
- return /* @__PURE__ */ jsxs3("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
1164
+ return /* @__PURE__ */ jsxs4("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
1070
1165
  /* @__PURE__ */ jsx5("div", { className: "w-12 h-12 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx5(Pencil, { className: "h-5 w-5 text-slate-400" }) }),
1071
1166
  "No editable fields detected on this page."
1072
1167
  ] });
@@ -1080,19 +1175,19 @@ function SectionAccordion({
1080
1175
  const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
1081
1176
  const unsectionedFields = groups["Unsectioned"] || [];
1082
1177
  const toggle = (name) => setExpanded((prev) => ({ ...prev, [name]: !prev[name] }));
1083
- return /* @__PURE__ */ jsxs3("div", { className: "p-2 space-y-3", children: [
1178
+ return /* @__PURE__ */ jsxs4("div", { className: "p-2 space-y-3", children: [
1084
1179
  unsectionedFields.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "divide-y divide-slate-100 bg-white rounded-lg border border-slate-200 overflow-hidden shadow-sm", children: unsectionedFields.map((m) => /* @__PURE__ */ jsx5(FieldListItem, { meta: m, onSelect }, m.id)) }),
1085
1180
  sectionNames.map((sectionName) => {
1086
1181
  const isOpen = expanded[sectionName] ?? false;
1087
1182
  const fields = groups[sectionName];
1088
- return /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
1089
- /* @__PURE__ */ jsxs3(
1183
+ return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
1184
+ /* @__PURE__ */ jsxs4(
1090
1185
  "button",
1091
1186
  {
1092
1187
  onClick: () => toggle(sectionName),
1093
1188
  className: "flex w-full items-center justify-between px-3 py-2.5 bg-slate-50/80 hover:bg-slate-100 transition-colors text-left",
1094
1189
  children: [
1095
- /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2", children: [
1190
+ /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
1096
1191
  /* @__PURE__ */ jsx5("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
1097
1192
  /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-400 bg-slate-200/70 px-1.5 py-0.5 rounded-full", children: fields.length })
1098
1193
  ] }),
@@ -1116,15 +1211,15 @@ function SectionAccordion({
1116
1211
  ] });
1117
1212
  }
1118
1213
  function FieldListItem({ meta, onSelect }) {
1119
- return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs3(
1214
+ return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs4(
1120
1215
  "button",
1121
1216
  {
1122
1217
  onClick: () => onSelect(meta.id),
1123
1218
  className: "flex w-full items-center justify-between gap-2 rounded-md px-3 py-2.5 text-left hover:bg-slate-50 group transition-colors",
1124
1219
  children: [
1125
- /* @__PURE__ */ jsxs3("span", { className: "overflow-hidden", children: [
1220
+ /* @__PURE__ */ jsxs4("span", { className: "overflow-hidden", children: [
1126
1221
  /* @__PURE__ */ jsx5("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
1127
- /* @__PURE__ */ jsxs3("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1222
+ /* @__PURE__ */ jsxs4("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1128
1223
  meta.type,
1129
1224
  " ",
1130
1225
  /* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
@@ -1145,13 +1240,28 @@ function FieldEditor({
1145
1240
  onClose
1146
1241
  }) {
1147
1242
  const ctx = useCmsContext();
1148
- return /* @__PURE__ */ jsxs3("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
1149
- /* @__PURE__ */ jsxs3("div", { className: "mb-5", children: [
1243
+ const [expandedItems, setExpandedItems] = useState4({});
1244
+ const [searchQuery, setSearchQuery] = useState4("");
1245
+ return /* @__PURE__ */ jsxs4("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
1246
+ /* @__PURE__ */ jsxs4("div", { className: "mb-5", children: [
1150
1247
  /* @__PURE__ */ jsx5("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded bg-indigo-50 text-indigo-700 text-[10px] font-bold uppercase tracking-wider mb-2", children: meta.type }),
1151
1248
  /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
1152
1249
  /* @__PURE__ */ jsx5("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
1153
1250
  ] }),
1154
- /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
1251
+ /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1252
+ meta.type === "boolean" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3 py-1", children: [
1253
+ /* @__PURE__ */ jsx5(
1254
+ "input",
1255
+ {
1256
+ type: "checkbox",
1257
+ id: meta.id,
1258
+ checked: value === void 0 ? meta.defaultValue : !!value,
1259
+ onChange: (e) => onChange(e.target.checked),
1260
+ className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ jsx5("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
1264
+ ] }),
1155
1265
  meta.type === "text" && /* @__PURE__ */ jsx5(
1156
1266
  "input",
1157
1267
  {
@@ -1170,8 +1280,8 @@ function FieldEditor({
1170
1280
  className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
1171
1281
  }
1172
1282
  ),
1173
- meta.type === "image" && /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1174
- /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1283
+ meta.type === "image" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1284
+ /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1175
1285
  /* @__PURE__ */ jsx5(
1176
1286
  "input",
1177
1287
  {
@@ -1182,7 +1292,7 @@ function FieldEditor({
1182
1292
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1183
1293
  }
1184
1294
  ),
1185
- /* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1295
+ /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1186
1296
  "Upload",
1187
1297
  /* @__PURE__ */ jsx5(
1188
1298
  "input",
@@ -1200,7 +1310,7 @@ function FieldEditor({
1200
1310
  )
1201
1311
  ] })
1202
1312
  ] }),
1203
- value ? /* @__PURE__ */ jsxs3("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
1313
+ value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
1204
1314
  /* @__PURE__ */ jsx5(
1205
1315
  "img",
1206
1316
  {
@@ -1212,8 +1322,8 @@ function FieldEditor({
1212
1322
  /* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx5("span", { className: "text-white text-xs font-medium px-2 py-1 bg-black/50 rounded backdrop-blur", children: "Preview" }) })
1213
1323
  ] }) : null
1214
1324
  ] }),
1215
- meta.type === "file" && /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1216
- /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1325
+ meta.type === "file" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1326
+ /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1217
1327
  /* @__PURE__ */ jsx5(
1218
1328
  "input",
1219
1329
  {
@@ -1224,7 +1334,7 @@ function FieldEditor({
1224
1334
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1225
1335
  }
1226
1336
  ),
1227
- /* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
1337
+ /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
1228
1338
  "Upload File",
1229
1339
  /* @__PURE__ */ jsx5(
1230
1340
  "input",
@@ -1242,13 +1352,13 @@ function FieldEditor({
1242
1352
  )
1243
1353
  ] })
1244
1354
  ] }),
1245
- value ? /* @__PURE__ */ jsxs3("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
1355
+ value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
1246
1356
  /* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} File URL:" }),
1247
1357
  /* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
1248
1358
  ] }) : null
1249
1359
  ] }),
1250
- meta.type === "link" && /* @__PURE__ */ jsxs3("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
1251
- /* @__PURE__ */ jsxs3("label", { className: "block", children: [
1360
+ meta.type === "link" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
1361
+ /* @__PURE__ */ jsxs4("label", { className: "block", children: [
1252
1362
  /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
1253
1363
  /* @__PURE__ */ jsx5(
1254
1364
  "input",
@@ -1259,7 +1369,7 @@ function FieldEditor({
1259
1369
  }
1260
1370
  )
1261
1371
  ] }),
1262
- /* @__PURE__ */ jsxs3("label", { className: "block", children: [
1372
+ /* @__PURE__ */ jsxs4("label", { className: "block", children: [
1263
1373
  /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL Target" }),
1264
1374
  /* @__PURE__ */ jsx5(
1265
1375
  "input",
@@ -1272,7 +1382,7 @@ function FieldEditor({
1272
1382
  )
1273
1383
  ] })
1274
1384
  ] }),
1275
- meta.type === "color" && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1385
+ meta.type === "color" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1276
1386
  /* @__PURE__ */ jsx5(
1277
1387
  "input",
1278
1388
  {
@@ -1301,140 +1411,185 @@ function FieldEditor({
1301
1411
  className: "w-full rounded-xl border border-slate-200 px-4 py-3 font-mono text-xs text-slate-700 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
1302
1412
  }
1303
1413
  ),
1304
- meta.type === "list" && /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
1305
- (Array.isArray(value) ? value : []).map((item, idx) => /* @__PURE__ */ jsxs3("div", { className: "flex gap-3 items-start bg-slate-50 p-3 rounded-xl border border-slate-100 relative group", children: [
1306
- /* @__PURE__ */ jsx5("div", { className: "flex-1 space-y-3 w-full", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs3("div", { children: [
1307
- /* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1308
- schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
1309
- SearchableSelect,
1310
- {
1311
- value: String(item?.[schemaField.key] ?? ""),
1312
- options: schemaField.options ?? [],
1313
- placeholder: "Search icon...",
1314
- iconMap: ctx.iconMap,
1315
- onChange: (val) => {
1316
- const arr = Array.isArray(value) ? [...value] : [];
1317
- arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
1318
- onChange(arr);
1319
- }
1320
- }
1321
- ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
1322
- "textarea",
1323
- {
1324
- rows: 3,
1325
- value: String(item?.[schemaField.key] ?? ""),
1326
- onChange: (e) => {
1327
- const arr = Array.isArray(value) ? [...value] : [];
1328
- arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1329
- onChange(arr);
1330
- },
1331
- className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1332
- }
1333
- ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1334
- /* @__PURE__ */ jsx5(
1335
- "input",
1414
+ meta.type === "list" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1415
+ meta.search && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
1416
+ /* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
1417
+ /* @__PURE__ */ jsx5(
1418
+ "input",
1419
+ {
1420
+ type: "text",
1421
+ placeholder: "Search by title...",
1422
+ value: searchQuery,
1423
+ onChange: (e) => setSearchQuery(e.target.value),
1424
+ className: "w-full rounded-lg border border-slate-200 pl-9 pr-3 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1425
+ }
1426
+ )
1427
+ ] }),
1428
+ (Array.isArray(value) ? value : []).map((item, idx) => {
1429
+ if (meta.search && searchQuery) {
1430
+ const title = String(item?.title || item?.name || "").toLowerCase();
1431
+ if (!title.includes(searchQuery.toLowerCase())) return null;
1432
+ }
1433
+ const isExpanded = expandedItems[idx] ?? false;
1434
+ return /* @__PURE__ */ jsxs4("div", { className: "flex gap-3 items-start bg-slate-50 p-3 rounded-xl border border-slate-100 relative group", children: [
1435
+ /* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-3 w-full", children: [
1436
+ /* @__PURE__ */ jsxs4(
1437
+ "div",
1336
1438
  {
1337
- type: "checkbox",
1338
- checked: !!item?.[schemaField.key],
1339
- onChange: (e) => {
1340
- const arr = Array.isArray(value) ? [...value] : [];
1341
- arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
1342
- onChange(arr);
1343
- },
1344
- className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
1439
+ className: "flex items-center justify-between cursor-pointer py-1 select-none",
1440
+ onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
1441
+ children: [
1442
+ /* @__PURE__ */ jsx5("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-4", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
1443
+ isExpanded ? /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
1444
+ ]
1345
1445
  }
1346
1446
  ),
1347
- /* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1348
- ] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3 mt-1", children: [
1349
- /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1350
- /* @__PURE__ */ jsx5(
1351
- "input",
1447
+ isExpanded && /* @__PURE__ */ jsx5("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs4("div", { children: [
1448
+ /* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1449
+ schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
1450
+ SearchableSelect,
1352
1451
  {
1353
- type: "url",
1452
+ value: String(item?.[schemaField.key] ?? ""),
1453
+ options: schemaField.options ?? [],
1454
+ placeholder: "Search icon...",
1455
+ iconMap: ctx.iconMap,
1456
+ onChange: (val) => {
1457
+ const arr = Array.isArray(value) ? [...value] : [];
1458
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
1459
+ onChange(arr);
1460
+ }
1461
+ }
1462
+ ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
1463
+ "textarea",
1464
+ {
1465
+ rows: 3,
1354
1466
  value: String(item?.[schemaField.key] ?? ""),
1355
1467
  onChange: (e) => {
1356
1468
  const arr = Array.isArray(value) ? [...value] : [];
1357
1469
  arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1358
1470
  onChange(arr);
1359
1471
  },
1360
- placeholder: "https://...",
1361
1472
  className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1362
1473
  }
1363
- ),
1364
- /* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1365
- "Upload",
1474
+ ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1366
1475
  /* @__PURE__ */ jsx5(
1367
1476
  "input",
1368
1477
  {
1369
- type: "file",
1370
- accept: "image/*",
1371
- className: "hidden",
1478
+ type: "checkbox",
1479
+ checked: !!item?.[schemaField.key],
1372
1480
  onChange: (e) => {
1373
- const file = e.target.files?.[0];
1374
- if (file) {
1375
- void handleImageFile(
1376
- file,
1377
- (url) => {
1378
- const arr = Array.isArray(value) ? [...value] : [];
1379
- arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
1380
- onChange(arr);
1381
- },
1382
- ctx.uploadImage
1383
- );
1384
- }
1481
+ const arr = Array.isArray(value) ? [...value] : [];
1482
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
1483
+ onChange(arr);
1484
+ },
1485
+ className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
1486
+ }
1487
+ ),
1488
+ /* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1489
+ ] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3 mt-1", children: [
1490
+ /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1491
+ /* @__PURE__ */ jsx5(
1492
+ "input",
1493
+ {
1494
+ type: "url",
1495
+ value: String(item?.[schemaField.key] ?? ""),
1496
+ onChange: (e) => {
1497
+ const arr = Array.isArray(value) ? [...value] : [];
1498
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1499
+ onChange(arr);
1500
+ },
1501
+ placeholder: "https://...",
1502
+ className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1385
1503
  }
1504
+ ),
1505
+ /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1506
+ "Upload",
1507
+ /* @__PURE__ */ jsx5(
1508
+ "input",
1509
+ {
1510
+ type: "file",
1511
+ accept: "image/*",
1512
+ className: "hidden",
1513
+ onChange: (e) => {
1514
+ const file = e.target.files?.[0];
1515
+ if (file) {
1516
+ void handleImageFile(
1517
+ file,
1518
+ (url) => {
1519
+ const arr = Array.isArray(value) ? [...value] : [];
1520
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
1521
+ onChange(arr);
1522
+ },
1523
+ ctx.uploadImage
1524
+ );
1525
+ }
1526
+ }
1527
+ }
1528
+ )
1529
+ ] })
1530
+ ] }),
1531
+ item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ jsx5(
1532
+ "img",
1533
+ {
1534
+ src: String(item?.[schemaField.key]),
1535
+ alt: "",
1536
+ className: "w-full h-auto max-h-32 object-contain rounded-md"
1386
1537
  }
1387
- )
1388
- ] })
1389
- ] }),
1390
- item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ jsx5(
1391
- "img",
1538
+ ) }) : null
1539
+ ] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
1540
+ "select",
1541
+ {
1542
+ value: String(item?.[schemaField.key] ?? ""),
1543
+ onChange: (e) => {
1544
+ const arr = Array.isArray(value) ? [...value] : [];
1545
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1546
+ onChange(arr);
1547
+ },
1548
+ className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
1549
+ children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
1550
+ }
1551
+ ) : /* @__PURE__ */ jsx5(
1552
+ "input",
1553
+ {
1554
+ type: "text",
1555
+ value: String(item?.[schemaField.key] ?? ""),
1556
+ onChange: (e) => {
1557
+ const arr = Array.isArray(value) ? [...value] : [];
1558
+ arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1559
+ onChange(arr);
1560
+ },
1561
+ className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1562
+ }
1563
+ )
1564
+ ] }, schemaField.key)) : /* @__PURE__ */ jsx5(
1565
+ "input",
1392
1566
  {
1393
- src: String(item?.[schemaField.key]),
1394
- alt: "",
1395
- className: "w-full h-auto max-h-32 object-contain rounded-md"
1567
+ type: "text",
1568
+ value: String(item),
1569
+ onChange: (e) => {
1570
+ const arr = Array.isArray(value) ? [...value] : [];
1571
+ arr[idx] = e.target.value;
1572
+ onChange(arr);
1573
+ },
1574
+ className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1396
1575
  }
1397
- ) }) : null
1398
- ] }) : /* @__PURE__ */ jsx5(
1399
- "input",
1576
+ ) })
1577
+ ] }),
1578
+ !meta.fixedLength && /* @__PURE__ */ jsx5(
1579
+ "button",
1400
1580
  {
1401
- type: "text",
1402
- value: String(item?.[schemaField.key] ?? ""),
1403
- onChange: (e) => {
1581
+ onClick: () => {
1404
1582
  const arr = Array.isArray(value) ? [...value] : [];
1405
- arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
1583
+ arr.splice(idx, 1);
1406
1584
  onChange(arr);
1407
1585
  },
1408
- className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1586
+ className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
1587
+ children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1409
1588
  }
1410
1589
  )
1411
- ] }, schemaField.key)) : /* @__PURE__ */ jsx5(
1412
- "input",
1413
- {
1414
- type: "text",
1415
- value: String(item),
1416
- onChange: (e) => {
1417
- const arr = Array.isArray(value) ? [...value] : [];
1418
- arr[idx] = e.target.value;
1419
- onChange(arr);
1420
- },
1421
- className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
1422
- }
1423
- ) }),
1424
- !meta.fixedLength && /* @__PURE__ */ jsx5(
1425
- "button",
1426
- {
1427
- onClick: () => {
1428
- const arr = Array.isArray(value) ? [...value] : [];
1429
- arr.splice(idx, 1);
1430
- onChange(arr);
1431
- },
1432
- className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
1433
- children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1434
- }
1435
- )
1436
- ] }, idx)),
1437
- !meta.fixedLength && /* @__PURE__ */ jsxs3(
1590
+ ] }, idx);
1591
+ }),
1592
+ !meta.fixedLength && /* @__PURE__ */ jsxs4(
1438
1593
  "button",
1439
1594
  {
1440
1595
  onClick: () => {
@@ -1460,8 +1615,8 @@ function FieldEditor({
1460
1615
  ] }),
1461
1616
  " "
1462
1617
  ] }),
1463
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1464
- /* @__PURE__ */ jsxs3(
1618
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1619
+ /* @__PURE__ */ jsxs4(
1465
1620
  "button",
1466
1621
  {
1467
1622
  onClick: onReset,
@@ -1497,18 +1652,18 @@ function CollectionsSection() {
1497
1652
  });
1498
1653
  });
1499
1654
  }, [ctx.adapter, collections]);
1500
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1501
- /* @__PURE__ */ jsxs3("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
1655
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1656
+ /* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
1502
1657
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
1503
- /* @__PURE__ */ jsxs3("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
1504
- collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs3(
1658
+ /* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
1659
+ collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
1505
1660
  "button",
1506
1661
  {
1507
1662
  onClick: () => setSelected(c),
1508
1663
  className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selected?.id === c.id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
1509
1664
  children: [
1510
1665
  /* @__PURE__ */ jsx5("div", { className: selected?.id === c.id ? "text-slate-900" : "text-slate-700", children: c.name }),
1511
- /* @__PURE__ */ jsxs3("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
1666
+ /* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
1512
1667
  counts[c.id] ?? 0,
1513
1668
  " items"
1514
1669
  ] })
@@ -1518,7 +1673,7 @@ function CollectionsSection() {
1518
1673
  collections.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No collections registered." })
1519
1674
  ] })
1520
1675
  ] }),
1521
- /* @__PURE__ */ jsxs3("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1676
+ /* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1522
1677
  /* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
1523
1678
  selected ? /* @__PURE__ */ jsx5(CollectionEditor, { collection: selected }, selected.id) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to manage its entries." })
1524
1679
  ] })
@@ -1556,7 +1711,7 @@ function CollectionEditor({ collection }) {
1556
1711
  } else if (f.defaultValue !== void 0) {
1557
1712
  base[f.id] = f.defaultValue;
1558
1713
  } else {
1559
- base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : "";
1714
+ base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : f.type === "select" ? f.options?.[0] ?? "" : "";
1560
1715
  }
1561
1716
  });
1562
1717
  setEditing(base);
@@ -1619,13 +1774,13 @@ function CollectionEditor({ collection }) {
1619
1774
  setDragOverIdx(null);
1620
1775
  };
1621
1776
  const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order").slice(0, 5);
1622
- return /* @__PURE__ */ jsxs3("div", { className: "mx-auto max-w-5xl", children: [
1623
- /* @__PURE__ */ jsxs3("div", { className: "mb-8 flex items-center justify-between", children: [
1624
- /* @__PURE__ */ jsxs3("div", { children: [
1777
+ return /* @__PURE__ */ jsxs4("div", { className: "mx-auto max-w-5xl", children: [
1778
+ /* @__PURE__ */ jsxs4("div", { className: "mb-8 flex items-center justify-between", children: [
1779
+ /* @__PURE__ */ jsxs4("div", { children: [
1625
1780
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
1626
1781
  collection.description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
1627
1782
  ] }),
1628
- /* @__PURE__ */ jsxs3(
1783
+ /* @__PURE__ */ jsxs4(
1629
1784
  "button",
1630
1785
  {
1631
1786
  onClick: startNew,
@@ -1637,13 +1792,13 @@ function CollectionEditor({ collection }) {
1637
1792
  }
1638
1793
  )
1639
1794
  ] }),
1640
- editing && /* @__PURE__ */ jsxs3("div", { className: "mb-8 rounded-2xl border border-indigo-100 bg-white p-6 shadow-xl shadow-indigo-100/50 animate-in fade-in slide-in-from-top-4", children: [
1641
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 mb-6", children: [
1795
+ editing && /* @__PURE__ */ jsxs4("div", { className: "mb-8 rounded-2xl border border-indigo-100 bg-white p-6 shadow-xl shadow-indigo-100/50 animate-in fade-in slide-in-from-top-4", children: [
1796
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-6", children: [
1642
1797
  /* @__PURE__ */ jsx5("div", { className: "w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600", children: /* @__PURE__ */ jsx5(Pencil, { className: "w-4 h-4" }) }),
1643
1798
  /* @__PURE__ */ jsx5("h3", { className: "text-lg font-bold text-slate-900", children: "Edit Entry" })
1644
1799
  ] }),
1645
- /* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */ jsxs3("label", { className: `block ${f.type === "richtext" ? "md:col-span-2" : ""}`, children: [
1646
- /* @__PURE__ */ jsxs3("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
1800
+ /* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */ jsxs4("label", { className: `block ${f.type === "richtext" ? "md:col-span-2" : ""}`, children: [
1801
+ /* @__PURE__ */ jsxs4("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
1647
1802
  f.label,
1648
1803
  /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
1649
1804
  ] }),
@@ -1680,7 +1835,7 @@ function CollectionEditor({ collection }) {
1680
1835
  placeholder: `Search ${f.label.toLowerCase()}...`,
1681
1836
  iconMap: ctx.iconMap
1682
1837
  }
1683
- ) : f.type === "slug" ? /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1838
+ ) : f.type === "slug" ? /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1684
1839
  /* @__PURE__ */ jsx5(
1685
1840
  "input",
1686
1841
  {
@@ -1704,7 +1859,7 @@ function CollectionEditor({ collection }) {
1704
1859
  children: "Generate"
1705
1860
  }
1706
1861
  )
1707
- ] }) : f.type === "select" ? /* @__PURE__ */ jsxs3("div", { children: [
1862
+ ] }) : f.type === "select" ? /* @__PURE__ */ jsxs4("div", { children: [
1708
1863
  /* @__PURE__ */ jsx5(
1709
1864
  "input",
1710
1865
  {
@@ -1719,8 +1874,8 @@ function CollectionEditor({ collection }) {
1719
1874
  const lab = typeof opt === "string" ? opt : opt.label;
1720
1875
  return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
1721
1876
  }) })
1722
- ] }) : f.type === "image" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1723
- /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1877
+ ] }) : f.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1878
+ /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1724
1879
  /* @__PURE__ */ jsx5(
1725
1880
  "input",
1726
1881
  {
@@ -1731,7 +1886,7 @@ function CollectionEditor({ collection }) {
1731
1886
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1732
1887
  }
1733
1888
  ),
1734
- /* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1889
+ /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1735
1890
  "Upload",
1736
1891
  /* @__PURE__ */ jsx5(
1737
1892
  "input",
@@ -1767,7 +1922,7 @@ function CollectionEditor({ collection }) {
1767
1922
  value: String(editing[f.id] ?? ""),
1768
1923
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
1769
1924
  }
1770
- ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
1925
+ ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
1771
1926
  /* @__PURE__ */ jsx5(
1772
1927
  "input",
1773
1928
  {
@@ -1794,11 +1949,11 @@ function CollectionEditor({ collection }) {
1794
1949
  style: { backgroundColor: String(editing[f.id] ?? "#000000") }
1795
1950
  }
1796
1951
  )
1797
- ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1952
+ ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1798
1953
  (Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : []).map((item, idx) => {
1799
1954
  const colorVal = String(item ?? "").trim();
1800
1955
  const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
1801
- return /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
1956
+ return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
1802
1957
  /* @__PURE__ */ jsx5(
1803
1958
  "input",
1804
1959
  {
@@ -1848,7 +2003,7 @@ function CollectionEditor({ collection }) {
1848
2003
  )
1849
2004
  ] }, idx);
1850
2005
  }),
1851
- /* @__PURE__ */ jsxs3(
2006
+ /* @__PURE__ */ jsxs4(
1852
2007
  "button",
1853
2008
  {
1854
2009
  type: "button",
@@ -1864,8 +2019,8 @@ function CollectionEditor({ collection }) {
1864
2019
  ]
1865
2020
  }
1866
2021
  )
1867
- ] }) : f.type === "list" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1868
- (Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
2022
+ ] }) : f.type === "list" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
2023
+ (Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
1869
2024
  /* @__PURE__ */ jsx5(
1870
2025
  "input",
1871
2026
  {
@@ -1893,7 +2048,7 @@ function CollectionEditor({ collection }) {
1893
2048
  }
1894
2049
  )
1895
2050
  ] }, idx)),
1896
- /* @__PURE__ */ jsxs3(
2051
+ /* @__PURE__ */ jsxs4(
1897
2052
  "button",
1898
2053
  {
1899
2054
  type: "button",
@@ -1918,7 +2073,7 @@ function CollectionEditor({ collection }) {
1918
2073
  }
1919
2074
  )
1920
2075
  ] }, f.id)) }),
1921
- /* @__PURE__ */ jsxs3("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
2076
+ /* @__PURE__ */ jsxs4("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
1922
2077
  /* @__PURE__ */ jsx5(
1923
2078
  "button",
1924
2079
  {
@@ -1934,8 +2089,8 @@ function CollectionEditor({ collection }) {
1934
2089
  onClick: save,
1935
2090
  disabled: saving,
1936
2091
  className: "inline-flex items-center gap-2 rounded-xl bg-slate-900 px-6 py-2.5 text-sm font-bold text-white shadow-sm hover:bg-slate-800 hover:shadow transition-all disabled:opacity-60",
1937
- children: saving ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
1938
- /* @__PURE__ */ jsxs3("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2092
+ children: saving ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
2093
+ /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
1939
2094
  /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1940
2095
  /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
1941
2096
  ] }),
@@ -1945,19 +2100,19 @@ function CollectionEditor({ collection }) {
1945
2100
  )
1946
2101
  ] })
1947
2102
  ] }),
1948
- /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs3("table", { className: "w-full text-sm text-left", children: [
1949
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs3("tr", { children: [
2103
+ /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
2104
+ /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs4("tr", { children: [
1950
2105
  visibleFields.map((f) => /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: f.label }, f.id)),
1951
2106
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
1952
2107
  ] }) }),
1953
2108
  /* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
1954
2109
  // Loading skeleton rows
1955
- Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs3("tr", { children: [
2110
+ Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs4("tr", { children: [
1956
2111
  visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx5("div", { className: "h-4 bg-slate-100 rounded animate-pulse", style: { width: `${60 + i * 13 % 30}%` } }) }, f.id)),
1957
2112
  /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 sticky right-0 bg-white border-l border-slate-100", children: /* @__PURE__ */ jsx5("div", { className: "h-4 w-16 bg-slate-100 rounded animate-pulse ml-auto" }) })
1958
2113
  ] }, i))
1959
- ) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
1960
- entries.map((e, idx) => /* @__PURE__ */ jsxs3(
2114
+ ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
2115
+ entries.map((e, idx) => /* @__PURE__ */ jsxs4(
1961
2116
  "tr",
1962
2117
  {
1963
2118
  draggable: true,
@@ -1968,7 +2123,7 @@ function CollectionEditor({ collection }) {
1968
2123
  className: `hover:bg-slate-50/50 transition-colors group cursor-grab active:cursor-grabbing ${deletingId === e.id ? "opacity-50" : ""} ${dragOverIdx === idx ? "border-t-2 border-t-indigo-500" : ""}`,
1969
2124
  children: [
1970
2125
  visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && e[f.id] ? /* @__PURE__ */ jsx5("img", { src: String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx5("div", { className: "h-8 w-8 rounded bg-slate-100 ring-1 ring-slate-200/50 flex items-center justify-center text-slate-300", children: /* @__PURE__ */ jsx5("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }) : String(e[f.id] ?? "") }, f.id)),
1971
- /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-2", children: [
2126
+ /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-2", children: [
1972
2127
  /* @__PURE__ */ jsx5("div", { className: "p-2 text-slate-300 cursor-grab active:cursor-grabbing", title: "Drag to reorder", children: /* @__PURE__ */ jsx5("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "w-4 h-4", children: /* @__PURE__ */ jsx5("path", { d: "M5.5 3C6.32843 3 7 3.67157 7 4.5C7 5.32843 6.32843 6 5.5 6C4.67157 6 4 5.32843 4 4.5C4 3.67157 4.67157 3 5.5 3ZM9.5 3C10.3284 3 11 3.67157 11 4.5C11 5.32843 10.3284 6 9.5 6C8.67157 6 8 5.32843 8 4.5C8 3.67157 8.67157 3 9.5 3ZM5.5 7.5C6.32843 7.5 7 8.17157 7 9C7 9.82843 6.32843 10.5 5.5 10.5C4.67157 10.5 4 9.82843 4 9C4 8.17157 4.67157 7.5 5.5 7.5ZM9.5 7.5C10.3284 7.5 11 8.17157 11 9C11 9.82843 10.3284 10.5 9.5 10.5C8.67157 10.5 8 9.82843 8 9C8 8.17157 8.67157 7.5 9.5 7.5ZM5.5 12C6.32843 12 7 12.6716 7 13.5C7 14.3284 6.32843 15 5.5 15C4.67157 15 4 14.3284 4 13.5C4 12.6716 4.67157 12 5.5 12ZM9.5 12C10.3284 12 11 12.6716 11 13.5C11 14.3284 10.3284 15 9.5 15C8.67157 15 8 14.3284 8 13.5C8 12.6716 8.67157 12 9.5 12Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) }),
1973
2128
  /* @__PURE__ */ jsx5(
1974
2129
  "button",
@@ -1986,7 +2141,7 @@ function CollectionEditor({ collection }) {
1986
2141
  disabled: deletingId === e.id,
1987
2142
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
1988
2143
  title: "Delete",
1989
- children: deletingId === e.id ? /* @__PURE__ */ jsxs3("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2144
+ children: deletingId === e.id ? /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
1990
2145
  /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1991
2146
  /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
1992
2147
  ] }) : /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
@@ -2002,7 +2157,7 @@ function CollectionEditor({ collection }) {
2002
2157
  {
2003
2158
  colSpan: visibleFields.length + 1,
2004
2159
  className: "px-6 py-12 text-center text-slate-500",
2005
- children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center", children: [
2160
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center", children: [
2006
2161
  /* @__PURE__ */ jsx5(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
2007
2162
  /* @__PURE__ */ jsx5("p", { children: 'No entries yet. Click "New Entry" to create one.' })
2008
2163
  ] })
@@ -2033,18 +2188,18 @@ function SubmissionsSection() {
2033
2188
  setSelectedFormId(formIds[0]);
2034
2189
  }
2035
2190
  }, [formIds, selectedFormId]);
2036
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2037
- /* @__PURE__ */ jsxs3("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
2191
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2192
+ /* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
2038
2193
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
2039
- /* @__PURE__ */ jsxs3("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
2040
- formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs3(
2194
+ /* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
2195
+ formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
2041
2196
  "button",
2042
2197
  {
2043
2198
  onClick: () => setSelectedFormId(id),
2044
2199
  className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selectedFormId === id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
2045
2200
  children: [
2046
2201
  /* @__PURE__ */ jsx5("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
2047
- /* @__PURE__ */ jsxs3("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
2202
+ /* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
2048
2203
  submissions.filter((s) => s.formId === id).length,
2049
2204
  " items"
2050
2205
  ] })
@@ -2054,7 +2209,7 @@ function SubmissionsSection() {
2054
2209
  formIds.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No data collected." })
2055
2210
  ] })
2056
2211
  ] }),
2057
- /* @__PURE__ */ jsxs3("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2212
+ /* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2058
2213
  /* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
2059
2214
  selectedFormId ? /* @__PURE__ */ jsx5(
2060
2215
  SubmissionsList,
@@ -2103,8 +2258,8 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2103
2258
  }
2104
2259
  };
2105
2260
  if (detail) {
2106
- return /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-2xl", children: [
2107
- /* @__PURE__ */ jsxs3(
2261
+ return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
2262
+ /* @__PURE__ */ jsxs4(
2108
2263
  "button",
2109
2264
  {
2110
2265
  onClick: () => setDetail(null),
@@ -2115,9 +2270,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2115
2270
  ]
2116
2271
  }
2117
2272
  ),
2118
- /* @__PURE__ */ jsxs3("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2119
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
2120
- /* @__PURE__ */ jsxs3("div", { children: [
2273
+ /* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2274
+ /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
2275
+ /* @__PURE__ */ jsxs4("div", { children: [
2121
2276
  /* @__PURE__ */ jsx5("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-indigo-100 px-3 py-1 text-xs font-bold text-indigo-700 mb-2 capitalize", children: detail.formId }),
2122
2277
  /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
2123
2278
  ] }),
@@ -2135,9 +2290,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2135
2290
  const strVal = String(val ?? "\u2014");
2136
2291
  const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
2137
2292
  const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
2138
- return /* @__PURE__ */ jsxs3("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2293
+ return /* @__PURE__ */ jsxs4("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2139
2294
  /* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2140
- /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
2295
+ /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
2141
2296
  /* @__PURE__ */ jsx5(
2142
2297
  "a",
2143
2298
  {
@@ -2155,7 +2310,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2155
2310
  )
2156
2311
  }
2157
2312
  ),
2158
- /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs3(
2313
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs4(
2159
2314
  "a",
2160
2315
  {
2161
2316
  href: strVal,
@@ -2168,7 +2323,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2168
2323
  ]
2169
2324
  }
2170
2325
  ) })
2171
- ] }) : isUrl ? /* @__PURE__ */ jsxs3(
2326
+ ] }) : isUrl ? /* @__PURE__ */ jsxs4(
2172
2327
  "a",
2173
2328
  {
2174
2329
  href: strVal,
@@ -2187,16 +2342,16 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2187
2342
  ] })
2188
2343
  ] });
2189
2344
  }
2190
- return /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
2191
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
2192
- /* @__PURE__ */ jsxs3("div", { children: [
2193
- /* @__PURE__ */ jsxs3("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
2345
+ return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
2346
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
2347
+ /* @__PURE__ */ jsxs4("div", { children: [
2348
+ /* @__PURE__ */ jsxs4("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
2194
2349
  formId,
2195
2350
  unreadCount > 0 && /* @__PURE__ */ jsx5("span", { className: "inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-indigo-600 px-2 text-xs font-bold text-white", children: unreadCount })
2196
2351
  ] }),
2197
2352
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
2198
2353
  ] }),
2199
- /* @__PURE__ */ jsxs3(
2354
+ /* @__PURE__ */ jsxs4(
2200
2355
  "button",
2201
2356
  {
2202
2357
  onClick: onLoad,
@@ -2209,7 +2364,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2209
2364
  }
2210
2365
  )
2211
2366
  ] }),
2212
- /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
2367
+ /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
2213
2368
  /* @__PURE__ */ jsx5(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
2214
2369
  /* @__PURE__ */ jsx5(
2215
2370
  "input",
@@ -2224,28 +2379,28 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2224
2379
  }
2225
2380
  )
2226
2381
  ] }),
2227
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs3("table", { className: "w-full text-sm text-left", children: [
2228
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs3("tr", { children: [
2382
+ /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
2383
+ /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs4("tr", { children: [
2229
2384
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
2230
2385
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
2231
2386
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
2232
2387
  ] }) }),
2233
- /* @__PURE__ */ jsxs3("tbody", { className: "divide-y divide-slate-100", children: [
2388
+ /* @__PURE__ */ jsxs4("tbody", { className: "divide-y divide-slate-100", children: [
2234
2389
  paginated.map((s) => {
2235
2390
  const firstVal = Object.values(s.data)[0];
2236
2391
  const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
2237
- return /* @__PURE__ */ jsxs3(
2392
+ return /* @__PURE__ */ jsxs4(
2238
2393
  "tr",
2239
2394
  {
2240
2395
  className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
2241
2396
  onClick: () => openDetail(s),
2242
2397
  children: [
2243
- /* @__PURE__ */ jsxs3("td", { className: "px-6 py-4", children: [
2398
+ /* @__PURE__ */ jsxs4("td", { className: "px-6 py-4", children: [
2244
2399
  /* @__PURE__ */ jsx5("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
2245
2400
  !s.read && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
2246
2401
  ] }),
2247
2402
  /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
2248
- /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-1", children: [
2403
+ /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-1", children: [
2249
2404
  /* @__PURE__ */ jsx5(
2250
2405
  "button",
2251
2406
  {
@@ -2270,19 +2425,19 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2270
2425
  s.id
2271
2426
  );
2272
2427
  }),
2273
- paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
2428
+ paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
2274
2429
  /* @__PURE__ */ jsx5(Inbox, { className: "h-12 w-12 text-slate-200" }),
2275
2430
  /* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
2276
2431
  ] }) }) })
2277
2432
  ] })
2278
2433
  ] }) }),
2279
- totalPages > 1 && /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
2280
- /* @__PURE__ */ jsxs3("span", { children: [
2434
+ totalPages > 1 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
2435
+ /* @__PURE__ */ jsxs4("span", { children: [
2281
2436
  filtered.length,
2282
2437
  " item",
2283
2438
  filtered.length !== 1 ? "s" : ""
2284
2439
  ] }),
2285
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
2440
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2286
2441
  /* @__PURE__ */ jsx5(
2287
2442
  "button",
2288
2443
  {
@@ -2292,7 +2447,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2292
2447
  children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
2293
2448
  }
2294
2449
  ),
2295
- /* @__PURE__ */ jsxs3("span", { className: "font-medium text-slate-700", children: [
2450
+ /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
2296
2451
  "Page ",
2297
2452
  page,
2298
2453
  " of ",
@@ -2313,14 +2468,14 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2313
2468
  }
2314
2469
  function SettingsSection() {
2315
2470
  const ctx = useCmsContext();
2316
- return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
2317
- /* @__PURE__ */ jsxs3("div", { children: [
2471
+ return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
2472
+ /* @__PURE__ */ jsxs4("div", { children: [
2318
2473
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
2319
2474
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
2320
2475
  ] }),
2321
- /* @__PURE__ */ jsxs3("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2476
+ /* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2322
2477
  /* @__PURE__ */ jsx5("div", { className: "px-6 py-4 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800", children: "Configuration Snapshot" }) }),
2323
- /* @__PURE__ */ jsxs3("dl", { className: "divide-y divide-slate-100 text-sm", children: [
2478
+ /* @__PURE__ */ jsxs4("dl", { className: "divide-y divide-slate-100 text-sm", children: [
2324
2479
  /* @__PURE__ */ jsx5(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
2325
2480
  /* @__PURE__ */ jsx5(Row, { label: "Active Storage Adapter", value: ctx.adapter.name, highlight: true }),
2326
2481
  /* @__PURE__ */ jsx5(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
@@ -2363,10 +2518,10 @@ function ConfigSection() {
2363
2518
  },
2364
2519
  [ctx]
2365
2520
  );
2366
- return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row h-full", children: [
2367
- /* @__PURE__ */ jsxs3("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
2521
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
2522
+ /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
2368
2523
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
2369
- /* @__PURE__ */ jsxs3("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2524
+ /* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2370
2525
  globals.map((g) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
2371
2526
  "button",
2372
2527
  {
@@ -2378,14 +2533,14 @@ function ConfigSection() {
2378
2533
  globals.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No global configurations." })
2379
2534
  ] })
2380
2535
  ] }),
2381
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-2xl", children: [
2382
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between mb-8", children: [
2383
- /* @__PURE__ */ jsxs3("div", { children: [
2536
+ /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
2537
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-8", children: [
2538
+ /* @__PURE__ */ jsxs4("div", { children: [
2384
2539
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
2385
2540
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
2386
2541
  ] }),
2387
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
2388
- /* @__PURE__ */ jsxs3(
2542
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2543
+ /* @__PURE__ */ jsxs4(
2389
2544
  "button",
2390
2545
  {
2391
2546
  onClick: () => ctx.reset(),
@@ -2397,7 +2552,7 @@ function ConfigSection() {
2397
2552
  ]
2398
2553
  }
2399
2554
  ),
2400
- /* @__PURE__ */ jsxs3(
2555
+ /* @__PURE__ */ jsxs4(
2401
2556
  "button",
2402
2557
  {
2403
2558
  onClick: () => ctx.save(),
@@ -2411,7 +2566,7 @@ function ConfigSection() {
2411
2566
  )
2412
2567
  ] })
2413
2568
  ] }),
2414
- selectedGroup ? /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
2569
+ selectedGroup ? /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
2415
2570
  /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
2416
2571
  /* @__PURE__ */ jsx5("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden divide-y divide-slate-100", children: selectedGroup.fields.map((field) => /* @__PURE__ */ jsx5("div", { className: "p-4", children: /* @__PURE__ */ jsx5(
2417
2572
  FieldEditor,
@@ -2424,7 +2579,7 @@ function ConfigSection() {
2424
2579
  }
2425
2580
  }
2426
2581
  ) }, field.id)) })
2427
- ] }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center p-16 text-center border-2 border-dashed border-slate-200 rounded-2xl bg-white/50", children: [
2582
+ ] }) : /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center p-16 text-center border-2 border-dashed border-slate-200 rounded-2xl bg-white/50", children: [
2428
2583
  /* @__PURE__ */ jsx5(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
2429
2584
  /* @__PURE__ */ jsx5("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
2430
2585
  ] })
@@ -2437,7 +2592,7 @@ function Row({
2437
2592
  highlight,
2438
2593
  status
2439
2594
  }) {
2440
- return /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2595
+ return /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2441
2596
  /* @__PURE__ */ jsx5("dt", { className: "text-slate-500 font-medium", children: label }),
2442
2597
  /* @__PURE__ */ jsx5("dd", { className: `font-semibold ${highlight ? "text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded" : status === "warning" ? "text-amber-600" : status === "success" ? "text-emerald-600" : "text-slate-900"}`, children: value })
2443
2598
  ] });
@@ -2448,8 +2603,8 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2448
2603
  const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
2449
2604
  const capped = filtered.slice(0, 80);
2450
2605
  const SelectedIcon = iconMap && value ? iconMap[value] : null;
2451
- return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
2452
- /* @__PURE__ */ jsxs3(
2606
+ return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
2607
+ /* @__PURE__ */ jsxs4(
2453
2608
  "button",
2454
2609
  {
2455
2610
  type: "button",
@@ -2459,7 +2614,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2459
2614
  },
2460
2615
  className: "w-full flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors",
2461
2616
  children: [
2462
- /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2 truncate", children: [
2617
+ /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2 truncate", children: [
2463
2618
  SelectedIcon && /* @__PURE__ */ jsx5(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
2464
2619
  /* @__PURE__ */ jsx5("span", { className: "truncate", children: value || placeholder || "Select..." })
2465
2620
  ] }),
@@ -2467,10 +2622,10 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2467
2622
  ]
2468
2623
  }
2469
2624
  ),
2470
- open && /* @__PURE__ */ jsxs3(Fragment2, { children: [
2625
+ open && /* @__PURE__ */ jsxs4(Fragment2, { children: [
2471
2626
  /* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
2472
- /* @__PURE__ */ jsxs3("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
2473
- /* @__PURE__ */ jsxs3("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
2627
+ /* @__PURE__ */ jsxs4("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
2628
+ /* @__PURE__ */ jsxs4("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
2474
2629
  /* @__PURE__ */ jsx5(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
2475
2630
  /* @__PURE__ */ jsx5(
2476
2631
  "input",
@@ -2485,15 +2640,15 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2485
2640
  ),
2486
2641
  search && /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-100 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
2487
2642
  ] }),
2488
- /* @__PURE__ */ jsxs3("div", { className: "overflow-y-auto flex-1 p-1", children: [
2489
- filtered.length === 0 && /* @__PURE__ */ jsxs3("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2643
+ /* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto flex-1 p-1", children: [
2644
+ filtered.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2490
2645
  'No results for "',
2491
2646
  search,
2492
2647
  '"'
2493
2648
  ] }),
2494
2649
  capped.map((opt) => {
2495
2650
  const OptIcon = iconMap ? iconMap[opt] : null;
2496
- return /* @__PURE__ */ jsxs3(
2651
+ return /* @__PURE__ */ jsxs4(
2497
2652
  "button",
2498
2653
  {
2499
2654
  type: "button",
@@ -2510,7 +2665,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2510
2665
  opt
2511
2666
  );
2512
2667
  }),
2513
- filtered.length > 80 && /* @__PURE__ */ jsxs3("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
2668
+ filtered.length > 80 && /* @__PURE__ */ jsxs4("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
2514
2669
  "Showing 80 of ",
2515
2670
  filtered.length,
2516
2671
  " \u2014 type to narrow results"
@@ -2525,7 +2680,7 @@ function PasswordField({ value, onChange }) {
2525
2680
  const isHash = value.startsWith("$2a$") || value.startsWith("$2b$");
2526
2681
  const [displayValue, setDisplayValue] = useState4(isHash ? "" : value);
2527
2682
  const [pristine, setPristine] = useState4(isHash);
2528
- return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
2683
+ return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
2529
2684
  /* @__PURE__ */ jsx5(
2530
2685
  "input",
2531
2686
  {
@@ -2555,7 +2710,7 @@ function PasswordField({ value, onChange }) {
2555
2710
  // src/admin/AdminLogin.tsx
2556
2711
  import { useState as useState5, useEffect as useEffect5 } from "react";
2557
2712
  import { Lock, UserPlus } from "lucide-react";
2558
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2713
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2559
2714
  function AdminLogin({
2560
2715
  authApiRoute = "/api/admin/auth",
2561
2716
  redirectRoute = "/admin"
@@ -2601,19 +2756,19 @@ function AdminLogin({
2601
2756
  }
2602
2757
  };
2603
2758
  if (view === "checking") {
2604
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-8 w-8 text-indigo-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2759
+ return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-8 w-8 text-indigo-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2605
2760
  /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2606
2761
  /* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
2607
2762
  ] }) });
2608
2763
  }
2609
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs4("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
2610
- /* @__PURE__ */ jsxs4("div", { className: "p-8", children: [
2764
+ return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
2765
+ /* @__PURE__ */ jsxs5("div", { className: "p-8", children: [
2611
2766
  /* @__PURE__ */ jsx6("div", { className: "w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6", children: view === "register" ? /* @__PURE__ */ jsx6(UserPlus, { className: "w-6 h-6 text-indigo-600" }) : /* @__PURE__ */ jsx6(Lock, { className: "w-6 h-6 text-indigo-600" }) }),
2612
2767
  /* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
2613
2768
  /* @__PURE__ */ jsx6("p", { className: "text-sm text-slate-500 text-center mb-8", children: view === "register" ? "No admin users found. Create the first admin account to get started." : "Sign in to manage your content." }),
2614
2769
  error && /* @__PURE__ */ jsx6("div", { className: "mb-6 bg-red-50 text-red-700 p-3 rounded-lg text-sm border border-red-100", children: error }),
2615
- /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
2616
- /* @__PURE__ */ jsxs4("div", { children: [
2770
+ /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
2771
+ /* @__PURE__ */ jsxs5("div", { children: [
2617
2772
  /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
2618
2773
  /* @__PURE__ */ jsx6(
2619
2774
  "input",
@@ -2627,7 +2782,7 @@ function AdminLogin({
2627
2782
  }
2628
2783
  )
2629
2784
  ] }),
2630
- /* @__PURE__ */ jsxs4("div", { children: [
2785
+ /* @__PURE__ */ jsxs5("div", { children: [
2631
2786
  /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
2632
2787
  /* @__PURE__ */ jsx6(
2633
2788
  "input",
@@ -2647,7 +2802,7 @@ function AdminLogin({
2647
2802
  type: "submit",
2648
2803
  disabled: loading,
2649
2804
  className: "w-full bg-indigo-600 text-white font-semibold rounded-xl px-4 py-3 hover:bg-indigo-700 focus:outline-none focus:ring-4 focus:ring-indigo-500/20 transition-all shadow-md disabled:opacity-70 flex justify-center items-center",
2650
- children: loading ? /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2805
+ children: loading ? /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2651
2806
  /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2652
2807
  /* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
2653
2808
  ] }) : view === "register" ? "Create Account" : "Sign In"