admin-lib-cms 1.2.8 → 1.2.9

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
@@ -1,793 +1,28 @@
1
1
  "use client";
2
+ import {
3
+ CmsProvider,
4
+ EditableFile,
5
+ EditableImage,
6
+ EditableLink,
7
+ EditableList,
8
+ EditableReference,
9
+ EditableText,
10
+ SubscriptionPage,
11
+ SubscriptionProvider,
12
+ useCmsContext,
13
+ useCmsOptional,
14
+ useSubmit,
15
+ useSubscription,
16
+ useSubscriptionContext
17
+ } from "./chunk-IXZXII3M.mjs";
2
18
  import "./chunk-WBQAMGXK.mjs";
3
19
  import {
4
20
  generateDefaultTemplate,
5
21
  sendEmailNotification
6
22
  } from "./chunk-4KJKAYIC.mjs";
7
23
 
8
- // src/provider.tsx
9
- import {
10
- createContext as createContext2,
11
- useCallback as useCallback2,
12
- useContext as useContext2,
13
- useEffect as useEffect2,
14
- useMemo,
15
- useRef,
16
- useState as useState3
17
- } from "react";
18
-
19
- // src/subscription/SubscriptionProvider.tsx
20
- import { createContext, useContext, useState, useCallback, useEffect } from "react";
21
- import { jsx } from "react/jsx-runtime";
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);
220
- function useCmsContext() {
221
- const ctx = useContext2(CmsContext);
222
- if (!ctx) throw new Error("useCms must be used inside <CmsProvider>");
223
- return ctx;
224
- }
225
- function useCmsOptional() {
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 });
242
- }
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);
259
- const registryRef = useRef(/* @__PURE__ */ new Map());
260
- const refCountRef = useRef(/* @__PURE__ */ new Map());
261
- useEffect2(() => {
262
- if (typeof window === "undefined" || typeof BroadcastChannel === "undefined") return;
263
- const bc = new BroadcastChannel("admin-cms:collection-changed");
264
- bc.onmessage = () => setCollectionChangedAt(Date.now());
265
- return () => bc.close();
266
- }, []);
267
- const notifyCollectionChanged = useCallback2(() => {
268
- setCollectionChangedAt(Date.now());
269
- if (typeof BroadcastChannel !== "undefined") {
270
- const bc = new BroadcastChannel("admin-cms:collection-changed");
271
- bc.postMessage({ at: Date.now() });
272
- bc.close();
273
- }
274
- }, []);
275
- useEffect2(() => {
276
- if (typeof window === "undefined") return;
277
- const params = new URLSearchParams(window.location.search);
278
- if (params.get("__cms") === "edit") setEditMode(true);
279
- }, []);
280
- useEffect2(() => {
281
- let cancelled = false;
282
- adapter.getOverrides().then((o) => {
283
- if (cancelled) return;
284
- setOverrides(o);
285
- setSavedOverrides(o);
286
- });
287
- return () => {
288
- cancelled = true;
289
- };
290
- }, [adapter]);
291
- useEffect2(() => {
292
- if (!editMode || typeof window === "undefined") return;
293
- const parent = window.parent;
294
- if (!parent || parent === window) return;
295
- const send = (msg) => parent.postMessage({ __cms: true, ...msg }, "*");
296
- send({ type: "cms:ready" });
297
- const onMsg = (e) => {
298
- const data = e.data;
299
- if (!data || !data.__cms) return;
300
- if (data.type === "cms:set-override") {
301
- setOverrides((prev) => ({ ...prev, [data.id]: data.value }));
302
- } else if (data.type === "cms:set-all-overrides") {
303
- setOverrides(data.overrides);
304
- }
305
- };
306
- window.addEventListener("message", onMsg);
307
- return () => window.removeEventListener("message", onMsg);
308
- }, [editMode]);
309
- const setSelectedId = useCallback2(
310
- (id) => {
311
- setSelectedIdRaw(id);
312
- if (editMode && typeof window !== "undefined" && window.parent && window.parent !== window) {
313
- window.parent.postMessage(
314
- { __cms: true, type: "cms:select", id },
315
- "*"
316
- );
317
- }
318
- },
319
- [editMode]
320
- );
321
- const getSafeItems = useCallback2(() => {
322
- try {
323
- return JSON.parse(
324
- JSON.stringify(Array.from(registryRef.current.values()), (_key, value2) => {
325
- if (typeof value2 === "function") {
326
- return value2.name || void 0;
327
- }
328
- return value2;
329
- })
330
- );
331
- } catch {
332
- return Array.from(registryRef.current.values());
333
- }
334
- }, []);
335
- const registerEditable = useCallback2((meta) => {
336
- refCountRef.current.set(meta.id, (refCountRef.current.get(meta.id) || 0) + 1);
337
- registryRef.current.set(meta.id, meta);
338
- if (typeof window !== "undefined" && window.parent && window.parent !== window) {
339
- window.parent.postMessage(
340
- {
341
- __cms: true,
342
- type: "cms:register",
343
- items: getSafeItems()
344
- },
345
- "*"
346
- );
347
- }
348
- }, [getSafeItems]);
349
- const unregisterEditable = useCallback2((id) => {
350
- const count = (refCountRef.current.get(id) || 1) - 1;
351
- if (count <= 0) {
352
- refCountRef.current.delete(id);
353
- registryRef.current.delete(id);
354
- } else {
355
- refCountRef.current.set(id, count);
356
- return;
357
- }
358
- if (typeof window !== "undefined" && window.parent && window.parent !== window) {
359
- window.parent.postMessage(
360
- {
361
- __cms: true,
362
- type: "cms:register",
363
- items: getSafeItems()
364
- },
365
- "*"
366
- );
367
- }
368
- }, [getSafeItems]);
369
- const setOverride = useCallback2((id, value2) => {
370
- setOverrides((prev) => ({ ...prev, [id]: value2 }));
371
- }, []);
372
- const save = useCallback2(async () => {
373
- await adapter.setOverrides(overrides);
374
- setSavedOverrides(overrides);
375
- }, [adapter, overrides]);
376
- const reset = useCallback2(
377
- async (id) => {
378
- if (id) {
379
- setOverrides((prev) => {
380
- const next = { ...prev };
381
- delete next[id];
382
- return next;
383
- });
384
- } else {
385
- setOverrides({});
386
- }
387
- },
388
- []
389
- );
390
- const isDirty = useMemo(
391
- () => JSON.stringify(overrides) !== JSON.stringify(savedOverrides),
392
- [overrides, savedOverrides]
393
- );
394
- const getRegistered = useCallback2(
395
- () => Array.from(registryRef.current.values()),
396
- []
397
- );
398
- const value = useMemo(() => ({
399
- config,
400
- adapter,
401
- overrides,
402
- editMode,
403
- selectedId,
404
- setSelectedId,
405
- setOverride,
406
- registerEditable,
407
- unregisterEditable,
408
- getRegistered,
409
- save,
410
- reset,
411
- isDirty,
412
- iconMap,
413
- uploadImage: adapter.uploadImage?.bind(adapter),
414
- collectionChangedAt,
415
- notifyCollectionChanged
416
- }), [config, adapter, overrides, editMode, selectedId, setSelectedId, setOverride, registerEditable, unregisterEditable, getRegistered, save, reset, isDirty, iconMap, collectionChangedAt, notifyCollectionChanged]);
417
- return /* @__PURE__ */ jsx3(CmsContext.Provider, { value, children });
418
- }
419
- function useSubmit(formId) {
420
- const ctx = useContext2(CmsContext);
421
- return async (data) => {
422
- const submission = {
423
- id: crypto.randomUUID(),
424
- formId,
425
- submittedAt: (/* @__PURE__ */ new Date()).toISOString(),
426
- data,
427
- read: false
428
- };
429
- if (ctx?.adapter) {
430
- await ctx.adapter.saveSubmission(submission);
431
- } else {
432
- const KEY = "admin-cms:submissions";
433
- const list = (() => {
434
- try {
435
- return JSON.parse(localStorage.getItem(KEY) ?? "[]");
436
- } catch {
437
- return [];
438
- }
439
- })();
440
- list.unshift(submission);
441
- localStorage.setItem(KEY, JSON.stringify(list));
442
- }
443
- };
444
- }
445
-
446
- // src/editable.tsx
447
- import { createElement, isValidElement, useEffect as useEffect3, useState as useState4, Fragment as Fragment2 } from "react";
448
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
449
- function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField, reorderable, sortable) {
450
- const ctx = useCmsOptional();
451
- useEffect3(() => {
452
- if (!ctx) return;
453
- ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField, reorderable, sortable });
454
- return () => ctx.unregisterEditable(id);
455
- }, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField, reorderable, sortable]);
456
- return ctx;
457
- }
458
- function editableClasses(active, selected) {
459
- if (!active) return "";
460
- return [
461
- "outline-dashed outline-2 outline-offset-2 cursor-pointer transition-colors",
462
- selected ? "outline-blue-500 bg-blue-500/5" : "outline-blue-400/60 hover:outline-blue-500"
463
- ].join(" ");
464
- }
465
- function EditableText({
466
- id,
467
- label,
468
- section,
469
- pageId,
470
- children,
471
- as = "span",
472
- className,
473
- type = "text",
474
- lineClassNames,
475
- renderLine
476
- }) {
477
- const ctx = useRegister(id, type, label, section, pageId, children);
478
- const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? "") : children;
479
- const active = !!ctx?.editMode;
480
- const selected = ctx?.selectedId === id;
481
- const isEmpty = !value || String(value).trim() === "";
482
- const renderValue = active && isEmpty ? `[Empty: ${label || id}]` : value;
483
- const onClick = (e) => {
484
- if (!active || !ctx) return;
485
- e.preventDefault();
486
- e.stopPropagation();
487
- ctx.setSelectedId(id);
488
- };
489
- let finalChildren = renderValue;
490
- if (typeof renderValue === "string" && renderValue.includes("\n")) {
491
- finalChildren = renderValue.split("\n").map((line, i, arr) => {
492
- if (renderLine) {
493
- return /* @__PURE__ */ jsxs3(Fragment2, { children: [
494
- renderLine(line, i),
495
- i < arr.length - 1 && /* @__PURE__ */ jsx4("br", {})
496
- ] }, i);
497
- }
498
- const lineClass = lineClassNames?.[i];
499
- return /* @__PURE__ */ jsxs3(Fragment2, { children: [
500
- lineClass ? /* @__PURE__ */ jsx4("span", { className: lineClass, children: line }) : line,
501
- i < arr.length - 1 && /* @__PURE__ */ jsx4("br", {})
502
- ] }, i);
503
- });
504
- }
505
- return createElement(
506
- as,
507
- {
508
- className: [
509
- className,
510
- editableClasses(active, selected),
511
- active && isEmpty ? "opacity-50" : ""
512
- ].filter(Boolean).join(" "),
513
- "data-cms-id": id,
514
- onClick: active ? onClick : void 0
515
- },
516
- finalChildren
517
- );
518
- }
519
- function EditableImage({
520
- id,
521
- label,
522
- section,
523
- pageId,
524
- src,
525
- alt,
526
- className,
527
- width,
528
- height
529
- }) {
530
- const ctx = useRegister(id, "image", label, section, pageId, src);
531
- const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? src) : src;
532
- const active = !!ctx?.editMode;
533
- const selected = ctx?.selectedId === id;
534
- const onClick = (e) => {
535
- if (!active || !ctx) return;
536
- e.preventDefault();
537
- e.stopPropagation();
538
- ctx.setSelectedId(id);
539
- };
540
- return /* @__PURE__ */ jsx4(
541
- "img",
542
- {
543
- src: value || void 0,
544
- alt,
545
- width,
546
- height,
547
- "data-cms-id": id,
548
- onClick: active ? onClick : void 0,
549
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" ")
550
- }
551
- );
552
- }
553
- function EditableFile({
554
- id,
555
- label,
556
- section,
557
- pageId,
558
- src,
559
- defaultUrl = "",
560
- className,
561
- children
562
- }) {
563
- const initialUrl = src || defaultUrl;
564
- const ctx = useRegister(id, "file", label, section, pageId, initialUrl);
565
- const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? initialUrl) : initialUrl;
566
- const active = !!ctx?.editMode;
567
- const selected = ctx?.selectedId === id;
568
- const onClick = (e) => {
569
- if (!active || !ctx) return;
570
- e.preventDefault();
571
- e.stopPropagation();
572
- ctx.setSelectedId(id);
573
- };
574
- if (children) {
575
- return /* @__PURE__ */ jsx4(
576
- "div",
577
- {
578
- "data-cms-id": id,
579
- onClick: active ? onClick : void 0,
580
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
581
- children: children(value)
582
- }
583
- );
584
- }
585
- return /* @__PURE__ */ jsx4(
586
- "div",
587
- {
588
- "data-cms-id": id,
589
- onClick: active ? onClick : void 0,
590
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
591
- children: /* @__PURE__ */ jsx4(
592
- "iframe",
593
- {
594
- src: value,
595
- className: "w-full h-[500px] rounded-xl border-0",
596
- title: label || id
597
- }
598
- )
599
- }
600
- );
601
- }
602
- function EditableLink({
603
- id,
604
- label,
605
- section,
606
- pageId,
607
- href,
608
- children,
609
- text,
610
- className,
611
- target
612
- }) {
613
- let defaultText = text ?? "";
614
- if (!defaultText) {
615
- if (typeof children === "string") {
616
- defaultText = children;
617
- } else if (Array.isArray(children)) {
618
- const strChild = children.find((c) => typeof c === "string");
619
- if (typeof strChild === "string") {
620
- defaultText = strChild.trim();
621
- }
622
- }
623
- }
624
- const ctx = useRegister(id, "link", label, section, pageId, { href, text: defaultText });
625
- const override = ctx?.overrides[id];
626
- const hrefValue = override?.href ?? href;
627
- const textValue = override?.text ?? defaultText;
628
- const active = !!ctx?.editMode;
629
- const selected = ctx?.selectedId === id;
630
- const onClick = (e) => {
631
- if (!active || !ctx) return;
632
- e.preventDefault();
633
- e.stopPropagation();
634
- ctx.setSelectedId(id);
635
- };
636
- const isExternal = hrefValue.startsWith("http");
637
- const computedTarget = target || (isExternal ? "_blank" : void 0);
638
- const computedRel = computedTarget === "_blank" ? "noopener noreferrer" : void 0;
639
- let content;
640
- if (typeof children === "function") {
641
- content = children(textValue);
642
- } else if (override && typeof override.text === "string" && override.text !== "") {
643
- if (Array.isArray(children)) {
644
- let replaced = false;
645
- content = children.map((c) => {
646
- if (typeof c === "string" && !replaced) {
647
- replaced = true;
648
- return override.text;
649
- }
650
- return c;
651
- });
652
- } else if (isValidElement(children)) {
653
- content = /* @__PURE__ */ jsxs3(Fragment3, { children: [
654
- override.text,
655
- " ",
656
- children
657
- ] });
658
- } else {
659
- content = override.text;
660
- }
661
- } else if (typeof children !== "undefined") {
662
- content = children;
663
- } else {
664
- content = textValue;
665
- }
666
- const isEmpty = !content || typeof content === "string" && content.trim() === "";
667
- const renderContent = active && isEmpty ? `[Empty Link: ${label || id}]` : content;
668
- return /* @__PURE__ */ jsx4(
669
- "a",
670
- {
671
- href: hrefValue,
672
- target: computedTarget,
673
- rel: computedRel,
674
- "data-cms-id": id,
675
- onClick: active ? onClick : void 0,
676
- className: [
677
- className,
678
- editableClasses(active, selected),
679
- active && isEmpty ? "opacity-50" : ""
680
- ].filter(Boolean).join(" "),
681
- children: renderContent
682
- }
683
- );
684
- }
685
- function EditableList({
686
- id,
687
- label,
688
- section,
689
- pageId,
690
- initialItems,
691
- renderItem,
692
- renderList,
693
- itemSchema,
694
- fixedLength,
695
- className,
696
- listClassName,
697
- search,
698
- reorderable,
699
- sortable
700
- }) {
701
- const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength, search, void 0, void 0, void 0, reorderable, sortable);
702
- const rawValue = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : initialItems;
703
- const rawList = Array.isArray(rawValue) ? rawValue : initialItems;
704
- const value = Array.isArray(rawList) ? rawList.map((item, idx) => {
705
- const def = Array.isArray(initialItems) ? initialItems[idx] : void 0;
706
- if (def && typeof def === "object" && item && typeof item === "object") {
707
- return { ...def, ...item };
708
- }
709
- return item;
710
- }) : initialItems;
711
- const active = !!ctx?.editMode;
712
- const selected = ctx?.selectedId === id;
713
- const onClick = (e) => {
714
- if (!active || !ctx) return;
715
- e.preventDefault();
716
- e.stopPropagation();
717
- ctx.setSelectedId(id);
718
- };
719
- return /* @__PURE__ */ jsxs3(
720
- "div",
721
- {
722
- "data-cms-id": id,
723
- onClick: active ? onClick : void 0,
724
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
725
- children: [
726
- renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) }),
727
- active && value.length === 0 && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
728
- "Empty List ",
729
- label ? `(${label})` : "",
730
- " \u2014 Click to add items"
731
- ] })
732
- ]
733
- }
734
- );
735
- }
736
- function EditableReference({
737
- id,
738
- label,
739
- section,
740
- pageId,
741
- collection,
742
- max,
743
- displayField,
744
- className,
745
- children
746
- }) {
747
- const ctx = useRegister(id, "reference", label, section, pageId, max === 1 ? "" : [], void 0, void 0, void 0, collection, max, displayField);
748
- const active = !!ctx?.editMode;
749
- const selected = ctx?.selectedId === id;
750
- const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : void 0;
751
- const [resolvedItems, setResolvedItems] = useState4([]);
752
- useEffect3(() => {
753
- if (!ctx) return;
754
- const ids = Array.isArray(value) ? value : value ? [value] : [];
755
- if (ids.length === 0) {
756
- setResolvedItems([]);
757
- return;
758
- }
759
- ctx.adapter.listEntries(collection).then((res) => {
760
- setResolvedItems(res.filter((r) => ids.includes(r.id)));
761
- }).catch(() => {
762
- });
763
- }, [value, collection, ctx]);
764
- const onClick = (e) => {
765
- if (!active || !ctx) return;
766
- e.preventDefault();
767
- e.stopPropagation();
768
- ctx.setSelectedId(id);
769
- };
770
- const childContent = typeof children === "function" ? children(resolvedItems) : children;
771
- return /* @__PURE__ */ jsxs3(
772
- "div",
773
- {
774
- "data-cms-id": id,
775
- onClick: active ? onClick : void 0,
776
- className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
777
- children: [
778
- childContent,
779
- active && (!resolvedItems || resolvedItems.length === 0) && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
780
- "Empty Reference ",
781
- label ? `(${label})` : "",
782
- " \u2014 Click to select"
783
- ] })
784
- ]
785
- }
786
- );
787
- }
788
-
789
24
  // src/admin/AdminApp.tsx
790
- import { createElement as createElement2, useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef2, useState as useState5 } from "react";
25
+ import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
791
26
  import { ConfigProvider, Modal, TimePicker } from "antd";
792
27
  import dayjs from "dayjs";
