@object-ui/layout 6.1.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @object-ui/layout
2
2
 
3
+ ## 6.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@6.2.1
8
+ - @object-ui/core@6.2.1
9
+ - @object-ui/react@6.2.1
10
+ - @object-ui/components@6.2.1
11
+
12
+ ## 6.2.0
13
+
14
+ ### Patch Changes
15
+
16
+ - @object-ui/react@6.2.0
17
+ - @object-ui/components@6.2.0
18
+ - @object-ui/types@6.2.0
19
+ - @object-ui/core@6.2.0
20
+
3
21
  ## 6.1.0
4
22
 
5
23
  ### 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 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";
4
+ import { ArrowLeft as M, ChevronRight as ee, FileText as te, GripVertical as ne, Layers as N, Pin as re, PinOff as P, Search as F, Star as ie } 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 B, NavLink as V, useLocation as H } from "react-router-dom";
8
+ import { DndContext as U, KeyboardSensor as W, PointerSensor as oe, closestCenter as se, useSensor as ce, useSensors as le } from "@dnd-kit/core";
9
+ import { SortableContext as ue, arrayMove as de, useSortable as fe, verticalListSortingStrategy as pe } from "@dnd-kit/sortable";
10
+ import { CSS as me } from "@dnd-kit/utilities";
11
+ import { menuItemToNavigationItem as he } from "@object-ui/types";
12
12
  //#region src/PageHeader.tsx
