@object-ui/layout 5.1.1 → 5.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  # @object-ui/layout
2
2
 
3
+ ## 5.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@5.3.0
8
+ - @object-ui/core@5.3.0
9
+ - @object-ui/react@5.3.0
10
+ - @object-ui/components@5.3.0
11
+
12
+ ## 5.2.1
13
+
14
+ ### Patch Changes
15
+
16
+ - @object-ui/types@5.2.1
17
+ - @object-ui/core@5.2.1
18
+ - @object-ui/react@5.2.1
19
+ - @object-ui/components@5.2.1
20
+
21
+ ## 5.2.0
22
+
23
+ ### Minor Changes
24
+
25
+ - e7b6eae: `NavigationRenderer` now resolves a group's initial open state with two
26
+ platform-aware defaults:
27
+ 1. **`expanded` field honored.** `@objectstack/spec` `AppNavigation`
28
+ uses `expanded: true | false` on group items; objectui historically
29
+ only read `defaultOpen`. App authors who wrote `expanded: false`
30
+ would see no effect because the renderer silently fell back to the
31
+ "open unless `defaultOpen === false`" rule. Both field names now
32
+ resolve to the same explicit override.
33
+ 2. **Auto-collapse long groups.** When the author has set neither
34
+ `expanded` nor `defaultOpen`, groups with **8 or more direct
35
+ children** default to collapsed. Long sidebar sections (e.g. 10+
36
+ reports) doubled the sidebar height and pushed siblings below the
37
+ fold — Slack, Linear, and Notion all default-collapse oversized
38
+ sections for the same reason. Short groups (typical 3–6 items) still
39
+ open by default.
40
+ 3. **Active-route override.** Both heuristics are bypassed when the
41
+ current route lives inside the group, so users never lose visual
42
+ orientation to a hidden active item.
43
+
44
+ ### Patch Changes
45
+
46
+ - b703480: feat(layout): smoother sidebar transitions
47
+
48
+ `SidebarNav` now animates the previously-instant state changes:
49
+ - Active-state colour swap on `SidebarMenuButton` /
50
+ `SidebarMenuSubButton` is wrapped in `transition-colors duration-150`
51
+ so navigating between rows glides rather than snaps.
52
+ - `CollapsibleContent` (group children) fades + slides in / out when
53
+ the parent group is expanded/collapsed (chevron already rotated;
54
+ the children now match).
55
+
56
+ All animations are gated on `motion-safe:` so users with
57
+ `prefers-reduced-motion` see the original instant UI.
58
+
59
+ - Updated dependencies [de0c5e6]
60
+ - Updated dependencies [9997cae]
61
+ - Updated dependencies [b2d1704]
62
+ - Updated dependencies [87bc8ff]
63
+ - Updated dependencies [3ebba63]
64
+ - Updated dependencies [a8d12ec]
65
+ - Updated dependencies [70b5570]
66
+ - Updated dependencies [aa063db]
67
+ - Updated dependencies [d1442e3]
68
+ - Updated dependencies [7c7400a]
69
+ - @object-ui/types@5.2.0
70
+ - @object-ui/core@5.2.0
71
+ - @object-ui/react@5.2.0
72
+ - @object-ui/components@5.2.0
73
+
3
74
  ## 5.1.1
4
75
 
5
76
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import { ComponentRegistry as e } from "@object-ui/core";
2
2
  import t, { useEffect as n, useMemo as r, useState as i } from "react";
3
3
  import { Badge as a, Button as o, Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l, Input as u, LazyIcon as d, Separator as f, Sidebar as p, SidebarContent as m, SidebarFooter as h, SidebarGroup as g, SidebarGroupContent as _, SidebarGroupLabel as v, SidebarHeader as y, SidebarInput as b, SidebarInset as x, SidebarMenu as S, SidebarMenuAction as C, SidebarMenuButton as w, SidebarMenuItem as T, SidebarMenuSub as E, SidebarMenuSubButton as D, SidebarMenuSubItem as O, SidebarProvider as k, cn as A, getLazyIcon as j } from "@object-ui/components";