793
28
  import {
@@ -816,12 +51,12 @@ import {
816
51
  ChevronRight,
817
52
  SlidersHorizontal,
818
53
  LogOut,
819
- ExternalLink as ExternalLink2,
54
+ ExternalLink,
820
55
  Check,
821
56
  GripVertical
822
57
  } from "lucide-react";
823
- import { CreditCard as CreditCard2, BarChart3 } from "lucide-react";
824
- import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
58
+ import { CreditCard, BarChart3 } from "lucide-react";
59
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
825
60
  var TIME_STORAGE_FORMAT = "HH:mm";
826
61
  var TIME_DISPLAY_FORMAT = "h:mm A";
827
62
  var TIME_PICKER_THEME = {
@@ -850,7 +85,7 @@ var TIME_PICKER_THEME = {
850
85
  }
851
86
  };
852
87
  function AdminTimeRangePicker(props) {
853
- return /* @__PURE__ */ jsx5(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx5(
88
+ return /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx(
854
89
  TimePicker.RangePicker,
855
90
  {
856
91
  ...props,
@@ -863,7 +98,7 @@ function AdminTimeRangePicker(props) {
863
98
  ) });
864
99
  }
865
100
  function AdminTimePicker(props) {
866
- return /* @__PURE__ */ jsx5(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx5(
101
+ return /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx(
867
102
  TimePicker,
868
103
  {
869
104
  ...props,
@@ -904,9 +139,9 @@ function FilePickerButton({
904
139
  multiple = false,
905
140
  onFiles
906
141
  }) {
907
- const inputRef = useRef2(null);
908
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
909
- /* @__PURE__ */ jsx5(
142
+ const inputRef = useRef(null);
143
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
144
+ /* @__PURE__ */ jsx(
910
145
  "button",
911
146
  {
912
147
  type: "button",
@@ -915,7 +150,7 @@ function FilePickerButton({
915
150
  children
916
151
  }
917
152
  ),
918
- /* @__PURE__ */ jsx5(
153
+ /* @__PURE__ */ jsx(
919
154
  "input",
920
155
  {
921
156
  ref: inputRef,
@@ -933,16 +168,16 @@ function FilePickerButton({
933
168
  }
934
169
  function AdminApp(props) {
935
170
  if (props.projectId) {
936
- return /* @__PURE__ */ jsx5(SubscriptionProvider, { apiUrl: props.apiUrl, projectId: props.projectId, email: props.email, children: /* @__PURE__ */ jsx5(AdminAppContent, { ...props }) });
171
+ return /* @__PURE__ */ jsx(SubscriptionProvider, { apiUrl: props.apiUrl, projectId: props.projectId, email: props.email, children: /* @__PURE__ */ jsx(AdminAppContent, { ...props }) });
937
172
  }
938
- return /* @__PURE__ */ jsx5(AdminAppContent, { ...props });
173
+ return /* @__PURE__ */ jsx(AdminAppContent, { ...props });
939
174
  }
940
175
  function AdminAppContent(props) {
941
176
  const ctx = useCmsContext();
942
177
  const hasDashboard = Boolean(props.dashboard);
943
- const [section, setSection] = useState5(hasDashboard ? "dashboard" : "pages");
944
- const [authChecking, setAuthChecking] = useState5(true);
945
- const [authenticated, setAuthenticated] = useState5(false);
178
+ const [section, setSection] = useState(hasDashboard ? "dashboard" : "pages");
179
+ const [authChecking, setAuthChecking] = useState(true);
180
+ const [authenticated, setAuthenticated] = useState(false);
946
181
  const hideSettings = props.hideSettings ?? ctx.config.hideSettings ?? false;
947
182
  const hideData = props.hideData ?? ctx.config.hideData ?? false;
948
183
  const hideGlobals = props.hideGlobals ?? ctx.config.hideGlobals ?? false;
@@ -958,7 +193,7 @@ function AdminAppContent(props) {
958
193
  ...ctx.config.menuLabels,
959
194
  ...props.menuLabels
960
195
  };
961
- useEffect4(() => {
196
+ useEffect(() => {
962
197
  fetch("/api/admin/auth").then((res) => res.json()).then((data) => {
963
198
  if (data && data.authenticated) {
964
199
  setAuthenticated(true);
@@ -979,8 +214,8 @@ function AdminAppContent(props) {
979
214
  const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
980
215
  const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
981
216
  if (authChecking) {
982
- return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
983
- /* @__PURE__ */ jsx5("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
217
+ return /* @__PURE__ */ jsx("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
218
+ /* @__PURE__ */ jsx("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
984
219
  "Authenticating Admin..."
985
220
  ] }) });
986
221
  }
@@ -988,90 +223,90 @@ function AdminAppContent(props) {
988
223
  return null;
989
224
  }
990
225
  if (!isSubscriptionActive) {
991
- 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, {}) });
226
+ return /* @__PURE__ */ jsx("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__ */ jsx(SubscriptionPage, {}) });
992
227
  }
993
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
994
- 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." }),
995
- 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." }),
996
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
997
- /* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
998
- 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)]" }),
999
- /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
228
+ return /* @__PURE__ */ jsxs("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: [
229
+ daysOverdue > 0 && daysOverdue <= 15 && /* @__PURE__ */ jsx("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." }),
230
+ daysOverdue > 15 && daysOverdue < 30 && /* @__PURE__ */ jsx("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." }),
231
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
232
+ /* @__PURE__ */ jsx("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__ */ jsxs("div", { className: "flex items-center gap-2", children: [
233
+ ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
234
+ /* @__PURE__ */ jsx("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
1000
235
  ] }) }),
1001
- /* @__PURE__ */ jsxs4("aside", { className: "flex w-full lg:w-64 shrink-0 flex-col border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/80 backdrop-blur-xl shadow-sm z-10 overflow-hidden", children: [
1002
- /* @__PURE__ */ jsxs4("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
1003
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-1", children: [
1004
- 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)]" }),
1005
- /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
236
+ /* @__PURE__ */ jsxs("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: [
237
+ /* @__PURE__ */ jsxs("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
238
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
239
+ ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
240
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
1006
241
  ] }),
1007
- /* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
242
+ /* @__PURE__ */ jsx("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
1008
243
  ] }),
1009
- /* @__PURE__ */ jsxs4("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: [
1010
- hasDashboard && /* @__PURE__ */ jsx5(
244
+ /* @__PURE__ */ jsxs("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: [
245
+ hasDashboard && /* @__PURE__ */ jsx(
1011
246
  SideItem,
1012
247
  {
1013
248
  active: section === "dashboard",
1014
249
  onClick: () => setSection("dashboard"),
1015
- icon: /* @__PURE__ */ jsx5(BarChart3, { className: "h-4 w-4 shrink-0" }),
250
+ icon: /* @__PURE__ */ jsx(BarChart3, { className: "h-4 w-4 shrink-0" }),
1016
251
  children: menuLabels.dashboard
1017
252
  }
1018
253
  ),
1019
- /* @__PURE__ */ jsx5(
254
+ /* @__PURE__ */ jsx(
1020
255
  SideItem,
1021
256
  {
1022
257
  active: section === "pages",
1023
258
  onClick: () => setSection("pages"),
1024
- icon: /* @__PURE__ */ jsx5(FileText, { className: "h-4 w-4 shrink-0" }),
259
+ icon: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 shrink-0" }),
1025
260
  children: menuLabels.pages
1026
261
  }
1027
262
  ),
1028
- /* @__PURE__ */ jsx5(
263
+ /* @__PURE__ */ jsx(
1029
264
  SideItem,
1030
265
  {
1031
266
  active: section === "collections",
1032
267
  onClick: () => setSection("collections"),
1033
- icon: /* @__PURE__ */ jsx5(Boxes, { className: "h-4 w-4 shrink-0" }),
268
+ icon: /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 shrink-0" }),
1034
269
  children: menuLabels.collections
1035
270
  }
1036
271
  ),
1037
- !hideData && /* @__PURE__ */ jsx5(
272
+ !hideData && /* @__PURE__ */ jsx(
1038
273
  SideItem,
1039
274
  {
1040
275
  active: section === "submissions",
1041
276
  onClick: () => setSection("submissions"),
1042
- icon: /* @__PURE__ */ jsx5(Inbox, { className: "h-4 w-4 shrink-0" }),
277
+ icon: /* @__PURE__ */ jsx(Inbox, { className: "h-4 w-4 shrink-0" }),
1043
278
  children: menuLabels.data
1044
279
  }
1045
280
  ),
1046
- !hideConfig && !hideGlobals && /* @__PURE__ */ jsx5(
281
+ !hideConfig && !hideGlobals && /* @__PURE__ */ jsx(
1047
282
  SideItem,
1048
283
  {
1049
284
  active: section === "config",
1050
285
  onClick: () => setSection("config"),
1051
- icon: /* @__PURE__ */ jsx5(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
286
+ icon: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
1052
287
  children: menuLabels.config
1053
288
  }
1054
289
  ),
1055
- !hideSettings && /* @__PURE__ */ jsx5(
290
+ !hideSettings && /* @__PURE__ */ jsx(
1056
291
  SideItem,
1057
292
  {
1058
293
  active: section === "settings",
1059
294
  onClick: () => setSection("settings"),
1060
- icon: /* @__PURE__ */ jsx5(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
295
+ icon: /* @__PURE__ */ jsx(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
1061
296
  children: menuLabels.settings
1062
297
  }
1063
298
  ),
1064
- subscriptionCtx && /* @__PURE__ */ jsx5(
299
+ subscriptionCtx && /* @__PURE__ */ jsx(
1065
300
  SideItem,
1066
301
  {
1067
302
  active: section === "subscription",
1068
303
  onClick: () => setSection("subscription"),
1069
- icon: /* @__PURE__ */ jsx5(CreditCard2, { className: "h-4 w-4 shrink-0" }),
304
+ icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4 shrink-0" }),
1070
305
  children: menuLabels.subscription
1071
306
  }
1072
307
  )
1073
308
  ] }),
1074
- /* @__PURE__ */ jsx5("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: /* @__PURE__ */ jsxs4(
309
+ /* @__PURE__ */ jsx("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: /* @__PURE__ */ jsxs(
1075
310
  "button",
1076
311
  {
1077
312
  onClick: async () => {
@@ -1080,20 +315,20 @@ function AdminAppContent(props) {
1080
315
  },
1081
316
  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",
1082
317
  children: [
1083
- /* @__PURE__ */ jsx5(LogOut, { className: "w-4 h-4" }),
318
+ /* @__PURE__ */ jsx(LogOut, { className: "w-4 h-4" }),
1084
319
  "Logout"
1085
320
  ]
1086
321
  }
1087
322
  ) })
1088
323
  ] }),
1089
- /* @__PURE__ */ jsxs4("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
1090
- section === "dashboard" && hasDashboard && (typeof props.dashboard === "function" ? createElement2(props.dashboard) : props.dashboard),
1091
- section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
1092
- section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
1093
- !hideData && section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
1094
- !hideConfig && !hideGlobals && section === "config" && /* @__PURE__ */ jsx5(ConfigSection, {}),
1095
- !hideSettings && section === "settings" && /* @__PURE__ */ jsx5(SettingsSection, {}),
1096
- section === "subscription" && /* @__PURE__ */ jsx5(SubscriptionPage, {})
324
+ /* @__PURE__ */ jsxs("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
325
+ section === "dashboard" && hasDashboard && (typeof props.dashboard === "function" ? createElement(props.dashboard) : props.dashboard),
326
+ section === "pages" && /* @__PURE__ */ jsx(PagesSection, {}),
327
+ section === "collections" && /* @__PURE__ */ jsx(CollectionsSection, {}),
328
+ !hideData && section === "submissions" && /* @__PURE__ */ jsx(SubmissionsSection, {}),
329
+ !hideConfig && !hideGlobals && section === "config" && /* @__PURE__ */ jsx(ConfigSection, {}),
330
+ !hideSettings && section === "settings" && /* @__PURE__ */ jsx(SettingsSection, {}),
331
+ section === "subscription" && /* @__PURE__ */ jsx(SubscriptionPage, {})
1097
332
  ] })
1098
333
  ] })
1099
334
  ] });
@@ -1104,14 +339,14 @@ function SideItem({
1104
339
  icon,
1105
340
  children
1106
341
  }) {
1107
- return /* @__PURE__ */ jsxs4(
342
+ return /* @__PURE__ */ jsxs(
1108
343
  "button",
1109
344
  {
1110
345
  onClick,
1111
346
  className: `flex items-center gap-2 lg:gap-3 rounded-lg px-4 lg:px-3 py-2 lg:py-2.5 text-left transition-all duration-200 whitespace-nowrap ${active ? "bg-indigo-600 text-white shadow-md shadow-indigo-200 lg:translate-x-1" : "text-slate-600 hover:bg-slate-100 hover:text-slate-900"}`,
1112
347
  children: [
1113
- /* @__PURE__ */ jsx5("span", { className: active ? "text-indigo-100" : "text-slate-400", children: icon }),
1114
- /* @__PURE__ */ jsx5("span", { className: "inline", children })
348
+ /* @__PURE__ */ jsx("span", { className: active ? "text-indigo-100" : "text-slate-400", children: icon }),
349
+ /* @__PURE__ */ jsx("span", { className: "inline", children })
1115
350
  ]
1116
351
  }
1117
352
  );
@@ -1122,20 +357,20 @@ function PageListItem({
1122
357
  onSelect,
1123
358
  depth = 0
1124
359
  }) {
1125
- const [expanded, setExpanded] = useState5(false);
360
+ const [expanded, setExpanded] = useState(false);
1126
361
  if (p.isSeparator) {
1127
- return /* @__PURE__ */ jsx5("li", { className: "my-2 border-t border-slate-200/60" });
362
+ return /* @__PURE__ */ jsx("li", { className: "my-2 border-t border-slate-200/60" });
1128
363
  }
1129
364
  const hasChildren = p.children && p.children.length > 0;
1130
365
  const isSelected = selected?.id === p.id;
1131
366
  const hasSelectedChild = hasChildren && p.children?.some((child) => child.id === selected?.id);
1132
- useEffect4(() => {
367
+ useEffect(() => {
1133
368
  if (hasSelectedChild) {
1134
369
  setExpanded(true);
1135
370
  }
1136
371
  }, [hasSelectedChild]);
1137
- return /* @__PURE__ */ jsxs4("li", { className: "shrink-0 lg:w-full", children: [
1138
- /* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
372
+ return /* @__PURE__ */ jsxs("li", { className: "shrink-0 lg:w-full", children: [
373
+ /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx(
1139
374
  "button",
1140
375
  {
1141
376
  onClick: () => {
@@ -1147,19 +382,19 @@ function PageListItem({
1147
382
  }
1148
383
  },
1149
384
  className: `flex-1 w-full rounded-lg py-2.5 text-left text-sm transition-all duration-200 ${depth === 0 ? "px-3" : "px-3 ml-2"} ${isSelected ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
1150
- children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
1151
- /* @__PURE__ */ jsx5(
385
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
386
+ /* @__PURE__ */ jsx(
1152
387
  "div",
1153
388
  {
1154
389
  className: `truncate ${isSelected ? "text-slate-900" : "text-slate-700"}`,
1155
390
  children: p.name
1156
391
  }
1157
392
  ),
1158
- hasChildren && /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx5(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx5(ChevronDown, { size: 14 }) })
393
+ hasChildren && /* @__PURE__ */ jsx("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) })
1159
394
  ] })
1160
395
  }
1161
396
  ) }),
1162
- hasChildren && expanded && /* @__PURE__ */ jsx5("ul", { className: `mt-1 space-y-1 ${depth === 0 ? "ml-4 border-l-2 border-slate-100 pl-1" : "ml-2"}`, children: p.children.map((child) => /* @__PURE__ */ jsx5(
397
+ hasChildren && expanded && /* @__PURE__ */ jsx("ul", { className: `mt-1 space-y-1 ${depth === 0 ? "ml-4 border-l-2 border-slate-100 pl-1" : "ml-2"}`, children: p.children.map((child) => /* @__PURE__ */ jsx(
1163
398
  PageListItem,
1164
399
  {
1165
400
  p: child,
@@ -1173,15 +408,15 @@ function PageListItem({
1173
408
  }
1174
409
  function PagesSection() {
1175
410
  const ctx = useCmsContext();
1176
- const [selected, setSelected] = useState5(
411
+ const [selected, setSelected] = useState(
1177
412
  ctx.config.pages[0] ?? null
1178
413
  );
1179
- const [showList, setShowList] = useState5(true);
1180
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
1181
- showList && /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
1182
- /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
1183
- /* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
1184
- ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
414
+ const [showList, setShowList] = useState(true);
415
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [
416
+ showList && /* @__PURE__ */ jsxs("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: [
417
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
418
+ /* @__PURE__ */ jsxs("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
419
+ ctx.config.pages.map((p) => /* @__PURE__ */ jsx(
1185
420
  PageListItem,
1186
421
  {
1187
422
  p,
@@ -1190,31 +425,31 @@ function PagesSection() {
1190
425
  },
1191
426
  p.id
1192
427
  )),
1193
- ctx.config.pages.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No pages registered." })
428
+ ctx.config.pages.length === 0 && /* @__PURE__ */ jsx("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No pages registered." })
1194
429
  ] })
1195
430
  ] }),
1196
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden bg-slate-50/50 flex flex-col", children: selected ? /* @__PURE__ */ jsx5(
431
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden bg-slate-50/50 flex flex-col", children: selected ? /* @__PURE__ */ jsx(
1197
432
  PageEditor,
1198
433
  {
1199
434
  page: selected,
1200
435
  showList,
1201
436
  onToggleList: () => setShowList(!showList)
1202
437
  }
1203
- ) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a page to edit its content." }) })
438
+ ) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a page to edit its content." }) })
1204
439
  ] });
1205
440
  }
1206
441
  function PageEditor({ page, showList, onToggleList }) {
1207
442
  const ctx = useCmsContext();
1208
- const iframeRef = useRef2(null);
1209
- const [registered, setRegistered] = useState5([]);
1210
- const [selectedId, setSelectedId] = useState5(null);
1211
- const [preview, setPreview] = useState5(false);
1212
- const [drawerState, setDrawerState] = useState5("half");
1213
- const src = useMemo2(
443
+ const iframeRef = useRef(null);
444
+ const [registered, setRegistered] = useState([]);
445
+ const [selectedId, setSelectedId] = useState(null);
446
+ const [preview, setPreview] = useState(false);
447
+ const [drawerState, setDrawerState] = useState("half");
448
+ const src = useMemo(
1214
449
  () => `${page.path}${preview ? "" : "?__cms=edit"}`,
1215
450
  [page.path, preview]
1216
451
  );
1217
- useEffect4(() => {
452
+ useEffect(() => {
1218
453
  const onMsg = (e) => {
1219
454
  if (e.source !== iframeRef.current?.contentWindow) return;
1220
455
  const d = e.data;
@@ -1236,11 +471,11 @@ function PageEditor({ page, showList, onToggleList }) {
1236
471
  window.addEventListener("message", onMsg);
1237
472
  return () => window.removeEventListener("message", onMsg);
1238
473
  }, [ctx.overrides]);
1239
- useEffect4(() => {
474
+ useEffect(() => {
1240
475
  setRegistered([]);
1241
476
  setSelectedId(null);
1242
477
  }, [page.id]);
1243
- const updateOverride = useCallback3(
478
+ const updateOverride = useCallback(
1244
479
  (id, value) => {
1245
480
  ctx.setOverride(id, value);
1246
481
  iframeRef.current?.contentWindow?.postMessage(
@@ -1251,33 +486,33 @@ function PageEditor({ page, showList, onToggleList }) {
1251
486
  [ctx]
1252
487
  );
1253
488
  const selectedMeta = registered.find((r) => r.id === selectedId) ?? null;
1254
- const [viewMode, setViewMode] = useState5("desktop");
1255
- return /* @__PURE__ */ jsxs4("div", { className: "flex h-full flex-col", children: [
1256
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-slate-200 bg-white/80 backdrop-blur px-4 py-3 shadow-sm z-10 shrink-0", children: [
1257
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
1258
- /* @__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" }) }),
1259
- /* @__PURE__ */ jsx5("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
1260
- /* @__PURE__ */ jsx5("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
1261
- /* @__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 })
489
+ const [viewMode, setViewMode] = useState("desktop");
490
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col", children: [
491
+ /* @__PURE__ */ jsxs("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: [
492
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
493
+ /* @__PURE__ */ jsx("button", { onClick: onToggleList, className: "text-slate-400 hover:text-slate-700 p-1 hidden lg:block", title: "Toggle Pages Menu", children: showList ? /* @__PURE__ */ jsx(PanelLeftClose, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(PanelLeftOpen, { className: "w-5 h-5" }) }),
494
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
495
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
496
+ /* @__PURE__ */ jsx("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 })
1262
497
  ] }),
1263
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 overflow-x-auto w-full sm:w-auto pb-1 sm:pb-0 hide-scrollbar shrink-0", children: [
1264
- /* @__PURE__ */ jsxs4("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
1265
- /* @__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" }) }),
1266
- /* @__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" }) }),
1267
- /* @__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" }) })
498
+ /* @__PURE__ */ jsxs("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: [
499
+ /* @__PURE__ */ jsxs("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
500
+ /* @__PURE__ */ jsx("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__ */ jsx(Monitor, { className: "w-4 h-4" }) }),
501
+ /* @__PURE__ */ jsx("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__ */ jsx(Tablet, { className: "w-4 h-4" }) }),
502
+ /* @__PURE__ */ jsx("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__ */ jsx(Smartphone, { className: "w-4 h-4" }) })
1268
503
  ] }),
1269
- /* @__PURE__ */ jsxs4(
504
+ /* @__PURE__ */ jsxs(
1270
505
  "button",
1271
506
  {
1272
507
  onClick: () => setPreview((v) => !v),
1273
508
  className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50 hover:text-slate-900 transition-colors bg-white shadow-sm shrink-0",
1274
509
  children: [
1275
- preview ? /* @__PURE__ */ jsx5(Pencil, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx5(Monitor, { className: "h-3.5 w-3.5" }),
510
+ preview ? /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Monitor, { className: "h-3.5 w-3.5" }),
1276
511
  preview ? "Edit" : "Preview"
1277
512
  ]
1278
513
  }
1279
514
  ),
1280
- /* @__PURE__ */ jsxs4(
515
+ /* @__PURE__ */ jsxs(
1281
516
  "a",
1282
517
  {
1283
518
  href: page.path,
@@ -1285,39 +520,39 @@ function PageEditor({ page, showList, onToggleList }) {
1285
520
  rel: "noreferrer",
1286
521
  className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50 hover:text-slate-900 transition-colors bg-white shadow-sm shrink-0",
1287
522
  children: [
1288
- /* @__PURE__ */ jsx5(Upload, { className: "h-3.5 w-3.5" }),
523
+ /* @__PURE__ */ jsx(Upload, { className: "h-3.5 w-3.5" }),
1289
524
  "Open"
1290
525
  ]
1291
526
  }
1292
527
  ),
1293
- /* @__PURE__ */ jsxs4(
528
+ /* @__PURE__ */ jsxs(
1294
529
  "button",
1295
530
  {
1296
531
  onClick: () => ctx.reset(),
1297
532
  disabled: !ctx.isDirty,
1298
533
  className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50 hover:text-slate-900 disabled:opacity-50 transition-colors bg-white shadow-sm shrink-0",
1299
534
  children: [
1300
- /* @__PURE__ */ jsx5(X, { className: "h-3.5 w-3.5" }),
535
+ /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }),
1301
536
  "Discard"
1302
537
  ]
1303
538
  }
1304
539
  ),
1305
- /* @__PURE__ */ jsxs4(
540
+ /* @__PURE__ */ jsxs(
1306
541
  "button",
1307
542
  {
1308
543
  onClick: () => ctx.save(),
1309
544
  disabled: !ctx.isDirty,
1310
545
  className: "inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors shadow-sm shrink-0",
1311
546
  children: [
1312
- /* @__PURE__ */ jsx5(Boxes, { className: "h-3.5 w-3.5" }),
547
+ /* @__PURE__ */ jsx(Boxes, { className: "h-3.5 w-3.5" }),
1313
548
  "Save"
1314
549
  ]
1315
550
  }
1316
551
  )
1317
552
  ] })
1318
553
  ] }),
1319
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
1320
- /* @__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(
554
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
555
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden bg-slate-100/80 p-2 sm:p-4 flex flex-col items-center", children: /* @__PURE__ */ jsx("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__ */ jsx(
1321
556
  "iframe",
1322
557
  {
1323
558
  ref: iframeRef,
@@ -1328,36 +563,36 @@ function PageEditor({ page, showList, onToggleList }) {
1328
563
  },
1329
564
  src
1330
565
  ) }) }),
1331
- /* @__PURE__ */ jsxs4("aside", { className: `w-full sm:w-[320px] lg:w-[360px] shrink-0 overflow-y-auto border-t sm:border-t-0 sm:border-l border-slate-200 bg-white shadow-[-4px_0_15px_-3px_rgba(0,0,0,0.05)] z-10 hide-scrollbar transition-all duration-300 ${drawerState === "min" ? "max-h-[52px] sm:max-h-none" : drawerState === "full" ? "max-h-[85vh] sm:max-h-none" : "max-h-[50vh] sm:max-h-none"}`, children: [
1332
- /* @__PURE__ */ jsxs4("div", { className: "sticky top-0 bg-white/90 backdrop-blur border-b border-slate-200 px-5 py-3 md:py-4 z-10 flex items-center justify-between", children: [
1333
- /* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
1334
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
1335
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 sm:hidden", children: [
1336
- /* @__PURE__ */ jsx5(
566
+ /* @__PURE__ */ jsxs("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: [
567
+ /* @__PURE__ */ jsxs("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: [
568
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
569
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
570
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:hidden", children: [
571
+ /* @__PURE__ */ jsx(
1337
572
  "button",
1338
573
  {
1339
574
  onClick: () => setDrawerState((prev) => prev === "full" ? "half" : prev === "half" ? "min" : "half"),
1340
575
  className: "p-1 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded",
1341
576
  title: "Shrink",
1342
- children: /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4" })
577
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
1343
578
  }
1344
579
  ),
1345
- /* @__PURE__ */ jsx5(
580
+ /* @__PURE__ */ jsx(
1346
581
  "button",
1347
582
  {
1348
583
  onClick: () => setDrawerState((prev) => prev === "min" ? "half" : prev === "half" ? "full" : "half"),
1349
584
  className: "p-1 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded",
1350
585
  title: "Expand",
1351
- children: /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4" })
586
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "w-4 h-4" })
1352
587
  }
1353
588
  )
1354
589
  ] }),
1355
- 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" })
590
+ selectedMeta && /* @__PURE__ */ jsx("button", { onClick: () => setSelectedId(null), className: "sm:hidden text-slate-400 hover:text-slate-700 text-xs font-bold uppercase tracking-widest", children: "Close" })
1356
591
  ] })
1357
592
  ] }),
1358
- /* @__PURE__ */ jsxs4("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
1359
- !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." }) }),
1360
- selectedMeta ? /* @__PURE__ */ jsx5(
593
+ /* @__PURE__ */ jsxs("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
594
+ !selectedMeta && /* @__PURE__ */ jsx("div", { className: "px-5 mt-1 mb-2", children: /* @__PURE__ */ jsx("p", { className: "text-[10px] md:text-xs text-slate-400", children: "Select an element on the left to edit it." }) }),
595
+ selectedMeta ? /* @__PURE__ */ jsx(
1361
596
  FieldEditor,
1362
597
  {
1363
598
  meta: selectedMeta,
@@ -1377,10 +612,10 @@ function PageEditor({ page, showList, onToggleList }) {
1377
612
  },
1378
613
  onClose: () => setSelectedId(null)
1379
614
  }
1380
- ) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
1381
- page.hideable && /* @__PURE__ */ jsxs4("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
1382
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3", children: [
1383
- /* @__PURE__ */ jsx5(
615
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
616
+ page.hideable && /* @__PURE__ */ jsxs("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
617
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
618
+ /* @__PURE__ */ jsx(
1384
619
  "input",
1385
620
  {
1386
621
  type: "checkbox",
@@ -1390,11 +625,11 @@ function PageEditor({ page, showList, onToggleList }) {
1390
625
  className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1391
626
  }
1392
627
  ),
1393
- /* @__PURE__ */ jsx5("label", { htmlFor: `page-visible-toggle-${page.id}`, className: "text-sm font-medium text-slate-800 cursor-pointer flex-1", children: "Page is Visible" })
628
+ /* @__PURE__ */ jsx("label", { htmlFor: `page-visible-toggle-${page.id}`, className: "text-sm font-medium text-slate-800 cursor-pointer flex-1", children: "Page is Visible" })
1394
629
  ] }),
1395
- /* @__PURE__ */ jsx5("p", { className: "text-[11px] text-slate-500 mt-1.5 pl-8", children: "If unchecked, this page will be hidden from navigation and URL access." })
630
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-slate-500 mt-1.5 pl-8", children: "If unchecked, this page will be hidden from navigation and URL access." })
1396
631
  ] }),
1397
- /* @__PURE__ */ jsx5(
632
+ /* @__PURE__ */ jsx(
1398
633
  SectionAccordion,
1399
634
  {
1400
635
  registered,
@@ -1418,10 +653,10 @@ function SectionAccordion({
1418
653
  registered,
1419
654
  onSelect
1420
655
  }) {
1421
- const [expanded, setExpanded] = useState5({});
656
+ const [expanded, setExpanded] = useState({});
1422
657
  if (registered.length === 0) {
1423
- return /* @__PURE__ */ jsxs4("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
1424
- /* @__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" }) }),
658
+ return /* @__PURE__ */ jsxs("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
659
+ /* @__PURE__ */ jsx("div", { className: "w-12 h-12 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx(Pencil, { className: "h-5 w-5 text-slate-400" }) }),
1425
660
  "No editable fields detected on this page."
1426
661
  ] });
1427
662
  }
@@ -1434,23 +669,23 @@ function SectionAccordion({
1434
669
  const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
1435
670
  const unsectionedFields = groups["Unsectioned"] || [];
1436
671
  const toggle = (name) => setExpanded((prev) => ({ ...prev, [name]: !prev[name] }));
1437
- return /* @__PURE__ */ jsxs4("div", { className: "p-2 space-y-3", children: [
1438
- 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)) }),
672
+ return /* @__PURE__ */ jsxs("div", { className: "p-2 space-y-3", children: [
673
+ unsectionedFields.length > 0 && /* @__PURE__ */ jsx("ul", { className: "divide-y divide-slate-100 bg-white rounded-lg border border-slate-200 overflow-hidden shadow-sm", children: unsectionedFields.map((m) => /* @__PURE__ */ jsx(FieldListItem, { meta: m, onSelect }, m.id)) }),
1439
674
  sectionNames.map((sectionName) => {
1440
675
  const isOpen = expanded[sectionName] ?? false;
1441
676
  const fields = groups[sectionName];
1442
- return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
1443
- /* @__PURE__ */ jsxs4(
677
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
678
+ /* @__PURE__ */ jsxs(
1444
679
  "button",
1445
680
  {
1446
681
  onClick: () => toggle(sectionName),
1447
682
  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",
1448
683
  children: [
1449
- /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
1450
- /* @__PURE__ */ jsx5("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
1451
- /* @__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 })
684
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
685
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
686
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-slate-400 bg-slate-200/70 px-1.5 py-0.5 rounded-full", children: fields.length })
1452
687
  ] }),
1453
- /* @__PURE__ */ jsx5(
688
+ /* @__PURE__ */ jsx(
1454
689
  "svg",
1455
690
  {
1456
691
  className: `h-4 w-4 text-slate-400 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`,
@@ -1458,35 +693,35 @@ function SectionAccordion({
1458
693
  viewBox: "0 0 24 24",
1459
694
  stroke: "currentColor",
1460
695
  strokeWidth: 2,
1461
- children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
696
+ children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
1462
697
  }
1463
698
  )
1464
699
  ]
1465
700
  }
1466
701
  ),
1467
- isOpen && /* @__PURE__ */ jsx5("ul", { className: "divide-y divide-slate-100 bg-white", children: fields.map((m) => /* @__PURE__ */ jsx5(FieldListItem, { meta: m, onSelect }, m.id)) })
702
+ isOpen && /* @__PURE__ */ jsx("ul", { className: "divide-y divide-slate-100 bg-white", children: fields.map((m) => /* @__PURE__ */ jsx(FieldListItem, { meta: m, onSelect }, m.id)) })
1468
703
  ] }, sectionName);
1469
704
  })
1470
705
  ] });
1471
706
  }
1472
707
  function FieldListItem({ meta, onSelect }) {
1473
- return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs4(
708
+ return /* @__PURE__ */ jsx("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs(
1474
709
  "button",
1475
710
  {
1476
711
  onClick: () => onSelect(meta.id),
1477
712
  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",
1478
713
  children: [
1479
- /* @__PURE__ */ jsxs4("span", { className: "overflow-hidden", children: [
1480
- /* @__PURE__ */ jsx5("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
1481
- /* @__PURE__ */ jsxs4("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
714
+ /* @__PURE__ */ jsxs("span", { className: "overflow-hidden", children: [
715
+ /* @__PURE__ */ jsx("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
716
+ /* @__PURE__ */ jsxs("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1482
717
  meta.type,
1483
718
  " ",
1484
- /* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
719
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
1485
720
  " ",
1486
721
  meta.id
1487
722
  ] })
1488
723
  ] }),
1489
- /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4 text-slate-300 group-hover:text-indigo-500 transition-colors shrink-0" })
724
+ /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-slate-300 group-hover:text-indigo-500 transition-colors shrink-0" })
1490
725
  ]
1491
726
  }
1492
727
  ) });
@@ -1494,10 +729,10 @@ function FieldListItem({ meta, onSelect }) {
1494
729
  function SidebarReferenceSelect({ meta, value, onChange }) {
1495
730
  const ctx = useCmsContext();
1496
731
  const collection = ctx.config.collections?.find((c) => c.id === meta.collection);
1497
- const [items, setItems] = useState5([]);
1498
- const [search, setSearch] = useState5("");
1499
- const [loading, setLoading] = useState5(true);
1500
- useEffect4(() => {
732
+ const [items, setItems] = useState([]);
733
+ const [search, setSearch] = useState("");
734
+ const [loading, setLoading] = useState(true);
735
+ useEffect(() => {
1501
736
  if (!meta.collection) return;
1502
737
  setLoading(true);
1503
738
  ctx.adapter.listEntries(meta.collection).then((res) => {
@@ -1526,8 +761,8 @@ function SidebarReferenceSelect({ meta, value, onChange }) {
1526
761
  const txt = String(it[txtField?.id || "id"] || "");
1527
762
  return txt.toLowerCase().includes(q);
1528
763
  });
1529
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1530
- /* @__PURE__ */ jsx5(
764
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
765
+ /* @__PURE__ */ jsx(
1531
766
  "input",
1532
767
  {
1533
768
  placeholder: "Search...",
@@ -1536,26 +771,26 @@ function SidebarReferenceSelect({ meta, value, onChange }) {
1536
771
  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"
1537
772
  }
1538
773
  ),
1539
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2 max-h-60 overflow-y-auto pr-1", children: [
1540
- loading ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500", children: "Loading..." }) : filtered.map((it) => {
774
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 max-h-60 overflow-y-auto pr-1", children: [
775
+ loading ? /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Loading..." }) : filtered.map((it) => {
1541
776
  const isSelected = selectedIds.includes(it.id);
1542
777
  const imgSrc = imgField ? it[imgField.id] : null;
1543
778
  const label = txtField ? it[txtField.id] : it.id;
1544
- return /* @__PURE__ */ jsxs4(
779
+ return /* @__PURE__ */ jsxs(
1545
780
  "div",
1546
781
  {
1547
782
  onClick: () => toggle(it.id),
1548
783
  className: `flex items-center gap-3 p-2 rounded-xl cursor-pointer border ${isSelected ? "border-indigo-500 bg-indigo-50" : "border-slate-100 bg-slate-50 hover:border-slate-300"}`,
1549
784
  children: [
1550
- !!imgSrc && /* @__PURE__ */ jsx5("img", { src: Array.isArray(imgSrc) ? String(imgSrc[0]) : String(imgSrc), alt: "", className: "w-10 h-10 rounded-lg object-cover bg-white border border-slate-200" }),
1551
- /* @__PURE__ */ jsx5("span", { className: `text-sm ${isSelected ? "font-semibold text-indigo-900" : "text-slate-700"}`, children: String(label) }),
1552
- isSelected && /* @__PURE__ */ jsx5(Check, { className: "w-4 h-4 text-indigo-600 ml-auto" })
785
+ !!imgSrc && /* @__PURE__ */ jsx("img", { src: Array.isArray(imgSrc) ? String(imgSrc[0]) : String(imgSrc), alt: "", className: "w-10 h-10 rounded-lg object-cover bg-white border border-slate-200" }),
786
+ /* @__PURE__ */ jsx("span", { className: `text-sm ${isSelected ? "font-semibold text-indigo-900" : "text-slate-700"}`, children: String(label) }),
787
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-indigo-600 ml-auto" })
1553
788
  ]
1554
789
  },
1555
790
  it.id
1556
791
  );
1557
792
  }),
1558
- !loading && filtered.length === 0 && /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500 text-center py-4", children: "No items found." })
793
+ !loading && filtered.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500 text-center py-4", children: "No items found." })
1559
794
  ] })
1560
795
  ] });
1561
796
  }
@@ -1567,19 +802,19 @@ function FieldEditor({
1567
802
  onClose
1568
803
  }) {
1569
804
  const ctx = useCmsContext();
1570
- const [expandedItems, setExpandedItems] = useState5({});
1571
- const [searchQuery, setSearchQuery] = useState5("");
1572
- const [listDragIdx, setListDragIdx] = useState5(null);
1573
- const [listDragOverIdx, setListDragOverIdx] = useState5(null);
1574
- return /* @__PURE__ */ jsxs4("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
1575
- /* @__PURE__ */ jsxs4("div", { className: "mb-5", children: [
1576
- /* @__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 }),
1577
- /* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
1578
- /* @__PURE__ */ jsx5("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
805
+ const [expandedItems, setExpandedItems] = useState({});
806
+ const [searchQuery, setSearchQuery] = useState("");
807
+ const [listDragIdx, setListDragIdx] = useState(null);
808
+ const [listDragOverIdx, setListDragOverIdx] = useState(null);
809
+ return /* @__PURE__ */ jsxs("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
810
+ /* @__PURE__ */ jsxs("div", { className: "mb-5", children: [
811
+ /* @__PURE__ */ jsx("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 }),
812
+ /* @__PURE__ */ jsx("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
813
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
1579
814
  ] }),
1580
- /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1581
- meta.type === "boolean" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3 py-1", children: [
1582
- /* @__PURE__ */ jsx5(
815
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
816
+ meta.type === "boolean" && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3 py-1", children: [
817
+ /* @__PURE__ */ jsx(
1583
818
  "input",
1584
819
  {
1585
820
  type: "checkbox",
@@ -1589,9 +824,9 @@ function FieldEditor({
1589
824
  className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1590
825
  }
1591
826
  ),
1592
- /* @__PURE__ */ jsx5("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
827
+ /* @__PURE__ */ jsx("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
1593
828
  ] }),
1594
- meta.type === "text" && /* @__PURE__ */ jsx5(
829
+ meta.type === "text" && /* @__PURE__ */ jsx(
1595
830
  "input",
1596
831
  {
1597
832
  type: "text",
@@ -1600,7 +835,7 @@ function FieldEditor({
1600
835
  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"
1601
836
  }
1602
837
  ),
1603
- meta.type === "textarea" && /* @__PURE__ */ jsx5(
838
+ meta.type === "textarea" && /* @__PURE__ */ jsx(
1604
839
  "textarea",
1605
840
  {
1606
841
  value: String(value ?? ""),
@@ -1609,9 +844,9 @@ function FieldEditor({
1609
844
  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"
1610
845
  }
1611
846
  ),
1612
- meta.type === "image" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1613
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1614
- /* @__PURE__ */ jsx5(
847
+ meta.type === "image" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
848
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
849
+ /* @__PURE__ */ jsx(
1615
850
  "input",
1616
851
  {
1617
852
  type: "url",
@@ -1621,9 +856,9 @@ function FieldEditor({
1621
856
  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"
1622
857
  }
1623
858
  ),
1624
- /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
859
+ /* @__PURE__ */ jsxs("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: [
1625
860
  "Upload",
1626
- /* @__PURE__ */ jsx5(
861
+ /* @__PURE__ */ jsx(
1627
862
  "input",
1628
863
  {
1629
864
  type: "file",
@@ -1639,8 +874,8 @@ function FieldEditor({
1639
874
  )
1640
875
  ] })
1641
876
  ] }),
1642
- value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
1643
- /* @__PURE__ */ jsx5(
877
+ value ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
878
+ /* @__PURE__ */ jsx(
1644
879
  "img",
1645
880
  {
1646
881
  src: String(value),
@@ -1648,7 +883,7 @@ function FieldEditor({
1648
883
  className: "max-h-48 w-full object-contain rounded-lg"
1649
884
  }
1650
885
  ),
1651
- /* @__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" }) })
886
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx("span", { className: "text-white text-xs font-medium px-2 py-1 bg-black/50 rounded backdrop-blur", children: "Preview" }) })
1652
887
  ] }) : null
1653
888
  ] }),
1654
889
  meta.type === "file" && (() => {
@@ -1656,9 +891,9 @@ function FieldEditor({
1656
891
  const strVal = String(currentVal ?? "");
1657
892
  const isVideo = strVal.match(/\.(mp4|webm|ogg|mov)(\?.*)?$/i) || strVal.includes("video");
1658
893
  const isImg = strVal.match(/\.(jpe?g|png|webp|avif|gif|svg)(\?.*)?$/i) || strVal.includes("image");
1659
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1660
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1661
- /* @__PURE__ */ jsx5(
894
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
895
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
896
+ /* @__PURE__ */ jsx(
1662
897
  "input",
1663
898
  {
1664
899
  type: "url",
@@ -1668,9 +903,9 @@ function FieldEditor({
1668
903
  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 font-mono text-xs"
1669
904
  }
1670
905
  ),
1671
- /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
906
+ /* @__PURE__ */ jsxs("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: [
1672
907
  "Subir",
1673
- /* @__PURE__ */ jsx5(
908
+ /* @__PURE__ */ jsx(
1674
909
  "input",
1675
910
  {
1676
911
  type: "file",
@@ -1686,8 +921,8 @@ function FieldEditor({
1686
921
  )
1687
922
  ] })
1688
923
  ] }),
1689
- currentVal ? /* @__PURE__ */ jsx5("div", { className: "space-y-2", children: isVideo ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-2 bg-slate-900 overflow-hidden shadow-sm", children: [
1690
- /* @__PURE__ */ jsx5(
924
+ currentVal ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: isVideo ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-2 bg-slate-900 overflow-hidden shadow-sm", children: [
925
+ /* @__PURE__ */ jsx(
1691
926
  "video",
1692
927
  {
1693
928
  src: strVal,
@@ -1700,15 +935,15 @@ function FieldEditor({
1700
935
  },
1701
936
  strVal
1702
937
  ),
1703
- /* @__PURE__ */ jsxs4("div", { className: "text-[10px] text-slate-300 font-mono truncate px-1 pt-1.5 flex items-center gap-1.5", children: [
1704
- /* @__PURE__ */ jsx5("span", { className: "inline-block w-2 h-2 rounded-full bg-emerald-400 animate-pulse" }),
1705
- /* @__PURE__ */ jsxs4("span", { className: "truncate", children: [
938
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-slate-300 font-mono truncate px-1 pt-1.5 flex items-center gap-1.5", children: [
939
+ /* @__PURE__ */ jsx("span", { className: "inline-block w-2 h-2 rounded-full bg-emerald-400 animate-pulse" }),
940
+ /* @__PURE__ */ jsxs("span", { className: "truncate", children: [
1706
941
  "\u{1F3AC} ",
1707
942
  strVal
1708
943
  ] })
1709
944
  ] })
1710
- ] }) : isImg ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-2 bg-slate-50 overflow-hidden shadow-sm", children: [
1711
- /* @__PURE__ */ jsx5(
945
+ ] }) : isImg ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-2 bg-slate-50 overflow-hidden shadow-sm", children: [
946
+ /* @__PURE__ */ jsx(
1712
947
  "img",
1713
948
  {
1714
949
  src: strVal,
@@ -1716,13 +951,13 @@ function FieldEditor({
1716
951
  className: "max-h-52 w-full object-contain rounded-lg"
1717
952
  }
1718
953
  ),
1719
- /* @__PURE__ */ jsxs4("div", { className: "text-[10px] text-slate-500 font-mono truncate px-1 pt-1.5", children: [
954
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-slate-500 font-mono truncate px-1 pt-1.5", children: [
1720
955
  "\u{1F5BC}\uFE0F ",
1721
956
  strVal
1722
957
  ] })
1723
- ] }) : /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
1724
- /* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} Archivo:" }),
1725
- /* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: strVal })
958
+ ] }) : /* @__PURE__ */ jsxs("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: [
959
+ /* @__PURE__ */ jsx("span", { children: "\u{1F4C4} Archivo:" }),
960
+ /* @__PURE__ */ jsx("span", { className: "truncate text-indigo-600 font-semibold", children: strVal })
1726
961
  ] }) }) : null
1727
962
  ] });
1728
963
  })(),
@@ -1731,10 +966,10 @@ function FieldEditor({
1731
966
  const currentObj = value || {};
1732
967
  const currentText = currentObj.text !== void 0 ? currentObj.text : defaultObj.text ?? "";
1733
968
  const currentHref = currentObj.href !== void 0 ? currentObj.href : defaultObj.href ?? "";
1734
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
1735
- /* @__PURE__ */ jsxs4("label", { className: "block", children: [
1736
- /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Texto del Enlace" }),
1737
- /* @__PURE__ */ jsx5(
969
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
970
+ /* @__PURE__ */ jsxs("label", { className: "block", children: [
971
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Texto del Enlace" }),
972
+ /* @__PURE__ */ jsx(
1738
973
  "input",
1739
974
  {
1740
975
  value: currentText,
@@ -1748,9 +983,9 @@ function FieldEditor({
1748
983
  }
1749
984
  )
1750
985
  ] }),
1751
- /* @__PURE__ */ jsxs4("label", { className: "block", children: [
1752
- /* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL de Destino" }),
1753
- /* @__PURE__ */ jsx5(
986
+ /* @__PURE__ */ jsxs("label", { className: "block", children: [
987
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL de Destino" }),
988
+ /* @__PURE__ */ jsx(
1754
989
  "input",
1755
990
  {
1756
991
  value: currentHref,
@@ -1766,8 +1001,8 @@ function FieldEditor({
1766
1001
  ] })
1767
1002
  ] });
1768
1003
  })(),
1769
- meta.type === "color" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1770
- /* @__PURE__ */ jsx5(
1004
+ meta.type === "color" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1005
+ /* @__PURE__ */ jsx(
1771
1006
  "input",
1772
1007
  {
1773
1008
  type: "color",
@@ -1776,7 +1011,7 @@ function FieldEditor({
1776
1011
  className: "h-10 w-16 cursor-pointer rounded bg-transparent border-0 p-0"
1777
1012
  }
1778
1013
  ),
1779
- /* @__PURE__ */ jsx5(
1014
+ /* @__PURE__ */ jsx(
1780
1015
  "input",
1781
1016
  {
1782
1017
  type: "text",
@@ -1786,7 +1021,7 @@ function FieldEditor({
1786
1021
  }
1787
1022
  )
1788
1023
  ] }),
1789
- meta.type === "richtext" && /* @__PURE__ */ jsx5(
1024
+ meta.type === "richtext" && /* @__PURE__ */ jsx(
1790
1025
  "textarea",
1791
1026
  {
1792
1027
  value: String(value ?? ""),
@@ -1795,10 +1030,10 @@ function FieldEditor({
1795
1030
  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"
1796
1031
  }
1797
1032
  ),
1798
- meta.type === "list" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
1799
- meta.search && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
1800
- /* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
1801
- /* @__PURE__ */ jsx5(
1033
+ meta.type === "list" && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1034
+ meta.search && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1035
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
1036
+ /* @__PURE__ */ jsx(
1802
1037
  "input",
1803
1038
  {
1804
1039
  type: "text",
@@ -1816,7 +1051,7 @@ function FieldEditor({
1816
1051
  }
1817
1052
  const isExpanded = expandedItems[idx] ?? false;
1818
1053
  const isReorderable = !!(meta.reorderable || meta.sortable);
1819
- return /* @__PURE__ */ jsxs4(
1054
+ return /* @__PURE__ */ jsxs(
1820
1055
  "div",
1821
1056
  {
1822
1057
  draggable: isReorderable,
@@ -1848,23 +1083,23 @@ function FieldEditor({
1848
1083
  } : void 0,
1849
1084
  className: `bg-slate-50 p-3 rounded-xl border transition-all relative group ${isReorderable && listDragOverIdx === idx ? "border-indigo-500 border-2 bg-indigo-50/40" : "border-slate-200 hover:border-slate-300"} ${isReorderable && listDragIdx === idx ? "opacity-40" : ""}`,
1850
1085
  children: [
1851
- /* @__PURE__ */ jsxs4("div", { className: "space-y-3 w-full min-w-0", children: [
1852
- /* @__PURE__ */ jsxs4(
1086
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 w-full min-w-0", children: [
1087
+ /* @__PURE__ */ jsxs(
1853
1088
  "div",
1854
1089
  {
1855
1090
  className: "flex items-center justify-between cursor-pointer py-1 select-none gap-2",
1856
1091
  onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
1857
1092
  children: [
1858
- isReorderable && /* @__PURE__ */ jsxs4(
1093
+ isReorderable && /* @__PURE__ */ jsxs(
1859
1094
  "div",
1860
1095
  {
1861
1096
  className: "flex items-center gap-1 text-slate-400 select-none shrink-0",
1862
1097
  title: "Drag or use arrows to reorder",
1863
1098
  onClick: (e) => e.stopPropagation(),
1864
1099
  children: [
1865
- /* @__PURE__ */ jsx5(GripVertical, { className: "w-4 h-4 cursor-grab active:cursor-grabbing hover:text-indigo-600" }),
1866
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-0.5", children: [
1867
- /* @__PURE__ */ jsx5(
1100
+ /* @__PURE__ */ jsx(GripVertical, { className: "w-4 h-4 cursor-grab active:cursor-grabbing hover:text-indigo-600" }),
1101
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
1102
+ /* @__PURE__ */ jsx(
1868
1103
  "button",
1869
1104
  {
1870
1105
  type: "button",
@@ -1879,10 +1114,10 @@ function FieldEditor({
1879
1114
  },
1880
1115
  className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
1881
1116
  title: "Move Up",
1882
- children: /* @__PURE__ */ jsx5(ChevronUp, { className: "w-3.5 h-3.5" })
1117
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "w-3.5 h-3.5" })
1883
1118
  }
1884
1119
  ),
1885
- /* @__PURE__ */ jsx5(
1120
+ /* @__PURE__ */ jsx(
1886
1121
  "button",
1887
1122
  {
1888
1123
  type: "button",
@@ -1897,21 +1132,21 @@ function FieldEditor({
1897
1132
  },
1898
1133
  className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
1899
1134
  title: "Move Down",
1900
- children: /* @__PURE__ */ jsx5(ChevronDown, { className: "w-3.5 h-3.5" })
1135
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-3.5 h-3.5" })
1901
1136
  }
1902
1137
  )
1903
1138
  ] })
1904
1139
  ]
1905
1140
  }
1906
1141
  ),
1907
- /* @__PURE__ */ jsx5("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-4", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
1908
- isExpanded ? /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
1142
+ /* @__PURE__ */ jsx("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-4", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
1143
+ isExpanded ? /* @__PURE__ */ jsx(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
1909
1144
  ]
1910
1145
  }
1911
1146
  ),
1912
- isExpanded && /* @__PURE__ */ jsx5("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs4("div", { children: [
1913
- /* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1914
- schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
1147
+ isExpanded && /* @__PURE__ */ jsx("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs("div", { children: [
1148
+ /* @__PURE__ */ jsx("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1149
+ schemaField.type === "icon" ? /* @__PURE__ */ jsx(
1915
1150
  SearchableSelect,
1916
1151
  {
1917
1152
  value: String(item?.[schemaField.key] ?? (Array.isArray(meta.defaultValue) ? meta.defaultValue[idx]?.[schemaField.key] : "") ?? ""),
@@ -1924,7 +1159,7 @@ function FieldEditor({
1924
1159
  onChange(arr);
1925
1160
  }
1926
1161
  }
1927
- ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
1162
+ ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx(
1928
1163
  "textarea",
1929
1164
  {
1930
1165
  rows: 3,
@@ -1936,8 +1171,8 @@ function FieldEditor({
1936
1171
  },
1937
1172
  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"
1938
1173
  }
1939
- ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1940
- /* @__PURE__ */ jsx5(
1174
+ ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1175
+ /* @__PURE__ */ jsx(
1941
1176
  "input",
1942
1177
  {
1943
1178
  type: "checkbox",
@@ -1950,10 +1185,10 @@ function FieldEditor({
1950
1185
  className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
1951
1186
  }
1952
1187
  ),
1953
- /* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1954
- ] }) : schemaField.type === "image" || schemaField.type === "file" || schemaField.type === "video" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3 mt-1", children: [
1955
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1956
- /* @__PURE__ */ jsx5(
1188
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1189
+ ] }) : schemaField.type === "image" || schemaField.type === "file" || schemaField.type === "video" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3 mt-1", children: [
1190
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1191
+ /* @__PURE__ */ jsx(
1957
1192
  "input",
1958
1193
  {
1959
1194
  type: "url",
@@ -1967,9 +1202,9 @@ function FieldEditor({
1967
1202
  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"
1968
1203
  }
1969
1204
  ),
1970
- /* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
1205
+ /* @__PURE__ */ jsxs("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: [
1971
1206
  "Upload",
1972
- /* @__PURE__ */ jsx5(
1207
+ /* @__PURE__ */ jsx(
1973
1208
  "input",
1974
1209
  {
1975
1210
  type: "file",
@@ -1993,14 +1228,14 @@ function FieldEditor({
1993
1228
  )
1994
1229
  ] })
1995
1230
  ] }),
1996
- item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: String(item?.[schemaField.key]).match(/\.(mp4|webm|ogg|mov)(\?.*)?$/i) || schemaField.type === "video" ? /* @__PURE__ */ jsx5(
1231
+ item?.[schemaField.key] ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: String(item?.[schemaField.key]).match(/\.(mp4|webm|ogg|mov)(\?.*)?$/i) || schemaField.type === "video" ? /* @__PURE__ */ jsx(
1997
1232
  "video",
1998
1233
  {
1999
1234
  src: String(item?.[schemaField.key]),
2000
1235
  controls: true,
2001
1236
  className: "w-full h-auto max-h-32 object-contain rounded-md"
2002
1237
  }
2003
- ) : /* @__PURE__ */ jsx5(
1238
+ ) : /* @__PURE__ */ jsx(
2004
1239
  "img",
2005
1240
  {
2006
1241
  src: String(item?.[schemaField.key]),
@@ -2008,7 +1243,7 @@ function FieldEditor({
2008
1243
  className: "w-full h-auto max-h-32 object-contain rounded-md"
2009
1244
  }
2010
1245
  ) }) : null
2011
- ] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
1246
+ ] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx(
2012
1247
  "select",
2013
1248
  {
2014
1249
  value: String(item?.[schemaField.key] ?? ""),
@@ -2018,9 +1253,9 @@ function FieldEditor({
2018
1253
  onChange(arr);
2019
1254
  },
2020
1255
  className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
2021
- children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
1256
+ children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
2022
1257
  }
2023
- ) : schemaField.type === "number" ? /* @__PURE__ */ jsx5(
1258
+ ) : schemaField.type === "number" ? /* @__PURE__ */ jsx(
2024
1259
  FormattedNumberInput,
2025
1260
  {
2026
1261
  value: item?.[schemaField.key],
@@ -2032,7 +1267,7 @@ function FieldEditor({
2032
1267
  isPrice: schemaField.key.toLowerCase().includes("price") || schemaField.key.toLowerCase().includes("precio"),
2033
1268
  className: "rounded-lg px-3 py-2 text-sm"
2034
1269
  }
2035
- ) : /* @__PURE__ */ jsx5(
1270
+ ) : /* @__PURE__ */ jsx(
2036
1271
  "input",
2037
1272
  {
2038
1273
  type: "text",
@@ -2045,7 +1280,7 @@ function FieldEditor({
2045
1280
  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"
2046
1281
  }
2047
1282
  )
2048
- ] }, schemaField.key)) : /* @__PURE__ */ jsx5(
1283
+ ] }, schemaField.key)) : /* @__PURE__ */ jsx(
2049
1284
  "input",
2050
1285
  {
2051
1286
  type: "text",
@@ -2059,7 +1294,7 @@ function FieldEditor({
2059
1294
  }
2060
1295
  ) })
2061
1296
  ] }),
2062
- !meta.fixedLength && /* @__PURE__ */ jsx5(
1297
+ !meta.fixedLength && /* @__PURE__ */ jsx(
2063
1298
  "button",
2064
1299
  {
2065
1300
  onClick: () => {
@@ -2068,7 +1303,7 @@ function FieldEditor({
2068
1303
  onChange(arr);
2069
1304
  },
2070
1305
  className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
2071
- children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1306
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2072
1307
  }
2073
1308
  )
2074
1309
  ]
@@ -2076,7 +1311,7 @@ function FieldEditor({
2076
1311
  idx
2077
1312
  );
2078
1313
  }),
2079
- !meta.fixedLength && /* @__PURE__ */ jsxs4(
1314
+ !meta.fixedLength && /* @__PURE__ */ jsxs(
2080
1315
  "button",
2081
1316
  {
2082
1317
  onClick: () => {
@@ -2105,27 +1340,27 @@ function FieldEditor({
2105
1340
  },
2106
1341
  className: "flex items-center justify-center w-full gap-1.5 text-sm font-medium text-indigo-600 hover:text-indigo-700 px-2 py-2.5 rounded-lg border border-dashed border-indigo-200 hover:bg-indigo-50 hover:border-indigo-300 transition-colors",
2107
1342
  children: [
2108
- /* @__PURE__ */ jsx5(Plus, { className: "w-4 h-4" }),
1343
+ /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
2109
1344
  " Add Item"
2110
1345
  ]
2111
1346
  }
2112
1347
  )
2113
1348
  ] }),
2114
- meta.type === "reference" && /* @__PURE__ */ jsx5(SidebarReferenceSelect, { meta, value, onChange })
1349
+ meta.type === "reference" && /* @__PURE__ */ jsx(SidebarReferenceSelect, { meta, value, onChange })
2115
1350
  ] }),
2116
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
2117
- /* @__PURE__ */ jsxs4(
1351
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1352
+ /* @__PURE__ */ jsxs(
2118
1353
  "button",
2119
1354
  {
2120
1355
  onClick: onReset,
2121
1356
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 hover:text-slate-900 transition-colors",
2122
1357
  children: [
2123
- /* @__PURE__ */ jsx5(RotateCcw, { className: "h-3.5 w-3.5" }),
1358
+ /* @__PURE__ */ jsx(RotateCcw, { className: "h-3.5 w-3.5" }),
2124
1359
  " Reset Default"
2125
1360
  ]
2126
1361
  }
2127
1362
  ),
2128
- /* @__PURE__ */ jsx5(
1363
+ /* @__PURE__ */ jsx(
2129
1364
  "button",
2130
1365
  {
2131
1366
  onClick: onClose,
@@ -2139,24 +1374,24 @@ function FieldEditor({
2139
1374
  function CollectionsSection() {
2140
1375
  const ctx = useCmsContext();
2141
1376
  const collections = ctx.config.collections ?? [];
2142
- const [selected, setSelected] = useState5(
1377
+ const [selected, setSelected] = useState(
2143
1378
  collections.find((c) => !c.isSeparator) ?? null
2144
1379
  );
2145
- const [counts, setCounts] = useState5({});
2146
- useEffect4(() => {
1380
+ const [counts, setCounts] = useState({});
1381
+ useEffect(() => {
2147
1382
  collections.filter((c) => !c.isSeparator).forEach((c) => {
2148
1383
  ctx.adapter.listEntries(c.id).then((entries) => {
2149
1384
  setCounts((prev) => ({ ...prev, [c.id]: entries.length }));
2150
1385
  });
2151
1386
  });
2152
1387
  }, [ctx.adapter, collections]);
2153
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2154
- /* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
2155
- /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
2156
- /* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
1388
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1389
+ /* @__PURE__ */ jsxs("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: [
1390
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
1391
+ /* @__PURE__ */ jsxs("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: [
2157
1392
  collections.map((c, idx) => {
2158
1393
  if (c.isSeparator) {
2159
- return /* @__PURE__ */ jsx5(
1394
+ return /* @__PURE__ */ jsx(
2160
1395
  "li",
2161
1396
  {
2162
1397
  className: "my-2 border-t border-slate-200/80"
@@ -2164,20 +1399,20 @@ function CollectionsSection() {
2164
1399
  c.id || `sep-${idx}`
2165
1400
  );
2166
1401
  }
2167
- return /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
1402
+ return /* @__PURE__ */ jsx("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs(
2168
1403
  "button",
2169
1404
  {
2170
1405
  onClick: () => setSelected(c),
2171
1406
  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"}`,
2172
1407
  children: [
2173
- /* @__PURE__ */ jsx5(
1408
+ /* @__PURE__ */ jsx(
2174
1409
  "div",
2175
1410
  {
2176
1411
  className: selected?.id === c.id ? "text-slate-900" : "text-slate-700",
2177
1412
  children: c.name
2178
1413
  }
2179
1414
  ),
2180
- /* @__PURE__ */ jsxs4(
1415
+ /* @__PURE__ */ jsxs(
2181
1416
  "div",
2182
1417
  {
2183
1418
  className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`,
@@ -2191,29 +1426,29 @@ function CollectionsSection() {
2191
1426
  }
2192
1427
  ) }, c.id);
2193
1428
  }),
2194
- 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." })
1429
+ collections.length === 0 && /* @__PURE__ */ jsx("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." })
2195
1430
  ] })
2196
1431
  ] }),
2197
- /* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2198
- /* @__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" }),
2199
- 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." })
1432
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1433
+ /* @__PURE__ */ jsx("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" }),
1434
+ selected ? /* @__PURE__ */ jsx(CollectionEditor, { collection: selected }, selected.id) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to manage its entries." })
2200
1435
  ] })
2201
1436
  ] });
2202
1437
  }
2203
1438
  function CollectionEditor({ collection }) {
2204
1439
  const ctx = useCmsContext();
2205
- const [entries, setEntries] = useState5([]);
2206
- const [editing, setEditing] = useState5(null);
2207
- const [saving, setSaving] = useState5(false);
2208
- const [deletingId, setDeletingId] = useState5(null);
2209
- const [loadingEntries, setLoadingEntries] = useState5(true);
2210
- const [draggedIdx, setDraggedIdx] = useState5(null);
2211
- const [dragOverIdx, setDragOverIdx] = useState5(null);
2212
- const [search, setSearch] = useState5("");
2213
- const [filters, setFilters] = useState5({});
2214
- const [page, setPage] = useState5(1);
1440
+ const [entries, setEntries] = useState([]);
1441
+ const [editing, setEditing] = useState(null);
1442
+ const [saving, setSaving] = useState(false);
1443
+ const [deletingId, setDeletingId] = useState(null);
1444
+ const [loadingEntries, setLoadingEntries] = useState(true);
1445
+ const [draggedIdx, setDraggedIdx] = useState(null);
1446
+ const [dragOverIdx, setDragOverIdx] = useState(null);
1447
+ const [search, setSearch] = useState("");
1448
+ const [filters, setFilters] = useState({});
1449
+ const [page, setPage] = useState(1);
2215
1450
  const itemsPerPage = 10;
2216
- const load = useCallback3(() => {
1451
+ const load = useCallback(() => {
2217
1452
  setLoadingEntries(true);
2218
1453
  ctx.adapter.listEntries(collection.id).then((res) => {
2219
1454
  const sorted = [...res].sort((a, b) => {
@@ -2225,7 +1460,7 @@ function CollectionEditor({ collection }) {
2225
1460
  setLoadingEntries(false);
2226
1461
  }).catch(() => setLoadingEntries(false));
2227
1462
  }, [ctx.adapter, collection.id]);
2228
- useEffect4(() => {
1463
+ useEffect(() => {
2229
1464
  load();
2230
1465
  }, [load]);
2231
1466
  const startNew = () => {
@@ -2327,28 +1562,28 @@ function CollectionEditor({ collection }) {
2327
1562
  };
2328
1563
  const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order" && !f.hidden).slice(0, 5);
2329
1564
  const isCreatingEntry = editing ? !entries.some((entry) => entry.id === editing.id) : false;
2330
- return /* @__PURE__ */ jsxs4("div", { className: "mx-auto max-w-5xl", children: [
2331
- /* @__PURE__ */ jsxs4("div", { className: "mb-8 flex items-center justify-between", children: [
2332
- /* @__PURE__ */ jsxs4("div", { children: [
2333
- /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
2334
- collection.description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
1565
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl", children: [
1566
+ /* @__PURE__ */ jsxs("div", { className: "mb-8 flex items-center justify-between", children: [
1567
+ /* @__PURE__ */ jsxs("div", { children: [
1568
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
1569
+ collection.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
2335
1570
  ] }),
2336
- /* @__PURE__ */ jsxs4(
1571
+ /* @__PURE__ */ jsxs(
2337
1572
  "button",
2338
1573
  {
2339
1574
  onClick: startNew,
2340
1575
  className: "inline-flex items-center gap-2 rounded-xl bg-indigo-600 px-4 py-2.5 text-sm font-bold text-white shadow-sm hover:bg-indigo-700 hover:shadow transition-all",
2341
1576
  children: [
2342
- /* @__PURE__ */ jsx5(Plus, { className: "h-4 w-4" }),
1577
+ /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
2343
1578
  " New Entry"
2344
1579
  ]
2345
1580
  }
2346
1581
  )
2347
1582
  ] }),
2348
- !editing && (collection.searchBy?.length || collection.filterBy?.length) && /* @__PURE__ */ jsxs4("div", { className: "mb-6 flex flex-wrap gap-4 items-center p-4 bg-white rounded-2xl border border-slate-200 shadow-sm animate-in fade-in slide-in-from-top-2", children: [
2349
- collection.searchBy?.length ? /* @__PURE__ */ jsxs4("div", { className: "relative flex-1 min-w-[200px]", children: [
2350
- /* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
2351
- /* @__PURE__ */ jsx5(
1583
+ !editing && (collection.searchBy?.length || collection.filterBy?.length) && /* @__PURE__ */ jsxs("div", { className: "mb-6 flex flex-wrap gap-4 items-center p-4 bg-white rounded-2xl border border-slate-200 shadow-sm animate-in fade-in slide-in-from-top-2", children: [
1584
+ collection.searchBy?.length ? /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-[200px]", children: [
1585
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
1586
+ /* @__PURE__ */ jsx(
2352
1587
  "input",
2353
1588
  {
2354
1589
  type: "text",
@@ -2366,8 +1601,8 @@ function CollectionEditor({ collection }) {
2366
1601
  const fieldDef = collection.fields.find((cf) => cf.id === f);
2367
1602
  const uniqueVals = Array.from(new Set(entries.map((e) => String(e[f] || "")))).filter(Boolean);
2368
1603
  if (!fieldDef || uniqueVals.length === 0) return null;
2369
- return /* @__PURE__ */ jsxs4("div", { className: "min-w-[150px] relative", children: [
2370
- /* @__PURE__ */ jsxs4(
1604
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-[150px] relative", children: [
1605
+ /* @__PURE__ */ jsxs(
2371
1606
  "select",
2372
1607
  {
2373
1608
  value: filters[f] || "",
@@ -2377,24 +1612,24 @@ function CollectionEditor({ collection }) {
2377
1612
  },
2378
1613
  className: "w-full rounded-xl border border-slate-200 bg-slate-50 py-2.5 px-4 pr-10 text-sm focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-500/10 outline-none transition-all appearance-none",
2379
1614
  children: [
2380
- /* @__PURE__ */ jsxs4("option", { value: "", children: [
1615
+ /* @__PURE__ */ jsxs("option", { value: "", children: [
2381
1616
  "All ",
2382
1617
  fieldDef.label
2383
1618
  ] }),
2384
- uniqueVals.map((v) => /* @__PURE__ */ jsx5("option", { value: v, children: v }, v))
1619
+ uniqueVals.map((v) => /* @__PURE__ */ jsx("option", { value: v, children: v }, v))
2385
1620
  ]
2386
1621
  }
2387
1622
  ),
2388
- /* @__PURE__ */ jsx5(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
1623
+ /* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
2389
1624
  ] }, f);
2390
1625
  })
2391
1626
  ] }),
2392
- /* @__PURE__ */ jsx5(
1627
+ /* @__PURE__ */ jsx(
2393
1628
  Modal,
2394
1629
  {
2395
1630
  open: Boolean(editing),
2396
- title: /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2 text-slate-900", children: [
2397
- isCreatingEntry ? /* @__PURE__ */ jsx5(Plus, { className: "h-4 w-4 text-indigo-600" }) : /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4 text-indigo-600" }),
1631
+ title: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-slate-900", children: [
1632
+ isCreatingEntry ? /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 text-indigo-600" }) : /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-indigo-600" }),
2398
1633
  isCreatingEntry ? "Create Entry" : "Edit Entry"
2399
1634
  ] }),
2400
1635
  onCancel: () => {
@@ -2419,13 +1654,13 @@ function CollectionEditor({ collection }) {
2419
1654
  backdropFilter: "blur(8px)"
2420
1655
  }
2421
1656
  },
2422
- children: editing && /* @__PURE__ */ jsxs4("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
2423
- /* @__PURE__ */ jsx5("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ jsx5("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).map((f) => /* @__PURE__ */ jsxs4("div", { className: `block ${f.type === "richtext" || f.type === "branch-settings" || f.type === "time-range" ? "lg:col-span-2" : ""}`, children: [
2424
- /* @__PURE__ */ jsxs4("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
1657
+ children: editing && /* @__PURE__ */ jsxs("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
1658
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).map((f) => /* @__PURE__ */ jsxs("div", { className: `block ${f.type === "richtext" || f.type === "branch-settings" || f.type === "time-range" ? "lg:col-span-2" : ""}`, children: [
1659
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
2425
1660
  f.label,
2426
- /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
1661
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
2427
1662
  ] }),
2428
- f.type === "branch-settings" ? /* @__PURE__ */ jsx5(
1663
+ f.type === "branch-settings" ? /* @__PURE__ */ jsx(
2429
1664
  BranchSettingsEditor,
2430
1665
  {
2431
1666
  collectionId: f.collection || "",
@@ -2434,7 +1669,7 @@ function CollectionEditor({ collection }) {
2434
1669
  globalDiscount: Number(editing.discountPercent) || 0,
2435
1670
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2436
1671
  }
2437
- ) : f.type === "boolean" ? /* @__PURE__ */ jsx5("div", { className: "mt-1 h-10 flex items-center", children: /* @__PURE__ */ jsx5(
1672
+ ) : f.type === "boolean" ? /* @__PURE__ */ jsx("div", { className: "mt-1 h-10 flex items-center", children: /* @__PURE__ */ jsx(
2438
1673
  "input",
2439
1674
  {
2440
1675
  type: "checkbox",
@@ -2442,7 +1677,7 @@ function CollectionEditor({ collection }) {
2442
1677
  onChange: (e) => setEditing({ ...editing, [f.id]: e.target.checked }),
2443
1678
  className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
2444
1679
  }
2445
- ) }) : f.type === "number" ? /* @__PURE__ */ jsx5(
1680
+ ) }) : f.type === "number" ? /* @__PURE__ */ jsx(
2446
1681
  FormattedNumberInput,
2447
1682
  {
2448
1683
  value: editing[f.id],
@@ -2450,8 +1685,8 @@ function CollectionEditor({ collection }) {
2450
1685
  isPrice: f.id.toLowerCase().includes("price") || f.id.toLowerCase().includes("precio") || f.label.toLowerCase().includes("precio") || f.label.toLowerCase().includes("valor") || f.label.includes("$"),
2451
1686
  isPercent: f.id.toLowerCase().includes("discount") || f.id.toLowerCase().includes("descuento") || f.label.toLowerCase().includes("descuento")
2452
1687
  }
2453
- ) : f.type === "time-range" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", children: [
2454
- /* @__PURE__ */ jsx5(
1688
+ ) : f.type === "time-range" ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
1689
+ /* @__PURE__ */ jsx(
2455
1690
  AdminTimeRangePicker,
2456
1691
  {
2457
1692
  value: [
@@ -2473,8 +1708,8 @@ function CollectionEditor({ collection }) {
2473
1708
  use12Hours: true
2474
1709
  }
2475
1710
  ),
2476
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500", children: "Selecciona inicio y cierre en un mismo control. Usa AM/PM; si el cierre es anterior al inicio, el horario cruza medianoche. Deja ambos vac\xEDos para mantenerlo siempre disponible." })
2477
- ] }) : f.type === "time" ? /* @__PURE__ */ jsx5(
1711
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Selecciona inicio y cierre en un mismo control. Usa AM/PM; si el cierre es anterior al inicio, el horario cruza medianoche. Deja ambos vac\xEDos para mantenerlo siempre disponible." })
1712
+ ] }) : f.type === "time" ? /* @__PURE__ */ jsx(
2478
1713
  AdminTimePicker,
2479
1714
  {
2480
1715
  value: toDayjsTime(editing[f.id]),
@@ -2483,7 +1718,7 @@ function CollectionEditor({ collection }) {
2483
1718
  format: TIME_DISPLAY_FORMAT,
2484
1719
  use12Hours: true
2485
1720
  }
2486
- ) : f.type === "richtext" ? /* @__PURE__ */ jsx5(
1721
+ ) : f.type === "richtext" ? /* @__PURE__ */ jsx(
2487
1722
  "textarea",
2488
1723
  {
2489
1724
  value: String(editing[f.id] ?? ""),
@@ -2491,7 +1726,7 @@ function CollectionEditor({ collection }) {
2491
1726
  rows: 4,
2492
1727
  className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all font-mono text-xs"
2493
1728
  }
2494
- ) : f.type === "icon" ? /* @__PURE__ */ jsx5(
1729
+ ) : f.type === "icon" ? /* @__PURE__ */ jsx(
2495
1730
  SearchableSelect,
2496
1731
  {
2497
1732
  value: String(editing[f.id] ?? ""),
@@ -2500,8 +1735,8 @@ function CollectionEditor({ collection }) {
2500
1735
  placeholder: `Search ${f.label.toLowerCase()}...`,
2501
1736
  iconMap: ctx.iconMap
2502
1737
  }
2503
- ) : f.type === "slug" ? /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2504
- /* @__PURE__ */ jsx5(
1738
+ ) : f.type === "slug" ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1739
+ /* @__PURE__ */ jsx(
2505
1740
  "input",
2506
1741
  {
2507
1742
  type: "text",
@@ -2510,7 +1745,7 @@ function CollectionEditor({ collection }) {
2510
1745
  className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all"
2511
1746
  }
2512
1747
  ),
2513
- /* @__PURE__ */ jsx5(
1748
+ /* @__PURE__ */ jsx(
2514
1749
  "button",
2515
1750
  {
2516
1751
  type: "button",
@@ -2524,7 +1759,7 @@ function CollectionEditor({ collection }) {
2524
1759
  children: "Generate"
2525
1760
  }
2526
1761
  )
2527
- ] }) : f.type === "reference" || f.type === "select" && f.collection ? /* @__PURE__ */ jsx5(
1762
+ ] }) : f.type === "reference" || f.type === "select" && f.collection ? /* @__PURE__ */ jsx(
2528
1763
  ReferenceSelect,
2529
1764
  {
2530
1765
  collectionId: f.collection,
@@ -2537,30 +1772,30 @@ function CollectionEditor({ collection }) {
2537
1772
  value: editing[f.id],
2538
1773
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2539
1774
  }
2540
- ) : f.type === "select" ? /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
2541
- /* @__PURE__ */ jsxs4(
1775
+ ) : f.type === "select" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1776
+ /* @__PURE__ */ jsxs(
2542
1777
  "select",
2543
1778
  {
2544
1779
  value: String(editing[f.id] ?? ""),
2545
1780
  onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
2546
1781
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all bg-white appearance-none pr-10 cursor-pointer text-slate-800",
2547
1782
  children: [
2548
- /* @__PURE__ */ jsx5("option", { value: "", children: "-- Selecciona una opci\xF3n --" }),
1783
+ /* @__PURE__ */ jsx("option", { value: "", children: "-- Selecciona una opci\xF3n --" }),
2549
1784
  f.options?.map((opt) => {
2550
1785
  const val = typeof opt === "string" ? opt : opt.value;
2551
1786
  const lab = typeof opt === "string" ? opt : opt.label;
2552
- return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
1787
+ return /* @__PURE__ */ jsx("option", { value: val, children: lab }, val);
2553
1788
  })
2554
1789
  ]
2555
1790
  }
2556
1791
  ),
2557
- /* @__PURE__ */ jsx5(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
2558
- ] }) : f.type === "image" || f.type === "file" ? f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
2559
- /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => {
1792
+ /* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
1793
+ ] }) : f.type === "image" || f.type === "file" ? f.multiple ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1794
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => {
2560
1795
  const isVideo = typeof url === "string" && (url.match(/\.(mp4|webm|mov|ogg)$/i) || url.includes("video"));
2561
- return /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group w-32 h-32", children: [
2562
- isVideo ? /* @__PURE__ */ jsx5("video", { src: url, className: "w-full h-full object-cover rounded-lg", autoPlay: true, muted: true, loop: true, playsInline: true }) : /* @__PURE__ */ jsx5("img", { src: url, alt: "", className: "w-full h-full object-cover rounded-lg" }),
2563
- /* @__PURE__ */ jsx5(
1796
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group w-32 h-32", children: [
1797
+ isVideo ? /* @__PURE__ */ jsx("video", { src: url, className: "w-full h-full object-cover rounded-lg", autoPlay: true, muted: true, loop: true, playsInline: true }) : /* @__PURE__ */ jsx("img", { src: url, alt: "", className: "w-full h-full object-cover rounded-lg" }),
1798
+ /* @__PURE__ */ jsx(
2564
1799
  "button",
2565
1800
  {
2566
1801
  type: "button",
@@ -2570,13 +1805,13 @@ function CollectionEditor({ collection }) {
2570
1805
  setEditing({ ...editing, [f.id]: arr });
2571
1806
  },
2572
1807
  className: "absolute top-2 right-2 bg-red-500/80 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",
2573
- children: /* @__PURE__ */ jsx5(X, { className: "w-3 h-3" })
1808
+ children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
2574
1809
  }
2575
1810
  )
2576
1811
  ] }, i);
2577
1812
  }) }),
2578
- (!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2579
- /* @__PURE__ */ jsx5(
1813
+ (!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1814
+ /* @__PURE__ */ jsx(
2580
1815
  "input",
2581
1816
  {
2582
1817
  type: "url",
@@ -2592,7 +1827,7 @@ function CollectionEditor({ collection }) {
2592
1827
  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"
2593
1828
  }
2594
1829
  ),
2595
- /* @__PURE__ */ jsx5(
1830
+ /* @__PURE__ */ jsx(
2596
1831
  FilePickerButton,
2597
1832
  {
2598
1833
  accept: "image/*,video/*",
@@ -2620,9 +1855,9 @@ function CollectionEditor({ collection }) {
2620
1855
  }
2621
1856
  )
2622
1857
  ] })
2623
- ] }) : /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
2624
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2625
- /* @__PURE__ */ jsx5(
1858
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1859
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1860
+ /* @__PURE__ */ jsx(
2626
1861
  "input",
2627
1862
  {
2628
1863
  type: "url",
@@ -2632,7 +1867,7 @@ function CollectionEditor({ collection }) {
2632
1867
  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"
2633
1868
  }
2634
1869
  ),
2635
- /* @__PURE__ */ jsx5(
1870
+ /* @__PURE__ */ jsx(
2636
1871
  FilePickerButton,
2637
1872
  {
2638
1873
  accept: "image/*,video/*",
@@ -2653,14 +1888,14 @@ function CollectionEditor({ collection }) {
2653
1888
  }
2654
1889
  )
2655
1890
  ] }),
2656
- editing[f.id] ? /* @__PURE__ */ jsx5("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: String(editing[f.id]).match(/\.(mp4|webm|mov|ogg)$/i) || String(editing[f.id]).includes("video") ? /* @__PURE__ */ jsx5(
1891
+ editing[f.id] ? /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: String(editing[f.id]).match(/\.(mp4|webm|mov|ogg)$/i) || String(editing[f.id]).includes("video") ? /* @__PURE__ */ jsx(
2657
1892
  "video",
2658
1893
  {
2659
1894
  src: String(editing[f.id]),
2660
1895
  controls: true,
2661
1896
  className: "w-full h-auto max-h-48 object-contain rounded-lg"
2662
1897
  }
2663
- ) : /* @__PURE__ */ jsx5(
1898
+ ) : /* @__PURE__ */ jsx(
2664
1899
  "img",
2665
1900
  {
2666
1901
  src: String(editing[f.id]),
@@ -2668,14 +1903,14 @@ function CollectionEditor({ collection }) {
2668
1903
  className: "w-full h-auto max-h-48 object-contain rounded-lg"
2669
1904
  }
2670
1905
  ) }) : null
2671
- ] }) : f.type === "password" ? /* @__PURE__ */ jsx5(
1906
+ ] }) : f.type === "password" ? /* @__PURE__ */ jsx(
2672
1907
  PasswordField,
2673
1908
  {
2674
1909
  value: String(editing[f.id] ?? ""),
2675
1910
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2676
1911
  }
2677
- ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
2678
- /* @__PURE__ */ jsx5(
1912
+ ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1913
+ /* @__PURE__ */ jsx(
2679
1914
  "input",
2680
1915
  {
2681
1916
  type: "color",
@@ -2684,7 +1919,7 @@ function CollectionEditor({ collection }) {
2684
1919
  className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
2685
1920
  }
2686
1921
  ),
2687
- /* @__PURE__ */ jsx5(
1922
+ /* @__PURE__ */ jsx(
2688
1923
  "input",
2689
1924
  {
2690
1925
  type: "text",
@@ -2694,19 +1929,19 @@ function CollectionEditor({ collection }) {
2694
1929
  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"
2695
1930
  }
2696
1931
  ),
2697
- /* @__PURE__ */ jsx5(
1932
+ /* @__PURE__ */ jsx(
2698
1933
  "div",
2699
1934
  {
2700
1935
  className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
2701
1936
  style: { backgroundColor: String(editing[f.id] ?? "#000000") }
2702
1937
  }
2703
1938
  )
2704
- ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1939
+ ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
2705
1940
  (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) => {
2706
1941
  const colorVal = String(item ?? "").trim();
2707
1942
  const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
2708
- return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
2709
- /* @__PURE__ */ jsx5(
1943
+ return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
1944
+ /* @__PURE__ */ jsx(
2710
1945
  "input",
2711
1946
  {
2712
1947
  type: "color",
@@ -2719,7 +1954,7 @@ function CollectionEditor({ collection }) {
2719
1954
  className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
2720
1955
  }
2721
1956
  ),
2722
- /* @__PURE__ */ jsx5(
1957
+ /* @__PURE__ */ jsx(
2723
1958
  "input",
2724
1959
  {
2725
1960
  type: "text",
@@ -2733,14 +1968,14 @@ function CollectionEditor({ collection }) {
2733
1968
  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"
2734
1969
  }
2735
1970
  ),
2736
- /* @__PURE__ */ jsx5(
1971
+ /* @__PURE__ */ jsx(
2737
1972
  "div",
2738
1973
  {
2739
1974
  className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
2740
1975
  style: { backgroundColor: colorVal || "#000000" }
2741
1976
  }
2742
1977
  ),
2743
- /* @__PURE__ */ jsx5(
1978
+ /* @__PURE__ */ jsx(
2744
1979
  "button",
2745
1980
  {
2746
1981
  type: "button",
@@ -2750,12 +1985,12 @@ function CollectionEditor({ collection }) {
2750
1985
  setEditing({ ...editing, [f.id]: arr });
2751
1986
  },
2752
1987
  className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
2753
- children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
1988
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2754
1989
  }
2755
1990
  )
2756
1991
  ] }, idx);
2757
1992
  }),
2758
- /* @__PURE__ */ jsxs4(
1993
+ /* @__PURE__ */ jsxs(
2759
1994
  "button",
2760
1995
  {
2761
1996
  type: "button",
@@ -2766,14 +2001,14 @@ function CollectionEditor({ collection }) {
2766
2001
  },
2767
2002
  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",
2768
2003
  children: [
2769
- /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
2004
+ /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
2770
2005
  " Add Color"
2771
2006
  ]
2772
2007
  }
2773
2008
  )
2774
- ] }) : f.type === "list" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
2775
- (Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
2776
- /* @__PURE__ */ jsx5(
2009
+ ] }) : f.type === "list" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
2010
+ (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__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
2011
+ /* @__PURE__ */ jsx(
2777
2012
  "input",
2778
2013
  {
2779
2014
  type: "text",
@@ -2786,7 +2021,7 @@ function CollectionEditor({ collection }) {
2786
2021
  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"
2787
2022
  }
2788
2023
  ),
2789
- /* @__PURE__ */ jsx5(
2024
+ /* @__PURE__ */ jsx(
2790
2025
  "button",
2791
2026
  {
2792
2027
  type: "button",
@@ -2796,11 +2031,11 @@ function CollectionEditor({ collection }) {
2796
2031
  setEditing({ ...editing, [f.id]: arr });
2797
2032
  },
2798
2033
  className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
2799
- children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
2034
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2800
2035
  }
2801
2036
  )
2802
2037
  ] }, idx)),
2803
- /* @__PURE__ */ jsxs4(
2038
+ /* @__PURE__ */ jsxs(
2804
2039
  "button",
2805
2040
  {
2806
2041
  type: "button",
@@ -2811,12 +2046,12 @@ function CollectionEditor({ collection }) {
2811
2046
  },
2812
2047
  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",
2813
2048
  children: [
2814
- /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
2049
+ /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
2815
2050
  " Add Item"
2816
2051
  ]
2817
2052
  }
2818
2053
  )
2819
- ] }) : /* @__PURE__ */ jsx5(
2054
+ ] }) : /* @__PURE__ */ jsx(
2820
2055
  "input",
2821
2056
  {
2822
2057
  value: String(editing[f.id] ?? ""),
@@ -2825,8 +2060,8 @@ function CollectionEditor({ collection }) {
2825
2060
  }
2826
2061
  )
2827
2062
  ] }, f.id)) }) }),
2828
- /* @__PURE__ */ jsxs4("div", { className: "flex shrink-0 justify-end gap-3 border-t border-slate-200 bg-white px-6 py-4", children: [
2829
- /* @__PURE__ */ jsx5(
2063
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 justify-end gap-3 border-t border-slate-200 bg-white px-6 py-4", children: [
2064
+ /* @__PURE__ */ jsx(
2830
2065
  "button",
2831
2066
  {
2832
2067
  onClick: () => setEditing(null),
@@ -2835,16 +2070,16 @@ function CollectionEditor({ collection }) {
2835
2070
  children: "Cancel"
2836
2071
  }
2837
2072
  ),
2838
- /* @__PURE__ */ jsx5(
2073
+ /* @__PURE__ */ jsx(
2839
2074
  "button",
2840
2075
  {
2841
2076
  onClick: save,
2842
2077
  disabled: saving,
2843
2078
  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",
2844
- children: saving ? /* @__PURE__ */ jsxs4(Fragment4, { children: [
2845
- /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2846
- /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2847
- /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2079
+ children: saving ? /* @__PURE__ */ jsxs(Fragment, { children: [
2080
+ /* @__PURE__ */ jsxs("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: [
2081
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2082
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2848
2083
  ] }),
2849
2084
  "Saving..."
2850
2085
  ] }) : "Save Entry"
@@ -2854,18 +2089,18 @@ function CollectionEditor({ collection }) {
2854
2089
  ] })
2855
2090
  }
2856
2091
  ),
2857
- /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
2858
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs4("tr", { children: [
2859
- 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)),
2860
- /* @__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" })
2092
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm text-left", children: [
2093
+ /* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs("tr", { children: [
2094
+ visibleFields.map((f) => /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: f.label }, f.id)),
2095
+ /* @__PURE__ */ jsx("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" })
2861
2096
  ] }) }),
2862
- /* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
2097
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
2863
2098
  // Loading skeleton rows
2864
- Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs4("tr", { children: [
2865
- 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)),
2866
- /* @__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" }) })
2099
+ Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs("tr", { children: [
2100
+ visibleFields.map((f) => /* @__PURE__ */ jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx("div", { className: "h-4 bg-slate-100 rounded animate-pulse", style: { width: `${60 + i * 13 % 30}%` } }) }, f.id)),
2101
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 sticky right-0 bg-white border-l border-slate-100", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-16 bg-slate-100 rounded animate-pulse ml-auto" }) })
2867
2102
  ] }, i))
2868
- ) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
2103
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
2869
2104
  (() => {
2870
2105
  let res = entries;
2871
2106
  if (search && collection.searchBy?.length) {
@@ -2881,7 +2116,7 @@ function CollectionEditor({ collection }) {
2881
2116
  });
2882
2117
  }
2883
2118
  const paginatedRes = res.slice((page - 1) * itemsPerPage, page * itemsPerPage);
2884
- return /* @__PURE__ */ jsx5(Fragment4, { children: paginatedRes.map((e, idx) => /* @__PURE__ */ jsxs4(
2119
+ return /* @__PURE__ */ jsx(Fragment, { children: paginatedRes.map((e, idx) => /* @__PURE__ */ jsxs(
2885
2120
  "tr",
2886
2121
  {
2887
2122
  draggable: true,
@@ -2891,32 +2126,32 @@ function CollectionEditor({ collection }) {
2891
2126
  onDragEnd,
2892
2127
  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" : ""}`,
2893
2128
  children: [
2894
- visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "branch-settings" ? /* @__PURE__ */ jsx5(BranchSettingsSummary, { value: e[f.id] }) : 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" && (Array.isArray(e[f.id]) ? e[f.id].length > 0 : !!e[f.id]) ? /* @__PURE__ */ jsx5("img", { src: Array.isArray(e[f.id]) ? String(e[f.id][0]) : 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" }) }) }) : (f.type === "reference" || f.type === "select" && f.collection) && e[f.id] ? /* @__PURE__ */ jsx5(ReferenceTableCell, { collectionId: f.collection, entryId: e[f.id], displayField: f.displayField, valueField: f.valueField, multiple: f.multiple }) : f.id === "status" && e[f.id] ? /* @__PURE__ */ jsx5("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold ${String(e[f.id]).includes("Entregado") ? "bg-emerald-100 text-emerald-800 border border-emerald-300" : String(e[f.id]).includes("Preparaci\xF3n") ? "bg-amber-100 text-amber-800 border border-amber-300" : String(e[f.id]).includes("Camino") ? "bg-blue-100 text-blue-800 border border-blue-300" : String(e[f.id]).includes("Confirmado") ? "bg-indigo-100 text-indigo-800 border border-indigo-300" : String(e[f.id]).includes("Cancelado") ? "bg-rose-100 text-rose-800 border border-rose-300" : "bg-amber-50 text-amber-800 border border-amber-200"}`, children: String(e[f.id]) }) : f.type === "number" && e[f.id] !== void 0 && e[f.id] !== null && String(e[f.id]) !== "" ? f.id.toLowerCase().includes("price") || f.id.toLowerCase().includes("precio") || f.label.toLowerCase().includes("precio") || f.label.includes("$") || f.id.toLowerCase().includes("amount") || f.id.toLowerCase().includes("total") ? /* @__PURE__ */ jsxs4("span", { className: "font-semibold text-slate-800", children: [
2129
+ visibleFields.map((f) => /* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "branch-settings" ? /* @__PURE__ */ jsx(BranchSettingsSummary, { value: e[f.id] }) : f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && (Array.isArray(e[f.id]) ? e[f.id].length > 0 : !!e[f.id]) ? /* @__PURE__ */ jsx("img", { src: Array.isArray(e[f.id]) ? String(e[f.id][0]) : String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx("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__ */ jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("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" }) }) }) : (f.type === "reference" || f.type === "select" && f.collection) && e[f.id] ? /* @__PURE__ */ jsx(ReferenceTableCell, { collectionId: f.collection, entryId: e[f.id], displayField: f.displayField, valueField: f.valueField, multiple: f.multiple }) : f.id === "status" && e[f.id] ? /* @__PURE__ */ jsx("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold ${String(e[f.id]).includes("Entregado") ? "bg-emerald-100 text-emerald-800 border border-emerald-300" : String(e[f.id]).includes("Preparaci\xF3n") ? "bg-amber-100 text-amber-800 border border-amber-300" : String(e[f.id]).includes("Camino") ? "bg-blue-100 text-blue-800 border border-blue-300" : String(e[f.id]).includes("Confirmado") ? "bg-indigo-100 text-indigo-800 border border-indigo-300" : String(e[f.id]).includes("Cancelado") ? "bg-rose-100 text-rose-800 border border-rose-300" : "bg-amber-50 text-amber-800 border border-amber-200"}`, children: String(e[f.id]) }) : f.type === "number" && e[f.id] !== void 0 && e[f.id] !== null && String(e[f.id]) !== "" ? f.id.toLowerCase().includes("price") || f.id.toLowerCase().includes("precio") || f.label.toLowerCase().includes("precio") || f.label.includes("$") || f.id.toLowerCase().includes("amount") || f.id.toLowerCase().includes("total") ? /* @__PURE__ */ jsxs("span", { className: "font-semibold text-slate-800", children: [
2895
2130
  "$ ",
2896
2131
  Number(e[f.id]).toLocaleString("es-CO")
2897
- ] }) : /* @__PURE__ */ jsx5("span", { children: Number(e[f.id]).toLocaleString("es-CO") }) : String(e[f.id] ?? "") }, f.id)),
2898
- /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-2", children: [
2899
- /* @__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" }) }) }),
2900
- /* @__PURE__ */ jsx5(
2132
+ ] }) : /* @__PURE__ */ jsx("span", { children: Number(e[f.id]).toLocaleString("es-CO") }) : String(e[f.id] ?? "") }, f.id)),
2133
+ /* @__PURE__ */ jsx("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__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
2134
+ /* @__PURE__ */ jsx("div", { className: "p-2 text-slate-300 cursor-grab active:cursor-grabbing", title: "Drag to reorder", children: /* @__PURE__ */ jsx("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__ */ jsx("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" }) }) }),
2135
+ /* @__PURE__ */ jsx(
2901
2136
  "button",
2902
2137
  {
2903
2138
  onClick: () => setEditing(e),
2904
2139
  className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
2905
2140
  title: "Edit",
2906
- children: /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4" })
2141
+ children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" })
2907
2142
  }
2908
2143
  ),
2909
- /* @__PURE__ */ jsx5(
2144
+ /* @__PURE__ */ jsx(
2910
2145
  "button",
2911
2146
  {
2912
2147
  onClick: () => remove(e.id),
2913
2148
  disabled: deletingId === e.id,
2914
2149
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
2915
2150
  title: "Delete",
2916
- children: deletingId === e.id ? /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2917
- /* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2918
- /* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2919
- ] }) : /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
2151
+ children: deletingId === e.id ? /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2152
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2153
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2154
+ ] }) : /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
2920
2155
  }
2921
2156
  )
2922
2157
  ] }) })
@@ -2925,21 +2160,21 @@ function CollectionEditor({ collection }) {
2925
2160
  e.id
2926
2161
  )) });
2927
2162
  })(),
2928
- entries.length === 0 && !search && Object.values(filters).every((v) => !v) && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
2163
+ entries.length === 0 && !search && Object.values(filters).every((v) => !v) && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
2929
2164
  "td",
2930
2165
  {
2931
2166
  colSpan: visibleFields.length + 1,
2932
2167
  className: "px-6 py-12 text-center text-slate-500",
2933
- children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center", children: [
2934
- /* @__PURE__ */ jsx5(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
2935
- /* @__PURE__ */ jsx5("p", { children: 'No entries yet. Click "New Entry" to create one.' })
2168
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
2169
+ /* @__PURE__ */ jsx(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
2170
+ /* @__PURE__ */ jsx("p", { children: 'No entries yet. Click "New Entry" to create one.' })
2936
2171
  ] })
2937
2172
  }
2938
2173
  ) })
2939
2174
  ] }) })
2940
2175
  ] }) }),
2941
- !loadingEntries && entries.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500 mt-4 px-2", children: [
2942
- /* @__PURE__ */ jsx5("span", { children: (() => {
2176
+ !loadingEntries && entries.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-slate-500 mt-4 px-2", children: [
2177
+ /* @__PURE__ */ jsx("span", { children: (() => {
2943
2178
  let res = entries;
2944
2179
  if (search && collection.searchBy?.length) {
2945
2180
  const q = search.toLowerCase();
@@ -2971,29 +2206,29 @@ function CollectionEditor({ collection }) {
2971
2206
  }
2972
2207
  const totalPages = Math.max(1, Math.ceil(res.length / itemsPerPage));
2973
2208
  if (totalPages <= 1) return null;
2974
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2975
- /* @__PURE__ */ jsx5(
2209
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2210
+ /* @__PURE__ */ jsx(
2976
2211
  "button",
2977
2212
  {
2978
2213
  onClick: () => setPage((p) => Math.max(1, p - 1)),
2979
2214
  disabled: page === 1,
2980
2215
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
2981
- children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
2216
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
2982
2217
  }
2983
2218
  ),
2984
- /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
2219
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-700", children: [
2985
2220
  "Page ",
2986
2221
  page,
2987
2222
  " of ",
2988
2223
  totalPages
2989
2224
  ] }),
2990
- /* @__PURE__ */ jsx5(
2225
+ /* @__PURE__ */ jsx(
2991
2226
  "button",
2992
2227
  {
2993
2228
  onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
2994
2229
  disabled: page === totalPages,
2995
2230
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
2996
- children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
2231
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
2997
2232
  }
2998
2233
  )
2999
2234
  ] });
@@ -3004,48 +2239,48 @@ function CollectionEditor({ collection }) {
3004
2239
  var PAGE_SIZE = 10;
3005
2240
  function SubmissionsSection() {
3006
2241
  const ctx = useCmsContext();
3007
- const [submissions, setSubmissions] = useState5([]);
3008
- const [loading, setLoading] = useState5(false);
3009
- const [selectedFormId, setSelectedFormId] = useState5(null);
3010
- const load = useCallback3(async () => {
2242
+ const [submissions, setSubmissions] = useState([]);
2243
+ const [loading, setLoading] = useState(false);
2244
+ const [selectedFormId, setSelectedFormId] = useState(null);
2245
+ const load = useCallback(async () => {
3011
2246
  setLoading(true);
3012
2247
  const all = await ctx.adapter.listSubmissions();
3013
2248
  setSubmissions(all);
3014
2249
  setLoading(false);
3015
2250
  }, [ctx.adapter]);
3016
- useEffect4(() => {
2251
+ useEffect(() => {
3017
2252
  load();
3018
2253
  }, [load]);
3019
2254
  const formIds = Array.from(new Set(submissions.map((s) => s.formId)));
3020
- useEffect4(() => {
2255
+ useEffect(() => {
3021
2256
  if (!selectedFormId && formIds.length > 0) {
3022
2257
  setSelectedFormId(formIds[0]);
3023
2258
  }
3024
2259
  }, [formIds, selectedFormId]);
3025
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
3026
- /* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
3027
- /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
3028
- /* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
3029
- formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
2260
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2261
+ /* @__PURE__ */ jsxs("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: [
2262
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
2263
+ /* @__PURE__ */ jsxs("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: [
2264
+ formIds.map((id) => /* @__PURE__ */ jsx("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs(
3030
2265
  "button",
3031
2266
  {
3032
2267
  onClick: () => setSelectedFormId(id),
3033
2268
  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"}`,
3034
2269
  children: [
3035
- /* @__PURE__ */ jsx5("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
3036
- /* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
2270
+ /* @__PURE__ */ jsx("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
2271
+ /* @__PURE__ */ jsxs("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
3037
2272
  submissions.filter((s) => s.formId === id).length,
3038
2273
  " items"
3039
2274
  ] })
3040
2275
  ]
3041
2276
  }
3042
2277
  ) }, id)),
3043
- 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." })
2278
+ formIds.length === 0 && /* @__PURE__ */ jsx("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." })
3044
2279
  ] })
3045
2280
  ] }),
3046
- /* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
3047
- /* @__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" }),
3048
- selectedFormId ? /* @__PURE__ */ jsx5(
2281
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2282
+ /* @__PURE__ */ jsx("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" }),
2283
+ selectedFormId ? /* @__PURE__ */ jsx(
3049
2284
  SubmissionsList,
3050
2285
  {
3051
2286
  formId: selectedFormId,
@@ -3054,15 +2289,15 @@ function SubmissionsSection() {
3054
2289
  loading
3055
2290
  },
3056
2291
  selectedFormId
3057
- ) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to view entries." })
2292
+ ) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to view entries." })
3058
2293
  ] })
3059
2294
  ] });
3060
2295
  }
3061
2296
  function SubmissionsList({ formId, submissions, onLoad, loading }) {
3062
2297
  const ctx = useCmsContext();
3063
- const [search, setSearch] = useState5("");
3064
- const [page, setPage] = useState5(1);
3065
- const [detail, setDetail] = useState5(null);
2298
+ const [search, setSearch] = useState("");
2299
+ const [page, setPage] = useState(1);
2300
+ const [detail, setDetail] = useState(null);
3066
2301
  const filtered = submissions.filter((s) => {
3067
2302
  const q = search.toLowerCase();
3068
2303
  if (!q) return true;
@@ -3092,49 +2327,49 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3092
2327
  }
3093
2328
  };
3094
2329
  if (detail) {
3095
- return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
3096
- /* @__PURE__ */ jsxs4(
2330
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl", children: [
2331
+ /* @__PURE__ */ jsxs(
3097
2332
  "button",
3098
2333
  {
3099
2334
  onClick: () => setDetail(null),
3100
2335
  className: "mb-6 inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-900 transition-colors",
3101
2336
  children: [
3102
- /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" }),
2337
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
3103
2338
  " Back to list"
3104
2339
  ]
3105
2340
  }
3106
2341
  ),
3107
- /* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
3108
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
3109
- /* @__PURE__ */ jsxs4("div", { children: [
3110
- /* @__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 }),
3111
- /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
2342
+ /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2343
+ /* @__PURE__ */ jsx("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2344
+ /* @__PURE__ */ jsxs("div", { children: [
2345
+ /* @__PURE__ */ jsx("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 }),
2346
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
3112
2347
  ] }),
3113
- /* @__PURE__ */ jsx5(
2348
+ /* @__PURE__ */ jsx(
3114
2349
  "button",
3115
2350
  {
3116
2351
  onClick: () => deleteOne(detail.id),
3117
2352
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors",
3118
2353
  title: "Delete",
3119
- children: /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
2354
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
3120
2355
  }
3121
2356
  )
3122
2357
  ] }) }),
3123
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
2358
+ /* @__PURE__ */ jsx("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
3124
2359
  const strVal = String(val ?? "\u2014");
3125
2360
  const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
3126
2361
  const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
3127
- return /* @__PURE__ */ jsxs4("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
3128
- /* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
3129
- /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
3130
- /* @__PURE__ */ jsx5(
2362
+ return /* @__PURE__ */ jsxs("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2363
+ /* @__PURE__ */ jsx("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2364
+ /* @__PURE__ */ jsx("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
2365
+ /* @__PURE__ */ jsx(
3131
2366
  "a",
3132
2367
  {
3133
2368
  href: strVal,
3134
2369
  target: "_blank",
3135
2370
  rel: "noopener noreferrer",
3136
2371
  className: "inline-block max-w-sm rounded-lg overflow-hidden border border-slate-200 shadow-sm hover:shadow transition-shadow bg-slate-50 p-1",
3137
- children: /* @__PURE__ */ jsx5(
2372
+ children: /* @__PURE__ */ jsx(
3138
2373
  "img",
3139
2374
  {
3140
2375
  src: strVal,
@@ -3144,7 +2379,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3144
2379
  )
3145
2380
  }
3146
2381
  ),
3147
- /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs4(
2382
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
3148
2383
  "a",
3149
2384
  {
3150
2385
  href: strVal,
@@ -3152,12 +2387,12 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3152
2387
  rel: "noopener noreferrer",
3153
2388
  className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
3154
2389
  children: [
3155
- /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5" }),
2390
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5" }),
3156
2391
  " View / Download file"
3157
2392
  ]
3158
2393
  }
3159
2394
  ) })
3160
- ] }) : isUrl ? /* @__PURE__ */ jsxs4(
2395
+ ] }) : isUrl ? /* @__PURE__ */ jsxs(
3161
2396
  "a",
3162
2397
  {
3163
2398
  href: strVal,
@@ -3165,42 +2400,42 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3165
2400
  rel: "noopener noreferrer",
3166
2401
  className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
3167
2402
  children: [
3168
- /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5 flex-shrink-0" }),
2403
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5 flex-shrink-0" }),
3169
2404
  " ",
3170
2405
  strVal
3171
2406
  ]
3172
2407
  }
3173
- ) : /* @__PURE__ */ jsx5("p", { className: "whitespace-pre-wrap", children: strVal }) })
2408
+ ) : /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", children: strVal }) })
3174
2409
  ] }, key);
3175
2410
  }) })
3176
2411
  ] })
3177
2412
  ] });
3178
2413
  }
3179
- return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
3180
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
3181
- /* @__PURE__ */ jsxs4("div", { children: [
3182
- /* @__PURE__ */ jsxs4("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
2414
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
2415
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2416
+ /* @__PURE__ */ jsxs("div", { children: [
2417
+ /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
3183
2418
  formId,
3184
- 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 })
2419
+ unreadCount > 0 && /* @__PURE__ */ jsx("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 })
3185
2420
  ] }),
3186
- /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
2421
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
3187
2422
  ] }),
3188
- /* @__PURE__ */ jsxs4(
2423
+ /* @__PURE__ */ jsxs(
3189
2424
  "button",
3190
2425
  {
3191
2426
  onClick: onLoad,
3192
2427
  disabled: loading,
3193
2428
  className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-semibold text-slate-700 shadow-sm hover:bg-slate-50 transition-colors disabled:opacity-50",
3194
2429
  children: [
3195
- /* @__PURE__ */ jsx5(RefreshCw, { className: `h-4 w-4 ${loading ? "animate-spin" : ""}` }),
2430
+ /* @__PURE__ */ jsx(RefreshCw, { className: `h-4 w-4 ${loading ? "animate-spin" : ""}` }),
3196
2431
  " Refresh"
3197
2432
  ]
3198
2433
  }
3199
2434
  )
3200
2435
  ] }),
3201
- /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
3202
- /* @__PURE__ */ jsx5(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
3203
- /* @__PURE__ */ jsx5(
2436
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2437
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
2438
+ /* @__PURE__ */ jsx(
3204
2439
  "input",
3205
2440
  {
3206
2441
  value: search,
@@ -3213,44 +2448,44 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3213
2448
  }
3214
2449
  )
3215
2450
  ] }),
