@object-ui/layout 17.3.0 → 17.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,185 +1,84 @@
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, useIsMobile as M } from "@object-ui/components";
4
- import { ArrowLeft as N, ChevronRight as P, FileText as F, GripVertical as ee, Layers as te, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
4
+ import { ArrowLeft as N, ChevronRight as P, FileText as ee, GripVertical as te, Layers as F, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
5
5
  import { SchemaRenderer as L, useRecordContext as R } from "@object-ui/react";
6
6
  import { Fragment as ae, jsx as z, jsxs as B } from "react/jsx-runtime";
7
7
  import { Link as oe, NavLink as V, useLocation as H } from "react-router-dom";
8
- import { DndContext as U, KeyboardSensor as se, PointerSensor as W, closestCenter as ce, useSensor as G, useSensors as K } from "@dnd-kit/core";
9
- import { SortableContext as q, 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";
8
+ import { DndContext as U, KeyboardSensor as se, PointerSensor as ce, closestCenter as W, useSensor as G, 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
+ import { resolveI18nLabel as ge } from "@objectstack/spec/ui";
12
13
  //#region src/PageHeader.tsx
13
- var me = (e) => {
14
+ var _e = (e) => {
14
15
  let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
15
16
  return t != null && String(t).trim() ? String(t) : [
16
17
  e?.salutation,
17
18
  e?.first_name,
18
19
  e?.last_name
19
20
  ].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) => {
21
+ }, ve = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
21
22
  let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
22
- return r == null ? "" : typeof r == "object" ? me(r) ?? "" : String(r);
23
+ return r == null ? "" : typeof r == "object" ? _e(r) ?? "" : String(r);
23
24
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
24
- function ge({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
- let m = R(), 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(() => {
25
+ function ye({ title: e, subtitle: n, icon: r, action: i, actions: a, showBack: s, schema: c, className: l, children: u, ...f }) {
26
+ let p = R(), m = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), h = ve(e, p?.data) || (m ? "" : e), g = n, _ = typeof g == "string" && /\{[a-zA-Z0-9_.]+\}/.test(g), v = ve(g, p?.data) || (_ ? "" : g), y = !!p?.recordId, b = !!p?.embedded, x = s ?? (y && !b), S = t.useCallback(() => {
26
27
  if (typeof window > "u") return;
27
28
  let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
28
29
  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__ */ z(L, { 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__ */ z(L, { schema: {
30
+ }, []), C = Array.isArray(c?.children) ? c.children.filter(Boolean).map((e, t) => /* @__PURE__ */ z(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, w = Array.isArray(a) && a.length > 0 && a || Array.isArray(c?.actions) && c.actions.length > 0 && c.actions || Array.isArray(c?.properties?.actions) && c.properties.actions.length > 0 && c.properties.actions || null, T = i || u || (w ? /* @__PURE__ */ z(L, { schema: {
30
31
  type: "record:quick_actions",
31
32
  properties: {
32
- actions: T,
33
+ actions: w,
33
34
  location: "record_header",
34
35
  align: "end",
35
36
  inline: !0
36
37
  }
37
- } }) : null) || w;
38
+ } }) : null) || C;
38
39
  return /* @__PURE__ */ z("div", {
39
- className: A("flex flex-col gap-3 pb-4 border-b", u),
40
- ...p,
40
+ className: A("flex flex-col gap-3 pb-4 border-b", l),
41
+ ...f,
41
42
  children: /* @__PURE__ */ B("div", {
42
43
  className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
44
  children: [
44
- S && /* @__PURE__ */ z(o, {
45
+ x && /* @__PURE__ */ z(o, {
45
46
  type: "button",
46
47
  variant: "ghost",
47
48
  size: "icon",
48
- onClick: C,
49
+ onClick: S,
49
50
  "aria-label": "Back to list",
50
51
  className: "flex-shrink-0 -ml-2",
51
52
  children: /* @__PURE__ */ z(N, { className: "size-4" })
52
53
  }),
53
- i && (g || y) && /* @__PURE__ */ z("div", {
54
+ r && (h || v) && /* @__PURE__ */ z("div", {
54
55
  className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
55
- children: typeof i == "string" ? /* @__PURE__ */ z(d, {
56
- name: i,
56
+ children: typeof r == "string" ? /* @__PURE__ */ z(d, {
57
+ name: r,
57
58
  className: "size-5"
58
- }) : i
59
+ }) : r
59
60
  }),
60
61
  /* @__PURE__ */ B("div", {
61
62
  className: "flex flex-col min-w-0 flex-1",
62
- children: [g ? /* @__PURE__ */ z("h1", {
63
+ children: [h ? /* @__PURE__ */ z("h1", {
63
64
  className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
- children: g
65
- }) : null, y && /* @__PURE__ */ z("p", {
65
+ children: h
66
+ }) : null, v && /* @__PURE__ */ z("p", {
66
67
  className: "text-sm text-muted-foreground truncate",
67
- children: y
68
+ children: v
68
69
  })]
69
70
  }),
70
- E && /* @__PURE__ */ z("div", {
71
+ T && /* @__PURE__ */ z("div", {
71
72
  className: "flex items-center gap-2 ml-auto",
72
- children: E
73
+ children: T
73
74
  })
74
75
  ]
75
76
  })
76
77
  });
77
78
  }
78
79
  //#endregion
79
- //#region src/AppShell.tsx
80
- function _e(e) {
81
- let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
82
- if (!t) return null;
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;
84
- if (a !== o) {
85
- let e = a - o;
86
- switch (c = l > .5 ? e / (2 - a - o) : e / (a + o), a) {
87
- case n:
88
- s = ((r - i) / e + (r < i ? 6 : 0)) / 6;
89
- break;
90
- case r:
91
- s = ((i - n) / e + 2) / 6;
92
- break;
93
- case i: s = ((n - r) / e + 4) / 6;
94
- }
95
- }
96
- return {
97
- h: s * 360,
98
- s: c * 100,
99
- l: l * 100
100
- };
101
- }
102
- function ve(e) {
103
- let t = _e(e);
104
- return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
105
- }
106
- function ye(e) {
107
- let t = _e(e);
108
- if (!t) return null;
109
- let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
110
- return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
111
- }
112
- function be(e) {
113
- let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
114
- if (!t) return "0 0% 100%";
115
- let n = (e) => {
116
- let t = e / 255;
117
- return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
118
- }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
119
- return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
120
- }
121
- function xe(e, t) {
122
- n(() => {
123
- let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
124
- if (e?.primaryColor) {
125
- let t = ve(e.primaryColor), i = ye(e.primaryColor), a = r() && i || t;
126
- 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%" : be(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
127
- } 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");
128
- if (e?.accentColor) {
129
- let t = ve(e.accentColor), i = ye(e.accentColor), a = r() && i || t;
130
- 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%" : be(e.accentColor)));
131
- } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
132
- };
133
- i();
134
- let a = new MutationObserver((e) => {
135
- for (let t of e) if (t.type === "attributes" && t.attributeName === "class") {
136
- i();
137
- break;
138
- }
139
- });
140
- if (a.observe(n, {
141
- attributes: !0,
142
- attributeFilter: ["class"]
143
- }), e?.favicon) {
144
- let t = document.querySelector("#favicon") || document.querySelector("link[rel=\"icon\"]");
145
- t && (t.href = e.favicon);
146
- }
147
- return t && (document.title = t), () => {
148
- 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");
149
- };
150
- }, [
151
- e?.primaryColor,
152
- e?.accentColor,
153
- e?.favicon,
154
- t
155
- ]);
156
- }
157
- function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
158
- return xe(a, a?.title), /* @__PURE__ */ B(k, {
159
- defaultOpen: i,
160
- className: "!flex-col h-svh overflow-hidden",
161
- children: [/* @__PURE__ */ z("header", {
162
- 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",
163
- children: t
164
- }), /* @__PURE__ */ B("div", {
165
- className: "flex flex-1 min-h-0 w-full",
166
- children: [
167
- e,
168
- /* @__PURE__ */ z(x, {
169
- className: "min-w-0",
170
- children: /* @__PURE__ */ z("main", {
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
- children: n
173
- })
174
- }),
175
- o
176
- ]
177
- })]
178
- });
179
- }
180
- //#endregion
181
80
  //#region src/PageCard.tsx
182
- function Se({ className: e, children: t, ...n }) {
81
+ function be({ className: e, children: t, ...n }) {
183
82
  return /* @__PURE__ */ z("div", {
184
83
  className: A("rounded-xl border bg-card text-card-foreground shadow", e),
185
84
  ...n,
@@ -191,7 +90,7 @@ function Se({ className: e, children: t, ...n }) {
191
90
  }
192
91
  //#endregion
193
92
  //#region src/ResponsiveGrid.tsx
194
- var Ce = {
93
+ var xe = {
195
94
  xs: {
196
95
  1: "grid-cols-1",
197
96
  2: "grid-cols-2",
@@ -241,11 +140,11 @@ var Ce = {
241
140
  12: "2xl:grid-cols-12"
242
141
  }
243
142
  };
244
- function we(e) {
143
+ function Se(e) {
245
144
  if (!e) return "grid-cols-1";
246
145
  let t = [];
247
146
  for (let [n, r] of Object.entries(e)) {
248
- let e = Ce[n];
147
+ let e = xe[n];
249
148
  if (e && r) {
250
149
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
251
150
  t.push(e[n]);
@@ -253,7 +152,7 @@ function we(e) {
253
152
  }
254
153
  return t.join(" ") || "grid-cols-1";
255
154
  }
256
- var Te = {
155
+ var Ce = {
257
156
  0: "gap-0",
258
157
  1: "gap-1",
259
158
  2: "gap-2",
@@ -262,8 +161,8 @@ var Te = {
262
161
  5: "gap-5",
263
162
  6: "gap-6",
264
163
  8: "gap-8"
265
- }, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => {
266
- let i = we(e), a = typeof t == "number" ? Te[t] || `gap-${t}` : "";
164
+ }, we = ({ columns: e, gap: t = 4, className: n, children: r }) => {
165
+ let i = Se(e), a = typeof t == "number" ? Ce[t] || `gap-${t}` : "";
267
166
  return /* @__PURE__ */ z("div", {
268
167
  className: A("grid", i, a, n),
269
168
  children: r
@@ -271,10 +170,10 @@ var Te = {
271
170
  };
272
171
  //#endregion
273
172
  //#region src/NavigationRenderer.tsx
274
- function Y(e) {
275
- return e ? j(e) : F;
173
+ function K(e) {
174
+ return e ? j(e) : ee;
276
175
  }
277
- function X(e, t) {
176
+ function q(e, t) {
278
177
  if (typeof e == "string") return e;
279
178
  if (t) {
280
179
  let n = t(e.key, {
@@ -285,52 +184,53 @@ function X(e, t) {
285
184
  }
286
185
  return e.defaultValue || e.key;
287
186
  }
288
- function De(e, t, n, r, i, a, o) {
289
- let s = X(e.label, n);
290
- if (typeof e.label != "string") return s;
291
- let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
187
+ function Te(e, t, n, r, i) {
188
+ let a = q(e.label, n);
189
+ if (typeof e.label != "string") return a;
190
+ let o = (e) => !!e && a.trim().toLowerCase() !== e.trim().toLowerCase();
292
191
  if (e.type === "object" && e.objectName) {
293
- if (e.viewName) return c(e.viewName) ? s : a ? a(e.objectName, e.viewName, s) : s;
294
- if (c(e.objectName)) return s;
295
- if (t) return t(e.objectName, s);
192
+ if (e.viewName) return o(e.viewName) ? a : i ? i(e.objectName, e.viewName, a) : a;
193
+ if (o(e.objectName)) return a;
194
+ if (t) return t(e.objectName, a);
296
195
  }
297
196
  if (e.type === "dashboard" && e.dashboardName) {
298
- if (c(e.dashboardName)) return s;
299
- if (r) return r(e.dashboardName, s);
197
+ if (o(e.dashboardName)) return a;
198
+ if (r) return r(e.dashboardName, a);
300
199
  }
301
- if (e.type === "group" && e.id) {
302
- if (c(e.id)) return s;
303
- if (i) return i(e.id, s);
304
- }
305
- return o && e.id && !c(e.id) ? o(e.id, s) : s;
200
+ return a;
306
201
  }
307
- var Oe = (e) => e !== !1 && e !== "false", ke = () => !0, Ae = () => !0;
308
- function je(e, t = {}) {
309
- let { evaluateVisibility: n = Oe, checkPermission: r = ke, checkCapability: i = Ae, hasActionHandler: a = !1 } = t;
202
+ var Ee = (e) => e !== !1 && e !== "false", De = () => !0, Oe = () => !0;
203
+ function J(e, t = {}) {
204
+ let { evaluateVisibility: n = Ee, checkPermission: r = De, checkCapability: i = Oe, hasActionHandler: a = !1 } = t;
310
205
  for (let o of e) if (n(o.visible) && !(o.requiredPermissions?.length && !r(o.requiredPermissions)) && !(o.requiresObject && !i("object", o.requiresObject)) && !(o.requiresService && !i("service", o.requiresService)) && o.type !== "separator") {
311
206
  if (o.type === "group") {
312
- if (je(o.children ?? [], t)) return !0;
207
+ if (J(o.children ?? [], t)) return !0;
313
208
  continue;
314
209
  }
315
210
  if (!(o.type === "action" && !a)) return !0;
316
211
  }
317
212
  return !1;
318
213
  }
319
- var Me = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
320
- function Z(e, t) {
214
+ var ke = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
215
+ function Y(e, t) {
321
216
  if (!e.includes("{")) return e;
322
- let n = !1, r = e.replace(Me, (e, r) => {
217
+ let n = !1, r = e.replace(ke, (e, r) => {
323
218
  let i;
324
219
  return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
325
220
  });
326
221
  return n ? null : r;
327
222
  }
328
- function Ne(e, t, n) {
223
+ var Ae = "runAction";
224
+ function je(e, t) {
225
+ let n = t.runAction;
226
+ return typeof n != "string" || n === "" ? e : `${e}${e.includes("?") ? "&" : "?"}${Ae}=${encodeURIComponent(n)}`;
227
+ }
228
+ function X(e, t, n) {
329
229
  switch (e.type) {
330
230
  case "object": {
331
231
  let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
332
232
  if (i) {
333
- let t = Z(i, n);
233
+ let t = Y(i, n);
334
234
  if (t) {
335
235
  let n = `${r}/record/${encodeURIComponent(t)}`;
336
236
  return {
@@ -341,20 +241,20 @@ function Ne(e, t, n) {
341
241
  }
342
242
  let a = e.filters;
343
243
  if (a && typeof a == "object" && !Array.isArray(a)) {
344
- let e = new URLSearchParams();
345
- for (let [t, r] of Object.entries(a)) {
346
- if (r == null || t === "") continue;
347
- let i = Z(String(r), n);
348
- i !== null && e.set(`filter[${t}]`, i);
244
+ let t = new URLSearchParams();
245
+ for (let [e, r] of Object.entries(a)) {
246
+ if (r == null || e === "") continue;
247
+ let i = Y(String(r), n);
248
+ i !== null && t.set(`filter[${e}]`, i);
349
249
  }
350
- let t = e.toString();
250
+ let i = t.toString();
351
251
  return {
352
- href: t ? `${r}/data?${t}` : `${r}/data`,
252
+ href: je(i ? `${r}/data?${i}` : `${r}/data`, e),
353
253
  external: !1
354
254
  };
355
255
  }
356
256
  return {
357
- href: e.viewName ? `${r}/view/${e.viewName}` : r,
257
+ href: je(e.viewName ? `${r}/view/${e.viewName}` : r, e),
358
258
  external: !1
359
259
  };
360
260
  }
@@ -370,10 +270,12 @@ function Ne(e, t, n) {
370
270
  let r = e.params, i = `${t}/page/${e.pageName}`;
371
271
  if (r && typeof r == "object") {
372
272
  let e = new URLSearchParams();
373
- for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
374
- let r = Z(i, n);
375
- r !== null && e.set(t, r);
376
- } else e.set(t, JSON.stringify(i));
273
+ for (let [t, i] of Object.entries(r)) if (i != null) {
274
+ if (typeof i == "string") {
275
+ let r = Y(i, n);
276
+ r !== null && e.set(t, r);
277
+ } else e.set(t, JSON.stringify(i));
278
+ }
377
279
  let t = e.toString();
378
280
  t && (i += `?${t}`);
379
281
  }
@@ -406,10 +308,12 @@ function Ne(e, t, n) {
406
308
  let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
407
309
  if (a && typeof a == "object") {
408
310
  let e = new URLSearchParams();
409
- for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) if (typeof r == "string") {
410
- let i = Z(r, n);
411
- i && e.set(t, i);
412
- } else e.set(t, JSON.stringify(r));
311
+ for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) {
312
+ if (typeof r == "string") {
313
+ let i = Y(r, n);
314
+ i && e.set(t, i);
315
+ } else e.set(t, JSON.stringify(r));
316
+ }
413
317
  let t = e.toString();
414
318
  t && (s = `?${t}`);
415
319
  }
@@ -442,27 +346,27 @@ function Ne(e, t, n) {
442
346
  };
443
347
  }
444
348
  }
445
- var Pe = 50, Fe = 40, Ie = 30, Le = 25, Re = 10, ze = 5;
446
- function Be(e) {
349
+ var Me = 50, Ne = 40, Pe = 30, Fe = 25, Ie = 10, Le = 5;
350
+ function Re(e) {
447
351
  let t = /* @__PURE__ */ new Map();
448
352
  return new URLSearchParams(e).forEach((e, n) => {
449
353
  let r = /^filter\[(.+)\]$/.exec(n);
450
354
  r && r[1] && e !== "" && t.set(r[1], e);
451
355
  }), t;
452
356
  }
453
- function Ve(e, t) {
357
+ function ze(e, t) {
454
358
  return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
455
359
  }
456
- function He(e, t, n, r, i) {
457
- let { href: a, external: o } = Ne(e, r, i);
360
+ function Be(e, t, n, r, i) {
361
+ let { href: a, external: o } = X(e, r, i);
458
362
  if (o || a === "#") return 0;
459
363
  if (e.type === "object" && e.objectName) {
460
364
  let a = `${r}/${e.objectName}`;
461
365
  if (t !== a && !t.startsWith(`${a}/`)) return 0;
462
366
  let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
463
367
  if (s) {
464
- let e = Z(s, i);
465
- if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Pe : 0;
368
+ let e = Y(s, i);
369
+ if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Me : 0;
466
370
  }
467
371
  let c = e.filters;
468
372
  if (c && typeof c == "object" && !Array.isArray(c)) {
@@ -470,65 +374,65 @@ function He(e, t, n, r, i) {
470
374
  let e = /* @__PURE__ */ new Map();
471
375
  for (let [t, n] of Object.entries(c)) {
472
376
  if (n == null || t === "") continue;
473
- let r = Z(String(n), i);
377
+ let r = Y(String(n), i);
474
378
  r !== null && e.set(t, r);
475
379
  }
476
380
  if (e.size !== n.size) return 0;
477
381
  for (let [t, r] of e) if (n.get(t) !== r) return 0;
478
- return Fe;
382
+ return Ne;
479
383
  }
480
- return e.viewName ? o[0] !== "view" || !o[1] ? 0 : Ve(e.objectName, decodeURIComponent(o[1])) === Ve(e.objectName, e.viewName) ? Ie : 0 : o.length === 0 ? Le : Re;
384
+ return e.viewName ? o[0] !== "view" || !o[1] ? 0 : ze(e.objectName, decodeURIComponent(o[1])) === ze(e.objectName, e.viewName) ? Pe : 0 : o.length === 0 ? Fe : Ie;
481
385
  }
482
386
  let s = a.split("?")[0];
483
- if (t === s) return Le;
387
+ if (t === s) return Fe;
484
388
  let c = e.componentRef;
485
- return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? ze : 0;
389
+ return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? Le : 0;
486
390
  }
487
- function Ue(e, t, n, r, i) {
488
- let a = Be(n), o = null, s = 0, c = (e) => {
391
+ function Ve(e, t, n, r, i) {
392
+ let a = Re(n), o = null, s = 0, c = (e) => {
489
393
  if (e) for (let n of e) {
490
394
  if (n.type === "group") {
491
395
  c(n.children);
492
396
  continue;
493
397
  }
494
- let e = He(n, t, a, r, i);
398
+ let e = Be(n, t, a, r, i);
495
399
  e > s && (o = n, s = e);
496
400
  }
497
401
  };
498
402
  return c(e), o;
499
403
  }
500
- var We = t.createContext(null);
501
- function Ge(e, t) {
404
+ var Z = t.createContext(null);
405
+ function Q(e, t) {
502
406
  if (!t.trim()) return e;
503
407
  let n = t.toLowerCase().trim();
504
408
  return e.reduce((e, r) => {
505
409
  if (r.type === "separator") return e;
506
410
  if (r.type === "group" && r.children?.length) {
507
- let n = Ge(r.children, t);
411
+ let n = Q(r.children, t);
508
412
  return n.length > 0 && e.push({
509
413
  ...r,
510
414
  children: n
511
415
  }), e;
512
416
  }
513
- return X(r.label).toLowerCase().includes(n) && e.push(r), e;
417
+ return q(r.label).toLowerCase().includes(n) && e.push(r), e;
514
418
  }, []);
515
419
  }
516
- var Ke = 5;
517
- function qe({ 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, templateContext: h }) {
518
- let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = ue({
420
+ var He = 5;
421
+ function Ue({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveViewLabel: d, t: f, templateContext: p }) {
422
+ let { attributes: m, listeners: h, setNodeRef: g, transform: _, transition: v, isDragging: y } = fe({
519
423
  id: e.id,
520
424
  disabled: !c
521
- }), S = {
522
- transform: fe.Transform.toString(y),
523
- transition: b,
524
- opacity: x ? .5 : void 0,
525
- zIndex: x ? 10 : void 0
425
+ }), b = {
426
+ transform: me.Transform.toString(_),
427
+ transition: v,
428
+ opacity: y ? .5 : void 0,
429
+ zIndex: y ? 10 : void 0
526
430
  };
527
431
  return /* @__PURE__ */ z("div", {
528
- ref: v,
529
- style: S,
530
- ...g,
531
- children: /* @__PURE__ */ z(Q, {
432
+ ref: g,
433
+ style: b,
434
+ ...m,
435
+ children: /* @__PURE__ */ z($, {
532
436
  item: e,
533
437
  basePath: t,
534
438
  evalVis: n,
@@ -537,42 +441,40 @@ function qe({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
537
441
  onAction: a,
538
442
  enablePinning: o,
539
443
  onPinToggle: s,
540
- dragListeners: c ? _ : void 0,
444
+ dragListeners: c ? h : void 0,
541
445
  resolveObjectLabel: l,
542
446
  resolveDashboardLabel: u,
543
- resolveGroupLabel: d,
544
- resolveViewLabel: f,
545
- resolveItemLabel: p,
546
- t: m,
547
- templateContext: h
447
+ resolveViewLabel: d,
448
+ t: f,
449
+ templateContext: p
548
450
  })
549
451
  });
550
452
  }
551
- 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, templateContext: k }) {
552
- let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
453
+ function $({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onAction: d, enablePinning: p, onPinToggle: m, dragListeners: h, resolveObjectLabel: y, resolveDashboardLabel: b, resolveViewLabel: x, t: E, templateContext: D }) {
454
+ let O = M(), k = O ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, j = A("shrink-0", O ? "h-5 w-5" : "h-4 w-4"), N = (() => {
553
455
  if (typeof e.expanded == "boolean") return e.expanded;
554
456
  if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
555
- })(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(We), L = t.useMemo(() => {
556
- if (e.type !== "group" || !I) return !1;
557
- let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
457
+ })(), ee = e.type === "group" ? e.children?.length ?? 0 : 0, F = t.useContext(Z), ie = t.useMemo(() => {
458
+ if (e.type !== "group" || !F) return !1;
459
+ let t = (e) => !!e?.some((e) => e.id === F || e.type === "group" && t(e.children));
558
460
  return t(e.children);
559
- }, [e, I]) ? !0 : te ?? !(ie >= 8), [R, V] = i(L);
461
+ }, [e, F]) ? !0 : N ?? !(ee >= 8), [I, L] = i(ie);
560
462
  if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
561
- let H = e.requiresObject, U = e.requiresService;
562
- if (H && !u("object", H) || U && !u("service", U)) return null;
463
+ let R = e.requiresObject, V = e.requiresService;
464
+ if (R && !u("object", R) || V && !u("service", V)) return null;
563
465
  if (e.type === "separator") return /* @__PURE__ */ z(f, { className: "my-2" });
564
466
  if (e.type === "group") {
565
- let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = De(e, y, O, b, x, E, D);
467
+ let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = Te(e, y, E, b, x);
566
468
  return /* @__PURE__ */ z(s, {
567
- open: R,
568
- onOpenChange: V,
469
+ open: I,
470
+ onOpenChange: L,
569
471
  children: /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, {
570
472
  asChild: !0,
571
473
  children: /* @__PURE__ */ B(l, {
572
- className: A("flex w-full items-center justify-between", j && "min-h-[44px] text-[15px] rounded-xl"),
573
- children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", R && "rotate-90") })]
474
+ className: A("flex w-full items-center justify-between", O && "min-h-[44px] text-[15px] rounded-xl"),
475
+ children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", O ? "h-5 w-5" : "h-4 w-4", I && "rotate-90") })]
574
476
  })
575
- }), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
477
+ }), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z($, {
576
478
  item: e,
577
479
  basePath: n,
578
480
  evalVis: r,
@@ -583,30 +485,28 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
583
485
  onPinToggle: m,
584
486
  resolveObjectLabel: y,
585
487
  resolveDashboardLabel: b,
586
- resolveGroupLabel: x,
587
- resolveViewLabel: E,
588
- resolveItemLabel: D,
589
- t: O,
590
- templateContext: k
488
+ resolveViewLabel: x,
489
+ t: E,
490
+ templateContext: D
591
491
  }, e.id)) }) }) })] })
592
492
  });
593
493
  }
594
494
  if (e.type === "action") {
595
495
  if (!d) return null;
596
- let t = Y(e.icon), r = X(e.label, O);
496
+ let t = K(e.icon), r = q(e.label, E);
597
497
  return /* @__PURE__ */ B(T, { children: [
598
498
  h && /* @__PURE__ */ z("span", {
599
499
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
600
- "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
500
+ "aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
601
501
  ...h,
602
- children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
502
+ children: /* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" })
603
503
  }),
604
504
  /* @__PURE__ */ B(w, {
605
505
  tooltip: r,
606
506
  onClick: () => d?.(e),
607
- className: N,
507
+ className: k,
608
508
  children: [
609
- /* @__PURE__ */ z(t, { className: F }),
509
+ /* @__PURE__ */ z(t, { className: j }),
610
510
  /* @__PURE__ */ z("span", { children: r }),
611
511
  e.badge != null && /* @__PURE__ */ z(a, {
612
512
  variant: e.badgeVariant ?? "default",
@@ -618,7 +518,7 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
618
518
  p && m && /* @__PURE__ */ z(C, {
619
519
  showOnHover: !0,
620
520
  onClick: () => m(e.id, !e.pinned, e, n),
621
- "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
521
+ "aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
622
522
  defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
623
523
  name: r
624
524
  }) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
@@ -626,9 +526,9 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
626
526
  })
627
527
  ] });
628
528
  }
629
- let se = Y(e.icon), { href: W, external: ce } = Ne(e, n, k), G = I !== null && e.id === I, K = De(e, y, O, b, x, E, D), q = /* @__PURE__ */ B(ae, { children: [
630
- /* @__PURE__ */ z(se, { className: F }),
631
- /* @__PURE__ */ z("span", { children: K }),
529
+ let H = K(e.icon), { href: U, external: se } = X(e, n, D), ce = F !== null && e.id === F, W = Te(e, y, E, b, x), G = /* @__PURE__ */ B(ae, { children: [
530
+ /* @__PURE__ */ z(H, { className: j }),
531
+ /* @__PURE__ */ z("span", { children: W }),
632
532
  e.badge != null && /* @__PURE__ */ z(a, {
633
533
  variant: e.badgeVariant ?? "default",
634
534
  className: "ml-auto text-[10px] px-1.5 py-0",
@@ -638,52 +538,52 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
638
538
  return /* @__PURE__ */ B(T, { children: [
639
539
  h && /* @__PURE__ */ z("span", {
640
540
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
641
- "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
541
+ "aria-label": E ? E("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
642
542
  ...h,
643
- children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
543
+ children: /* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" })
644
544
  }),
645
545
  /* @__PURE__ */ z(w, {
646
546
  asChild: !0,
647
- isActive: G,
648
- tooltip: K,
649
- className: N,
650
- children: ce ? /* @__PURE__ */ z("a", {
651
- href: W,
547
+ isActive: ce,
548
+ tooltip: W,
549
+ className: k,
550
+ children: se ? /* @__PURE__ */ z("a", {
551
+ href: U,
652
552
  target: "_blank",
653
553
  rel: "noopener noreferrer",
654
- children: q
554
+ children: G
655
555
  }) : /* @__PURE__ */ z(oe, {
656
- to: W,
657
- children: q
556
+ to: U,
557
+ children: G
658
558
  })
659
559
  }),
660
560
  p && m && /* @__PURE__ */ z(C, {
661
561
  showOnHover: !0,
662
562
  onClick: () => m(e.id, !e.pinned, e, n),
663
- "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
664
- defaultValue: e.pinned ? `Unpin ${K}` : `Pin ${K}`,
665
- name: K
666
- }) : e.pinned ? `Unpin ${K}` : `Pin ${K}`,
563
+ "aria-label": E ? E(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
564
+ defaultValue: e.pinned ? `Unpin ${W}` : `Pin ${W}`,
565
+ name: W
566
+ }) : e.pinned ? `Unpin ${W}` : `Pin ${W}`,
667
567
  children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
668
568
  })
669
569
  ] });
670
570
  }
671
- function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermission: i = ke, checkCapability: a = Ae, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
672
- let C = H(), w = r(() => Ue(e, C.pathname, C.search, t, x)?.id ?? null, [
571
+ function We({ items: e, basePath: t = "", evaluateVisibility: n = Ee, checkPermission: i = De, checkCapability: a = Oe, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveViewLabel: m, t: h, templateContext: y }) {
572
+ let b = H(), x = r(() => Ve(e, b.pathname, b.search, t, y)?.id ?? null, [
673
573
  e,
674
- C.pathname,
675
- C.search,
574
+ b.pathname,
575
+ b.search,
676
576
  t,
677
- x
678
- ]), T = r(() => s ? Ge(e, s) : e, [e, s]), E = r(() => Je(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = K(G(W, { activationConstraint: { distance: Ke } }), G(se)), k = (e) => {
577
+ y
578
+ ]), C = r(() => s ? Q(e, s) : e, [e, s]), w = r(() => Ge(C), [C]), T = C.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), E = le(G(ce, { activationConstraint: { distance: He } }), G(se)), D = (e) => {
679
579
  let { active: t, over: n } = e;
680
580
  if (!n || t.id === n.id || !d) return;
681
- let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
682
- r !== -1 && i !== -1 && d(le(D, r, i).map((e, t) => ({
581
+ let r = T.findIndex((e) => e.id === t.id), i = T.findIndex((e) => e.id === n.id);
582
+ r !== -1 && i !== -1 && d(de(T, r, i).map((e, t) => ({
683
583
  ...e,
684
584
  order: t
685
585
  })));
686
- }, A = {
586
+ }, O = {
687
587
  basePath: t,
688
588
  evalVis: n,
689
589
  checkPerm: i,
@@ -693,81 +593,184 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermis
693
593
  onPinToggle: l,
694
594
  resolveObjectLabel: f,
695
595
  resolveDashboardLabel: p,
696
- resolveGroupLabel: m,
697
- resolveViewLabel: h,
698
- resolveItemLabel: y,
699
- t: b,
700
- templateContext: x
701
- }, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
596
+ resolveViewLabel: m,
597
+ t: h,
598
+ templateContext: y
599
+ }, k = T.some((e) => e.type === "group"), A = w.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
702
600
  className: "flex items-center gap-1.5",
703
- children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
704
- }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: E.map((e) => /* @__PURE__ */ z(Q, {
601
+ children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), h ? h("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
602
+ }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: w.map((e) => /* @__PURE__ */ z($, {
705
603
  item: e,
706
- ...A
604
+ ...O
707
605
  }, `fav-${e.id}`)) }) })] }) : null;
708
- if (!j) {
709
- let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
710
- sensors: O,
711
- collisionDetection: ce,
712
- onDragEnd: k,
713
- children: /* @__PURE__ */ z(q, {
606
+ if (!k) {
607
+ let e = T.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
608
+ sensors: E,
609
+ collisionDetection: W,
610
+ onDragEnd: D,
611
+ children: /* @__PURE__ */ z(ue, {
714
612
  items: e,
715
- strategy: de,
716
- children: /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(qe, {
613
+ strategy: pe,
614
+ children: /* @__PURE__ */ z(S, { children: T.map((e) => /* @__PURE__ */ z(Ue, {
717
615
  item: e,
718
616
  enableReorder: u,
719
- ...A
617
+ ...O
720
618
  }, e.id)) })
721
619
  })
722
- }) : /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(Q, {
620
+ }) : /* @__PURE__ */ z(S, { children: T.map((e) => /* @__PURE__ */ z($, {
723
621
  item: e,
724
- ...A
622
+ ...O
725
623
  }, e.id)) });
726
- return /* @__PURE__ */ B(We.Provider, {
727
- value: w,
728
- children: [M, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
624
+ return /* @__PURE__ */ B(Z.Provider, {
625
+ value: x,
626
+ children: [A, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
729
627
  });
730
628
  }
731
- let N = [], P = [], F = (e) => {
732
- if (P.length === 0) return;
733
- let t = P;
734
- P = [], N.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
629
+ let j = [], M = [], N = (e) => {
630
+ if (M.length === 0) return;
631
+ let t = M;
632
+ M = [], j.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z($, {
735
633
  item: e,
736
- ...A
634
+ ...O
737
635
  }, e.id)) }) }) }, e));
738
636
  };
739
- return D.forEach((e, t) => {
740
- e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ z(Q, {
637
+ return T.forEach((e, t) => {
638
+ e.type === "group" ? (N(`leaf-${t}`), j.push(/* @__PURE__ */ z($, {
741
639
  item: e,
742
- ...A
743
- }, e.id))) : P.push(e);
744
- }), F("leaf-end"), /* @__PURE__ */ B(We.Provider, {
745
- value: w,
746
- children: [M, N]
640
+ ...O
641
+ }, e.id))) : M.push(e);
642
+ }), N("leaf-end"), /* @__PURE__ */ B(Z.Provider, {
643
+ value: x,
644
+ children: [A, j]
747
645
  });
748
646
  }
749
- function Je(e) {
647
+ function Ge(e) {
750
648
  let t = [];
751
- for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Je(n.children));
649
+ for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Ge(n.children));
752
650
  return t;
753
651
  }
754
652
  //#endregion
653
+ //#region src/AppShell.tsx
654
+ function Ke(e) {
655
+ let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
656
+ if (!t) return null;
657
+ 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;
658
+ if (a !== o) {
659
+ let e = a - o;
660
+ switch (c = l > .5 ? e / (2 - a - o) : e / (a + o), a) {
661
+ case n:
662
+ s = ((r - i) / e + (r < i ? 6 : 0)) / 6;
663
+ break;
664
+ case r:
665
+ s = ((i - n) / e + 2) / 6;
666
+ break;
667
+ case i: s = ((n - r) / e + 4) / 6;
668
+ }
669
+ }
670
+ return {
671
+ h: s * 360,
672
+ s: c * 100,
673
+ l: l * 100
674
+ };
675
+ }
676
+ function qe(e) {
677
+ let t = Ke(e);
678
+ return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
679
+ }
680
+ function Je(e) {
681
+ let t = Ke(e);
682
+ if (!t) return null;
683
+ let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
684
+ return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
685
+ }
686
+ function Ye(e) {
687
+ let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
688
+ if (!t) return "0 0% 100%";
689
+ let n = (e) => {
690
+ let t = e / 255;
691
+ return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
692
+ }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
693
+ return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
694
+ }
695
+ function Xe(e, t) {
696
+ n(() => {
697
+ let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
698
+ if (e?.primaryColor) {
699
+ let t = qe(e.primaryColor), i = Je(e.primaryColor), a = r() && i || t;
700
+ a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : Ye(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
701
+ } 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");
702
+ if (e?.accentColor) {
703
+ let t = qe(e.accentColor), i = Je(e.accentColor), a = r() && i || t;
704
+ a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : Ye(e.accentColor)));
705
+ } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
706
+ };
707
+ i();
708
+ let a = new MutationObserver((e) => {
709
+ for (let t of e) if (t.type === "attributes" && t.attributeName === "class") {
710
+ i();
711
+ break;
712
+ }
713
+ });
714
+ if (a.observe(n, {
715
+ attributes: !0,
716
+ attributeFilter: ["class"]
717
+ }), e?.favicon) {
718
+ let t = document.querySelector("#favicon") || document.querySelector("link[rel=\"icon\"]");
719
+ t && (t.href = e.favicon);
720
+ }
721
+ return t && (document.title = t), () => {
722
+ 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");
723
+ };
724
+ }, [
725
+ e?.primaryColor,
726
+ e?.accentColor,
727
+ e?.favicon,
728
+ t
729
+ ]);
730
+ }
731
+ function Ze({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
732
+ return Xe(a, a?.title), /* @__PURE__ */ B(k, {
733
+ defaultOpen: i,
734
+ className: "!flex-col h-svh overflow-hidden",
735
+ children: [/* @__PURE__ */ z("header", {
736
+ 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",
737
+ children: t
738
+ }), /* @__PURE__ */ B("div", {
739
+ className: "flex flex-1 min-h-0 w-full",
740
+ children: [
741
+ e,
742
+ /* @__PURE__ */ z(x, {
743
+ className: "min-w-0",
744
+ children: /* @__PURE__ */ z("main", {
745
+ 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),
746
+ children: n
747
+ })
748
+ }),
749
+ o
750
+ ]
751
+ })]
752
+ });
753
+ }
754
+ //#endregion
755
755
  //#region src/AppSchemaRenderer.tsx
756
- function Ye({ areas: e, activeAreaId: t, onAreaChange: n }) {
756
+ function Qe(e) {
757
+ return ge(e, void 0) ?? "";
758
+ }
759
+ function $e({ areas: e, activeAreaId: t, onAreaChange: n }) {
757
760
  return e.length <= 1 ? null : /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
758
761
  className: "flex items-center gap-1.5",
759
- children: [/* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" }), "Area"]
762
+ children: [/* @__PURE__ */ z(F, { className: "h-3.5 w-3.5" }), "Area"]
760
763
  }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.map((e) => {
761
- let r = Y(e.icon);
764
+ let r = K(e.icon), i = Qe(e.label);
762
765
  return /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
763
766
  isActive: e.id === t,
764
- tooltip: X(e.label),
767
+ tooltip: i,
765
768
  onClick: () => n(e.id),
766
- children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: X(e.label) })]
769
+ children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: i })]
767
770
  }) }, e.id);
768
771
  }) }) })] });
769
772
  }
770
- function Xe({ items: e, basePath: t }) {
773
+ function et({ items: e, basePath: t }) {
771
774
  let n = H(), r = (e) => {
772
775
  let t = [];
773
776
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
@@ -778,7 +781,7 @@ function Xe({ items: e, basePath: t }) {
778
781
  role: "navigation",
779
782
  "aria-label": "Mobile navigation",
780
783
  children: i.map((e) => {
781
- let r = Y(e.icon), i = "#";
784
+ let r = K(e.icon), i = "#";
782
785
  if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
783
786
  else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
784
787
  else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
@@ -803,14 +806,14 @@ function Xe({ items: e, basePath: t }) {
803
806
  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"}`,
804
807
  children: [/* @__PURE__ */ z(r, { className: "h-5 w-5" }), /* @__PURE__ */ z("span", {
805
808
  className: "text-[10px] truncate max-w-[60px]",
806
- children: X(e.label)
809
+ children: q(e.label)
807
810
  })]
808
811
  }, e.id);
809
812
  })
810
813
  });
811
814
  }
812
- function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, visibleAreas: u, activeAreaId: d, setActiveAreaId: f, resolvedNavigation: g, enableSearch: _, enablePinning: v, onPinToggle: x, enableReorder: C, onReorder: E }) {
813
- let D = Y(e.logo), [O, k] = i("");
815
+ function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, visibleAreas: u, activeAreaId: d, setActiveAreaId: f, resolvedNavigation: g, enableSearch: _, enablePinning: v, onPinToggle: x, enableReorder: C, onReorder: E }) {
816
+ let D = K(e.logo), [O, k] = i("");
814
817
  return /* @__PURE__ */ B(p, {
815
818
  collapsible: "icon",
816
819
  children: [
@@ -841,12 +844,12 @@ function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
841
844
  "aria-label": "Search navigation"
842
845
  })] }),
843
846
  /* @__PURE__ */ B(m, { children: [
844
- u.length > 1 && d && /* @__PURE__ */ z(Ye, {
847
+ u.length > 1 && d && /* @__PURE__ */ z($e, {
845
848
  areas: u,
846
849
  activeAreaId: d,
847
850
  onAreaChange: f
848
851
  }),
849
- /* @__PURE__ */ z($, {
852
+ /* @__PURE__ */ z(We, {
850
853
  items: g,
851
854
  basePath: t,
852
855
  evaluateVisibility: n,
@@ -865,8 +868,8 @@ function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
865
868
  ]
866
869
  });
867
870
  }
868
- function Qe({ 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 }) {
869
- 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 ?? []).filter((e) => je(e.navigation, {
871
+ function nt({ 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 }) {
872
+ 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 ?? []).filter((e) => J(e.navigation, {
870
873
  evaluateVisibility: S,
871
874
  checkPermission: C,
872
875
  checkCapability: w,
@@ -877,9 +880,8 @@ function Qe({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
877
880
  }, [e.name, A]);
878
881
  let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
879
882
  title: e.title,
880
- favicon: e.favicon,
881
- logo: e.logo
882
- }, P = /* @__PURE__ */ z(Ze, {
883
+ favicon: e.favicon
884
+ }, P = /* @__PURE__ */ z(tt, {
883
885
  schema: e,
884
886
  basePath: t,
885
887
  evalVis: S,
@@ -899,24 +901,24 @@ function Qe({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
899
901
  enableReorder: b,
900
902
  onReorder: x
901
903
  });
902
- return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(J, {
904
+ return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(Ze, {
903
905
  sidebar: P,
904
906
  navbar: u,
905
907
  className: h,
906
908
  defaultOpen: g,
907
909
  branding: N,
908
910
  children: m
909
- }), a === "bottom_nav" && /* @__PURE__ */ z(Xe, {
911
+ }), a === "bottom_nav" && /* @__PURE__ */ z(et, {
910
912
  items: M,
911
913
  basePath: t
912
914
  })] });
913
915
  }
914
916
  //#endregion
915
917
  //#region src/SidebarNav.tsx
916
- function $e(e) {
918
+ function rt(e) {
917
919
  return "items" in e && !("href" in e);
918
920
  }
919
- function et({ item: e, pathname: t }) {
921
+ function it({ item: e, pathname: t }) {
920
922
  return e.children && e.children.length > 0 ? /* @__PURE__ */ z(s, {
921
923
  asChild: !0,
922
924
  defaultOpen: !0,
@@ -976,8 +978,8 @@ function et({ item: e, pathname: t }) {
976
978
  })
977
979
  }) });
978
980
  }
979
- function tt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
980
- let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : $e(e[0]) ? e.map((e) => ({
981
+ function at({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
982
+ let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : rt(e[0]) ? e.map((e) => ({
981
983
  groupLabel: e.label,
982
984
  items: e.items
983
985
  })) : [{ items: e }], [e]), f = t.useMemo(() => {
@@ -1012,7 +1014,7 @@ function tt({ items: e, title: n = "Application", className: r, collapsible: i =
1012
1014
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
1013
1015
  children: e.groupLabel || n
1014
1016
  }),
1015
- /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(et, {
1017
+ /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(it, {
1016
1018
  item: e,
1017
1019
  pathname: s.pathname
1018
1020
  }, e.href)) }) })
@@ -1021,31 +1023,43 @@ function tt({ items: e, title: n = "Application", className: r, collapsible: i =
1021
1023
  }
1022
1024
  //#endregion
1023
1025
  //#region src/index.ts
1024
- function nt() {
1025
- e.register("page-header", ge, {
1026
+ function ot() {
1027
+ e.register("page-header", ye, {
1026
1028
  namespace: "layout",
1027
1029
  label: "Page Header",
1028
1030
  category: "Layout",
1029
- inputs: [{
1030
- name: "title",
1031
- type: "string",
1032
- label: "Title"
1033
- }, {
1034
- name: "subtitle",
1035
- type: "string",
1036
- label: "Subtitle"
1037
- }]
1038
- }), e.register("page:card", Se, {
1031
+ isContainer: !0,
1032
+ inputs: [
1033
+ {
1034
+ name: "title",
1035
+ type: "string",
1036
+ label: "Title"
1037
+ },
1038
+ {
1039
+ name: "subtitle",
1040
+ type: "string",
1041
+ label: "Subtitle"
1042
+ },
1043
+ {
1044
+ name: "icon",
1045
+ type: "string",
1046
+ label: "Icon",
1047
+ description: "Lucide icon name"
1048
+ },
1049
+ {
1050
+ name: "actions",
1051
+ type: "array",
1052
+ label: "Actions",
1053
+ description: "ActionDef list (or action ids) rendered through record:quick_actions"
1054
+ }
1055
+ ]
1056
+ }), e.register("page:card", be, {
1039
1057
  namespace: "layout",
1040
1058
  skipFallback: !0,
1041
1059
  label: "Page Card",
1042
1060
  category: "Layout",
1043
1061
  isContainer: !0
1044
- }), e.register("app-shell", J, {
1045
- namespace: "layout",
1046
- label: "App Shell",
1047
- category: "Layout"
1048
- }), e.register("responsive-grid", Ee, {
1062
+ }), e.register("responsive-grid", we, {
1049
1063
  namespace: "layout",
1050
1064
  label: "Responsive Grid",
1051
1065
  category: "Layout",
@@ -1057,18 +1071,19 @@ function nt() {
1057
1071
  name: "gap",
1058
1072
  type: "number"
1059
1073
  }]
1060
- }), e.register("navigation-renderer", $, {
1074
+ }), e.register("navigation-renderer", We, {
1061
1075
  namespace: "layout",
1062
1076
  label: "Navigation Renderer",
1063
1077
  category: "Layout",
1064
1078
  inputs: [{
1065
1079
  name: "items",
1066
- type: "object"
1080
+ type: "array",
1081
+ required: !0
1067
1082
  }, {
1068
1083
  name: "basePath",
1069
1084
  type: "string"
1070
1085
  }]
1071
- }), e.register("app-schema-renderer", Qe, {
1086
+ }), e.register("app-schema-renderer", nt, {
1072
1087
  namespace: "layout",
1073
1088
  label: "App Schema Renderer",
1074
1089
  category: "Layout",
@@ -1084,13 +1099,17 @@ function nt() {
1084
1099
  },
1085
1100
  {
1086
1101
  name: "mobileNavMode",
1087
- type: "string"
1102
+ type: "enum",
1103
+ enum: ["drawer", "bottom_nav"],
1104
+ defaultValue: "drawer",
1105
+ label: "Mobile Nav Mode",
1106
+ description: "Mobile navigation mode. \"drawer\" (default) puts the sidebar in the mobile sheet overlay; \"bottom_nav\" additionally renders a fixed bottom bar. These are the only two modes the renderer implements."
1088
1107
  }
1089
1108
  ]
1090
1109
  });
1091
1110
  }
1092
1111
  try {
1093
- nt();
1112
+ ot();
1094
1113
  } catch {}
1095
1114
  //#endregion
1096
- export { Qe as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Se as PageCard, ge as PageHeader, Ee as ResponsiveGrid, tt as SidebarNav, Ge as filterNavigationItems, je as hasVisibleNavigationItems, nt as registerLayout, Ue as resolveActiveNavItem, Ne as resolveHref, Y as resolveIcon, X as resolveLabel, xe as useAppShellBranding };
1115
+ export { nt as AppSchemaRenderer, Ze as AppShell, Ae as NAV_RUN_ACTION_PARAM, We as NavigationRenderer, be as PageCard, ye as PageHeader, we as ResponsiveGrid, at as SidebarNav, Q as filterNavigationItems, J as hasVisibleNavigationItems, ot as registerLayout, Ve as resolveActiveNavItem, X as resolveHref, K as resolveIcon, q as resolveLabel, Xe as useAppShellBranding };