admin-lib-cms 1.2.8 → 1.2.10

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,29 @@
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";
26
+ import { createPortal } from "react-dom";
791
27
  import { ConfigProvider, Modal, TimePicker } from "antd";
792
28
  import dayjs from "dayjs";
793
29
  import {
@@ -816,12 +52,12 @@ import {
816
52
  ChevronRight,
817
53
  SlidersHorizontal,
818
54
  LogOut,
819
- ExternalLink as ExternalLink2,
55
+ ExternalLink,
820
56
  Check,
821
57
  GripVertical
822
58
  } 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";
59
+ import { CreditCard, BarChart3 } from "lucide-react";
60
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
825
61
  var TIME_STORAGE_FORMAT = "HH:mm";
826
62
  var TIME_DISPLAY_FORMAT = "h:mm A";
827
63
  var TIME_PICKER_THEME = {
@@ -850,7 +86,7 @@ var TIME_PICKER_THEME = {
850
86
  }
851
87
  };
852
88
  function AdminTimeRangePicker(props) {
853
- return /* @__PURE__ */ jsx5(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx5(
89
+ return /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx(
854
90
  TimePicker.RangePicker,
855
91
  {
856
92
  ...props,
@@ -863,7 +99,7 @@ function AdminTimeRangePicker(props) {
863
99
  ) });
864
100
  }
865
101
  function AdminTimePicker(props) {
866
- return /* @__PURE__ */ jsx5(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx5(
102
+ return /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx(
867
103
  TimePicker,
868
104
  {
869
105
  ...props,
@@ -904,9 +140,9 @@ function FilePickerButton({
904
140
  multiple = false,
905
141
  onFiles
906
142
  }) {
907
- const inputRef = useRef2(null);
908
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
909
- /* @__PURE__ */ jsx5(
143
+ const inputRef = useRef(null);
144
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
145
+ /* @__PURE__ */ jsx(
910
146
  "button",
911
147
  {
912
148
  type: "button",
@@ -915,7 +151,7 @@ function FilePickerButton({
915
151
  children
916
152
  }
917
153
  ),
918
- /* @__PURE__ */ jsx5(
154
+ /* @__PURE__ */ jsx(
919
155
  "input",
920
156
  {
921
157
  ref: inputRef,
@@ -933,16 +169,16 @@ function FilePickerButton({
933
169
  }
934
170
  function AdminApp(props) {
935
171
  if (props.projectId) {
936
- return /* @__PURE__ */ jsx5(SubscriptionProvider, { apiUrl: props.apiUrl, projectId: props.projectId, email: props.email, children: /* @__PURE__ */ jsx5(AdminAppContent, { ...props }) });
172
+ return /* @__PURE__ */ jsx(SubscriptionProvider, { apiUrl: props.apiUrl, projectId: props.projectId, email: props.email, children: /* @__PURE__ */ jsx(AdminAppContent, { ...props }) });
937
173
  }
938
- return /* @__PURE__ */ jsx5(AdminAppContent, { ...props });
174
+ return /* @__PURE__ */ jsx(AdminAppContent, { ...props });
939
175
  }
940
176
  function AdminAppContent(props) {
941
177
  const ctx = useCmsContext();
942
178
  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);
179
+ const [section, setSection] = useState(hasDashboard ? "dashboard" : "pages");
180
+ const [authChecking, setAuthChecking] = useState(true);
181
+ const [authenticated, setAuthenticated] = useState(false);
946
182
  const hideSettings = props.hideSettings ?? ctx.config.hideSettings ?? false;
947
183
  const hideData = props.hideData ?? ctx.config.hideData ?? false;
948
184
  const hideGlobals = props.hideGlobals ?? ctx.config.hideGlobals ?? false;
@@ -958,7 +194,7 @@ function AdminAppContent(props) {
958
194
  ...ctx.config.menuLabels,
959
195
  ...props.menuLabels
960
196
  };
961
- useEffect4(() => {
197
+ useEffect(() => {
962
198
  fetch("/api/admin/auth").then((res) => res.json()).then((data) => {
963
199
  if (data && data.authenticated) {
964
200
  setAuthenticated(true);
@@ -979,8 +215,8 @@ function AdminAppContent(props) {
979
215
  const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
980
216
  const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
981
217
  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" }),
218
+ 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: [
219
+ /* @__PURE__ */ jsx("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
984
220
  "Authenticating Admin..."
985
221
  ] }) });
986
222
  }
@@ -988,90 +224,100 @@ function AdminAppContent(props) {
988
224
  return null;
989
225
  }
990
226
  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, {}) });
227
+ 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
228
  }
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" })
229
+ 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: [
230
+ 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." }),
231
+ 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." }),
232
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
233
+ /* @__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: [
234
+ 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)]" }),
235
+ /* @__PURE__ */ jsx("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
1000
236
  ] }) }),
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" })
237
+ /* @__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: [
238
+ /* @__PURE__ */ jsxs("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
239
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
240
+ 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)]" }),
241
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
1006
242
  ] }),
1007
- /* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
243
+ /* @__PURE__ */ jsx("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
1008
244
  ] }),
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(
245
+ /* @__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: [
246
+ hasDashboard && /* @__PURE__ */ jsx(
1011
247
  SideItem,
1012
248
  {
1013
249
  active: section === "dashboard",
1014
250
  onClick: () => setSection("dashboard"),
1015
- icon: /* @__PURE__ */ jsx5(BarChart3, { className: "h-4 w-4 shrink-0" }),
251
+ icon: /* @__PURE__ */ jsx(BarChart3, { className: "h-4 w-4 shrink-0" }),
1016
252
  children: menuLabels.dashboard
1017
253
  }
1018
254
  ),
1019
- /* @__PURE__ */ jsx5(
255
+ props.customSections?.map((cs) => /* @__PURE__ */ jsx(
256
+ SideItem,
257
+ {
258
+ active: section === cs.id,
259
+ onClick: () => setSection(cs.id),
260
+ icon: cs.icon || /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 shrink-0" }),
261
+ children: cs.label
262
+ },
263
+ cs.id
264
+ )),
265
+ /* @__PURE__ */ jsx(
1020
266
  SideItem,
1021
267
  {
1022
268
  active: section === "pages",
1023
269
  onClick: () => setSection("pages"),
1024
- icon: /* @__PURE__ */ jsx5(FileText, { className: "h-4 w-4 shrink-0" }),
270
+ icon: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 shrink-0" }),
1025
271
  children: menuLabels.pages
1026
272
  }
1027
273
  ),
1028
- /* @__PURE__ */ jsx5(
274
+ /* @__PURE__ */ jsx(
1029
275
  SideItem,
1030
276
  {
1031
277
  active: section === "collections",
1032
278
  onClick: () => setSection("collections"),
1033
- icon: /* @__PURE__ */ jsx5(Boxes, { className: "h-4 w-4 shrink-0" }),
279
+ icon: /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 shrink-0" }),
1034
280
  children: menuLabels.collections
1035
281
  }
1036
282
  ),
1037
- !hideData && /* @__PURE__ */ jsx5(
283
+ !hideData && /* @__PURE__ */ jsx(
1038
284
  SideItem,
1039
285
  {
1040
286
  active: section === "submissions",
1041
287
  onClick: () => setSection("submissions"),
1042
- icon: /* @__PURE__ */ jsx5(Inbox, { className: "h-4 w-4 shrink-0" }),
288
+ icon: /* @__PURE__ */ jsx(Inbox, { className: "h-4 w-4 shrink-0" }),
1043
289
  children: menuLabels.data
1044
290
  }
1045
291
  ),
1046
- !hideConfig && !hideGlobals && /* @__PURE__ */ jsx5(
292
+ !hideConfig && !hideGlobals && /* @__PURE__ */ jsx(
1047
293
  SideItem,
1048
294
  {
1049
295
  active: section === "config",
1050
296
  onClick: () => setSection("config"),
1051
- icon: /* @__PURE__ */ jsx5(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
297
+ icon: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
1052
298
  children: menuLabels.config
1053
299
  }
1054
300
  ),
1055
- !hideSettings && /* @__PURE__ */ jsx5(
301
+ !hideSettings && /* @__PURE__ */ jsx(
1056
302
  SideItem,
1057
303
  {
1058
304
  active: section === "settings",
1059
305
  onClick: () => setSection("settings"),
1060
- icon: /* @__PURE__ */ jsx5(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
306
+ icon: /* @__PURE__ */ jsx(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
1061
307
  children: menuLabels.settings
1062
308
  }
1063
309
  ),
1064
- subscriptionCtx && /* @__PURE__ */ jsx5(
310
+ subscriptionCtx && /* @__PURE__ */ jsx(
1065
311
  SideItem,
1066
312
  {
1067
313
  active: section === "subscription",
1068
314
  onClick: () => setSection("subscription"),
1069
- icon: /* @__PURE__ */ jsx5(CreditCard2, { className: "h-4 w-4 shrink-0" }),
315
+ icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4 shrink-0" }),
1070
316
  children: menuLabels.subscription
1071
317
  }
1072
318
  )
1073
319
  ] }),
1074
- /* @__PURE__ */ jsx5("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: /* @__PURE__ */ jsxs4(
320
+ /* @__PURE__ */ jsx("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: /* @__PURE__ */ jsxs(
1075
321
  "button",
1076
322
  {
1077
323
  onClick: async () => {
@@ -1080,20 +326,23 @@ function AdminAppContent(props) {
1080
326
  },
1081
327
  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
328
  children: [
1083
- /* @__PURE__ */ jsx5(LogOut, { className: "w-4 h-4" }),
329
+ /* @__PURE__ */ jsx(LogOut, { className: "w-4 h-4" }),
1084
330
  "Logout"
1085
331
  ]
1086
332
  }
1087
333
  ) })
1088
334
  ] }),
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, {})
335
+ /* @__PURE__ */ jsxs("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
336
+ section === "dashboard" && hasDashboard && (typeof props.dashboard === "function" ? createElement(props.dashboard) : props.dashboard),
337
+ section === "pages" && /* @__PURE__ */ jsx(PagesSection, {}),
338
+ section === "collections" && /* @__PURE__ */ jsx(CollectionsSection, {}),
339
+ !hideData && section === "submissions" && /* @__PURE__ */ jsx(SubmissionsSection, {}),
340
+ !hideConfig && !hideGlobals && section === "config" && /* @__PURE__ */ jsx(ConfigSection, {}),
341
+ !hideSettings && section === "settings" && /* @__PURE__ */ jsx(SettingsSection, {}),
342
+ section === "subscription" && /* @__PURE__ */ jsx(SubscriptionPage, {}),
343
+ props.customSections?.map(
344
+ (cs) => section === cs.id ? /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: typeof cs.component === "function" ? createElement(cs.component) : cs.component }, cs.id) : null
345
+ )
1097
346
  ] })
1098
347
  ] })
1099
348
  ] });