3216
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
3217
- /* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs4("tr", { children: [
3218
- /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
3219
- /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
3220
- /* @__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" })
2451
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm text-left", children: [
2452
+ /* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs("tr", { children: [
2453
+ /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
2454
+ /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
2455
+ /* @__PURE__ */ jsx("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" })
3221
2456
  ] }) }),
3222
- /* @__PURE__ */ jsxs4("tbody", { className: "divide-y divide-slate-100", children: [
2457
+ /* @__PURE__ */ jsxs("tbody", { className: "divide-y divide-slate-100", children: [
3223
2458
  paginated.map((s) => {
3224
2459
  const firstVal = Object.values(s.data)[0];
3225
2460
  const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
3226
- return /* @__PURE__ */ jsxs4(
2461
+ return /* @__PURE__ */ jsxs(
3227
2462
  "tr",
3228
2463
  {
3229
2464
  className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
3230
2465
  onClick: () => openDetail(s),
3231
2466
  children: [
3232
- /* @__PURE__ */ jsxs4("td", { className: "px-6 py-4", children: [
3233
- /* @__PURE__ */ jsx5("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
3234
- !s.read && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
2467
+ /* @__PURE__ */ jsxs("td", { className: "px-6 py-4", children: [
2468
+ /* @__PURE__ */ jsx("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
2469
+ !s.read && /* @__PURE__ */ jsx("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
3235
2470
  ] }),
3236
- /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
3237
- /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-1", children: [
3238
- /* @__PURE__ */ jsx5(
2471
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
2472
+ /* @__PURE__ */ jsx("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__ */ jsxs("div", { className: "flex items-center justify-end gap-1", children: [
2473
+ /* @__PURE__ */ jsx(
3239
2474
  "button",
3240
2475
  {
3241
2476
  onClick: () => openDetail(s),
3242
2477
  className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
3243
2478
  title: "View detail",
3244
- children: /* @__PURE__ */ jsx5(Eye, { className: "h-4 w-4" })
2479
+ children: /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" })
3245
2480
  }
3246
2481
  ),
3247
- /* @__PURE__ */ jsx5(
2482
+ /* @__PURE__ */ jsx(
3248
2483
  "button",
3249
2484
  {
3250
2485
  onClick: () => deleteOne(s.id),
3251
2486
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors",
3252
2487
  title: "Delete",
3253
- children: /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
2488
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
3254
2489
  }
3255
2490
  )
3256
2491
  ] }) })
@@ -3259,41 +2494,41 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3259
2494
  s.id
3260
2495
  );
3261
2496
  }),
3262
- paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
3263
- /* @__PURE__ */ jsx5(Inbox, { className: "h-12 w-12 text-slate-200" }),
3264
- /* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
2497
+ paginated.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
2498
+ /* @__PURE__ */ jsx(Inbox, { className: "h-12 w-12 text-slate-200" }),
2499
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
3265
2500
  ] }) }) })
3266
2501
  ] })
3267
2502
  ] }) }),
