@mt-gloss/ui 0.1.94 → 0.1.96

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.
@@ -1,20 +1,391 @@
1
- import { a as r, u, f as p, c as f } from "./COMMITS-DAem0P4s.js";
2
- import { C as H, b as N, P as O, e as w, i as A, r as z, d as M, g as D } from "./COMMITS-DAem0P4s.js";
3
- import { jsxs as c, jsx as a, Fragment as m } from "react/jsx-runtime";
4
- import { useEffect as i, useRef as P, useLayoutEffect as h, useCallback as v } from "react";
5
- function _({ isOpen: e }) {
6
- const t = r()?.state.activeTrigger, o = t?.kind === "card-overflow" ? t.cardId : null;
1
+ import { a as C, f as L, u as K, g, c as b } from "./COMMITS-By42AA8m.js";
2
+ import { C as we, b as Ae, P as _e, e as Le, i as Oe, r as xe, d as Ie } from "./COMMITS-By42AA8m.js";
3
+ import { jsx as o, jsxs as c, Fragment as j } from "react/jsx-runtime";
4
+ import { useState as m, useRef as O, createContext as x, useContext as I, useEffect as N, useLayoutEffect as q, useCallback as T } from "react";
5
+ function B({ children: e }) {
6
+ return /* @__PURE__ */ o("div", { className: "clone-stage", children: e });
7
+ }
8
+ function G({ span: e, rotating: t = !0, children: a }) {
9
+ const n = ["clone-card", `span-${e}`, t ? "rotating" : ""].filter(Boolean).join(" ");
10
+ return /* @__PURE__ */ o("div", { className: n, children: a });
11
+ }
12
+ function he({
13
+ isOpen: e,
14
+ cardSpan: t,
15
+ cardLabel: a = "Metric",
16
+ cardValue: n = "—"
17
+ }) {
18
+ const r = C()?.state.activeTrigger, s = r?.kind === "card-overflow" ? r.cardId : null, i = L(), d = r?.span;
7
19
  return /* @__PURE__ */ c("div", { "data-shell": "settings", "aria-hidden": !e, children: [
8
- /* @__PURE__ */ a("p", { style: { margin: 0, fontSize: 14, color: "#495057" }, children: o ? `Settings for card: ${o}` : "Settings" }),
9
- /* @__PURE__ */ a("p", { style: { margin: "8px 0 0", fontSize: 12, color: "#adb5bd" }, children: "Configuration options coming soon." })
20
+ /* @__PURE__ */ o(B, { children: /* @__PURE__ */ c(G, { span: t ?? d ?? 1, rotating: !i, children: [
21
+ /* @__PURE__ */ o("div", { style: { fontSize: 9, textTransform: "uppercase", letterSpacing: "0.06em", color: "#9ca3af", marginBottom: 6 }, children: a }),
22
+ /* @__PURE__ */ o("div", { style: { fontSize: 22, fontWeight: 700, color: "#111827", lineHeight: 1 }, children: n })
23
+ ] }) }),
24
+ /* @__PURE__ */ o("p", { style: { margin: "12px 0 0", fontSize: 14, color: "#495057" }, children: s ? `Settings for card: ${s}` : "Settings" }),
25
+ /* @__PURE__ */ o("p", { style: { margin: "8px 0 0", fontSize: 12, color: "#adb5bd" }, children: "Configuration options coming soon." })
26
+ ] });
27
+ }
28
+ function M({ lenses: e, activeLens: t, onLensChange: a }) {
29
+ const [n, l] = m(!1), r = O(null), s = () => {
30
+ r.current != null && (window.clearTimeout(r.current), r.current = null);
31
+ }, i = () => {
32
+ s(), r.current = window.setTimeout(() => l(!1), 100);
33
+ }, d = e.filter((u) => u !== t);
34
+ return /* @__PURE__ */ o("div", { className: "cat-segmented-wrap", children: /* @__PURE__ */ c("div", { className: "cat-segmented", children: [
35
+ /* @__PURE__ */ o(
36
+ "button",
37
+ {
38
+ type: "button",
39
+ className: "cat-seg active",
40
+ "data-lens": t,
41
+ "aria-pressed": "true",
42
+ children: t
43
+ }
44
+ ),
45
+ /* @__PURE__ */ c(
46
+ "div",
47
+ {
48
+ className: "cat-seg-more",
49
+ onMouseEnter: () => {
50
+ s(), l(!0);
51
+ },
52
+ onMouseLeave: i,
53
+ children: [
54
+ /* @__PURE__ */ o("button", { type: "button", className: "cat-seg cat-seg-more-btn", "aria-haspopup": "menu", "aria-expanded": n, children: "More ▾" }),
55
+ n && /* @__PURE__ */ o(
56
+ "div",
57
+ {
58
+ className: "cat-seg-overflow",
59
+ role: "menu",
60
+ onMouseEnter: s,
61
+ onMouseLeave: i,
62
+ children: d.map((u) => /* @__PURE__ */ o(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ "data-lens": u,
67
+ role: "menuitem",
68
+ onClick: () => {
69
+ a(u), l(!1);
70
+ },
71
+ children: u
72
+ },
73
+ u
74
+ ))
75
+ }
76
+ )
77
+ ]
78
+ }
79
+ )
80
+ ] }) });
81
+ }
82
+ function U(e) {
83
+ return e.split("·").map((t, a) => {
84
+ const n = t.trim(), l = n.match(/^([$+\-]?[\d,]+(?:\.\d+)?[%+]?)\s*(.*)$/), r = l ? l[1] : "", s = l ? l[2] : n;
85
+ return /* @__PURE__ */ c("span", { children: [
86
+ /* @__PURE__ */ o("strong", { children: r }),
87
+ /* @__PURE__ */ o("small", { children: s })
88
+ ] }, a);
89
+ });
90
+ }
91
+ function D({ tiles: e, selectedTileId: t, onSelectTile: a }) {
92
+ return /* @__PURE__ */ o("div", { className: "cat-tiles", children: e.map((n) => {
93
+ const l = n.id === t, r = n.stack === !0, s = ["cat-tile"];
94
+ return r && s.push("span-2"), l && s.push("selected"), /* @__PURE__ */ c(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ className: s.join(" "),
99
+ "data-metric": n.id,
100
+ "data-desc": n.desc,
101
+ "aria-pressed": l,
102
+ onClick: () => a(n.id, n.desc),
103
+ children: [
104
+ /* @__PURE__ */ o("span", { className: "cat-tile-label", children: n.label }),
105
+ /* @__PURE__ */ o("span", { className: "cat-tile-value", children: r ? U(n.value) : n.value }),
106
+ n.variants && n.variants.length > 0 && /* @__PURE__ */ o("span", { className: "cat-tile-variants", "aria-hidden": "true", children: n.variants.map((i) => /* @__PURE__ */ o("span", { children: i }, i)) })
107
+ ]
108
+ },
109
+ n.id
110
+ );
111
+ }) });
112
+ }
113
+ const E = x(null);
114
+ function Y() {
115
+ return I(E);
116
+ }
117
+ function V({ mode: e, dispatch: t }) {
118
+ const a = Y();
119
+ if (a == null && e == null) return null;
120
+ const n = a?.mode ?? e ?? "add", l = a?.selectedTileId ?? null, r = a?.description ?? null, s = l == null;
121
+ return /* @__PURE__ */ c("div", { className: "panel-footer catalog", children: [
122
+ /* @__PURE__ */ o("div", { className: "cat-description", id: "cat-desc", children: r ?? /* @__PURE__ */ o("em", { children: "Tap a metric to see its description" }) }),
123
+ /* @__PURE__ */ c("div", { style: { display: "flex", padding: "10px 14px", gap: 8 }, children: [
124
+ /* @__PURE__ */ o("div", { className: "spacer", style: { flex: 1 } }),
125
+ /* @__PURE__ */ o(
126
+ "button",
127
+ {
128
+ id: "btn-cat-cancel",
129
+ type: "button",
130
+ className: "btn btn-ghost",
131
+ onClick: () => t({ type: "CLOSE_PANEL", reason: "cancel-button" }),
132
+ children: "Cancel"
133
+ }
134
+ ),
135
+ n === "add" && /* @__PURE__ */ o(
136
+ "button",
137
+ {
138
+ id: "btn-cat-add",
139
+ type: "button",
140
+ className: "btn btn-primary",
141
+ disabled: s,
142
+ onClick: () => t({ type: "CLOSE_PANEL", reason: "apply-button" }),
143
+ children: "Add metric"
144
+ }
145
+ ),
146
+ n === "replace" && /* @__PURE__ */ o(
147
+ "button",
148
+ {
149
+ id: "btn-cat-replace",
150
+ type: "button",
151
+ className: "btn btn-primary",
152
+ disabled: s,
153
+ onClick: () => t({ type: "CLOSE_PANEL", reason: "apply-button" }),
154
+ children: "Replace metric"
155
+ }
156
+ )
157
+ ] })
158
+ ] });
159
+ }
160
+ const R = [
161
+ "Revenue",
162
+ "Order flow",
163
+ "Rep performance",
164
+ "Brand portfolio",
165
+ "Account coverage",
166
+ "Commission"
167
+ ], k = "Order flow", z = {
168
+ Revenue: [
169
+ { id: "rev-mtd", label: "Revenue MTD", value: "$184K", desc: "Month-to-date revenue across all manufacturers and territories." },
170
+ { id: "rev-ytd", label: "Revenue YTD", value: "$2.1M", desc: "Year-to-date revenue including pending and posted orders.", variants: ["1×1", "1×3"] },
171
+ { id: "rev-yoy", label: "YoY Δ", value: "+12.4%", desc: "Revenue growth versus the prior comparable period." },
172
+ { id: "rev-avg", label: "Avg order", value: "$1,820", desc: "Average order value over the last 30 days." }
173
+ ],
174
+ "Order flow": [
175
+ {
176
+ id: "of-funnel",
177
+ label: "Order funnel",
178
+ value: "New 42 · Incomplete 18 · Transmitted 91",
179
+ stack: !0,
180
+ desc: "Funnel snapshot — new orders, incomplete (awaiting attention), and transmitted to manufacturer.",
181
+ variants: ["1×3"]
182
+ },
183
+ { id: "of-incomplete", label: "Incomplete", value: "18", desc: "Orders started but not yet transmitted." },
184
+ { id: "of-transmitted", label: "Transmitted", value: "91", desc: "Orders successfully sent to manufacturer." },
185
+ { id: "of-today", label: "New today", value: "7", desc: "Orders created in the current calendar day." },
186
+ { id: "of-velocity", label: "Order velocity", value: "+3.1/d", desc: "Rolling 7-day order-creation rate change." }
187
+ ],
188
+ "Rep performance": [
189
+ { id: "rp-leader", label: "#1 Rep", value: "A. Chen", desc: "Top revenue performer in the current period." },
190
+ { id: "rp-quota", label: "Below quota", value: "4 reps", desc: "Reps currently tracking below pace-to-quota." },
191
+ { id: "rp-commission", label: "Commission pace", value: "$48K", desc: "Projected commission pool at current burn rate." },
192
+ { id: "rp-active", label: "Active reps", value: "14", desc: "Reps with at least one order this period." }
193
+ ],
194
+ "Brand portfolio": [
195
+ { id: "bp-top", label: "Top brand", value: "Acme Co.", desc: "Highest-revenue manufacturer this period." },
196
+ { id: "bp-mix", label: "Mix Δ", value: "+2pp", desc: "Portfolio mix shift versus the prior period." },
197
+ { id: "bp-coverage", label: "Brand coverage", value: "73%", desc: "Percent of accounts with at least one active brand." },
198
+ { id: "bp-new", label: "New brand adds", value: "3", desc: "Brands with first-order activity this period." }
199
+ ],
200
+ "Account coverage": [
201
+ { id: "ac-active", label: "Active accounts", value: "128", desc: "Accounts with at least one order in the period." },
202
+ { id: "ac-untouched", label: "Untouched", value: "34", desc: "Accounts with zero activity in the period." },
203
+ { id: "ac-concentration", label: "Concentration", value: "38% top-5", desc: "Revenue concentration in top-5 accounts." },
204
+ { id: "ac-new", label: "New accounts", value: "6", desc: "Accounts with first-ever order this period." }
205
+ ],
206
+ Commission: [
207
+ { id: "cm-projected", label: "Projected", value: "$48K", desc: "Forecast commission at current pace." },
208
+ { id: "cm-paid", label: "Paid", value: "$31K", desc: "Commission posted to ledger this period." },
209
+ { id: "cm-pending", label: "Pending", value: "$17K", desc: "Commission earned but not yet posted." },
210
+ { id: "cm-rate", label: "Effective rate", value: "6.8%", desc: "Realized commission rate across all orders." }
211
+ ]
212
+ };
213
+ function ve({
214
+ isOpen: e,
215
+ lenses: t = R,
216
+ defaultLens: a = k,
217
+ tilesByLens: n = z,
218
+ footerSlot: l
219
+ }) {
220
+ const [r, s] = m(a), [i, d] = m(null), [u, p] = m(null), v = n[r] ?? [];
221
+ return /* @__PURE__ */ c(
222
+ E.Provider,
223
+ {
224
+ value: { mode: "add", selectedTileId: i, description: u },
225
+ children: [
226
+ /* @__PURE__ */ c("div", { "data-shell": "catalog-add", "aria-hidden": !e, children: [
227
+ /* @__PURE__ */ o("h3", { children: "Add a metric" }),
228
+ /* @__PURE__ */ o(
229
+ M,
230
+ {
231
+ lenses: t,
232
+ activeLens: r,
233
+ onLensChange: (f) => {
234
+ s(f), d(null), p(null);
235
+ }
236
+ }
237
+ ),
238
+ /* @__PURE__ */ o(
239
+ D,
240
+ {
241
+ tiles: v,
242
+ selectedTileId: i,
243
+ onSelectTile: (f, h) => {
244
+ d(f), p(h);
245
+ }
246
+ }
247
+ )
248
+ ] }),
249
+ l
250
+ ]
251
+ }
252
+ );
253
+ }
254
+ function ge({
255
+ isOpen: e,
256
+ replacingLabel: t,
257
+ lenses: a = R,
258
+ defaultLens: n = k,
259
+ tilesByLens: l = z,
260
+ footerSlot: r
261
+ }) {
262
+ const [s, i] = m(n), [d, u] = m(null), [p, v] = m(null), f = l[s] ?? [];
263
+ return /* @__PURE__ */ c(
264
+ E.Provider,
265
+ {
266
+ value: { mode: "replace", selectedTileId: d, description: p },
267
+ children: [
268
+ /* @__PURE__ */ c("div", { "data-shell": "catalog-replace", "aria-hidden": !e, children: [
269
+ /* @__PURE__ */ o("h3", { children: "Replace metric" }),
270
+ t && /* @__PURE__ */ c("p", { className: "cat-subtitle", children: [
271
+ "replacing ",
272
+ t
273
+ ] }),
274
+ /* @__PURE__ */ o(
275
+ M,
276
+ {
277
+ lenses: a,
278
+ activeLens: s,
279
+ onLensChange: (h) => {
280
+ i(h), u(null), v(null);
281
+ }
282
+ }
283
+ ),
284
+ /* @__PURE__ */ o(
285
+ D,
286
+ {
287
+ tiles: f,
288
+ selectedTileId: d,
289
+ onSelectTile: (h, H) => {
290
+ u(h), v(H);
291
+ }
292
+ }
293
+ )
294
+ ] }),
295
+ r
296
+ ]
297
+ }
298
+ );
299
+ }
300
+ function W({ page: e, onRename: t, onKebab: a, onDragStart: n }) {
301
+ const l = ["pm-row"];
302
+ return e.active && l.push("active"), /* @__PURE__ */ c("div", { className: l.join(" "), "data-page-id": e.id, role: "listitem", children: [
303
+ /* @__PURE__ */ o(
304
+ "div",
305
+ {
306
+ className: "pm-handle",
307
+ "aria-hidden": "true",
308
+ onMouseDown: () => n?.(e.id),
309
+ children: "⋮⋮"
310
+ }
311
+ ),
312
+ /* @__PURE__ */ o("div", { className: "pm-name", onClick: () => t?.(e.id), children: e.name }),
313
+ /* @__PURE__ */ o(
314
+ "button",
315
+ {
316
+ type: "button",
317
+ className: "pm-kebab",
318
+ "aria-label": "Page options",
319
+ onClick: () => a?.(e.id),
320
+ children: "⋯"
321
+ }
322
+ )
10
323
  ] });
11
324
  }