@@ -1104,14 +353,14 @@ function SideItem({
1104
353
  icon,
1105
354
  children
1106
355
  }) {
1107
- return /* @__PURE__ */ jsxs4(
356
+ return /* @__PURE__ */ jsxs(
1108
357
  "button",
1109
358
  {
1110
359
  onClick,
1111
360
  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
361
  children: [
1113
- /* @__PURE__ */ jsx5("span", { className: active ? "text-indigo-100" : "text-slate-400", children: icon }),
1114
- /* @__PURE__ */ jsx5("span", { className: "inline", children })
362
+ /* @__PURE__ */ jsx("span", { className: active ? "text-indigo-100" : "text-slate-400", children: icon }),
363
+ /* @__PURE__ */ jsx("span", { className: "inline", children })
1115
364
  ]
1116
365
  }
1117
366
  );
@@ -1122,20 +371,20 @@ function PageListItem({
1122
371
  onSelect,
1123
372
  depth = 0
1124
373
  }) {
1125
- const [expanded, setExpanded] = useState5(false);
374
+ const [expanded, setExpanded] = useState(false);
1126
375
  if (p.isSeparator) {
1127
- return /* @__PURE__ */ jsx5("li", { className: "my-2 border-t border-slate-200/60" });
376
+ return /* @__PURE__ */ jsx("li", { className: "my-2 border-t border-slate-200/60" });
1128
377
  }
1129
378
  const hasChildren = p.children && p.children.length > 0;
1130
379
  const isSelected = selected?.id === p.id;
1131
380
  const hasSelectedChild = hasChildren && p.children?.some((child) => child.id === selected?.id);
1132
- useEffect4(() => {
381
+ useEffect(() => {
1133
382
  if (hasSelectedChild) {
1134
383
  setExpanded(true);
1135
384
  }
1136
385
  }, [hasSelectedChild]);
1137
- return /* @__PURE__ */ jsxs4("li", { className: "shrink-0 lg:w-full", children: [
1138
- /* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
386
+ return /* @__PURE__ */ jsxs("li", { className: "shrink-0 lg:w-full", children: [
387
+ /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx(
1139
388
  "button",
1140
389
  {
1141
390
  onClick: () => {
@@ -1147,19 +396,19 @@ function PageListItem({
1147
396
  }
1148
397
  },
1149
398
  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(
399
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
400
+ /* @__PURE__ */ jsx(
1152
401
  "div",
1153
402
  {
1154
403
  className: `truncate ${isSelected ? "text-slate-900" : "text-slate-700"}`,
1155
404
  children: p.name
1156
405
  }
1157
406
  ),
1158
- hasChildren && /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx5(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx5(ChevronDown, { size: 14 }) })
407
+ hasChildren && /* @__PURE__ */ jsx("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) })
1159
408
  ] })
1160
409
  }
1161
410
  ) }),
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(
411
+ 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
412
  PageListItem,
1164
413
  {
1165
414
  p: child,
@@ -1173,15 +422,15 @@ function PageListItem({
1173
422
  }
1174
423
  function PagesSection() {
1175
424
  const ctx = useCmsContext();
1176
- const [selected, setSelected] = useState5(
425
+ const [selected, setSelected] = useState(
1177
426
  ctx.config.pages[0] ?? null
1178
427
  );
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(
428
+ const [showList, setShowList] = useState(true);
429
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [
430
+ 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: [
431
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
432
+ /* @__PURE__ */ jsxs("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
433
+ ctx.config.pages.map((p) => /* @__PURE__ */ jsx(
1185
434
  PageListItem,
1186
435
  {
1187
436
  p,
@@ -1190,31 +439,31 @@ function PagesSection() {
1190
439
  },
1191
440
  p.id
1192
441
  )),
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." })
442
+ 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
443
  ] })
1195
444
  ] }),
1196
- /* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden bg-slate-50/50 flex flex-col", children: selected ? /* @__PURE__ */ jsx5(
445
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden bg-slate-50/50 flex flex-col", children: selected ? /* @__PURE__ */ jsx(
1197
446
  PageEditor,
1198
447
  {
1199
448
  page: selected,
1200
449
  showList,
1201
450
  onToggleList: () => setShowList(!showList)
1202
451
  }
1203
- ) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a page to edit its content." }) })
452
+ ) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a page to edit its content." }) })
1204
453
  ] });
1205
454
  }
1206
455
  function PageEditor({ page, showList, onToggleList }) {
1207
456
  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(
457
+ const iframeRef = useRef(null);
458
+ const [registered, setRegistered] = useState([]);
459
+ const [selectedId, setSelectedId] = useState(null);
460
+ const [preview, setPreview] = useState(false);
461
+ const [drawerState, setDrawerState] = useState("half");
462
+ const src = useMemo(
1214
463
  () => `${page.path}${preview ? "" : "?__cms=edit"}`,
1215
464
  [page.path, preview]
1216
465
  );
1217
- useEffect4(() => {
466
+ useEffect(() => {
1218
467
  const onMsg = (e) => {
1219
468
  if (e.source !== iframeRef.current?.contentWindow) return;
1220
469
  const d = e.data;
@@ -1236,11 +485,11 @@ function PageEditor({ page, showList, onToggleList }) {
1236
485
  window.addEventListener("message", onMsg);
1237
486
  return () => window.removeEventListener("message", onMsg);
1238
487
  }, [ctx.overrides]);
1239
- useEffect4(() => {
488
+ useEffect(() => {
1240
489
  setRegistered([]);
1241
490
  setSelectedId(null);
1242
491
  }, [page.id]);
1243
- const updateOverride = useCallback3(
492
+ const updateOverride = useCallback(
1244
493
  (id, value) => {
1245
494
  ctx.setOverride(id, value);
1246
495
  iframeRef.current?.contentWindow?.postMessage(
@@ -1251,33 +500,33 @@ function PageEditor({ page, showList, onToggleList }) {
1251
500
  [ctx]
1252
501
  );
1253
502
  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 })
503
+ const [viewMode, setViewMode] = useState("desktop");
504
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col", children: [
505
+ /* @__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: [
506
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
507
+ /* @__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" }) }),
508
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
509
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
510
+ /* @__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
511
  ] }),
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" }) })
512
+ /* @__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: [
513
+ /* @__PURE__ */ jsxs("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
514
+ /* @__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" }) }),
515
+ /* @__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" }) }),
516
+ /* @__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
517
  ] }),
1269
- /* @__PURE__ */ jsxs4(
518
+ /* @__PURE__ */ jsxs(
1270
519
  "button",
1271
520
  {
1272
521
  onClick: () => setPreview((v) => !v),
1273
522
  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
523
  children: [
1275
- preview ? /* @__PURE__ */ jsx5(Pencil, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx5(Monitor, { className: "h-3.5 w-3.5" }),
524
+ preview ? /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Monitor, { className: "h-3.5 w-3.5" }),
1276
525
  preview ? "Edit" : "Preview"
1277
526
  ]
1278
527
  }
1279
528
  ),
1280
- /* @__PURE__ */ jsxs4(
529
+ /* @__PURE__ */ jsxs(
1281
530
  "a",
1282
531
  {
1283
532
  href: page.path,
@@ -1285,39 +534,39 @@ function PageEditor({ page, showList, onToggleList }) {
1285
534
  rel: "noreferrer",
1286
535
  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
536
  children: [
1288
- /* @__PURE__ */ jsx5(Upload, { className: "h-3.5 w-3.5" }),
537
+ /* @__PURE__ */ jsx(Upload, { className: "h-3.5 w-3.5" }),
1289
538
  "Open"
1290
539
  ]
1291
540
  }
1292
541
  ),
1293
- /* @__PURE__ */ jsxs4(
542
+ /* @__PURE__ */ jsxs(
1294
543
  "button",
1295
544
  {
1296
545
  onClick: () => ctx.reset(),
1297
546
  disabled: !ctx.isDirty,
1298
547
  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
548
  children: [
1300
- /* @__PURE__ */ jsx5(X, { className: "h-3.5 w-3.5" }),
549
+ /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }),
1301
550
  "Discard"
1302
551
  ]
1303
552
  }
1304
553
  ),
1305
- /* @__PURE__ */ jsxs4(
554
+ /* @__PURE__ */ jsxs(
1306
555
  "button",
1307
556
  {
1308
557
  onClick: () => ctx.save(),
1309
558
  disabled: !ctx.isDirty,
1310
559
  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
560
  children: [
1312
- /* @__PURE__ */ jsx5(Boxes, { className: "h-3.5 w-3.5" }),
561
+ /* @__PURE__ */ jsx(Boxes, { className: "h-3.5 w-3.5" }),
1313
562
  "Save"
1314
563
  ]
1315
564
  }
1316
565
  )
1317
566
  ] })
1318
567
  ] }),
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(
568
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
569
+ /* @__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
570
  "iframe",
1322
571
  {
1323
572
  ref: iframeRef,
@@ -1328,36 +577,36 @@ function PageEditor({ page, showList, onToggleList }) {
1328
577
  },
1329
578
  src
1330
579
  ) }) }),
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(
580
+ /* @__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: [
581
+ /* @__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: [
582
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
583
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
584
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:hidden", children: [
585
+ /* @__PURE__ */ jsx(
1337
586
  "button",
1338
587
  {
1339
588
  onClick: () => setDrawerState((prev) => prev === "full" ? "half" : prev === "half" ? "min" : "half"),
1340
589
  className: "p-1 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded",
1341
590
  title: "Shrink",
1342
- children: /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4" })
591
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
1343
592
  }
1344
593
  ),
1345
- /* @__PURE__ */ jsx5(
594
+ /* @__PURE__ */ jsx(
1346
595
  "button",
1347
596
  {
1348
597
  onClick: () => setDrawerState((prev) => prev === "min" ? "half" : prev === "half" ? "full" : "half"),
1349
598
  className: "p-1 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded",
1350
599
  title: "Expand",
1351
- children: /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4" })
600
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "w-4 h-4" })
1352
601
  }
1353
602
  )
1354
603
  ] }),
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" })
604
+ 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
605
  ] })
1357
606
  ] }),
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(
607
+ /* @__PURE__ */ jsxs("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
608
+ !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." }) }),
609
+ selectedMeta ? /* @__PURE__ */ jsx(
1361
610
  FieldEditor,
1362
611
  {
1363
612
  meta: selectedMeta,
@@ -1377,10 +626,10 @@ function PageEditor({ page, showList, onToggleList }) {
1377
626
  },
1378
627
  onClose: () => setSelectedId(null)
1379
628
  }
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(
629
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
630
+ page.hideable && /* @__PURE__ */ jsxs("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
631
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3", children: [
632
+ /* @__PURE__ */ jsx(
1384
633
  "input",
1385
634
  {
1386
635
  type: "checkbox",
@@ -1390,11 +639,11 @@ function PageEditor({ page, showList, onToggleList }) {
1390
639
  className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1391
640
  }
1392
641
  ),
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" })
642
+ /* @__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
643
  ] }),
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." })
644
+ /* @__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
645
  ] }),
1397
- /* @__PURE__ */ jsx5(
646
+ /* @__PURE__ */ jsx(
1398
647
  SectionAccordion,
1399
648
  {
1400
649
  registered,
@@ -1418,10 +667,10 @@ function SectionAccordion({
1418
667
  registered,
1419
668
  onSelect
1420
669
  }) {
1421
- const [expanded, setExpanded] = useState5({});
670
+ const [expanded, setExpanded] = useState({});
1422
671
  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" }) }),
672
+ return /* @__PURE__ */ jsxs("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
673
+ /* @__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
674
  "No editable fields detected on this page."
1426
675
  ] });
1427
676
  }
@@ -1434,23 +683,23 @@ function SectionAccordion({
1434
683
  const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
1435
684
  const unsectionedFields = groups["Unsectioned"] || [];
1436
685
  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)) }),
686
+ return /* @__PURE__ */ jsxs("div", { className: "p-2 space-y-3", children: [
687
+ 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
688
  sectionNames.map((sectionName) => {
1440
689
  const isOpen = expanded[sectionName] ?? false;
1441
690
  const fields = groups[sectionName];
1442
- return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
1443
- /* @__PURE__ */ jsxs4(
691
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
692
+ /* @__PURE__ */ jsxs(
1444
693
  "button",
1445
694
  {
1446
695
  onClick: () => toggle(sectionName),
1447
696
  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
697
  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 })
698
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
699
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
700
+ /* @__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
701
  ] }),
1453
- /* @__PURE__ */ jsx5(
702
+ /* @__PURE__ */ jsx(
1454
703
  "svg",
1455
704
  {
1456
705
  className: `h-4 w-4 text-slate-400 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`,
@@ -1458,35 +707,35 @@ function SectionAccordion({
1458
707
  viewBox: "0 0 24 24",
1459
708
  stroke: "currentColor",
1460
709
  strokeWidth: 2,
1461
- children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
710
+ children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
1462
711
  }
1463
712
  )
1464
713
  ]
1465
714
  }
1466
715
  ),
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)) })
716
+ 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
717
  ] }, sectionName);
1469
718
  })
1470
719
  ] });
1471
720
  }
1472
721
  function FieldListItem({ meta, onSelect }) {
1473
- return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs4(
722
+ return /* @__PURE__ */ jsx("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs(
1474
723
  "button",
1475
724
  {
1476
725
  onClick: () => onSelect(meta.id),
1477
726
  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
727
  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: [
728
+ /* @__PURE__ */ jsxs("span", { className: "overflow-hidden", children: [
729
+ /* @__PURE__ */ jsx("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
730
+ /* @__PURE__ */ jsxs("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
1482
731
  meta.type,
1483
732
  " ",
1484
- /* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
733
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
1485
734
  " ",
1486
735
  meta.id
1487
736
  ] })
1488
737
  ] }),
1489
- /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4 text-slate-300 group-hover:text-indigo-500 transition-colors shrink-0" })
738
+ /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-slate-300 group-hover:text-indigo-500 transition-colors shrink-0" })
1490
739
  ]
1491
740
  }
1492
741
  ) });
@@ -1494,10 +743,10 @@ function FieldListItem({ meta, onSelect }) {
1494
743
  function SidebarReferenceSelect({ meta, value, onChange }) {
1495
744
  const ctx = useCmsContext();
1496
745
  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(() => {
746
+ const [items, setItems] = useState([]);
747
+ const [search, setSearch] = useState("");
748
+ const [loading, setLoading] = useState(true);
749
+ useEffect(() => {
1501
750
  if (!meta.collection) return;
1502
751
  setLoading(true);
1503
752
  ctx.adapter.listEntries(meta.collection).then((res) => {
@@ -1526,8 +775,8 @@ function SidebarReferenceSelect({ meta, value, onChange }) {
1526
775
  const txt = String(it[txtField?.id || "id"] || "");
1527
776
  return txt.toLowerCase().includes(q);
1528
777
  });
1529
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1530
- /* @__PURE__ */ jsx5(
778
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
779
+ /* @__PURE__ */ jsx(
1531
780
  "input",
1532
781
  {
1533
782
  placeholder: "Search...",
@@ -1536,26 +785,26 @@ function SidebarReferenceSelect({ meta, value, onChange }) {
1536
785
  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
786
  }
1538
787
  ),
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) => {
788
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 max-h-60 overflow-y-auto pr-1", children: [
789
+ loading ? /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Loading..." }) : filtered.map((it) => {
1541
790
  const isSelected = selectedIds.includes(it.id);
1542
791
  const imgSrc = imgField ? it[imgField.id] : null;
1543
792
  const label = txtField ? it[txtField.id] : it.id;
1544
- return /* @__PURE__ */ jsxs4(
793
+ return /* @__PURE__ */ jsxs(
1545
794
  "div",
1546
795
  {
1547
796
  onClick: () => toggle(it.id),
1548
797
  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
798
  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" })
799
+ !!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" }),
800
+ /* @__PURE__ */ jsx("span", { className: `text-sm ${isSelected ? "font-semibold text-indigo-900" : "text-slate-700"}`, children: String(label) }),
801
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-indigo-600 ml-auto" })
1553
802
  ]
1554
803
  },
1555
804
  it.id
1556
805
  );
1557
806
  }),
1558
- !loading && filtered.length === 0 && /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500 text-center py-4", children: "No items found." })
807
+ !loading && filtered.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500 text-center py-4", children: "No items found." })
1559
808
  ] })
1560
809
  ] });
1561
810
  }
@@ -1567,19 +816,19 @@ function FieldEditor({
1567
816
  onClose
1568
817
  }) {
1569
818
  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 })
819
+ const [expandedItems, setExpandedItems] = useState({});
820
+ const [searchQuery, setSearchQuery] = useState("");
821
+ const [listDragIdx, setListDragIdx] = useState(null);
822
+ const [listDragOverIdx, setListDragOverIdx] = useState(null);
823
+ return /* @__PURE__ */ jsxs("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
824
+ /* @__PURE__ */ jsxs("div", { className: "mb-5", children: [
825
+ /* @__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 }),
826
+ /* @__PURE__ */ jsx("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
827
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
1579
828
  ] }),
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(
829
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
830
+ meta.type === "boolean" && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3 py-1", children: [
831
+ /* @__PURE__ */ jsx(
1583
832
  "input",
1584
833
  {
1585
834
  type: "checkbox",
@@ -1589,9 +838,9 @@ function FieldEditor({
1589
838
  className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
1590
839
  }
1591
840
  ),
1592
- /* @__PURE__ */ jsx5("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
841
+ /* @__PURE__ */ jsx("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
1593
842
  ] }),
1594
- meta.type === "text" && /* @__PURE__ */ jsx5(
843
+ meta.type === "text" && /* @__PURE__ */ jsx(
1595
844
  "input",
1596
845
  {
1597
846
  type: "text",
@@ -1600,7 +849,7 @@ function FieldEditor({
1600
849
  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
850
  }
1602
851
  ),
1603
- meta.type === "textarea" && /* @__PURE__ */ jsx5(
852
+ meta.type === "textarea" && /* @__PURE__ */ jsx(
1604
853
  "textarea",
1605
854
  {
1606
855
  value: String(value ?? ""),
@@ -1609,9 +858,9 @@ function FieldEditor({
1609
858
  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
859
  }
1611
860
  ),
1612
- meta.type === "image" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1613
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
1614
- /* @__PURE__ */ jsx5(
861
+ meta.type === "image" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
862
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
863
+ /* @__PURE__ */ jsx(
1615
864
  "input",
1616
865
  {
1617
866
  type: "url",
@@ -1621,9 +870,9 @@ function FieldEditor({
1621
870
  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
871
  }
1623
872
  ),
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: [
873
+ /* @__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
874
  "Upload",
1626
- /* @__PURE__ */ jsx5(
875
+ /* @__PURE__ */ jsx(
1627
876
  "input",
1628
877
  {
1629
878
  type: "file",
@@ -1639,8 +888,8 @@ function FieldEditor({
1639
888
  )
1640
889
  ] })
1641
890
  ] }),
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(
891
+ value ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
892
+ /* @__PURE__ */ jsx(
1644
893
  "img",
1645
894
  {
1646
895
  src: String(value),
@@ -1648,7 +897,7 @@ function FieldEditor({
1648
897
  className: "max-h-48 w-full object-contain rounded-lg"
1649
898
  }
1650
899
  ),
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" }) })
900
+ /* @__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
901
  ] }) : null
1653
902
  ] }),
1654
903
  meta.type === "file" && (() => {
@@ -1656,9 +905,9 @@ function FieldEditor({
1656
905
  const strVal = String(currentVal ?? "");
1657
906
  const isVideo = strVal.match(/\.(mp4|webm|ogg|mov)(\?.*)?$/i) || strVal.includes("video");
1658
907
  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(
908
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
909
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
910
+ /* @__PURE__ */ jsx(
1662
911
  "input",
1663
912
  {
1664
913
  type: "url",
@@ -1668,9 +917,9 @@ function FieldEditor({
1668
917
  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
918
  }
1670
919
  ),
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: [
920
+ /* @__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
921
  "Subir",
1673
- /* @__PURE__ */ jsx5(
922
+ /* @__PURE__ */ jsx(
1674
923
  "input",
1675
924
  {
1676
925
  type: "file",
@@ -1686,8 +935,8 @@ function FieldEditor({
1686
935
  )
1687
936
  ] })
1688
937
  ] }),
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(
938
+ 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: [
939
+ /* @__PURE__ */ jsx(
1691
940
  "video",
1692
941
  {
1693
942
  src: strVal,
@@ -1700,15 +949,15 @@ function FieldEditor({
1700
949
  },
1701
950
  strVal
1702
951
  ),
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: [
952
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-slate-300 font-mono truncate px-1 pt-1.5 flex items-center gap-1.5", children: [
953
+ /* @__PURE__ */ jsx("span", { className: "inline-block w-2 h-2 rounded-full bg-emerald-400 animate-pulse" }),
954
+ /* @__PURE__ */ jsxs("span", { className: "truncate", children: [
1706
955
  "\u{1F3AC} ",
1707
956
  strVal
1708
957
  ] })
1709
958
  ] })
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(
959
+ ] }) : isImg ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-2 bg-slate-50 overflow-hidden shadow-sm", children: [
960
+ /* @__PURE__ */ jsx(
1712
961
  "img",
1713
962
  {
1714
963
  src: strVal,
@@ -1716,13 +965,13 @@ function FieldEditor({
1716
965
  className: "max-h-52 w-full object-contain rounded-lg"
1717
966
  }
1718
967
  ),
1719
- /* @__PURE__ */ jsxs4("div", { className: "text-[10px] text-slate-500 font-mono truncate px-1 pt-1.5", children: [
968
+ /* @__PURE__ */ jsxs("div", { className: "text-[10px] text-slate-500 font-mono truncate px-1 pt-1.5", children: [
1720
969
  "\u{1F5BC}\uFE0F ",
1721
970
  strVal
1722
971
  ] })
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 })
972
+ ] }) : /* @__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: [
973
+ /* @__PURE__ */ jsx("span", { children: "\u{1F4C4} Archivo:" }),
974
+ /* @__PURE__ */ jsx("span", { className: "truncate text-indigo-600 font-semibold", children: strVal })
1726
975
  ] }) }) : null
1727
976
  ] });
1728
977
  })(),
@@ -1731,10 +980,10 @@ function FieldEditor({
1731
980
  const currentObj = value || {};
1732
981
  const currentText = currentObj.text !== void 0 ? currentObj.text : defaultObj.text ?? "";
1733
982
  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(
983
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
984
+ /* @__PURE__ */ jsxs("label", { className: "block", children: [
985
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Texto del Enlace" }),
986
+ /* @__PURE__ */ jsx(
1738
987
  "input",
1739
988
  {
1740
989
  value: currentText,
@@ -1748,9 +997,9 @@ function FieldEditor({
1748
997
  }
1749
998
  )
1750
999
  ] }),
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(
1000
+ /* @__PURE__ */ jsxs("label", { className: "block", children: [
1001
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL de Destino" }),
1002
+ /* @__PURE__ */ jsx(
1754
1003
  "input",
1755
1004
  {
1756
1005
  value: currentHref,
@@ -1766,8 +1015,8 @@ function FieldEditor({
1766
1015
  ] })
1767
1016
  ] });
1768
1017
  })(),
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(
1018
+ meta.type === "color" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
1019
+ /* @__PURE__ */ jsx(
1771
1020
  "input",
1772
1021
  {
1773
1022
  type: "color",
@@ -1776,7 +1025,7 @@ function FieldEditor({
1776
1025
  className: "h-10 w-16 cursor-pointer rounded bg-transparent border-0 p-0"
1777
1026
  }
1778
1027
  ),
1779
- /* @__PURE__ */ jsx5(
1028
+ /* @__PURE__ */ jsx(
1780
1029
  "input",
1781
1030
  {
1782
1031
  type: "text",
@@ -1786,7 +1035,7 @@ function FieldEditor({
1786
1035
  }
1787
1036
  )
1788
1037
  ] }),
1789
- meta.type === "richtext" && /* @__PURE__ */ jsx5(
1038
+ meta.type === "richtext" && /* @__PURE__ */ jsx(
1790
1039
  "textarea",
1791
1040
  {
1792
1041
  value: String(value ?? ""),
@@ -1795,10 +1044,10 @@ function FieldEditor({
1795
1044
  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
1045
  }
1797
1046
  ),
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(
1047
+ meta.type === "list" && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1048
+ meta.search && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1049
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
1050
+ /* @__PURE__ */ jsx(
1802
1051
  "input",
1803
1052
  {
1804
1053
  type: "text",
@@ -1816,7 +1065,7 @@ function FieldEditor({
1816
1065
  }
1817
1066
  const isExpanded = expandedItems[idx] ?? false;
1818
1067
  const isReorderable = !!(meta.reorderable || meta.sortable);
1819
- return /* @__PURE__ */ jsxs4(
1068
+ return /* @__PURE__ */ jsxs(
1820
1069
  "div",
1821
1070
  {
1822
1071
  draggable: isReorderable,
@@ -1848,23 +1097,23 @@ function FieldEditor({
1848
1097
  } : void 0,
1849
1098
  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
1099
  children: [
1851
- /* @__PURE__ */ jsxs4("div", { className: "space-y-3 w-full min-w-0", children: [
1852
- /* @__PURE__ */ jsxs4(
1100
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 w-full min-w-0", children: [
1101
+ /* @__PURE__ */ jsxs(
1853
1102
  "div",
1854
1103
  {
1855
1104
  className: "flex items-center justify-between cursor-pointer py-1 select-none gap-2",
1856
1105
  onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
1857
1106
  children: [
1858
- isReorderable && /* @__PURE__ */ jsxs4(
1107
+ isReorderable && /* @__PURE__ */ jsxs(
1859
1108
  "div",
1860
1109
  {
1861
1110
  className: "flex items-center gap-1 text-slate-400 select-none shrink-0",
1862
1111
  title: "Drag or use arrows to reorder",
1863
1112
  onClick: (e) => e.stopPropagation(),
1864
1113
  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(
1114
+ /* @__PURE__ */ jsx(GripVertical, { className: "w-4 h-4 cursor-grab active:cursor-grabbing hover:text-indigo-600" }),
1115
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
1116
+ /* @__PURE__ */ jsx(
1868
1117
  "button",
1869
1118
  {
1870
1119
  type: "button",
@@ -1879,10 +1128,10 @@ function FieldEditor({
1879
1128
  },
1880
1129
  className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
1881
1130
  title: "Move Up",
1882
- children: /* @__PURE__ */ jsx5(ChevronUp, { className: "w-3.5 h-3.5" })
1131
+ children: /* @__PURE__ */ jsx(ChevronUp, { className: "w-3.5 h-3.5" })
1883
1132
  }
1884
1133
  ),
1885
- /* @__PURE__ */ jsx5(
1134
+ /* @__PURE__ */ jsx(
1886
1135
  "button",
1887
1136
  {
1888
1137
  type: "button",
@@ -1897,21 +1146,21 @@ function FieldEditor({
1897
1146
  },
1898
1147
  className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
1899
1148
  title: "Move Down",
1900
- children: /* @__PURE__ */ jsx5(ChevronDown, { className: "w-3.5 h-3.5" })
1149
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-3.5 h-3.5" })
1901
1150
  }
1902
1151
  )
1903
1152
  ] })
1904
1153
  ]
1905
1154
  }
1906
1155
  ),
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" })
1156
+ /* @__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) }),
1157
+ 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
1158
  ]
1910
1159
  }
1911
1160
  ),
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(
1161
+ 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: [
1162
+ /* @__PURE__ */ jsx("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
1163
+ schemaField.type === "icon" ? /* @__PURE__ */ jsx(
1915
1164
  SearchableSelect,
1916
1165
  {
1917
1166
  value: String(item?.[schemaField.key] ?? (Array.isArray(meta.defaultValue) ? meta.defaultValue[idx]?.[schemaField.key] : "") ?? ""),
@@ -1924,7 +1173,7 @@ function FieldEditor({
1924
1173
  onChange(arr);
1925
1174
  }
1926
1175
  }
1927
- ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
1176
+ ) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx(
1928
1177
  "textarea",
1929
1178
  {
1930
1179
  rows: 3,
@@ -1936,8 +1185,8 @@ function FieldEditor({
1936
1185
  },
1937
1186
  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
1187
  }
1939
- ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1940
- /* @__PURE__ */ jsx5(
1188
+ ) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
1189
+ /* @__PURE__ */ jsx(
1941
1190
  "input",
1942
1191
  {
1943
1192
  type: "checkbox",
@@ -1950,10 +1199,10 @@ function FieldEditor({
1950
1199
  className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
1951
1200
  }
1952
1201
  ),
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(
1202
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
1203
+ ] }) : schemaField.type === "image" || schemaField.type === "file" || schemaField.type === "video" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3 mt-1", children: [
1204
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1205
+ /* @__PURE__ */ jsx(
1957
1206
  "input",
1958
1207
  {
1959
1208
  type: "url",
@@ -1967,9 +1216,9 @@ function FieldEditor({
1967
1216
  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
1217
  }
1969
1218
  ),
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: [
1219
+ /* @__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
1220
  "Upload",
1972
- /* @__PURE__ */ jsx5(
1221
+ /* @__PURE__ */ jsx(
1973
1222
  "input",
1974
1223
  {
1975
1224
  type: "file",
@@ -1993,14 +1242,14 @@ function FieldEditor({
1993
1242
  )
1994
1243
  ] })
1995
1244
  ] }),
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(
1245
+ 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
1246
  "video",
1998
1247
  {
1999
1248
  src: String(item?.[schemaField.key]),
2000
1249
  controls: true,
2001
1250
  className: "w-full h-auto max-h-32 object-contain rounded-md"
2002
1251
  }
2003
- ) : /* @__PURE__ */ jsx5(
1252
+ ) : /* @__PURE__ */ jsx(
2004
1253
  "img",
2005
1254
  {
2006
1255
  src: String(item?.[schemaField.key]),
@@ -2008,7 +1257,7 @@ function FieldEditor({
2008
1257
  className: "w-full h-auto max-h-32 object-contain rounded-md"
2009
1258
  }
2010
1259
  ) }) : null
2011
- ] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
1260
+ ] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx(
2012
1261
  "select",
2013
1262
  {
2014
1263
  value: String(item?.[schemaField.key] ?? ""),
@@ -2018,9 +1267,9 @@ function FieldEditor({
2018
1267
  onChange(arr);
2019
1268
  },
2020
1269
  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))
1270
+ children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
2022
1271
  }
2023
- ) : schemaField.type === "number" ? /* @__PURE__ */ jsx5(
1272
+ ) : schemaField.type === "number" ? /* @__PURE__ */ jsx(
2024
1273
  FormattedNumberInput,
2025
1274
  {
2026
1275
  value: item?.[schemaField.key],
@@ -2032,7 +1281,7 @@ function FieldEditor({
2032
1281
  isPrice: schemaField.key.toLowerCase().includes("price") || schemaField.key.toLowerCase().includes("precio"),
2033
1282
  className: "rounded-lg px-3 py-2 text-sm"
2034
1283
  }
2035
- ) : /* @__PURE__ */ jsx5(
1284
+ ) : /* @__PURE__ */ jsx(
2036
1285
  "input",
2037
1286
  {
2038
1287
  type: "text",
@@ -2045,7 +1294,7 @@ function FieldEditor({
2045
1294
  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
1295
  }
2047
1296
  )
2048
- ] }, schemaField.key)) : /* @__PURE__ */ jsx5(
1297
+ ] }, schemaField.key)) : /* @__PURE__ */ jsx(
2049
1298
  "input",
2050
1299
  {
2051
1300
  type: "text",
@@ -2059,7 +1308,7 @@ function FieldEditor({
2059
1308
  }
2060
1309
  ) })
2061
1310
  ] }),
2062
- !meta.fixedLength && /* @__PURE__ */ jsx5(
1311
+ !meta.fixedLength && /* @__PURE__ */ jsx(
2063
1312
  "button",
2064
1313
  {
2065
1314
  onClick: () => {
@@ -2068,7 +1317,7 @@ function FieldEditor({
2068
1317
  onChange(arr);
2069
1318
  },
2070
1319
  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" })
1320
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2072
1321
  }
2073
1322
  )
2074
1323
  ]
@@ -2076,7 +1325,7 @@ function FieldEditor({
2076
1325
  idx
2077
1326
  );
2078
1327
  }),
2079
- !meta.fixedLength && /* @__PURE__ */ jsxs4(
1328
+ !meta.fixedLength && /* @__PURE__ */ jsxs(
2080
1329
  "button",
2081
1330
  {
2082
1331
  onClick: () => {
@@ -2105,27 +1354,27 @@ function FieldEditor({
2105
1354
  },
2106
1355
  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
1356
  children: [
2108
- /* @__PURE__ */ jsx5(Plus, { className: "w-4 h-4" }),
1357
+ /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
2109
1358
  " Add Item"
2110
1359
  ]
2111
1360
  }
2112
1361
  )
2113
1362
  ] }),
2114
- meta.type === "reference" && /* @__PURE__ */ jsx5(SidebarReferenceSelect, { meta, value, onChange })
1363
+ meta.type === "reference" && /* @__PURE__ */ jsx(SidebarReferenceSelect, { meta, value, onChange })
2115
1364
  ] }),
2116
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
2117
- /* @__PURE__ */ jsxs4(
1365
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
1366
+ /* @__PURE__ */ jsxs(
2118
1367
  "button",
2119
1368
  {
2120
1369
  onClick: onReset,
2121
1370
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 hover:text-slate-900 transition-colors",
2122
1371
  children: [
2123
- /* @__PURE__ */ jsx5(RotateCcw, { className: "h-3.5 w-3.5" }),
1372
+ /* @__PURE__ */ jsx(RotateCcw, { className: "h-3.5 w-3.5" }),
2124
1373
  " Reset Default"
2125
1374
  ]
2126
1375
  }
2127
1376
  ),
2128
- /* @__PURE__ */ jsx5(
1377
+ /* @__PURE__ */ jsx(
2129
1378
  "button",
2130
1379
  {
2131
1380
  onClick: onClose,
@@ -2139,24 +1388,24 @@ function FieldEditor({
2139
1388
  function CollectionsSection() {
2140
1389
  const ctx = useCmsContext();
2141
1390
  const collections = ctx.config.collections ?? [];
2142
- const [selected, setSelected] = useState5(
1391
+ const [selected, setSelected] = useState(
2143
1392
  collections.find((c) => !c.isSeparator) ?? null
2144
1393
  );
2145
- const [counts, setCounts] = useState5({});
2146
- useEffect4(() => {
1394
+ const [counts, setCounts] = useState({});
1395
+ useEffect(() => {
2147
1396
  collections.filter((c) => !c.isSeparator).forEach((c) => {
2148
1397
  ctx.adapter.listEntries(c.id).then((entries) => {
2149
1398
  setCounts((prev) => ({ ...prev, [c.id]: entries.length }));
2150
1399
  });
2151
1400
  });
2152
1401
  }, [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: [
1402
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
1403
+ /* @__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: [
1404
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
1405
+ /* @__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
1406
  collections.map((c, idx) => {
2158
1407
  if (c.isSeparator) {
2159
- return /* @__PURE__ */ jsx5(
1408
+ return /* @__PURE__ */ jsx(
2160
1409
  "li",
2161
1410
  {
2162
1411
  className: "my-2 border-t border-slate-200/80"
@@ -2164,20 +1413,20 @@ function CollectionsSection() {
2164
1413
  c.id || `sep-${idx}`
2165
1414
  );
2166
1415
  }
2167
- return /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
1416
+ return /* @__PURE__ */ jsx("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs(
2168
1417
  "button",
2169
1418
  {
2170
1419
  onClick: () => setSelected(c),
2171
1420
  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
1421
  children: [
2173
- /* @__PURE__ */ jsx5(
1422
+ /* @__PURE__ */ jsx(
2174
1423
  "div",
2175
1424
  {
2176
1425
  className: selected?.id === c.id ? "text-slate-900" : "text-slate-700",
2177
1426
  children: c.name
2178
1427
  }
2179
1428
  ),
2180
- /* @__PURE__ */ jsxs4(
1429
+ /* @__PURE__ */ jsxs(
2181
1430
  "div",
2182
1431
  {
2183
1432
  className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`,
@@ -2191,29 +1440,29 @@ function CollectionsSection() {
2191
1440
  }
2192
1441
  ) }, c.id);
2193
1442
  }),
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." })
1443
+ 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
1444
  ] })
2196
1445
  ] }),
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." })
1446
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
1447
+ /* @__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" }),
1448
+ 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
1449
  ] })
2201
1450
  ] });
2202
1451
  }
2203
1452
  function CollectionEditor({ collection }) {
2204
1453
  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);
1454
+ const [entries, setEntries] = useState([]);
1455
+ const [editing, setEditing] = useState(null);
1456
+ const [saving, setSaving] = useState(false);
1457
+ const [deletingId, setDeletingId] = useState(null);
1458
+ const [loadingEntries, setLoadingEntries] = useState(true);
1459
+ const [draggedIdx, setDraggedIdx] = useState(null);
1460
+ const [dragOverIdx, setDragOverIdx] = useState(null);
1461
+ const [search, setSearch] = useState("");
1462
+ const [filters, setFilters] = useState({});
1463
+ const [page, setPage] = useState(1);
2215
1464
  const itemsPerPage = 10;
2216
- const load = useCallback3(() => {
1465
+ const load = useCallback(() => {
2217
1466
  setLoadingEntries(true);
2218
1467
  ctx.adapter.listEntries(collection.id).then((res) => {
2219
1468
  const sorted = [...res].sort((a, b) => {
@@ -2225,7 +1474,7 @@ function CollectionEditor({ collection }) {
2225
1474
  setLoadingEntries(false);
2226
1475
  }).catch(() => setLoadingEntries(false));
2227
1476
  }, [ctx.adapter, collection.id]);
2228
- useEffect4(() => {
1477
+ useEffect(() => {
2229
1478
  load();
2230
1479
  }, [load]);
2231
1480
  const startNew = () => {
@@ -2318,6 +1567,7 @@ function CollectionEditor({ collection }) {
2318
1567
  newEntries[i].order = i;
2319
1568
  await ctx.adapter.putEntry(collection.id, newEntries[i]);
2320
1569
  }
1570
+ ctx.notifyCollectionChanged();
2321
1571
  };
2322
1572
  const onDragEnd = (e) => {
2323
1573
  const target = e.target;
@@ -2327,28 +1577,28 @@ function CollectionEditor({ collection }) {
2327
1577
  };
2328
1578
  const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order" && !f.hidden).slice(0, 5);
2329
1579
  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 })
1580
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl", children: [
1581
+ /* @__PURE__ */ jsxs("div", { className: "mb-8 flex items-center justify-between", children: [
1582
+ /* @__PURE__ */ jsxs("div", { children: [
1583
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
1584
+ collection.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
2335
1585
  ] }),
2336
- /* @__PURE__ */ jsxs4(
1586
+ /* @__PURE__ */ jsxs(
2337
1587
  "button",
2338
1588
  {
2339
1589
  onClick: startNew,
2340
1590
  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
1591
  children: [
2342
- /* @__PURE__ */ jsx5(Plus, { className: "h-4 w-4" }),
1592
+ /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
2343
1593
  " New Entry"
2344
1594
  ]
2345
1595
  }
2346
1596
  )
2347
1597
  ] }),
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(
1598
+ !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: [
1599
+ collection.searchBy?.length ? /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-[200px]", children: [
1600
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
1601
+ /* @__PURE__ */ jsx(
2352
1602
  "input",
2353
1603
  {
2354
1604
  type: "text",
@@ -2366,8 +1616,8 @@ function CollectionEditor({ collection }) {
2366
1616
  const fieldDef = collection.fields.find((cf) => cf.id === f);
2367
1617
  const uniqueVals = Array.from(new Set(entries.map((e) => String(e[f] || "")))).filter(Boolean);
2368
1618
  if (!fieldDef || uniqueVals.length === 0) return null;
2369
- return /* @__PURE__ */ jsxs4("div", { className: "min-w-[150px] relative", children: [
2370
- /* @__PURE__ */ jsxs4(
1619
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-[150px] relative", children: [
1620
+ /* @__PURE__ */ jsxs(
2371
1621
  "select",
2372
1622
  {
2373
1623
  value: filters[f] || "",
@@ -2377,24 +1627,24 @@ function CollectionEditor({ collection }) {
2377
1627
  },
2378
1628
  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
1629
  children: [
2380
- /* @__PURE__ */ jsxs4("option", { value: "", children: [
1630
+ /* @__PURE__ */ jsxs("option", { value: "", children: [
2381
1631
  "All ",
2382
1632
  fieldDef.label
2383
1633
  ] }),
2384
- uniqueVals.map((v) => /* @__PURE__ */ jsx5("option", { value: v, children: v }, v))
1634
+ uniqueVals.map((v) => /* @__PURE__ */ jsx("option", { value: v, children: v }, v))
2385
1635
  ]
2386
1636
  }
2387
1637
  ),
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" })
1638
+ /* @__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
1639
  ] }, f);
2390
1640
  })
2391
1641
  ] }),
2392
- /* @__PURE__ */ jsx5(
1642
+ /* @__PURE__ */ jsx(
2393
1643
  Modal,
2394
1644
  {
2395
1645
  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" }),
1646
+ title: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-slate-900", children: [
1647
+ isCreatingEntry ? /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 text-indigo-600" }) : /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-indigo-600" }),
2398
1648
  isCreatingEntry ? "Create Entry" : "Edit Entry"
2399
1649
  ] }),
2400
1650
  onCancel: () => {
@@ -2419,13 +1669,13 @@ function CollectionEditor({ collection }) {
2419
1669
  backdropFilter: "blur(8px)"
2420
1670
  }
2421
1671
  },
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: [
1672
+ children: editing && /* @__PURE__ */ jsxs("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
1673
+ /* @__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 === "textarea" || f.type === "list" || f.type === "branch-settings" || f.type === "time-range" ? "lg:col-span-2" : ""}`, children: [
1674
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
2425
1675
  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 })
1676
+ /* @__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
1677
  ] }),
2428
- f.type === "branch-settings" ? /* @__PURE__ */ jsx5(
1678
+ f.type === "branch-settings" ? /* @__PURE__ */ jsx(
2429
1679
  BranchSettingsEditor,
2430
1680
  {
2431
1681
  collectionId: f.collection || "",
@@ -2434,15 +1684,21 @@ function CollectionEditor({ collection }) {
2434
1684
  globalDiscount: Number(editing.discountPercent) || 0,
2435
1685
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2436
1686
  }
2437
- ) : f.type === "boolean" ? /* @__PURE__ */ jsx5("div", { className: "mt-1 h-10 flex items-center", children: /* @__PURE__ */ jsx5(
2438
- "input",
2439
- {
2440
- type: "checkbox",
2441
- checked: !!editing[f.id],
2442
- onChange: (e) => setEditing({ ...editing, [f.id]: e.target.checked }),
2443
- className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
2444
- }
2445
- ) }) : f.type === "number" ? /* @__PURE__ */ jsx5(
1687
+ ) : f.type === "boolean" ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-3", children: [
1688
+ /* @__PURE__ */ jsxs("label", { className: "relative inline-flex items-center cursor-pointer select-none", children: [
1689
+ /* @__PURE__ */ jsx(
1690
+ "input",
1691
+ {
1692
+ type: "checkbox",
1693
+ checked: !!editing[f.id],
1694
+ onChange: (e) => setEditing({ ...editing, [f.id]: e.target.checked }),
1695
+ className: "sr-only peer"
1696
+ }
1697
+ ),
1698
+ /* @__PURE__ */ jsx("div", { className: "w-11 h-6 bg-slate-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600" })
1699
+ ] }),
1700
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-slate-700", children: editing[f.id] ? "Activado / S\xED" : "Desactivado / No" })
1701
+ ] }) : f.type === "number" ? /* @__PURE__ */ jsx(
2446
1702
  FormattedNumberInput,
2447
1703
  {
2448
1704
  value: editing[f.id],
@@ -2450,8 +1706,8 @@ function CollectionEditor({ collection }) {
2450
1706
  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
1707
  isPercent: f.id.toLowerCase().includes("discount") || f.id.toLowerCase().includes("descuento") || f.label.toLowerCase().includes("descuento")
2452
1708
  }
2453
- ) : f.type === "time-range" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", children: [
2454
- /* @__PURE__ */ jsx5(
1709
+ ) : f.type === "time-range" ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
1710
+ /* @__PURE__ */ jsx(
2455
1711
  AdminTimeRangePicker,
2456
1712
  {
2457
1713
  value: [
@@ -2473,8 +1729,8 @@ function CollectionEditor({ collection }) {
2473
1729
  use12Hours: true
2474
1730
  }
2475
1731
  ),
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(
1732
+ /* @__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." })
1733
+ ] }) : f.type === "time" ? /* @__PURE__ */ jsx(
2478
1734
  AdminTimePicker,
2479
1735
  {
2480
1736
  value: toDayjsTime(editing[f.id]),
@@ -2483,25 +1739,26 @@ function CollectionEditor({ collection }) {
2483
1739
  format: TIME_DISPLAY_FORMAT,
2484
1740
  use12Hours: true
2485
1741
  }
2486
- ) : f.type === "richtext" ? /* @__PURE__ */ jsx5(
1742
+ ) : f.type === "richtext" || f.type === "textarea" ? /* @__PURE__ */ jsx(
2487
1743
  "textarea",
2488
1744
  {
2489
1745
  value: String(editing[f.id] ?? ""),
2490
1746
  onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
2491
1747
  rows: 4,
2492
- 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"
1748
+ placeholder: `Escribe ${f.label.toLowerCase()}...`,
1749
+ 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-sans text-slate-800"
2493
1750
  }
2494
- ) : f.type === "icon" ? /* @__PURE__ */ jsx5(
1751
+ ) : f.type === "icon" ? /* @__PURE__ */ jsx(
2495
1752
  SearchableSelect,
2496
1753
  {
2497
1754
  value: String(editing[f.id] ?? ""),
2498
1755
  onChange: (val) => setEditing({ ...editing, [f.id]: val }),
2499
- options: f.options || [],
2500
- placeholder: `Search ${f.label.toLowerCase()}...`,
1756
+ options: f.options?.length ? f.options : ctx.iconMap ? Object.keys(ctx.iconMap) : [],
1757
+ placeholder: `Buscar icono ${f.label.toLowerCase()}...`,
2501
1758
  iconMap: ctx.iconMap
2502
1759
  }
2503
- ) : f.type === "slug" ? /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2504
- /* @__PURE__ */ jsx5(
1760
+ ) : f.type === "slug" ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1761
+ /* @__PURE__ */ jsx(
2505
1762
  "input",
2506
1763
  {
2507
1764
  type: "text",
@@ -2510,7 +1767,7 @@ function CollectionEditor({ collection }) {
2510
1767
  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
1768
  }
2512
1769
  ),
2513
- /* @__PURE__ */ jsx5(
1770
+ /* @__PURE__ */ jsx(
2514
1771
  "button",
2515
1772
  {
2516
1773
  type: "button",
@@ -2524,7 +1781,7 @@ function CollectionEditor({ collection }) {
2524
1781
  children: "Generate"
2525
1782
  }
2526
1783
  )
2527
- ] }) : f.type === "reference" || f.type === "select" && f.collection ? /* @__PURE__ */ jsx5(
1784
+ ] }) : f.type === "reference" || f.type === "select" && f.collection ? /* @__PURE__ */ jsx(
2528
1785
  ReferenceSelect,
2529
1786
  {
2530
1787
  collectionId: f.collection,
@@ -2537,30 +1794,30 @@ function CollectionEditor({ collection }) {
2537
1794
  value: editing[f.id],
2538
1795
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2539
1796
  }
2540
- ) : f.type === "select" ? /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
2541
- /* @__PURE__ */ jsxs4(
1797
+ ) : f.type === "select" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1798
+ /* @__PURE__ */ jsxs(
2542
1799
  "select",
2543
1800
  {
2544
1801
  value: String(editing[f.id] ?? ""),
2545
1802
  onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
2546
1803
  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
1804
  children: [
2548
- /* @__PURE__ */ jsx5("option", { value: "", children: "-- Selecciona una opci\xF3n --" }),
1805
+ /* @__PURE__ */ jsx("option", { value: "", children: "-- Selecciona una opci\xF3n --" }),
2549
1806
  f.options?.map((opt) => {
2550
1807
  const val = typeof opt === "string" ? opt : opt.value;
2551
1808
  const lab = typeof opt === "string" ? opt : opt.label;
2552
- return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
1809
+ return /* @__PURE__ */ jsx("option", { value: val, children: lab }, val);
2553
1810
  })
2554
1811
  ]
2555
1812
  }
2556
1813
  ),
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) => {
1814
+ /* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
1815
+ ] }) : f.type === "image" || f.type === "file" ? f.multiple ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1816
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => {
2560
1817
  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(
1818
+ 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: [
1819
+ 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" }),
1820
+ /* @__PURE__ */ jsx(
2564
1821
  "button",
2565
1822
  {
2566
1823
  type: "button",
@@ -2570,13 +1827,13 @@ function CollectionEditor({ collection }) {
2570
1827
  setEditing({ ...editing, [f.id]: arr });
2571
1828
  },
2572
1829
  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" })
1830
+ children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
2574
1831
  }
2575
1832
  )
2576
1833
  ] }, i);
2577
1834
  }) }),
2578
- (!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2579
- /* @__PURE__ */ jsx5(
1835
+ (!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1836
+ /* @__PURE__ */ jsx(
2580
1837
  "input",
2581
1838
  {
2582
1839
  type: "url",
@@ -2592,7 +1849,7 @@ function CollectionEditor({ collection }) {
2592
1849
  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
1850
  }
2594
1851
  ),
2595
- /* @__PURE__ */ jsx5(
1852
+ /* @__PURE__ */ jsx(
2596
1853
  FilePickerButton,
2597
1854
  {
2598
1855
  accept: "image/*,video/*",
@@ -2620,9 +1877,9 @@ function CollectionEditor({ collection }) {
2620
1877
  }
2621
1878
  )
2622
1879
  ] })
2623
- ] }) : /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
2624
- /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
2625
- /* @__PURE__ */ jsx5(
1880
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
1881
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
1882
+ /* @__PURE__ */ jsx(
2626
1883
  "input",
2627
1884
  {
2628
1885
  type: "url",
@@ -2632,7 +1889,7 @@ function CollectionEditor({ collection }) {
2632
1889
  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
1890
  }
2634
1891
  ),
2635
- /* @__PURE__ */ jsx5(
1892
+ /* @__PURE__ */ jsx(
2636
1893
  FilePickerButton,
2637
1894
  {
2638
1895
  accept: "image/*,video/*",
@@ -2653,14 +1910,14 @@ function CollectionEditor({ collection }) {
2653
1910
  }
2654
1911
  )
2655
1912
  ] }),
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(
1913
+ 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
1914
  "video",
2658
1915
  {
2659
1916
  src: String(editing[f.id]),
2660
1917
  controls: true,
2661
1918
  className: "w-full h-auto max-h-48 object-contain rounded-lg"
2662
1919
  }
2663
- ) : /* @__PURE__ */ jsx5(
1920
+ ) : /* @__PURE__ */ jsx(
2664
1921
  "img",
2665
1922
  {
2666
1923
  src: String(editing[f.id]),
@@ -2668,14 +1925,14 @@ function CollectionEditor({ collection }) {
2668
1925
  className: "w-full h-auto max-h-48 object-contain rounded-lg"
2669
1926
  }
2670
1927
  ) }) : null
2671
- ] }) : f.type === "password" ? /* @__PURE__ */ jsx5(
1928
+ ] }) : f.type === "password" ? /* @__PURE__ */ jsx(
2672
1929
  PasswordField,
2673
1930
  {
2674
1931
  value: String(editing[f.id] ?? ""),
2675
1932
  onChange: (val) => setEditing({ ...editing, [f.id]: val })
2676
1933
  }
2677
- ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
2678
- /* @__PURE__ */ jsx5(
1934
+ ) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1935
+ /* @__PURE__ */ jsx(
2679
1936
  "input",
2680
1937
  {
2681
1938
  type: "color",
@@ -2684,7 +1941,7 @@ function CollectionEditor({ collection }) {
2684
1941
  className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
2685
1942
  }
2686
1943
  ),
2687
- /* @__PURE__ */ jsx5(
1944
+ /* @__PURE__ */ jsx(
2688
1945
  "input",
2689
1946
  {
2690
1947
  type: "text",
@@ -2694,19 +1951,19 @@ function CollectionEditor({ collection }) {
2694
1951
  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
1952
  }
2696
1953
  ),
2697
- /* @__PURE__ */ jsx5(
1954
+ /* @__PURE__ */ jsx(
2698
1955
  "div",
2699
1956
  {
2700
1957
  className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
2701
1958
  style: { backgroundColor: String(editing[f.id] ?? "#000000") }
2702
1959
  }
2703
1960
  )
2704
- ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
1961
+ ] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
2705
1962
  (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
1963
  const colorVal = String(item ?? "").trim();
2707
1964
  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(
1965
+ return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
1966
+ /* @__PURE__ */ jsx(
2710
1967
  "input",
2711
1968
  {
2712
1969
  type: "color",
@@ -2719,7 +1976,7 @@ function CollectionEditor({ collection }) {
2719
1976
  className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
2720
1977
  }
2721
1978
  ),
2722
- /* @__PURE__ */ jsx5(
1979
+ /* @__PURE__ */ jsx(
2723
1980
  "input",
2724
1981
  {
2725
1982
  type: "text",
@@ -2733,14 +1990,14 @@ function CollectionEditor({ collection }) {
2733
1990
  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
1991
  }
2735
1992
  ),
2736
- /* @__PURE__ */ jsx5(
1993
+ /* @__PURE__ */ jsx(
2737
1994
  "div",
2738
1995
  {
2739
1996
  className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
2740
1997
  style: { backgroundColor: colorVal || "#000000" }
2741
1998
  }
2742
1999
  ),
2743
- /* @__PURE__ */ jsx5(
2000
+ /* @__PURE__ */ jsx(
2744
2001
  "button",
2745
2002
  {
2746
2003
  type: "button",
@@ -2750,12 +2007,12 @@ function CollectionEditor({ collection }) {
2750
2007
  setEditing({ ...editing, [f.id]: arr });
2751
2008
  },
2752
2009
  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" })
2010
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2754
2011
  }
2755
2012
  )
2756
2013
  ] }, idx);
2757
2014
  }),
2758
- /* @__PURE__ */ jsxs4(
2015
+ /* @__PURE__ */ jsxs(
2759
2016
  "button",
2760
2017
  {
2761
2018
  type: "button",
@@ -2766,41 +2023,51 @@ function CollectionEditor({ collection }) {
2766
2023
  },
2767
2024
  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
2025
  children: [
2769
- /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
2026
+ /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
2770
2027
  " Add Color"
2771
2028
  ]
2772
2029
  }
2773
2030
  )
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(
2777
- "input",
2778
- {
2779
- type: "text",
2780
- value: String(item ?? ""),
2781
- onChange: (e) => {
2782
- let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
2783
- arr[idx] = e.target.value;
2784
- setEditing({ ...editing, [f.id]: arr });
2785
- },
2786
- 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
- }
2788
- ),
2789
- /* @__PURE__ */ jsx5(
2790
- "button",
2791
- {
2792
- type: "button",
2793
- onClick: () => {
2794
- let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
2795
- arr.splice(idx, 1);
2796
- setEditing({ ...editing, [f.id]: arr });
2797
- },
2798
- 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" })
2800
- }
2801
- )
2802
- ] }, idx)),
2803
- /* @__PURE__ */ jsxs4(
2031
+ ] }) : f.type === "list" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
2032
+ (Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => {
2033
+ const isFeatures = f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") || f.label.toLowerCase().includes("beneficio");
2034
+ const placeholder = isFeatures ? `Caracter\xEDstica o beneficio ${idx + 1}...` : `Entregable o punto clave ${idx + 1}...`;
2035
+ return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
2036
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-mono font-bold text-slate-400 w-6 text-right shrink-0", children: [
2037
+ idx + 1,
2038
+ "."
2039
+ ] }),
2040
+ /* @__PURE__ */ jsx(
2041
+ "input",
2042
+ {
2043
+ type: "text",
2044
+ value: String(item ?? ""),
2045
+ placeholder,
2046
+ onChange: (e) => {
2047
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
2048
+ arr[idx] = e.target.value;
2049
+ setEditing({ ...editing, [f.id]: arr });
2050
+ },
2051
+ className: "flex-1 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 bg-white"
2052
+ }
2053
+ ),
2054
+ /* @__PURE__ */ jsx(
2055
+ "button",
2056
+ {
2057
+ type: "button",
2058
+ onClick: () => {
2059
+ let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
2060
+ arr.splice(idx, 1);
2061
+ setEditing({ ...editing, [f.id]: arr });
2062
+ },
2063
+ className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors cursor-pointer",
2064
+ title: "Eliminar elemento",
2065
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
2066
+ }
2067
+ )
2068
+ ] }, idx);
2069
+ }),
2070
+ /* @__PURE__ */ jsxs(
2804
2071
  "button",
2805
2072
  {
2806
2073
  type: "button",
@@ -2809,14 +2076,15 @@ function CollectionEditor({ collection }) {
2809
2076
  arr.push("");
2810
2077
  setEditing({ ...editing, [f.id]: arr });
2811
2078
  },
2812
- 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",
2079
+ className: "inline-flex items-center gap-1.5 px-3.5 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-bold rounded-xl border border-indigo-100 transition-colors cursor-pointer",
2813
2080
  children: [
2814
- /* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
2815
- " Add Item"
2081
+ /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
2082
+ " ",
2083
+ f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") ? "Agregar caracter\xEDstica uno a uno" : "Agregar entregable / punto uno a uno"
2816
2084
  ]
2817
2085
  }
2818
2086
  )
2819
- ] }) : /* @__PURE__ */ jsx5(
2087
+ ] }) : /* @__PURE__ */ jsx(
2820
2088
  "input",
2821
2089
  {
2822
2090
  value: String(editing[f.id] ?? ""),
@@ -2825,8 +2093,8 @@ function CollectionEditor({ collection }) {
2825
2093
  }
2826
2094
  )
2827
2095
  ] }, 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(
2096
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 justify-end gap-3 border-t border-slate-200 bg-white px-6 py-4", children: [
2097
+ /* @__PURE__ */ jsx(
2830
2098
  "button",
2831
2099
  {
2832
2100
  onClick: () => setEditing(null),
@@ -2835,16 +2103,16 @@ function CollectionEditor({ collection }) {
2835
2103
  children: "Cancel"
2836
2104
  }
2837
2105
  ),
2838
- /* @__PURE__ */ jsx5(
2106
+ /* @__PURE__ */ jsx(
2839
2107
  "button",
2840
2108
  {
2841
2109
  onClick: save,
2842
2110
  disabled: saving,
2843
2111
  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" })
2112
+ children: saving ? /* @__PURE__ */ jsxs(Fragment, { children: [
2113
+ /* @__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: [
2114
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2115
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2848
2116
  ] }),
2849
2117
  "Saving..."
2850
2118
  ] }) : "Save Entry"
@@ -2854,18 +2122,18 @@ function CollectionEditor({ collection }) {
2854
2122
  ] })
2855
2123
  }
2856
2124
  ),
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" })
2125
+ /* @__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: [
2126
+ /* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs("tr", { children: [
2127
+ 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)),
2128
+ /* @__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
2129
  ] }) }),
2862
- /* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
2130
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
2863
2131
  // 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" }) })
2132
+ Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs("tr", { children: [
2133
+ 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)),
2134
+ /* @__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
2135
  ] }, i))
2868
- ) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
2136
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
2869
2137
  (() => {
2870
2138
  let res = entries;
2871
2139
  if (search && collection.searchBy?.length) {
@@ -2881,7 +2149,7 @@ function CollectionEditor({ collection }) {
2881
2149
  });
2882
2150
  }
2883
2151
  const paginatedRes = res.slice((page - 1) * itemsPerPage, page * itemsPerPage);
2884
- return /* @__PURE__ */ jsx5(Fragment4, { children: paginatedRes.map((e, idx) => /* @__PURE__ */ jsxs4(
2152
+ return /* @__PURE__ */ jsx(Fragment, { children: paginatedRes.map((e, idx) => /* @__PURE__ */ jsxs(
2885
2153
  "tr",
2886
2154
  {
2887
2155
  draggable: true,
@@ -2891,32 +2159,32 @@ function CollectionEditor({ collection }) {
2891
2159
  onDragEnd,
2892
2160
  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
2161
  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: [
2162
+ 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
2163
  "$ ",
2896
2164
  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(
2165
+ ] }) : /* @__PURE__ */ jsx("span", { children: Number(e[f.id]).toLocaleString("es-CO") }) : String(e[f.id] ?? "") }, f.id)),
2166
+ /* @__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: [
2167
+ /* @__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" }) }) }),
2168
+ /* @__PURE__ */ jsx(
2901
2169
  "button",
2902
2170
  {
2903
2171
  onClick: () => setEditing(e),
2904
2172
  className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
2905
2173
  title: "Edit",
2906
- children: /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4" })
2174
+ children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" })
2907
2175
  }
2908
2176
  ),
2909
- /* @__PURE__ */ jsx5(
2177
+ /* @__PURE__ */ jsx(
2910
2178
  "button",
2911
2179
  {
2912
2180
  onClick: () => remove(e.id),
2913
2181
  disabled: deletingId === e.id,
2914
2182
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
2915
2183
  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" })
2184
+ 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: [
2185
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2186
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
2187
+ ] }) : /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
2920
2188
  }
2921
2189
  )
2922
2190
  ] }) })
@@ -2925,21 +2193,21 @@ function CollectionEditor({ collection }) {
2925
2193
  e.id
2926
2194
  )) });
2927
2195
  })(),
2928
- entries.length === 0 && !search && Object.values(filters).every((v) => !v) && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
2196
+ entries.length === 0 && !search && Object.values(filters).every((v) => !v) && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
2929
2197
  "td",
2930
2198
  {
2931
2199
  colSpan: visibleFields.length + 1,
2932
2200
  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.' })
2201
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
2202
+ /* @__PURE__ */ jsx(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
2203
+ /* @__PURE__ */ jsx("p", { children: 'No entries yet. Click "New Entry" to create one.' })
2936
2204
  ] })
2937
2205
  }
2938
2206
  ) })
2939
2207
  ] }) })
2940
2208
  ] }) }),
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: (() => {
2209
+ !loadingEntries && entries.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-slate-500 mt-4 px-2", children: [
2210
+ /* @__PURE__ */ jsx("span", { children: (() => {
2943
2211
  let res = entries;
2944
2212
  if (search && collection.searchBy?.length) {
2945
2213
  const q = search.toLowerCase();
@@ -2971,29 +2239,29 @@ function CollectionEditor({ collection }) {
2971
2239
  }
2972
2240
  const totalPages = Math.max(1, Math.ceil(res.length / itemsPerPage));
2973
2241
  if (totalPages <= 1) return null;
2974
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2975
- /* @__PURE__ */ jsx5(
2242
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2243
+ /* @__PURE__ */ jsx(
2976
2244
  "button",
2977
2245
  {
2978
2246
  onClick: () => setPage((p) => Math.max(1, p - 1)),
2979
2247
  disabled: page === 1,
2980
2248
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
2981
- children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
2249
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
2982
2250
  }
2983
2251
  ),
2984
- /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
2252
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-700", children: [
2985
2253
  "Page ",
2986
2254
  page,
2987
2255
  " of ",
2988
2256
  totalPages
2989
2257
  ] }),
2990
- /* @__PURE__ */ jsx5(
2258
+ /* @__PURE__ */ jsx(
2991
2259
  "button",
2992
2260
  {
2993
2261
  onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
2994
2262
  disabled: page === totalPages,
2995
2263
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
2996
- children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
2264
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
2997
2265
  }
2998
2266
  )
2999
2267
  ] });
@@ -3004,48 +2272,48 @@ function CollectionEditor({ collection }) {
3004
2272
  var PAGE_SIZE = 10;
3005
2273
  function SubmissionsSection() {
3006
2274
  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 () => {
2275
+ const [submissions, setSubmissions] = useState([]);
2276
+ const [loading, setLoading] = useState(false);
2277
+ const [selectedFormId, setSelectedFormId] = useState(null);
2278
+ const load = useCallback(async () => {
3011
2279
  setLoading(true);
3012
2280
  const all = await ctx.adapter.listSubmissions();
3013
2281
  setSubmissions(all);
3014
2282
  setLoading(false);
3015
2283
  }, [ctx.adapter]);
3016
- useEffect4(() => {
2284
+ useEffect(() => {
3017
2285
  load();
3018
2286
  }, [load]);
3019
2287
  const formIds = Array.from(new Set(submissions.map((s) => s.formId)));
3020
- useEffect4(() => {
2288
+ useEffect(() => {
3021
2289
  if (!selectedFormId && formIds.length > 0) {
3022
2290
  setSelectedFormId(formIds[0]);
3023
2291
  }
3024
2292
  }, [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(
2293
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
2294
+ /* @__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: [
2295
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
2296
+ /* @__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: [
2297
+ formIds.map((id) => /* @__PURE__ */ jsx("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs(
3030
2298
  "button",
3031
2299
  {
3032
2300
  onClick: () => setSelectedFormId(id),
3033
2301
  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
2302
  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: [
2303
+ /* @__PURE__ */ jsx("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
2304
+ /* @__PURE__ */ jsxs("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
3037
2305
  submissions.filter((s) => s.formId === id).length,
3038
2306
  " items"
3039
2307
  ] })
3040
2308
  ]
3041
2309
  }
3042
2310
  ) }, 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." })
2311
+ 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
2312
  ] })
3045
2313
  ] }),
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(
2314
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
2315
+ /* @__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" }),
2316
+ selectedFormId ? /* @__PURE__ */ jsx(
3049
2317
  SubmissionsList,
3050
2318
  {
3051
2319
  formId: selectedFormId,
@@ -3054,15 +2322,15 @@ function SubmissionsSection() {
3054
2322
  loading
3055
2323
  },
3056
2324
  selectedFormId
3057
- ) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to view entries." })
2325
+ ) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to view entries." })
3058
2326
  ] })
3059
2327
  ] });
3060
2328
  }
3061
2329
  function SubmissionsList({ formId, submissions, onLoad, loading }) {
3062
2330
  const ctx = useCmsContext();
3063
- const [search, setSearch] = useState5("");
3064
- const [page, setPage] = useState5(1);
3065
- const [detail, setDetail] = useState5(null);
2331
+ const [search, setSearch] = useState("");
2332
+ const [page, setPage] = useState(1);
2333
+ const [detail, setDetail] = useState(null);
3066
2334
  const filtered = submissions.filter((s) => {
3067
2335
  const q = search.toLowerCase();
3068
2336
  if (!q) return true;
@@ -3092,49 +2360,49 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3092
2360
  }
3093
2361
  };
3094
2362
  if (detail) {
3095
- return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
3096
- /* @__PURE__ */ jsxs4(
2363
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-2xl", children: [
2364
+ /* @__PURE__ */ jsxs(
3097
2365
  "button",
3098
2366
  {
3099
2367
  onClick: () => setDetail(null),
3100
2368
  className: "mb-6 inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-900 transition-colors",
3101
2369
  children: [
3102
- /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" }),
2370
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
3103
2371
  " Back to list"
3104
2372
  ]
3105
2373
  }
3106
2374
  ),
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) })
2375
+ /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2376
+ /* @__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: [
2377
+ /* @__PURE__ */ jsxs("div", { children: [
2378
+ /* @__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 }),
2379
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
3112
2380
  ] }),
3113
- /* @__PURE__ */ jsx5(
2381
+ /* @__PURE__ */ jsx(
3114
2382
  "button",
3115
2383
  {
3116
2384
  onClick: () => deleteOne(detail.id),
3117
2385
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors",
3118
2386
  title: "Delete",
3119
- children: /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
2387
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
3120
2388
  }
3121
2389
  )
3122
2390
  ] }) }),
3123
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
2391
+ /* @__PURE__ */ jsx("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
3124
2392
  const strVal = String(val ?? "\u2014");
3125
2393
  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
2394
  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(
2395
+ return /* @__PURE__ */ jsxs("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2396
+ /* @__PURE__ */ jsx("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2397
+ /* @__PURE__ */ jsx("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
2398
+ /* @__PURE__ */ jsx(
3131
2399
  "a",
3132
2400
  {
3133
2401
  href: strVal,
3134
2402
  target: "_blank",
3135
2403
  rel: "noopener noreferrer",
3136
2404
  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(
2405
+ children: /* @__PURE__ */ jsx(
3138
2406
  "img",
3139
2407
  {
3140
2408
  src: strVal,
@@ -3144,7 +2412,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3144
2412
  )
3145
2413
  }
3146
2414
  ),
3147
- /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs4(
2415
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
3148
2416
  "a",
3149
2417
  {
3150
2418
  href: strVal,
@@ -3152,12 +2420,12 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3152
2420
  rel: "noopener noreferrer",
3153
2421
  className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
3154
2422
  children: [
3155
- /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5" }),
2423
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5" }),
3156
2424
  " View / Download file"
3157
2425
  ]
3158
2426
  }
3159
2427
  ) })
3160
- ] }) : isUrl ? /* @__PURE__ */ jsxs4(
2428
+ ] }) : isUrl ? /* @__PURE__ */ jsxs(
3161
2429
  "a",
3162
2430
  {
3163
2431
  href: strVal,
@@ -3165,42 +2433,42 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3165
2433
  rel: "noopener noreferrer",
3166
2434
  className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
3167
2435
  children: [
3168
- /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5 flex-shrink-0" }),
2436
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5 flex-shrink-0" }),
3169
2437
  " ",
3170
2438
  strVal
3171
2439
  ]
3172
2440
  }
3173
- ) : /* @__PURE__ */ jsx5("p", { className: "whitespace-pre-wrap", children: strVal }) })
2441
+ ) : /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", children: strVal }) })
3174
2442
  ] }, key);
3175
2443
  }) })
3176
2444
  ] })
3177
2445
  ] });
3178
2446
  }
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: [
2447
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
2448
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2449
+ /* @__PURE__ */ jsxs("div", { children: [
2450
+ /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
3183
2451
  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 })
2452
+ 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
2453
  ] }),
3186
- /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
2454
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
3187
2455
  ] }),
3188
- /* @__PURE__ */ jsxs4(
2456
+ /* @__PURE__ */ jsxs(
3189
2457
  "button",
3190
2458
  {
3191
2459
  onClick: onLoad,
3192
2460
  disabled: loading,
3193
2461
  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
2462
  children: [
3195
- /* @__PURE__ */ jsx5(RefreshCw, { className: `h-4 w-4 ${loading ? "animate-spin" : ""}` }),
2463
+ /* @__PURE__ */ jsx(RefreshCw, { className: `h-4 w-4 ${loading ? "animate-spin" : ""}` }),
3196
2464
  " Refresh"
3197
2465
  ]
3198
2466
  }
3199
2467
  )
3200
2468
  ] }),
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(
2469
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2470
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
2471
+ /* @__PURE__ */ jsx(
3204
2472
  "input",
3205
2473
  {
3206
2474
  value: search,
@@ -3213,44 +2481,44 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3213
2481
  }
3214
2482
  )
3215
2483
  ] }),
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" })
2484
+ /* @__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: [
2485
+ /* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs("tr", { children: [
2486
+ /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
2487
+ /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
2488
+ /* @__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
2489
  ] }) }),
3222
- /* @__PURE__ */ jsxs4("tbody", { className: "divide-y divide-slate-100", children: [
2490
+ /* @__PURE__ */ jsxs("tbody", { className: "divide-y divide-slate-100", children: [
3223
2491
  paginated.map((s) => {
3224
2492
  const firstVal = Object.values(s.data)[0];
3225
2493
  const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
3226
- return /* @__PURE__ */ jsxs4(
2494
+ return /* @__PURE__ */ jsxs(
3227
2495
  "tr",
3228
2496
  {
3229
2497
  className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
3230
2498
  onClick: () => openDetail(s),
3231
2499
  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" })
2500
+ /* @__PURE__ */ jsxs("td", { className: "px-6 py-4", children: [
2501
+ /* @__PURE__ */ jsx("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
2502
+ !s.read && /* @__PURE__ */ jsx("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
3235
2503
  ] }),
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(
2504
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
2505
+ /* @__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: [
2506
+ /* @__PURE__ */ jsx(
3239
2507
  "button",
3240
2508
  {
3241
2509
  onClick: () => openDetail(s),
3242
2510
  className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
3243
2511
  title: "View detail",
3244
- children: /* @__PURE__ */ jsx5(Eye, { className: "h-4 w-4" })
2512
+ children: /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" })
3245
2513
  }
3246
2514
  ),
3247
- /* @__PURE__ */ jsx5(
2515
+ /* @__PURE__ */ jsx(
3248
2516
  "button",
3249
2517
  {
3250
2518
  onClick: () => deleteOne(s.id),
3251
2519
  className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors",
3252
2520
  title: "Delete",
3253
- children: /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
2521
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
3254
2522
  }
3255
2523
  )
3256
2524
  ] }) })
@@ -3259,41 +2527,41 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3259
2527
  s.id
3260
2528
  );
3261
2529
  }),
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." })
2530
+ 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: [
2531
+ /* @__PURE__ */ jsx(Inbox, { className: "h-12 w-12 text-slate-200" }),
2532
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
3265
2533
  ] }) }) })
3266
2534
  ] })
3267
2535
  ] }) }),
3268
- totalPages > 1 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
3269
- /* @__PURE__ */ jsxs4("span", { children: [
2536
+ totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
2537
+ /* @__PURE__ */ jsxs("span", { children: [
3270
2538
  filtered.length,
3271
2539
  " item",
3272
2540
  filtered.length !== 1 ? "s" : ""
3273
2541
  ] }),
3274
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
3275
- /* @__PURE__ */ jsx5(
2542
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2543
+ /* @__PURE__ */ jsx(
3276
2544
  "button",
3277
2545
  {
3278
2546
  onClick: () => setPage((p) => Math.max(1, p - 1)),
3279
2547
  disabled: page === 1,
3280
2548
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
3281
- children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
2549
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
3282
2550
  }
3283
2551
  ),
3284
- /* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
2552
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-700", children: [
3285
2553
  "Page ",
3286
2554
  page,
3287
2555
  " of ",
3288
2556
  totalPages
3289
2557
  ] }),
3290
- /* @__PURE__ */ jsx5(
2558
+ /* @__PURE__ */ jsx(
3291
2559
  "button",
3292
2560
  {
3293
2561
  onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
3294
2562
  disabled: page === totalPages,
3295
2563
  className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
3296
- children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
2564
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
3297
2565
  }
3298
2566
  )
3299
2567
  ] })
@@ -3302,31 +2570,31 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
3302
2570
  }
3303
2571
  function SettingsSection() {
3304
2572
  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." })
2573
+ 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: [
2574
+ /* @__PURE__ */ jsxs("div", { children: [
2575
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
2576
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
3309
2577
  ] }),
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(
2578
+ /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
2579
+ /* @__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" }) }),
2580
+ /* @__PURE__ */ jsxs("dl", { className: "divide-y divide-slate-100 text-sm", children: [
2581
+ /* @__PURE__ */ jsx(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
2582
+ /* @__PURE__ */ jsx(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
2583
+ /* @__PURE__ */ jsx(
3316
2584
  Row,
3317
2585
  {
3318
2586
  label: "Defined Collections",
3319
2587
  value: String(ctx.config.collections?.length ?? 0)
3320
2588
  }
3321
2589
  ),
3322
- /* @__PURE__ */ jsx5(
2590
+ /* @__PURE__ */ jsx(
3323
2591
  Row,
3324
2592
  {
3325
2593
  label: "Editable Fields (Current Page)",
3326
2594
  value: String(ctx.getRegistered().length)
3327
2595
  }
3328
2596
  ),
3329
- /* @__PURE__ */ jsx5(
2597
+ /* @__PURE__ */ jsx(
3330
2598
  Row,
3331
2599
  {
3332
2600
  label: "Unsaved Changes",
@@ -3341,67 +2609,67 @@ function SettingsSection() {
3341
2609
  function ConfigSection() {
3342
2610
  const ctx = useCmsContext();
3343
2611
  const globals = ctx.config.globals ?? [];
3344
- const [selectedGroupId, setSelectedGroupId] = useState5(
2612
+ const [selectedGroupId, setSelectedGroupId] = useState(
3345
2613
  globals[0]?.id ?? null
3346
2614
  );
3347
2615
  const selectedGroup = globals.find((g) => g.id === selectedGroupId) ?? null;
3348
- const updateOverride = useCallback3(
2616
+ const updateOverride = useCallback(
3349
2617
  (id, value) => {
3350
2618
  ctx.setOverride(id, value);
3351
2619
  },
3352
2620
  [ctx]
3353
2621
  );
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(
2622
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [
2623
+ /* @__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: [
2624
+ /* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
2625
+ /* @__PURE__ */ jsxs("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
2626
+ globals.map((g) => /* @__PURE__ */ jsx("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx(
3359
2627
  "button",
3360
2628
  {
3361
2629
  onClick: () => setSelectedGroupId(g.id),
3362
2630
  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 })
2631
+ children: /* @__PURE__ */ jsx("div", { className: `truncate ${selectedGroupId === g.id ? "text-slate-900" : "text-slate-700"}`, children: g.label })
3364
2632
  }
3365
2633
  ) }, 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." })
2634
+ 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
2635
  ] })
3368
2636
  ] }),
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." })
2637
+ /* @__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: [
2638
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-8", children: [
2639
+ /* @__PURE__ */ jsxs("div", { children: [
2640
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
2641
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
3374
2642
  ] }),
3375
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
3376
- /* @__PURE__ */ jsxs4(
2643
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2644
+ /* @__PURE__ */ jsxs(
3377
2645
  "button",
3378
2646
  {
3379
2647
  onClick: () => ctx.reset(),
3380
2648
  disabled: !ctx.isDirty,
3381
2649
  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
2650
  children: [
3383
- /* @__PURE__ */ jsx5(X, { className: "h-3.5 w-3.5" }),
2651
+ /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }),
3384
2652
  "Discard"
3385
2653
  ]
3386
2654
  }
3387
2655
  ),
3388
- /* @__PURE__ */ jsxs4(
2656
+ /* @__PURE__ */ jsxs(
3389
2657
  "button",
3390
2658
  {
3391
2659
  onClick: () => ctx.save(),
3392
2660
  disabled: !ctx.isDirty,
3393
2661
  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
2662
  children: [
3395
- /* @__PURE__ */ jsx5(Boxes, { className: "h-3.5 w-3.5" }),
2663
+ /* @__PURE__ */ jsx(Boxes, { className: "h-3.5 w-3.5" }),
3396
2664
  "Save"
3397
2665
  ]
3398
2666
  }
3399
2667
  )
3400
2668
  ] })
3401
2669
  ] }),
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(
2670
+ selectedGroup ? /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
2671
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
2672
+ /* @__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
2673
  FieldEditor,
3406
2674
  {
3407
2675
  meta: field,
@@ -3412,9 +2680,9 @@ function ConfigSection() {
3412
2680
  }
3413
2681
  }
3414
2682
  ) }, 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." })
2683
+ ] }) : /* @__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: [
2684
+ /* @__PURE__ */ jsx(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
2685
+ /* @__PURE__ */ jsx("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
3418
2686
  ] })
3419
2687
  ] }) })
3420
2688
  ] });