3268
- totalPages > 1 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
3269
- /* @__PURE__ */ jsxs4("span", { children: [
2503
+ totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
2504
+ /* @__PURE__ */ jsxs("span", { children: [
3270
2505
  filtered.length,
3271
2506
  " item",
3272
2507
  filtered.length !== 1 ? "s" : ""
3273
2508
  ] }),
3274
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
3275
- /* @__PURE__ */ jsx5(
2509
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2510
+ /* @__PURE__ */ jsx(
3276
2511
  "button",
3277
2512
  {
3278
2513
  onClick: () => setPage((p) => Math.max(1, p - 1)),
3279
2514
  disabled: page === 1,
3280
2515
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
3281
- children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
2516
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
3282
2517
  }
3283
2518
  ),
3284
- /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
2519
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-700", children: [
3285
2520
  "Page ",
3286
2521
  page,
3287
2522
  " of ",
3288
2523
  totalPages
3289
2524
  ] }),
3290
- /* @__PURE__ */ jsx5(
2525
+ /* @__PURE__ */ jsx(
3291
2526
  "button",
3292
2527
  {
3293
2528
  onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
3294
2529
  disabled: page === totalPages,
3295
2530
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
3296
- children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
2531
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
3297
2532
  }
3298
2533
  )
3299
2534
  ] })