12
- const y = {
325
+ const $ = x(null);
326
+ function Q() {
327
+ return I($);
328
+ }
329
+ function J(e = {}) {
330
+ const a = Q()?.setPages;
331
+ return /* @__PURE__ */ c(
332
+ "div",
333
+ {
334
+ className: "panel-footer pm",
335
+ style: { display: "flex", justifyContent: "flex-end", padding: "10px 14px" },
336
+ children: [
337
+ /* @__PURE__ */ o("div", { className: "spacer", style: { flex: 1 } }),
338
+ /* @__PURE__ */ o(
339
+ "button",
340
+ {
341
+ id: "btn-new-page",
342
+ type: "button",
343
+ className: "btn btn-primary",
344
+ onClick: () => {
345
+ a && a((n) => [
346
+ ...n,
347
+ { id: `new-${Date.now()}`, name: "Untitled", active: !1 }
348
+ ]);
349
+ },
350
+ children: "+ New page"
351
+ }
352
+ )
353
+ ]
354
+ }
355
+ );
356
+ }
357
+ const X = [
358
+ { id: "p-pipeline", name: "My Pipeline", active: !0 },
359
+ { id: "p-numbers", name: "My Numbers", active: !1 },
360
+ { id: "p-morning", name: "My Morning", active: !1 },
361
+ { id: "p-accounts", name: "My Accounts", active: !1 }
362
+ ];
363
+ function be({
364
+ isOpen: e,
365
+ pages: t = X,
366
+ footerSlot: a
367
+ }) {
368
+ const [n, l] = m(() => [...t]);
369
+ return /* @__PURE__ */ c($.Provider, { value: { pages: n, setPages: l }, children: [
370
+ /* @__PURE__ */ c("div", { "data-shell": "page-management", "aria-hidden": !e, children: [
371
+ /* @__PURE__ */ o("h3", { children: "Manage pages" }),
372
+ /* @__PURE__ */ o("div", { className: "pm-list", role: "list", children: n.map((r) => /* @__PURE__ */ o(W, { page: r }, r.id)) })
373
+ ] }),
374
+ a
375
+ ] });
376
+ }
377
+ const ye = {
378
+ SETTINGS: "settings",
379
+ CATALOG_ADD: "catalog-add",
380
+ CATALOG_REPLACE: "catalog-replace",
381
+ PAGE_MGMT: "page-management",
382
+ NOTIFICATION_CENTER: "notification-center"
383
+ }, Z = {
13
384
  position: "fixed",
14
385
  inset: 0,
15
386
  pointerEvents: "none",
16
387
  zIndex: 55
17
- }, g = {
388
+ }, ee = {
18
389
  position: "absolute",
19
390
  inset: 0,
20
391
  zIndex: 1,
@@ -23,102 +394,308 @@ const y = {
23
394
  pointerEvents: "none",
24
395
  background: "rgba(0, 0, 0, 0.04)"
25
396
  };
26
- function b() {
27
- const { state: e, dispatch: n, getCloseLog: t } = u();
28
- i(() => {
397
+ function Pe() {
398
+ const { state: e, dispatch: t, getCloseLog: a } = K();
399
+ N(() => {
29
400
  if (e.activePanelId == null) return;
30
- function l(d) {
31
- d.key === "Escape" && n({ type: "CLOSE_PANEL", reason: "escape-key" });
401
+ function r(s) {
402
+ s.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
32
403
  }
33
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
34
- }, [e.activePanelId, n]);
35
- const o = P(e);
36
- h(() => {
37
- o.current = e;
38
- }), i(() => {
404
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
405
+ }, [e.activePanelId, t]);
406
+ const n = O(e);
407
+ q(() => {
408
+ n.current = e;
409
+ }), N(() => {
39
410
  if (process.env.NODE_ENV === "production") return;
40
- const l = window;
41
- return l.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), l.__panelsHostHandle = {
42
- dispatch: n,
43
- getState: () => o.current,
44
- getCloseLog: t
411
+ const r = window;
412
+ return r.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), r.__panelsHostHandle = {
413
+ dispatch: t,
414
+ getState: () => n.current,
415
+ getCloseLog: a
45
416
  }, () => {
46
- l.__panelsHostHandle?.dispatch === n && delete window.__panelsHostHandle;
417
+ r.__panelsHostHandle?.dispatch === t && delete window.__panelsHostHandle;
47
418
  };
48
- }, [n, t]);
49
- const s = v(() => {
50
- n({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
51
- }, [n]);
52
- return /* @__PURE__ */ a("div", { "data-panel-host": "true", style: y, children: e.activePanelId != null && /* @__PURE__ */ a(
419
+ }, [t, a]);
420
+ const l = T(() => {
421
+ t({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
422
+ }, [t]);
423
+ return /* @__PURE__ */ o("div", { "data-panel-host": "true", style: Z, children: e.activePanelId != null && /* @__PURE__ */ o(
53
424
  "div",
54
425
  {
55
426
  "data-panel-scrim": "true",
56
- style: g,
57
- onClick: s
427
+ style: ee,
428
+ onClick: l
58
429
  }
59
430
  ) });
60
431
  }
61
- function x({ panelComponents: e }) {
62
- const n = r();
63
- if (n == null) return null;
64
- const { state: t, dispatch: o } = n;
65
- if (t.activePanelId == null) return null;
66
- const s = e[t.activePanelId];
67
- if (s == null)
432
+ function Se({ panelComponents: e }) {
433
+ const t = C();
434
+ if (t == null) return null;
435
+ const { state: a, dispatch: n } = t;
436
+ if (a.activePanelId == null) return null;
437
+ const l = e[a.activePanelId];
438
+ if (l == null)
68
439
  return process.env.NODE_ENV !== "production" && console.error(
69
440
  "[panels] No panel component registered for activePanelId:",
70
- t.activePanelId
441
+ a.activePanelId
71
442
  ), null;
72
- const l = t.activePanelId === "settings" ? /* @__PURE__ */ c(m, { children: [
73
- /* @__PURE__ */ a(
74
- "button",
443
+ if (a.activePanelId === "settings")
444
+ return /* @__PURE__ */ o(g, { isOpen: !0, children: /* @__PURE__ */ o(
445
+ b,
75
446
  {
76
- id: "settings-cancel",
77
- type: "button",
78
- className: "gloss-panel-chrome__footer-btn",
79
- onClick: () => o({ type: "CLOSE_PANEL", reason: "cancel-button" }),
80
- children: "Cancel"
447
+ isOpen: !0,
448
+ onClose: () => n({ type: "CLOSE_PANEL", reason: "header-x" }),
449
+ footer: /* @__PURE__ */ c(j, { children: [
450
+ /* @__PURE__ */ o(
451
+ "button",
452
+ {
453
+ id: "settings-cancel",
454
+ type: "button",
455
+ className: "gloss-panel-chrome__footer-btn",
456
+ onClick: () => n({ type: "CLOSE_PANEL", reason: "cancel-button" }),
457
+ children: "Cancel"
458
+ }
459
+ ),
460
+ /* @__PURE__ */ o(
461
+ "button",
462
+ {
463
+ id: "settings-apply",
464
+ type: "button",
465
+ className: "gloss-panel-chrome__footer-btn gloss-panel-chrome__footer-btn--primary",
466
+ onClick: () => n({ type: "CLOSE_PANEL", reason: "apply-button" }),
467
+ children: "Apply"
468
+ }
469
+ )
470
+ ] }),
471
+ children: /* @__PURE__ */ o(l, { isOpen: !0 })
81
472
  }
82
- ),
83
- /* @__PURE__ */ a(
84
- "button",
473
+ ) });
474
+ if (a.activePanelId === "catalog-add" || a.activePanelId === "catalog-replace") {
475
+ const r = a.activePanelId === "catalog-replace" ? "replace" : "add";
476
+ return /* @__PURE__ */ o(g, { isOpen: !0, children: /* @__PURE__ */ o(
477
+ b,
85
478
  {
86
- id: "settings-apply",
87
- type: "button",
88
- className: "gloss-panel-chrome__footer-btn gloss-panel-chrome__footer-btn--primary",
89
- onClick: () => o({ type: "CLOSE_PANEL", reason: "apply-button" }),
90
- children: "Apply"
479
+ isOpen: !0,
480
+ onClose: () => n({ type: "CLOSE_PANEL", reason: "header-x" }),
481
+ footer: null,
482
+ children: /* @__PURE__ */ o(
483
+ l,
484
+ {
485
+ isOpen: !0,
486
+ footerSlot: /* @__PURE__ */ o(V, { mode: r, dispatch: n })
487
+ }
488
+ )
91
489
  }
92
- )
93
- ] }) : null;
94
- return /* @__PURE__ */ a(p, { isOpen: !0, children: /* @__PURE__ */ a(
95
- f,
490
+ ) });
491
+ }
492
+ return a.activePanelId === "page-management" ? /* @__PURE__ */ o(g, { isOpen: !0, children: /* @__PURE__ */ o(
493
+ b,
96
494
  {
97
495
  isOpen: !0,
98
- onClose: () => o({ type: "CLOSE_PANEL", reason: "header-x" }),
99
- footer: l,
100
- children: /* @__PURE__ */ a(s, { isOpen: !0 })
496
+ onClose: () => n({ type: "CLOSE_PANEL", reason: "header-x" }),
497
+ footer: null,
498
+ children: /* @__PURE__ */ o(l, { isOpen: !0, footerSlot: /* @__PURE__ */ o(J, {}) })
499
+ }
500
+ ) }) : /* @__PURE__ */ o(g, { isOpen: !0, children: /* @__PURE__ */ o(
501
+ b,
502
+ {
503
+ isOpen: !0,
504
+ onClose: () => n({ type: "CLOSE_PANEL", reason: "header-x" }),
505
+ footer: null,
506
+ children: /* @__PURE__ */ o(l, { isOpen: !0 })
101
507
  }
102
508
  ) });
103
509
  }
104
- function k(e) {
510
+ function w(e) {
105
511
  return e === null ? null : e.kind === "manage-pages-action" ? `global-${e.align ?? "left"}` : e.kind === "card-overflow" || e.kind === "empty-cell" ? `section-${e.sectionIndex}` : null;
106
512
  }
513
+ const te = 685, A = 627, ne = "cubic-bezier(0.22, 1, 0.36, 1)", ae = 200;
514
+ function F(e, t) {
515
+ if (typeof window > "u") return t;
516
+ const a = window.getComputedStyle(document.documentElement).getPropertyValue(e).trim();
517
+ if (!a) return t;
518
+ const n = parseFloat(a);
519
+ return Number.isNaN(n) ? t : a.endsWith("s") && !a.endsWith("ms") ? n * 1e3 : n;
520
+ }
521
+ function oe(e, t) {
522
+ return typeof window > "u" ? t : window.getComputedStyle(document.documentElement).getPropertyValue(e).trim() || t;
523
+ }
524
+ function y(e) {
525
+ e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger });
526
+ }
527
+ function re(e) {
528
+ const { mountEl: t, chromeEl: a, reducedMotion: n, onAssert: l } = e;
529
+ if (t == null || a == null) {
530
+ y(e), l?.({ branch: "slide-fallback-no-dom", timestamp: Date.now() });
531
+ return;
532
+ }
533
+ if (n) {
534
+ e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger }), l?.({ branch: "slide-reduced-motion", timestamp: Date.now() });
535
+ return;
536
+ }
537
+ if (typeof a.animate != "function") {
538
+ y(e), l?.({ branch: "slide-no-waapi", timestamp: Date.now() });
539
+ return;
540
+ }
541
+ const r = a.cloneNode(!0);
542
+ r.id = "panel-chrome-frozen", r.style.cssText = "position:absolute;left:8px;right:8px;top:8px;z-index:1;pointer-events:none;", t.appendChild(r), a.style.zIndex = "2", e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger });
543
+ const s = F("--panel-open-dur", te), i = oe("--panel-easing", ne), d = a.animate(
544
+ [{ transform: "translateY(100%)" }, { transform: "translateY(0)" }],
545
+ { duration: s, easing: i, fill: "forwards" }
546
+ );
547
+ d.addEventListener(
548
+ "finish",
549
+ () => {
550
+ r.remove(), a.style.zIndex = "", d.cancel(), l?.({ branch: "slide-complete", frozen: "cleaned", timestamp: Date.now() });
551
+ },
552
+ { once: !0 }
553
+ );
554
+ }
555
+ function le(e) {
556
+ const { mountEl: t, onAssert: a } = e;
557
+ if (t == null) {
558
+ e.dispatch({ type: "CLOSE_PANEL", reason: "mutex-handoff" }), setTimeout(() => y(e), A), a?.({ branch: "handoff-fallback-no-mount", timestamp: Date.now() });
559
+ return;
560
+ }
561
+ const n = F("--panel-close-dur", A);
562
+ let l = !1, r = null;
563
+ const s = (d) => {
564
+ d.target !== t || d.propertyName !== "max-height" || l || (l = !0, r != null && clearTimeout(r), t.removeEventListener("transitionend", s), e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger }), a?.({ branch: "handoff-complete", timestamp: Date.now() }));
565
+ }, i = () => {
566
+ l || (l = !0, t.removeEventListener("transitionend", s), e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger }), a?.({ branch: "handoff-forced", timestamp: Date.now() }));
567
+ };
568
+ t.addEventListener("transitionend", s), e.dispatch({ type: "CLOSE_PANEL", reason: "mutex-handoff" }), r = setTimeout(i, n + ae);
569
+ }
570
+ function se(e) {
571
+ const { state: t, onAssert: a } = e;
572
+ if (t.activePanelId && t.isDirty) {
573
+ e.dispatch({ type: "OPEN_PANEL", panelId: e.panelId, trigger: e.trigger }), a?.({ branch: "blocked-dirty", timestamp: Date.now() });
574
+ return;
575
+ }
576
+ const n = w(t.activeTrigger), l = w(e.trigger);
577
+ if (!!t.activePanelId && n != null && n === l) {
578
+ re(e);
579
+ return;
580
+ }
581
+ if (t.activePanelId) {
582
+ le(e);
583
+ return;
584
+ }
585
+ y(e), a?.({ branch: "fresh-open", timestamp: Date.now() });
586
+ }
587
+ function ie() {
588
+ if (!(typeof window > "u"))
589
+ return window.__panelsAsserter;
590
+ }
591
+ function Ce() {
592
+ const e = C(), t = L();
593
+ return T(
594
+ (a, n) => {
595
+ if (!e)
596
+ return;
597
+ const l = typeof document < "u" ? document.querySelector('[data-mount="panel"]') : null, r = typeof document < "u" ? document.querySelector('[data-chrome="panel"]') : null, s = {
598
+ panelId: a,
599
+ trigger: n,
600
+ state: e.state,
601
+ dispatch: e.dispatch,
602
+ mountEl: l,
603
+ chromeEl: r,
604
+ reducedMotion: t,
605
+ onAssert: (i) => {
606
+ ie()?.recordTransition?.(i);
607
+ }
608
+ };
609
+ se(s);
610
+ },
611
+ [e, t]
612
+ );
613
+ }
614
+ let P = !1, S = null;
615
+ function _() {
616
+ const e = [];
617
+ let t = "cleaned";
618
+ document.querySelectorAll("#panel-chrome-frozen").length > 0 && (e.push("#panel-chrome-frozen"), t = "lingering");
619
+ const n = document.querySelectorAll(".gloss-panel-mount");
620
+ n.length > 1 && e.push(`mount-count=${n.length}`);
621
+ const l = n[0] ?? null, r = l ? l.querySelectorAll(".gloss-panel-chrome") : [];
622
+ r.length > 1 && e.push(`chrome-count=${r.length}`);
623
+ const s = r[0] ?? null;
624
+ if (s) {
625
+ const p = s.style.zIndex;
626
+ p !== "" && p !== "2" && e.push(`chrome-zindex=${p}`);
627
+ }
628
+ const i = l ? "present" : "absent", d = s ? "present" : "absent";
629
+ return {
630
+ valid: e.length === 0,
631
+ mount: i,
632
+ chrome: d,
633
+ frozen: t,
634
+ orphans: e,
635
+ timestamp: Date.now()
636
+ };
637
+ }
638
+ function ce() {
639
+ return {
640
+ enable: de,
641
+ disable: ue,
642
+ isEnabled: () => P,
643
+ getLastReport: () => S,
644
+ recordTransition: (e) => {
645
+ P && (S = { ...e, ..._() });
646
+ },
647
+ assertOnce: () => {
648
+ const e = _();
649
+ return S = e, e;
650
+ }
651
+ };
652
+ }
653
+ function de() {
654
+ if (P = !0, typeof window > "u") return;
655
+ const e = window;
656
+ e.__panelsAsserter || (e.__panelsAsserter = ce(), console.info(
657
+ "[panels] Q12-12 asserter enabled. Inspect via window.__panelsAsserter.getLastReport()."
658
+ ));
659
+ }
660
+ function ue() {
661
+ P = !1;
662
+ }
107
663
  export {
108
- H as COMMITS,
109
- f as PanelChrome,
110
- N as PanelHost,
111
- b as PanelHostShell,
112
- p as PanelMount,
113
- O as PanelProvider,
114
- x as PanelSlot,
115
- _ as SettingsShell,
116
- w as deriveSurfaceState,
117
- A as initialState,
118
- k as positionKey,
119
- z as reducer,
120
- u as usePanelContext,
121
- r as usePanelContextOptional,
122
- M as usePanelCoordinator,
123
- D as useReducedMotionPanel
664
+ we as COMMITS,
665
+ ve as CatalogAddShell,
666
+ V as CatalogFooter,
667
+ ge as CatalogReplaceShell,
668
+ E as CatalogStateContext,
669
+ G as CloneCard,
670
+ B as CloneStage,
671
+ k as MOCK_DEFAULT_LENS,
672
+ R as MOCK_LENSES,
673
+ X as MOCK_PAGES,
674
+ z as MOCK_TILES_BY_LENS,
675
+ ye as PANEL_IDS,
676
+ J as PageMgmtFooter,
677
+ be as PageMgmtShell,
678
+ $ as PageMgmtStateContext,
679
+ b as PanelChrome,
680
+ Ae as PanelHost,
681
+ Pe as PanelHostShell,
682
+ g as PanelMount,
683
+ _e as PanelProvider,
684
+ Se as PanelSlot,
685
+ he as SettingsShell,
686
+ _ as assertPanelDomShape,
687
+ Le as deriveSurfaceState,
688
+ ue as disablePanelAsserter,
689
+ de as enablePanelAsserter,
690
+ Oe as initialState,
691
+ w as positionKey,
692
+ xe as reducer,
693
+ se as transitionToPanel,
694
+ Y as useCatalogState,
695
+ Q as usePageMgmtState,
696
+ K as usePanelContext,
697
+ C as usePanelContextOptional,
698
+ Ie as usePanelCoordinator,
699
+ L as useReducedMotionPanel,
700
+ Ce as useTransitionToPanel
124
701
  };