@@ -3425,96 +2693,160 @@ function Row({
3425
2693
  highlight,
3426
2694
  status
3427
2695
  }) {
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 })
2696
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
2697
+ /* @__PURE__ */ jsx("dt", { className: "text-slate-500 font-medium", children: label }),
2698
+ /* @__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
2699
  ] });
3432
2700
  }
3433
2701
  function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
3434
- const [open, setOpen] = useState5(false);
3435
- const [search, setSearch] = useState5("");
3436
- const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
3437
- const capped = filtered.slice(0, 80);
2702
+ const [open, setOpen] = useState(false);
2703
+ const [search, setSearch] = useState("");
2704
+ const btnRef = useRef(null);
2705
+ const [coords, setCoords] = useState({
2706
+ top: 0,
2707
+ left: 0,
2708
+ width: 250
2709
+ });
2710
+ const updateCoords = useCallback(() => {
2711
+ if (btnRef.current) {
2712
+ const rect = btnRef.current.getBoundingClientRect();
2713
+ const dropdownHeight = 280;
2714
+ const spaceBelow = window.innerHeight - rect.bottom;
2715
+ const opensUp = spaceBelow < dropdownHeight && rect.top > dropdownHeight;
2716
+ setCoords({
2717
+ top: opensUp ? Math.max(10, rect.top - dropdownHeight - 6) : rect.bottom + 6,
2718
+ left: Math.max(10, Math.min(rect.left, window.innerWidth - rect.width - 10)),
2719
+ width: rect.width
2720
+ });
2721
+ }
2722
+ }, []);
2723
+ const handleToggle = () => {
2724
+ if (!open) {
2725
+ updateCoords();
2726
+ }
2727
+ setOpen((prev) => !prev);
2728
+ setSearch("");
2729
+ };
2730
+ useEffect(() => {
2731
+ if (!open) return;
2732
+ const handleScrollOrResize = () => {
2733
+ updateCoords();
2734
+ };
2735
+ window.addEventListener("scroll", handleScrollOrResize, true);
2736
+ window.addEventListener("resize", handleScrollOrResize);
2737
+ return () => {
2738
+ window.removeEventListener("scroll", handleScrollOrResize, true);
2739
+ window.removeEventListener("resize", handleScrollOrResize);
2740
+ };
2741
+ }, [open, updateCoords]);
2742
+ const filtered = options.filter(
2743
+ (o) => o.toLowerCase().includes(search.toLowerCase())
2744
+ );
2745
+ const capped = filtered.slice(0, 100);
3438
2746
  const SelectedIcon = iconMap && value ? iconMap[value] : null;
3439
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
3440
- /* @__PURE__ */ jsxs4(
2747
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2748
+ /* @__PURE__ */ jsxs(
3441
2749
  "button",
3442
2750
  {
2751
+ ref: btnRef,
3443
2752
  type: "button",
3444
- onClick: () => {
3445
- setOpen(!open);
3446
- setSearch("");
3447
- },
3448
- 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",
2753
+ onClick: handleToggle,
2754
+ className: "w-full flex items-center justify-between rounded-xl border border-slate-200 px-3.5 py-2.5 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors cursor-pointer",
3449
2755
  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..." })
2756
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2.5 truncate", children: [
2757
+ SelectedIcon && /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center rounded bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ jsx(SelectedIcon, { className: "w-3.5 h-3.5" }) }),
2758
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: value || placeholder || "Seleccionar icono..." })
3453
2759
  ] }),