@@ -3302,31 +2537,31 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3302
2537
  }
3303
2538
  function SettingsSection() {
3304
2539
  const ctx = useCmsContext();
3305
- return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
3306
- /* @__PURE__ */ jsxs4("div", { children: [
3307
- /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
3308
- /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
2540
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
2541
+ /* @__PURE__ */ jsxs("div", { children: [
2542
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
2543
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
3309
2544
  ] }),
3310
- /* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
3311
- /* @__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" }) }),
3312
- /* @__PURE__ */ jsxs4("dl", { className: "divide-y divide-slate-100 text-sm", children: [
3313
- /* @__PURE__ */ jsx5(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
3314
- /* @__PURE__ */ jsx5(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
3315
- /* @__PURE__ */ jsx5(
2545
+ /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2546
+ /* @__PURE__ */ jsx("div", { className: "px-6 py-4 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsx("h3", { className: "font-bold text-slate-800", children: "Configuration Snapshot" }) }),
2547
+ /* @__PURE__ */ jsxs("dl", { className: "divide-y divide-slate-100 text-sm", children: [
2548
+ /* @__PURE__ */ jsx(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
2549
+ /* @__PURE__ */ jsx(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
2550
+ /* @__PURE__ */ jsx(
3316
2551
  Row,
3317
2552
  {
3318
2553
  label: "Defined Collections",
3319
2554
  value: String(ctx.config.collections?.length ?? 0)
3320
2555
  }
3321
2556
  ),
3322
- /* @__PURE__ */ jsx5(
2557
+ /* @__PURE__ */ jsx(
3323
2558
  Row,
3324
2559
  {
3325
2560
  label: "Editable Fields (Current Page)",
3326
2561
  value: String(ctx.getRegistered().length)
3327
2562
  }
3328
2563
  ),
3329
- /* @__PURE__ */ jsx5(
2564
+ /* @__PURE__ */ jsx(
3330
2565
  Row,
3331
2566
  {
3332
2567
  label: "Unsaved Changes",
@@ -3341,67 +2576,67 @@ function SettingsSection() {
3341
2576
  function ConfigSection() {
3342
2577
  const ctx = useCmsContext();
3343
2578
  const globals = ctx.config.globals ?? [];
3344
- const [selectedGroupId, setSelectedGroupId] = useState5(
2579
+ const [selectedGroupId, setSelectedGroupId] = useState(
3345
2580
  globals[0]?.id ?? null
3346
2581
  );
3347
2582
  const selectedGroup = globals.find((g) => g.id === selectedGroupId) ?? null;
3348
- const updateOverride = useCallback3(
2583
+ const updateOverride = useCallback(
3349
2584
  (id, value) => {
3350
2585
  ctx.setOverride(id, value);
3351
2586
  },
3352
2587
  [ctx]
3353
2588
  );
3354
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
3355
- /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
3356
- /* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
3357
- /* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
3358
- globals.map((g) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
2589
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [
2590
+ /* @__PURE__ */ jsxs("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: [
2591
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
2592
+ /* @__PURE__ */ jsxs("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2593
+ globals.map((g) => /* @__PURE__ */ jsx("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx(
3359
2594
  "button",
3360
2595
  {
3361
2596
  onClick: () => setSelectedGroupId(g.id),
3362
2597
  className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selectedGroupId === g.id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
3363
- children: /* @__PURE__ */ jsx5("div", { className: `truncate ${selectedGroupId === g.id ? "text-slate-900" : "text-slate-700"}`, children: g.label })
2598
+ children: /* @__PURE__ */ jsx("div", { className: `truncate ${selectedGroupId === g.id ? "text-slate-900" : "text-slate-700"}`, children: g.label })
3364
2599
  }
3365
2600
  ) }, g.id)),
3366
- 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." })
2601
+ globals.length === 0 && /* @__PURE__ */ jsx("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." })
3367
2602
  ] })
3368
2603
  ] }),
3369
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
3370
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-8", children: [
3371
- /* @__PURE__ */ jsxs4("div", { children: [
3372
- /* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
3373
- /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
2604
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl", children: [
2605
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-8", children: [
2606
+ /* @__PURE__ */ jsxs("div", { children: [
2607
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
2608
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
3374
2609
  ] }),
3375
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
3376
- /* @__PURE__ */ jsxs4(
2610
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2611
+ /* @__PURE__ */ jsxs(
3377
2612
  "button",
3378
2613
  {
3379
2614
  onClick: () => ctx.reset(),
3380
2615
  disabled: !ctx.isDirty,
3381
2616
  className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50 hover:text-slate-900 disabled:opacity-50 transition-colors bg-white shadow-sm",
3382
2617
  children: [
3383
- /* @__PURE__ */ jsx5(X, { className: "h-3.5 w-3.5" }),
2618
+ /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }),
3384
2619
  "Discard"
3385
2620
  ]
3386
2621
  }
3387
2622
  ),
3388
- /* @__PURE__ */ jsxs4(
2623
+ /* @__PURE__ */ jsxs(
3389
2624
  "button",
3390
2625
  {
3391
2626
  onClick: () => ctx.save(),
3392
2627
  disabled: !ctx.isDirty,
3393
2628
  className: "inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors shadow-sm",
3394
2629
  children: [
3395
- /* @__PURE__ */ jsx5(Boxes, { className: "h-3.5 w-3.5" }),
2630
+ /* @__PURE__ */ jsx(Boxes, { className: "h-3.5 w-3.5" }),
3396
2631
  "Save"
3397
2632
  ]
3398
2633
  }
3399
2634
  )
3400
2635
  ] })
3401
2636
  ] }),
3402
- selectedGroup ? /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
3403
- /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
3404
- /* @__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(
2637
+ selectedGroup ? /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
2638
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
2639
+ /* @__PURE__ */ jsx("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__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(
3405
2640
  FieldEditor,
3406
2641
  {
3407
2642
  meta: field,
@@ -3412,9 +2647,9 @@ function ConfigSection() {
3412
2647
  }
3413
2648
  }
3414
2649
  ) }, field.id)) })
3415
- ] }) : /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center p-16 text-center border-2 border-dashed border-slate-200 rounded-2xl bg-white/50", children: [
3416
- /* @__PURE__ */ jsx5(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
3417
- /* @__PURE__ */ jsx5("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
2650
+ ] }) : /* @__PURE__ */ jsxs("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: [
2651
+ /* @__PURE__ */ jsx(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
2652
+ /* @__PURE__ */ jsx("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
3418
2653
  ] })
3419
2654
  ] }) })
3420
2655
  ] });