13
- var me = (e) => {
13
+ var ge = (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
- }, he = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
20
+ }, G = (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" ? me(r) ?? "" : String(r);
22
+ return r == null ? "" : typeof r == "object" ? ge(r) ?? "" : String(r);
23
23
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
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(() => {
24
+ function K({ 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 = G(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = G(_, 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__ */ 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: {
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: {
30
30
  type: "record:quick_actions",
31
31
  properties: {
32
32
  actions: T,
@@ -35,39 +35,39 @@ function q({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
35
35
  inline: !0
36
36
  }
37
37
  } }) : null) || w;
38
- return /* @__PURE__ */ B("div", {
38
+ return /* @__PURE__ */ R("div", {
39
39
  className: A("flex flex-col gap-3 pb-4 border-b", u),
40
40
  ...p,
41
- children: /* @__PURE__ */ V("div", {
41
+ children: /* @__PURE__ */ z("div", {
42
42
  className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
43
  children: [
44
- S && /* @__PURE__ */ B(o, {
44
+ S && /* @__PURE__ */ R(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__ */ B(M, { className: "size-4" })
51
+ children: /* @__PURE__ */ R(M, { className: "size-4" })
52
52
  }),
53
- i && (g || y) && /* @__PURE__ */ B("div", {
53
+ i && (g || y) && /* @__PURE__ */ R("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__ */ B(d, {
55
+ children: typeof i == "string" ? /* @__PURE__ */ R(d, {
56
56
  name: i,
57
57
  className: "size-5"
58
58
  }) : i
59
59
  }),
60
- /* @__PURE__ */ V("div", {
60
+ /* @__PURE__ */ z("div", {
61
61
  className: "flex flex-col min-w-0 flex-1",
62
- children: [g ? /* @__PURE__ */ B("h1", {
62
+ children: [g ? /* @__PURE__ */ R("h1", {
63
63
  className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
64
  children: g
65
- }) : null, y && /* @__PURE__ */ B("p", {
65
+ }) : null, y && /* @__PURE__ */ R("p", {
66
66
  className: "text-sm text-muted-foreground truncate",
67
67
  children: y
68
68
  })]
69
69
  }),
70
- E && /* @__PURE__ */ B("div", {
70
+ E && /* @__PURE__ */ R("div", {
71
71
  className: "flex items-center gap-2 ml-auto",
72
72
  children: E
73
73
  })
@@ -77,7 +77,7 @@ function q({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
77
77
  }
78
78
  //#endregion
79
79
  //#region src/AppShell.tsx
80
- function ge(e) {
80
+ function q(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;
@@ -102,11 +102,11 @@ function ge(e) {
102
102
  };
103
103
  }
104
104
  function _e(e) {
105
- let t = ge(e);
105
+ let t = q(e);
106
106
  return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
107
107
  }
108
108
  function ve(e) {
109
- let t = ge(e);
109
+ let t = q(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)}%`;
@@ -157,17 +157,17 @@ function be(e, t) {
157
157
  ]);
158
158
  }
159
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, {
160
+ return be(a, a?.title), /* @__PURE__ */ z(k, {
161
161
  defaultOpen: i,
162
162
  className: "!flex-col h-svh overflow-hidden",
163
- children: [/* @__PURE__ */ B("header", {
163
+ children: [/* @__PURE__ */ R("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__ */ V("div", {
166
+ }), /* @__PURE__ */ z("div", {
167
167
  className: "flex flex-1 min-h-0 w-full",
168
- children: [e, /* @__PURE__ */ B(x, {
168
+ children: [e, /* @__PURE__ */ R(x, {
169
169
  className: "min-w-0",
170
- children: /* @__PURE__ */ B("main", {
170
+ children: /* @__PURE__ */ R("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
  })
@@ -178,10 +178,10 @@ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
178
178
  //#endregion
179
179
  //#region src/PageCard.tsx
180
180
  function xe({ className: e, children: t, ...n }) {
181
- return /* @__PURE__ */ B("div", {
181
+ return /* @__PURE__ */ R("div", {
182
182
  className: A("rounded-xl border bg-card text-card-foreground shadow", e),
183
183
  ...n,
184
- children: /* @__PURE__ */ B("div", {
184
+ children: /* @__PURE__ */ R("div", {
185
185
  className: "p-6",
186
186
  children: t
187
187
  })
@@ -260,14 +260,14 @@ var we = {
260
260
  5: "gap-5",
261
261
  6: "gap-6",
262
262
  8: "gap-8"
263
- }, Te = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ B("div", {
263
+ }, Te = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
264
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
269
  function Y(e) {
270
- return e ? j(e) : P;
270
+ return e ? j(e) : te;
271
271
  }
272
272
  function X(e, t) {
273
273
  if (typeof e == "string") return e;
@@ -280,14 +280,14 @@ function X(e, t) {
280
280
  }
281
281
  return e.defaultValue || e.key;
282
282
  }
283
- function Ee(e, t, n, r, i, a) {
284
- let o = X(e.label, n);
285
- if (typeof e.label != "string") return o;
283
+ function Ee(e, t, n, r, i, a, o) {
284
+ let s = X(e.label, n);
285
+ if (typeof e.label != "string") return s;
286
286
  if (e.type === "object" && e.objectName) {
287
- if (e.viewName) return a ? a(e.objectName, e.viewName, o) : o;
288
- if (t) return t(e.objectName, o);
287
+ if (e.viewName) return a ? a(e.objectName, e.viewName, s) : s;
288
+ if (t) return t(e.objectName, s);
289
289
  }
290
- return r && e.type === "dashboard" && e.dashboardName ? r(e.dashboardName, o) : i && e.type === "group" && e.id ? i(e.id, o) : o;
290
+ return r && e.type === "dashboard" && e.dashboardName ? r(e.dashboardName, s) : i && e.type === "group" && e.id ? i(e.id, s) : o && e.id ? o(e.id, s) : s;
291
291
  }
292
292
  var De = (e) => !(e === !1 || e === "false"), Oe = () => !0, ke = () => !0;
293
293
  function Ae(e, t) {
@@ -315,6 +315,43 @@ function Ae(e, t) {
315
315
  href: e.url ?? "#",
316
316
  external: e.target === "_blank"
317
317
  };
318
+ case "component": {
319
+ let n = e.componentRef;
320
+ if (!n) return {
321
+ href: "#",
322
+ external: !1
323
+ };
324
+ let r = n.split(":").filter(Boolean);
325
+ if (r.length === 0) return {
326
+ href: "#",
327
+ external: !1
328
+ };
329
+ let i = e.params;
330
+ if (r[0] === "metadata") {
331
+ let e = r[1], n = i && typeof i.type == "string" ? i.type : void 0, a = i && typeof i.name == "string" ? i.name : void 0;
332
+ return e === "directory" || !e ? {
333
+ href: `${t}/metadata`,
334
+ external: !1
335
+ } : e === "resource" && n ? {
336
+ href: `${t}/metadata${a ? `/${encodeURIComponent(n)}/${encodeURIComponent(a)}` : `/${encodeURIComponent(n)}`}`,
337
+ external: !1
338
+ } : {
339
+ href: `${t}/metadata`,
340
+ external: !1
341
+ };
342
+ }
343
+ let a = `${t}/component/${r.join("/")}`;
344
+ if (i && typeof i == "object") {
345
+ let e = new URLSearchParams();
346
+ for (let [t, n] of Object.entries(i)) n != null && e.set(t, typeof n == "string" ? n : JSON.stringify(n));
347
+ let t = e.toString();
348
+ t && (a += `?${t}`);
349
+ }
350
+ return {
351
+ href: a,
352
+ external: !1
353
+ };
354
+ }
318
355
  default: return {
319
356
  href: "#",
320
357
  external: !1
@@ -340,21 +377,21 @@ function Z(e, t) {
340
377
  }, []);
341
378
  }
342
379
  var Me = 5;
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 } = ue({
380
+ 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, resolveItemLabel: p, t: m }) {
381
+ let { attributes: h, listeners: g, setNodeRef: _, transform: v, transition: y, isDragging: b } = fe({
345
382
  id: e.id,
346
383
  disabled: !c
347
384
  });
348
- return /* @__PURE__ */ B("div", {
349
- ref: g,
385
+ return /* @__PURE__ */ R("div", {
386
+ ref: _,
350
387
  style: {
351
- transform: fe.Transform.toString(_),
352
- transition: v,
353
- opacity: y ? .5 : void 0,
354
- zIndex: y ? 10 : void 0
388
+ transform: me.Transform.toString(v),
389
+ transition: y,
390
+ opacity: b ? .5 : void 0,
391
+ zIndex: b ? 10 : void 0
355
392
  },
356
- ...m,
357
- children: /* @__PURE__ */ B(Q, {
393
+ ...h,
394
+ children: /* @__PURE__ */ R(Q, {
358
395
  item: e,
359
396
  basePath: t,
360
397
  evalVis: n,
@@ -363,21 +400,22 @@ function Ne({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
363
400
  onAction: a,
364
401
  enablePinning: o,
365
402
  onPinToggle: s,
366
- dragListeners: c ? h : void 0,
403
+ dragListeners: c ? g : void 0,
367
404
  resolveObjectLabel: l,
368
405
  resolveDashboardLabel: u,
369
406
  resolveGroupLabel: d,
370
407
  resolveViewLabel: f,
371
- t: p
408
+ resolveItemLabel: p,
409
+ t: m
372
410
  })
373
411
  });
374
412
  }
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 = (() => {
413
+ 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, resolveItemLabel: D, t: O }) {
414
+ let k = H(), A = (() => {
377
415
  let t = e.expanded;
378
416
  if (typeof t == "boolean") return t;
379
417
  if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
380
- })(), A = e.type === "group" ? e.children?.length ?? 0 : 0, [j, M] = i(t.useMemo(() => {
418
+ })(), j = e.type === "group" ? e.children?.length ?? 0 : 0, [M, te] = i(t.useMemo(() => {
381
419
  if (e.type !== "group") return !1;
382
420
  let t = (e) => {
383
421
  if (!e) return !1;
@@ -387,7 +425,7 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
387
425
  continue;
388
426
  }
389
427
  let { href: e } = Ae(r, n);
390
- if (je(r, e, O.pathname)) return !0;
428
+ if (je(r, e, k.pathname)) return !0;
391
429
  }
392
430
  return !1;
393
431
  };
@@ -395,24 +433,24 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
395
433
  }, [
396
434
  e,
397
435
  n,
398
- O.pathname
399
- ]) ? !0 : k ?? !(A >= 8));
436
+ k.pathname
437
+ ]) ? !0 : A ?? !(j >= 8));
400
438
  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" });
439
+ let N = e.requiresObject, F = e.requiresService;
440
+ if (N && !u("object", N) || F && !u("service", F)) return null;
441
+ if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
404
442
  if (e.type === "group") {
405
443
  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, {
444
+ return /* @__PURE__ */ R(s, {
445
+ open: M,
446
+ onOpenChange: te,
447
+ children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
410
448
  asChild: !0,
411
- children: /* @__PURE__ */ V(l, {
449
+ children: /* @__PURE__ */ z(l, {
412
450
  className: "flex w-full items-center justify-between",
413
- children: [Ee(e, y, D, b, x, E), /* @__PURE__ */ B(N, { className: `ml-auto h-4 w-4 transition-transform ${j ? "rotate-90" : ""}` })]
451
+ children: [Ee(e, y, O, b, x, E, D), /* @__PURE__ */ R(ee, { className: `ml-auto h-4 w-4 transition-transform ${M ? "rotate-90" : ""}` })]
414
452
  })
415
- }), /* @__PURE__ */ B(c, { children: /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: t.map((e) => /* @__PURE__ */ B(Q, {
453
+ }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
416
454
  item: e,
417
455
  basePath: n,
418
456
  evalVis: r,
@@ -425,94 +463,95 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
425
463
  resolveDashboardLabel: b,
426
464
  resolveGroupLabel: x,
427
465
  resolveViewLabel: E,
428
- t: D
466
+ resolveItemLabel: D,
467
+ t: O
429
468
  }, e.id)) }) }) })] })
430
469
  });
431
470
  }
432
471
  if (e.type === "action") {
433
- let t = Y(e.icon), n = X(e.label, D);
434
- return /* @__PURE__ */ V(T, { children: [
435
- h && /* @__PURE__ */ B("span", {
472
+ let t = Y(e.icon), r = X(e.label, O);
473
+ return /* @__PURE__ */ z(T, { children: [
474
+ h && /* @__PURE__ */ R("span", {
436
475
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
437
- "aria-label": D ? D("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
476
+ "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
438
477
  ...h,
439
- children: /* @__PURE__ */ B(F, { className: "h-3.5 w-3.5" })
478
+ children: /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
440
479
  }),
441
- /* @__PURE__ */ V(w, {
442
- tooltip: n,
480
+ /* @__PURE__ */ z(w, {
481
+ tooltip: r,
443
482
  onClick: () => d?.(e),
444
483
  children: [
445
- /* @__PURE__ */ B(t, { className: "h-4 w-4" }),
446
- /* @__PURE__ */ B("span", { children: n }),
447
- e.badge != null && /* @__PURE__ */ B(a, {
484
+ /* @__PURE__ */ R(t, { className: "h-4 w-4" }),
485
+ /* @__PURE__ */ R("span", { children: r }),
486
+ e.badge != null && /* @__PURE__ */ R(a, {
448
487
  variant: e.badgeVariant ?? "default",
449
488
  className: "ml-auto text-[10px] px-1.5 py-0",
450
489
  children: e.badge
451
490
  })
452
491
  ]
453
492
  }),
454
- p && m && /* @__PURE__ */ B(C, {
493
+ p && m && /* @__PURE__ */ R(C, {
455
494
  showOnHover: !0,
456
- onClick: () => m(e.id, !e.pinned),
457
- "aria-label": D ? D(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
458
- defaultValue: e.pinned ? `Unpin ${n}` : `Pin ${n}`,
459
- name: n
460
- }) : e.pinned ? `Unpin ${n}` : `Pin ${n}`,
461
- children: e.pinned ? /* @__PURE__ */ B(te, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ B(ee, { className: "h-3.5 w-3.5" })
495
+ onClick: () => m(e.id, !e.pinned, e, n),
496
+ "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
497
+ defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
498
+ name: r
499
+ }) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
500
+ children: e.pinned ? /* @__PURE__ */ R(P, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
462
501
  })
463
502
  ] });
464
503
  }
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, {
504
+ let ie = Y(e.icon), { href: I, external: ae } = Ae(e, n), V = je(e, I, k.pathname), U = Ee(e, y, O, b, x, E, D), W = /* @__PURE__ */ z(L, { children: [
505
+ /* @__PURE__ */ R(ie, { className: "h-4 w-4" }),
506
+ /* @__PURE__ */ R("span", { children: U }),
507
+ e.badge != null && /* @__PURE__ */ R(a, {
469
508
  variant: e.badgeVariant ?? "default",
470
509
  className: "ml-auto text-[10px] px-1.5 py-0",
471
510
  children: e.badge
472
511
  })
473
512
  ] });
474
- return /* @__PURE__ */ V(T, { children: [
475
- h && /* @__PURE__ */ B("span", {
513
+ return /* @__PURE__ */ z(T, { children: [
514
+ h && /* @__PURE__ */ R("span", {
476
515
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
477
- "aria-label": D ? D("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
516
+ "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
478
517
  ...h,
479
- children: /* @__PURE__ */ B(F, { className: "h-3.5 w-3.5" })
518
+ children: /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
480
519
  }),
481
- /* @__PURE__ */ B(w, {
520
+ /* @__PURE__ */ R(w, {
482
521
  asChild: !0,
483
- isActive: re,
522
+ isActive: V,
484
523
  tooltip: U,
485
- children: R ? /* @__PURE__ */ B("a", {
486
- href: L,
524
+ children: ae ? /* @__PURE__ */ R("a", {
525
+ href: I,
487
526
  target: "_blank",
488
527
  rel: "noopener noreferrer",
489
- children: G
490
- }) : /* @__PURE__ */ B(H, {
491
- to: L,
492
- children: G
528
+ children: W
529
+ }) : /* @__PURE__ */ R(B, {
530
+ to: I,
531
+ children: W
493
532
  })
494
533
  }),
495
- p && m && /* @__PURE__ */ B(C, {
534
+ p && m && /* @__PURE__ */ R(C, {
496
535
  showOnHover: !0,
497
- onClick: () => m(e.id, !e.pinned),
498
- "aria-label": D ? D(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
536
+ onClick: () => m(e.id, !e.pinned, e, n),
537
+ "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
499
538
  defaultValue: e.pinned ? `Unpin ${U}` : `Pin ${U}`,
500
539
  name: U
501
540
  }) : 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" })
541
+ children: e.pinned ? /* @__PURE__ */ R(P, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
503
542
  })
504
543
  ] });
505
544
  }
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 }) {
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) => {
545
+ 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, resolveItemLabel: y, t: b }) {
546
+ let x = r(() => s ? Z(e, s) : e, [e, s]), C = r(() => Pe(x), [x]), w = x.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), T = le(ce(oe, { activationConstraint: { distance: Me } }), ce(W)), E = (e) => {
508
547
  let { active: t, over: n } = e;
509
548
  if (!n || t.id === n.id || !d) return;
510
- let r = C.findIndex((e) => e.id === t.id), i = C.findIndex((e) => e.id === n.id);
511
- r === -1 || i === -1 || d(le(C, r, i).map((e, t) => ({
549
+ let r = w.findIndex((e) => e.id === t.id), i = w.findIndex((e) => e.id === n.id);
550
+ r === -1 || i === -1 || d(de(w, r, i).map((e, t) => ({
512
551
  ...e,
513
552
  order: t
514
553
  })));
515
- }, E = {
554
+ }, D = {
516
555
  basePath: t,
517
556
  evalVis: n,
518
557
  checkPerm: i,
@@ -524,48 +563,49 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermis
524
563
  resolveDashboardLabel: p,
525
564
  resolveGroupLabel: m,
526
565
  resolveViewLabel: h,
527
- t: y
528
- }, D = C.some((e) => e.type === "group"), O = x.length > 0 && c ? /* @__PURE__ */ V(g, { children: [/* @__PURE__ */ V(v, {
566
+ resolveItemLabel: y,
567
+ t: b
568
+ }, O = w.some((e) => e.type === "group"), k = C.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
529
569
  className: "flex items-center gap-1.5",
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, {
570
+ children: [/* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
571
+ }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: C.map((e) => /* @__PURE__ */ R(Q, {
532
572
  item: e,
533
- ...E
573
+ ...D
534
574
  }, `fav-${e.id}`)) }) })] }) : null;
535
- if (!D) {
536
- let e = C.filter((e) => e.type !== "group").map((e) => e.id);
537
- return /* @__PURE__ */ V(z, { children: [O, /* @__PURE__ */ B(g, { children: /* @__PURE__ */ B(_, { children: u ? /* @__PURE__ */ B(G, {
538
- sensors: w,
539
- collisionDetection: oe,
540
- onDragEnd: T,
541
- children: /* @__PURE__ */ B(ce, {
575
+ if (!O) {
576
+ let e = w.filter((e) => e.type !== "group").map((e) => e.id);
577
+ return /* @__PURE__ */ z(L, { children: [k, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: u ? /* @__PURE__ */ R(U, {
578
+ sensors: T,
579
+ collisionDetection: se,
580
+ onDragEnd: E,
581
+ children: /* @__PURE__ */ R(ue, {
542
582
  items: e,
543
- strategy: de,
544
- children: /* @__PURE__ */ B(S, { children: C.map((e) => /* @__PURE__ */ B(Ne, {
583
+ strategy: pe,
584
+ children: /* @__PURE__ */ R(S, { children: w.map((e) => /* @__PURE__ */ R(Ne, {
545
585
  item: e,
546
586
  enableReorder: u,
547
- ...E
587
+ ...D
548
588
  }, e.id)) })
549
589
  })
550
- }) : /* @__PURE__ */ B(S, { children: C.map((e) => /* @__PURE__ */ B(Q, {
590
+ }) : /* @__PURE__ */ R(S, { children: w.map((e) => /* @__PURE__ */ R(Q, {
551
591
  item: e,
552
- ...E
592
+ ...D
553
593
  }, e.id)) }) }) })] });
554
594
  }
555
- let k = [], A = [], j = (e) => {
556
- if (A.length === 0) return;
557
- let t = A;
558
- A = [], k.push(/* @__PURE__ */ B(g, { children: /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: t.map((e) => /* @__PURE__ */ B(Q, {
595
+ let A = [], j = [], M = (e) => {
596
+ if (j.length === 0) return;
597
+ let t = j;
598
+ j = [], A.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
559
599
  item: e,
560
- ...E
600
+ ...D
561
601
  }, e.id)) }) }) }, e));
562
602
  };
563
- return C.forEach((e, t) => {
564
- e.type === "group" ? (j(`leaf-${t}`), k.push(/* @__PURE__ */ B(Q, {
603
+ return w.forEach((e, t) => {
604
+ e.type === "group" ? (M(`leaf-${t}`), A.push(/* @__PURE__ */ R(Q, {
565
605
  item: e,
566
- ...E
567
- }, e.id))) : A.push(e);
568
- }), j("leaf-end"), /* @__PURE__ */ V(z, { children: [O, k] });
606
+ ...D
607
+ }, e.id))) : j.push(e);
608
+ }), M("leaf-end"), /* @__PURE__ */ z(L, { children: [k, A] });
569
609
  }
570
610
  function Pe(e) {
571
611
  let t = [];
@@ -576,37 +616,54 @@ function Pe(e) {
576
616
  //#region src/AppSchemaRenderer.tsx
577
617
  function Fe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
578
618
  let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
579
- return a.length <= 1 ? null : /* @__PURE__ */ V(g, { children: [/* @__PURE__ */ V(v, {
619
+ return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
580
620
  className: "flex items-center gap-1.5",
581
- children: [/* @__PURE__ */ B(I, { className: "h-3.5 w-3.5" }), "Area"]
582
- }), /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: a.map((e) => {
621
+ children: [/* @__PURE__ */ R(N, { className: "h-3.5 w-3.5" }), "Area"]
622
+ }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
583
623
  let r = Y(e.icon);
584
- return /* @__PURE__ */ B(T, { children: /* @__PURE__ */ V(w, {
624
+ return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
585
625
  isActive: e.id === t,
586
626
  tooltip: X(e.label),
587
627
  onClick: () => n(e.id),
588
- children: [/* @__PURE__ */ B(r, { className: "h-4 w-4" }), /* @__PURE__ */ B("span", { children: X(e.label) })]
628
+ children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: X(e.label) })]
589
629
  }) }, e.id);
590
630
  }) }) })] });
591
631
  }
592
632
  function Ie({ items: e, basePath: t }) {
593
- let n = W(), r = (e) => {
633
+ let n = H(), r = (e) => {
594
634
  let t = [];
595
635
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
596
636
  return t;
597
637
  }, i = r(e).slice(0, 5);
598
- return i.length === 0 ? null : /* @__PURE__ */ B("div", {
638
+ return i.length === 0 ? null : /* @__PURE__ */ R("div", {
599
639
  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",
600
640
  role: "navigation",
601
641
  "aria-label": "Mobile navigation",
602
642
  children: i.map((e) => {
603
643
  let r = Y(e.icon), i = "#";
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 ?? "#");
644
+ if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
645
+ else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
646
+ else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
647
+ else if (e.type === "report") i = e.reportName ? `${t}/report/${e.reportName}` : "#";
648
+ else if (e.type === "url") i = e.url ?? "#";
649
+ else if (e.type === "component") {
650
+ let n = e.componentRef;
651
+ if (n) {
652
+ i = `${t}/component/${n.split(":").filter(Boolean).join("/")}`;
653
+ let r = e.params;
654
+ if (r) {
655
+ let e = new URLSearchParams();
656
+ for (let [t, n] of Object.entries(r)) n != null && e.set(t, typeof n == "string" ? n : JSON.stringify(n));
657
+ let t = e.toString();
658
+ t && (i += `?${t}`);
659
+ }
660
+ }
661
+ }
605
662
  let a = i !== "#" && n.pathname.startsWith(i);
606
- return /* @__PURE__ */ V(H, {
663
+ return /* @__PURE__ */ z(B, {
607
664
  to: i,
608
665
  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"}`,
609
- children: [/* @__PURE__ */ B(r, { className: "h-5 w-5" }), /* @__PURE__ */ B("span", {
666
+ children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
610
667
  className: "text-[10px] truncate max-w-[60px]",
611
668
  children: X(e.label)
612
669
  })]
@@ -616,44 +673,44 @@ function Ie({ items: e, basePath: t }) {
616
673
  }
617
674
  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 }) {
618
675
  let E = Y(e.logo), D = e.areas ?? [], [O, k] = i("");
619
- return /* @__PURE__ */ V(p, {
676
+ return /* @__PURE__ */ z(p, {
620
677
  collapsible: "icon",
621
678
  children: [
622
- /* @__PURE__ */ V(y, { children: [s ?? /* @__PURE__ */ B(S, { children: /* @__PURE__ */ B(T, { children: /* @__PURE__ */ V(w, {
679
+ /* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
623
680
  size: "lg",
624
681
  tooltip: e.title ?? e.name,
625
- children: [/* @__PURE__ */ B("div", {
682
+ children: [/* @__PURE__ */ R("div", {
626
683
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
627
- children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ B("img", {
684
+ children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
628
685
  src: e.logo,
629
686
  alt: e.title ?? "",
630
687
  className: "size-6 object-contain"
631
- }) : /* @__PURE__ */ B(E, { className: "size-4" })
632
- }), /* @__PURE__ */ V("div", {
688
+ }) : /* @__PURE__ */ R(E, { className: "size-4" })
689
+ }), /* @__PURE__ */ z("div", {
633
690
  className: "grid flex-1 text-left text-sm leading-tight",
634
- children: [/* @__PURE__ */ B("span", {
691
+ children: [/* @__PURE__ */ R("span", {
635
692
  className: "truncate font-semibold",
636
693
  children: e.title ?? e.name ?? "App"
637
- }), e.description && /* @__PURE__ */ B("span", {
694
+ }), e.description && /* @__PURE__ */ R("span", {
638
695
  className: "truncate text-xs text-muted-foreground",
639
696
  children: e.description
640
697
  })]
641
698
  })]
642
- }) }) }), g && /* @__PURE__ */ B(b, {
699
+ }) }) }), g && /* @__PURE__ */ R(b, {
643
700
  placeholder: "Search navigation…",
644
701
  value: O,
645
702
  onChange: (e) => k(e.target.value),
646
703
  "aria-label": "Search navigation"
647
704
  })] }),
648
- /* @__PURE__ */ V(m, { children: [
649
- D.length > 1 && u && /* @__PURE__ */ B(Fe, {
705
+ /* @__PURE__ */ z(m, { children: [
706
+ D.length > 1 && u && /* @__PURE__ */ R(Fe, {
650
707
  areas: D,
651
708
  activeAreaId: u,
652
709
  onAreaChange: d,
653
710
  evalVis: n,
654
711
  checkPerm: r
655
712
  }),
656
- /* @__PURE__ */ B($, {
713
+ /* @__PURE__ */ R($, {
657
714
  items: f,
658
715
  basePath: t,
659
716
  evaluateVisibility: n,
@@ -668,12 +725,12 @@ function Le({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
668
725
  }),
669
726
  l
670
727
  ] }),
671
- c && /* @__PURE__ */ B(h, { children: c })
728
+ c && /* @__PURE__ */ R(h, { children: c })
672
729
  ]
673
730
  });
674
731
  }
675
732
  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 }) {
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(",");
733
+ let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => he(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(",");
677
734
  n(() => {
678
735
  D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
679
736
  }, [e.name, A]);
@@ -682,8 +739,8 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
682
739
  favicon: e.favicon,
683
740
  logo: e.logo
684
741
  };
685
- return /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(J, {
686
- sidebar: /* @__PURE__ */ B(Le, {
742
+ return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(J, {
743
+ sidebar: /* @__PURE__ */ R(Le, {
687
744
  schema: e,
688
745
  basePath: t,
689
746
  evalVis: S,
@@ -707,7 +764,7 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
707
764
  defaultOpen: g,
708
765
  branding: M,
709
766
  children: m
710
- }), a === "bottom_nav" && /* @__PURE__ */ B(Ie, {
767
+ }), a === "bottom_nav" && /* @__PURE__ */ R(Ie, {
711
768
  items: j,
712
769
  basePath: t
713
770
  })] });
@@ -717,16 +774,16 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
717
774
  var ze = (e) => e ? Array.isArray(e) ? e : [e] : [];
718
775
  function Be({ schema: e, className: t, style: n, id: r, ...i }) {
719
776
  let a = ze(e.children);
720
- return /* @__PURE__ */ V("div", {
777
+ return /* @__PURE__ */ z("div", {
721
778
  id: r || e.id,
722
779
  className: A("flex flex-col h-full space-y-4", t),
723
780
  style: n,
724
- children: [/* @__PURE__ */ B(q, {
781
+ children: [/* @__PURE__ */ R(K, {
725
782
  title: e.title,
726
783
  description: e.description
727
- }), /* @__PURE__ */ B("div", {
784
+ }), /* @__PURE__ */ R("div", {
728
785
  className: "flex-1 overflow-auto",
729
- children: a.map((e, t) => /* @__PURE__ */ B(R, {
786
+ children: a.map((e, t) => /* @__PURE__ */ R(I, {
730
787
  schema: e,
731
788
  ...i
732
789
  }, e?.id || t))
@@ -739,38 +796,38 @@ function Ve(e) {
739
796
  return "items" in e && !("href" in e);
740
797
  }
741
798
  function He({ item: e, pathname: t }) {
742
- return e.children && e.children.length > 0 ? /* @__PURE__ */ B(s, {
799
+ return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
743
800
  asChild: !0,
744
801
  defaultOpen: !0,
745
802
  className: "group/collapsible",
746
- children: /* @__PURE__ */ V(T, { children: [/* @__PURE__ */ B(l, {
803
+ children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
747
804
  asChild: !0,
748
- children: /* @__PURE__ */ V(w, {
805
+ children: /* @__PURE__ */ z(w, {
749
806
  tooltip: e.title,
750
807
  className: "motion-safe:transition-colors motion-safe:duration-150",
751
808
  children: [
752
- e.icon && /* @__PURE__ */ B(e.icon, {}),
753
- /* @__PURE__ */ B("span", { children: e.title }),
754
- e.badge != null && /* @__PURE__ */ B(a, {
809
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
810
+ /* @__PURE__ */ R("span", { children: e.title }),
811
+ e.badge != null && /* @__PURE__ */ R(a, {
755
812
  variant: e.badgeVariant || "default",
756
813
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
757
814
  children: e.badge
758
815
  }),
759
- /* @__PURE__ */ B(N, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
816
+ /* @__PURE__ */ R(ee, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
760
817
  ]
761
818
  })
762
- }), /* @__PURE__ */ B(c, {
819
+ }), /* @__PURE__ */ R(c, {
763
820
  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, {
821
+ children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
765
822
  asChild: !0,
766
823
  isActive: t === e.href,
767
824
  className: "motion-safe:transition-colors motion-safe:duration-150",
768
- children: /* @__PURE__ */ V(U, {
825
+ children: /* @__PURE__ */ z(V, {
769
826
  to: e.href,
770
827
  children: [
771
- e.icon && /* @__PURE__ */ B(e.icon, {}),
772
- /* @__PURE__ */ B("span", { children: e.title }),
773
- e.badge != null && /* @__PURE__ */ B(a, {
828
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
829
+ /* @__PURE__ */ R("span", { children: e.title }),
830
+ e.badge != null && /* @__PURE__ */ R(a, {
774
831
  variant: e.badgeVariant || "default",
775
832
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
776
833
  children: e.badge
@@ -779,17 +836,17 @@ function He({ item: e, pathname: t }) {
779
836
  })
780
837
  }) }, e.href)) })
781
838
  })] })
782
- }) : /* @__PURE__ */ B(T, { children: /* @__PURE__ */ B(w, {
839
+ }) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
783
840
  asChild: !0,
784
841
  isActive: t === e.href,
785
842
  tooltip: e.title,
786
843
  className: "motion-safe:transition-colors motion-safe:duration-150",
787
- children: /* @__PURE__ */ V(U, {
844
+ children: /* @__PURE__ */ z(V, {
788
845
  to: e.href,
789
846
  children: [
790
- e.icon && /* @__PURE__ */ B(e.icon, {}),
791
- /* @__PURE__ */ B("span", { children: e.title }),
792
- e.badge != null && /* @__PURE__ */ B(a, {
847
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
848
+ /* @__PURE__ */ R("span", { children: e.title }),
849
+ e.badge != null && /* @__PURE__ */ R(a, {
793
850
  variant: e.badgeVariant || "default",
794
851
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
795
852
  children: e.badge
@@ -799,7 +856,7 @@ function He({ item: e, pathname: t }) {
799
856
  }) });
800
857
  }
801
858
  function Ue({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
802
- let s = W(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Ve(e[0]) ? e.map((e) => ({
859
+ let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Ve(e[0]) ? e.map((e) => ({
803
860
  groupLabel: e.label,
804
861
  items: e.items
805
862
  })) : [{ items: e }], [e]), f = t.useMemo(() => {
@@ -810,14 +867,14 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
810
867
  items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
811
868
  })).filter((e) => e.items.length > 0);
812
869
  }, [d, c]);
813
- return /* @__PURE__ */ B(p, {
870
+ return /* @__PURE__ */ R(p, {
814
871
  className: r,
815
872
  collapsible: i,
816
- children: /* @__PURE__ */ V(m, { children: [a && /* @__PURE__ */ B("div", {
873
+ children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
817
874
  className: "px-3 py-2",
818
- children: /* @__PURE__ */ V("div", {
875
+ children: /* @__PURE__ */ z("div", {
819
876
  className: "relative",
820
- children: [/* @__PURE__ */ B(ne, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ B(u, {
877
+ children: [/* @__PURE__ */ R(F, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
821
878
  type: "search",
822
879
  placeholder: o,
823
880
  value: c,
@@ -825,16 +882,16 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
825
882
  className: "pl-8 h-9"
826
883
  })]
827
884
  })
828
- }), f.map((e, t) => /* @__PURE__ */ V(g, { children: [
829
- t > 0 && /* @__PURE__ */ B("div", {
885
+ }), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
886
+ t > 0 && /* @__PURE__ */ R("div", {
830
887
  className: "mx-3 mb-1 h-px bg-sidebar-border/60",
831
888
  "aria-hidden": !0
832
889
  }),
833
- /* @__PURE__ */ B(v, {
890
+ /* @__PURE__ */ R(v, {
834
891
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
835
892
  children: e.groupLabel || n
836
893
  }),
837
- /* @__PURE__ */ B(_, { children: /* @__PURE__ */ B(S, { children: e.items.map((e) => /* @__PURE__ */ B(He, {
894
+ /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(He, {
838
895
  item: e,
839
896
  pathname: s.pathname
840
897
  }, e.href)) }) })
@@ -844,7 +901,7 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
844
901
  //#endregion
845
902
  //#region src/index.ts
846
903
  function We() {
847
- e.register("page-header", q, {
904
+ e.register("page-header", K, {
848
905
  namespace: "layout",
849
906
  label: "Page Header",
850
907
  category: "Layout",
@@ -912,4 +969,4 @@ try {
912
969
  We();
913
970
  } catch {}
914
971
  //#endregion
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 };
972
+ export { Re as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Be as Page, xe as PageCard, K 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=(()=>{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});
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,o){let s=P(e.label,n);if(typeof e.label!=`string`)return s;if(e.type===`object`&&e.objectName){if(e.viewName)return a?a(e.objectName,e.viewName,s):s;if(t)return t(e.objectName,s)}return r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,s):i&&e.type===`group`&&e.id?i(e.id,s):o&&e.id?o(e.id,s):s}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`};case`component`:{let n=e.componentRef;if(!n)return{href:`#`,external:!1};let r=n.split(`:`).filter(Boolean);if(r.length===0)return{href:`#`,external:!1};let i=e.params;if(r[0]===`metadata`){let e=r[1],n=i&&typeof i.type==`string`?i.type:void 0,a=i&&typeof i.name==`string`?i.name:void 0;return e===`directory`||!e?{href:`${t}/metadata`,external:!1}:e===`resource`&&n?{href:`${t}/metadata${a?`/${encodeURIComponent(n)}/${encodeURIComponent(a)}`:`/${encodeURIComponent(n)}`}`,external:!1}:{href:`${t}/metadata`,external:!1}}let a=`${t}/component/${r.join(`/`)}`;if(i&&typeof i==`object`){let e=new URLSearchParams;for(let[t,n]of Object.entries(i))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(a+=`?${t}`)}return{href:a,external:!1}}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,resolveItemLabel:g,t:_}){let{attributes:v,listeners:y,setNodeRef:b,transform:x,transition:S,isDragging:C}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:b,style:{transform:u.CSS.Transform.toString(x),transition:S,opacity:C?.5:void 0,zIndex:C?10:void 0},...v,children:(0,o.jsx)(W,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?y:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,resolveItemLabel:g,t:_})})}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:_,resolveItemLabel:v,t:y}){let b=(0,s.useLocation)(),x=(()=>{let t=e.expanded;if(typeof t==`boolean`)return t;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),S=e.type===`group`?e.children?.length??0:0,[C,w]=(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,b.pathname))return!0}return!1};return n(e.children)},[e,t,b.pathname])?!0:x??!(S>=8));if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let T=e.requiresObject,E=e.requiresService;if(T&&!l(`object`,T)||E&&!l(`service`,E))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:C,onOpenChange:w,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,y,h,g,_,v),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${C?`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:_,resolveItemLabel:v,t:y},e.id))})})})]})})}if(e.type===`action`){let n=N(e.icon),a=P(e.label,y);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":y?y(`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:a,onClick:()=>u?.(e),children:[(0,o.jsx)(n,{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})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned,e,t),"aria-label":y?y(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`})})]})}let D=N(e.icon),{href:O,external:k}=z(e,t),A=B(e,O,b.pathname),j=F(e,m,y,h,g,_,v),M=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:j}),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":y?y(`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:A,tooltip:j,children:k?(0,o.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener noreferrer`,children:M}):(0,o.jsx)(s.Link,{to:O,children:M})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned,e,t),"aria-label":y?y(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${j}`:`Pin ${j}`,name:j}):e.pinned?`Unpin ${j}`:`Pin ${j}`,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,resolveItemLabel:x,t:S}){let C=(0,n.useMemo)(()=>f?V(e,f):e,[e,f]),w=(0,n.useMemo)(()=>K(C),[C]),T=C.slice().sort((e,t)=>(e.order??0)-(t.order??0)),E=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:H}}),(0,c.useSensor)(c.KeyboardSensor)),D=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=T.findIndex(e=>e.id===t.id),i=T.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(T,r,i).map((e,t)=>({...e,order:t})))},O={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,resolveItemLabel:x,t:S},k=T.some(e=>e.type===`group`),A=w.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`}),S?S(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(W,{item:e,...O},`fav-${e.id}`))})})]}):null;if(!k){let e=T.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[A,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:E,collisionDetection:c.closestCenter,onDragEnd:D,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:T.map(e=>(0,o.jsx)(U,{item:e,enableReorder:h,...O},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:T.map(e=>(0,o.jsx)(W,{item:e,...O},e.id))})})})]})}let j=[],M=[],N=e=>{if(M.length===0)return;let t=M;M=[],j.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,...O},e.id))})})},e))};return T.forEach((e,t)=>{e.type===`group`?(N(`leaf-${t}`),j.push((0,o.jsx)(W,{item:e,...O},e.id))):M.push(e)}),N(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[A,j]})}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=`#`;if(e.type===`object`)i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`);else if(e.type===`dashboard`)i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`;else if(e.type===`page`)i=e.pageName?`${t}/page/${e.pageName}`:`#`;else if(e.type===`report`)i=e.reportName?`${t}/report/${e.reportName}`:`#`;else if(e.type===`url`)i=e.url??`#`;else if(e.type===`component`){let n=e.componentRef;if(n){i=`${t}/component/${n.split(`:`).filter(Boolean).join(`/`)}`;let r=e.params;if(r){let e=new URLSearchParams;for(let[t,n]of Object.entries(r))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(i+=`?${t}`)}}}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});
@@ -37,7 +37,7 @@ export interface AppSchemaRendererProps {
37
37
  /** Enable pin/favorite toggle on navigation items */
38
38
  enablePinning?: boolean;
39
39
  /** Called when a navigation item is pinned or unpinned */
40
- onPinToggle?: (itemId: string, pinned: boolean) => void;
40
+ onPinToggle?: (itemId: string, pinned: boolean, item?: NavigationItem, basePath?: string) => void;
41
41
  /** Enable drag-to-reorder for navigation items */
42
42
  enableReorder?: boolean;
43
43
  /** Called when navigation items are reordered via drag */
@@ -47,8 +47,14 @@ export interface NavigationRendererProps {
47
47
  searchQuery?: string;
48
48
  /** Enable pin/favorite toggle on navigation items */
49
49
  enablePinning?: boolean;
50
- /** Called when a navigation item is pinned or unpinned */
51
- onPinToggle?: (itemId: string, pinned: boolean) => void;
50
+ /**
51
+ * Called when a navigation item is pinned or unpinned. The optional
52
+ * `item` and `basePath` arguments are passed so consumers can synthesize
53
+ * a portable favorite record (with a real label/href) instead of storing
54
+ * only the raw nav id. Older consumers that ignore the extra args keep
55
+ * working unchanged.
56
+ */
57
+ onPinToggle?: (itemId: string, pinned: boolean, item?: NavigationItem, basePath?: string) => void;
52
58
  /** Enable drag-to-reorder for navigation items */
53
59
  enableReorder?: boolean;
54
60
  /** Called when navigation items are reordered via drag */
@@ -90,6 +96,14 @@ export interface NavigationRendererProps {
90
96
  * `{ns}.apps.{appName}.navigation.{groupId}.label`.
91
97
  */
92
98
  resolveGroupLabel?: (groupId: string, fallbackLabel: string) => string;
99
+ /**
100
+ * Optional label resolver for non-object/non-dashboard/non-group nav
101
+ * items (url, page, report, custom). Called with `(itemId, fallbackLabel)`
102
+ * for items that have a plain-string label and a stable `id`.
103
+ * Convention: `{ns}.apps.{appName}.navigation.{itemId}.label` — same
104
+ * key shape as `resolveGroupLabel` so a single i18n helper covers both.
105
+ */
106
+ resolveItemLabel?: (itemId: string, fallbackLabel: string) => string;
93
107
  /**
94
108
  * Optional i18n translation function for resolving I18nLabel objects
95
109
  * (`{ key, defaultValue }`). When provided, labels are translated
@@ -147,4 +161,4 @@ export declare function filterNavigationItems(items: NavigationItem[], query: st
147
161
  * />
148
162
  * ```
149
163
  */
150
- export declare function NavigationRenderer({ items, basePath, evaluateVisibility: evalVis, checkPermission: checkPerm, checkCapability: checkCap, onAction, searchQuery, enablePinning, onPinToggle, enableReorder, onReorder, resolveObjectLabel, resolveDashboardLabel, resolveGroupLabel, resolveViewLabel, t: tProp, }: NavigationRendererProps): import("react/jsx-runtime").JSX.Element;
164
+ export declare function NavigationRenderer({ items, basePath, evaluateVisibility: evalVis, checkPermission: checkPerm, checkCapability: checkCap, onAction, searchQuery, enablePinning, onPinToggle, enableReorder, onReorder, resolveObjectLabel, resolveDashboardLabel, resolveGroupLabel, resolveViewLabel, resolveItemLabel, t: tProp, }: NavigationRendererProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/layout",
3
- "version": "6.1.0",
3
+ "version": "6.2.1",
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": "6.1.0",
26
- "@object-ui/core": "6.1.0",
27
- "@object-ui/react": "6.1.0",
28
- "@object-ui/types": "6.1.0"
25
+ "@object-ui/components": "6.2.1",
26
+ "@object-ui/core": "6.2.1",
27
+ "@object-ui/react": "6.2.1",
28
+ "@object-ui/types": "6.2.1"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^18.0.0 || ^19.0.0",