3454
- /* @__PURE__ */ jsx5(ChevronDown, { className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}` })
2760
+ /* @__PURE__ */ jsx(
2761
+ ChevronDown,
2762
+ {
2763
+ className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}`
2764
+ }
2765
+ )
3455
2766
  ]
3456
2767
  }
3457
2768
  ),
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(
3464
- "input",
3465
- {
3466
- autoFocus: true,
3467
- type: "text",
3468
- className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
3469
- placeholder: "Type to search\u2026",
3470
- value: search,
3471
- onChange: (e) => setSearch(e.target.value)
3472
- }
3473
- ),
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 })
3475
- ] }),
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: [
3478
- 'No results for "',
3479
- search,
3480
- '"'
3481
- ] }),
3482
- capped.map((opt) => {
3483
- const OptIcon = iconMap ? iconMap[opt] : null;
3484
- return /* @__PURE__ */ jsxs4(
3485
- "button",
3486
- {
3487
- type: "button",
3488
- className: `w-full flex items-center gap-2.5 text-left px-2.5 py-1.5 text-sm rounded-lg transition-colors ${value === opt ? "bg-indigo-50 text-indigo-700 font-medium" : "text-slate-700 hover:bg-slate-50"}`,
3489
- onClick: () => {
3490
- onChange(opt);
3491
- setOpen(false);
3492
- },
3493
- 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 })
3496
- ]
3497
- },
3498
- opt
3499
- );
3500
- }),
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: [
3502
- "Showing 80 of ",
3503
- filtered.length,
3504
- " \u2014 type to narrow results"
3505
- ] })
3506
- ] })
3507
- ] })
3508
- ] })
2769
+ open && typeof document !== "undefined" && createPortal(
2770
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2771
+ /* @__PURE__ */ jsx(
2772
+ "div",
2773
+ {
2774
+ className: "fixed inset-0 z-[99998] cursor-default",
2775
+ onClick: () => setOpen(false)
2776
+ }
2777
+ ),
2778
+ /* @__PURE__ */ jsxs(
2779
+ "div",
2780
+ {
2781
+ style: {
2782
+ position: "fixed",
2783
+ top: `${coords.top}px`,
2784
+ left: `${coords.left}px`,
2785
+ width: `${coords.width}px`
2786
+ },
2787
+ className: "z-[99999] rounded-2xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-150",
2788
+ children: [
2789
+ /* @__PURE__ */ jsxs("div", { className: "p-2.5 border-b border-slate-100 flex items-center gap-2 bg-slate-50/50", children: [
2790
+ /* @__PURE__ */ jsx(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
2791
+ /* @__PURE__ */ jsx(
2792
+ "input",
2793
+ {
2794
+ autoFocus: true,
2795
+ type: "text",
2796
+ className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
2797
+ placeholder: "Buscar icono por nombre (ej: LuCode, LuServer)...",
2798
+ value: search,
2799
+ onChange: (e) => setSearch(e.target.value)
2800
+ }
2801
+ ),
2802
+ search && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-200 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
2803
+ ] }),
2804
+ /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto flex-1 p-1.5", children: [
2805
+ filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
2806
+ 'No se encontraron iconos para "',
2807
+ search,
2808
+ '"'
2809
+ ] }),
2810
+ capped.map((opt) => {
2811
+ const OptIcon = iconMap ? iconMap[opt] : null;
2812
+ return /* @__PURE__ */ jsxs(
2813
+ "button",
2814
+ {
2815
+ type: "button",
2816
+ className: `w-full flex items-center gap-2.5 text-left px-2.5 py-2 text-sm rounded-xl transition-colors cursor-pointer ${value === opt ? "bg-indigo-50 text-indigo-700 font-semibold" : "text-slate-700 hover:bg-slate-50"}`,
2817
+ onClick: () => {
2818
+ onChange(opt);
2819
+ setOpen(false);
2820
+ },
2821
+ children: [
2822
+ OptIcon && /* @__PURE__ */ jsx("span", { className: "w-6 h-6 flex items-center justify-center rounded-lg bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ jsx(OptIcon, { className: "w-4 h-4" }) }),
2823
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt })
2824
+ ]
2825
+ },
2826
+ opt
2827
+ );
2828
+ }),
2829
+ filtered.length > 100 && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
2830
+ "Mostrando 100 de ",
2831
+ filtered.length,
2832
+ " \u2014 escribe en el buscador para filtrar"
2833
+ ] })
2834
+ ] })
2835
+ ]
2836
+ }
2837
+ )
2838
+ ] }),
2839
+ document.body
2840
+ )
3509
2841
  ] });
