admin-lib-cms 1.1.6 → 1.1.8

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
@@ -7,38 +7,263 @@ import {
7
7
 
8
8
  // src/provider.tsx
9
9
  import {
10
- createContext,
11
- useCallback,
12
- useContext,
13
- useEffect,
10
+ createContext as createContext2,
11
+ useCallback as useCallback2,
12
+ useContext as useContext2,
13
+ useEffect as useEffect2,
14
14
  useMemo,
15
15
  useRef,
16
- useState
16
+ useState as useState3
17
17
  } from "react";
18
+
19
+ // src/subscription/SubscriptionProvider.tsx
20
+ import { createContext, useContext, useState, useCallback, useEffect } from "react";
18
21
  import { jsx } from "react/jsx-runtime";
19
- var CmsContext = createContext(null);
22
+ var SubscriptionContext = createContext(void 0);
23
+ function useSubscriptionContext() {
24
+ const ctx = useContext(SubscriptionContext);
25
+ if (!ctx) {
26
+ throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");
27
+ }
28
+ return ctx;
29
+ }
30
+ function useSubscription() {
31
+ return useSubscriptionContext();
32
+ }
33
+ function SubscriptionProvider({
34
+ children,
35
+ apiUrl,
36
+ projectId,
37
+ email,
38
+ validateSubscriptionUrl
39
+ }) {
40
+ const [subscription, setSubscription] = useState(null);
41
+ const [loading, setLoading] = useState(true);
42
+ const [error, setError] = useState(null);
43
+ const fetchSubscription = useCallback(
44
+ async (silent = false) => {
45
+ if (!apiUrl || !projectId) {
46
+ setLoading(false);
47
+ return;
48
+ }
49
+ if (!silent) setLoading(true);
50
+ setError(null);
51
+ try {
52
+ const endpoint = validateSubscriptionUrl || `${apiUrl}/api/validate-subscription`;
53
+ const res = await fetch(endpoint, {
54
+ method: "POST",
55
+ headers: { "Content-Type": "application/json" },
56
+ body: JSON.stringify({ projectId })
57
+ });
58
+ if (!res.ok) throw new Error(`Server error: ${res.status}`);
59
+ const data = await res.json();
60
+ setSubscription({
61
+ subscriptionStatus: data.valid ? data.status : "inactive",
62
+ currentPeriodEnd: data.expiryDate,
63
+ customerEmail: email,
64
+ subscriptionId: data._id,
65
+ stripeCustomerId: data.stripeCustomerId,
66
+ stripePaymentLink: data.stripePaymentLink,
67
+ valid: data.valid
68
+ });
69
+ } catch (err) {
70
+ console.error("SubscriptionProvider Error:", err);
71
+ setError(err.message || "Failed to fetch subscription");
72
+ setSubscription({ subscriptionStatus: "active", valid: true });
73
+ } finally {
74
+ setLoading(false);
75
+ }
76
+ },
77
+ [apiUrl, projectId, email]
78
+ );
79
+ useEffect(() => {
80
+ fetchSubscription();
81
+ const handleFocus = () => {
82
+ fetchSubscription(true);
83
+ };
84
+ window.addEventListener("focus", handleFocus);
85
+ let intervalId;
86
+ if (subscription && !subscription.valid) {
87
+ intervalId = setInterval(() => {
88
+ fetchSubscription(true);
89
+ }, 1e4);
90
+ }
91
+ return () => {
92
+ window.removeEventListener("focus", handleFocus);
93
+ if (intervalId) clearInterval(intervalId);
94
+ };
95
+ }, [fetchSubscription, subscription?.valid]);
96
+ let daysOverdue = 0;
97
+ if (subscription && !subscription.valid && subscription.currentPeriodEnd) {
98
+ const diffTime = Date.now() - new Date(subscription.currentPeriodEnd).getTime();
99
+ if (diffTime > 0) {
100
+ daysOverdue = Math.floor(diffTime / (1e3 * 60 * 60 * 24));
101
+ }
102
+ }
103
+ const isSubscriptionActive = subscription ? subscription.valid || daysOverdue < 30 : true;
104
+ const value = {
105
+ subscription,
106
+ loading,
107
+ error,
108
+ refetch: fetchSubscription,
109
+ isSubscriptionActive,
110
+ daysOverdue,
111
+ config: { apiUrl, projectId }
112
+ };
113
+ return /* @__PURE__ */ jsx(SubscriptionContext.Provider, { value, children });
114
+ }
115
+
116
+ // src/subscription/SubscriptionPage.tsx
117
+ import { useState as useState2 } from "react";
118
+ import { CreditCard, ExternalLink, Settings, AlertTriangle, CheckCircle2 } from "lucide-react";
119
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
120
+ function SubscriptionPage() {
121
+ const { subscription, loading, config } = useSubscription();
122
+ const [actionLoading, setActionLoading] = useState2(null);
123
+ const status = subscription?.subscriptionStatus || "inactive";
124
+ const isValid = subscription?.valid ?? false;
125
+ const handleSubscribe = () => {
126
+ if (!subscription?.stripePaymentLink) {
127
+ alert("No payment link found. Please contact support.");
128
+ return;
129
+ }
130
+ const raw = subscription.stripePaymentLink;
131
+ const url = raw.startsWith("http") ? raw : `https://buy.stripe.com/${raw}`;
132
+ window.open(url, "_blank");
133
+ };
134
+ const handleManageBilling = async () => {
135
+ if (!subscription?.stripeCustomerId) {
136
+ alert("No customer ID available. Please contact support.");
137
+ return;
138
+ }
139
+ setActionLoading("billing");
140
+ try {
141
+ const returnUrl = window.location.href;
142
+ const apiUrl = config.apiUrl || "https://dev-soft-admin-sigma.vercel.app";
143
+ const res = await fetch(`${apiUrl}/api/create-billing-session`, {
144
+ method: "POST",
145
+ headers: { "Content-Type": "application/json" },
146
+ body: JSON.stringify({
147
+ customerId: subscription.stripeCustomerId,
148
+ returnUrl
149
+ })
150
+ });
151
+ if (!res.ok) throw new Error(`Server error: ${res.status}`);
152
+ const data = await res.json();
153
+ if (data.url) {
154
+ window.open(data.url, "_blank");
155
+ } else {
156
+ alert("Could not create billing session.");
157
+ }
158
+ } catch (err) {
159
+ alert(`Portal failed: ${err.message}`);
160
+ } finally {
161
+ setActionLoading(null);
162
+ }
163
+ };
164
+ if (loading && !subscription) {
165
+ return /* @__PURE__ */ jsx2("div", { className: "flex h-full min-h-[500px] w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 text-slate-500", children: [
166
+ /* @__PURE__ */ jsx2("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-indigo-200 border-t-indigo-600" }),
167
+ /* @__PURE__ */ jsx2("p", { className: "text-sm font-medium", children: "Verifying subscription..." })
168
+ ] }) });
169
+ }
170
+ return /* @__PURE__ */ jsx2("div", { className: "flex min-h-screen w-full flex-col items-center justify-center bg-slate-50 p-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl", children: [
171
+ /* @__PURE__ */ jsxs("div", { className: `p-8 text-center ${isValid ? "bg-emerald-50" : "bg-rose-50"}`, children: [
172
+ /* @__PURE__ */ jsx2("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white shadow-sm", children: isValid ? /* @__PURE__ */ jsx2(CheckCircle2, { className: "h-8 w-8 text-emerald-500" }) : /* @__PURE__ */ jsx2(AlertTriangle, { className: "h-8 w-8 text-rose-500" }) }),
173
+ /* @__PURE__ */ jsx2("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: isValid ? "Subscription Active" : "Subscription Inactive" }),
174
+ /* @__PURE__ */ jsx2("p", { className: "mt-2 text-sm text-slate-600", children: isValid ? "Your subscription is currently active and in good standing." : "Your project requires an active subscription to access the administration panel." })
175
+ ] }),
176
+ /* @__PURE__ */ jsxs("div", { className: "p-8", children: [
177
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
178
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-xl bg-slate-50 p-4 border border-slate-100", children: [
179
+ /* @__PURE__ */ jsx2("span", { className: "text-sm font-medium text-slate-500", children: "Status" }),
180
+ /* @__PURE__ */ jsx2("span", { className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold capitalize ${isValid ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: status })
181
+ ] }),
182
+ subscription?.currentPeriodEnd && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-xl bg-slate-50 p-4 border border-slate-100", children: [
183
+ /* @__PURE__ */ jsx2("span", { className: "text-sm font-medium text-slate-500", children: "Next Billing Date" }),
184
+ /* @__PURE__ */ jsx2("span", { className: "text-sm font-semibold text-slate-900", children: new Date(subscription.currentPeriodEnd).toLocaleDateString() })
185
+ ] })
186
+ ] }),
187
+ /* @__PURE__ */ jsxs("div", { className: "mt-8 space-y-3", children: [
188
+ !isValid && /* @__PURE__ */ jsxs(
189
+ "button",
190
+ {
191
+ onClick: handleSubscribe,
192
+ className: "group flex w-full items-center justify-center gap-2 rounded-xl bg-indigo-600 px-4 py-3.5 text-sm font-semibold text-white shadow-sm transition-all hover:bg-indigo-700 hover:shadow",
193
+ children: [
194
+ /* @__PURE__ */ jsx2(CreditCard, { className: "h-4 w-4" }),
195
+ "Pay Now to Restore Access",
196
+ /* @__PURE__ */ jsx2(ExternalLink, { className: "h-3.5 w-3.5 opacity-70 transition-transform group-hover:translate-x-0.5" })
197
+ ]
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs(
201
+ "button",
202
+ {
203
+ onClick: handleManageBilling,
204
+ disabled: actionLoading === "billing",
205
+ className: "group flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-white px-4 py-3.5 text-sm font-semibold text-slate-700 shadow-sm transition-all hover:bg-slate-50 hover:text-slate-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50",
206
+ children: [
207
+ actionLoading === "billing" ? /* @__PURE__ */ jsx2("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600" }) : /* @__PURE__ */ jsx2(Settings, { className: "h-4 w-4 text-slate-400 group-hover:text-slate-600" }),
208
+ "Manage Billing & Invoices"
209
+ ]
210
+ }
211
+ )
212
+ ] })
213
+ ] })
214
+ ] }) });
215
+ }
216
+
217
+ // src/provider.tsx
218
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
219
+ var CmsContext = createContext2(null);
20
220
  function useCmsContext() {
21
- const ctx = useContext(CmsContext);
221
+ const ctx = useContext2(CmsContext);
22
222
  if (!ctx) throw new Error("useCms must be used inside <CmsProvider>");
23
223
  return ctx;
24
224
  }