@@ -3425,19 +2660,19 @@ function Row({
3425
2660
  highlight,
3426
2661
  status
3427
2662
  }) {
3428
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
3429
- /* @__PURE__ */ jsx5("dt", { className: "text-slate-500 font-medium", children: label }),
3430
- /* @__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 })
2663
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2664
+ /* @__PURE__ */ jsx("dt", { className: "text-slate-500 font-medium", children: label }),
2665
+ /* @__PURE__ */ jsx("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 })
3431
2666
  ] });
3432
2667
  }
3433
2668
  function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3434
- const [open, setOpen] = useState5(false);
3435
- const [search, setSearch] = useState5("");
2669
+ const [open, setOpen] = useState(false);
2670
+ const [search, setSearch] = useState("");
3436
2671
  const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
3437
2672
  const capped = filtered.slice(0, 80);
3438
2673
  const SelectedIcon = iconMap && value ? iconMap[value] : null;
3439
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
3440
- /* @__PURE__ */ jsxs4(
2674
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2675
+ /* @__PURE__ */ jsxs(
3441
2676
  "button",
3442
2677
  {
3443
2678
  type: "button",
@@ -3447,20 +2682,20 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3447
2682
  },
3448
2683
  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",
3449
2684
  children: [
3450
- /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2 truncate", children: [
3451
- SelectedIcon && /* @__PURE__ */ jsx5(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
3452
- /* @__PURE__ */ jsx5("span", { className: "truncate", children: value || placeholder || "Select..." })
2685
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 truncate", children: [
2686
+ SelectedIcon && /* @__PURE__ */ jsx(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
2687
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: value || placeholder || "Select..." })
3453
2688
  ] }),