3510
2842
  }
3511
2843
  function PasswordField({ value, onChange }) {
3512
- const [show, setShow] = useState5(false);
2844
+ const [show, setShow] = useState(false);
3513
2845
  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(
2846
+ const [displayValue, setDisplayValue] = useState(isHash ? "" : value);
2847
+ const [pristine, setPristine] = useState(isHash);
2848
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2849
+ /* @__PURE__ */ jsx(
3518
2850
  "input",
3519
2851
  {
3520
2852
  type: show ? "text" : "password",
@@ -3528,13 +2860,13 @@ function PasswordField({ value, onChange }) {
3528
2860
  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
2861
  }
3530
2862
  ),
3531
- /* @__PURE__ */ jsx5(
2863
+ /* @__PURE__ */ jsx(
3532
2864
  "button",
3533
2865
  {
3534
2866
  type: "button",
3535
2867
  onClick: () => setShow(!show),
3536
2868
  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" })
2869
+ children: show ? /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" })
3538
2870
  }
3539
2871
  )
3540
2872
  ] });
@@ -3555,8 +2887,8 @@ function FormattedNumberInput({
3555
2887
  if (!cleanDigits) return "";
3556
2888
  return cleanDigits.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
3557
2889
  };
3558
- const [displayVal, setDisplayVal] = useState5(() => formatWithDots(value));
3559
- useEffect4(() => {
2890
+ const [displayVal, setDisplayVal] = useState(() => formatWithDots(value));
2891
+ useEffect(() => {
3560
2892
  setDisplayVal(formatWithDots(value));
3561
2893
  }, [value]);
3562
2894
  const handleChange = (e) => {
@@ -3577,10 +2909,10 @@ function FormattedNumberInput({
3577
2909
  setDisplayVal(formatted);
3578
2910
  onChange(parsed);
3579
2911
  };
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(
2912
+ return /* @__PURE__ */ jsxs("div", { className: `relative flex items-center ${containerClassName}`, children: [
2913
+ isPrice && /* @__PURE__ */ jsx("span", { className: "absolute left-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "$" }),
2914
+ isPercent && /* @__PURE__ */ jsx("span", { className: "absolute right-3.5 text-sm font-bold text-slate-400 pointer-events-none select-none", children: "%" }),
2915
+ /* @__PURE__ */ jsx(
3584
2916
  "input",
3585
2917
  {
3586
2918
  type: "text",
@@ -3605,9 +2937,9 @@ function BranchSettingsEditor({
3605
2937
  onChange
3606
2938
  }) {
3607
2939
  const ctx = useCmsContext();
3608
- const [branches, setBranches] = useState5([]);
3609
- const [loading, setLoading] = useState5(true);
3610
- const [loadError, setLoadError] = useState5("");
2940
+ const [branches, setBranches] = useState([]);
2941
+ const [loading, setLoading] = useState(true);
2942
+ const [loadError, setLoadError] = useState("");
3611
2943
  const settings = value && typeof value === "object" ? value : {};
3612
2944
  const selectedBranches = Array.isArray(settings.branches) ? settings.branches.map(String) : [];
3613
2945
  const prices = settings.prices && typeof settings.prices === "object" ? settings.prices : {};
@@ -3629,7 +2961,7 @@ function BranchSettingsEditor({
3629
2961
  const allBranches = settings.allBranches !== false;
3630
2962
  const useBranchPricing = settings.useBranchPricing === true;
3631
2963
  const useBranchDiscounts = settings.useBranchDiscounts === true;
3632
- useEffect4(() => {
2964
+ useEffect(() => {
3633
2965
  let active = true;
3634
2966
  setLoading(true);
3635
2967
  setLoadError("");
@@ -3693,9 +3025,9 @@ function BranchSettingsEditor({
3693
3025
  }
3694
3026
  updateSettings({ discounts: nextDiscounts });
3695
3027
  };
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(
3028
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4 rounded-xl border border-slate-200 bg-slate-50/50 p-4", children: [
3029
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3030
+ /* @__PURE__ */ jsx(
3699
3031
  "input",
3700
3032
  {
3701
3033
  type: "checkbox",
@@ -3704,12 +3036,12 @@ function BranchSettingsEditor({
3704
3036
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3705
3037
  }
3706
3038
  ),
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." })
3039
+ /* @__PURE__ */ jsxs("span", { children: [
3040
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Disponible en todas las sedes" }),
3041
+ /* @__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
3042
  ] })
3711
3043
  ] }),
3712
- !allBranches && /* @__PURE__ */ jsx5(
3044
+ !allBranches && /* @__PURE__ */ jsx(
3713
3045
  SearchableMultiSelect,
3714
3046
  {
3715
3047
  options: branches.map((branch) => ({
@@ -3725,10 +3057,10 @@ function BranchSettingsEditor({
3725
3057
  emptyMessage: "No hay sedes registradas todav\xEDa."
3726
3058
  }
3727
3059
  ),
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(
3060
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
3061
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-slate-700", children: "Horario diferente por sede (opcional)" }),
3062
+ /* @__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." }),
3063
+ /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(
3732
3064
  SearchableMultiSelect,
3733
3065
  {
3734
3066
  options: branches.map((branch) => ({
@@ -3752,19 +3084,19 @@ function BranchSettingsEditor({
3752
3084
  emptyMessage: "No hay sedes registradas todav\xEDa."
3753
3085
  }
3754
3086
  ) }),
3755
- /* @__PURE__ */ jsx5("div", { className: "mt-3 space-y-2", children: branches.filter(
3087
+ /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: branches.filter(
3756
3088
  (branch) => selectedAvailabilityBranches.includes(getBranchName(branch))
3757
3089
  ).map((branch) => {
3758
3090
  const name = getBranchName(branch);
3759
3091
  const schedule = branchAvailability[name] ?? {};
3760
- return /* @__PURE__ */ jsxs4(
3092
+ return /* @__PURE__ */ jsxs(
3761
3093
  "div",
3762
3094
  {
3763
3095
  className: "space-y-3 rounded-lg border border-slate-200 bg-white p-3",
3764
3096
  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(
3097
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3098
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3099
+ /* @__PURE__ */ jsx(
3768
3100
  "button",
3769
3101
  {
3770
3102
  type: "button",
@@ -3776,11 +3108,11 @@ function BranchSettingsEditor({
3776
3108
  "aria-label": `Quitar horario de ${name}`,
3777
3109
  title: `Quitar horario de ${name}`,
3778
3110
  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" })
3111
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3780
3112
  }
3781
3113
  )
3782
3114
  ] }),
3783
- /* @__PURE__ */ jsx5(
3115
+ /* @__PURE__ */ jsx(
3784
3116
  AdminTimeRangePicker,
3785
3117
  {
3786
3118
  value: [
@@ -3806,9 +3138,9 @@ function BranchSettingsEditor({
3806
3138
  );
3807
3139
  }) })
3808
3140
  ] }),
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(
3141
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
3142
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3143
+ /* @__PURE__ */ jsx(
3812
3144
  "input",
3813
3145
  {
3814
3146
  type: "checkbox",
@@ -3817,17 +3149,17 @@ function BranchSettingsEditor({
3817
3149
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3818
3150
  }
3819
3151
  ),
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." })
3152
+ /* @__PURE__ */ jsxs("span", { children: [
3153
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Usar precio diferente por sede" }),
3154
+ /* @__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
3155
  ] })
3824
3156
  ] }),
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: [
3157
+ 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: [
3158
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-slate-500", children: [
3827
3159
  "Precio global actual: $",
3828
3160
  globalPrice.toLocaleString("es-CO")
3829
3161
  ] }),
3830
- /* @__PURE__ */ jsx5(
3162
+ /* @__PURE__ */ jsx(
3831
3163
  SearchableMultiSelect,
3832
3164
  {
3833
3165
  options: branches.map((branch) => ({
@@ -3857,14 +3189,14 @@ function BranchSettingsEditor({
3857
3189
  (branch) => selectedPriceBranches.includes(getBranchName(branch))
3858
3190
  ).map((branch) => {
3859
3191
  const name = getBranchName(branch);
3860
- return /* @__PURE__ */ jsxs4(
3192
+ return /* @__PURE__ */ jsxs(
3861
3193
  "div",
3862
3194
  {
3863
3195
  className: "space-y-2 rounded-lg border border-slate-200 bg-white p-3",
3864
3196
  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(
3197
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3198
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3199
+ /* @__PURE__ */ jsx(
3868
3200
  "button",
3869
3201
  {
3870
3202
  type: "button",
@@ -3881,16 +3213,16 @@ function BranchSettingsEditor({
3881
3213
  "aria-label": `Quitar ${name} de precios por sede`,
3882
3214
  title: `Quitar ${name}`,
3883
3215
  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" })
3216
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3885
3217
  }
3886
3218
  )
3887
3219
  ] }),
3888
- /* @__PURE__ */ jsxs4("label", { className: "block w-full", children: [
3889
- /* @__PURE__ */ jsxs4("span", { className: "sr-only", children: [
3220
+ /* @__PURE__ */ jsxs("label", { className: "block w-full", children: [
3221
+ /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
3890
3222
  "Precio para ",
3891
3223
  name
3892
3224
  ] }),
3893
- /* @__PURE__ */ jsx5(
3225
+ /* @__PURE__ */ jsx(
3894
3226
  FormattedNumberInput,
3895
3227
  {
3896
3228
  value: prices[name] ?? "",
@@ -3913,9 +3245,9 @@ function BranchSettingsEditor({
3913
3245
  })
3914
3246
  ] }) })
3915
3247
  ] }),
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(
3248
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-slate-200 pt-4", children: [
3249
+ /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 text-sm text-slate-700", children: [
3250
+ /* @__PURE__ */ jsx(
3919
3251
  "input",
3920
3252
  {
3921
3253
  type: "checkbox",
@@ -3924,18 +3256,18 @@ function BranchSettingsEditor({
3924
3256
  className: "mt-0.5 h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
3925
3257
  }
3926
3258
  ),
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." })
3259
+ /* @__PURE__ */ jsxs("span", { children: [
3260
+ /* @__PURE__ */ jsx("span", { className: "block font-semibold", children: "Usar descuento diferente por sede" }),
3261
+ /* @__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
3262
  ] })
3931
3263
  ] }),
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: [
3264
+ 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: [
3265
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-slate-500", children: [
3934
3266
  "Descuento global actual: ",
3935
3267
  globalDiscount,
3936
3268
  "%"
3937
3269
  ] }),
3938
- /* @__PURE__ */ jsx5(
3270
+ /* @__PURE__ */ jsx(
3939
3271
  SearchableMultiSelect,
3940
3272
  {
3941
3273
  options: branches.map((branch) => ({
@@ -3965,14 +3297,14 @@ function BranchSettingsEditor({
3965
3297
  (branch) => selectedDiscountBranches.includes(getBranchName(branch))
3966
3298
  ).map((branch) => {
3967
3299
  const name = getBranchName(branch);
3968
- return /* @__PURE__ */ jsxs4(
3300
+ return /* @__PURE__ */ jsxs(
3969
3301
  "div",
3970
3302
  {
3971
3303
  className: "space-y-2 rounded-lg border border-slate-200 bg-white p-3",
3972
3304
  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(
3305
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [
3306
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-normal break-words text-sm font-semibold leading-5 text-slate-800", children: name }),
3307
+ /* @__PURE__ */ jsx(
3976
3308
  "button",
3977
3309
  {
3978
3310
  type: "button",
@@ -3989,16 +3321,16 @@ function BranchSettingsEditor({
3989
3321
  "aria-label": `Quitar descuento de ${name}`,
3990
3322
  title: `Quitar ${name}`,
3991
3323
  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" })
3324
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3993
3325
  }
3994
3326
  )
3995
3327
  ] }),
3996
- /* @__PURE__ */ jsxs4("label", { className: "block w-full", children: [
3997
- /* @__PURE__ */ jsxs4("span", { className: "sr-only", children: [
3328
+ /* @__PURE__ */ jsxs("label", { className: "block w-full", children: [
3329
+ /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
3998
3330
  "Descuento para ",
3999
3331
  name
4000
3332
  ] }),
4001
- /* @__PURE__ */ jsx5(
3333
+ /* @__PURE__ */ jsx(
4002
3334
  FormattedNumberInput,
4003
3335
  {
4004
3336
  value: discounts[name] ?? "",
@@ -4024,12 +3356,12 @@ function BranchSettingsEditor({
4024
3356
  ] });
4025
3357
  }
4026
3358
  function BranchSettingsSummary({ value }) {
4027
- if (!value || typeof value !== "object") return /* @__PURE__ */ jsx5("span", { children: "Todas las sedes" });
3359
+ if (!value || typeof value !== "object") return /* @__PURE__ */ jsx("span", { children: "Todas las sedes" });
4028
3360
  const settings = value;
4029
3361
  const names = Array.isArray(settings.branches) ? settings.branches : [];
4030
3362
  const locationSummary = settings.allBranches === false ? names.length > 0 ? names.join(", ") : "Sin sedes" : "Todas las sedes";
4031
3363
  const pricingSummary = settings.useBranchPricing ? " \xB7 Precio por sede" : " \xB7 Precio global";
4032
- return /* @__PURE__ */ jsx5("span", { children: locationSummary + pricingSummary });
3364
+ return /* @__PURE__ */ jsx("span", { children: locationSummary + pricingSummary });
4033
3365
  }
4034
3366
  function SearchableMultiSelect({
4035
3367
  options,
@@ -4043,10 +3375,10 @@ function SearchableMultiSelect({
4043
3375
  error,
4044
3376
  max
4045
3377
  }) {
4046
- const [open, setOpen] = useState5(false);
4047
- const [search, setSearch] = useState5("");
4048
- const rootRef = useRef2(null);
4049
- useEffect4(() => {
3378
+ const [open, setOpen] = useState(false);
3379
+ const [search, setSearch] = useState("");
3380
+ const rootRef = useRef(null);
3381
+ useEffect(() => {
4050
3382
  if (!open) return;
4051
3383
  const handlePointerDown = (event) => {
4052
3384
  if (event.target instanceof Node && !rootRef.current?.contains(event.target)) {
@@ -4095,8 +3427,8 @@ function SearchableMultiSelect({
4095
3427
  onChange(value.filter((selected) => !visibleValues.includes(selected)));
4096
3428
  }
4097
3429
  };
4098
- return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: "relative", children: [
4099
- /* @__PURE__ */ jsxs4(
3430
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: "relative", children: [
3431
+ /* @__PURE__ */ jsxs(
4100
3432
  "button",
4101
3433
  {
4102
3434
  type: "button",
@@ -4105,8 +3437,8 @@ function SearchableMultiSelect({
4105
3437
  onClick: () => setOpen((isOpen) => !isOpen),
4106
3438
  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
3439
  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(
3440
+ /* @__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: [
3441
+ selectedOptions.slice(0, 2).map((option) => /* @__PURE__ */ jsx(
4110
3442
  "span",
4111
3443
  {
4112
3444
  className: "max-w-full truncate rounded-md bg-indigo-50 px-2 py-1 text-xs font-medium text-indigo-700",
@@ -4114,18 +3446,18 @@ function SearchableMultiSelect({
4114
3446
  },
4115
3447
  option.value
4116
3448
  )),
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: [
3449
+ 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
3450
  "+",
4119
3451
  selectedOptions.length - 2
4120
3452
  ] })
4121
3453
  ] }) }),
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: [
3454
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2 text-xs text-slate-400", children: [
3455
+ selectedOptions.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
4124
3456
  selectedOptions.length,
4125
3457
  " seleccionada",
4126
3458
  selectedOptions.length === 1 ? "" : "s"
4127
3459
  ] }),
4128
- /* @__PURE__ */ jsx5(
3460
+ /* @__PURE__ */ jsx(
4129
3461
  ChevronDown,
4130
3462
  {
4131
3463
  className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`
@@ -4135,11 +3467,11 @@ function SearchableMultiSelect({
4135
3467
  ]
4136
3468
  }
4137
3469
  ),
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(
3470
+ 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: [
3471
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-b border-slate-100 p-3", children: [
3472
+ searchable && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3473
+ /* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" }),
3474
+ /* @__PURE__ */ jsx(
4143
3475
  "input",
4144
3476
  {
4145
3477
  type: "search",
@@ -4151,15 +3483,15 @@ function SearchableMultiSelect({
4151
3483
  }
4152
3484
  )
4153
3485
  ] }),
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: [
3486
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 text-xs", children: [
3487
+ /* @__PURE__ */ jsxs("span", { className: "font-medium text-slate-500", children: [
4156
3488
  value.length,
4157
3489
  " seleccionada",
4158
3490
  value.length === 1 ? "" : "s",
4159
3491
  max ? ` \xB7 m\xE1ximo ${max}` : ""
4160
3492
  ] }),
4161
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
4162
- /* @__PURE__ */ jsx5(
3493
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3494
+ /* @__PURE__ */ jsx(
4163
3495
  "button",
4164
3496
  {
4165
3497
  type: "button",
@@ -4169,8 +3501,8 @@ function SearchableMultiSelect({
4169
3501
  children: visibleOptions.length > 0 && visibleOptions.every((option) => value.includes(option.value)) ? searchable ? "Quitar visibles" : "Quitar todas" : searchable ? "Seleccionar visibles" : "Seleccionar todas"
4170
3502
  }
4171
3503
  ),
4172
- /* @__PURE__ */ jsx5("span", { className: "text-slate-300", children: "\xB7" }),
4173
- /* @__PURE__ */ jsx5(
3504
+ /* @__PURE__ */ jsx("span", { className: "text-slate-300", children: "\xB7" }),
3505
+ /* @__PURE__ */ jsx(
4174
3506
  "button",
4175
3507
  {
4176
3508
  type: "button",
@@ -4183,10 +3515,10 @@ function SearchableMultiSelect({
4183
3515
  ] })
4184
3516
  ] })
4185
3517
  ] }),
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) => {
3518
+ /* @__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
3519
  const isSelected = value.includes(option.value);
4188
3520
  const isAtMax = !!max && value.length >= max && !isSelected;
4189
- return /* @__PURE__ */ jsxs4(
3521
+ return /* @__PURE__ */ jsxs(
4190
3522
  "button",
4191
3523
  {
4192
3524
  type: "button",
@@ -4196,14 +3528,14 @@ function SearchableMultiSelect({
4196
3528
  onClick: () => toggleOption(option.value),
4197
3529
  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
3530
  children: [
4199
- /* @__PURE__ */ jsx5(
3531
+ /* @__PURE__ */ jsx(
4200
3532
  "span",
4201
3533
  {
4202
3534
  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" })
3535
+ children: isSelected && /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" })
4204
3536
  }
4205
3537
  ),
4206
- /* @__PURE__ */ jsx5("span", { className: "truncate", children: option.label })
3538
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
4207
3539
  ]
4208
3540
  },
4209
3541
  option.value
@@ -4224,9 +3556,9 @@ function ReferenceSelect({
4224
3556
  onChange
4225
3557
  }) {
4226
3558
  const ctx = useCmsContext();
4227
- const [options, setOptions] = useState5([]);
4228
- const [loading, setLoading] = useState5(true);
4229
- useEffect4(() => {
3559
+ const [options, setOptions] = useState([]);
3560
+ const [loading, setLoading] = useState(true);
3561
+ useEffect(() => {
4230
3562
  if (!collectionId) {
4231
3563
  if (fallbackOptions && fallbackOptions.length > 0) {
4232
3564
  setOptions(fallbackOptions.map((opt) => typeof opt === "string" ? { value: opt, label: opt } : opt));
@@ -4261,7 +3593,7 @@ function ReferenceSelect({
4261
3593
  }, [collectionId, displayField, valueField, fallbackOptions, ctx.adapter]);
4262
3594
  if (multiple) {
4263
3595
  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(
3596
+ return /* @__PURE__ */ jsx(
4265
3597
  SearchableMultiSelect,
4266
3598
  {
4267
3599
  options,
@@ -4281,20 +3613,20 @@ function ReferenceSelect({
4281
3613
  if (singleVal && !displayOptions.some((o) => o.value === singleVal)) {
4282
3614
  displayOptions.unshift({ value: singleVal, label: singleVal });
4283
3615
  }
4284
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
4285
- /* @__PURE__ */ jsxs4(
3616
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3617
+ /* @__PURE__ */ jsxs(
4286
3618
  "select",
4287
3619
  {
4288
3620
  value: singleVal,
4289
3621
  onChange: (e) => onChange(e.target.value),
4290
3622
  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
3623
  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}`))
3624
+ /* @__PURE__ */ jsx("option", { value: "", children: loading ? "Cargando opciones..." : "-- Selecciona una opci\xF3n --" }),
3625
+ displayOptions.map((o, idx) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, `${o.value}-${idx}`))
4294
3626
  ]
4295
3627
  }
4296
3628
  ),
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" })
3629
+ /* @__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
3630
  ] });
4299
3631
  }
4300
3632
  function ReferenceTableCell({
@@ -4305,9 +3637,9 @@ function ReferenceTableCell({
4305
3637
  multiple = false
4306
3638
  }) {
4307
3639
  const ctx = useCmsContext();
4308
- const [labels, setLabels] = useState5([]);
3640
+ const [labels, setLabels] = useState([]);
4309
3641
  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(() => {
3642
+ useEffect(() => {
4311
3643
  if (!collectionId || ids.length === 0) {
4312
3644
  setLabels(ids);
4313
3645
  return;
@@ -4324,33 +3656,33 @@ function ReferenceTableCell({
4324
3656
  setLabels(ids);
4325
3657
  });
4326
3658
  }, [collectionId, displayField, valueField, JSON.stringify(ids), ctx.adapter]);
4327
- if (labels.length === 0) return /* @__PURE__ */ jsx5("span", { children: "-" });
3659
+ if (labels.length === 0) return /* @__PURE__ */ jsx("span", { children: "-" });
4328
3660
  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: [
3661
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1 max-w-[260px]", children: [
3662
+ 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)),
3663
+ 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
3664
  "+",
4333
3665
  labels.length - 3
4334
3666
  ] })
4335
3667
  ] });
4336
3668
  }
4337
- return /* @__PURE__ */ jsx5("span", { children: labels[0] });
3669
+ return /* @__PURE__ */ jsx("span", { children: labels[0] });
4338
3670
  }
4339
3671
 
4340
3672
  // src/admin/AdminLogin.tsx
4341
- import { useState as useState6, useEffect as useEffect5 } from "react";
3673
+ import { useState as useState2, useEffect as useEffect2 } from "react";
4342
3674
  import { Lock, UserPlus } from "lucide-react";
4343
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
3675
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
4344
3676
  function AdminLogin({
4345
3677
  authApiRoute = "/api/admin/auth",
4346
3678
  redirectRoute = "/admin"
4347
3679
  }) {
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(() => {
3680
+ const [email, setEmail] = useState2("");
3681
+ const [password, setPassword] = useState2("");
3682
+ const [error, setError] = useState2("");
3683
+ const [loading, setLoading] = useState2(false);
3684
+ const [view, setView] = useState2("checking");
3685
+ useEffect2(() => {
4354
3686
  fetch(authApiRoute, { cache: "no-store" }).then((res) => res.json()).then((data) => {
4355
3687
  if (data.hasUsers) {
4356
3688
  setView("login");
@@ -4386,21 +3718,21 @@ function AdminLogin({
4386
3718
  }
4387
3719
  };
4388
3720
  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" })
3721
+ 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: [
3722
+ /* @__PURE__ */ jsx2("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
3723
+ /* @__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
3724
  ] }) });
4393
3725
  }
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(
3726
+ 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: [
3727
+ /* @__PURE__ */ jsxs2("div", { className: "p-8", children: [
3728
+ /* @__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" }) }),
3729
+ /* @__PURE__ */ jsx2("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
3730
+ /* @__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." }),
3731
+ 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 }),
3732
+ /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
3733
+ /* @__PURE__ */ jsxs2("div", { children: [
3734
+ /* @__PURE__ */ jsx2("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
3735
+ /* @__PURE__ */ jsx2(
4404
3736
  "input",
4405
3737
  {
4406
3738
  type: "email",
@@ -4412,9 +3744,9 @@ function AdminLogin({
4412
3744
  }
4413
3745
  )
4414
3746
  ] }),
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(
3747
+ /* @__PURE__ */ jsxs2("div", { children: [
3748
+ /* @__PURE__ */ jsx2("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
3749
+ /* @__PURE__ */ jsx2(
4418
3750
  "input",
4419
3751
  {
4420
3752
  type: "password",
@@ -4426,21 +3758,21 @@ function AdminLogin({
4426
3758
  }
4427
3759
  )
4428
3760
  ] }),
4429
- /* @__PURE__ */ jsx6(
3761
+ /* @__PURE__ */ jsx2(
4430
3762
  "button",
4431
3763
  {
4432
3764
  type: "submit",
4433
3765
  disabled: loading,
4434
3766
  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" })
3767
+ 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: [
3768
+ /* @__PURE__ */ jsx2("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
3769
+ /* @__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
3770
  ] }) : view === "register" ? "Create Account" : "Sign In"
4439
3771
  }
4440
3772
  )
4441
3773
  ] })
4442
3774
  ] }),
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" })
3775
+ /* @__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
3776
  ] }) });
4445
3777
  }
4446
3778
  export {