4
- import { ArrowLeft as M, ChevronRight as N, FileText as P, GripVertical as ee, Layers as te, Pin as ne, PinOff as re, Search as ie, Star as F } from "lucide-react";
5
- import { SchemaRenderer as I, useRecordContext as ae } from "@object-ui/react";
6
- import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
7
- import { Link as oe, NavLink as se, useLocation as B } from "react-router-dom";
8
- import { DndContext as ce, KeyboardSensor as le, PointerSensor as ue, closestCenter as de, useSensor as fe, useSensors as pe } from "@dnd-kit/core";
9
- import { SortableContext as me, arrayMove as he, useSortable as ge, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
10
- import { CSS as ve } from "@dnd-kit/utilities";
11
- import { menuItemToNavigationItem as ye } from "@object-ui/types";
4
+ import { ArrowLeft as M, ChevronRight as N, FileText as P, GripVertical as F, Layers as I, Pin as ee, PinOff as te, Search as ne, Star as L } from "lucide-react";
5
+ import { SchemaRenderer as R, useRecordContext as re } from "@object-ui/react";
6
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
7
+ import { Link as H, NavLink as U, useLocation as W } from "react-router-dom";
8
+ import { DndContext as G, KeyboardSensor as ie, PointerSensor as ae, closestCenter as oe, useSensor as K, useSensors as se } from "@dnd-kit/core";
9
+ import { SortableContext as ce, arrayMove as le, useSortable as ue, verticalListSortingStrategy as de } from "@dnd-kit/sortable";
10
+ import { CSS as fe } from "@dnd-kit/utilities";
11
+ import { menuItemToNavigationItem as pe } from "@object-ui/types";
12
12
  //#region src/PageHeader.tsx
13
- var be = (e) => {
13
+ var me = (e) => {
14
14
  let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
15
15
  return t != null && String(t).trim() ? String(t) : [
16
16
  e?.salutation,
17
17
  e?.first_name,
18
18
  e?.last_name
19
19
  ].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
20
- }, V = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
20
+ }, he = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
21
21
  let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
22
- return r == null ? "" : typeof r == "object" ? be(r) ?? "" : String(r);
22
+ return r == null ? "" : typeof r == "object" ? me(r) ?? "" : String(r);
23
23
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
24
- function H({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
- let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = V(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = V(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
24
+ function q({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
+ let m = re(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = he(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = he(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
26
26
  if (typeof window > "u") return;
27
27
  let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
28
28
  t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
29
- }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(I, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ R(I, { schema: {
29
+ }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ B(R, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ B(R, { schema: {
30
30
  type: "record:quick_actions",
31
31
  properties: {
32
32
  actions: T,
@@ -35,39 +35,39 @@ function H({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
35
35
  inline: !0
36
36
  }
37
37
  } }) : null) || w;
38
- return /* @__PURE__ */ R("div", {
38
+ return /* @__PURE__ */ B("div", {
39
39
  className: A("flex flex-col gap-3 pb-4 border-b", u),
40
40
  ...p,
41
- children: /* @__PURE__ */ z("div", {
41
+ children: /* @__PURE__ */ V("div", {
42
42
  className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
43
  children: [
44
- S && /* @__PURE__ */ R(o, {
44
+ S && /* @__PURE__ */ B(o, {
45
45
  type: "button",
46
46
  variant: "ghost",
47
47
  size: "icon",
48
48
  onClick: C,
49
49
  "aria-label": "Back to list",
50
50
  className: "flex-shrink-0 -ml-2",
51
- children: /* @__PURE__ */ R(M, { className: "size-4" })
51
+ children: /* @__PURE__ */ B(M, { className: "size-4" })
52
52
  }),
53
- i && (g || y) && /* @__PURE__ */ R("div", {
53
+ i && (g || y) && /* @__PURE__ */ B("div", {
54
54
  className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
55
- children: typeof i == "string" ? /* @__PURE__ */ R(d, {
55
+ children: typeof i == "string" ? /* @__PURE__ */ B(d, {
56
56
  name: i,
57
57
  className: "size-5"
58
58
  }) : i
59
59
  }),
60
- /* @__PURE__ */ z("div", {
60
+ /* @__PURE__ */ V("div", {
61
61
  className: "flex flex-col min-w-0 flex-1",
62
- children: [g ? /* @__PURE__ */ R("h1", {
62
+ children: [g ? /* @__PURE__ */ B("h1", {
63
63
  className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
64
  children: g
65
- }) : null, y && /* @__PURE__ */ R("p", {
65
+ }) : null, y && /* @__PURE__ */ B("p", {
66
66
  className: "text-sm text-muted-foreground truncate",
67
67
  children: y
68
68
  })]
69
69
  }),
70
- E && /* @__PURE__ */ R("div", {
70
+ E && /* @__PURE__ */ B("div", {
71
71
  className: "flex items-center gap-2 ml-auto",
72
72
  children: E
73
73
  })
@@ -77,7 +77,7 @@ function H({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
77
77
  }
78
78
  //#endregion
79
79
  //#region src/AppShell.tsx
80
- function U(e) {
80
+ function ge(e) {
81
81
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
82
82
  if (!t) return null;
83
83
  let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
@@ -101,17 +101,17 @@ function U(e) {
101
101
  l: l * 100
102
102
  };
103
103
  }
104
- function W(e) {
105
- let t = U(e);
104
+ function _e(e) {
105
+ let t = ge(e);
106
106
  return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
107
107
  }
108
- function G(e) {
109
- let t = U(e);
108
+ function ve(e) {
109
+ let t = ge(e);
110
110
  if (!t) return null;
111
111
  let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
112
112
  return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
113
113
  }
114
- function K(e) {
114
+ function ye(e) {
115
115
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
116
116
  if (!t) return "0 0% 100%";
117
117
  let n = (e) => {
@@ -120,16 +120,16 @@ function K(e) {
120
120
  }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
121
121
  return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
122
122
  }
123
- function xe(e, t) {
123
+ function be(e, t) {
124
124
  n(() => {
125
125
  let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
126
126
  if (e?.primaryColor) {
127
- let t = W(e.primaryColor), i = G(e.primaryColor), a = r() && i || t;
128
- a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : K(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
127
+ let t = _e(e.primaryColor), i = ve(e.primaryColor), a = r() && i || t;
128
+ a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : ye(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
129
129
  } else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
130
130
  if (e?.accentColor) {
131
- let t = W(e.accentColor), i = G(e.accentColor), a = r() && i || t;
132
- a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : K(e.accentColor)));
131
+ let t = _e(e.accentColor), i = ve(e.accentColor), a = r() && i || t;
132
+ a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : ye(e.accentColor)));
133
133
  } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
134
134
  };
135
135
  i();
@@ -156,18 +156,18 @@ function xe(e, t) {
156
156
  t
157
157
  ]);
158
158
  }
159
- function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
160
- return xe(a, a?.title), /* @__PURE__ */ z(k, {
159
+ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
160
+ return be(a, a?.title), /* @__PURE__ */ V(k, {
161
161
  defaultOpen: i,
162
162
  className: "!flex-col h-svh overflow-hidden",
163
- children: [/* @__PURE__ */ R("header", {
163
+ children: [/* @__PURE__ */ B("header", {
164
164
  className: "sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
165
165
  children: t
166
- }), /* @__PURE__ */ z("div", {
166
+ }), /* @__PURE__ */ V("div", {
167
167
  className: "flex flex-1 min-h-0 w-full",
168
- children: [e, /* @__PURE__ */ R(x, {
168
+ children: [e, /* @__PURE__ */ B(x, {
169
169
  className: "min-w-0",
170
- children: /* @__PURE__ */ R("main", {
170
+ children: /* @__PURE__ */ B("main", {
171
171
  className: A("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6", r),
172
172
  children: n
173
173
  })
@@ -177,11 +177,11 @@ function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
177
177
  }
178
178
  //#endregion
179
179
  //#region src/PageCard.tsx
180
- function Se({ className: e, children: t, ...n }) {
181
- return /* @__PURE__ */ R("div", {
180
+ function xe({ className: e, children: t, ...n }) {
181
+ return /* @__PURE__ */ B("div", {
182
182
  className: A("rounded-xl border bg-card text-card-foreground shadow", e),
183
183
  ...n,
184
- children: /* @__PURE__ */ R("div", {
184
+ children: /* @__PURE__ */ B("div", {
185
185
  className: "p-6",
186
186
  children: t
187
187
  })
@@ -189,7 +189,7 @@ function Se({ className: e, children: t, ...n }) {
189
189
  }
190
190
  //#endregion
191
191
  //#region src/ResponsiveGrid.tsx
192
- var Ce = {
192
+ var Se = {
193
193
  xs: {
194
194
  1: "grid-cols-1",
195
195
  2: "grid-cols-2",
@@ -239,11 +239,11 @@ var Ce = {
239
239
  12: "2xl:grid-cols-12"
240
240
  }
241
241
  };
242
- function we(e) {
242
+ function Ce(e) {
243
243
  if (!e) return "grid-cols-1";
244
244
  let t = [];
245
245
  for (let [n, r] of Object.entries(e)) {
246
- let e = Ce[n];
246
+ let e = Se[n];
247
247
  if (e && r) {
248
248
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
249
249
  t.push(e[n]);
@@ -251,7 +251,7 @@ function we(e) {
251
251
  }
252
252
  return t.join(" ") || "grid-cols-1";
253
253
  }
254
- var Te = {
254
+ var we = {
255
255
  0: "gap-0",
256
256
  1: "gap-1",
257
257
  2: "gap-2",
@@ -260,16 +260,16 @@ var Te = {
260
260
  5: "gap-5",
261
261
  6: "gap-6",
262
262
  8: "gap-8"
263
- }, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
264
- className: A("grid", we(e), typeof t == "number" ? Te[t] || `gap-${t}` : "", n),
263
+ }, Te = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ B("div", {
264
+ className: A("grid", Ce(e), typeof t == "number" ? we[t] || `gap-${t}` : "", n),
265
265
  children: r
266
266
  });
267
267
  //#endregion
268
268
  //#region src/NavigationRenderer.tsx
269
- function J(e) {
269
+ function Y(e) {
270
270
  return e ? j(e) : P;
271
271
  }
272
- function Y(e, t) {
272
+ function X(e, t) {
273
273
  if (typeof e == "string") return e;
274
274
  if (t) {
275
275
  let n = t(e.key, {
@@ -280,8 +280,8 @@ function Y(e, t) {
280
280
  }
281
281
  return e.defaultValue || e.key;
282
282
  }
283
- function X(e, t, n, r, i, a) {
284
- let o = Y(e.label, n);
283
+ function Ee(e, t, n, r, i, a) {
284
+ let o = X(e.label, n);
285
285
  if (typeof e.label != "string") return o;
286
286
  if (e.type === "object" && e.objectName) {
287
287
  if (e.viewName) return a ? a(e.objectName, e.viewName, o) : o;
@@ -336,25 +336,25 @@ function Z(e, t) {
336
336
  children: n
337
337
  }), e;
338
338
  }
339
- return Y(r.label).toLowerCase().includes(n) && e.push(r), e;
339
+ return X(r.label).toLowerCase().includes(n) && e.push(r), e;
340
340
  }, []);
341
341
  }
342
342
  var Me = 5;
343
343
  function Ne({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, t: p }) {
344
- let { attributes: m, listeners: h, setNodeRef: g, transform: _, transition: v, isDragging: y } = ge({
344
+ let { attributes: m, listeners: h, setNodeRef: g, transform: _, transition: v, isDragging: y } = ue({
345
345
  id: e.id,
346
346
  disabled: !c
347
347
  });
348
- return /* @__PURE__ */ R("div", {
348
+ return /* @__PURE__ */ B("div", {
349
349
  ref: g,
350
350
  style: {
351
- transform: ve.Transform.toString(_),
351
+ transform: fe.Transform.toString(_),
352
352
  transition: v,
353
353
  opacity: y ? .5 : void 0,
354
354
  zIndex: y ? 10 : void 0
355
355
  },
356
356
  ...m,
357
- children: /* @__PURE__ */ R(Q, {
357
+ children: /* @__PURE__ */ B(Q, {
358
358
  item: e,
359
359
  basePath: t,
360
360
  evalVis: n,
@@ -372,120 +372,143 @@ function Ne({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
372
372
  })
373
373
  });
374
374
  }
375
- function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: o, onAction: u, enablePinning: d, onPinToggle: p, dragListeners: m, resolveObjectLabel: h, resolveDashboardLabel: y, resolveGroupLabel: b, resolveViewLabel: x, t: E }) {
376
- let D = B(), [O, k] = i(e.defaultOpen !== !1);
377
- if (!n(e.visible) || e.requiredPermissions?.length && !r(e.requiredPermissions)) return null;
378
- let A = e.requiresObject, j = e.requiresService;
379
- if (A && !o("object", A) || j && !o("service", j)) return null;
380
- if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
375
+ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onAction: d, enablePinning: p, onPinToggle: m, dragListeners: h, resolveObjectLabel: y, resolveDashboardLabel: b, resolveGroupLabel: x, resolveViewLabel: E, t: D }) {
376
+ let O = W(), k = (() => {
377
+ let t = e.expanded;
378
+ if (typeof t == "boolean") return t;
379
+ if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
380
+ })(), A = e.type === "group" ? e.children?.length ?? 0 : 0, [j, M] = i(t.useMemo(() => {
381
+ if (e.type !== "group") return !1;
382
+ let t = (e) => {
383
+ if (!e) return !1;
384
+ for (let r of e) {
385
+ if (r.type === "group") {
386
+ if (t(r.children)) return !0;
387
+ continue;
388
+ }
389
+ let { href: e } = Ae(r, n);
390
+ if (je(r, e, O.pathname)) return !0;
391
+ }
392
+ return !1;
393
+ };
394
+ return t(e.children);
395
+ }, [
396
+ e,
397
+ n,
398
+ O.pathname
399
+ ]) ? !0 : k ?? !(A >= 8));
400
+ if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
401
+ let P = e.requiresObject, I = e.requiresService;
402
+ if (P && !u("object", P) || I && !u("service", I)) return null;
403
+ if (e.type === "separator") return /* @__PURE__ */ B(f, { className: "my-2" });
381
404
  if (e.type === "group") {
382
- let i = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
383
- return /* @__PURE__ */ R(s, {
384
- open: O,
385
- onOpenChange: k,
386
- children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
405
+ let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
406
+ return /* @__PURE__ */ B(s, {
407
+ open: j,
408
+ onOpenChange: M,
409
+ children: /* @__PURE__ */ V(g, { children: [/* @__PURE__ */ B(v, {
387
410
  asChild: !0,
388
- children: /* @__PURE__ */ z(l, {
411
+ children: /* @__PURE__ */ V(l, {
389
412
  className: "flex w-full items-center justify-between",
390
- children: [X(e, h, E, y, b, x), /* @__PURE__ */ R(N, { className: `ml-auto h-4 w-4 transition-transform ${O ? "rotate-90" : ""}` })]
413
+ children: [Ee(e, y, D, b, x, E), /* @__PURE__ */ B(N, { className: `ml-auto h-4 w-4 transition-transform ${j ? "rotate-90" : ""}` })]
391
414
  })
392
- }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: i.map((e) => /* @__PURE__ */ R(Q, {
415
+ }), /* @__PURE__ */ B(c, { children: /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: t.map((e) => /* @__PURE__ */ B(Q, {
393
416
  item: e,
394
- basePath: t,
395
- evalVis: n,
396
- checkPerm: r,
397
- checkCap: o,
398
- onAction: u,
399
- enablePinning: d,
400
- onPinToggle: p,
401
- resolveObjectLabel: h,
402
- resolveDashboardLabel: y,
403
- resolveGroupLabel: b,
404
- resolveViewLabel: x,
405
- t: E
417
+ basePath: n,
418
+ evalVis: r,
419
+ checkPerm: o,
420
+ checkCap: u,
421
+ onAction: d,
422
+ enablePinning: p,
423
+ onPinToggle: m,
424
+ resolveObjectLabel: y,
425
+ resolveDashboardLabel: b,
426
+ resolveGroupLabel: x,
427
+ resolveViewLabel: E,
428
+ t: D
406
429
  }, e.id)) }) }) })] })
407
430
  });
408
431
  }
409
432
  if (e.type === "action") {
410
- let t = J(e.icon), n = Y(e.label, E);
411
- return /* @__PURE__ */ z(T, { children: [
412
- m && /* @__PURE__ */ R("span", {
433
+ let t = Y(e.icon), n = X(e.label, D);
434
+ return /* @__PURE__ */ V(T, { children: [
435
+ h && /* @__PURE__ */ B("span", {
413
436
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
414
- "aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
415
- ...m,
416
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
437
+ "aria-label": D ? D("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
438
+ ...h,
439
+ children: /* @__PURE__ */ B(F, { className: "h-3.5 w-3.5" })
417
440
  }),
418
- /* @__PURE__ */ z(w, {
441
+ /* @__PURE__ */ V(w, {
419
442
  tooltip: n,
420
- onClick: () => u?.(e),
443
+ onClick: () => d?.(e),
421
444
  children: [
422
- /* @__PURE__ */ R(t, { className: "h-4 w-4" }),
423
- /* @__PURE__ */ R("span", { children: n }),
424
- e.badge != null && /* @__PURE__ */ R(a, {
445
+ /* @__PURE__ */ B(t, { className: "h-4 w-4" }),
446
+ /* @__PURE__ */ B("span", { children: n }),
447
+ e.badge != null && /* @__PURE__ */ B(a, {
425
448
  variant: e.badgeVariant ?? "default",
426
449
  className: "ml-auto text-[10px] px-1.5 py-0",
427
450
  children: e.badge
428
451
  })
429
452
  ]
430
453
  }),
431
- d && p && /* @__PURE__ */ R(C, {
454
+ p && m && /* @__PURE__ */ B(C, {
432
455
  showOnHover: !0,
433
- onClick: () => p(e.id, !e.pinned),
434
- "aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
456
+ onClick: () => m(e.id, !e.pinned),
457
+ "aria-label": D ? D(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
435
458
  defaultValue: e.pinned ? `Unpin ${n}` : `Pin ${n}`,
436
459
  name: n
437
460
  }) : e.pinned ? `Unpin ${n}` : `Pin ${n}`,
438
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
461
+ children: e.pinned ? /* @__PURE__ */ B(te, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ B(ee, { className: "h-3.5 w-3.5" })
439
462
  })
440
463
  ] });
441
464
  }
442
- let M = J(e.icon), { href: P, external: te } = Ae(e, t), ie = je(e, P, D.pathname), F = X(e, h, E, y, b, x), I = /* @__PURE__ */ z(L, { children: [
443
- /* @__PURE__ */ R(M, { className: "h-4 w-4" }),
444
- /* @__PURE__ */ R("span", { children: F }),
445
- e.badge != null && /* @__PURE__ */ R(a, {
465
+ let ne = Y(e.icon), { href: L, external: R } = Ae(e, n), re = je(e, L, O.pathname), U = Ee(e, y, D, b, x, E), G = /* @__PURE__ */ V(z, { children: [
466
+ /* @__PURE__ */ B(ne, { className: "h-4 w-4" }),
467
+ /* @__PURE__ */ B("span", { children: U }),
468
+ e.badge != null && /* @__PURE__ */ B(a, {
446
469
  variant: e.badgeVariant ?? "default",
447
470
  className: "ml-auto text-[10px] px-1.5 py-0",
448
471
  children: e.badge
449
472
  })
450
473
  ] });
451
- return /* @__PURE__ */ z(T, { children: [
452
- m && /* @__PURE__ */ R("span", {
474
+ return /* @__PURE__ */ V(T, { children: [
475
+ h && /* @__PURE__ */ B("span", {
453
476
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
454
- "aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
455
- ...m,
456
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
477
+ "aria-label": D ? D("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
478
+ ...h,
479
+ children: /* @__PURE__ */ B(F, { className: "h-3.5 w-3.5" })
457
480
  }),
458
- /* @__PURE__ */ R(w, {
481
+ /* @__PURE__ */ B(w, {
459
482
  asChild: !0,
460
- isActive: ie,
461
- tooltip: F,
462
- children: te ? /* @__PURE__ */ R("a", {
463
- href: P,
483
+ isActive: re,
484
+ tooltip: U,
485
+ children: R ? /* @__PURE__ */ B("a", {
486
+ href: L,
464
487
  target: "_blank",
465
488
  rel: "noopener noreferrer",
466
- children: I
467
- }) : /* @__PURE__ */ R(oe, {
468
- to: P,
469
- children: I
489
+ children: G
490
+ }) : /* @__PURE__ */ B(H, {
491
+ to: L,
492
+ children: G
470
493
  })
471
494
  }),
472
- d && p && /* @__PURE__ */ R(C, {
495
+ p && m && /* @__PURE__ */ B(C, {
473
496
  showOnHover: !0,
474
- onClick: () => p(e.id, !e.pinned),
475
- "aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
476
- defaultValue: e.pinned ? `Unpin ${F}` : `Pin ${F}`,
477
- name: F
478
- }) : e.pinned ? `Unpin ${F}` : `Pin ${F}`,
479
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
497
+ onClick: () => m(e.id, !e.pinned),
498
+ "aria-label": D ? D(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
499
+ defaultValue: e.pinned ? `Unpin ${U}` : `Pin ${U}`,
500
+ name: U
501
+ }) : e.pinned ? `Unpin ${U}` : `Pin ${U}`,
502
+ children: e.pinned ? /* @__PURE__ */ B(te, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ B(ee, { className: "h-3.5 w-3.5" })
480
503
  })
481
504
  ] });
482
505
  }
483
506
  function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermission: i = Oe, checkCapability: a = ke, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, t: y }) {
484
- let b = r(() => s ? Z(e, s) : e, [e, s]), x = r(() => Pe(b), [b]), C = b.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), w = pe(fe(ue, { activationConstraint: { distance: Me } }), fe(le)), T = (e) => {
507
+ let b = r(() => s ? Z(e, s) : e, [e, s]), x = r(() => Pe(b), [b]), C = b.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), w = se(K(ae, { activationConstraint: { distance: Me } }), K(ie)), T = (e) => {
485
508
  let { active: t, over: n } = e;
486
509
  if (!n || t.id === n.id || !d) return;
487
510
  let r = C.findIndex((e) => e.id === t.id), i = C.findIndex((e) => e.id === n.id);
488
- r === -1 || i === -1 || d(he(C, r, i).map((e, t) => ({
511
+ r === -1 || i === -1 || d(le(C, r, i).map((e, t) => ({
489
512
  ...e,
490
513
  order: t
491
514
  })));
@@ -502,29 +525,29 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermis
502
525
  resolveGroupLabel: m,
503
526
  resolveViewLabel: h,
504
527
  t: y
505
- }, D = C.some((e) => e.type === "group"), O = x.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
528
+ }, D = C.some((e) => e.type === "group"), O = x.length > 0 && c ? /* @__PURE__ */ V(g, { children: [/* @__PURE__ */ V(v, {
506
529
  className: "flex items-center gap-1.5",
507
- children: [/* @__PURE__ */ R(F, { className: "h-3.5 w-3.5" }), y ? y("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
508
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(Q, {
530
+ children: [/* @__PURE__ */ B(L, { className: "h-3.5 w-3.5" }), y ? y("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
531
+ }), /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: x.map((e) => /* @__PURE__ */ B(Q, {
509
532
  item: e,
510
533
  ...E
511
534
  }, `fav-${e.id}`)) }) })] }) : null;
512
535
  if (!D) {
513
536
  let e = C.filter((e) => e.type !== "group").map((e) => e.id);
514
- return /* @__PURE__ */ z(L, { children: [O, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: u ? /* @__PURE__ */ R(ce, {
537
+ return /* @__PURE__ */ V(z, { children: [O, /* @__PURE__ */ B(g, { children: /* @__PURE__ */ B(_, { children: u ? /* @__PURE__ */ B(G, {
515
538
  sensors: w,
516
- collisionDetection: de,
539
+ collisionDetection: oe,
517
540
  onDragEnd: T,
518
- children: /* @__PURE__ */ R(me, {
541
+ children: /* @__PURE__ */ B(ce, {
519
542
  items: e,
520
- strategy: _e,
521
- children: /* @__PURE__ */ R(S, { children: C.map((e) => /* @__PURE__ */ R(Ne, {
543
+ strategy: de,
544
+ children: /* @__PURE__ */ B(S, { children: C.map((e) => /* @__PURE__ */ B(Ne, {
522
545
  item: e,
523
546
  enableReorder: u,
524
547
  ...E
525
548
  }, e.id)) })
526
549
  })
527
- }) : /* @__PURE__ */ R(S, { children: C.map((e) => /* @__PURE__ */ R(Q, {
550
+ }) : /* @__PURE__ */ B(S, { children: C.map((e) => /* @__PURE__ */ B(Q, {
528
551
  item: e,
529
552
  ...E
530
553
  }, e.id)) }) }) })] });
@@ -532,17 +555,17 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermis
532
555
  let k = [], A = [], j = (e) => {
533
556
  if (A.length === 0) return;
534
557
  let t = A;
535
- A = [], k.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
558
+ A = [], k.push(/* @__PURE__ */ B(g, { children: /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: t.map((e) => /* @__PURE__ */ B(Q, {
536
559
  item: e,
537
560
  ...E
538
561
  }, e.id)) }) }) }, e));
539
562
  };
540
563
  return C.forEach((e, t) => {
541
- e.type === "group" ? (j(`leaf-${t}`), k.push(/* @__PURE__ */ R(Q, {
564
+ e.type === "group" ? (j(`leaf-${t}`), k.push(/* @__PURE__ */ B(Q, {
542
565
  item: e,
543
566
  ...E
544
567
  }, e.id))) : A.push(e);
545
- }), j("leaf-end"), /* @__PURE__ */ z(L, { children: [O, k] });
568
+ }), j("leaf-end"), /* @__PURE__ */ V(z, { children: [O, k] });
546
569
  }
547
570
  function Pe(e) {
548
571
  let t = [];
@@ -553,84 +576,84 @@ function Pe(e) {
553
576
  //#region src/AppSchemaRenderer.tsx
554
577
  function Fe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
555
578
  let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
556
- return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
579
+ return a.length <= 1 ? null : /* @__PURE__ */ V(g, { children: [/* @__PURE__ */ V(v, {
557
580
  className: "flex items-center gap-1.5",
558
- children: [/* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" }), "Area"]
559
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
560
- let r = J(e.icon);
561
- return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
581
+ children: [/* @__PURE__ */ B(I, { className: "h-3.5 w-3.5" }), "Area"]
582
+ }), /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: a.map((e) => {
583
+ let r = Y(e.icon);
584
+ return /* @__PURE__ */ B(T, { children: /* @__PURE__ */ V(w, {
562
585
  isActive: e.id === t,
563
- tooltip: Y(e.label),
586
+ tooltip: X(e.label),
564
587
  onClick: () => n(e.id),
565
- children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: Y(e.label) })]
588
+ children: [/* @__PURE__ */ B(r, { className: "h-4 w-4" }), /* @__PURE__ */ B("span", { children: X(e.label) })]
566
589
  }) }, e.id);
567
590
  }) }) })] });
568
591
  }
569
592
  function Ie({ items: e, basePath: t }) {
570
- let n = B(), r = (e) => {
593
+ let n = W(), r = (e) => {
571
594
  let t = [];
572
595
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
573
596
  return t;
574
597
  }, i = r(e).slice(0, 5);
575
- return i.length === 0 ? null : /* @__PURE__ */ R("div", {
598
+ return i.length === 0 ? null : /* @__PURE__ */ B("div", {
576
599
  className: "fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",
577
600
  role: "navigation",
578
601
  "aria-label": "Mobile navigation",
579
602
  children: i.map((e) => {
580
- let r = J(e.icon), i = "#";
603
+ let r = Y(e.icon), i = "#";
581
604
  e.type === "object" ? (i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`)) : e.type === "dashboard" ? i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#" : e.type === "page" ? i = e.pageName ? `${t}/page/${e.pageName}` : "#" : e.type === "report" ? i = e.reportName ? `${t}/report/${e.reportName}` : "#" : e.type === "url" && (i = e.url ?? "#");
582
605
  let a = i !== "#" && n.pathname.startsWith(i);
583
- return /* @__PURE__ */ z(oe, {
606
+ return /* @__PURE__ */ V(H, {
584
607
  to: i,
585
608
  className: `flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a ? "text-primary" : "text-muted-foreground hover:text-foreground"}`,
586
- children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
609
+ children: [/* @__PURE__ */ B(r, { className: "h-5 w-5" }), /* @__PURE__ */ B("span", {
587
610
  className: "text-[10px] truncate max-w-[60px]",
588
- children: Y(e.label)
611
+ children: X(e.label)
589
612
  })]
590
613
  }, e.id);
591
614
  })
592
615
  });
593
616
  }
594
617
  function Le({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, activeAreaId: u, setActiveAreaId: d, resolvedNavigation: f, enableSearch: g, enablePinning: _, onPinToggle: v, enableReorder: x, onReorder: C }) {
595
- let E = J(e.logo), D = e.areas ?? [], [O, k] = i("");
596
- return /* @__PURE__ */ z(p, {
618
+ let E = Y(e.logo), D = e.areas ?? [], [O, k] = i("");
619
+ return /* @__PURE__ */ V(p, {
597
620
  collapsible: "icon",
598
621
  children: [
599
- /* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
622
+ /* @__PURE__ */ V(y, { children: [s ?? /* @__PURE__ */ B(S, { children: /* @__PURE__ */ B(T, { children: /* @__PURE__ */ V(w, {
600
623
  size: "lg",
601
624
  tooltip: e.title ?? e.name,
602
- children: [/* @__PURE__ */ R("div", {
625
+ children: [/* @__PURE__ */ B("div", {
603
626
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
604
- children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
627
+ children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ B("img", {
605
628
  src: e.logo,
606
629
  alt: e.title ?? "",
607
630
  className: "size-6 object-contain"
608
- }) : /* @__PURE__ */ R(E, { className: "size-4" })
609
- }), /* @__PURE__ */ z("div", {
631
+ }) : /* @__PURE__ */ B(E, { className: "size-4" })
632
+ }), /* @__PURE__ */ V("div", {
610
633
  className: "grid flex-1 text-left text-sm leading-tight",
611
- children: [/* @__PURE__ */ R("span", {
634
+ children: [/* @__PURE__ */ B("span", {
612
635
  className: "truncate font-semibold",
613
636
  children: e.title ?? e.name ?? "App"
614
- }), e.description && /* @__PURE__ */ R("span", {
637
+ }), e.description && /* @__PURE__ */ B("span", {
615
638
  className: "truncate text-xs text-muted-foreground",
616
639
  children: e.description
617
640
  })]
618
641
  })]
619
- }) }) }), g && /* @__PURE__ */ R(b, {
642
+ }) }) }), g && /* @__PURE__ */ B(b, {
620
643
  placeholder: "Search navigation…",
621
644
  value: O,
622
645
  onChange: (e) => k(e.target.value),
623
646
  "aria-label": "Search navigation"
624
647
  })] }),
625
- /* @__PURE__ */ z(m, { children: [
626
- D.length > 1 && u && /* @__PURE__ */ R(Fe, {
648
+ /* @__PURE__ */ V(m, { children: [
649
+ D.length > 1 && u && /* @__PURE__ */ B(Fe, {
627
650
  areas: D,
628
651
  activeAreaId: u,
629
652
  onAreaChange: d,
630
653
  evalVis: n,
631
654
  checkPerm: r
632
655
  }),
633
- /* @__PURE__ */ R($, {
656
+ /* @__PURE__ */ B($, {
634
657
  items: f,
635
658
  basePath: t,
636
659
  evaluateVisibility: n,
@@ -645,12 +668,12 @@ function Le({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
645
668
  }),
646
669
  l
647
670
  ] }),
648
- c && /* @__PURE__ */ R(h, { children: c })
671
+ c && /* @__PURE__ */ B(h, { children: c })
649
672
  ]
650
673
  });
651
674
  }
652
675
  function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
653
- let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => ye(e, t)), [e.menu]), E = e.navigation ?? T, D = e.areas ?? [], [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
676
+ let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => pe(e, t)), [e.menu]), E = e.navigation ?? T, D = e.areas ?? [], [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
654
677
  n(() => {
655
678
  D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
656
679
  }, [e.name, A]);
@@ -659,8 +682,8 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
659
682
  favicon: e.favicon,
660
683
  logo: e.logo
661
684
  };
662
- return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(q, {
663
- sidebar: /* @__PURE__ */ R(Le, {
685
+ return /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(J, {
686
+ sidebar: /* @__PURE__ */ B(Le, {
664
687
  schema: e,
665
688
  basePath: t,
666
689
  evalVis: S,
@@ -684,7 +707,7 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
684
707
  defaultOpen: g,
685
708
  branding: M,
686
709
  children: m
687
- }), a === "bottom_nav" && /* @__PURE__ */ R(Ie, {
710
+ }), a === "bottom_nav" && /* @__PURE__ */ B(Ie, {
688
711
  items: j,
689
712
  basePath: t
690
713
  })] });
@@ -694,16 +717,16 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
694
717
  var ze = (e) => e ? Array.isArray(e) ? e : [e] : [];
695
718
  function Be({ schema: e, className: t, style: n, id: r, ...i }) {
696
719
  let a = ze(e.children);
697
- return /* @__PURE__ */ z("div", {
720
+ return /* @__PURE__ */ V("div", {
698
721
  id: r || e.id,
699
722
  className: A("flex flex-col h-full space-y-4", t),
700
723
  style: n,
701
- children: [/* @__PURE__ */ R(H, {
724
+ children: [/* @__PURE__ */ B(q, {
702
725
  title: e.title,
703
726
  description: e.description
704
- }), /* @__PURE__ */ R("div", {
727
+ }), /* @__PURE__ */ B("div", {
705
728
  className: "flex-1 overflow-auto",
706
- children: a.map((e, t) => /* @__PURE__ */ R(I, {
729
+ children: a.map((e, t) => /* @__PURE__ */ B(R, {
707
730
  schema: e,
708
731
  ...i
709
732
  }, e?.id || t))
@@ -716,51 +739,57 @@ function Ve(e) {
716
739
  return "items" in e && !("href" in e);
717
740
  }
718
741
  function He({ item: e, pathname: t }) {
719
- return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
742
+ return e.children && e.children.length > 0 ? /* @__PURE__ */ B(s, {
720
743
  asChild: !0,
721
744
  defaultOpen: !0,
722
745
  className: "group/collapsible",
723
- children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
746
+ children: /* @__PURE__ */ V(T, { children: [/* @__PURE__ */ B(l, {
724
747
  asChild: !0,
725
- children: /* @__PURE__ */ z(w, {
748
+ children: /* @__PURE__ */ V(w, {
726
749
  tooltip: e.title,
750
+ className: "motion-safe:transition-colors motion-safe:duration-150",
727
751
  children: [
728
- e.icon && /* @__PURE__ */ R(e.icon, {}),
729
- /* @__PURE__ */ R("span", { children: e.title }),
730
- e.badge != null && /* @__PURE__ */ R(a, {
752
+ e.icon && /* @__PURE__ */ B(e.icon, {}),
753
+ /* @__PURE__ */ B("span", { children: e.title }),
754
+ e.badge != null && /* @__PURE__ */ B(a, {
731
755
  variant: e.badgeVariant || "default",
732
756
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
733
757
  children: e.badge
734
758
  }),
735
- /* @__PURE__ */ R(N, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
736
- ]
737
- })
738
- }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
739
- asChild: !0,
740
- isActive: t === e.href,
741
- children: /* @__PURE__ */ z(se, {
742
- to: e.href,
743
- children: [
744
- e.icon && /* @__PURE__ */ R(e.icon, {}),
745
- /* @__PURE__ */ R("span", { children: e.title }),
746
- e.badge != null && /* @__PURE__ */ R(a, {
747
- variant: e.badgeVariant || "default",
748
- className: "ml-auto h-5 min-w-5 px-1 text-xs",
749
- children: e.badge
750
- })
759
+ /* @__PURE__ */ B(N, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
751
760
  ]
752
761
  })
753
- }) }, e.href)) }) })] })
754
- }) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
762
+ }), /* @__PURE__ */ B(c, {
763
+ className: "motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150",
764
+ children: /* @__PURE__ */ B(E, { children: e.children.map((e) => /* @__PURE__ */ B(O, { children: /* @__PURE__ */ B(D, {
765
+ asChild: !0,
766
+ isActive: t === e.href,
767
+ className: "motion-safe:transition-colors motion-safe:duration-150",
768
+ children: /* @__PURE__ */ V(U, {
769
+ to: e.href,
770
+ children: [
771
+ e.icon && /* @__PURE__ */ B(e.icon, {}),
772
+ /* @__PURE__ */ B("span", { children: e.title }),
773
+ e.badge != null && /* @__PURE__ */ B(a, {
774
+ variant: e.badgeVariant || "default",
775
+ className: "ml-auto h-5 min-w-5 px-1 text-xs",
776
+ children: e.badge
777
+ })
778
+ ]
779
+ })
780
+ }) }, e.href)) })
781
+ })] })
782
+ }) : /* @__PURE__ */ B(T, { children: /* @__PURE__ */ B(w, {
755
783
  asChild: !0,
756
784
  isActive: t === e.href,
757
785
  tooltip: e.title,
758
- children: /* @__PURE__ */ z(se, {
786
+ className: "motion-safe:transition-colors motion-safe:duration-150",
787
+ children: /* @__PURE__ */ V(U, {
759
788
  to: e.href,
760
789
  children: [
761
- e.icon && /* @__PURE__ */ R(e.icon, {}),
762
- /* @__PURE__ */ R("span", { children: e.title }),
763
- e.badge != null && /* @__PURE__ */ R(a, {
790
+ e.icon && /* @__PURE__ */ B(e.icon, {}),
791
+ /* @__PURE__ */ B("span", { children: e.title }),
792
+ e.badge != null && /* @__PURE__ */ B(a, {
764
793
  variant: e.badgeVariant || "default",
765
794
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
766
795
  children: e.badge
@@ -770,7 +799,7 @@ function He({ item: e, pathname: t }) {
770
799
  }) });
771
800
  }
772
801
  function Ue({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
773
- let s = B(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Ve(e[0]) ? e.map((e) => ({
802
+ let s = W(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Ve(e[0]) ? e.map((e) => ({
774
803
  groupLabel: e.label,
775
804
  items: e.items
776
805
  })) : [{ items: e }], [e]), f = t.useMemo(() => {
@@ -781,14 +810,14 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
781
810
  items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
782
811
  })).filter((e) => e.items.length > 0);
783
812
  }, [d, c]);
784
- return /* @__PURE__ */ R(p, {
813
+ return /* @__PURE__ */ B(p, {
785
814
  className: r,
786
815
  collapsible: i,
787
- children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
816
+ children: /* @__PURE__ */ V(m, { children: [a && /* @__PURE__ */ B("div", {
788
817
  className: "px-3 py-2",
789
- children: /* @__PURE__ */ z("div", {
818
+ children: /* @__PURE__ */ V("div", {
790
819
  className: "relative",
791
- children: [/* @__PURE__ */ R(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
820
+ children: [/* @__PURE__ */ B(ne, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ B(u, {
792
821
  type: "search",
793
822
  placeholder: o,
794
823
  value: c,
@@ -796,16 +825,16 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
796
825
  className: "pl-8 h-9"
797
826
  })]
798
827
  })
799
- }), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
800
- t > 0 && /* @__PURE__ */ R("div", {
828
+ }), f.map((e, t) => /* @__PURE__ */ V(g, { children: [
829
+ t > 0 && /* @__PURE__ */ B("div", {
801
830
  className: "mx-3 mb-1 h-px bg-sidebar-border/60",
802
831
  "aria-hidden": !0
803
832
  }),
804
- /* @__PURE__ */ R(v, {
833
+ /* @__PURE__ */ B(v, {
805
834
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
806
835
  children: e.groupLabel || n
807
836
  }),
808
- /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(He, {
837
+ /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: e.items.map((e) => /* @__PURE__ */ B(He, {
809
838
  item: e,
810
839
  pathname: s.pathname
811
840
  }, e.href)) }) })
@@ -815,7 +844,7 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
815
844
  //#endregion
816
845
  //#region src/index.ts
817
846
  function We() {
818
- e.register("page-header", H, {
847
+ e.register("page-header", q, {
819
848
  namespace: "layout",
820
849
  label: "Page Header",
821
850
  category: "Layout",
@@ -826,16 +855,16 @@ function We() {
826
855
  name: "description",
827
856
  type: "string"
828
857
  }]
829
- }), e.register("page:card", Se, {
858
+ }), e.register("page:card", xe, {
830
859
  namespace: "layout",
831
860
  label: "Page Card",
832
861
  category: "Layout",
833
862
  isContainer: !0
834
- }), e.register("app-shell", q, {
863
+ }), e.register("app-shell", J, {
835
864
  namespace: "layout",
836
865
  label: "App Shell",
837
866
  category: "Layout"
838
- }), e.register("responsive-grid", Ee, {
867
+ }), e.register("responsive-grid", Te, {
839
868
  namespace: "layout",
840
869
  label: "Responsive Grid",
841
870
  category: "Layout",
@@ -883,4 +912,4 @@ try {
883
912
  We();
884
913
  } catch {}
885
914
  //#endregion
886
- export { Re as AppSchemaRenderer, q as AppShell, $ as NavigationRenderer, Be as Page, Se as PageCard, H as PageHeader, Ee as ResponsiveGrid, Ue as SidebarNav, Z as filterNavigationItems, We as registerLayout, J as resolveIcon, Y as resolveLabel, xe as useAppShellBranding };
915
+ export { Re as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Be as Page, xe as PageCard, q as PageHeader, Te as ResponsiveGrid, Ue as SidebarNav, Z as filterNavigationItems, We as registerLayout, Y as resolveIcon, X as resolveLabel, be as useAppShellBranding };
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`@object-ui/react`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g,``).replace(/^\s*[-–—|/·,:]\s*/,``).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=typeof e==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(e),v=b(e,g?.data)||(_?``:e),y=t??s,x=typeof y==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(y),S=b(y,g?.data)||(x?``:y),C=!!g?.recordId,w=!!g?.embedded,T=d??(C&&!w),E=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),D=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,O=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,k=l||m||(O?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:O,location:`record_header`,align:`end`,inline:!0}}}):null)||D;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[T&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:E,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(v||S)&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[v?(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:v}):null,S&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:S})]}),k&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:k})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-primary`,e.primaryColor),n.style.setProperty(`--brand-primary-hsl`,t||a),n.style.setProperty(`--primary`,a),n.style.setProperty(`--primary-foreground`,r()?`222 47% 11%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}else n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-accent`,e.accentColor),n.style.setProperty(`--brand-accent-hsl`,t||a),n.style.setProperty(`--accent`,a),n.style.setProperty(`--accent-foreground`,r()?`222 47% 11%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{className:`sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i,a){let o=P(e.label,n);if(typeof e.label!=`string`)return o;if(e.type===`object`&&e.objectName){if(e.viewName)return a?a(e.objectName,e.viewName,o):o;if(t)return t(e.objectName,o)}return r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,o):i&&e.type===`group`&&e.id?i(e.id,o):o}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0;function z(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function B(e,t,n){return t===`#`?!1:n===t?!0:e.type===`object`&&e.objectName?!(e.viewName||!n.startsWith(`${t}/`)||n.slice(t.length+1).startsWith(`view/`)):n.startsWith(`${t}/`)}function V(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=V(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var H=5;function U({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,t:g}){let{attributes:_,listeners:v,setNodeRef:y,transform:b,transition:x,isDragging:S}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:y,style:{transform:u.CSS.Transform.toString(b),transition:x,opacity:S?.5:void 0,zIndex:S?10:void 0},..._,children:(0,o.jsx)(W,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?v:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,t:g})})}function W({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,t:v}){let y=(0,s.useLocation)(),[b,x]=(0,n.useState)(e.defaultOpen!==!1);if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let S=e.requiresObject,C=e.requiresService;if(S&&!l(`object`,S)||C&&!l(`service`,C))return null;if(e.type===`separator`)return(0,o.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,o.jsx)(r.Collapsible,{open:b,onOpenChange:x,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[F(e,m,v,h,g,_),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${b?`rotate-90`:``}`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:n.map(e=>(0,o.jsx)(W,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,t:v},e.id))})})})]})})}if(e.type===`action`){let t=N(e.icon),n=P(e.label,v);return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":v?v(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,o.jsx)(t,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:n}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":v?v(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}let w=N(e.icon),{href:T,external:E}=z(e,t),D=B(e,T,y.pathname),O=F(e,m,v,h,g,_),k=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:O}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":v?v(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:D,tooltip:O,children:E?(0,o.jsx)(`a`,{href:T,target:`_blank`,rel:`noopener noreferrer`,children:k}):(0,o.jsx)(s.Link,{to:T,children:k})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":v?v(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${O}`:`Pin ${O}`,name:O}):e.pinned?`Unpin ${O}`:`Pin ${O}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}function G({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,t:x}){let S=(0,n.useMemo)(()=>f?V(e,f):e,[e,f]),C=(0,n.useMemo)(()=>K(S),[S]),w=S.slice().sort((e,t)=>(e.order??0)-(t.order??0)),T=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:H}}),(0,c.useSensor)(c.KeyboardSensor)),E=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=w.findIndex(e=>e.id===t.id),i=w.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(w,r,i).map((e,t)=>({...e,order:t})))},D={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,t:x},O=w.some(e=>e.type===`group`),k=C.length>0&&p?(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Star,{className:`h-3.5 w-3.5`}),x?x(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(W,{item:e,...D},`fav-${e.id}`))})})]}):null;if(!O){let e=w.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[k,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:T,collisionDetection:c.closestCenter,onDragEnd:E,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(U,{item:e,enableReorder:h,...D},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(W,{item:e,...D},e.id))})})})]})}let A=[],j=[],M=e=>{if(j.length===0)return;let t=j;j=[],A.push((0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:t.map(e=>(0,o.jsx)(W,{item:e,...D},e.id))})})},e))};return w.forEach((e,t)=>{e.type===`group`?(M(`leaf-${t}`),A.push((0,o.jsx)(W,{item:e,...D},e.id))):j.push(e)}),M(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[k,A]})}function K(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...K(n.children));return t}function q({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function J({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;e.type===`object`?(i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`)):e.type===`dashboard`?i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?i=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?i=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(i=e.url??`#`);let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function Y({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(q,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(G,{items:m,basePath:t,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,o.jsx)(r.SidebarFooter,{children:u})]})}function X({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(Y,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,o.jsx)(J,{items:M,basePath:t})]})}var Z=e=>e?Array.isArray(e)?e:[e]:[];function Q({schema:e,className:t,style:n,id:i,...s}){let c=Z(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function ee(e){return`items`in e&&!(`href`in e)}function te({item:e,pathname:t}){return e.children&&e.children.length>0?(0,o.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,o.jsxs)(r.SidebarMenuItem,{children:[(0,o.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,o.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,o.jsx)(r.SidebarMenuSubItem,{children:(0,o.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function ne({items:e,title:t=`Application`,className:a,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search…`}){let d=(0,s.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:ee(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,o.jsx)(r.Sidebar,{className:a,collapsible:c,children:(0,o.jsxs)(r.SidebarContent,{children:[l&&(0,o.jsx)(`div`,{className:`px-3 py-2`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,o.jsxs)(r.SidebarGroup,{children:[n>0&&(0,o.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,o.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,o.jsx)(te,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,G,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,X,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=X,e.AppShell=D,e.NavigationRenderer=G,e.Page=Q,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=ne,e.filterNavigationItems=V,e.registerLayout=$,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`@object-ui/react`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g,``).replace(/^\s*[-–—|/·,:]\s*/,``).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=typeof e==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(e),v=b(e,g?.data)||(_?``:e),y=t??s,x=typeof y==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(y),S=b(y,g?.data)||(x?``:y),C=!!g?.recordId,w=!!g?.embedded,T=d??(C&&!w),E=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),D=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,O=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,k=l||m||(O?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:O,location:`record_header`,align:`end`,inline:!0}}}):null)||D;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[T&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:E,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(v||S)&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[v?(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:v}):null,S&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:S})]}),k&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:k})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-primary`,e.primaryColor),n.style.setProperty(`--brand-primary-hsl`,t||a),n.style.setProperty(`--primary`,a),n.style.setProperty(`--primary-foreground`,r()?`222 47% 11%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}else n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-accent`,e.accentColor),n.style.setProperty(`--brand-accent-hsl`,t||a),n.style.setProperty(`--accent`,a),n.style.setProperty(`--accent-foreground`,r()?`222 47% 11%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{className:`sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i,a){let o=P(e.label,n);if(typeof e.label!=`string`)return o;if(e.type===`object`&&e.objectName){if(e.viewName)return a?a(e.objectName,e.viewName,o):o;if(t)return t(e.objectName,o)}return r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,o):i&&e.type===`group`&&e.id?i(e.id,o):o}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0;function z(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function B(e,t,n){return t===`#`?!1:n===t?!0:e.type===`object`&&e.objectName?!(e.viewName||!n.startsWith(`${t}/`)||n.slice(t.length+1).startsWith(`view/`)):n.startsWith(`${t}/`)}function V(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=V(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var H=5;function U({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,t:g}){let{attributes:_,listeners:v,setNodeRef:y,transform:b,transition:x,isDragging:S}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:y,style:{transform:u.CSS.Transform.toString(b),transition:x,opacity:S?.5:void 0,zIndex:S?10:void 0},..._,children:(0,o.jsx)(W,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?v:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,t:g})})}function W({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,t:v}){let y=(0,s.useLocation)(),b=(()=>{let t=e.expanded;if(typeof t==`boolean`)return t;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),x=e.type===`group`?e.children?.length??0:0,[S,C]=(0,n.useState)(n.default.useMemo(()=>{if(e.type!==`group`)return!1;let n=e=>{if(!e)return!1;for(let r of e){if(r.type===`group`){if(n(r.children))return!0;continue}let{href:e}=z(r,t);if(B(r,e,y.pathname))return!0}return!1};return n(e.children)},[e,t,y.pathname])?!0:b??!(x>=8));if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let w=e.requiresObject,T=e.requiresService;if(w&&!l(`object`,w)||T&&!l(`service`,T))return null;if(e.type===`separator`)return(0,o.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,o.jsx)(r.Collapsible,{open:S,onOpenChange:C,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[F(e,m,v,h,g,_),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${S?`rotate-90`:``}`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:n.map(e=>(0,o.jsx)(W,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,t:v},e.id))})})})]})})}if(e.type===`action`){let t=N(e.icon),n=P(e.label,v);return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":v?v(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,o.jsx)(t,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:n}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":v?v(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}let E=N(e.icon),{href:D,external:O}=z(e,t),k=B(e,D,y.pathname),A=F(e,m,v,h,g,_),j=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:A}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":v?v(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:k,tooltip:A,children:O?(0,o.jsx)(`a`,{href:D,target:`_blank`,rel:`noopener noreferrer`,children:j}):(0,o.jsx)(s.Link,{to:D,children:j})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":v?v(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${A}`:`Pin ${A}`,name:A}):e.pinned?`Unpin ${A}`:`Pin ${A}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}function G({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,t:x}){let S=(0,n.useMemo)(()=>f?V(e,f):e,[e,f]),C=(0,n.useMemo)(()=>K(S),[S]),w=S.slice().sort((e,t)=>(e.order??0)-(t.order??0)),T=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:H}}),(0,c.useSensor)(c.KeyboardSensor)),E=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=w.findIndex(e=>e.id===t.id),i=w.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(w,r,i).map((e,t)=>({...e,order:t})))},D={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,t:x},O=w.some(e=>e.type===`group`),k=C.length>0&&p?(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Star,{className:`h-3.5 w-3.5`}),x?x(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(W,{item:e,...D},`fav-${e.id}`))})})]}):null;if(!O){let e=w.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[k,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:T,collisionDetection:c.closestCenter,onDragEnd:E,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(U,{item:e,enableReorder:h,...D},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(W,{item:e,...D},e.id))})})})]})}let A=[],j=[],M=e=>{if(j.length===0)return;let t=j;j=[],A.push((0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:t.map(e=>(0,o.jsx)(W,{item:e,...D},e.id))})})},e))};return w.forEach((e,t)=>{e.type===`group`?(M(`leaf-${t}`),A.push((0,o.jsx)(W,{item:e,...D},e.id))):j.push(e)}),M(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[k,A]})}function K(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...K(n.children));return t}function q({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function J({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;e.type===`object`?(i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`)):e.type===`dashboard`?i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?i=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?i=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(i=e.url??`#`);let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function Y({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(q,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(G,{items:m,basePath:t,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,o.jsx)(r.SidebarFooter,{children:u})]})}function X({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(Y,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,o.jsx)(J,{items:M,basePath:t})]})}var Z=e=>e?Array.isArray(e)?e:[e]:[];function Q({schema:e,className:t,style:n,id:i,...s}){let c=Z(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function ee(e){return`items`in e&&!(`href`in e)}function te({item:e,pathname:t}){return e.children&&e.children.length>0?(0,o.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,o.jsxs)(r.SidebarMenuItem,{children:[(0,o.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,o.jsxs)(r.SidebarMenuButton,{tooltip:e.title,className:`motion-safe:transition-colors motion-safe:duration-150`,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,o.jsx)(r.CollapsibleContent,{className:`motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150`,children:(0,o.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,o.jsx)(r.SidebarMenuSubItem,{children:(0,o.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,className:`motion-safe:transition-colors motion-safe:duration-150`,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,className:`motion-safe:transition-colors motion-safe:duration-150`,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function ne({items:e,title:t=`Application`,className:a,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search…`}){let d=(0,s.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:ee(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,o.jsx)(r.Sidebar,{className:a,collapsible:c,children:(0,o.jsxs)(r.SidebarContent,{children:[l&&(0,o.jsx)(`div`,{className:`px-3 py-2`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,o.jsxs)(r.SidebarGroup,{children:[n>0&&(0,o.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,o.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,o.jsx)(te,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,G,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,X,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=X,e.AppShell=D,e.NavigationRenderer=G,e.Page=Q,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=ne,e.filterNavigationItems=V,e.registerLayout=$,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/layout",
3
- "version": "5.1.1",
3
+ "version": "5.3.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.cjs",
@@ -22,10 +22,10 @@
22
22
  "react": "19.2.6",
23
23
  "react-dom": "19.2.6",
24
24
  "tailwind-merge": "^3.6.0",
25
- "@object-ui/components": "5.1.1",
26
- "@object-ui/core": "5.1.1",
27
- "@object-ui/react": "5.1.1",
28
- "@object-ui/types": "5.1.1"
25
+ "@object-ui/components": "5.3.0",
26
+ "@object-ui/core": "5.3.0",
27
+ "@object-ui/react": "5.3.0",
28
+ "@object-ui/types": "5.3.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^18.0.0 || ^19.0.0",