25
225
  function useCmsOptional() {
26
- return useContext(CmsContext);
226
+ return useContext2(CmsContext);
227
+ }
228
+ function CmsProvider(props) {
229
+ if (props.projectId) {
230
+ return /* @__PURE__ */ jsx3(
231
+ SubscriptionProvider,
232
+ {
233
+ apiUrl: props.apiUrl,
234
+ projectId: props.projectId,
235
+ email: props.email,
236
+ validateSubscriptionUrl: props.validateSubscriptionUrl,
237
+ children: /* @__PURE__ */ jsx3(CmsProviderInner, { ...props, children: /* @__PURE__ */ jsx3(SiteGuard, { children: props.children }) })
238
+ }
239
+ );
240
+ }
241
+ return /* @__PURE__ */ jsx3(CmsProviderInner, { ...props, children: props.children });
27
242
  }
28
- function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
29
- const [overrides, setOverrides] = useState(initialOverrides || {});
30
- const [savedOverrides, setSavedOverrides] = useState(initialOverrides || {});
31
- const [selectedId, setSelectedIdRaw] = useState(null);
32
- const [editMode, setEditMode] = useState(false);
33
- const [collectionChangedAt, setCollectionChangedAt] = useState(0);
243
+ function SiteGuard({ children }) {
244
+ const { daysOverdue, isSubscriptionActive } = useSubscription();
245
+ if (!isSubscriptionActive && daysOverdue >= 60) {
246
+ return /* @__PURE__ */ jsx3("div", { style: { display: "flex", height: "100vh", width: "100%", alignItems: "center", justifyContent: "center", backgroundColor: "#f8fafc", color: "#0f172a", fontFamily: "system-ui, -apple-system, sans-serif" }, children: /* @__PURE__ */ jsxs2("div", { style: { textAlign: "center", padding: "2rem", maxWidth: "32rem" }, children: [
247
+ /* @__PURE__ */ jsx3("h1", { style: { fontSize: "1.5rem", fontWeight: 600, marginBottom: "0.5rem" }, children: "This website is temporarily unavailable" }),
248
+ /* @__PURE__ */ jsx3("p", { style: { color: "#64748b" }, children: "Please contact the site administrator if you believe this is an error." })
249
+ ] }) });
250
+ }
251
+ return /* @__PURE__ */ jsx3(Fragment, { children });
252
+ }
253
+ function CmsProviderInner({ config, adapter, children, iconMap, initialOverrides }) {
254
+ const [overrides, setOverrides] = useState3(initialOverrides || {});
255
+ const [savedOverrides, setSavedOverrides] = useState3(initialOverrides || {});
256
+ const [selectedId, setSelectedIdRaw] = useState3(null);
257
+ const [editMode, setEditMode] = useState3(false);
258
+ const [collectionChangedAt, setCollectionChangedAt] = useState3(0);
34
259
  const registryRef = useRef(/* @__PURE__ */ new Map());
35
- useEffect(() => {
260
+ useEffect2(() => {
36
261
  if (typeof window === "undefined" || typeof BroadcastChannel === "undefined") return;
37
262
  const bc = new BroadcastChannel("admin-cms:collection-changed");
38
263
  bc.onmessage = () => setCollectionChangedAt(Date.now());
39
264
  return () => bc.close();
40
265
  }, []);
41
- const notifyCollectionChanged = useCallback(() => {
266
+ const notifyCollectionChanged = useCallback2(() => {
42
267
  setCollectionChangedAt(Date.now());
43
268
  if (typeof BroadcastChannel !== "undefined") {
44
269
  const bc = new BroadcastChannel("admin-cms:collection-changed");
@@ -46,12 +271,12 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
46
271
  bc.close();
47
272
  }
48
273
  }, []);
49
- useEffect(() => {
274
+ useEffect2(() => {
50
275
  if (typeof window === "undefined") return;
51
276
  const params = new URLSearchParams(window.location.search);
52
277
  if (params.get("__cms") === "edit") setEditMode(true);
53
278
  }, []);
54
- useEffect(() => {
279
+ useEffect2(() => {
55
280
  let cancelled = false;
56
281
  adapter.getOverrides().then((o) => {
57
282
  if (cancelled) return;
@@ -62,7 +287,7 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
62
287
  cancelled = true;
63
288
  };
64
289
  }, [adapter]);
65
- useEffect(() => {
290
+ useEffect2(() => {
66
291
  if (!editMode || typeof window === "undefined") return;
67
292
  const parent = window.parent;
68
293
  if (!parent || parent === window) return;
@@ -80,7 +305,7 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
80
305
  window.addEventListener("message", onMsg);
81
306
  return () => window.removeEventListener("message", onMsg);
82
307
  }, [editMode]);
83
- const setSelectedId = useCallback(
308
+ const setSelectedId = useCallback2(
84
309
  (id) => {
85
310
  setSelectedIdRaw(id);
86
311
  if (editMode && typeof window !== "undefined" && window.parent && window.parent !== window) {
@@ -92,7 +317,7 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
92
317
  },
93
318
  [editMode]
94
319
  );
95
- const registerEditable = useCallback((meta) => {
320
+ const registerEditable = useCallback2((meta) => {
96
321
  registryRef.current.set(meta.id, meta);
97
322
  if (typeof window !== "undefined" && window.parent && window.parent !== window) {
98
323
  window.parent.postMessage(
@@ -105,7 +330,7 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
105
330
  );
106
331
  }
107
332
  }, []);
108
- const unregisterEditable = useCallback((id) => {
333
+ const unregisterEditable = useCallback2((id) => {
109
334
  registryRef.current.delete(id);
110
335
  if (typeof window !== "undefined" && window.parent && window.parent !== window) {
111
336
  window.parent.postMessage(
@@ -118,14 +343,14 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
118
343
  );
119
344
  }
120
345
  }, []);
121
- const setOverride = useCallback((id, value2) => {
346
+ const setOverride = useCallback2((id, value2) => {
122
347
  setOverrides((prev) => ({ ...prev, [id]: value2 }));
123
348
  }, []);
124
- const save = useCallback(async () => {
349
+ const save = useCallback2(async () => {
125
350
  await adapter.setOverrides(overrides);
126
351
  setSavedOverrides(overrides);
127
352
  }, [adapter, overrides]);
128
- const reset = useCallback(
353
+ const reset = useCallback2(
129
354
  async (id) => {
130
355
  if (id) {
131
356
  setOverrides((prev) => {
@@ -143,7 +368,7 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
143
368
  () => JSON.stringify(overrides) !== JSON.stringify(savedOverrides),
144
369
  [overrides, savedOverrides]
145
370
  );
146
- const getRegistered = useCallback(
371
+ const getRegistered = useCallback2(
147
372
  () => Array.from(registryRef.current.values()),
148
373
  []
149
374
  );
@@ -166,10 +391,10 @@ function CmsProvider({ config, adapter, children, iconMap, initialOverrides }) {
166
391
  collectionChangedAt,
167
392
  notifyCollectionChanged
168
393
  }), [config, adapter, overrides, editMode, selectedId, setSelectedId, setOverride, registerEditable, unregisterEditable, getRegistered, save, reset, isDirty, iconMap, collectionChangedAt, notifyCollectionChanged]);
169
- return /* @__PURE__ */ jsx(CmsContext.Provider, { value, children });
394
+ return /* @__PURE__ */ jsx3(CmsContext.Provider, { value, children });
170
395
  }
171
396
  function useSubmit(formId) {
172
- const ctx = useContext(CmsContext);
397
+ const ctx = useContext2(CmsContext);
173
398
  return async (data) => {
174
399
  const submission = {
175
400
  id: crypto.randomUUID(),
@@ -196,11 +421,11 @@ function useSubmit(formId) {
196
421
  }
197
422
 
198
423
  // src/editable.tsx
199
- import { createElement, useEffect as useEffect2 } from "react";
200
- import { jsx as jsx2 } from "react/jsx-runtime";
424
+ import { createElement, useEffect as useEffect3 } from "react";
425
+ import { jsx as jsx4 } from "react/jsx-runtime";
201
426
  function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength) {
202
427
  const ctx = useCmsOptional();
203
- useEffect2(() => {
428
+ useEffect3(() => {
204
429
  if (!ctx) return;
205
430
  ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength });
206
431
  return () => ctx.unregisterEditable(id);
@@ -264,7 +489,7 @@ function EditableImage({
264
489
  e.stopPropagation();
265
490
  ctx.setSelectedId(id);
266
491
  };
267
- return /* @__PURE__ */ jsx2(
492
+ return /* @__PURE__ */ jsx4(
268
493
  "img",
269
494
  {
270
495
  src: value,
@@ -277,6 +502,55 @@ function EditableImage({
277
502
  }
278
503
  );
279
504
  }
505
+ function EditableFile({
506
+ id,
507
+ label,
508
+ section,
509
+ pageId,
510
+ src,
511
+ defaultUrl = "",
512
+ className,
513
+ children
514
+ }) {
515
+ const initialUrl = src || defaultUrl;
516
+ const ctx = useRegister(id, "file", label, section, pageId, initialUrl);
517
+ const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? initialUrl) : initialUrl;
518
+ const active = !!ctx?.editMode;
519
+ const selected = ctx?.selectedId === id;
520
+ const onClick = (e) => {
521
+ if (!active || !ctx) return;
522
+ e.preventDefault();
523
+ e.stopPropagation();
524
+ ctx.setSelectedId(id);
525
+ };
526
+ if (children) {
527
+ return /* @__PURE__ */ jsx4(
528
+ "div",
529
+ {
530
+ "data-cms-id": id,
531
+ onClick: active ? onClick : void 0,
532
+ className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
533
+ children: children(value)
534
+ }
535
+ );
536
+ }
537
+ return /* @__PURE__ */ jsx4(
538
+ "div",
539
+ {
540
+ "data-cms-id": id,
541
+ onClick: active ? onClick : void 0,
542
+ className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
543
+ children: /* @__PURE__ */ jsx4(
544
+ "iframe",
545
+ {
546
+ src: value,
547
+ className: "w-full h-[500px] rounded-xl border-0",
548
+ title: label || id
549
+ }
550
+ )
551
+ }
552
+ );
553
+ }
280
554
  function EditableLink({
281
555
  id,
282
556
  label,
@@ -304,7 +578,7 @@ function EditableLink({
304
578
  const isExternal = hrefValue.startsWith("http");
305
579
  const computedTarget = target || (isExternal ? "_blank" : void 0);
306
580
  const computedRel = computedTarget === "_blank" ? "noopener noreferrer" : void 0;
307
- return /* @__PURE__ */ jsx2(
581
+ return /* @__PURE__ */ jsx4(
308
582
  "a",
309
583
  {
310
584
  href: hrefValue,
@@ -332,246 +606,57 @@ function EditableList({
332
606
  }) {
333
607
  const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength);
334
608
  const rawValue = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : initialItems;
335
- const value = Array.isArray(rawValue) ? rawValue : initialItems;
336
- const active = !!ctx?.editMode;
337
- const selected = ctx?.selectedId === id;
338
- const onClick = (e) => {
339
- if (!active || !ctx) return;
340
- e.preventDefault();
341
- e.stopPropagation();
342
- ctx.setSelectedId(id);
343
- };
344
- return /* @__PURE__ */ jsx2(
345
- "div",
346
- {
347
- "data-cms-id": id,
348
- onClick: active ? onClick : void 0,
349
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
350
- children: renderList ? renderList(value) : /* @__PURE__ */ jsx2("div", { className: listClassName, children: renderItem && value.map(renderItem) })
351
- }
352
- );
353
- }
354
-
355
- // src/admin/AdminApp.tsx
356
- import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
357
- import {
358
- FileText,
359
- Boxes,
360
- Settings as SettingsIcon,
361
- Pencil,
362
- Plus,
363
- Trash2,
364
- X,
365
- Upload,
366
- RotateCcw,
367
- Monitor,
368
- Tablet,
369
- Smartphone,
370
- PanelLeftClose,
371
- PanelLeftOpen,
372
- Search,
373
- ChevronDown,
374
- ChevronUp,
375
- Inbox,
376
- RefreshCw,
377
- Eye,
378
- EyeOff,
379
- ChevronLeft,
380
- ChevronRight,
381
- SlidersHorizontal,
382
- LogOut
383
- } from "lucide-react";
384
- import { CreditCard as CreditCard2 } from "lucide-react";
385
-
386
- // src/subscription/SubscriptionProvider.tsx
387
- import { createContext as createContext2, useContext as useContext2, useState as useState2, useCallback as useCallback2, useEffect as useEffect3 } from "react";
388
- import { jsx as jsx3 } from "react/jsx-runtime";
389
- var SubscriptionContext = createContext2(void 0);
390
- function useSubscriptionContext() {
391
- const ctx = useContext2(SubscriptionContext);
392
- if (!ctx) {
393
- throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");
394
- }
395
- return ctx;
396
- }
397
- function useSubscription() {
398
- return useSubscriptionContext();
399
- }
400
- function SubscriptionProvider({
401
- children,
402
- apiUrl,
403
- projectId,
404
- email
405
- }) {
406
- const [subscription, setSubscription] = useState2(null);
407
- const [loading, setLoading] = useState2(true);
408
- const [error, setError] = useState2(null);
409
- const fetchSubscription = useCallback2(
410
- async (silent = false) => {
411
- if (!apiUrl || !projectId) {
412
- setLoading(false);
413
- return;
414
- }
415
- if (!silent) setLoading(true);
416
- setError(null);
417
- try {
418
- const res = await fetch(`${apiUrl}/api/validate-subscription`, {
419
- method: "POST",
420
- headers: { "Content-Type": "application/json" },
421
- body: JSON.stringify({ projectId })
422
- });
423
- if (!res.ok) throw new Error(`Server error: ${res.status}`);
424
- const data = await res.json();
425
- setSubscription({
426
- subscriptionStatus: data.valid ? data.status : "inactive",
427
- currentPeriodEnd: data.expiryDate,
428
- customerEmail: email,
429
- subscriptionId: data._id,
430
- stripeCustomerId: data.stripeCustomerId,
431
- stripePaymentLink: data.stripePaymentLink,
432
- valid: data.valid
433
- });
434
- } catch (err) {
435
- console.error("SubscriptionProvider Error:", err);
436
- setError(err.message || "Failed to fetch subscription");
437
- setSubscription({ subscriptionStatus: "active", valid: true });
438
- } finally {
439
- setLoading(false);
440
- }
441
- },
442
- [apiUrl, projectId, email]
443
- );
444
- useEffect3(() => {
445
- fetchSubscription();
446
- const handleFocus = () => {
447
- fetchSubscription(true);
448
- };
449
- window.addEventListener("focus", handleFocus);
450
- let intervalId;
451
- if (subscription && !subscription.valid) {
452
- intervalId = setInterval(() => {
453
- fetchSubscription(true);
454
- }, 1e4);
455
- }
456
- return () => {
457
- window.removeEventListener("focus", handleFocus);
458
- if (intervalId) clearInterval(intervalId);
459
- };
460
- }, [fetchSubscription, subscription?.valid]);
461
- const value = {
462
- subscription,
463
- loading,
464
- error,
465
- refetch: fetchSubscription,
466
- isSubscriptionActive: subscription?.valid ?? true,
467
- config: { apiUrl, projectId }
468
- };
469
- return /* @__PURE__ */ jsx3(SubscriptionContext.Provider, { value, children });
470
- }
471
-
472
- // src/subscription/SubscriptionPage.tsx
473
- import { useState as useState3 } from "react";
474
- import { CreditCard, ExternalLink, Settings, AlertTriangle, CheckCircle2 } from "lucide-react";
475
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
476
- function SubscriptionPage() {
477
- const { subscription, loading, config } = useSubscription();
478
- const [actionLoading, setActionLoading] = useState3(null);
479
- const status = subscription?.subscriptionStatus || "inactive";
480
- const isValid = subscription?.valid ?? false;
481
- const handleSubscribe = () => {
482
- if (!subscription?.stripePaymentLink) {
483
- alert("No payment link found. Please contact support.");
484
- return;
485
- }
486
- const raw = subscription.stripePaymentLink;
487
- const url = raw.startsWith("http") ? raw : `https://buy.stripe.com/${raw}`;
488
- window.open(url, "_blank");
489
- };
490
- const handleManageBilling = async () => {
491
- if (!subscription?.stripeCustomerId) {
492
- alert("No customer ID available. Please contact support.");
493
- return;
494
- }
495
- setActionLoading("billing");
496
- try {
497
- const returnUrl = window.location.href;
498
- const apiUrl = config.apiUrl || "https://dev-soft-admin-sigma.vercel.app";
499
- const res = await fetch(`${apiUrl}/api/create-billing-session`, {
500
- method: "POST",
501
- headers: { "Content-Type": "application/json" },
502
- body: JSON.stringify({
503
- customerId: subscription.stripeCustomerId,
504
- returnUrl
505
- })
506
- });
507
- if (!res.ok) throw new Error(`Server error: ${res.status}`);
508
- const data = await res.json();
509
- if (data.url) {
510
- window.open(data.url, "_blank");
511
- } else {
512
- alert("Could not create billing session.");
513
- }
514
- } catch (err) {
515
- alert(`Portal failed: ${err.message}`);
516
- } finally {
517
- setActionLoading(null);
518
- }
609
+ const value = Array.isArray(rawValue) ? rawValue : initialItems;
610
+ const active = !!ctx?.editMode;
611
+ const selected = ctx?.selectedId === id;
612
+ const onClick = (e) => {
613
+ if (!active || !ctx) return;
614
+ e.preventDefault();
615
+ e.stopPropagation();
616
+ ctx.setSelectedId(id);
519
617
  };
520
- if (loading && !subscription) {
521
- return /* @__PURE__ */ jsx4("div", { className: "flex h-full min-h-[500px] w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 text-slate-500", children: [
522
- /* @__PURE__ */ jsx4("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-indigo-200 border-t-indigo-600" }),
523
- /* @__PURE__ */ jsx4("p", { className: "text-sm font-medium", children: "Verifying subscription..." })
524
- ] }) });
525
- }
526
- return /* @__PURE__ */ jsx4("div", { className: "flex min-h-screen w-full flex-col items-center justify-center bg-slate-50 p-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl", children: [
527
- /* @__PURE__ */ jsxs("div", { className: `p-8 text-center ${isValid ? "bg-emerald-50" : "bg-rose-50"}`, children: [
528
- /* @__PURE__ */ jsx4("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white shadow-sm", children: isValid ? /* @__PURE__ */ jsx4(CheckCircle2, { className: "h-8 w-8 text-emerald-500" }) : /* @__PURE__ */ jsx4(AlertTriangle, { className: "h-8 w-8 text-rose-500" }) }),
529
- /* @__PURE__ */ jsx4("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: isValid ? "Subscription Active" : "Subscription Inactive" }),
530
- /* @__PURE__ */ jsx4("p", { className: "mt-2 text-sm text-slate-600", children: isValid ? "Your subscription is currently active and in good standing." : "Your project requires an active subscription to access the administration panel." })
531
- ] }),
532
- /* @__PURE__ */ jsxs("div", { className: "p-8", children: [
533
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
534
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-xl bg-slate-50 p-4 border border-slate-100", children: [
535
- /* @__PURE__ */ jsx4("span", { className: "text-sm font-medium text-slate-500", children: "Status" }),
536
- /* @__PURE__ */ jsx4("span", { className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold capitalize ${isValid ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: status })
537
- ] }),
538
- subscription?.currentPeriodEnd && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-xl bg-slate-50 p-4 border border-slate-100", children: [
539
- /* @__PURE__ */ jsx4("span", { className: "text-sm font-medium text-slate-500", children: "Next Billing Date" }),
540
- /* @__PURE__ */ jsx4("span", { className: "text-sm font-semibold text-slate-900", children: new Date(subscription.currentPeriodEnd).toLocaleDateString() })
541
- ] })
542
- ] }),
543
- /* @__PURE__ */ jsxs("div", { className: "mt-8 space-y-3", children: [
544
- !isValid && /* @__PURE__ */ jsxs(
545
- "button",
546
- {
547
- onClick: handleSubscribe,
548
- className: "group flex w-full items-center justify-center gap-2 rounded-xl bg-indigo-600 px-4 py-3.5 text-sm font-semibold text-white shadow-sm transition-all hover:bg-indigo-700 hover:shadow",
549
- children: [
550
- /* @__PURE__ */ jsx4(CreditCard, { className: "h-4 w-4" }),
551
- "Pay Now to Restore Access",
552
- /* @__PURE__ */ jsx4(ExternalLink, { className: "h-3.5 w-3.5 opacity-70 transition-transform group-hover:translate-x-0.5" })
553
- ]
554
- }
555
- ),
556
- /* @__PURE__ */ jsxs(
557
- "button",
558
- {
559
- onClick: handleManageBilling,
560
- disabled: actionLoading === "billing",
561
- className: "group flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-white px-4 py-3.5 text-sm font-semibold text-slate-700 shadow-sm transition-all hover:bg-slate-50 hover:text-slate-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50",
562
- children: [
563
- actionLoading === "billing" ? /* @__PURE__ */ jsx4("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600" }) : /* @__PURE__ */ jsx4(Settings, { className: "h-4 w-4 text-slate-400 group-hover:text-slate-600" }),
564
- "Manage Billing & Invoices"
565
- ]
566
- }
567
- )
568
- ] })
569
- ] })
570
- ] }) });
618
+ return /* @__PURE__ */ jsx4(
619
+ "div",
620
+ {
621
+ "data-cms-id": id,
622
+ onClick: active ? onClick : void 0,
623
+ className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
624
+ children: renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) })
625
+ }
626
+ );
571
627
  }
572
628
 
573
629
  // src/admin/AdminApp.tsx
574
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
630
+ import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
631
+ import {
632
+ FileText,
633
+ Boxes,
634
+ Settings as SettingsIcon,
635
+ Pencil,
636
+ Plus,
637
+ Trash2,
638
+ X,
639
+ Upload,
640
+ RotateCcw,
641
+ Monitor,
642
+ Tablet,
643
+ Smartphone,
644
+ PanelLeftClose,
645
+ PanelLeftOpen,
646
+ Search,
647
+ ChevronDown,
648
+ ChevronUp,
649
+ Inbox,
650
+ RefreshCw,
651
+ Eye,
652
+ EyeOff,
653
+ ChevronLeft,
654
+ ChevronRight,
655
+ SlidersHorizontal,
656
+ LogOut
657
+ } from "lucide-react";
658
+ import { CreditCard as CreditCard2 } from "lucide-react";
659
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
575
660
  async function handleImageFile(file, onUrl, uploadImage) {
576
661
  if (uploadImage) {
577
662
  try {
@@ -601,106 +686,111 @@ function AdminAppContent() {
601
686
  } catch (e) {
602
687
  }
603
688
  const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
689
+ const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
604
690
  if (!isSubscriptionActive) {
605
691
  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, {}) });
606
692
  }
607
- return /* @__PURE__ */ jsxs2("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: [
608
- /* @__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__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
609
- 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)]" }),
610
- /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
611
- ] }) }),
612
- /* @__PURE__ */ jsxs2("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: [
613
- /* @__PURE__ */ jsxs2("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
614
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 mb-1", children: [
615
- 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)]" }),
616
- /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
693
+ 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: [
694
+ 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." }),
695
+ 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." }),
696
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
697
+ /* @__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: [
698
+ 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)]" }),
699
+ /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
700
+ ] }) }),
701
+ /* @__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: [
702
+ /* @__PURE__ */ jsxs3("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
703
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 mb-1", children: [
704
+ 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)]" }),
705
+ /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
706
+ ] }),
707
+ /* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
617
708
  ] }),
618
- /* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
619
- ] }),
620
- /* @__PURE__ */ jsxs2("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: [
621
- /* @__PURE__ */ jsx5(
622
- SideItem,
623
- {
624
- active: section === "pages",
625
- onClick: () => setSection("pages"),
626
- icon: /* @__PURE__ */ jsx5(FileText, { className: "h-4 w-4 shrink-0" }),
627
- children: "Pages"
628
- }
629
- ),
630
- /* @__PURE__ */ jsx5(
631
- SideItem,
632
- {
633
- active: section === "collections",
634
- onClick: () => setSection("collections"),
635
- icon: /* @__PURE__ */ jsx5(Boxes, { className: "h-4 w-4 shrink-0" }),
636
- children: "Collections"
637
- }
638
- ),
639
- /* @__PURE__ */ jsx5(
640
- SideItem,
641
- {
642
- active: section === "submissions",
643
- onClick: () => setSection("submissions"),
644
- icon: /* @__PURE__ */ jsx5(Inbox, { className: "h-4 w-4 shrink-0" }),
645
- children: "Data"
646
- }
647
- ),
648
- /* @__PURE__ */ jsx5(
649
- SideItem,
650
- {
651
- active: section === "config",
652
- onClick: () => setSection("config"),
653
- icon: /* @__PURE__ */ jsx5(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
654
- children: "Config"
655
- }
656
- ),
657
- /* @__PURE__ */ jsx5(
658
- SideItem,
659
- {
660
- active: section === "settings",
661
- onClick: () => setSection("settings"),
662
- icon: /* @__PURE__ */ jsx5(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
663
- children: "Settings"
664
- }
665
- ),
666
- subscriptionCtx && /* @__PURE__ */ jsx5(
667
- SideItem,
668
- {
669
- active: section === "subscription",
670
- onClick: () => setSection("subscription"),
671
- icon: /* @__PURE__ */ jsx5(CreditCard2, { className: "h-4 w-4 shrink-0" }),
672
- children: "Subscription"
673
- }
674
- )
675
- ] }),
676
- /* @__PURE__ */ jsxs2("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
677
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
678
- /* @__PURE__ */ jsx5("span", { children: "Storage Adapter" }),
679
- /* @__PURE__ */ jsx5("span", { className: "font-semibold px-2 py-0.5 rounded-full bg-slate-200 text-slate-700", children: ctx.adapter.name })
709
+ /* @__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: [
710
+ /* @__PURE__ */ jsx5(
711
+ SideItem,
712
+ {
713
+ active: section === "pages",
714
+ onClick: () => setSection("pages"),
715
+ icon: /* @__PURE__ */ jsx5(FileText, { className: "h-4 w-4 shrink-0" }),
716
+ children: "Pages"
717
+ }
718
+ ),
719
+ /* @__PURE__ */ jsx5(
720
+ SideItem,
721
+ {
722
+ active: section === "collections",
723
+ onClick: () => setSection("collections"),
724
+ icon: /* @__PURE__ */ jsx5(Boxes, { className: "h-4 w-4 shrink-0" }),
725
+ children: "Collections"
726
+ }
727
+ ),
728
+ /* @__PURE__ */ jsx5(
729
+ SideItem,
730
+ {
731
+ active: section === "submissions",
732
+ onClick: () => setSection("submissions"),
733
+ icon: /* @__PURE__ */ jsx5(Inbox, { className: "h-4 w-4 shrink-0" }),
734
+ children: "Data"
735
+ }
736
+ ),
737
+ /* @__PURE__ */ jsx5(
738
+ SideItem,
739
+ {
740
+ active: section === "config",
741
+ onClick: () => setSection("config"),
742
+ icon: /* @__PURE__ */ jsx5(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
743
+ children: "Config"
744
+ }
745
+ ),
746
+ /* @__PURE__ */ jsx5(
747
+ SideItem,
748
+ {
749
+ active: section === "settings",
750
+ onClick: () => setSection("settings"),
751
+ icon: /* @__PURE__ */ jsx5(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
752
+ children: "Settings"
753
+ }
754
+ ),
755
+ subscriptionCtx && /* @__PURE__ */ jsx5(
756
+ SideItem,
757
+ {
758
+ active: section === "subscription",
759
+ onClick: () => setSection("subscription"),
760
+ icon: /* @__PURE__ */ jsx5(CreditCard2, { className: "h-4 w-4 shrink-0" }),
761
+ children: "Subscription"
762
+ }
763
+ )
680
764
  ] }),
681
- /* @__PURE__ */ jsxs2(
682
- "button",
683
- {
684
- onClick: async () => {
685
- await fetch("/api/admin/auth?action=logout", { method: "POST" });
686
- window.location.href = "/admin/login";
687
- },
688
- className: "flex items-center justify-center gap-2 w-full px-3 py-2 text-sm font-medium text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",
689
- children: [
690
- /* @__PURE__ */ jsx5(LogOut, { className: "w-4 h-4" }),
691
- "Logout"
692
- ]
693
- }
694
- )
765
+ /* @__PURE__ */ jsxs3("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
766
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
767
+ /* @__PURE__ */ jsx5("span", { children: "Storage Adapter" }),
768
+ /* @__PURE__ */ jsx5("span", { className: "font-semibold px-2 py-0.5 rounded-full bg-slate-200 text-slate-700", children: ctx.adapter.name })
769
+ ] }),
770
+ /* @__PURE__ */ jsxs3(
771
+ "button",
772
+ {
773
+ onClick: async () => {
774
+ await fetch("/api/admin/auth?action=logout", { method: "POST" });
775
+ window.location.href = "/admin/login";
776
+ },
777
+ className: "flex items-center justify-center gap-2 w-full px-3 py-2 text-sm font-medium text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",
778
+ children: [
779
+ /* @__PURE__ */ jsx5(LogOut, { className: "w-4 h-4" }),
780
+ "Logout"
781
+ ]
782
+ }
783
+ )
784
+ ] })
785
+ ] }),
786
+ /* @__PURE__ */ jsxs3("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
787
+ section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
788
+ section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
789
+ section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
790
+ section === "config" && /* @__PURE__ */ jsx5(ConfigSection, {}),
791
+ section === "settings" && /* @__PURE__ */ jsx5(SettingsSection, {}),
792
+ section === "subscription" && /* @__PURE__ */ jsx5(SubscriptionPage, {})
695
793
  ] })
696
- ] }),
697
- /* @__PURE__ */ jsxs2("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
698
- section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
699
- section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
700
- section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
701
- section === "config" && /* @__PURE__ */ jsx5(ConfigSection, {}),
702
- section === "settings" && /* @__PURE__ */ jsx5(SettingsSection, {}),
703
- section === "subscription" && /* @__PURE__ */ jsx5(SubscriptionPage, {})
704
794
  ] })
705
795
  ] });
706
796
  }
@@ -710,7 +800,7 @@ function SideItem({
710
800
  icon,
711
801
  children
712
802
  }) {
713
- return /* @__PURE__ */ jsxs2(
803
+ return /* @__PURE__ */ jsxs3(
714
804
  "button",
715
805
  {
716
806
  onClick,
@@ -728,10 +818,10 @@ function PagesSection() {
728
818
  ctx.config.pages[0] ?? null
729
819
  );
730
820
  const [showList, setShowList] = useState4(true);
731
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col lg:flex-row h-full", children: [
732
- showList && /* @__PURE__ */ jsxs2("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: [
821
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row h-full", children: [
822
+ 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: [
733
823
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
734
- /* @__PURE__ */ jsxs2("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
824
+ /* @__PURE__ */ jsxs3("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
735
825
  ctx.config.pages.map((p) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
736
826
  "button",
737
827
  {
@@ -802,21 +892,21 @@ function PageEditor({ page, showList, onToggleList }) {
802
892
  );
803
893
  const selectedMeta = registered.find((r) => r.id === selectedId) ?? null;
804
894
  const [viewMode, setViewMode] = useState4("desktop");
805
- return /* @__PURE__ */ jsxs2("div", { className: "flex h-full flex-col", children: [
806
- /* @__PURE__ */ jsxs2("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: [
807
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
895
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full flex-col", children: [
896
+ /* @__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: [
897
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
808
898
  /* @__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" }) }),
809
899
  /* @__PURE__ */ jsx5("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
810
900
  /* @__PURE__ */ jsx5("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
811
901
  /* @__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 })
812
902
  ] }),
813
- /* @__PURE__ */ jsxs2("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: [
814
- /* @__PURE__ */ jsxs2("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
903
+ /* @__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: [
904
+ /* @__PURE__ */ jsxs3("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
815
905
  /* @__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" }) }),
816
906
  /* @__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" }) }),
817
907
  /* @__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" }) })
818
908
  ] }),
819
- /* @__PURE__ */ jsxs2(
909
+ /* @__PURE__ */ jsxs3(
820
910
  "button",
821
911
  {
822
912
  onClick: () => setPreview((v) => !v),
@@ -827,7 +917,7 @@ function PageEditor({ page, showList, onToggleList }) {
827
917
  ]
828
918
  }
829
919
  ),
830
- /* @__PURE__ */ jsxs2(
920
+ /* @__PURE__ */ jsxs3(
831
921
  "a",
832
922
  {
833
923
  href: page.path,
@@ -840,7 +930,7 @@ function PageEditor({ page, showList, onToggleList }) {
840
930
  ]
841
931
  }
842
932
  ),
843
- /* @__PURE__ */ jsxs2(
933
+ /* @__PURE__ */ jsxs3(
844
934
  "button",
845
935
  {
846
936
  onClick: () => ctx.reset(),
@@ -852,7 +942,7 @@ function PageEditor({ page, showList, onToggleList }) {
852
942
  ]
853
943
  }
854
944
  ),
855
- /* @__PURE__ */ jsxs2(
945
+ /* @__PURE__ */ jsxs3(
856
946
  "button",
857
947
  {
858
948
  onClick: () => ctx.save(),
@@ -866,7 +956,7 @@ function PageEditor({ page, showList, onToggleList }) {
866
956
  )
867
957
  ] })
868
958
  ] }),
869
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
959
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
870
960
  /* @__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(
871
961
  "iframe",
872
962
  {
@@ -877,11 +967,11 @@ function PageEditor({ page, showList, onToggleList }) {
877
967
  },
878
968
  src
879
969
  ) }) }),
880
- /* @__PURE__ */ jsxs2("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: [
881
- /* @__PURE__ */ jsxs2("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: [
970
+ /* @__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: [
971
+ /* @__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: [
882
972
  /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
883
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
884
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1 sm:hidden", children: [
973
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
974
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 sm:hidden", children: [
885
975
  /* @__PURE__ */ jsx5(
886
976
  "button",
887
977
  {
@@ -904,7 +994,7 @@ function PageEditor({ page, showList, onToggleList }) {
904
994
  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" })
905
995
  ] })
906
996
  ] }),
907
- /* @__PURE__ */ jsxs2("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
997
+ /* @__PURE__ */ jsxs3("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
908
998
  !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." }) }),
909
999
  selectedMeta ? /* @__PURE__ */ jsx5(
910
1000
  FieldEditor,
@@ -951,7 +1041,7 @@ function SectionAccordion({
951
1041
  }) {
952
1042
  const [expanded, setExpanded] = useState4({});
953
1043
  if (registered.length === 0) {
954
- return /* @__PURE__ */ jsxs2("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
1044
+ return /* @__PURE__ */ jsxs3("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
955
1045
  /* @__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" }) }),
956
1046
  "No editable fields detected on this page."
957
1047
  ] });
@@ -965,19 +1055,19 @@ function SectionAccordion({
965
1055
  const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
966
1056
  const unsectionedFields = groups["Unsectioned"] || [];
967
1057
  const toggle = (name) => setExpanded((prev) => ({ ...prev, [name]: !prev[name] }));
968
- return /* @__PURE__ */ jsxs2("div", { className: "p-2 space-y-3", children: [
1058
+ return /* @__PURE__ */ jsxs3("div", { className: "p-2 space-y-3", children: [
969
1059
  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)) }),
970
1060
  sectionNames.map((sectionName) => {
971
1061
  const isOpen = expanded[sectionName] ?? false;
972
1062
  const fields = groups[sectionName];
973
- return /* @__PURE__ */ jsxs2("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
974
- /* @__PURE__ */ jsxs2(
1063
+ return /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
1064
+ /* @__PURE__ */ jsxs3(
975
1065
  "button",
976
1066
  {
977
1067
  onClick: () => toggle(sectionName),
978
1068
  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",
979
1069
  children: [
980
- /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-2", children: [
1070
+ /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2", children: [
981
1071
  /* @__PURE__ */ jsx5("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
982
1072
  /* @__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 })
983
1073
  ] }),
@@ -1001,15 +1091,15 @@ function SectionAccordion({
1001
1091
  ] });
1002
1092
  }
1003
1093
  function FieldListItem({ meta, onSelect }) {
1004
- return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs2(
1094
+ return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs3(
1005
1095
  "button",
1006
1096
  {
1007
1097
  onClick: () => onSelect(meta.id),
1008
1098
  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",
1009
1099
  children: [
1010
- /* @__PURE__ */ jsxs2("span", { className: "overflow-hidden", children: [
1100
+ /* @__PURE__ */ jsxs3("span", { className: "overflow-hidden", children: [
1011
1101
  /* @__PURE__ */ jsx5("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
1012
- /* @__PURE__ */ jsxs2("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1102
+ /* @__PURE__ */ jsxs3("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1013
1103
  meta.type,
1014
1104
  " ",
1015
1105
  /* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
@@ -1030,13 +1120,13 @@ function FieldEditor({
1030
1120
  onClose
1031
1121
  }) {
1032
1122
  const ctx = useCmsContext();
1033
- return /* @__PURE__ */ jsxs2("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
1034
- /* @__PURE__ */ jsxs2("div", { className: "mb-5", children: [
1123
+ return /* @__PURE__ */ jsxs3("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
1124
+ /* @__PURE__ */ jsxs3("div", { className: "mb-5", children: [
1035
1125
  /* @__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 }),
1036
1126
  /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
1037
1127
  /* @__PURE__ */ jsx5("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
1038
1128
  ] }),
1039
- /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
1129
+ /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
1040
1130
  meta.type === "text" && /* @__PURE__ */ jsx5(
1041
1131
  "input",
1042
1132
  {
@@ -1055,8 +1145,8 @@ function FieldEditor({
1055
1145
  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"
1056
1146
  }
1057
1147
  ),
1058
- meta.type === "image" && /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
1059
- /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
1148
+ meta.type === "image" && /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1149
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1060
1150
  /* @__PURE__ */ jsx5(
1061
1151
  "input",
1062
1152
  {
@@ -1067,7 +1157,7 @@ function FieldEditor({
1067
1157
  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"
1068
1158
  }
1069
1159
  ),
1070
- /* @__PURE__ */ jsxs2("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: [
1160
+ /* @__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: [
1071
1161
  "Upload",
1072
1162
  /* @__PURE__ */ jsx5(
1073
1163
  "input",
@@ -1085,7 +1175,7 @@ function FieldEditor({
1085
1175
  )
1086
1176
  ] })
1087
1177
  ] }),
1088
- value ? /* @__PURE__ */ jsxs2("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
1178
+ value ? /* @__PURE__ */ jsxs3("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
1089
1179
  /* @__PURE__ */ jsx5(
1090
1180
  "img",
1091
1181
  {
@@ -1097,8 +1187,43 @@ function FieldEditor({
1097
1187
  /* @__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" }) })
1098
1188
  ] }) : null
1099
1189
  ] }),
1100
- meta.type === "link" && /* @__PURE__ */ jsxs2("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
1101
- /* @__PURE__ */ jsxs2("label", { className: "block", children: [
1190
+ meta.type === "file" && /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1191
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1192
+ /* @__PURE__ */ jsx5(
1193
+ "input",
1194
+ {
1195
+ type: "url",
1196
+ value: String(value ?? ""),
1197
+ onChange: (e) => onChange(e.target.value),
1198
+ placeholder: "https://... or upload PDF/file",
1199
+ 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"
1200
+ }
1201
+ ),
1202
+ /* @__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: [
1203
+ "Upload File",
1204
+ /* @__PURE__ */ jsx5(
1205
+ "input",
1206
+ {
1207
+ type: "file",
1208
+ accept: "application/pdf,.pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/*",
1209
+ className: "hidden",
1210
+ onChange: (e) => {
1211
+ const file = e.target.files?.[0];
1212
+ if (file) {
1213
+ void handleImageFile(file, onChange, ctx.uploadImage);
1214
+ }
1215
+ }
1216
+ }
1217
+ )
1218
+ ] })
1219
+ ] }),
1220
+ 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: [
1221
+ /* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} File URL:" }),
1222
+ /* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
1223
+ ] }) : null
1224
+ ] }),
1225
+ meta.type === "link" && /* @__PURE__ */ jsxs3("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
1226
+ /* @__PURE__ */ jsxs3("label", { className: "block", children: [
1102
1227
  /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
1103
1228
  /* @__PURE__ */ jsx5(
1104
1229
  "input",
@@ -1109,7 +1234,7 @@ function FieldEditor({
1109
1234
  }
1110
1235
  )
1111
1236
  ] }),
1112
- /* @__PURE__ */ jsxs2("label", { className: "block", children: [
1237
+ /* @__PURE__ */ jsxs3("label", { className: "block", children: [
1113
1238
  /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL Target" }),
1114
1239
  /* @__PURE__ */ jsx5(
1115
1240
  "input",
@@ -1122,7 +1247,7 @@ function FieldEditor({
1122
1247
  )
1123
1248
  ] })
1124
1249
  ] }),
1125
- meta.type === "color" && /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1250
+ meta.type === "color" && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1126
1251
  /* @__PURE__ */ jsx5(
1127
1252
  "input",
1128
1253
  {
@@ -1151,9 +1276,9 @@ function FieldEditor({
1151
1276
  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"
1152
1277
  }
1153
1278
  ),
1154
- meta.type === "list" && /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
1155
- (Array.isArray(value) ? value : []).map((item, idx) => /* @__PURE__ */ jsxs2("div", { className: "flex gap-3 items-start bg-slate-50 p-3 rounded-xl border border-slate-100 relative group", children: [
1156
- /* @__PURE__ */ jsx5("div", { className: "flex-1 space-y-3 w-full", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs2("div", { children: [
1279
+ meta.type === "list" && /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
1280
+ (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: [
1281
+ /* @__PURE__ */ jsx5("div", { className: "flex-1 space-y-3 w-full", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs3("div", { children: [
1157
1282
  /* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1158
1283
  schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
1159
1284
  SearchableSelect,
@@ -1180,7 +1305,7 @@ function FieldEditor({
1180
1305
  },
1181
1306
  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"
1182
1307
  }
1183
- ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs2("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1308
+ ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1184
1309
  /* @__PURE__ */ jsx5(
1185
1310
  "input",
1186
1311
  {
@@ -1195,8 +1320,8 @@ function FieldEditor({
1195
1320
  }
1196
1321
  ),
1197
1322
  /* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1198
- ] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs2("div", { className: "space-y-3 mt-1", children: [
1199
- /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
1323
+ ] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3 mt-1", children: [
1324
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1200
1325
  /* @__PURE__ */ jsx5(
1201
1326
  "input",
1202
1327
  {
@@ -1211,7 +1336,7 @@ function FieldEditor({
1211
1336
  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"
1212
1337
  }
1213
1338
  ),
1214
- /* @__PURE__ */ jsxs2("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: [
1339
+ /* @__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: [
1215
1340
  "Upload",
1216
1341
  /* @__PURE__ */ jsx5(
1217
1342
  "input",
@@ -1284,7 +1409,7 @@ function FieldEditor({
1284
1409
  }
1285
1410
  )
1286
1411
  ] }, idx)),
1287
- !meta.fixedLength && /* @__PURE__ */ jsxs2(
1412
+ !meta.fixedLength && /* @__PURE__ */ jsxs3(
1288
1413
  "button",
1289
1414
  {
1290
1415
  onClick: () => {
@@ -1310,8 +1435,8 @@ function FieldEditor({
1310
1435
  ] }),
1311
1436
  " "
1312
1437
  ] }),
1313
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1314
- /* @__PURE__ */ jsxs2(
1438
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1439
+ /* @__PURE__ */ jsxs3(
1315
1440
  "button",
1316
1441
  {
1317
1442
  onClick: onReset,
@@ -1347,18 +1472,18 @@ function CollectionsSection() {
1347
1472
  });
1348
1473
  });
1349
1474
  }, [ctx.adapter, collections]);
1350
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1351
- /* @__PURE__ */ jsxs2("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: [
1475
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1476
+ /* @__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: [
1352
1477
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
1353
- /* @__PURE__ */ jsxs2("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: [
1354
- collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs2(
1478
+ /* @__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: [
1479
+ collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs3(
1355
1480
  "button",
1356
1481
  {
1357
1482
  onClick: () => setSelected(c),
1358
1483
  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"}`,
1359
1484
  children: [
1360
1485
  /* @__PURE__ */ jsx5("div", { className: selected?.id === c.id ? "text-slate-900" : "text-slate-700", children: c.name }),
1361
- /* @__PURE__ */ jsxs2("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
1486
+ /* @__PURE__ */ jsxs3("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
1362
1487
  counts[c.id] ?? 0,
1363
1488
  " items"
1364
1489
  ] })
@@ -1368,7 +1493,7 @@ function CollectionsSection() {
1368
1493
  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." })
1369
1494
  ] })
1370
1495
  ] }),
1371
- /* @__PURE__ */ jsxs2("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1496
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1372
1497
  /* @__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" }),
1373
1498
  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." })
1374
1499
  ] })
@@ -1469,13 +1594,13 @@ function CollectionEditor({ collection }) {
1469
1594
  setDragOverIdx(null);
1470
1595
  };
1471
1596
  const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order").slice(0, 5);
1472
- return /* @__PURE__ */ jsxs2("div", { className: "mx-auto max-w-5xl", children: [
1473
- /* @__PURE__ */ jsxs2("div", { className: "mb-8 flex items-center justify-between", children: [
1474
- /* @__PURE__ */ jsxs2("div", { children: [
1597
+ return /* @__PURE__ */ jsxs3("div", { className: "mx-auto max-w-5xl", children: [
1598
+ /* @__PURE__ */ jsxs3("div", { className: "mb-8 flex items-center justify-between", children: [
1599
+ /* @__PURE__ */ jsxs3("div", { children: [
1475
1600
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
1476
1601
  collection.description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
1477
1602
  ] }),
1478
- /* @__PURE__ */ jsxs2(
1603
+ /* @__PURE__ */ jsxs3(
1479
1604
  "button",
1480
1605
  {
1481
1606
  onClick: startNew,
@@ -1487,13 +1612,13 @@ function CollectionEditor({ collection }) {
1487
1612
  }
1488
1613
  )
1489
1614
  ] }),
1490
- editing && /* @__PURE__ */ jsxs2("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: [
1491
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 mb-6", children: [
1615
+ 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: [
1616
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 mb-6", children: [
1492
1617
  /* @__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" }) }),
1493
1618
  /* @__PURE__ */ jsx5("h3", { className: "text-lg font-bold text-slate-900", children: "Edit Entry" })
1494
1619
  ] }),
1495
- /* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */ jsxs2("label", { className: `block ${f.type === "richtext" ? "md:col-span-2" : ""}`, children: [
1496
- /* @__PURE__ */ jsxs2("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
1620
+ /* @__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: [
1621
+ /* @__PURE__ */ jsxs3("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
1497
1622
  f.label,
1498
1623
  /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
1499
1624
  ] }),
@@ -1530,7 +1655,7 @@ function CollectionEditor({ collection }) {
1530
1655
  placeholder: `Search ${f.label.toLowerCase()}...`,
1531
1656
  iconMap: ctx.iconMap
1532
1657
  }
1533
- ) : f.type === "slug" ? /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
1658
+ ) : f.type === "slug" ? /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1534
1659
  /* @__PURE__ */ jsx5(
1535
1660
  "input",
1536
1661
  {
@@ -1554,7 +1679,7 @@ function CollectionEditor({ collection }) {
1554
1679
  children: "Generate"
1555
1680
  }
1556
1681
  )
1557
- ] }) : f.type === "select" ? /* @__PURE__ */ jsxs2("div", { children: [
1682
+ ] }) : f.type === "select" ? /* @__PURE__ */ jsxs3("div", { children: [
1558
1683
  /* @__PURE__ */ jsx5(
1559
1684
  "input",
1560
1685
  {
@@ -1569,8 +1694,8 @@ function CollectionEditor({ collection }) {
1569
1694
  const lab = typeof opt === "string" ? opt : opt.label;
1570
1695
  return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
1571
1696
  }) })
1572
- ] }) : f.type === "image" ? /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
1573
- /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
1697
+ ] }) : f.type === "image" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1698
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1574
1699
  /* @__PURE__ */ jsx5(
1575
1700
  "input",
1576
1701
  {
@@ -1581,7 +1706,7 @@ function CollectionEditor({ collection }) {
1581
1706
  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"
1582
1707
  }
1583
1708
  ),
1584
- /* @__PURE__ */ jsxs2("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: [
1709
+ /* @__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: [
1585
1710
  "Upload",
1586
1711
  /* @__PURE__ */ jsx5(
1587
1712
  "input",
@@ -1617,7 +1742,149 @@ function CollectionEditor({ collection }) {
1617
1742
  value: String(editing[f.id] ?? ""),
1618
1743
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
1619
1744
  }
1620
- ) : /* @__PURE__ */ jsx5(
1745
+ ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
1746
+ /* @__PURE__ */ jsx5(
1747
+ "input",
1748
+ {
1749
+ type: "color",
1750
+ value: String(editing[f.id] ?? "#000000").startsWith("#") && String(editing[f.id] ?? "").length === 7 ? String(editing[f.id]) : "#000000",
1751
+ onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
1752
+ className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
1753
+ }
1754
+ ),
1755
+ /* @__PURE__ */ jsx5(
1756
+ "input",
1757
+ {
1758
+ type: "text",
1759
+ value: String(editing[f.id] ?? ""),
1760
+ onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
1761
+ placeholder: "#000000",
1762
+ className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsx5(
1766
+ "div",
1767
+ {
1768
+ className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
1769
+ style: { backgroundColor: String(editing[f.id] ?? "#000000") }
1770
+ }
1771
+ )
1772
+ ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1773
+ (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) => {
1774
+ const colorVal = String(item ?? "").trim();
1775
+ const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
1776
+ return /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
1777
+ /* @__PURE__ */ jsx5(
1778
+ "input",
1779
+ {
1780
+ type: "color",
1781
+ value: validHex.length === 7 ? validHex : "#000000",
1782
+ onChange: (e) => {
1783
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
1784
+ arr[idx] = e.target.value;
1785
+ setEditing({ ...editing, [f.id]: arr });
1786
+ },
1787
+ className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
1788
+ }
1789
+ ),
1790
+ /* @__PURE__ */ jsx5(
1791
+ "input",
1792
+ {
1793
+ type: "text",
1794
+ value: colorVal,
1795
+ onChange: (e) => {
1796
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
1797
+ arr[idx] = e.target.value;
1798
+ setEditing({ ...editing, [f.id]: arr });
1799
+ },
1800
+ placeholder: "#1c2a44",
1801
+ className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1802
+ }
1803
+ ),
1804
+ /* @__PURE__ */ jsx5(
1805
+ "div",
1806
+ {
1807
+ className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
1808
+ style: { backgroundColor: colorVal || "#000000" }
1809
+ }
1810
+ ),
1811
+ /* @__PURE__ */ jsx5(
1812
+ "button",
1813
+ {
1814
+ type: "button",
1815
+ onClick: () => {
1816
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
1817
+ arr.splice(idx, 1);
1818
+ setEditing({ ...editing, [f.id]: arr });
1819
+ },
1820
+ className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
1821
+ children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1822
+ }
1823
+ )
1824
+ ] }, idx);
1825
+ }),
1826
+ /* @__PURE__ */ jsxs3(
1827
+ "button",
1828
+ {
1829
+ type: "button",
1830
+ onClick: () => {
1831
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
1832
+ arr.push("#000000");
1833
+ setEditing({ ...editing, [f.id]: arr });
1834
+ },
1835
+ className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg border border-indigo-100 transition-colors",
1836
+ children: [
1837
+ /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
1838
+ " Add Color"
1839
+ ]
1840
+ }
1841
+ )
1842
+ ] }) : f.type === "list" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
1843
+ (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: [
1844
+ /* @__PURE__ */ jsx5(
1845
+ "input",
1846
+ {
1847
+ type: "text",
1848
+ value: String(item ?? ""),
1849
+ onChange: (e) => {
1850
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
1851
+ arr[idx] = e.target.value;
1852
+ setEditing({ ...editing, [f.id]: arr });
1853
+ },
1854
+ className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
1855
+ }
1856
+ ),
1857
+ /* @__PURE__ */ jsx5(
1858
+ "button",
1859
+ {
1860
+ type: "button",
1861
+ onClick: () => {
1862
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
1863
+ arr.splice(idx, 1);
1864
+ setEditing({ ...editing, [f.id]: arr });
1865
+ },
1866
+ className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
1867
+ children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1868
+ }
1869
+ )
1870
+ ] }, idx)),
1871
+ /* @__PURE__ */ jsxs3(
1872
+ "button",
1873
+ {
1874
+ type: "button",
1875
+ onClick: () => {
1876
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
1877
+ arr.push("");
1878
+ setEditing({ ...editing, [f.id]: arr });
1879
+ },
1880
+ className: "inline-flex items-center gap-1.5 px-3 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-semibold rounded-xl transition-colors",
1881
+ children: [
1882
+ /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
1883
+ " Add Item"
1884
+ ]
1885
+ }
1886
+ )
1887
+ ] }) : /* @__PURE__ */ jsx5(
1621
1888
  "input",
1622
1889
  {
1623
1890
  value: String(editing[f.id] ?? ""),
@@ -1626,7 +1893,7 @@ function CollectionEditor({ collection }) {
1626
1893
  }
1627
1894
  )
1628
1895
  ] }, f.id)) }),
1629
- /* @__PURE__ */ jsxs2("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
1896
+ /* @__PURE__ */ jsxs3("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
1630
1897
  /* @__PURE__ */ jsx5(
1631
1898
  "button",
1632
1899
  {
@@ -1642,8 +1909,8 @@ function CollectionEditor({ collection }) {
1642
1909
  onClick: save,
1643
1910
  disabled: saving,
1644
1911
  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",
1645
- children: saving ? /* @__PURE__ */ jsxs2(Fragment, { children: [
1646
- /* @__PURE__ */ jsxs2("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: [
1912
+ children: saving ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
1913
+ /* @__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: [
1647
1914
  /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1648
1915
  /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
1649
1916
  ] }),
@@ -1653,19 +1920,19 @@ function CollectionEditor({ collection }) {
1653
1920
  )
1654
1921
  ] })
1655
1922
  ] }),
1656
- /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm text-left", children: [
1657
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs2("tr", { children: [
1923
+ /* @__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: [
1924
+ /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs3("tr", { children: [
1658
1925
  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)),
1659
1926
  /* @__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" })
1660
1927
  ] }) }),
1661
1928
  /* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
1662
1929
  // Loading skeleton rows
1663
- Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs2("tr", { children: [
1930
+ Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs3("tr", { children: [
1664
1931
  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)),
1665
1932
  /* @__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" }) })
1666
1933
  ] }, i))
1667
- ) : /* @__PURE__ */ jsxs2(Fragment, { children: [
1668
- entries.map((e, idx) => /* @__PURE__ */ jsxs2(
1934
+ ) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
1935
+ entries.map((e, idx) => /* @__PURE__ */ jsxs3(
1669
1936
  "tr",
1670
1937
  {
1671
1938
  draggable: true,
@@ -1676,7 +1943,7 @@ function CollectionEditor({ collection }) {
1676
1943
  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" : ""}`,
1677
1944
  children: [
1678
1945
  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)),
1679
- /* @__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__ */ jsxs2("div", { className: "flex items-center justify-end gap-2", children: [
1946
+ /* @__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: [
1680
1947
  /* @__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" }) }) }),
1681
1948
  /* @__PURE__ */ jsx5(
1682
1949
  "button",
@@ -1694,7 +1961,7 @@ function CollectionEditor({ collection }) {
1694
1961
  disabled: deletingId === e.id,
1695
1962
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
1696
1963
  title: "Delete",
1697
- children: deletingId === e.id ? /* @__PURE__ */ jsxs2("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
1964
+ 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: [
1698
1965
  /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1699
1966
  /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
1700
1967
  ] }) : /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
@@ -1710,7 +1977,7 @@ function CollectionEditor({ collection }) {
1710
1977
  {
1711
1978
  colSpan: visibleFields.length + 1,
1712
1979
  className: "px-6 py-12 text-center text-slate-500",
1713
- children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center", children: [
1980
+ children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center", children: [
1714
1981
  /* @__PURE__ */ jsx5(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
1715
1982
  /* @__PURE__ */ jsx5("p", { children: 'No entries yet. Click "New Entry" to create one.' })
1716
1983
  ] })
@@ -1741,18 +2008,18 @@ function SubmissionsSection() {
1741
2008
  setSelectedFormId(formIds[0]);
1742
2009
  }
1743
2010
  }, [formIds, selectedFormId]);
1744
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1745
- /* @__PURE__ */ jsxs2("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: [
2011
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2012
+ /* @__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: [
1746
2013
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
1747
- /* @__PURE__ */ jsxs2("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: [
1748
- formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs2(
2014
+ /* @__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: [
2015
+ formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs3(
1749
2016
  "button",
1750
2017
  {
1751
2018
  onClick: () => setSelectedFormId(id),
1752
2019
  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"}`,
1753
2020
  children: [
1754
2021
  /* @__PURE__ */ jsx5("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
1755
- /* @__PURE__ */ jsxs2("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
2022
+ /* @__PURE__ */ jsxs3("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
1756
2023
  submissions.filter((s) => s.formId === id).length,
1757
2024
  " items"
1758
2025
  ] })
@@ -1762,7 +2029,7 @@ function SubmissionsSection() {
1762
2029
  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." })
1763
2030
  ] })
1764
2031
  ] }),
1765
- /* @__PURE__ */ jsxs2("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2032
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1766
2033
  /* @__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" }),
1767
2034
  selectedFormId ? /* @__PURE__ */ jsx5(
1768
2035
  SubmissionsList,
@@ -1811,8 +2078,8 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1811
2078
  }
1812
2079
  };
1813
2080
  if (detail) {
1814
- return /* @__PURE__ */ jsxs2("div", { className: "mx-auto w-full max-w-2xl", children: [
1815
- /* @__PURE__ */ jsxs2(
2081
+ return /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-2xl", children: [
2082
+ /* @__PURE__ */ jsxs3(
1816
2083
  "button",
1817
2084
  {
1818
2085
  onClick: () => setDetail(null),
@@ -1823,9 +2090,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1823
2090
  ]
1824
2091
  }
1825
2092
  ),
1826
- /* @__PURE__ */ jsxs2("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
1827
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
1828
- /* @__PURE__ */ jsxs2("div", { children: [
2093
+ /* @__PURE__ */ jsxs3("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2094
+ /* @__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: [
2095
+ /* @__PURE__ */ jsxs3("div", { children: [
1829
2096
  /* @__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 }),
1830
2097
  /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
1831
2098
  ] }),
@@ -1839,23 +2106,23 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1839
2106
  }
1840
2107
  )
1841
2108
  ] }) }),
1842
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => /* @__PURE__ */ jsxs2("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4", children: [
2109
+ /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => /* @__PURE__ */ jsxs3("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4", children: [
1843
2110
  /* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
1844
2111
  /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800 whitespace-pre-wrap", children: String(val ?? "\u2014") })
1845
2112
  ] }, key)) })
1846
2113
  ] })
1847
2114
  ] });
1848
2115
  }
1849
- return /* @__PURE__ */ jsxs2("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
1850
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
1851
- /* @__PURE__ */ jsxs2("div", { children: [
1852
- /* @__PURE__ */ jsxs2("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
2116
+ return /* @__PURE__ */ jsxs3("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
2117
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
2118
+ /* @__PURE__ */ jsxs3("div", { children: [
2119
+ /* @__PURE__ */ jsxs3("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
1853
2120
  formId,
1854
2121
  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 })
1855
2122
  ] }),
1856
2123
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
1857
2124
  ] }),
1858
- /* @__PURE__ */ jsxs2(
2125
+ /* @__PURE__ */ jsxs3(
1859
2126
  "button",
1860
2127
  {
1861
2128
  onClick: onLoad,
@@ -1868,7 +2135,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1868
2135
  }
1869
2136
  )
1870
2137
  ] }),
1871
- /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
2138
+ /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
1872
2139
  /* @__PURE__ */ jsx5(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
1873
2140
  /* @__PURE__ */ jsx5(
1874
2141
  "input",
@@ -1883,28 +2150,28 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1883
2150
  }
1884
2151
  )
1885
2152
  ] }),
1886
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm text-left", children: [
1887
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs2("tr", { children: [
2153
+ /* @__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: [
2154
+ /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs3("tr", { children: [
1888
2155
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
1889
2156
  /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
1890
2157
  /* @__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" })
1891
2158
  ] }) }),
1892
- /* @__PURE__ */ jsxs2("tbody", { className: "divide-y divide-slate-100", children: [
2159
+ /* @__PURE__ */ jsxs3("tbody", { className: "divide-y divide-slate-100", children: [
1893
2160
  paginated.map((s) => {
1894
2161
  const firstVal = Object.values(s.data)[0];
1895
2162
  const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
1896
- return /* @__PURE__ */ jsxs2(
2163
+ return /* @__PURE__ */ jsxs3(
1897
2164
  "tr",
1898
2165
  {
1899
2166
  className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
1900
2167
  onClick: () => openDetail(s),
1901
2168
  children: [
1902
- /* @__PURE__ */ jsxs2("td", { className: "px-6 py-4", children: [
2169
+ /* @__PURE__ */ jsxs3("td", { className: "px-6 py-4", children: [
1903
2170
  /* @__PURE__ */ jsx5("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
1904
2171
  !s.read && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
1905
2172
  ] }),
1906
2173
  /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
1907
- /* @__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__ */ jsxs2("div", { className: "flex items-center justify-end gap-1", children: [
2174
+ /* @__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: [
1908
2175
  /* @__PURE__ */ jsx5(
1909
2176
  "button",
1910
2177
  {
@@ -1929,19 +2196,19 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1929
2196
  s.id
1930
2197
  );
1931
2198
  }),
1932
- paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
2199
+ 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: [
1933
2200
  /* @__PURE__ */ jsx5(Inbox, { className: "h-12 w-12 text-slate-200" }),
1934
2201
  /* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
1935
2202
  ] }) }) })
1936
2203
  ] })
1937
2204
  ] }) }),
1938
- totalPages > 1 && /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
1939
- /* @__PURE__ */ jsxs2("span", { children: [
2205
+ totalPages > 1 && /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
2206
+ /* @__PURE__ */ jsxs3("span", { children: [
1940
2207
  filtered.length,
1941
2208
  " item",
1942
2209
  filtered.length !== 1 ? "s" : ""
1943
2210
  ] }),
1944
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
2211
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
1945
2212
  /* @__PURE__ */ jsx5(
1946
2213
  "button",
1947
2214
  {
@@ -1951,7 +2218,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1951
2218
  children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
1952
2219
  }
1953
2220
  ),
1954
- /* @__PURE__ */ jsxs2("span", { className: "font-medium text-slate-700", children: [
2221
+ /* @__PURE__ */ jsxs3("span", { className: "font-medium text-slate-700", children: [
1955
2222
  "Page ",
1956
2223
  page,
1957
2224
  " of ",
@@ -1972,14 +2239,14 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
1972
2239
  }
1973
2240
  function SettingsSection() {
1974
2241
  const ctx = useCmsContext();
1975
- return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs2("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
1976
- /* @__PURE__ */ jsxs2("div", { children: [
2242
+ 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: [
2243
+ /* @__PURE__ */ jsxs3("div", { children: [
1977
2244
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
1978
2245
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
1979
2246
  ] }),
1980
- /* @__PURE__ */ jsxs2("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2247
+ /* @__PURE__ */ jsxs3("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
1981
2248
  /* @__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" }) }),
1982
- /* @__PURE__ */ jsxs2("dl", { className: "divide-y divide-slate-100 text-sm", children: [
2249
+ /* @__PURE__ */ jsxs3("dl", { className: "divide-y divide-slate-100 text-sm", children: [
1983
2250
  /* @__PURE__ */ jsx5(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
1984
2251
  /* @__PURE__ */ jsx5(Row, { label: "Active Storage Adapter", value: ctx.adapter.name, highlight: true }),
1985
2252
  /* @__PURE__ */ jsx5(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
@@ -2022,10 +2289,10 @@ function ConfigSection() {
2022
2289
  },
2023
2290
  [ctx]
2024
2291
  );
2025
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col lg:flex-row h-full", children: [
2026
- /* @__PURE__ */ jsxs2("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: [
2292
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col lg:flex-row h-full", children: [
2293
+ /* @__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: [
2027
2294
  /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
2028
- /* @__PURE__ */ jsxs2("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2295
+ /* @__PURE__ */ jsxs3("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2029
2296
  globals.map((g) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
2030
2297
  "button",
2031
2298
  {
@@ -2037,14 +2304,14 @@ function ConfigSection() {
2037
2304
  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." })
2038
2305
  ] })
2039
2306
  ] }),
2040
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs2("div", { className: "mx-auto w-full max-w-2xl", children: [
2041
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between mb-8", children: [
2042
- /* @__PURE__ */ jsxs2("div", { children: [
2307
+ /* @__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: [
2308
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between mb-8", children: [
2309
+ /* @__PURE__ */ jsxs3("div", { children: [
2043
2310
  /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
2044
2311
  /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
2045
2312
  ] }),
2046
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
2047
- /* @__PURE__ */ jsxs2(
2313
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
2314
+ /* @__PURE__ */ jsxs3(
2048
2315
  "button",
2049
2316
  {
2050
2317
  onClick: () => ctx.reset(),
@@ -2056,7 +2323,7 @@ function ConfigSection() {
2056
2323
  ]
2057
2324
  }
2058
2325
  ),
2059
- /* @__PURE__ */ jsxs2(
2326
+ /* @__PURE__ */ jsxs3(
2060
2327
  "button",
2061
2328
  {
2062
2329
  onClick: () => ctx.save(),
@@ -2070,7 +2337,7 @@ function ConfigSection() {
2070
2337
  )
2071
2338
  ] })
2072
2339
  ] }),
2073
- selectedGroup ? /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
2340
+ selectedGroup ? /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
2074
2341
  /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
2075
2342
  /* @__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(
2076
2343
  FieldEditor,
@@ -2083,7 +2350,7 @@ function ConfigSection() {
2083
2350
  }
2084
2351
  }
2085
2352
  ) }, field.id)) })
2086
- ] }) : /* @__PURE__ */ jsxs2("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: [
2353
+ ] }) : /* @__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: [
2087
2354
  /* @__PURE__ */ jsx5(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
2088
2355
  /* @__PURE__ */ jsx5("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
2089
2356
  ] })
@@ -2096,7 +2363,7 @@ function Row({
2096
2363
  highlight,
2097
2364
  status
2098
2365
  }) {
2099
- return /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2366
+ return /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2100
2367
  /* @__PURE__ */ jsx5("dt", { className: "text-slate-500 font-medium", children: label }),
2101
2368
  /* @__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 })
2102
2369
  ] });
@@ -2107,8 +2374,8 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2107
2374
  const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
2108
2375
  const capped = filtered.slice(0, 80);
2109
2376
  const SelectedIcon = iconMap && value ? iconMap[value] : null;
2110
- return /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
2111
- /* @__PURE__ */ jsxs2(
2377
+ return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
2378
+ /* @__PURE__ */ jsxs3(
2112
2379
  "button",
2113
2380
  {
2114
2381
  type: "button",
@@ -2118,7 +2385,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2118
2385
  },
2119
2386
  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",
2120
2387
  children: [
2121
- /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-2 truncate", children: [
2388
+ /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2 truncate", children: [
2122
2389
  SelectedIcon && /* @__PURE__ */ jsx5(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
2123
2390
  /* @__PURE__ */ jsx5("span", { className: "truncate", children: value || placeholder || "Select..." })
2124
2391
  ] }),
@@ -2126,10 +2393,10 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2126
2393
  ]
2127
2394
  }
2128
2395
  ),
2129
- open && /* @__PURE__ */ jsxs2(Fragment, { children: [
2396
+ open && /* @__PURE__ */ jsxs3(Fragment2, { children: [
2130
2397
  /* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
2131
- /* @__PURE__ */ jsxs2("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: [
2132
- /* @__PURE__ */ jsxs2("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
2398
+ /* @__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: [
2399
+ /* @__PURE__ */ jsxs3("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
2133
2400
  /* @__PURE__ */ jsx5(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
2134
2401
  /* @__PURE__ */ jsx5(
2135
2402
  "input",
@@ -2144,15 +2411,15 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2144
2411
  ),
2145
2412
  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 })
2146
2413
  ] }),
2147
- /* @__PURE__ */ jsxs2("div", { className: "overflow-y-auto flex-1 p-1", children: [
2148
- filtered.length === 0 && /* @__PURE__ */ jsxs2("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2414
+ /* @__PURE__ */ jsxs3("div", { className: "overflow-y-auto flex-1 p-1", children: [
2415
+ filtered.length === 0 && /* @__PURE__ */ jsxs3("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2149
2416
  'No results for "',
2150
2417
  search,
2151
2418
  '"'
2152
2419
  ] }),
2153
2420
  capped.map((opt) => {
2154
2421
  const OptIcon = iconMap ? iconMap[opt] : null;
2155
- return /* @__PURE__ */ jsxs2(
2422
+ return /* @__PURE__ */ jsxs3(
2156
2423
  "button",
2157
2424
  {
2158
2425
  type: "button",
@@ -2169,7 +2436,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
2169
2436
  opt
2170
2437
  );
2171
2438
  }),
2172
- filtered.length > 80 && /* @__PURE__ */ jsxs2("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
2439
+ 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: [
2173
2440
  "Showing 80 of ",
2174
2441
  filtered.length,
2175
2442
  " \u2014 type to narrow results"
@@ -2184,7 +2451,7 @@ function PasswordField({ value, onChange }) {
2184
2451
  const isHash = value.startsWith("$2a$") || value.startsWith("$2b$");
2185
2452
  const [displayValue, setDisplayValue] = useState4(isHash ? "" : value);
2186
2453
  const [pristine, setPristine] = useState4(isHash);
2187
- return /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
2454
+ return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
2188
2455
  /* @__PURE__ */ jsx5(
2189
2456
  "input",
2190
2457
  {
@@ -2214,7 +2481,7 @@ function PasswordField({ value, onChange }) {
2214
2481
  // src/admin/AdminLogin.tsx
2215
2482
  import { useState as useState5, useEffect as useEffect5 } from "react";
2216
2483
  import { Lock, UserPlus } from "lucide-react";
2217
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
2484
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2218
2485
  function AdminLogin({
2219
2486
  authApiRoute = "/api/admin/auth",
2220
2487
  redirectRoute = "/admin"
@@ -2260,19 +2527,19 @@ function AdminLogin({
2260
2527
  }
2261
2528
  };
2262
2529
  if (view === "checking") {
2263
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs3("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: [
2530
+ 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: [
2264
2531
  /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2265
2532
  /* @__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" })
2266
2533
  ] }) });
2267
2534
  }
2268
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs3("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
2269
- /* @__PURE__ */ jsxs3("div", { className: "p-8", children: [
2535
+ 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: [
2536
+ /* @__PURE__ */ jsxs4("div", { className: "p-8", children: [
2270
2537
  /* @__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" }) }),
2271
2538
  /* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
2272
2539
  /* @__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." }),
2273
2540
  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 }),
2274
- /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
2275
- /* @__PURE__ */ jsxs3("div", { children: [
2541
+ /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
2542
+ /* @__PURE__ */ jsxs4("div", { children: [
2276
2543
  /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
2277
2544
  /* @__PURE__ */ jsx6(
2278
2545
  "input",
@@ -2286,7 +2553,7 @@ function AdminLogin({
2286
2553
  }
2287
2554
  )
2288
2555
  ] }),
2289
- /* @__PURE__ */ jsxs3("div", { children: [
2556
+ /* @__PURE__ */ jsxs4("div", { children: [
2290
2557
  /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
2291
2558
  /* @__PURE__ */ jsx6(
2292
2559
  "input",
@@ -2306,7 +2573,7 @@ function AdminLogin({
2306
2573
  type: "submit",
2307
2574
  disabled: loading,
2308
2575
  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",
2309
- children: loading ? /* @__PURE__ */ jsxs3("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: [
2576
+ 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: [
2310
2577
  /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2311
2578
  /* @__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" })
2312
2579
  ] }) : view === "register" ? "Create Account" : "Sign In"
@@ -2321,6 +2588,7 @@ export {
2321
2588
  AdminApp,
2322
2589
  AdminLogin,
2323
2590
  CmsProvider,
2591
+ EditableFile,
2324
2592
  EditableImage,
2325
2593
  EditableLink,
2326
2594
  EditableList,