3454
- /* @__PURE__ */ jsx5(ChevronDown, { className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}` })
2689
+ /* @__PURE__ */ jsx(ChevronDown, { className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}` })
3455
2690
  ]
3456
2691
  }
3457
2692
  ),
3458
- open && /* @__PURE__ */ jsxs4(Fragment4, { children: [
3459
- /* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
3460
- /* @__PURE__ */ jsxs4("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
3461
- /* @__PURE__ */ jsxs4("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
3462
- /* @__PURE__ */ jsx5(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
3463
- /* @__PURE__ */ jsx5(
2693
+ open && /* @__PURE__ */ jsxs(Fragment, { children: [
2694
+ /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
2695
+ /* @__PURE__ */ jsxs("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: [
2696
+ /* @__PURE__ */ jsxs("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
2697
+ /* @__PURE__ */ jsx(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
2698
+ /* @__PURE__ */ jsx(
3464
2699
  "input",
3465
2700
  {
3466
2701
  autoFocus: true,
@@ -3471,17 +2706,17 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3471
2706
  onChange: (e) => setSearch(e.target.value)
3472
2707
  }
3473
2708
  ),
3474
- 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 })
2709
+ search && /* @__PURE__ */ jsx("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 })
3475
2710
  ] }),
3476
- /* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto flex-1 p-1", children: [
3477
- filtered.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2711
+ /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto flex-1 p-1", children: [
2712
+ filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
3478
2713
  'No results for "',
3479
2714
  search,
3480
2715
  '"'
3481
2716
  ] }),
3482
2717
  capped.map((opt) => {
3483
2718
  const OptIcon = iconMap ? iconMap[opt] : null;
3484
- return /* @__PURE__ */ jsxs4(
2719
+ return /* @__PURE__ */ jsxs(
3485
2720
  "button",
3486
2721
  {
3487
2722
  type: "button",
@@ -3491,14 +2726,14 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3491
2726
  setOpen(false);
3492
2727
  },
3493
2728
  children: [
3494
- OptIcon && /* @__PURE__ */ jsx5("span", { className: "w-5 h-5 flex items-center justify-center rounded bg-slate-100 shrink-0", children: /* @__PURE__ */ jsx5(OptIcon, { className: "w-3.5 h-3.5" }) }),
3495
- /* @__PURE__ */ jsx5("span", { className: "truncate", children: opt })
2729
+ OptIcon && /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center rounded bg-slate-100 shrink-0", children: /* @__PURE__ */ jsx(OptIcon, { className: "w-3.5 h-3.5" }) }),
2730
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt })
3496
2731
  ]
3497
2732
  },
3498
2733
  opt
3499
2734
  );
3500
2735
  }),
3501
- filtered.length > 80 && /* @__PURE__ */ jsxs4("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
2736
+ filtered.length > 80 && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
3502
2737
  "Showing 80 of ",
3503
2738
  filtered.length,
3504
2739
  " \u2014 type to narrow results"
@@ -3509,12 +2744,12 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3509
2744
  ] });
3510
2745
  }
3511
2746
  function PasswordField({ value, onChange }) {
3512
- const [show, setShow] = useState5(false);
2747
+ const [show, setShow] = useState(false);
3513
2748
  const isHash = value.startsWith("$2a$") || value.startsWith("$2b$");
3514
- const [displayValue, setDisplayValue] = useState5(isHash ? "" : value);
3515
- const [pristine, setPristine] = useState5(isHash);
3516
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
3517
- /* @__PURE__ */ jsx5(
2749
+ const [displayValue, setDisplayValue] = useState(isHash ? "" : value);
2750
+ const [pristine, setPristine] = useState(isHash);
2751
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2752
+ /* @__PURE__ */ jsx(
3518
2753
  "input",
3519
2754
  {
3520
2755
  type: show ? "text" : "password",
@@ -3528,13 +2763,13 @@ function PasswordField({ value, onChange }) {
3528
2763
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all pr-10"
3529
2764
  }
3530
2765
  ),
3531
- /* @__PURE__ */ jsx5(
2766
+ /* @__PURE__ */ jsx(
3532
2767
  "button",
3533
2768
  {
3534
2769
  type: "button",
3535
2770
  onClick: () => setShow(!show),
3536
2771
  className: "absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 transition-colors",
3537
- children: show ? /* @__PURE__ */ jsx5(EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx5(Eye, { className: "w-4 h-4" })
2772
+ children: show ? /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" })
3538
2773
  }
3539
2774
  )
3540
2775
  ] });
@@ -3555,8 +2790,8 @@ function FormattedNumberInput({
3555
2790
  if (!cleanDigits) return "";
3556
2791
  return cleanDigits.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
3557
2792
  };
3558
- const [displayVal, setDisplayVal] = useState5(() => formatWithDots(value));
3559
- useEffect4(() => {
2793
+ const [displayVal, setDisplayVal] = useState(() => formatWithDots(value));
2794
+ useEffect(() => {
3560
2795
  setDisplayVal(formatWithDots(value));
3561
2796
  }, [value]);
3562
2797
  const handleChange = (e) => {
@@ -3577,10 +2812,10 @@ function FormattedNumberInput({
3577
2812
  setDisplayVal(formatted);
3578
2813
  onChange(parsed);
3579
2814
  };
3580
- return /* @__PURE__ */ jsxs4("div", { className: `relative flex items-center ${containerClassName}`, children: [
3581
- isPrice && /* @__PURE__ */ jsx5("span", { className: "absolute left-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "$" }),
3582
- isPercent && /* @__PURE__ */ jsx5("span", { className: "absolute right-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "%" }),
3583
- /* @__PURE__ */ jsx5(
2815
+ return /* @__PURE__ */ jsxs("div", { className: `relative flex items-center ${containerClassName}`, children: [
2816
+ isPrice && /* @__PURE__ */ jsx("span", { className: "absolute left-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "$" }),
2817
+ isPercent && /* @__PURE__ */ jsx("span", { className: "absolute right-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "%" }),
2818
+ /* @__PURE__ */ jsx(
3584
2819
  "input",
3585
2820
  {
3586
2821
  type: "text",
@@ -3605,9 +2840,9 @@ function BranchSettingsEditor({
3605
2840
  onChange
3606
2841
  }) {
3607
2842
  const ctx = useCmsContext();
3608
- const [branches, setBranches] = useState5([]);
3609
- const [loading, setLoading] = useState5(true);
3610
- const [loadError, setLoadError] = useState5("");
2843
+ const [branches, setBranches] = useState([]);
2844
+ const [loading, setLoading] = useState(true);
2845
+ const [loadError, setLoadError] = useState("");
3611
2846
  const settings = value && typeof value === "object" ? value : {};
3612
2847
  const selectedBranches = Array.isArray(settings.branches) ? settings.branches.map(String) : [];
3613
2848
  const prices = settings.prices && typeof settings.prices === "object" ? settings.prices : {};
@@ -3629,7 +2864,7 @@ function BranchSettingsEditor({
3629
2864
  const allBranches = settings.allBranches !== false;
3630
2865
  const useBranchPricing = settings.useBranchPricing === true;
3631
2866
  const useBranchDiscounts = settings.useBranchDiscounts === true;
3632
- useEffect4(() => {
2867
+ useEffect(() => {
3633
2868
  let active = true;
3634
2869
  setLoading(true);
3635
2870
  setLoadError("");
@@ -3693,9 +2928,9 @@ function BranchSettingsEditor({
3693
2928
  }
3694
2929
  updateSettings({ discounts: nextDiscounts });
3695
2930
  };
3696
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-4 rounded-xl border border-slate-200 bg-slate-50/50 p-4", children: [
3697
- /* @__PURE__ */ jsxs4("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3698
- /* @__PURE__ */ jsx5(
2931
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl border border-slate-200 bg-slate-50/50 p-4", children: [
2932
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
2933
+ /* @__PURE__ */ jsx(
3699
2934
  "input",
3700
2935
  {
3701
2936
  type: "checkbox",
@@ -3704,12 +2939,12 @@ function BranchSettingsEditor({
3704
2939
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3705
2940
  }
3706
2941
  ),
3707
- /* @__PURE__ */ jsxs4("span", { children: [
3708
- /* @__PURE__ */ jsx5("span", { className: "block font-semibold", children: "Disponible en todas las sedes" }),
3709
- /* @__PURE__ */ jsx5("span", { className: "mt-0.5 block text-xs text-slate-500", children: "Desactiva esta opci\xF3n para elegir una o varias sedes." })
2942
+ /* @__PURE__ */ jsxs("span", { children: [
2943
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Disponible en todas las sedes" }),
2944
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-xs text-slate-500", children: "Desactiva esta opci\xF3n para elegir una o varias sedes." })
3710
2945
  ] })
3711
2946
  ] }),
3712
- !allBranches && /* @__PURE__ */ jsx5(
2947
+ !allBranches && /* @__PURE__ */ jsx(
3713
2948
  SearchableMultiSelect,
3714
2949
  {
3715
2950
  options: branches.map((branch) => ({
@@ -3725,10 +2960,10 @@ function BranchSettingsEditor({
3725
2960
  emptyMessage: "No hay sedes registradas todav\xEDa."
3726
2961
  }
3727
2962
  ),
3728
- /* @__PURE__ */ jsxs4("div", { className: "border-t border-slate-200 pt-4", children: [
3729
- /* @__PURE__ */ jsx5("p", { className: "text-sm font-semibold text-slate-700", children: "Horario diferente por sede (opcional)" }),
3730
- /* @__PURE__ */ jsx5("p", { className: "mt-1 text-xs text-slate-500", children: "Deja ambas horas vac\xEDas para heredar el horario general. Si defines una hora, el horario de esa sede reemplaza por completo al general." }),
3731
- /* @__PURE__ */ jsx5("div", { className: "mt-3", children: /* @__PURE__ */ jsx5(
2963
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
2964
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-slate-700", children: "Horario diferente por sede (opcional)" }),
2965
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-slate-500", children: "Deja ambas horas vac\xEDas para heredar el horario general. Si defines una hora, el horario de esa sede reemplaza por completo al general." }),
2966
+ /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(
3732
2967
  SearchableMultiSelect,
3733
2968
  {
3734
2969
  options: branches.map((branch) => ({
@@ -3752,19 +2987,19 @@ function BranchSettingsEditor({
3752
2987
  emptyMessage: "No hay sedes registradas todav\xEDa."
3753
2988
  }
3754
2989
  ) }),
3755
- /* @__PURE__ */ jsx5("div", { className: "mt-3 space-y-2", children: branches.filter(
2990
+ /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: branches.filter(
3756
2991
  (branch) => selectedAvailabilityBranches.includes(getBranchName(branch))
3757
2992
  ).map((branch) => {
3758
2993
  const name = getBranchName(branch);
3759
2994
  const schedule = branchAvailability[name] ?? {};
3760
- return /* @__PURE__ */ jsxs4(
2995
+ return /* @__PURE__ */ jsxs(
3761
2996
  "div",
3762
2997
  {
3763
2998
  className: "space-y-3 rounded-lg border border-slate-200 bg-white p-3",
3764
2999
  children: [
3765
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3766
- /* @__PURE__ */ jsx5("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3767
- /* @__PURE__ */ jsx5(
3000
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3001
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3002
+ /* @__PURE__ */ jsx(
3768
3003
  "button",
3769
3004
  {
3770
3005
  type: "button",
@@ -3776,11 +3011,11 @@ function BranchSettingsEditor({
3776
3011
  "aria-label": `Quitar horario de ${name}`,
3777
3012
  title: `Quitar horario de ${name}`,
3778
3013
  className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-slate-200 text-slate-500 transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-700",
3779
- children: /* @__PURE__ */ jsx5(X, { className: "h-4 w-4" })
3014
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3780
3015
  }
3781
3016
  )
3782
3017
  ] }),
3783
- /* @__PURE__ */ jsx5(
3018
+ /* @__PURE__ */ jsx(
3784
3019
  AdminTimeRangePicker,
3785
3020
  {
3786
3021
  value: [
@@ -3806,9 +3041,9 @@ function BranchSettingsEditor({
3806
3041
  );
3807
3042
  }) })
3808
3043
  ] }),
3809
- /* @__PURE__ */ jsxs4("div", { className: "border-t border-slate-200 pt-4", children: [
3810
- /* @__PURE__ */ jsxs4("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3811
- /* @__PURE__ */ jsx5(
3044
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
3045
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3046
+ /* @__PURE__ */ jsx(
3812
3047
  "input",
3813
3048
  {
3814
3049
  type: "checkbox",
@@ -3817,17 +3052,17 @@ function BranchSettingsEditor({
3817
3052
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3818
3053
  }
3819
3054
  ),
3820
- /* @__PURE__ */ jsxs4("span", { children: [
3821
- /* @__PURE__ */ jsx5("span", { className: "block font-semibold", children: "Usar precio diferente por sede" }),
3822
- /* @__PURE__ */ jsx5("span", { className: "mt-0.5 block text-xs text-slate-500", children: "El precio global se usa como base; deja una sede vac\xEDa para conservarlo." })
3055
+ /* @__PURE__ */ jsxs("span", { children: [
3056
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Usar precio diferente por sede" }),
3057
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-xs text-slate-500", children: "El precio global se usa como base; deja una sede vac\xEDa para conservarlo." })
3823
3058
  ] })
3824
3059
  ] }),
3825
- useBranchPricing && /* @__PURE__ */ jsx5("div", { className: "mt-3 space-y-2", children: loading ? /* @__PURE__ */ jsx5("p", { className: "py-2 text-center text-xs text-slate-400", children: "Cargando sedes..." }) : loadError ? /* @__PURE__ */ jsx5("p", { role: "alert", className: "py-2 text-center text-xs text-red-600", children: loadError }) : branches.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "py-2 text-center text-xs text-slate-400", children: "Agrega sedes a la colecci\xF3n antes de definir precios." }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
3826
- /* @__PURE__ */ jsxs4("p", { className: "text-xs text-slate-500", children: [
3060
+ useBranchPricing && /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: loading ? /* @__PURE__ */ jsx("p", { className: "py-2 text-center text-xs text-slate-400", children: "Cargando sedes..." }) : loadError ? /* @__PURE__ */ jsx("p", { role: "alert", className: "py-2 text-center text-xs text-red-600", children: loadError }) : branches.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-2 text-center text-xs text-slate-400", children: "Agrega sedes a la colecci\xF3n antes de definir precios." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3061
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-slate-500", children: [
3827
3062
  "Precio global actual: $",
3828
3063
  globalPrice.toLocaleString("es-CO")
3829
3064
  ] }),
3830
- /* @__PURE__ */ jsx5(
3065
+ /* @__PURE__ */ jsx(
3831
3066
  SearchableMultiSelect,
3832
3067
  {
3833
3068
  options: branches.map((branch) => ({
@@ -3857,14 +3092,14 @@ function BranchSettingsEditor({
3857
3092
  (branch) => selectedPriceBranches.includes(getBranchName(branch))
3858
3093
  ).map((branch) => {
3859
3094
  const name = getBranchName(branch);
3860
- return /* @__PURE__ */ jsxs4(
3095
+ return /* @__PURE__ */ jsxs(
3861
3096
  "div",
3862
3097
  {
3863
3098
  className: "space-y-2 rounded-lg border border-slate-200 bg-white p-3",
3864
3099
  children: [
3865
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3866
- /* @__PURE__ */ jsx5("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3867
- /* @__PURE__ */ jsx5(
3100
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3101
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3102
+ /* @__PURE__ */ jsx(
3868
3103
  "button",
3869
3104
  {
3870
3105
  type: "button",
@@ -3881,16 +3116,16 @@ function BranchSettingsEditor({
3881
3116
  "aria-label": `Quitar ${name} de precios por sede`,
3882
3117
  title: `Quitar ${name}`,
3883
3118
  className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-slate-200 text-slate-500 transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-700",
3884
- children: /* @__PURE__ */ jsx5(X, { className: "h-4 w-4" })
3119
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3885
3120
  }
3886
3121
  )
3887
3122
  ] }),
3888
- /* @__PURE__ */ jsxs4("label", { className: "block w-full", children: [
3889
- /* @__PURE__ */ jsxs4("span", { className: "sr-only", children: [
3123
+ /* @__PURE__ */ jsxs("label", { className: "block w-full", children: [
3124
+ /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
3890
3125
  "Precio para ",
3891
3126
  name
3892
3127
  ] }),
3893
- /* @__PURE__ */ jsx5(
3128
+ /* @__PURE__ */ jsx(
3894
3129
  FormattedNumberInput,
3895
3130
  {
3896
3131
  value: prices[name] ?? "",
@@ -3913,9 +3148,9 @@ function BranchSettingsEditor({
3913
3148
  })
3914
3149
  ] }) })
3915
3150
  ] }),
3916
- /* @__PURE__ */ jsxs4("div", { className: "border-t border-slate-200 pt-4", children: [
3917
- /* @__PURE__ */ jsxs4("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3918
- /* @__PURE__ */ jsx5(
3151
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
3152
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3153
+ /* @__PURE__ */ jsx(
3919
3154
  "input",
3920
3155
  {
3921
3156
  type: "checkbox",
@@ -3924,18 +3159,18 @@ function BranchSettingsEditor({
3924
3159
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3925
3160
  }
3926
3161
  ),
3927
- /* @__PURE__ */ jsxs4("span", { children: [
3928
- /* @__PURE__ */ jsx5("span", { className: "block font-semibold", children: "Usar descuento diferente por sede" }),
3929
- /* @__PURE__ */ jsx5("span", { className: "mt-0.5 block text-xs text-slate-500", children: "El descuento global aplica como base; una sede vac\xEDa hereda ese porcentaje." })
3162
+ /* @__PURE__ */ jsxs("span", { children: [
3163
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Usar descuento diferente por sede" }),
3164
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-xs text-slate-500", children: "El descuento global aplica como base; una sede vac\xEDa hereda ese porcentaje." })
3930
3165
  ] })
3931
3166
  ] }),
3932
- useBranchDiscounts && /* @__PURE__ */ jsx5("div", { className: "mt-3 space-y-2", children: loading ? /* @__PURE__ */ jsx5("p", { className: "py-2 text-center text-xs text-slate-400", children: "Cargando sedes..." }) : loadError ? /* @__PURE__ */ jsx5("p", { role: "alert", className: "py-2 text-center text-xs text-red-600", children: loadError }) : branches.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "py-2 text-center text-xs text-slate-400", children: "Agrega sedes a la colecci\xF3n antes de definir descuentos." }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
3933
- /* @__PURE__ */ jsxs4("p", { className: "text-xs text-slate-500", children: [
3167
+ useBranchDiscounts && /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: loading ? /* @__PURE__ */ jsx("p", { className: "py-2 text-center text-xs text-slate-400", children: "Cargando sedes..." }) : loadError ? /* @__PURE__ */ jsx("p", { role: "alert", className: "py-2 text-center text-xs text-red-600", children: loadError }) : branches.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-2 text-center text-xs text-slate-400", children: "Agrega sedes a la colecci\xF3n antes de definir descuentos." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3168
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-slate-500", children: [
3934
3169
  "Descuento global actual: ",
3935
3170
  globalDiscount,
3936
3171
  "%"
3937
3172
  ] }),
3938
- /* @__PURE__ */ jsx5(
3173
+ /* @__PURE__ */ jsx(
3939
3174
  SearchableMultiSelect,
3940
3175
  {
3941
3176
  options: branches.map((branch) => ({
@@ -3965,14 +3200,14 @@ function BranchSettingsEditor({
3965
3200
  (branch) => selectedDiscountBranches.includes(getBranchName(branch))
3966
3201
  ).map((branch) => {
3967
3202
  const name = getBranchName(branch);
3968
- return /* @__PURE__ */ jsxs4(
3203
+ return /* @__PURE__ */ jsxs(
3969
3204
  "div",
3970
3205
  {
3971
3206
  className: "space-y-2 rounded-lg border border-slate-200 bg-white p-3",
3972
3207
  children: [
3973
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3974
- /* @__PURE__ */ jsx5("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3975
- /* @__PURE__ */ jsx5(
3208
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3209
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3210
+ /* @__PURE__ */ jsx(
3976
3211
  "button",
3977
3212
  {
3978
3213
  type: "button",
@@ -3989,16 +3224,16 @@ function BranchSettingsEditor({
3989
3224
  "aria-label": `Quitar descuento de ${name}`,
3990
3225
  title: `Quitar ${name}`,
3991
3226
  className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-slate-200 text-slate-500 transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-700",
3992
- children: /* @__PURE__ */ jsx5(X, { className: "h-4 w-4" })
3227
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3993
3228
  }
3994
3229
  )
3995
3230
  ] }),
3996
- /* @__PURE__ */ jsxs4("label", { className: "block w-full", children: [
3997
- /* @__PURE__ */ jsxs4("span", { className: "sr-only", children: [
3231
+ /* @__PURE__ */ jsxs("label", { className: "block w-full", children: [
3232
+ /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
3998
3233
  "Descuento para ",
3999
3234
  name
4000
3235
  ] }),
4001
- /* @__PURE__ */ jsx5(
3236
+ /* @__PURE__ */ jsx(
4002
3237
  FormattedNumberInput,
4003
3238
  {
4004
3239
  value: discounts[name] ?? "",
@@ -4024,12 +3259,12 @@ function BranchSettingsEditor({
4024
3259
  ] });
4025
3260
  }
4026
3261
  function BranchSettingsSummary({ value }) {
4027
- if (!value || typeof value !== "object") return /* @__PURE__ */ jsx5("span", { children: "Todas las sedes" });
3262
+ if (!value || typeof value !== "object") return /* @__PURE__ */ jsx("span", { children: "Todas las sedes" });
4028
3263
  const settings = value;
4029
3264
  const names = Array.isArray(settings.branches) ? settings.branches : [];
4030
3265
  const locationSummary = settings.allBranches === false ? names.length > 0 ? names.join(", ") : "Sin sedes" : "Todas las sedes";
4031
3266
  const pricingSummary = settings.useBranchPricing ? " \xB7 Precio por sede" : " \xB7 Precio global";
4032
- return /* @__PURE__ */ jsx5("span", { children: locationSummary + pricingSummary });
3267
+ return /* @__PURE__ */ jsx("span", { children: locationSummary + pricingSummary });
4033
3268
  }
4034
3269
  function SearchableMultiSelect({
4035
3270
  options,
@@ -4043,10 +3278,10 @@ function SearchableMultiSelect({
4043
3278
  error,
4044
3279
  max
4045
3280
  }) {
4046
- const [open, setOpen] = useState5(false);
4047
- const [search, setSearch] = useState5("");
4048
- const rootRef = useRef2(null);
4049
- useEffect4(() => {
3281
+ const [open, setOpen] = useState(false);
3282
+ const [search, setSearch] = useState("");
3283
+ const rootRef = useRef(null);
3284
+ useEffect(() => {
4050
3285
  if (!open) return;
4051
3286
  const handlePointerDown = (event) => {
4052
3287
  if (event.target instanceof Node && !rootRef.current?.contains(event.target)) {
@@ -4095,8 +3330,8 @@ function SearchableMultiSelect({
4095
3330
  onChange(value.filter((selected) => !visibleValues.includes(selected)));
4096
3331
  }
4097
3332
  };
4098
- return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: "relative", children: [
4099
- /* @__PURE__ */ jsxs4(
3333
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: "relative", children: [
3334
+ /* @__PURE__ */ jsxs(
4100
3335
  "button",
4101
3336
  {
4102
3337
  type: "button",
@@ -4105,8 +3340,8 @@ function SearchableMultiSelect({
4105
3340
  onClick: () => setOpen((isOpen) => !isOpen),
4106
3341
  className: "flex min-h-11 w-full items-center justify-between gap-3 rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-left text-sm shadow-sm transition-colors hover:border-slate-300 focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10",
4107
3342
  children: [
4108
- /* @__PURE__ */ jsx5("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: placeholder }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
4109
- selectedOptions.slice(0, 2).map((option) => /* @__PURE__ */ jsx5(
3343
+ /* @__PURE__ */ jsx("span", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-slate-400", children: placeholder }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3344
+ selectedOptions.slice(0, 2).map((option) => /* @__PURE__ */ jsx(
4110
3345
  "span",
4111
3346
  {
4112
3347
  className: "max-w-full truncate rounded-md bg-indigo-50 px-2 py-1 text-xs font-medium text-indigo-700",
@@ -4114,18 +3349,18 @@ function SearchableMultiSelect({
4114
3349
  },
4115
3350
  option.value
4116
3351
  )),
4117
- selectedOptions.length > 2 && /* @__PURE__ */ jsxs4("span", { className: "rounded-md bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-600", children: [
3352
+ selectedOptions.length > 2 && /* @__PURE__ */ jsxs("span", { className: "rounded-md bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-600", children: [
4118
3353
  "+",
4119
3354
  selectedOptions.length - 2
4120
3355
  ] })
4121
3356
  ] }) }),
4122
- /* @__PURE__ */ jsxs4("span", { className: "flex shrink-0 items-center gap-2 text-xs text-slate-400", children: [
4123
- selectedOptions.length > 0 && /* @__PURE__ */ jsxs4("span", { children: [
3357
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2 text-xs text-slate-400", children: [
3358
+ selectedOptions.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
4124
3359
  selectedOptions.length,
4125
3360
  " seleccionada",
4126
3361
  selectedOptions.length === 1 ? "" : "s"
4127
3362
  ] }),
4128
- /* @__PURE__ */ jsx5(
3363
+ /* @__PURE__ */ jsx(
4129
3364
  ChevronDown,
4130
3365
  {
4131
3366
  className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`
@@ -4135,11 +3370,11 @@ function SearchableMultiSelect({
4135
3370
  ]
4136
3371
  }
4137
3372
  ),
4138
- open && /* @__PURE__ */ jsxs4("div", { className: "absolute left-0 right-0 top-full z-[70] mt-1 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl", children: [
4139
- /* @__PURE__ */ jsxs4("div", { className: "space-y-2 border-b border-slate-100 p-3", children: [
4140
- searchable && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
4141
- /* @__PURE__ */ jsx5(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" }),
4142
- /* @__PURE__ */ jsx5(
3373
+ open && /* @__PURE__ */ jsxs("div", { className: "absolute left-0 right-0 top-full z-[70] mt-1 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl", children: [
3374
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-b border-slate-100 p-3", children: [
3375
+ searchable && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3376
+ /* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" }),
3377
+ /* @__PURE__ */ jsx(
4143
3378
  "input",
4144
3379
  {
4145
3380
  type: "search",
@@ -4151,15 +3386,15 @@ function SearchableMultiSelect({
4151
3386
  }
4152
3387
  )
4153
3388
  ] }),
4154
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2 text-xs", children: [
4155
- /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-500", children: [
3389
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 text-xs", children: [
3390
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-500", children: [
4156
3391
  value.length,
4157
3392
  " seleccionada",
4158
3393
  value.length === 1 ? "" : "s",
4159
3394
  max ? ` \xB7 m\xE1ximo ${max}` : ""
4160
3395
  ] }),
4161
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
4162
- /* @__PURE__ */ jsx5(
3396
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3397
+ /* @__PURE__ */ jsx(
4163
3398
  "button",
4164
3399
  {
4165
3400
  type: "button",
@@ -4169,8 +3404,8 @@ function SearchableMultiSelect({
4169
3404
  children: visibleOptions.length > 0 && visibleOptions.every((option) => value.includes(option.value)) ? searchable ? "Quitar visibles" : "Quitar todas" : searchable ? "Seleccionar visibles" : "Seleccionar todas"
4170
3405
  }
4171
3406
  ),
4172
- /* @__PURE__ */ jsx5("span", { className: "text-slate-300", children: "\xB7" }),
4173
- /* @__PURE__ */ jsx5(
3407
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300", children: "\xB7" }),
3408
+ /* @__PURE__ */ jsx(
4174
3409
  "button",
4175
3410
  {
4176
3411
  type: "button",
@@ -4183,10 +3418,10 @@ function SearchableMultiSelect({
4183
3418
  ] })
4184
3419
  ] })
4185
3420
  ] }),
4186
- /* @__PURE__ */ jsx5("div", { role: "listbox", "aria-multiselectable": "true", className: "max-h-56 overflow-y-auto p-2", children: loading ? /* @__PURE__ */ jsx5("p", { className: "py-4 text-center text-xs text-slate-400", children: "Cargando opciones..." }) : error ? /* @__PURE__ */ jsx5("p", { role: "alert", className: "py-4 text-center text-xs text-red-600", children: error }) : visibleOptions.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "py-4 text-center text-xs text-slate-400", children: options.length === 0 ? emptyMessage : "No hay resultados para la b\xFAsqueda." }) : /* @__PURE__ */ jsx5("div", { className: "space-y-1", children: visibleOptions.map((option) => {
3421
+ /* @__PURE__ */ jsx("div", { role: "listbox", "aria-multiselectable": "true", className: "max-h-56 overflow-y-auto p-2", children: loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-xs text-slate-400", children: "Cargando opciones..." }) : error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "py-4 text-center text-xs text-red-600", children: error }) : visibleOptions.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-xs text-slate-400", children: options.length === 0 ? emptyMessage : "No hay resultados para la b\xFAsqueda." }) : /* @__PURE__ */ jsx("div", { className: "space-y-1", children: visibleOptions.map((option) => {
4187
3422
  const isSelected = value.includes(option.value);
4188
3423
  const isAtMax = !!max && value.length >= max && !isSelected;
4189
- return /* @__PURE__ */ jsxs4(
3424
+ return /* @__PURE__ */ jsxs(
4190
3425
  "button",
4191
3426
  {
4192
3427
  type: "button",
@@ -4196,14 +3431,14 @@ function SearchableMultiSelect({
4196
3431
  onClick: () => toggleOption(option.value),
4197
3432
  className: `flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-left text-sm transition-colors ${isSelected ? "bg-indigo-50 font-semibold text-indigo-900" : "text-slate-700 hover:bg-slate-50"} disabled:cursor-not-allowed disabled:opacity-50`,
4198
3433
  children: [
4199
- /* @__PURE__ */ jsx5(
3434
+ /* @__PURE__ */ jsx(
4200
3435
  "span",
4201
3436
  {
4202
3437
  className: `flex h-4 w-4 shrink-0 items-center justify-center rounded border ${isSelected ? "border-indigo-600 bg-indigo-600 text-white" : "border-slate-300 bg-white"}`,
4203
- children: isSelected && /* @__PURE__ */ jsx5(Check, { className: "h-3 w-3" })
3438
+ children: isSelected && /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" })
4204
3439
  }
4205
3440
  ),
4206
- /* @__PURE__ */ jsx5("span", { className: "truncate", children: option.label })
3441
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
4207
3442
  ]
4208
3443
  },
4209
3444
  option.value
@@ -4224,9 +3459,9 @@ function ReferenceSelect({
4224
3459
  onChange
4225
3460
  }) {
4226
3461
  const ctx = useCmsContext();
4227
- const [options, setOptions] = useState5([]);
4228
- const [loading, setLoading] = useState5(true);
4229
- useEffect4(() => {
3462
+ const [options, setOptions] = useState([]);
3463
+ const [loading, setLoading] = useState(true);
3464
+ useEffect(() => {
4230
3465
  if (!collectionId) {
4231
3466
  if (fallbackOptions && fallbackOptions.length > 0) {
4232
3467
  setOptions(fallbackOptions.map((opt) => typeof opt === "string" ? { value: opt, label: opt } : opt));
@@ -4261,7 +3496,7 @@ function ReferenceSelect({
4261
3496
  }, [collectionId, displayField, valueField, fallbackOptions, ctx.adapter]);
4262
3497
  if (multiple) {
4263
3498
  const selectedList = Array.isArray(value) ? value.map(String) : typeof value === "string" && value.trim() ? value.split(",").map((s) => s.trim()).filter(Boolean) : [];
4264
- return /* @__PURE__ */ jsx5(
3499
+ return /* @__PURE__ */ jsx(
4265
3500
  SearchableMultiSelect,
4266
3501
  {
4267
3502
  options,
@@ -4281,20 +3516,20 @@ function ReferenceSelect({
4281
3516
  if (singleVal && !displayOptions.some((o) => o.value === singleVal)) {
4282
3517
  displayOptions.unshift({ value: singleVal, label: singleVal });
4283
3518
  }
4284
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
4285
- /* @__PURE__ */ jsxs4(
3519
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3520
+ /* @__PURE__ */ jsxs(
4286
3521
  "select",
4287
3522
  {
4288
3523
  value: singleVal,
4289
3524
  onChange: (e) => onChange(e.target.value),
4290
3525
  className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all bg-white appearance-none pr-10",
4291
3526
  children: [
4292
- /* @__PURE__ */ jsx5("option", { value: "", children: loading ? "Cargando opciones..." : "-- Selecciona una opci\xF3n --" }),
4293
- displayOptions.map((o, idx) => /* @__PURE__ */ jsx5("option", { value: o.value, children: o.label }, `${o.value}-${idx}`))
3527
+ /* @__PURE__ */ jsx("option", { value: "", children: loading ? "Cargando opciones..." : "-- Selecciona una opci\xF3n --" }),
3528
+ displayOptions.map((o, idx) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, `${o.value}-${idx}`))
4294
3529
  ]
4295
3530
  }
4296
3531
  ),
4297
- /* @__PURE__ */ jsx5(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
3532
+ /* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
4298
3533
  ] });
4299
3534
  }
4300
3535
  function ReferenceTableCell({
@@ -4305,9 +3540,9 @@ function ReferenceTableCell({
4305
3540
  multiple = false
4306
3541
  }) {
4307
3542
  const ctx = useCmsContext();
4308
- const [labels, setLabels] = useState5([]);
3543
+ const [labels, setLabels] = useState([]);
4309
3544
  const ids = Array.isArray(entryId) ? entryId.map(String) : typeof entryId === "string" && entryId.trim() ? multiple ? entryId.split(",").map((s) => s.trim()).filter(Boolean) : [entryId] : [];
4310
- useEffect4(() => {
3545
+ useEffect(() => {
4311
3546
  if (!collectionId || ids.length === 0) {
4312
3547
  setLabels(ids);
4313
3548
  return;
@@ -4324,33 +3559,33 @@ function ReferenceTableCell({
4324
3559
  setLabels(ids);
4325
3560
  });
4326
3561
  }, [collectionId, displayField, valueField, JSON.stringify(ids), ctx.adapter]);
4327
- if (labels.length === 0) return /* @__PURE__ */ jsx5("span", { children: "-" });
3562
+ if (labels.length === 0) return /* @__PURE__ */ jsx("span", { children: "-" });
4328
3563
  if (multiple || labels.length > 1) {
4329
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap gap-1 max-w-[260px]", children: [
4330
- labels.slice(0, 3).map((lbl, idx) => /* @__PURE__ */ jsx5("span", { className: "inline-flex px-1.5 py-0.5 rounded bg-slate-100 text-slate-700 text-[11px] font-medium truncate max-w-[120px]", children: lbl }, idx)),
4331
- labels.length > 3 && /* @__PURE__ */ jsxs4("span", { className: "inline-flex px-1.5 py-0.5 rounded bg-slate-200 text-slate-600 text-[10px] font-bold", children: [
3564
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1 max-w-[260px]", children: [
3565
+ labels.slice(0, 3).map((lbl, idx) => /* @__PURE__ */ jsx("span", { className: "inline-flex px-1.5 py-0.5 rounded bg-slate-100 text-slate-700 text-[11px] font-medium truncate max-w-[120px]", children: lbl }, idx)),
3566
+ labels.length > 3 && /* @__PURE__ */ jsxs("span", { className: "inline-flex px-1.5 py-0.5 rounded bg-slate-200 text-slate-600 text-[10px] font-bold", children: [
4332
3567
  "+",
4333
3568
  labels.length - 3
4334
3569
  ] })
4335
3570
  ] });
4336
3571
  }
4337
- return /* @__PURE__ */ jsx5("span", { children: labels[0] });
3572
+ return /* @__PURE__ */ jsx("span", { children: labels[0] });
4338
3573
  }
4339
3574
 
4340
3575
  // src/admin/AdminLogin.tsx
4341
- import { useState as useState6, useEffect as useEffect5 } from "react";
3576
+ import { useState as useState2, useEffect as useEffect2 } from "react";
4342
3577
  import { Lock, UserPlus } from "lucide-react";
4343
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
3578
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
4344
3579
  function AdminLogin({
4345
3580
  authApiRoute = "/api/admin/auth",
4346
3581
  redirectRoute = "/admin"
4347
3582
  }) {
4348
- const [email, setEmail] = useState6("");
4349
- const [password, setPassword] = useState6("");
4350
- const [error, setError] = useState6("");
4351
- const [loading, setLoading] = useState6(false);
4352
- const [view, setView] = useState6("checking");
4353
- useEffect5(() => {
3583
+ const [email, setEmail] = useState2("");
3584
+ const [password, setPassword] = useState2("");
3585
+ const [error, setError] = useState2("");
3586
+ const [loading, setLoading] = useState2(false);
3587
+ const [view, setView] = useState2("checking");
3588
+ useEffect2(() => {
4354
3589
  fetch(authApiRoute, { cache: "no-store" }).then((res) => res.json()).then((data) => {
4355
3590
  if (data.hasUsers) {
4356
3591
  setView("login");
@@ -4386,21 +3621,21 @@ function AdminLogin({
4386
3621
  }
4387
3622
  };
4388
3623
  if (view === "checking") {
4389
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-8 w-8 text-indigo-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
4390
- /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
4391
- /* @__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" })
3624
+ return /* @__PURE__ */ jsx2("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs2("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: [
3625
+ /* @__PURE__ */ jsx2("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
3626
+ /* @__PURE__ */ jsx2("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" })
4392
3627
  ] }) });
4393
3628
  }
4394
- return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
4395
- /* @__PURE__ */ jsxs5("div", { className: "p-8", children: [
4396
- /* @__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" }) }),
4397
- /* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
4398
- /* @__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." }),
4399
- 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 }),
4400
- /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
4401
- /* @__PURE__ */ jsxs5("div", { children: [
4402
- /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
4403
- /* @__PURE__ */ jsx6(
3629
+ return /* @__PURE__ */ jsx2("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs2("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
3630
+ /* @__PURE__ */ jsxs2("div", { className: "p-8", children: [
3631
+ /* @__PURE__ */ jsx2("div", { className: "w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6", children: view === "register" ? /* @__PURE__ */ jsx2(UserPlus, { className: "w-6 h-6 text-indigo-600" }) : /* @__PURE__ */ jsx2(Lock, { className: "w-6 h-6 text-indigo-600" }) }),
3632
+ /* @__PURE__ */ jsx2("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
3633
+ /* @__PURE__ */ jsx2("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." }),
3634
+ error && /* @__PURE__ */ jsx2("div", { className: "mb-6 bg-red-50 text-red-700 p-3 rounded-lg text-sm border border-red-100", children: error }),
3635
+ /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
3636
+ /* @__PURE__ */ jsxs2("div", { children: [
3637
+ /* @__PURE__ */ jsx2("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
3638
+ /* @__PURE__ */ jsx2(
4404
3639
  "input",
4405
3640
  {
4406
3641
  type: "email",
@@ -4412,9 +3647,9 @@ function AdminLogin({
4412
3647
  }
4413
3648
  )
4414
3649
  ] }),
4415
- /* @__PURE__ */ jsxs5("div", { children: [
4416
- /* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
4417
- /* @__PURE__ */ jsx6(
3650
+ /* @__PURE__ */ jsxs2("div", { children: [
3651
+ /* @__PURE__ */ jsx2("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
3652
+ /* @__PURE__ */ jsx2(
4418
3653
  "input",
4419
3654
  {
4420
3655
  type: "password",
@@ -4426,21 +3661,21 @@ function AdminLogin({
4426
3661
  }
4427
3662
  )
4428
3663
  ] }),
4429
- /* @__PURE__ */ jsx6(
3664
+ /* @__PURE__ */ jsx2(
4430
3665
  "button",
4431
3666
  {
4432
3667
  type: "submit",
4433
3668
  disabled: loading,
4434
3669
  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",
4435
- children: loading ? /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
4436
- /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
4437
- /* @__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" })
3670
+ children: loading ? /* @__PURE__ */ jsxs2("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: [
3671
+ /* @__PURE__ */ jsx2("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
3672
+ /* @__PURE__ */ jsx2("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" })
4438
3673
  ] }) : view === "register" ? "Create Account" : "Sign In"
4439
3674
  }
4440
3675
  )
4441
3676
  ] })
4442
3677
  ] }),
4443
- /* @__PURE__ */ jsx6("div", { className: "bg-slate-50 border-t border-slate-100 p-4 text-center text-xs text-slate-400", children: "Powered by Portable CMS" })
3678
+ /* @__PURE__ */ jsx2("div", { className: "bg-slate-50 border-t border-slate-100 p-4 text-center text-xs text-slate-400", children: "Powered by Portable CMS" })
4444
3679
  ] }) });
4445
3680
  }
4446
3681
  export {