@brucesantos/design-space 0.12.0 → 0.14.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,402 +1,225 @@
1
- import { jsx as n, jsxs as x, Fragment as G } from "react/jsx-runtime";
2
- import { useState as z, useRef as q, useCallback as I, useEffect as K, useMemo as D, useContext as ft, createContext as wt, useLayoutEffect as Be } from "react";
3
- import { r as ye, s as gt, h as re, v as vt, a as ve, b as je, p as bt, P as $, c as qe, C as be, d as Ee, e as ae, t as ie, f as he, N as Ge, g as Ze, F as kt, i as Te, j as St, k as me, l as Ne, m as Ct, n as Fe, o as xt, q as Oe, u as yt, w as Nt, x as $t, y as Mt } from "./index-rWBjjVMg.js";
4
- import { H as Tn, z as Pn, A as _n, B as Rn, D as Fn, E as On, G as An, I as zn, J as Dn } from "./index-rWBjjVMg.js";
5
- import { createPortal as Lt } from "react-dom";
6
- function Et(e) {
7
- const t = e.scenarios ?? [], a = e.routes ?? [], r = e.components ?? [], o = new Map(t.map((i) => [i.id, i])), s = new Map(r.map((i) => [i.id, i])), d = new Map((e.personas ?? []).map((i) => [i.id, i])), l = new Map((e.fixtures ?? []).map((i) => [i.id, i])), p = new Map((e.rules ?? []).map((i) => [i.id, i])), h = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
8
- for (const i of t) {
9
- const w = ye(a, i.route ?? "");
10
- if (!w) continue;
11
- const S = w.definition.path;
12
- u.set(i.id, S);
13
- const M = h.get(S) ?? [];
14
- M.push(i), h.set(S, M);
15
- }
16
- const c = /* @__PURE__ */ new Set(), g = [];
17
- for (const i of a) {
18
- if (c.has(i.path)) continue;
19
- c.add(i.path);
20
- const w = h.get(i.path) ?? [];
21
- g.push({
22
- id: i.path,
23
- name: i.name?.trim() || w[0]?.title || i.path,
24
- description: i.description,
25
- route: i,
26
- href: gt(i.path, i.params),
27
- variations: w,
28
- group: i.group?.trim() || void 0,
29
- controls: Array.isArray(i.controls) ? i.controls : []
30
- });
31
- }
32
- const C = new Map(g.map((i) => [i.id, i])), N = (i) => i ? o.get(i) : void 0, E = (i) => i ? d.get(i) : void 0, R = E(e.defaultPersona)?.id, v = (i, w) => {
33
- if (!(!i || !w))
34
- return s.get(i)?.fixtures?.find((S) => S.id === w);
35
- }, L = (i = {}) => t.filter((w) => re(i.handoff, w.id)), b = (i) => {
36
- const w = ye(a, i);
37
- return w ? C.get(w.definition.path) : void 0;
38
- }, m = (i = {}) => {
39
- const { handoff: w } = i;
40
- return w ? g.map((S) => ({
41
- ...S,
42
- variations: S.variations.filter((M) => re(w, M.id))
43
- })).filter(
44
- (S) => S.variations.length > 0 || (w.routes ?? []).length > 0 && je(w, S.href)
45
- ) : g;
46
- }, f = (i) => i ? i.permissions ? i.permissions : E(i.persona ?? R)?.permissions ?? [] : [], k = (i = {}) => Ye(m(i)), y = (i, w) => {
47
- const S = new Set(i?.route.components ?? []), M = w ? [w] : i?.variations ?? [];
48
- for (const F of M)
49
- for (const O of F.components ?? []) S.add(O);
50
- return [...S];
51
- }, T = (i) => r.filter((w) => ve(i, w.id));
52
- return {
53
- product: e,
54
- screens: g,
55
- issues: vt(e),
56
- defaultPersona: R,
57
- scenario: N,
58
- component: (i) => i ? s.get(i) : void 0,
59
- componentFixture: v,
60
- resolveComponentFixture: (i, w) => {
61
- const S = i ? s.get(i) : void 0, M = v(i, w), F = v(i, S?.defaultFixture) ?? S?.fixtures?.[0];
62
- return {
63
- fixture: M ?? F,
64
- requestedId: w,
65
- didFallback: !!(w && !M)
66
- };
67
- },
68
- persona: E,
69
- fixture: (i) => i ? l.get(i) : void 0,
70
- rule: (i) => i ? p.get(i) : void 0,
71
- screen: (i) => i ? C.get(i) : void 0,
72
- screenForPath: b,
73
- screenOf: (i) => {
74
- const w = i ? u.get(i.id) : void 0;
75
- return w ? C.get(w) : void 0;
76
- },
77
- screensFor: m,
78
- flows: k,
79
- flowOf: (i, w) => {
80
- if (i)
81
- return k(w).find((S) => S.name === i.group);
82
- },
83
- controlsOf: (i) => (i?.controls ?? []).flatMap((w) => w.controls ?? []),
84
- resolveControls: (i, w = {}) => Tt(i?.controls ?? [], w),
85
- rulesOf: (i) => (i?.rules ?? []).map((w) => p.get(w)).filter((w) => !!w),
86
- permissionsOf: f,
87
- scenariosForRoute: (i, w) => {
88
- const S = b(i);
89
- return S ? S.variations.filter((M) => re(w?.handoff, M.id)) : [];
90
- },
91
- activeScenarios: L,
92
- search: (i, w) => {
93
- const S = X(i), M = L(w);
94
- return S ? M.filter(
95
- (F) => X(
96
- [
97
- F.title,
98
- F.id,
99
- F.intent ?? "",
100
- F.route,
101
- E(F.persona)?.name ?? "",
102
- (F.tags ?? []).join(" "),
103
- (F.expected ?? []).join(" ")
104
- ].join(" ")
105
- ).includes(S)
106
- ) : M;
107
- },
108
- searchScreens: (i, w) => {
109
- const S = X(i), M = m(w);
110
- return S ? M.filter(
111
- (F) => X(
112
- [
113
- F.name,
114
- F.description ?? "",
115
- F.id,
116
- F.group ?? "",
117
- ...F.variations.flatMap((O) => [
118
- O.title,
119
- O.id,
120
- (O.tags ?? []).join(" ")
121
- ])
122
- ].join(" ")
123
- ).includes(S)
124
- ) : M;
125
- },
126
- searchComponents: (i, w) => {
127
- const S = X(i), M = T(w);
128
- return S ? M.filter(
129
- (F) => X(
130
- [
131
- F.name,
132
- F.description ?? "",
133
- F.group ?? "",
134
- F.id,
135
- F.source ?? ""
136
- ].join(" ")
137
- ).includes(S)
138
- ) : M;
139
- },
140
- componentsFor: T,
141
- componentsOfScreen: (i, w) => y(i, w).map((S) => s.get(S)).filter((S) => !!S),
142
- usagesOf: (i, w) => i ? m(w).filter(
143
- (S) => S.route.components?.includes(i) || S.variations.some((M) => M.components?.includes(i))
144
- ) : []
145
- };
146
- }
147
- function X(e) {
148
- return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").trim();
149
- }
150
- function Ye(e) {
151
- const t = [], a = /* @__PURE__ */ new Map();
152
- for (const o of e) {
153
- if (!o.group) {
154
- t.push(o);
155
- continue;
156
- }
157
- const s = a.get(o.group) ?? [];
158
- s.push(o), a.set(o.group, s);
159
- }
160
- const r = [...a].map(([o, s]) => ({ name: o, screens: s }));
161
- return t.length > 0 ? [{ name: void 0, screens: t }, ...r] : r;
162
- }
163
- function ke(e) {
164
- const t = e.options ?? [];
165
- return e.default !== void 0 && t.some((a) => a.value === e.default) ? e.default : t[0]?.value ?? "";
166
- }
167
- function Tt(e, t = {}) {
168
- const a = {}, r = [], o = /* @__PURE__ */ new Set(), s = t.requested ?? {};
169
- for (const d of e)
170
- for (const l of d.controls ?? []) {
171
- if (o.has(l.id)) continue;
172
- o.add(l.id);
173
- const p = (g) => g !== void 0 && (l.options ?? []).some((C) => C.value === g);
174
- let h = ke(l);
175
- const u = t.scenario?.controls?.[l.id];
176
- p(u) && (h = u);
177
- const c = s[l.id];
178
- c !== void 0 && (p(c) ? h = c : r.push({ id: l.id, value: c, reason: "invalid-value", fallback: h })), a[l.id] = h;
179
- }
180
- for (const [d, l] of Object.entries(s))
181
- o.has(d) || r.push({ id: d, value: l, reason: "unknown-control" });
182
- return { values: a, invalid: r };
183
- }
184
- function Pt(e, t) {
185
- return e ? Object.entries(e.controls ?? {}).every(([a, r]) => t?.[a] === r) : !1;
186
- }
187
- const _t = [
1
+ import { jsx as n, jsxs as b, Fragment as V } from "react/jsx-runtime";
2
+ import { useState as z, useRef as j, useCallback as W, useEffect as I, useMemo as $, useLayoutEffect as Ie } from "react";
3
+ import { u as X, g as ht, n as fe, s as ut, c as We, a as mt, r as ft, L as pt } from "./labels-BlpcrSph.js";
4
+ import { D as On, E as $n, N as zn } from "./labels-BlpcrSph.js";
5
+ import { p as wt, P as y, h as Se, a as Ne, r as Ue, C as me, b as Ce, N as He, i as xe, d as bt, c as gt, e as vt, g as kt } from "./index-CaxlsfFr.js";
6
+ import { H as Kn, f as In, j as Wn, k as Un, l as Hn, m as qn, n as Bn, o as jn, s as Vn, q as Gn, v as Zn, t as Yn } from "./index-CaxlsfFr.js";
7
+ import { p as ne, t as re, f as ce, a as qe, F as yt, b as _e, c as St, C as de, i as Nt, m as Ct, s as xt } from "./index-BobUYxei.js";
8
+ import { createPortal as Mt } from "react-dom";
9
+ import { r as Et, i as Lt, s as _t } from "./hook-CeXcli-1.js";
10
+ const Tt = [
188
11
  { id: "mobile", label: "Celular", width: 375, height: 812 },
189
12
  { id: "tablet", label: "Tablet", width: 768, height: 1024 },
190
13
  { id: "desktop", label: "Desktop", width: 1280, height: 800 },
191
14
  { id: "fit", label: "Ajustar" },
192
15
  { id: "custom", label: "Personalizado" }
193
- ], Pe = 25, _e = 150, fe = 100;
194
- function Qe(e, t, a) {
195
- const r = a !== void 0 ? e.screenForPath(a) : e.screenOf(t), o = t && r && e.screenOf(t)?.id === r.id ? t : void 0;
196
- return { screen: r, scenario: o };
197
- }
198
- function $e(e, t, a) {
199
- const r = new URLSearchParams(e), o = bt(r), s = r.get($.component) ?? void 0, d = ve(o, s) ? t.component(s) : void 0, l = r.get($.scenario) ?? void 0, p = d || !re(o, l) ? void 0 : t.scenario(l), h = r.get($.fixture) ?? void 0, u = d ? h ?? t.componentFixture(d.id, d.defaultFixture)?.id ?? d.fixtures?.[0]?.id : void 0, c = r.get($.network), g = d ? void 0 : Qe(t, p, a), C = g?.screen && g.screen.controls.length > 0 ? t.resolveControls(g.screen, {
200
- scenario: g.scenario,
201
- requested: qe(r)
16
+ ], Me = 25, Ee = 150, he = 100;
17
+ function Be(e, t, o) {
18
+ const r = o !== void 0 ? e.screenForPath(o) : e.screenOf(t), s = t && r && e.screenOf(t)?.id === r.id ? t : void 0;
19
+ return { screen: r, scenario: s };
20
+ }
21
+ function ge(e, t, o) {
22
+ const r = new URLSearchParams(e), s = wt(r), a = r.get(y.component) ?? void 0, i = Se(s, a) ? t.component(a) : void 0, d = r.get(y.scenario) ?? void 0, l = i || !Ne(s, d) ? void 0 : t.scenario(d), c = r.get(y.fixture) ?? void 0, h = i ? c ?? t.componentFixture(i.id, i.defaultFixture)?.id ?? i.fixtures?.[0]?.id : void 0, u = r.get(y.network), p = i ? void 0 : Be(t, l, o), S = p?.screen && p.screen.controls.length > 0 ? t.resolveControls(p.screen, {
23
+ scenario: p.scenario,
24
+ requested: Ue(r)
202
25
  }).values : void 0;
203
26
  return {
204
- scenario: p?.id,
205
- handoff: o,
206
- component: d?.id,
27
+ scenario: l?.id,
28
+ handoff: s,
29
+ component: i?.id,
207
30
  // Precedência: URL, cenário, padrão do produto. O preview de componente não
208
31
  // tem persona, então o padrão não se aplica a ele.
209
- persona: r.get($.persona) ?? p?.persona ?? (d ? void 0 : t.defaultPersona),
210
- fixture: d ? u : h ?? p?.fixture,
211
- network: zt(c) ? c : p?.network ?? "success",
212
- viewport: r.get($.viewport) ?? "fit",
213
- customWidth: Vt(r.get($.customWidth)),
214
- themeMode: r.get($.themeMode) ?? t.product.theme?.modes?.[0],
215
- locale: r.get($.locale) ?? t.product.theme?.locales?.[0],
216
- dataSource: r.get($.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
32
+ persona: r.get(y.persona) ?? l?.persona ?? (i ? void 0 : t.defaultPersona),
33
+ fixture: i ? h : c ?? l?.fixture,
34
+ network: Ot(u) ? u : l?.network ?? "success",
35
+ viewport: r.get(y.viewport) ?? "fit",
36
+ customWidth: Dt(r.get(y.customWidth)),
37
+ themeMode: r.get(y.themeMode) ?? t.product.theme?.modes?.[0],
38
+ locale: r.get(y.locale) ?? t.product.theme?.locales?.[0],
39
+ dataSource: r.get(y.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
217
40
  // Sem parâmetro, o tema do chrome fica em aberto: o shell resolve pela
218
41
  // última escolha da pessoa e, na falta dela, pelo sistema.
219
- chromeTheme: Dt(r.get($.chromeTheme)) ? r.get($.chromeTheme) : void 0,
42
+ chromeTheme: $t(r.get(y.chromeTheme)) ? r.get(y.chromeTheme) : void 0,
220
43
  // Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
221
44
  // de tela, então precisa ser explícito para não sumir sem pedido.
222
- chrome: r.get($.chrome) !== "0",
223
- inspector: r.get($.inspector) !== "0",
224
- panelTab: Ut(r.get($.panelTab)) ? r.get($.panelTab) : "variations",
225
- zoom: et(r.get($.zoom)),
226
- rotated: r.get($.rotated) === "1",
227
- highlight: r.get($.highlight) === "1",
228
- screenControls: C
45
+ chrome: r.get(y.chrome) !== "0",
46
+ inspector: r.get(y.inspector) !== "0",
47
+ panelTab: zt(r.get(y.panelTab)) ? r.get(y.panelTab) : "variations",
48
+ zoom: Ge(r.get(y.zoom)),
49
+ rotated: r.get(y.rotated) === "1",
50
+ highlight: r.get(y.highlight) === "1",
51
+ screenControls: S
229
52
  };
230
53
  }
231
- function se(e, t, a) {
232
- const r = new URLSearchParams(), o = t.scenario(e.scenario);
233
- if (e.component ? r.set($.component, e.component) : e.scenario && r.set($.scenario, e.scenario), e.persona && e.persona !== (o?.persona ?? t.defaultPersona) && r.set($.persona, e.persona), e.component && e.fixture ? r.set($.fixture, e.fixture) : e.fixture && e.fixture !== o?.fixture && r.set($.fixture, e.fixture), e.network !== (o?.network ?? "success") && r.set($.network, e.network), e.screenControls && !e.component) {
234
- const u = Qe(t, o, a), c = u.screen ? t.resolveControls(u.screen, { scenario: u.scenario }).values : {}, g = u.screen ? t.controlsOf(u.screen).map((C) => C.id) : Object.keys(e.screenControls);
235
- for (const C of g) {
236
- const N = e.screenControls[C];
237
- N !== void 0 && N !== c[C] && r.set(`${be}${C}`, N);
54
+ function oe(e, t, o) {
55
+ const r = new URLSearchParams(), s = t.scenario(e.scenario);
56
+ if (e.component ? r.set(y.component, e.component) : e.scenario && r.set(y.scenario, e.scenario), e.persona && e.persona !== (s?.persona ?? t.defaultPersona) && r.set(y.persona, e.persona), e.component && e.fixture ? r.set(y.fixture, e.fixture) : e.fixture && e.fixture !== s?.fixture && r.set(y.fixture, e.fixture), e.network !== (s?.network ?? "success") && r.set(y.network, e.network), e.screenControls && !e.component) {
57
+ const h = Be(t, s, o), u = h.screen ? t.resolveControls(h.screen, { scenario: h.scenario }).values : {}, p = h.screen ? t.controlsOf(h.screen).map((S) => S.id) : Object.keys(e.screenControls);
58
+ for (const S of p) {
59
+ const C = e.screenControls[S];
60
+ C !== void 0 && C !== u[S] && r.set(`${me}${S}`, C);
238
61
  }
239
62
  }
240
- e.viewport !== "fit" && r.set($.viewport, e.viewport), e.viewport === "custom" && e.customWidth && r.set($.customWidth, String(e.customWidth));
241
- const s = t.product.theme?.modes?.[0];
242
- e.themeMode && e.themeMode !== s && r.set($.themeMode, e.themeMode);
243
- const d = t.product.theme?.locales?.[0];
244
- e.locale && e.locale !== d && r.set($.locale, e.locale);
245
- const l = t.product.dataSources?.default ?? "fixtures";
246
- e.dataSource && e.dataSource !== l && r.set($.dataSource, e.dataSource), e.chromeTheme && r.set($.chromeTheme, e.chromeTheme), e.chrome || r.set($.chrome, "0"), e.inspector || r.set($.inspector, "0"), e.panelTab === "info" && r.set($.panelTab, "info");
247
- const p = et(e.zoom === void 0 ? null : String(e.zoom));
248
- p !== fe && r.set($.zoom, String(p)), e.rotated && r.set($.rotated, "1"), e.highlight && r.set($.highlight, "1"), Ee(r, e.handoff);
249
- const h = r.toString();
250
- return h ? `?${h}` : "";
251
- }
252
- function Xe(e, t = {}) {
253
- const a = !!t.frame, [r, o] = z(() => Se()), s = q(r), d = I((m) => {
254
- s.current = m, o(m);
255
- }, []), l = q(!1), p = I((m) => {
256
- l.current = !0;
63
+ e.viewport !== "fit" && r.set(y.viewport, e.viewport), e.viewport === "custom" && e.customWidth && r.set(y.customWidth, String(e.customWidth));
64
+ const a = t.product.theme?.modes?.[0];
65
+ e.themeMode && e.themeMode !== a && r.set(y.themeMode, e.themeMode);
66
+ const i = t.product.theme?.locales?.[0];
67
+ e.locale && e.locale !== i && r.set(y.locale, e.locale);
68
+ const d = t.product.dataSources?.default ?? "fixtures";
69
+ e.dataSource && e.dataSource !== d && r.set(y.dataSource, e.dataSource), e.chromeTheme && r.set(y.chromeTheme, e.chromeTheme), e.chrome || r.set(y.chrome, "0"), e.inspector || r.set(y.inspector, "0"), e.panelTab === "info" && r.set(y.panelTab, "info");
70
+ const l = Ge(e.zoom === void 0 ? null : String(e.zoom));
71
+ l !== he && r.set(y.zoom, String(l)), e.rotated && r.set(y.rotated, "1"), e.highlight && r.set(y.highlight, "1"), Ce(r, e.handoff);
72
+ const c = r.toString();
73
+ return c ? `?${c}` : "";
74
+ }
75
+ function je(e, t = {}) {
76
+ const o = !!t.frame, [r, s] = z(() => pe()), a = j(r), i = W((m) => {
77
+ a.current = m, s(m);
78
+ }, []), d = j(!1), l = W((m) => {
79
+ d.current = !0;
257
80
  try {
258
81
  window.history.replaceState(null, "", m);
259
82
  } finally {
260
- l.current = !1;
83
+ d.current = !1;
261
84
  }
262
85
  }, []);
263
- K(() => {
264
- const m = () => d(Se());
86
+ I(() => {
87
+ const m = () => i(pe());
265
88
  return window.addEventListener("popstate", m), () => window.removeEventListener("popstate", m);
266
- }, [d]), K(() => {
267
- if (!a) return;
268
- const m = window.history, { pushState: f, replaceState: k } = m, y = (T) => {
269
- const i = s.current;
270
- if (window.location.pathname !== i.path) return !1;
271
- const w = Ae(i.search, he(window.location.href).search), S = ie(i.path, w);
272
- if (`${window.location.pathname}${window.location.search}` !== S && k.call(m, m.state, "", `${S}${window.location.hash}`), w === i.search) return !0;
273
- const F = { path: i.path, search: w };
274
- return s.current = F, queueMicrotask(() => {
275
- s.current === F && (o(F), ae(
89
+ }, [i]), I(() => {
90
+ if (!o) return;
91
+ const m = window.history, { pushState: w, replaceState: g } = m, N = (T) => {
92
+ const L = a.current;
93
+ if (window.location.pathname !== L.path) return !1;
94
+ const P = Te(L.search, ce(window.location.href).search), A = re(L.path, P);
95
+ if (`${window.location.pathname}${window.location.search}` !== A && g.call(m, m.state, "", `${A}${window.location.hash}`), P === L.search) return !0;
96
+ const G = { path: L.path, search: P };
97
+ return a.current = G, queueMicrotask(() => {
98
+ a.current === G && (s(G), ne(
276
99
  window.parent === window ? void 0 : window.parent,
277
- { ds: 1, type: "navigate", url: S, replace: T },
100
+ { ds: 1, type: "navigate", url: A, replace: T },
278
101
  window.location.origin
279
102
  ));
280
103
  }), !0;
281
104
  };
282
- return m.replaceState = function(T, i, w) {
283
- k.call(m, T, i, w), l.current || y(!0);
284
- }, m.pushState = function(T, i, w) {
285
- const S = `${window.location.pathname}${window.location.search}${window.location.hash}`;
286
- k.call(m, T, i, w), !y(!1) && (k.call(m, m.state, "", S), f.call(m, T, i, w));
287
- }, y(!0), () => {
288
- m.pushState = f, m.replaceState = k;
105
+ return m.replaceState = function(T, L, P) {
106
+ g.call(m, T, L, P), d.current || N(!0);
107
+ }, m.pushState = function(T, L, P) {
108
+ const A = `${window.location.pathname}${window.location.search}${window.location.hash}`;
109
+ g.call(m, T, L, P), !N(!1) && (g.call(m, m.state, "", A), w.call(m, T, L, P));
110
+ }, N(!0), () => {
111
+ m.pushState = w, m.replaceState = g;
289
112
  };
290
- }, [a]), K(() => {
291
- if (!a || window.parent === window) return;
292
- const m = window.location.origin, f = (y) => {
293
- const T = Ze(y, { origin: m, source: window.parent });
113
+ }, [o]), I(() => {
114
+ if (!o || window.parent === window) return;
115
+ const m = window.location.origin, w = (N) => {
116
+ const T = qe(N, { origin: m, source: window.parent });
294
117
  if (T?.type !== "location") return;
295
- const { path: i, search: w } = he(T.url);
296
- p(ie(i, w)), d({ path: i, search: w });
118
+ const { path: L, search: P } = ce(T.url);
119
+ l(re(L, P)), i({ path: L, search: P });
297
120
  };
298
- window.addEventListener("message", f);
299
- const k = Se();
300
- return ae(
121
+ window.addEventListener("message", w);
122
+ const g = pe();
123
+ return ne(
301
124
  window.parent,
302
- { ds: 1, type: "ready", url: ie(k.path, k.search) },
125
+ { ds: 1, type: "ready", url: re(g.path, g.search) },
303
126
  m
304
- ), () => window.removeEventListener("message", f);
305
- }, [a, d, p]);
306
- const h = D(
307
- () => $e(r.search, e, r.path),
127
+ ), () => window.removeEventListener("message", w);
128
+ }, [o, i, l]);
129
+ const c = $(
130
+ () => ge(r.search, e, r.path),
308
131
  [r.path, r.search, e]
309
- ), u = I(
310
- (m, f, k = !1) => {
311
- if (a) {
312
- const T = ie(m, f), i = he(T);
313
- p(T), d(i), ae(
132
+ ), h = W(
133
+ (m, w, g = !1) => {
134
+ if (o) {
135
+ const T = re(m, w), L = ce(T);
136
+ l(T), i(L), ne(
314
137
  window.parent === window ? void 0 : window.parent,
315
- { ds: 1, type: "navigate", url: T, replace: k },
138
+ { ds: 1, type: "navigate", url: T, replace: g },
316
139
  window.location.origin
317
140
  );
318
141
  return;
319
142
  }
320
- const y = `${m}${f}`;
321
- k ? window.history.replaceState(null, "", y) : window.history.pushState(null, "", y), d({ path: m, search: f });
143
+ const N = `${m}${w}`;
144
+ g ? window.history.replaceState(null, "", N) : window.history.pushState(null, "", N), i({ path: m, search: w });
322
145
  },
323
- [a, d, p]
324
- ), c = I(() => {
325
- const m = s.current;
326
- return m === r ? h : $e(m.search, e, m.path);
327
- }, [h, r, e]), g = I(
146
+ [o, i, l]
147
+ ), u = W(() => {
148
+ const m = a.current;
149
+ return m === r ? c : ge(m.search, e, m.path);
150
+ }, [c, r, e]), p = W(
328
151
  (m) => {
329
- const f = s.current, k = { ...c(), ...m }, y = Ae(se(k, e, f.path), f.search);
330
- y !== f.search && u(f.path, y, !0);
152
+ const w = a.current, g = { ...u(), ...m }, N = Te(oe(g, e, w.path), w.search);
153
+ N !== w.search && h(w.path, N, !0);
331
154
  },
332
- [c, u, e]
333
- ), C = I(
155
+ [u, h, e]
156
+ ), S = W(
334
157
  (m) => {
335
- const f = c().screenControls ?? {};
336
- Object.entries(m).some(([y, T]) => f[y] !== T) && g({ screenControls: { ...f, ...m } });
158
+ const w = u().screenControls ?? {};
159
+ Object.entries(m).some(([N, T]) => w[N] !== T) && p({ screenControls: { ...w, ...m } });
337
160
  },
338
- [c, g]
339
- ), N = I(
340
- (m, f) => {
341
- const k = Rt(m, s.current, e, {
342
- controls: f?.controls
161
+ [u, p]
162
+ ), C = W(
163
+ (m, w) => {
164
+ const g = Rt(m, a.current, e, {
165
+ controls: w?.controls
343
166
  });
344
- u(k.path, k.search, f?.replace ?? !1);
167
+ h(g.path, g.search, w?.replace ?? !1);
345
168
  },
346
- [u, e]
347
- ), E = I(
169
+ [h, e]
170
+ ), k = W(
348
171
  (m) => {
349
- const f = e.scenario(m);
350
- if (!f || !re(h.handoff, m)) return;
351
- const k = {
352
- ...h,
353
- scenario: f.id,
172
+ const w = e.scenario(m);
173
+ if (!w || !Ne(c.handoff, m)) return;
174
+ const g = {
175
+ ...c,
176
+ scenario: w.id,
354
177
  component: void 0,
355
- persona: f.persona,
356
- fixture: f.fixture,
357
- network: f.network ?? "success",
178
+ persona: w.persona,
179
+ fixture: w.fixture,
180
+ network: w.network ?? "success",
358
181
  // Os controles voltam ao que o cenário fixa, sobre os padrões da tela.
359
182
  screenControls: void 0
360
183
  };
361
- u(f.route, se(k, e, f.route), !1);
184
+ h(w.route, oe(g, e, w.route), !1);
362
185
  },
363
- [h, u, e]
364
- ), R = I(
365
- (m, f) => {
366
- const k = e.component(m);
367
- if (!k || !ve(h.handoff, m)) return;
368
- const y = {
369
- ...h,
186
+ [c, h, e]
187
+ ), E = W(
188
+ (m, w) => {
189
+ const g = e.component(m);
190
+ if (!g || !Se(c.handoff, m)) return;
191
+ const N = {
192
+ ...c,
370
193
  scenario: void 0,
371
- component: k.id,
194
+ component: g.id,
372
195
  persona: void 0,
373
196
  fixture: void 0,
374
197
  network: "success",
375
198
  screenControls: void 0
376
199
  };
377
- y.fixture = e.componentFixture(k.id, k.defaultFixture)?.id ?? k.fixtures?.[0]?.id, u("/", se(y, e), f?.replace ?? !1);
200
+ N.fixture = e.componentFixture(g.id, g.defaultFixture)?.id ?? g.fixtures?.[0]?.id, h("/", oe(N, e), w?.replace ?? !1);
378
201
  },
379
- [h, u, e]
380
- ), v = I(
381
- (m, f) => {
382
- const k = e.screensFor({ handoff: h.handoff }).find((i) => i.id === m);
383
- if (!k) return;
384
- const y = k.variations[0];
385
- if (y) {
386
- const i = {
387
- ...h,
388
- scenario: y.id,
202
+ [c, h, e]
203
+ ), v = W(
204
+ (m, w) => {
205
+ const g = e.screensFor({ handoff: c.handoff }).find((L) => L.id === m);
206
+ if (!g) return;
207
+ const N = g.variations[0];
208
+ if (N) {
209
+ const L = {
210
+ ...c,
211
+ scenario: N.id,
389
212
  component: void 0,
390
- persona: y.persona,
391
- fixture: y.fixture,
392
- network: y.network ?? "success",
213
+ persona: N.persona,
214
+ fixture: N.fixture,
215
+ network: N.network ?? "success",
393
216
  screenControls: void 0
394
217
  };
395
- u(y.route, se(i, e, y.route), f?.replace ?? !1);
218
+ h(N.route, oe(L, e, N.route), w?.replace ?? !1);
396
219
  return;
397
220
  }
398
221
  const T = {
399
- ...h,
222
+ ...c,
400
223
  scenario: void 0,
401
224
  component: void 0,
402
225
  persona: void 0,
@@ -404,155 +227,155 @@ function Xe(e, t = {}) {
404
227
  network: "success",
405
228
  screenControls: void 0
406
229
  };
407
- u(k.href, se(T, e, k.href), f?.replace ?? !1);
230
+ h(g.href, oe(T, e, g.href), w?.replace ?? !1);
408
231
  },
409
- [h, u, e]
410
- ), L = I(
411
- (m, f, k) => u(m || "/", f, k?.replace ?? !1),
412
- [u]
413
- ), b = D(() => At(h), [h]);
232
+ [c, h, e]
233
+ ), _ = W(
234
+ (m, w, g) => h(m || "/", w, g?.replace ?? !1),
235
+ [h]
236
+ ), f = $(() => At(c), [c]);
414
237
  return {
415
238
  location: r,
416
- controls: h,
417
- viewport: b,
418
- setControls: g,
419
- setScreenControls: C,
420
- navigate: N,
421
- openScenario: E,
422
- openComponent: R,
239
+ controls: c,
240
+ viewport: f,
241
+ setControls: p,
242
+ setScreenControls: S,
243
+ navigate: C,
244
+ openScenario: k,
245
+ openComponent: E,
423
246
  openScreen: v,
424
- go: L
247
+ go: _
425
248
  };
426
249
  }
427
- function Rt(e, t, a, r = {}) {
428
- const o = e.split("#")[0] ?? e, s = o.indexOf("?"), d = (s === -1 ? o : o.slice(0, s)) || "/", l = s === -1 ? void 0 : o.slice(s + 1), p = new URLSearchParams(t.search), h = $e(t.search, a, t.path), u = !Ft(a, d, t.path);
429
- let c;
430
- if (l === void 0 && r.controls === void 0)
431
- c = new URLSearchParams(t.search), u && (St(c), Je(c));
250
+ function Rt(e, t, o, r = {}) {
251
+ const s = e.split("#")[0] ?? e, a = s.indexOf("?"), i = (a === -1 ? s : s.slice(0, a)) || "/", d = a === -1 ? void 0 : s.slice(a + 1), l = new URLSearchParams(t.search), c = ge(t.search, o, t.path), h = !Pt(o, i, t.path);
252
+ let u;
253
+ if (d === void 0 && r.controls === void 0)
254
+ u = new URLSearchParams(t.search), h && (bt(u), Ve(u));
432
255
  else {
433
- const C = new URLSearchParams(l ?? "");
434
- c = new URLSearchParams();
435
- for (const [N, E] of p)
436
- !Ot(N) || C.has(N) || u && !Te(N) || c.append(N, E);
437
- h.scenario && !C.has($.scenario) && h.persona && h.persona !== a.defaultPersona && !c.has($.persona) && !C.has($.persona) && c.set($.persona, h.persona);
438
- for (const [N, E] of C) c.append(N, E);
256
+ const S = new URLSearchParams(d ?? "");
257
+ u = new URLSearchParams();
258
+ for (const [C, k] of l)
259
+ !Ft(C) || S.has(C) || h && !xe(C) || u.append(C, k);
260
+ c.scenario && !S.has(y.scenario) && c.persona && c.persona !== o.defaultPersona && !u.has(y.persona) && !S.has(y.persona) && u.set(y.persona, c.persona);
261
+ for (const [C, k] of S) u.append(C, k);
439
262
  if (r.controls) {
440
- const N = a.screenForPath(d), E = a.scenario(c.get($.scenario) ?? void 0), R = E && N && a.screenOf(E)?.id === N.id ? E : void 0, v = N ? a.resolveControls(N, { scenario: R }).values : {};
441
- for (const [L, b] of Object.entries(r.controls)) {
442
- const m = `${be}${L}`;
443
- v[L] === b ? c.delete(m) : c.set(m, b);
263
+ const C = o.screenForPath(i), k = o.scenario(u.get(y.scenario) ?? void 0), E = k && C && o.screenOf(k)?.id === C.id ? k : void 0, v = C ? o.resolveControls(C, { scenario: E }).values : {};
264
+ for (const [_, f] of Object.entries(r.controls)) {
265
+ const m = `${me}${_}`;
266
+ v[_] === f ? u.delete(m) : u.set(m, f);
444
267
  }
445
268
  }
446
269
  }
447
- h.handoff && Ee(c, h.handoff);
448
- const g = c.toString();
449
- return { path: d, search: g ? `?${g}` : "" };
450
- }
451
- function Ae(e, t) {
452
- const a = new URLSearchParams(e);
453
- Je(a);
454
- for (const [o, s] of new URLSearchParams(t))
455
- o === kt || Te(o) || a.append(o, s);
456
- const r = a.toString();
270
+ c.handoff && Ce(u, c.handoff);
271
+ const p = u.toString();
272
+ return { path: i, search: p ? `?${p}` : "" };
273
+ }
274
+ function Te(e, t) {
275
+ const o = new URLSearchParams(e);
276
+ Ve(o);
277
+ for (const [s, a] of new URLSearchParams(t))
278
+ s === yt || xe(s) || o.append(s, a);
279
+ const r = o.toString();
457
280
  return r ? `?${r}` : "";
458
281
  }
459
- function Je(e) {
282
+ function Ve(e) {
460
283
  for (const t of [...e.keys()])
461
- Te(t) || e.delete(t);
284
+ xe(t) || e.delete(t);
462
285
  }
463
- function Ft(e, t, a) {
464
- const r = e.screenForPath(t)?.id, o = e.screenForPath(a)?.id;
465
- return r === void 0 && o === void 0 ? t === a : r === o;
286
+ function Pt(e, t, o) {
287
+ const r = e.screenForPath(t)?.id, s = e.screenForPath(o)?.id;
288
+ return r === void 0 && s === void 0 ? t === o : r === s;
466
289
  }
467
- function Ot(e) {
468
- return e.startsWith(be) ? !1 : e !== $.scenario && e !== $.fixture && e !== $.component;
290
+ function Ft(e) {
291
+ return e.startsWith(me) ? !1 : e !== y.scenario && e !== y.fixture && e !== y.component;
469
292
  }
470
293
  function At(e) {
471
294
  if (e.viewport === "custom")
472
295
  return { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 };
473
- const t = _t.find((a) => a.id === e.viewport) ?? {
296
+ const t = Tt.find((o) => o.id === e.viewport) ?? {
474
297
  id: "fit",
475
298
  label: "Ajustar"
476
299
  };
477
300
  return e.rotated && t.width && t.height ? { ...t, width: t.height, height: t.width } : { ...t };
478
301
  }
479
- function et(e) {
480
- if (e === null) return fe;
302
+ function Ge(e) {
303
+ if (e === null) return he;
481
304
  const t = Number.parseInt(e, 10);
482
- return Number.isFinite(t) ? Math.min(_e, Math.max(Pe, t)) : fe;
305
+ return Number.isFinite(t) ? Math.min(Ee, Math.max(Me, t)) : he;
483
306
  }
484
- function Se() {
307
+ function pe() {
485
308
  return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
486
309
  }
487
- function zt(e) {
488
- return e !== null && Ge.includes(e);
310
+ function Ot(e) {
311
+ return e !== null && He.includes(e);
489
312
  }
490
- function Dt(e) {
313
+ function $t(e) {
491
314
  return e === "dark" || e === "light";
492
315
  }
493
- function Ut(e) {
316
+ function zt(e) {
494
317
  return e === "variations" || e === "info";
495
318
  }
496
- function Vt(e) {
319
+ function Dt(e) {
497
320
  if (!e) return;
498
321
  const t = Number.parseInt(e, 10);
499
322
  return Number.isFinite(t) && t > 0 ? t : void 0;
500
323
  }
501
- const Kt = "@brucesantos/design-space", ze = "0.12.0", It = {
502
- mobile: /* @__PURE__ */ x(G, { children: [
324
+ const Kt = "@brucesantos/design-space", Re = "0.14.0", It = {
325
+ mobile: /* @__PURE__ */ b(V, { children: [
503
326
  /* @__PURE__ */ n("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2" }),
504
327
  /* @__PURE__ */ n("path", { d: "M11 18.5h2" })
505
328
  ] }),
506
- tablet: /* @__PURE__ */ x(G, { children: [
329
+ tablet: /* @__PURE__ */ b(V, { children: [
507
330
  /* @__PURE__ */ n("rect", { x: "4.5", y: "2.5", width: "15", height: "19", rx: "2" }),
508
331
  /* @__PURE__ */ n("path", { d: "M11 18.5h2" })
509
332
  ] }),
510
- desktop: /* @__PURE__ */ x(G, { children: [
333
+ desktop: /* @__PURE__ */ b(V, { children: [
511
334
  /* @__PURE__ */ n("rect", { x: "2.5", y: "4", width: "19", height: "12.5", rx: "1.5" }),
512
335
  /* @__PURE__ */ n("path", { d: "M8.5 20.5h7M12 16.5v4" })
513
336
  ] }),
514
337
  fit: /* @__PURE__ */ n("path", { d: "M3 12h7M3 12l3-3M3 12l3 3M21 12h-7M21 12l-3-3M21 12l-3 3" }),
515
- rotate: /* @__PURE__ */ x(G, { children: [
338
+ rotate: /* @__PURE__ */ b(V, { children: [
516
339
  /* @__PURE__ */ n("path", { d: "M20 12a8 8 0 1 1-2.34-5.66" }),
517
340
  /* @__PURE__ */ n("path", { d: "M20 4v4.5h-4.5" })
518
341
  ] }),
519
342
  minus: /* @__PURE__ */ n("path", { d: "M5 12h14" }),
520
343
  plus: /* @__PURE__ */ n("path", { d: "M5 12h14M12 5v14" }),
521
344
  "arrow-up-right": /* @__PURE__ */ n("path", { d: "M7 17 17 7M8 7h9v9" }),
522
- link: /* @__PURE__ */ x(G, { children: [
345
+ link: /* @__PURE__ */ b(V, { children: [
523
346
  /* @__PURE__ */ n("path", { d: "M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1" }),
524
347
  /* @__PURE__ */ n("path", { d: "M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1" })
525
348
  ] }),
526
349
  check: /* @__PURE__ */ n("path", { d: "M5 12.5l4.5 4.5L19 7.5" }),
527
350
  fullscreen: /* @__PURE__ */ n("path", { d: "M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" }),
528
- components: /* @__PURE__ */ x(G, { children: [
351
+ components: /* @__PURE__ */ b(V, { children: [
529
352
  /* @__PURE__ */ n("rect", { x: "4", y: "4", width: "7", height: "7", rx: "1" }),
530
353
  /* @__PURE__ */ n("rect", { x: "13", y: "13", width: "7", height: "7", rx: "1" }),
531
354
  /* @__PURE__ */ n("path", { d: "M13 4h7v7M4 13v7h7", strokeDasharray: "2 2" })
532
355
  ] }),
533
- external: /* @__PURE__ */ x(G, { children: [
356
+ external: /* @__PURE__ */ b(V, { children: [
534
357
  /* @__PURE__ */ n("path", { d: "M14 4h6v6M20 4l-8.5 8.5" }),
535
358
  /* @__PURE__ */ n("path", { d: "M18 14v4.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 4 18.5v-11A1.5 1.5 0 0 1 5.5 6H10" })
536
359
  ] }),
537
- sun: /* @__PURE__ */ x(G, { children: [
360
+ sun: /* @__PURE__ */ b(V, { children: [
538
361
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
539
362
  /* @__PURE__ */ n("path", { d: "M12 2.5v2M12 19.5v2M4.6 4.6 6 6M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4 6 18M18 6l1.4-1.4" })
540
363
  ] }),
541
364
  moon: /* @__PURE__ */ n("path", { d: "M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5Z" }),
542
- panel: /* @__PURE__ */ x(G, { children: [
365
+ panel: /* @__PURE__ */ b(V, { children: [
543
366
  /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
544
367
  /* @__PURE__ */ n("path", { d: "M15 4v16" })
545
368
  ] }),
546
- alert: /* @__PURE__ */ x(G, { children: [
369
+ alert: /* @__PURE__ */ b(V, { children: [
547
370
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
548
371
  /* @__PURE__ */ n("path", { d: "M12 7.5v5.5M12 16.2v.3" })
549
372
  ] }),
550
373
  chevron: /* @__PURE__ */ n("path", { d: "M9 6l6 6-6 6" }),
551
- search: /* @__PURE__ */ x(G, { children: [
374
+ search: /* @__PURE__ */ b(V, { children: [
552
375
  /* @__PURE__ */ n("circle", { cx: "11", cy: "11", r: "6.5" }),
553
376
  /* @__PURE__ */ n("path", { d: "M20 20l-4.2-4.2" })
554
377
  ] }),
555
- copy: /* @__PURE__ */ x(G, { children: [
378
+ copy: /* @__PURE__ */ b(V, { children: [
556
379
  /* @__PURE__ */ n("rect", { x: "8.5", y: "8.5", width: "12", height: "12", rx: "2" }),
557
380
  /* @__PURE__ */ n("path", { d: "M15.5 8.5V5.5a2 2 0 0 0-2-2h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3" })
558
381
  ] })
@@ -576,377 +399,71 @@ function H({ name: e, size: t = 16 }) {
576
399
  }
577
400
  );
578
401
  }
579
- const oe = {
580
- network: {
581
- success: "Sucesso",
582
- loading: "Carregando",
583
- empty: "Vazio",
584
- error: "Erro",
585
- slow: "Lento"
586
- },
587
- viewport: {
588
- fit: "Ajustar",
589
- mobile: "Celular",
590
- tablet: "Tablet",
591
- desktop: "Desktop",
592
- custom: "Personalizado"
593
- },
594
- topbar: {
595
- region: "Barra do Design Space",
596
- viewportGroup: "Viewport",
597
- rotate: "Girar",
598
- zoomOut: "Diminuir zoom",
599
- zoomIn: "Aumentar zoom",
600
- zoomReset: "Voltar o zoom para 100%",
601
- zoomValue: (e) => `${e}%`,
602
- copyLink: "Copiar link",
603
- copied: "Link copiado",
604
- copyPrompt: "Copie o link:",
605
- cleanReview: "Revisão limpa (Shift+C)",
606
- highlight: "Destacar componentes",
607
- openFrame: "Abrir em nova janela",
608
- lightMode: "Tema claro",
609
- darkMode: "Tema escuro",
610
- engineVersion: (e) => `Design Space ${e}`,
611
- diagnostics: (e, t) => `Diagnóstico: ${e} ${e === 1 ? "erro" : "erros"}, ${t} ${t === 1 ? "aviso" : "avisos"}`,
612
- branchTitle: (e) => `Branch: ${e}`,
613
- commitTitle: (e) => `Commit: ${e}`,
614
- envTitle: (e) => `Ambiente: ${e}`
615
- },
616
- highlight: {
617
- notInCatalog: (e) => `${e} · fora do catálogo`
618
- },
619
- sidebar: {
620
- region: "Navegação",
621
- tabs: "Telas e componentes",
622
- screensTab: "Telas",
623
- componentsTab: "Componentes",
624
- searchPlaceholder: "Buscar",
625
- searchLabel: "Buscar telas e componentes",
626
- searchShortcut: "⌘K",
627
- noMatch: (e) => `Nada encontrado para "${e}".`,
628
- emptyScreens: "Nenhuma tela neste branch. Telas de feature entram por PR, enquanto estão em desenho.",
629
- emptyComponents: "O produto ainda não registrou componentes.",
630
- ungrouped: "Outros",
631
- toggleGroup: (e) => `Mostrar ou ocultar ${e}`,
632
- resize: "Redimensionar a navegação"
633
- },
634
- panel: {
635
- region: "Painel",
636
- searchPlaceholder: "Filtrar",
637
- searchLabel: "Filtrar variações e informações",
638
- searchShortcut: "⌘F",
639
- noMatch: (e) => `Nada neste painel para "${e}".`,
640
- tabs: "Variações e informações",
641
- variationsTab: "Variações",
642
- infoTab: "Informações",
643
- resize: "Redimensionar o painel",
644
- variationsList: "Variações da tela",
645
- componentVariations: "Variações do componente",
646
- defaultVariation: "Padrão",
647
- defaultVariationHint: "A tela sem cenário declarado, sem fixture.",
648
- noVariations: "Esta tela não tem variações.",
649
- noComponentVariations: "Este componente não declara variações de dados.",
650
- nothingSelected: "Escolha uma tela ou um componente na navegação.",
651
- persona: "Persona",
652
- network: "Estado de rede",
653
- theme: "Tema",
654
- locale: "Idioma",
655
- dataSource: "Fonte de dados",
656
- fixturesOption: "Fixtures",
657
- none: "—",
658
- fixtureFallback: (e, t) => `A variação \`${e}\` não existe neste componente. Exibindo \`${t}\`.`,
659
- context: "Contexto",
660
- shortcuts: "Atalhos",
661
- toggleGroup: (e) => `Mostrar ou ocultar ${e}`,
662
- openComponent: (e) => `Abrir ${e} no catálogo`
663
- },
664
- info: {
665
- screen: "Tela",
666
- variation: "Variação",
667
- component: "Componente",
668
- name: "Nome",
669
- id: "Id",
670
- group: "Grupo",
671
- description: "Descrição",
672
- source: "Origem",
673
- usedIn: "Usado em",
674
- notUsed: "Nenhuma tela declara este componente.",
675
- route: "Rota",
676
- persona: "Persona",
677
- permissions: "Permissões",
678
- intent: "Intenção",
679
- preconditions: "Pré-condições",
680
- actions: "Ações",
681
- expected: "Comportamento esperado",
682
- rules: "Regras",
683
- components: "Componentes usados",
684
- ticket: "Ticket",
685
- flow: "Fluxo",
686
- controls: "Controles",
687
- copyForPr: "Copiar para o PR",
688
- copiedForPr: "Copiado",
689
- copyPrompt: "Copie o texto para o PR:"
690
- },
691
- diagnostics: {
692
- title: "Diagnóstico",
693
- noIssues: "Nenhum problema encontrado.",
694
- error: "Erro",
695
- warning: "Aviso",
696
- close: "Fechar diagnóstico",
697
- invalidControl: (e, t, a) => `O controle \`${e}\` não tem a opção \`${t}\`. Exibindo \`${a}\`.`,
698
- unknownControl: (e, t) => `A tela não tem o controle \`${e}\` (pedido \`${t}\` na URL). O parâmetro foi ignorado.`
699
- },
700
- pr: {
701
- variations: "Variações",
702
- components: "Componentes",
703
- component: "Componente",
704
- source: "Origem",
705
- expected: "Comportamento esperado",
706
- commit: (e) => `Commit \`${e}\``,
707
- immutableLink: "link deste deployment",
708
- noExpected: "Sem comportamento esperado declarado.",
709
- empty: "—",
710
- open: "Abrir a tela",
711
- controls: "Controles",
712
- shortcuts: "Atalhos",
713
- defaultOption: "padrão"
714
- },
715
- shell: {
716
- restoreChrome: "Mostrar o chrome (Shift+C)",
717
- frameTitle: (e) => `Pré-visualização de ${e}`,
718
- noRoute: "Nenhuma rota para este endereço",
719
- noRouteHint: "não casa com nenhuma rota declarada. Escolha uma tela na navegação.",
720
- outsideHandoff: "Fora do escopo deste handoff",
721
- outsideHandoffHint: "Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação.",
722
- empty: "Nada para mostrar ainda",
723
- emptyHint: "O produto ainda não registrou telas nem componentes."
724
- }
725
- }, Cn = {
726
- network: {
727
- success: "Success",
728
- loading: "Loading",
729
- empty: "Empty",
730
- error: "Error",
731
- slow: "Slow"
732
- },
733
- viewport: {
734
- fit: "Fit",
735
- mobile: "Mobile",
736
- tablet: "Tablet",
737
- desktop: "Desktop",
738
- custom: "Custom"
739
- },
740
- topbar: {
741
- region: "Design Space bar",
742
- viewportGroup: "Viewport",
743
- rotate: "Rotate",
744
- zoomOut: "Zoom out",
745
- zoomIn: "Zoom in",
746
- zoomReset: "Reset zoom to 100%",
747
- zoomValue: (e) => `${e}%`,
748
- copyLink: "Copy link",
749
- copied: "Link copied",
750
- copyPrompt: "Copy the link:",
751
- cleanReview: "Clean review (Shift+C)",
752
- highlight: "Highlight components",
753
- openFrame: "Open in new window",
754
- lightMode: "Light theme",
755
- darkMode: "Dark theme",
756
- engineVersion: (e) => `Design Space ${e}`,
757
- diagnostics: (e, t) => `Diagnostics: ${e} ${e === 1 ? "error" : "errors"}, ${t} ${t === 1 ? "warning" : "warnings"}`,
758
- branchTitle: (e) => `Branch: ${e}`,
759
- commitTitle: (e) => `Commit: ${e}`,
760
- envTitle: (e) => `Environment: ${e}`
761
- },
762
- highlight: {
763
- notInCatalog: (e) => `${e} · not in catalog`
764
- },
765
- sidebar: {
766
- region: "Navigation",
767
- tabs: "Screens and components",
768
- screensTab: "Screens",
769
- componentsTab: "Components",
770
- searchPlaceholder: "Search",
771
- searchLabel: "Search screens and components",
772
- searchShortcut: "⌘K",
773
- noMatch: (e) => `Nothing found for "${e}".`,
774
- emptyScreens: "No screens on this branch. Feature screens come in through a pull request while they are being designed.",
775
- emptyComponents: "The product has not registered any components yet.",
776
- ungrouped: "Other",
777
- toggleGroup: (e) => `Show or hide ${e}`,
778
- resize: "Resize navigation"
779
- },
780
- panel: {
781
- region: "Panel",
782
- searchPlaceholder: "Filter",
783
- searchLabel: "Filter variations and details",
784
- searchShortcut: "⌘F",
785
- noMatch: (e) => `Nothing in this panel for "${e}".`,
786
- tabs: "Variations and information",
787
- variationsTab: "Variations",
788
- infoTab: "Information",
789
- resize: "Resize panel",
790
- variationsList: "Screen variations",
791
- componentVariations: "Component variations",
792
- defaultVariation: "Default",
793
- defaultVariationHint: "The screen without a declared scenario or fixture.",
794
- noVariations: "This screen has no variations.",
795
- noComponentVariations: "This component does not declare data variations.",
796
- nothingSelected: "Choose a screen or a component in the navigation.",
797
- persona: "Persona",
798
- network: "Network state",
799
- theme: "Theme",
800
- locale: "Language",
801
- dataSource: "Data source",
802
- fixturesOption: "Fixtures",
803
- none: "—",
804
- fixtureFallback: (e, t) => `Variation \`${e}\` does not exist for this component. Showing \`${t}\`.`,
805
- context: "Context",
806
- shortcuts: "Shortcuts",
807
- toggleGroup: (e) => `Show or hide ${e}`,
808
- openComponent: (e) => `Open ${e} in the catalog`
809
- },
810
- info: {
811
- screen: "Screen",
812
- variation: "Variation",
813
- component: "Component",
814
- name: "Name",
815
- id: "ID",
816
- group: "Group",
817
- description: "Description",
818
- source: "Source",
819
- usedIn: "Used in",
820
- notUsed: "No screen declares this component.",
821
- route: "Route",
822
- persona: "Persona",
823
- permissions: "Permissions",
824
- intent: "Intent",
825
- preconditions: "Preconditions",
826
- actions: "Actions",
827
- expected: "Expected behavior",
828
- rules: "Rules",
829
- components: "Components used",
830
- ticket: "Ticket",
831
- flow: "Flow",
832
- controls: "Controls",
833
- copyForPr: "Copy for PR",
834
- copiedForPr: "Copied",
835
- copyPrompt: "Copy the text for the PR:"
836
- },
837
- diagnostics: {
838
- title: "Diagnostics",
839
- noIssues: "No issues found.",
840
- error: "Error",
841
- warning: "Warning",
842
- close: "Close diagnostics",
843
- invalidControl: (e, t, a) => `Control \`${e}\` has no option \`${t}\`. Showing \`${a}\`.`,
844
- unknownControl: (e, t) => `This screen has no control \`${e}\` (\`${t}\` requested in the URL). The parameter was ignored.`
845
- },
846
- pr: {
847
- variations: "Variations",
848
- components: "Components",
849
- component: "Component",
850
- source: "Source",
851
- expected: "Expected behavior",
852
- commit: (e) => `Commit \`${e}\``,
853
- immutableLink: "this deployment",
854
- noExpected: "No expected behavior declared.",
855
- empty: "—",
856
- open: "Open the screen",
857
- controls: "Controls",
858
- shortcuts: "Shortcuts",
859
- defaultOption: "default"
860
- },
861
- shell: {
862
- restoreChrome: "Show chrome (Shift+C)",
863
- frameTitle: (e) => `${e} preview`,
864
- noRoute: "No route for this address",
865
- noRouteHint: "does not match any declared route. Choose a screen from the navigation.",
866
- outsideHandoff: "Outside this handoff scope",
867
- outsideHandoffHint: "This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation.",
868
- empty: "Nothing to show yet",
869
- emptyHint: "The product has not registered any screens or components yet."
870
- }
871
- };
872
- function Ht(e) {
873
- if (!e) return oe;
874
- const t = { ...oe };
875
- for (const a of Object.keys(oe)) {
876
- const r = e[a];
877
- r && (t[a] = { ...oe[a], ...r });
878
- }
879
- return t;
880
- }
881
- const tt = wt(oe);
882
- function J() {
883
- return ft(tt);
884
- }
885
- const xn = oe.network, Wt = [
402
+ const Wt = [
886
403
  { id: "mobile", icon: "mobile" },
887
404
  { id: "tablet", icon: "tablet" },
888
405
  { id: "desktop", icon: "desktop" },
889
406
  { id: "fit", icon: "fit" }
890
- ], De = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
891
- function Ue(e, t) {
892
- return t > 0 ? De.find((a) => a > e) ?? _e : [...De].reverse().find((a) => a < e) ?? Pe;
407
+ ], Pe = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
408
+ function Fe(e, t) {
409
+ return t > 0 ? Pe.find((o) => o > e) ?? Ee : [...Pe].reverse().find((o) => o < e) ?? Me;
893
410
  }
894
- function Bt({
411
+ function Ut({
895
412
  productName: e,
896
413
  viewportId: t,
897
- viewport: a,
414
+ viewport: o,
898
415
  zoom: r,
899
- rotated: o,
900
- highlight: s,
901
- theme: d,
902
- issues: l,
903
- linkUrl: p,
904
- onViewport: h,
905
- onRotate: u,
906
- onZoom: c,
907
- onHighlight: g,
908
- onCleanReview: C,
909
- onOpenFrame: N,
910
- onToggleTheme: E
416
+ rotated: s,
417
+ highlight: a,
418
+ theme: i,
419
+ issues: d,
420
+ linkUrl: l,
421
+ onViewport: c,
422
+ onRotate: h,
423
+ onZoom: u,
424
+ onHighlight: p,
425
+ onCleanReview: S,
426
+ onOpenFrame: C,
427
+ onToggleTheme: k
911
428
  }) {
912
- const R = J(), v = R.topbar, [L, b] = z(!1), m = (t === "mobile" || t === "tablet") && !!(a.width && a.height), f = async () => {
429
+ const E = X(), v = E.topbar, [_, f] = z(!1), m = (t === "mobile" || t === "tablet") && !!(o.width && o.height), w = async () => {
913
430
  try {
914
- await navigator.clipboard.writeText(p);
431
+ await navigator.clipboard.writeText(l);
915
432
  } catch {
916
- window.prompt(v.copyPrompt, p);
433
+ window.prompt(v.copyPrompt, l);
917
434
  }
918
- b(!0), window.setTimeout(() => b(!1), 1600);
435
+ f(!0), window.setTimeout(() => f(!1), 1600);
919
436
  };
920
- return /* @__PURE__ */ x("header", { className: "ds-topbar", "aria-label": v.region, children: [
921
- /* @__PURE__ */ x("div", { className: "ds-topbar__product", children: [
437
+ return /* @__PURE__ */ b("header", { className: "ds-topbar", "aria-label": v.region, children: [
438
+ /* @__PURE__ */ b("div", { className: "ds-topbar__product", children: [
922
439
  /* @__PURE__ */ n("span", { className: "ds-topbar__name", children: e }),
923
440
  /* @__PURE__ */ n(
924
441
  "a",
925
442
  {
926
443
  className: "ds-topbar__version",
927
- href: `https://www.npmjs.com/package/${Kt}/v/${ze}`,
444
+ href: `https://www.npmjs.com/package/${Kt}/v/${Re}`,
928
445
  target: "_blank",
929
446
  rel: "noreferrer",
930
- children: v.engineVersion(ze)
447
+ children: v.engineVersion(Re)
931
448
  }
932
449
  )
933
450
  ] }),
934
- /* @__PURE__ */ x("div", { className: "ds-topbar__view", children: [
935
- /* @__PURE__ */ x("div", { className: "ds-group", role: "group", "aria-label": v.viewportGroup, children: [
936
- Wt.map((k) => {
937
- const y = R.viewport[k.id] ?? k.id;
451
+ /* @__PURE__ */ b("div", { className: "ds-topbar__view", children: [
452
+ /* @__PURE__ */ b("div", { className: "ds-group", role: "group", "aria-label": v.viewportGroup, children: [
453
+ Wt.map((g) => {
454
+ const N = E.viewport[g.id] ?? g.id;
938
455
  return /* @__PURE__ */ n(
939
456
  "button",
940
457
  {
941
458
  type: "button",
942
459
  className: "ds-btn ds-btn--icon",
943
- "aria-pressed": t === k.id,
944
- "aria-label": y,
945
- title: y,
946
- onClick: () => h(k.id),
947
- children: /* @__PURE__ */ n(H, { name: k.icon })
460
+ "aria-pressed": t === g.id,
461
+ "aria-label": N,
462
+ title: N,
463
+ onClick: () => c(g.id),
464
+ children: /* @__PURE__ */ n(H, { name: g.icon })
948
465
  },
949
- k.id
466
+ g.id
950
467
  );
951
468
  }),
952
469
  /* @__PURE__ */ n(
@@ -954,16 +471,16 @@ function Bt({
954
471
  {
955
472
  type: "button",
956
473
  className: "ds-btn ds-btn--icon",
957
- "aria-pressed": o,
474
+ "aria-pressed": s,
958
475
  "aria-label": v.rotate,
959
476
  title: v.rotate,
960
477
  disabled: !m,
961
- onClick: u,
478
+ onClick: h,
962
479
  children: /* @__PURE__ */ n(H, { name: "rotate" })
963
480
  }
964
481
  )
965
482
  ] }),
966
- /* @__PURE__ */ x("div", { className: "ds-group", role: "group", children: [
483
+ /* @__PURE__ */ b("div", { className: "ds-group", role: "group", children: [
967
484
  /* @__PURE__ */ n(
968
485
  "button",
969
486
  {
@@ -971,8 +488,8 @@ function Bt({
971
488
  className: "ds-btn ds-btn--icon",
972
489
  "aria-label": v.zoomOut,
973
490
  title: v.zoomOut,
974
- disabled: r <= Pe,
975
- onClick: () => c(Ue(r, -1)),
491
+ disabled: r <= Me,
492
+ onClick: () => u(Fe(r, -1)),
976
493
  children: /* @__PURE__ */ n(H, { name: "minus" })
977
494
  }
978
495
  ),
@@ -983,7 +500,7 @@ function Bt({
983
500
  className: "ds-btn ds-btn--zoom",
984
501
  "aria-label": v.zoomReset,
985
502
  title: v.zoomReset,
986
- onClick: () => c(fe),
503
+ onClick: () => u(he),
987
504
  children: v.zoomValue(r)
988
505
  }
989
506
  ),
@@ -994,8 +511,8 @@ function Bt({
994
511
  className: "ds-btn ds-btn--icon",
995
512
  "aria-label": v.zoomIn,
996
513
  title: v.zoomIn,
997
- disabled: r >= _e,
998
- onClick: () => c(Ue(r, 1)),
514
+ disabled: r >= Ee,
515
+ onClick: () => u(Fe(r, 1)),
999
516
  children: /* @__PURE__ */ n(H, { name: "plus" })
1000
517
  }
1001
518
  )
@@ -1005,10 +522,10 @@ function Bt({
1005
522
  {
1006
523
  type: "button",
1007
524
  className: "ds-btn ds-btn--icon",
1008
- "aria-pressed": s,
525
+ "aria-pressed": a,
1009
526
  "aria-label": v.highlight,
1010
527
  title: v.highlight,
1011
- onClick: g,
528
+ onClick: p,
1012
529
  children: /* @__PURE__ */ n(H, { name: "components" })
1013
530
  }
1014
531
  ),
@@ -1019,7 +536,7 @@ function Bt({
1019
536
  className: "ds-btn ds-btn--icon",
1020
537
  "aria-label": v.cleanReview,
1021
538
  title: v.cleanReview,
1022
- onClick: C,
539
+ onClick: S,
1023
540
  children: /* @__PURE__ */ n(H, { name: "fullscreen" })
1024
541
  }
1025
542
  ),
@@ -1030,21 +547,21 @@ function Bt({
1030
547
  className: "ds-btn ds-btn--icon",
1031
548
  "aria-label": v.openFrame,
1032
549
  title: v.openFrame,
1033
- onClick: N,
550
+ onClick: C,
1034
551
  children: /* @__PURE__ */ n(H, { name: "external" })
1035
552
  }
1036
553
  )
1037
554
  ] }),
1038
- /* @__PURE__ */ x("div", { className: "ds-topbar__tools", children: [
555
+ /* @__PURE__ */ b("div", { className: "ds-topbar__tools", children: [
1039
556
  /* @__PURE__ */ n(
1040
557
  "button",
1041
558
  {
1042
559
  type: "button",
1043
560
  className: "ds-btn ds-btn--icon",
1044
- "aria-label": L ? v.copied : v.copyLink,
1045
- title: L ? v.copied : v.copyLink,
1046
- onClick: f,
1047
- children: /* @__PURE__ */ n(H, { name: L ? "check" : "link" })
561
+ "aria-label": _ ? v.copied : v.copyLink,
562
+ title: _ ? v.copied : v.copyLink,
563
+ onClick: w,
564
+ children: /* @__PURE__ */ n(H, { name: _ ? "check" : "link" })
1048
565
  }
1049
566
  ),
1050
567
  /* @__PURE__ */ n(
@@ -1052,73 +569,73 @@ function Bt({
1052
569
  {
1053
570
  type: "button",
1054
571
  className: "ds-btn ds-btn--icon",
1055
- "aria-label": d === "dark" ? v.lightMode : v.darkMode,
1056
- title: d === "dark" ? v.lightMode : v.darkMode,
1057
- onClick: E,
1058
- children: /* @__PURE__ */ n(H, { name: d === "dark" ? "sun" : "moon" })
572
+ "aria-label": i === "dark" ? v.lightMode : v.darkMode,
573
+ title: i === "dark" ? v.lightMode : v.darkMode,
574
+ onClick: k,
575
+ children: /* @__PURE__ */ n(H, { name: i === "dark" ? "sun" : "moon" })
1059
576
  }
1060
577
  ),
1061
- l.length > 0 && /* @__PURE__ */ n(jt, { issues: l })
578
+ d.length > 0 && /* @__PURE__ */ n(Ht, { issues: d })
1062
579
  ] })
1063
580
  ] });
1064
581
  }
1065
- function jt({ issues: e }) {
1066
- const t = J(), [a, r] = z(!1), o = q(null), s = e.filter((p) => p.level === "error").length, d = e.length - s, l = t.topbar.diagnostics(s, d);
1067
- return K(() => {
1068
- if (!a) return;
1069
- const p = (u) => {
1070
- o.current?.contains(u.target) || r(!1);
1071
- }, h = (u) => {
1072
- u.key === "Escape" && r(!1);
582
+ function Ht({ issues: e }) {
583
+ const t = X(), [o, r] = z(!1), s = j(null), a = e.filter((l) => l.level === "error").length, i = e.length - a, d = t.topbar.diagnostics(a, i);
584
+ return I(() => {
585
+ if (!o) return;
586
+ const l = (h) => {
587
+ s.current?.contains(h.target) || r(!1);
588
+ }, c = (h) => {
589
+ h.key === "Escape" && r(!1);
1073
590
  };
1074
- return window.addEventListener("pointerdown", p), window.addEventListener("keydown", h), () => {
1075
- window.removeEventListener("pointerdown", p), window.removeEventListener("keydown", h);
591
+ return window.addEventListener("pointerdown", l), window.addEventListener("keydown", c), () => {
592
+ window.removeEventListener("pointerdown", l), window.removeEventListener("keydown", c);
1076
593
  };
1077
- }, [a]), /* @__PURE__ */ x("div", { className: "ds-diagnostics", ref: o, children: [
1078
- /* @__PURE__ */ x(
594
+ }, [o]), /* @__PURE__ */ b("div", { className: "ds-diagnostics", ref: s, children: [
595
+ /* @__PURE__ */ b(
1079
596
  "button",
1080
597
  {
1081
598
  type: "button",
1082
599
  className: "ds-btn ds-diagnostics__trigger",
1083
- "data-level": s > 0 ? "error" : "warning",
1084
- "aria-expanded": a,
1085
- "aria-label": l,
1086
- title: l,
1087
- onClick: () => r((p) => !p),
600
+ "data-level": a > 0 ? "error" : "warning",
601
+ "aria-expanded": o,
602
+ "aria-label": d,
603
+ title: d,
604
+ onClick: () => r((l) => !l),
1088
605
  children: [
1089
606
  /* @__PURE__ */ n(H, { name: "alert" }),
1090
- /* @__PURE__ */ n("span", { children: s > 0 ? s : d })
607
+ /* @__PURE__ */ n("span", { children: a > 0 ? a : i })
1091
608
  ]
1092
609
  }
1093
610
  ),
1094
- a && /* @__PURE__ */ x("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": t.diagnostics.title, children: [
1095
- /* @__PURE__ */ x("div", { className: "ds-diagnostics__head", children: [
611
+ o && /* @__PURE__ */ b("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": t.diagnostics.title, children: [
612
+ /* @__PURE__ */ b("div", { className: "ds-diagnostics__head", children: [
1096
613
  /* @__PURE__ */ n("strong", { children: t.diagnostics.title }),
1097
- /* @__PURE__ */ n("span", { className: "ds-muted", children: l })
614
+ /* @__PURE__ */ n("span", { className: "ds-muted", children: d })
1098
615
  ] }),
1099
- /* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((p, h) => /* @__PURE__ */ x("li", { className: "ds-diagnostics__item", "data-level": p.level, children: [
1100
- /* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children: p.level === "error" ? t.diagnostics.error : t.diagnostics.warning }),
1101
- /* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children: p.where }),
1102
- /* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children: p.message })
1103
- ] }, `${p.where}-${h}`)) })
616
+ /* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((l, c) => /* @__PURE__ */ b("li", { className: "ds-diagnostics__item", "data-level": l.level, children: [
617
+ /* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children: l.level === "error" ? t.diagnostics.error : t.diagnostics.warning }),
618
+ /* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children: l.where }),
619
+ /* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children: l.message })
620
+ ] }, `${l.where}-${c}`)) })
1104
621
  ] })
1105
622
  ] });
1106
623
  }
1107
624
  const qt = 16;
1108
- function nt({ side: e, label: t, value: a, onChange: r, onStart: o, onEnd: s }) {
1109
- const d = q(void 0), l = e === "left" ? 1 : -1, p = (g) => {
1110
- if (g.button === 0) {
1111
- g.preventDefault(), d.current = { x: g.clientX, width: a };
625
+ function Ze({ side: e, label: t, value: o, onChange: r, onStart: s, onEnd: a }) {
626
+ const i = j(void 0), d = e === "left" ? 1 : -1, l = (p) => {
627
+ if (p.button === 0) {
628
+ p.preventDefault(), i.current = { x: p.clientX, width: o };
1112
629
  try {
1113
- g.currentTarget.setPointerCapture(g.pointerId);
630
+ p.currentTarget.setPointerCapture(p.pointerId);
1114
631
  } catch {
1115
632
  }
1116
- o?.();
633
+ s?.();
1117
634
  }
1118
- }, h = (g) => {
1119
- d.current && r(d.current.width + (g.clientX - d.current.x) * l);
1120
- }, u = () => {
1121
- d.current && (d.current = void 0, s?.());
635
+ }, c = (p) => {
636
+ i.current && r(i.current.width + (p.clientX - i.current.x) * d);
637
+ }, h = () => {
638
+ i.current && (i.current = void 0, a?.());
1122
639
  };
1123
640
  return /* @__PURE__ */ n(
1124
641
  "div",
@@ -1128,177 +645,177 @@ function nt({ side: e, label: t, value: a, onChange: r, onStart: o, onEnd: s })
1128
645
  role: "separator",
1129
646
  "aria-orientation": "vertical",
1130
647
  "aria-label": t,
1131
- "aria-valuenow": a,
648
+ "aria-valuenow": o,
1132
649
  tabIndex: 0,
1133
- onPointerDown: p,
1134
- onPointerMove: h,
1135
- onPointerUp: u,
1136
- onPointerCancel: u,
1137
- onLostPointerCapture: u,
1138
- onKeyDown: (g) => {
1139
- if (g.key !== "ArrowLeft" && g.key !== "ArrowRight") return;
1140
- g.preventDefault();
1141
- const C = g.key === "ArrowRight" ? 1 : -1;
1142
- r(a + C * l * qt);
650
+ onPointerDown: l,
651
+ onPointerMove: c,
652
+ onPointerUp: h,
653
+ onPointerCancel: h,
654
+ onLostPointerCapture: h,
655
+ onKeyDown: (p) => {
656
+ if (p.key !== "ArrowLeft" && p.key !== "ArrowRight") return;
657
+ p.preventDefault();
658
+ const S = p.key === "ArrowRight" ? 1 : -1;
659
+ r(o + S * d * qt);
1143
660
  }
1144
661
  }
1145
662
  );
1146
663
  }
1147
- function Gt({
664
+ function Bt({
1148
665
  registry: e,
1149
666
  handoff: t,
1150
- activeScreen: a,
667
+ activeScreen: o,
1151
668
  activeComponent: r,
1152
- onOpenScreen: o,
1153
- onOpenComponent: s,
1154
- width: d,
1155
- onResize: l,
1156
- onResizeStart: p,
1157
- onResizeEnd: h
669
+ onOpenScreen: s,
670
+ onOpenComponent: a,
671
+ width: i,
672
+ onResize: d,
673
+ onResizeStart: l,
674
+ onResizeEnd: c
1158
675
  }) {
1159
- const c = J().sidebar, [g, C] = z(""), [N, E] = z(() => /* @__PURE__ */ new Set()), R = q(null), v = e.screensFor({ handoff: t }), L = e.componentsFor(t), b = v.length > 0, m = L.length > 0, [f, k] = z(
1160
- () => r || !b ? "components" : "screens"
676
+ const u = X().sidebar, [p, S] = z(""), [C, k] = z(() => /* @__PURE__ */ new Set()), E = j(null), v = e.screensFor({ handoff: t }), _ = e.componentsFor(t), f = v.length > 0, m = _.length > 0, [w, g] = z(
677
+ () => r || !f ? "components" : "screens"
1161
678
  );
1162
- K(() => {
1163
- r && m ? k("components") : a && b && k("screens");
1164
- }, [r, a, m, b]);
1165
- const y = f;
1166
- K(() => {
1167
- const O = (U) => {
1168
- Qt(U) && (U.preventDefault(), R.current?.focus(), R.current?.select());
679
+ I(() => {
680
+ r && m ? g("components") : o && f && g("screens");
681
+ }, [r, o, m, f]);
682
+ const N = w;
683
+ I(() => {
684
+ const F = (D) => {
685
+ Gt(D) && (D.preventDefault(), E.current?.focus(), E.current?.select());
1169
686
  };
1170
- return window.addEventListener("keydown", O), () => window.removeEventListener("keydown", O);
687
+ return window.addEventListener("keydown", F), () => window.removeEventListener("keydown", F);
1171
688
  }, []);
1172
- const T = D(
1173
- () => e.searchScreens(g, { handoff: t }),
1174
- [t, g, e]
1175
- ), i = D(
1176
- () => e.searchComponents(g, t),
1177
- [t, g, e]
1178
- ), w = D(() => Yt(i, c.ungrouped), [i, c.ungrouped]), S = D(() => Ye(T), [T]), M = g.trim().length > 0, F = (O) => E((U) => {
1179
- const P = new Set(U);
1180
- return P.has(O) ? P.delete(O) : P.add(O), P;
689
+ const T = $(
690
+ () => e.searchScreens(p, { handoff: t }),
691
+ [t, p, e]
692
+ ), L = $(
693
+ () => e.searchComponents(p, t),
694
+ [t, p, e]
695
+ ), P = $(() => Vt(L, u.ungrouped), [L, u.ungrouped]), A = $(() => ht(T), [T]), O = p.trim().length > 0, G = (F) => k((D) => {
696
+ const x = new Set(D);
697
+ return x.has(F) ? x.delete(F) : x.add(F), x;
1181
698
  });
1182
- return /* @__PURE__ */ x("nav", { className: "ds-sidebar", "aria-label": c.region, style: { width: d }, children: [
1183
- /* @__PURE__ */ x("div", { className: "ds-search", children: [
699
+ return /* @__PURE__ */ b("nav", { className: "ds-sidebar", "aria-label": u.region, style: { width: i }, children: [
700
+ /* @__PURE__ */ b("div", { className: "ds-search", children: [
1184
701
  /* @__PURE__ */ n(H, { name: "search", size: 14 }),
1185
702
  /* @__PURE__ */ n(
1186
703
  "input",
1187
704
  {
1188
- ref: R,
705
+ ref: E,
1189
706
  className: "ds-input ds-search__input",
1190
707
  type: "search",
1191
- value: g,
1192
- placeholder: c.searchPlaceholder,
1193
- "aria-label": c.searchLabel,
1194
- onChange: (O) => C(O.target.value),
1195
- onKeyDown: (O) => {
1196
- O.key === "Escape" && C("");
708
+ value: p,
709
+ placeholder: u.searchPlaceholder,
710
+ "aria-label": u.searchLabel,
711
+ onChange: (F) => S(F.target.value),
712
+ onKeyDown: (F) => {
713
+ F.key === "Escape" && S("");
1197
714
  }
1198
715
  }
1199
716
  ),
1200
- /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: c.searchShortcut })
717
+ /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: u.searchShortcut })
1201
718
  ] }),
1202
- /* @__PURE__ */ x("div", { className: "ds-tabs", role: "tablist", "aria-label": c.tabs, children: [
719
+ /* @__PURE__ */ b("div", { className: "ds-tabs", role: "tablist", "aria-label": u.tabs, children: [
1203
720
  /* @__PURE__ */ n(
1204
- Ve,
721
+ Ae,
1205
722
  {
1206
- selected: y === "screens",
1207
- label: c.screensTab,
1208
- count: M ? T.length : void 0,
1209
- onSelect: () => k("screens")
723
+ selected: N === "screens",
724
+ label: u.screensTab,
725
+ count: O ? T.length : void 0,
726
+ onSelect: () => g("screens")
1210
727
  }
1211
728
  ),
1212
729
  /* @__PURE__ */ n(
1213
- Ve,
730
+ Ae,
1214
731
  {
1215
- selected: y === "components",
1216
- label: c.componentsTab,
1217
- count: M ? i.length : void 0,
1218
- onSelect: () => k("components")
732
+ selected: N === "components",
733
+ label: u.componentsTab,
734
+ count: O ? L.length : void 0,
735
+ onSelect: () => g("components")
1219
736
  }
1220
737
  )
1221
738
  ] }),
1222
- /* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children: y === "screens" ? b ? T.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: c.noMatch(g) }) : S.map((O) => {
1223
- const U = /* @__PURE__ */ n("ul", { className: "ds-items", children: O.screens.map((V) => /* @__PURE__ */ n(
1224
- Zt,
739
+ /* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children: N === "screens" ? f ? T.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: u.noMatch(p) }) : A.map((F) => {
740
+ const D = /* @__PURE__ */ n("ul", { className: "ds-items", children: F.screens.map((K) => /* @__PURE__ */ n(
741
+ jt,
1225
742
  {
1226
- screen: V,
1227
- active: V.id === a && !r,
1228
- onOpen: o
743
+ screen: K,
744
+ active: K.id === o && !r,
745
+ onOpen: s
1229
746
  },
1230
- V.id
747
+ K.id
1231
748
  )) });
1232
- if (O.name === void 0) return /* @__PURE__ */ n("div", { className: "ds-group-section", children: U }, "");
1233
- const P = `screens:${O.name}`, A = N.has(P) && !M;
1234
- return /* @__PURE__ */ x("section", { className: "ds-group-section", children: [
1235
- /* @__PURE__ */ x(
749
+ if (F.name === void 0) return /* @__PURE__ */ n("div", { className: "ds-group-section", children: D }, "");
750
+ const x = `screens:${F.name}`, R = C.has(x) && !O;
751
+ return /* @__PURE__ */ b("section", { className: "ds-group-section", children: [
752
+ /* @__PURE__ */ b(
1236
753
  "button",
1237
754
  {
1238
755
  type: "button",
1239
756
  className: "ds-group-section__head",
1240
- "aria-expanded": !A,
1241
- "aria-label": c.toggleGroup(O.name),
1242
- onClick: () => F(P),
757
+ "aria-expanded": !R,
758
+ "aria-label": u.toggleGroup(F.name),
759
+ onClick: () => G(x),
1243
760
  children: [
1244
761
  /* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
1245
- /* @__PURE__ */ n("span", { children: O.name }),
1246
- /* @__PURE__ */ n("span", { className: "ds-count", children: O.screens.length })
762
+ /* @__PURE__ */ n("span", { children: F.name }),
763
+ /* @__PURE__ */ n("span", { className: "ds-count", children: F.screens.length })
1247
764
  ]
1248
765
  }
1249
766
  ),
1250
- !A && U
1251
- ] }, P);
1252
- }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: c.emptyScreens }) : m ? i.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: c.noMatch(g) }) : w.map(({ group: O, items: U }) => {
1253
- const P = N.has(O) && !M;
1254
- return /* @__PURE__ */ x("section", { className: "ds-group-section", children: [
1255
- /* @__PURE__ */ x(
767
+ !R && D
768
+ ] }, x);
769
+ }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: u.emptyScreens }) : m ? L.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: u.noMatch(p) }) : P.map(({ group: F, items: D }) => {
770
+ const x = C.has(F) && !O;
771
+ return /* @__PURE__ */ b("section", { className: "ds-group-section", children: [
772
+ /* @__PURE__ */ b(
1256
773
  "button",
1257
774
  {
1258
775
  type: "button",
1259
776
  className: "ds-group-section__head",
1260
- "aria-expanded": !P,
1261
- "aria-label": c.toggleGroup(O),
1262
- onClick: () => F(O),
777
+ "aria-expanded": !x,
778
+ "aria-label": u.toggleGroup(F),
779
+ onClick: () => G(F),
1263
780
  children: [
1264
781
  /* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
1265
- /* @__PURE__ */ n("span", { children: O }),
1266
- /* @__PURE__ */ n("span", { className: "ds-count", children: U.length })
782
+ /* @__PURE__ */ n("span", { children: F }),
783
+ /* @__PURE__ */ n("span", { className: "ds-count", children: D.length })
1267
784
  ]
1268
785
  }
1269
786
  ),
1270
- !P && /* @__PURE__ */ n("ul", { className: "ds-items", children: U.map((A) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
787
+ !x && /* @__PURE__ */ n("ul", { className: "ds-items", children: D.map((R) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1271
788
  "button",
1272
789
  {
1273
790
  type: "button",
1274
791
  className: "ds-item",
1275
- "aria-current": A.id === r ? "true" : void 0,
1276
- onClick: () => s(A.id),
1277
- children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: A.name })
792
+ "aria-current": R.id === r ? "true" : void 0,
793
+ onClick: () => a(R.id),
794
+ children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: R.name })
1278
795
  }
1279
- ) }, A.id)) })
1280
- ] }, O);
1281
- }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: c.emptyComponents }) }),
796
+ ) }, R.id)) })
797
+ ] }, F);
798
+ }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: u.emptyComponents }) }),
1282
799
  /* @__PURE__ */ n(
1283
- nt,
800
+ Ze,
1284
801
  {
1285
802
  side: "left",
1286
- label: c.resize,
1287
- value: d,
1288
- onChange: l,
1289
- onStart: p,
1290
- onEnd: h
803
+ label: u.resize,
804
+ value: i,
805
+ onChange: d,
806
+ onStart: l,
807
+ onEnd: c
1291
808
  }
1292
809
  )
1293
810
  ] });
1294
811
  }
1295
- function Ve({
812
+ function Ae({
1296
813
  selected: e,
1297
814
  label: t,
1298
- count: a,
815
+ count: o,
1299
816
  onSelect: r
1300
817
  }) {
1301
- return /* @__PURE__ */ x(
818
+ return /* @__PURE__ */ b(
1302
819
  "button",
1303
820
  {
1304
821
  type: "button",
@@ -1309,23 +826,23 @@ function Ve({
1309
826
  onClick: r,
1310
827
  children: [
1311
828
  /* @__PURE__ */ n("span", { children: t }),
1312
- a !== void 0 && /* @__PURE__ */ n("span", { className: "ds-count", children: a })
829
+ o !== void 0 && /* @__PURE__ */ n("span", { className: "ds-count", children: o })
1313
830
  ]
1314
831
  }
1315
832
  );
1316
833
  }
1317
- function Zt({
834
+ function jt({
1318
835
  screen: e,
1319
836
  active: t,
1320
- onOpen: a
837
+ onOpen: o
1321
838
  }) {
1322
- return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ x(
839
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ b(
1323
840
  "button",
1324
841
  {
1325
842
  type: "button",
1326
843
  className: "ds-item",
1327
844
  "aria-current": t ? "true" : void 0,
1328
- onClick: () => a(e.id),
845
+ onClick: () => o(e.id),
1329
846
  children: [
1330
847
  /* @__PURE__ */ n("span", { className: "ds-item__title", children: e.name }),
1331
848
  e.variations.length > 1 && /* @__PURE__ */ n("span", { className: "ds-count", children: e.variations.length })
@@ -1333,185 +850,61 @@ function Zt({
1333
850
  }
1334
851
  ) });
1335
852
  }
1336
- function Yt(e, t) {
1337
- const a = /* @__PURE__ */ new Map();
853
+ function Vt(e, t) {
854
+ const o = /* @__PURE__ */ new Map();
1338
855
  for (const r of e) {
1339
- const o = r.group?.trim() || t, s = a.get(o) ?? [];
1340
- s.push(r), a.set(o, s);
856
+ const s = r.group?.trim() || t, a = o.get(s) ?? [];
857
+ a.push(r), o.set(s, a);
1341
858
  }
1342
- return [...a].map(([r, o]) => ({ group: r, items: o }));
859
+ return [...o].map(([r, s]) => ({ group: r, items: s }));
1343
860
  }
1344
- function Qt(e) {
861
+ function Gt(e) {
1345
862
  return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k";
1346
863
  }
1347
- function Xt({
1348
- screen: e,
1349
- variations: t,
1350
- components: a,
1351
- deploy: r,
1352
- labels: o,
1353
- overrides: s
1354
- }) {
1355
- const d = o.pr, l = [`## ${e.name}`, ""];
1356
- e.description && l.push(e.description, ""), l.push(`\`${e.route.path}\``, "");
1357
- const p = r.deploymentUrl ? `https://${r.deploymentUrl}` : void 0, h = r.shortCommit ? d.commit(r.shortCommit) : void 0;
1358
- if (l.push(`### ${d.variations}`, ""), t.length === 0) {
1359
- const u = new URL(e.href, r.origin);
1360
- Ne(u.searchParams, s), l.push(`- [${o.panel.defaultVariation}](${u.toString()})`);
1361
- }
1362
- for (const u of t) {
1363
- const c = me(u, { origin: r.origin, overrides: s });
1364
- let g = `- [${ot(u.title)}](${c})`;
1365
- if (p) {
1366
- const C = me(u, { origin: p, overrides: s });
1367
- g += ` · [${h ?? d.immutableLink}](${C})`;
1368
- } else h && (g += ` · ${h}`);
1369
- l.push(g);
1370
- }
1371
- if (l.push(""), a.length > 0) {
1372
- l.push(`### ${d.components}`, ""), l.push(`| ${d.component} | ${d.source} |`, "| --- | --- |");
1373
- for (const u of a) {
1374
- const c = u.source ? `\`${we(u.source)}\`` : d.empty;
1375
- l.push(`| ${we(u.name)} (\`${u.id}\`) | ${c} |`);
1376
- }
1377
- l.push("");
1378
- }
1379
- l.push(`### ${d.expected}`, ""), t.length === 0 && l.push(`**${o.panel.defaultVariation}**`, "", d.noExpected, "");
1380
- for (const u of t) {
1381
- if (l.push(`**${u.title}**`, ""), u.expected?.length)
1382
- for (const c of u.expected) l.push(`- ${c}`);
1383
- else
1384
- l.push(d.noExpected);
1385
- l.push("");
1386
- }
1387
- return `${l.join(`
1388
- `).trimEnd()}
1389
- `;
1390
- }
1391
- function we(e) {
1392
- return e.replace(/\|/g, "\\|").replace(/\n/g, " ");
1393
- }
1394
- function ot(e) {
1395
- return e.replace(/([[\]])/g, "\\$1");
1396
- }
1397
- function Jt({
1398
- flow: e,
1399
- registry: t,
1400
- open: a,
1401
- deploy: r,
1402
- labels: o,
1403
- overrides: s
1404
- }) {
1405
- const d = o.pr, l = [`## ${e.name}`, ""], p = r.deploymentUrl ? `https://${r.deploymentUrl}` : void 0, h = r.shortCommit ? d.commit(r.shortCommit) : void 0, u = (c, g) => {
1406
- if (a && a.screen.id === c.id) {
1407
- const E = new URL(a.location.path || "/", g), R = new URLSearchParams(a.location.search);
1408
- for (const v of Ct) R.delete(v);
1409
- for (const [v, L] of R) E.searchParams.append(v, L);
1410
- return Ne(E.searchParams, s), E.toString();
1411
- }
1412
- const C = c.variations[0];
1413
- if (C) return me(C, { origin: g, overrides: s });
1414
- const N = new URL(c.href, g);
1415
- return Ne(N.searchParams, s), N.toString();
1416
- };
1417
- for (const c of e.screens) {
1418
- l.push(`### ${c.name}`, ""), c.description && l.push(c.description, "");
1419
- let g = `\`${c.route.path}\` · [${d.open}](${u(c, r.origin)})`;
1420
- if (p ? g += ` · [${h ?? d.immutableLink}](${u(c, p)})` : h && (g += ` · ${h}`), l.push(g, ""), c.controls.length > 0) {
1421
- l.push(`**${d.controls}**`, "");
1422
- for (const v of c.controls) {
1423
- l.push(`- ${le(v.title)} (\`${v.id}\`)`);
1424
- for (const L of v.controls) {
1425
- const b = ke(L), m = L.options.map(
1426
- (f) => f.value === b ? `${le(f.label)} (\`${f.value}\`, ${d.defaultOption})` : `${le(f.label)} (\`${f.value}\`)`
1427
- ).join(" · ");
1428
- l.push(` - ${le(L.label)} (\`c.${L.id}\`): ${m}`);
1429
- }
1430
- }
1431
- l.push("");
1432
- }
1433
- if (c.variations.length > 0) {
1434
- l.push(`**${d.shortcuts}**`, "");
1435
- for (const v of c.variations)
1436
- l.push(
1437
- `- [${ot(v.title)}](${me(v, { origin: r.origin, overrides: s })})`
1438
- );
1439
- l.push("");
1440
- }
1441
- l.push(`**${d.expected}**`, "");
1442
- const C = a?.screen.id === c.id ? a.variation : void 0, N = C?.expected?.length ? C.expected : c.route.expected, E = c.variations.filter(
1443
- (v) => v.expected?.length && v.id !== C?.id
1444
- );
1445
- if (!N?.length && E.length === 0 && l.push(d.noExpected, ""), N?.length) {
1446
- for (const v of N) l.push(`- ${v}`);
1447
- l.push("");
1448
- }
1449
- for (const v of E) {
1450
- l.push(`*${v.title}*`, "");
1451
- for (const L of v.expected ?? []) l.push(`- ${L}`);
1452
- l.push("");
1453
- }
1454
- const R = t.componentsOfScreen(c);
1455
- if (R.length > 0) {
1456
- l.push(`**${d.components}**`, ""), l.push(`| ${d.component} | ${d.source} |`, "| --- | --- |");
1457
- for (const v of R) {
1458
- const L = v.source ? `\`${we(v.source)}\`` : d.empty;
1459
- l.push(`| ${we(v.name)} (\`${v.id}\`) | ${L} |`);
1460
- }
1461
- l.push("");
1462
- }
1463
- }
1464
- return `${l.join(`
1465
- `).trimEnd()}
1466
- `;
1467
- }
1468
- function le(e) {
1469
- return e.replace(/([*_[\]`])/g, "\\$1");
1470
- }
1471
- function en(e) {
1472
- const { tab: t, onTab: a, width: r, onResize: o, onResizeStart: s, onResizeEnd: d } = e, l = J().panel, [p, h] = z(""), u = q(null), c = q(null), [g, C] = z(!1), [N, E] = z(() => /* @__PURE__ */ new Set()), R = (L) => E((b) => {
1473
- const m = new Set(b);
1474
- return m.has(L) ? m.delete(L) : m.add(L), m;
1475
- }), v = p.trim().length > 0;
1476
- return K(() => {
1477
- const L = (b) => {
1478
- on(b) && (b.preventDefault(), u.current?.focus(), u.current?.select());
864
+ function Zt(e) {
865
+ const { tab: t, onTab: o, width: r, onResize: s, onResizeStart: a, onResizeEnd: i } = e, d = X().panel, [l, c] = z(""), h = j(null), u = j(null), [p, S] = z(!1), [C, k] = z(() => /* @__PURE__ */ new Set()), E = (_) => k((f) => {
866
+ const m = new Set(f);
867
+ return m.has(_) ? m.delete(_) : m.add(_), m;
868
+ }), v = l.trim().length > 0;
869
+ return I(() => {
870
+ const _ = (f) => {
871
+ Xt(f) && (f.preventDefault(), h.current?.focus(), h.current?.select());
1479
872
  };
1480
- return window.addEventListener("keydown", L), () => window.removeEventListener("keydown", L);
1481
- }, []), Be(() => {
1482
- C(rn(c.current, p));
1483
- }), /* @__PURE__ */ x("aside", { className: "ds-panel", "aria-label": l.region, style: { width: r }, children: [
873
+ return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
874
+ }, []), Ie(() => {
875
+ S(Jt(u.current, l));
876
+ }), /* @__PURE__ */ b("aside", { className: "ds-panel", "aria-label": d.region, style: { width: r }, children: [
1484
877
  /* @__PURE__ */ n(
1485
- nt,
878
+ Ze,
1486
879
  {
1487
880
  side: "right",
1488
- label: l.resize,
881
+ label: d.resize,
1489
882
  value: r,
1490
- onChange: o,
1491
- onStart: s,
1492
- onEnd: d
883
+ onChange: s,
884
+ onStart: a,
885
+ onEnd: i
1493
886
  }
1494
887
  ),
1495
- /* @__PURE__ */ x("div", { className: "ds-search", children: [
888
+ /* @__PURE__ */ b("div", { className: "ds-search", children: [
1496
889
  /* @__PURE__ */ n(H, { name: "search", size: 14 }),
1497
890
  /* @__PURE__ */ n(
1498
891
  "input",
1499
892
  {
1500
- ref: u,
893
+ ref: h,
1501
894
  className: "ds-input ds-search__input",
1502
895
  type: "search",
1503
- value: p,
1504
- placeholder: l.searchPlaceholder,
1505
- "aria-label": l.searchLabel,
1506
- onChange: (L) => h(L.target.value),
1507
- onKeyDown: (L) => {
1508
- L.key === "Escape" && h("");
896
+ value: l,
897
+ placeholder: d.searchPlaceholder,
898
+ "aria-label": d.searchLabel,
899
+ onChange: (_) => c(_.target.value),
900
+ onKeyDown: (_) => {
901
+ _.key === "Escape" && c("");
1509
902
  }
1510
903
  }
1511
904
  ),
1512
- /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: l.searchShortcut })
905
+ /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: d.searchShortcut })
1513
906
  ] }),
1514
- /* @__PURE__ */ x("div", { className: "ds-tabs", role: "tablist", "aria-label": l.tabs, children: [
907
+ /* @__PURE__ */ b("div", { className: "ds-tabs", role: "tablist", "aria-label": d.tabs, children: [
1515
908
  /* @__PURE__ */ n(
1516
909
  "button",
1517
910
  {
@@ -1520,8 +913,8 @@ function en(e) {
1520
913
  className: "ds-tab",
1521
914
  "aria-selected": t === "variations",
1522
915
  tabIndex: t === "variations" ? 0 : -1,
1523
- onClick: () => a("variations"),
1524
- children: l.variationsTab
916
+ onClick: () => o("variations"),
917
+ children: d.variationsTab
1525
918
  }
1526
919
  ),
1527
920
  /* @__PURE__ */ n(
@@ -1532,156 +925,156 @@ function en(e) {
1532
925
  className: "ds-tab",
1533
926
  "aria-selected": t === "info",
1534
927
  tabIndex: t === "info" ? 0 : -1,
1535
- onClick: () => a("info"),
1536
- children: l.infoTab
928
+ onClick: () => o("info"),
929
+ children: d.infoTab
1537
930
  }
1538
931
  )
1539
932
  ] }),
1540
- /* @__PURE__ */ x("div", { className: "ds-panel__body", role: "tabpanel", ref: c, children: [
1541
- t === "variations" ? /* @__PURE__ */ n(tn, { ...e, collapsed: N, onToggle: R, filtering: v }) : /* @__PURE__ */ n(nn, { ...e }),
1542
- g && /* @__PURE__ */ n("p", { className: "ds-empty", children: l.noMatch(p) })
933
+ /* @__PURE__ */ b("div", { className: "ds-panel__body", role: "tabpanel", ref: u, children: [
934
+ t === "variations" ? /* @__PURE__ */ n(Yt, { ...e, collapsed: C, onToggle: E, filtering: v }) : /* @__PURE__ */ n(Qt, { ...e }),
935
+ p && /* @__PURE__ */ n("p", { className: "ds-empty", children: d.noMatch(l) })
1543
936
  ] })
1544
937
  ] });
1545
938
  }
1546
- function tn({
939
+ function Yt({
1547
940
  registry: e,
1548
941
  controls: t,
1549
- screen: a,
942
+ screen: o,
1550
943
  variation: r,
1551
- component: o,
1552
- componentFixture: s,
1553
- onOpenScenario: d,
1554
- onOpenComponent: l,
1555
- onChange: p
944
+ component: s,
945
+ componentFixture: a,
946
+ onOpenScenario: i,
947
+ onOpenComponent: d,
948
+ onChange: l
1556
949
  }) {
1557
- const h = J(), u = h.panel;
1558
- if (o) {
1559
- const b = o.fixtures ?? [];
1560
- if (b.length === 0) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.noComponentVariations });
1561
- const m = s.fixture;
1562
- return /* @__PURE__ */ x("div", { className: "ds-vcards", children: [
1563
- s.didFallback && s.requestedId && m && /* @__PURE__ */ n("p", { className: "ds-notice", children: u.fixtureFallback(s.requestedId, m.id) }),
1564
- /* @__PURE__ */ n(de, { title: o.name, hint: m?.description, children: /* @__PURE__ */ n(
1565
- ee,
950
+ const c = X(), h = c.panel;
951
+ if (s) {
952
+ const f = s.fixtures ?? [];
953
+ if (f.length === 0) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.noComponentVariations });
954
+ const m = a.fixture;
955
+ return /* @__PURE__ */ b("div", { className: "ds-vcards", children: [
956
+ a.didFallback && a.requestedId && m && /* @__PURE__ */ n("p", { className: "ds-notice", children: h.fixtureFallback(a.requestedId, m.id) }),
957
+ /* @__PURE__ */ n(ae, { title: s.name, hint: m?.description, children: /* @__PURE__ */ n(
958
+ J,
1566
959
  {
1567
- label: u.componentVariations,
960
+ label: h.componentVariations,
1568
961
  value: m?.id ?? "",
1569
- options: b.map((f) => ({ value: f.id, label: f.label })),
1570
- onChange: (f) => p({ fixture: f })
962
+ options: f.map((w) => ({ value: w.id, label: w.label })),
963
+ onChange: (w) => l({ fixture: w })
1571
964
  }
1572
965
  ) })
1573
966
  ] });
1574
967
  }
1575
- if (!a) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.nothingSelected });
1576
- const c = a.variations, g = e.product, C = g.theme?.modes ?? [], N = g.theme?.locales ?? [], E = g.dataSources?.adapters ?? [], R = t.screenControls ?? {}, v = r && Pt(r, R) ? r : void 0, L = (b, m) => p({ screenControls: { ...R, [b]: m } });
1577
- return /* @__PURE__ */ x("div", { className: "ds-vcards", children: [
1578
- /* @__PURE__ */ x(de, { title: u.context, children: [
968
+ if (!o) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.nothingSelected });
969
+ const u = o.variations, p = e.product, S = p.theme?.modes ?? [], C = p.theme?.locales ?? [], k = p.dataSources?.adapters ?? [], E = t.screenControls ?? {}, v = r && ut(r, E) ? r : void 0, _ = (f, m) => l({ screenControls: { ...E, [f]: m } });
970
+ return /* @__PURE__ */ b("div", { className: "ds-vcards", children: [
971
+ /* @__PURE__ */ b(ae, { title: h.context, children: [
1579
972
  /* @__PURE__ */ n(
1580
- ee,
973
+ J,
1581
974
  {
1582
- label: u.persona,
975
+ label: h.persona,
1583
976
  value: t.persona ?? "",
1584
977
  options: [
1585
978
  // Com persona padrão, "nenhuma" não é uma situação possível.
1586
- ...e.defaultPersona ? [] : [{ value: "", label: u.none }],
1587
- ...g.personas.map((b) => ({ value: b.id, label: b.name }))
979
+ ...e.defaultPersona ? [] : [{ value: "", label: h.none }],
980
+ ...p.personas.map((f) => ({ value: f.id, label: f.name }))
1588
981
  ],
1589
- onChange: (b) => p({ persona: b || void 0 })
982
+ onChange: (f) => l({ persona: f || void 0 })
1590
983
  }
1591
984
  ),
1592
985
  /* @__PURE__ */ n(
1593
- ee,
986
+ J,
1594
987
  {
1595
- label: u.network,
988
+ label: h.network,
1596
989
  value: t.network,
1597
- options: Ge.map((b) => ({ value: b, label: h.network[b] })),
1598
- onChange: (b) => p({ network: b })
990
+ options: He.map((f) => ({ value: f, label: c.network[f] })),
991
+ onChange: (f) => l({ network: f })
1599
992
  }
1600
993
  ),
1601
- C.length > 1 && /* @__PURE__ */ n(
1602
- ee,
994
+ S.length > 1 && /* @__PURE__ */ n(
995
+ J,
1603
996
  {
1604
- label: u.theme,
1605
- value: t.themeMode ?? C[0],
1606
- options: C.map((b) => ({ value: b, label: b })),
1607
- onChange: (b) => p({ themeMode: b })
997
+ label: h.theme,
998
+ value: t.themeMode ?? S[0],
999
+ options: S.map((f) => ({ value: f, label: f })),
1000
+ onChange: (f) => l({ themeMode: f })
1608
1001
  }
1609
1002
  ),
1610
- N.length > 1 && /* @__PURE__ */ n(
1611
- ee,
1003
+ C.length > 1 && /* @__PURE__ */ n(
1004
+ J,
1612
1005
  {
1613
- label: u.locale,
1614
- value: t.locale ?? N[0],
1615
- options: N.map((b) => ({ value: b, label: b })),
1616
- onChange: (b) => p({ locale: b })
1006
+ label: h.locale,
1007
+ value: t.locale ?? C[0],
1008
+ options: C.map((f) => ({ value: f, label: f })),
1009
+ onChange: (f) => l({ locale: f })
1617
1010
  }
1618
1011
  ),
1619
- E.length > 0 && /* @__PURE__ */ n(
1620
- ee,
1012
+ k.length > 0 && /* @__PURE__ */ n(
1013
+ J,
1621
1014
  {
1622
- label: u.dataSource,
1015
+ label: h.dataSource,
1623
1016
  value: t.dataSource ?? "fixtures",
1624
1017
  options: [
1625
- { value: "fixtures", label: u.fixturesOption },
1626
- ...E.map((b) => ({ value: b.id, label: b.label }))
1018
+ { value: "fixtures", label: h.fixturesOption },
1019
+ ...k.map((f) => ({ value: f.id, label: f.label }))
1627
1020
  ],
1628
- onChange: (b) => p({ dataSource: b })
1021
+ onChange: (f) => l({ dataSource: f })
1629
1022
  }
1630
1023
  )
1631
1024
  ] }),
1632
- a.controls.map((b) => {
1633
- const m = e.component(b.component);
1025
+ o.controls.map((f) => {
1026
+ const m = e.component(f.component);
1634
1027
  return /* @__PURE__ */ n(
1635
- de,
1028
+ ae,
1636
1029
  {
1637
- title: b.title,
1638
- hint: b.note,
1639
- link: m ? { label: u.openComponent(m.name), onOpen: () => l(m.id) } : void 0,
1640
- children: b.controls.map((f) => /* @__PURE__ */ n(
1641
- ee,
1030
+ title: f.title,
1031
+ hint: f.note,
1032
+ link: m ? { label: h.openComponent(m.name), onOpen: () => d(m.id) } : void 0,
1033
+ children: f.controls.map((w) => /* @__PURE__ */ n(
1034
+ J,
1642
1035
  {
1643
- label: f.label,
1644
- hint: f.description,
1645
- value: R[f.id] ?? ke(f),
1646
- options: f.options ?? [],
1647
- onChange: (k) => L(f.id, k)
1036
+ label: w.label,
1037
+ hint: w.description,
1038
+ value: E[w.id] ?? We(w),
1039
+ options: w.options ?? [],
1040
+ onChange: (g) => _(w.id, g)
1648
1041
  },
1649
- f.id
1042
+ w.id
1650
1043
  ))
1651
1044
  },
1652
- b.id
1045
+ f.id
1653
1046
  );
1654
1047
  }),
1655
- c.length > 0 && /* @__PURE__ */ n(de, { title: u.shortcuts, children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": u.variationsList, children: c.map((b) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
1048
+ u.length > 0 && /* @__PURE__ */ n(ae, { title: h.shortcuts, children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": h.variationsList, children: u.map((f) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
1656
1049
  "button",
1657
1050
  {
1658
1051
  type: "button",
1659
1052
  className: "ds-item",
1660
- title: b.intent,
1661
- "aria-current": v?.id === b.id ? "true" : void 0,
1662
- onClick: () => d(b.id),
1663
- children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: b.title })
1053
+ title: f.intent,
1054
+ "aria-current": v?.id === f.id ? "true" : void 0,
1055
+ onClick: () => i(f.id),
1056
+ children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: f.title })
1664
1057
  }
1665
- ) }, b.id)) }) })
1058
+ ) }, f.id)) }) })
1666
1059
  ] });
1667
1060
  }
1668
- function de({
1061
+ function ae({
1669
1062
  title: e,
1670
1063
  hint: t,
1671
- link: a,
1064
+ link: o,
1672
1065
  children: r
1673
1066
  }) {
1674
- return /* @__PURE__ */ x("section", { className: "ds-vcard", "data-ds-filter-group": !0, children: [
1675
- /* @__PURE__ */ x("header", { className: "ds-vcard__head", title: t ? `${e} — ${t}` : e, children: [
1067
+ return /* @__PURE__ */ b("section", { className: "ds-vcard", "data-ds-filter-group": !0, children: [
1068
+ /* @__PURE__ */ b("header", { className: "ds-vcard__head", title: t ? `${e} — ${t}` : e, children: [
1676
1069
  /* @__PURE__ */ n("h3", { className: "ds-vcard__title ds-section__title", "data-ds-filter-title": !0, children: e }),
1677
- a && /* @__PURE__ */ n(
1070
+ o && /* @__PURE__ */ n(
1678
1071
  "button",
1679
1072
  {
1680
1073
  type: "button",
1681
1074
  className: "ds-btn ds-btn--icon ds-vcard__link",
1682
- "aria-label": a.label,
1683
- title: a.label,
1684
- onClick: a.onOpen,
1075
+ "aria-label": o.label,
1076
+ title: o.label,
1077
+ onClick: o.onOpen,
1685
1078
  children: /* @__PURE__ */ n(H, { name: "arrow-up-right", size: 14 })
1686
1079
  }
1687
1080
  )
@@ -1689,560 +1082,640 @@ function de({
1689
1082
  /* @__PURE__ */ n("div", { className: "ds-vcard__body", children: r })
1690
1083
  ] });
1691
1084
  }
1692
- function ee({
1085
+ function J({
1693
1086
  label: e,
1694
1087
  hint: t,
1695
- value: a,
1088
+ value: o,
1696
1089
  options: r,
1697
- onChange: o
1090
+ onChange: s
1698
1091
  }) {
1699
- return /* @__PURE__ */ x("label", { className: "ds-vcard__field", "data-ds-filter": !0, title: t ? `${e} — ${t}` : e, children: [
1092
+ return /* @__PURE__ */ b("label", { className: "ds-vcard__field", "data-ds-filter": !0, title: t ? `${e} — ${t}` : e, children: [
1700
1093
  /* @__PURE__ */ n("span", { className: "ds-visually-hidden", children: e }),
1701
- /* @__PURE__ */ n("select", { className: "ds-select", value: a, onChange: (s) => o(s.target.value), children: r.map((s) => /* @__PURE__ */ n("option", { value: s.value, children: s.label }, s.value)) })
1094
+ /* @__PURE__ */ n("select", { className: "ds-select", value: o, onChange: (a) => s(a.target.value), children: r.map((a) => /* @__PURE__ */ n("option", { value: a.value, children: a.label }, a.value)) })
1702
1095
  ] });
1703
1096
  }
1704
- function nn({
1097
+ function Qt({
1705
1098
  registry: e,
1706
1099
  controls: t,
1707
- deploy: a,
1708
- location: r,
1709
1100
  screen: o,
1710
- variation: s,
1711
- component: d,
1712
- onOpenScenario: l,
1713
- onOpenComponent: p,
1714
- onOpenScreen: h
1101
+ variation: r,
1102
+ component: s,
1103
+ onOpenScenario: a,
1104
+ onOpenComponent: i,
1105
+ onOpenScreen: d
1715
1106
  }) {
1716
- const u = J(), c = u.info, [g, C] = z(!1);
1717
- if (d) {
1718
- const f = e.usagesOf(d.id, { handoff: t.handoff });
1719
- return /* @__PURE__ */ x("div", { className: "ds-info", children: [
1720
- /* @__PURE__ */ x(ne, { title: c.component, children: [
1721
- /* @__PURE__ */ n(W, { term: c.name, children: d.name }),
1722
- /* @__PURE__ */ n(W, { term: c.id, children: /* @__PURE__ */ n("code", { children: d.id }) }),
1723
- d.group && /* @__PURE__ */ n(W, { term: c.group, children: d.group }),
1724
- d.description && /* @__PURE__ */ n(W, { term: c.description, children: d.description }),
1725
- d.source && /* @__PURE__ */ n(W, { term: c.source, children: /* @__PURE__ */ n("code", { children: d.source }) })
1107
+ const l = X(), c = l.info;
1108
+ if (s) {
1109
+ const k = e.usagesOf(s.id, { handoff: t.handoff });
1110
+ return /* @__PURE__ */ b("div", { className: "ds-info", children: [
1111
+ /* @__PURE__ */ b(te, { title: c.component, children: [
1112
+ /* @__PURE__ */ n(U, { term: c.name, children: s.name }),
1113
+ /* @__PURE__ */ n(U, { term: c.id, children: /* @__PURE__ */ n("code", { children: s.id }) }),
1114
+ s.group && /* @__PURE__ */ n(U, { term: c.group, children: s.group }),
1115
+ s.description && /* @__PURE__ */ n(U, { term: c.description, children: s.description }),
1116
+ s.source && /* @__PURE__ */ n(U, { term: c.source, children: /* @__PURE__ */ n("code", { children: s.source }) })
1726
1117
  ] }),
1727
- /* @__PURE__ */ n(ne, { title: c.usedIn, children: f.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-muted", children: c.notUsed }) : /* @__PURE__ */ n("ul", { className: "ds-links", children: f.map((k) => {
1728
- const y = k.variations.find((T) => T.components?.includes(d.id)) ?? k.variations[0];
1729
- return /* @__PURE__ */ x("li", { "data-ds-filter": !0, children: [
1118
+ /* @__PURE__ */ n(te, { title: c.usedIn, children: k.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-muted", children: c.notUsed }) : /* @__PURE__ */ n("ul", { className: "ds-links", children: k.map((E) => {
1119
+ const v = E.variations.find((_) => _.components?.includes(s.id)) ?? E.variations[0];
1120
+ return /* @__PURE__ */ b("li", { "data-ds-filter": !0, children: [
1730
1121
  /* @__PURE__ */ n(
1731
1122
  "button",
1732
1123
  {
1733
1124
  type: "button",
1734
1125
  className: "ds-link",
1735
- onClick: () => y ? l(y.id) : h?.(k.id),
1736
- children: k.name
1126
+ onClick: () => v ? a(v.id) : d?.(E.id),
1127
+ children: E.name
1737
1128
  }
1738
1129
  ),
1739
- /* @__PURE__ */ n("code", { className: "ds-muted", children: k.id })
1740
- ] }, k.id);
1130
+ /* @__PURE__ */ n("code", { className: "ds-muted", children: E.id })
1131
+ ] }, E.id);
1741
1132
  }) }) })
1742
1133
  ] });
1743
1134
  }
1744
- if (!o) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.panel.nothingSelected });
1745
- const N = s ? e.componentsOfScreen(o, s) : e.componentsOfScreen(o), E = e.persona(t.persona ?? s?.persona), R = e.rulesOf(s), v = t.screenControls ?? {}, L = s?.expected?.length ? s.expected : o.route.expected, b = t.handoff ? { handoff: t.handoff } : void 0, m = async () => {
1746
- const f = o.group ? e.flowOf(o, { handoff: t.handoff }) : void 0, k = f?.name ? Jt({
1747
- flow: { name: f.name, screens: f.screens },
1748
- registry: e,
1749
- open: { screen: o, location: r, variation: s },
1750
- deploy: a,
1751
- labels: u,
1752
- overrides: b
1753
- }) : Xt({
1754
- screen: o,
1755
- variations: o.variations,
1756
- components: e.componentsOfScreen(o),
1757
- deploy: a,
1758
- labels: u,
1759
- overrides: b
1760
- });
1761
- try {
1762
- await navigator.clipboard.writeText(k);
1763
- } catch {
1764
- window.prompt(c.copyPrompt, k);
1765
- }
1766
- C(!0), window.setTimeout(() => C(!1), 1600);
1767
- };
1768
- return /* @__PURE__ */ x("div", { className: "ds-info", children: [
1769
- /* @__PURE__ */ x(ne, { title: c.screen, children: [
1770
- /* @__PURE__ */ n(W, { term: c.name, children: o.name }),
1771
- /* @__PURE__ */ n(W, { term: c.route, children: /* @__PURE__ */ n("code", { children: o.route.path }) }),
1772
- o.group && /* @__PURE__ */ n(W, { term: c.flow, children: o.group }),
1773
- o.description && /* @__PURE__ */ n(W, { term: c.description, children: o.description }),
1774
- /* @__PURE__ */ n(ue, { term: c.expected, items: L })
1135
+ if (!o) return /* @__PURE__ */ n("p", { className: "ds-empty", children: l.panel.nothingSelected });
1136
+ const h = r ? e.componentsOfScreen(o, r) : e.componentsOfScreen(o), u = e.persona(t.persona ?? r?.persona), p = e.rulesOf(r), S = t.screenControls ?? {}, C = r?.expected?.length ? r.expected : o.route.expected;
1137
+ return /* @__PURE__ */ b("div", { className: "ds-info", children: [
1138
+ /* @__PURE__ */ b(te, { title: c.screen, children: [
1139
+ /* @__PURE__ */ n(U, { term: c.name, children: o.name }),
1140
+ /* @__PURE__ */ n(U, { term: c.route, children: /* @__PURE__ */ n("code", { children: o.route.path }) }),
1141
+ o.group && /* @__PURE__ */ n(U, { term: c.flow, children: o.group }),
1142
+ o.description && /* @__PURE__ */ n(U, { term: c.description, children: o.description }),
1143
+ /* @__PURE__ */ n(ie, { term: c.expected, items: C })
1775
1144
  ] }),
1776
- o.controls.length > 0 && /* @__PURE__ */ n(ne, { title: c.controls, children: o.controls.flatMap(
1777
- (f) => f.controls.map((k) => {
1778
- const y = v[k.id] ?? ke(k), T = k.options.find((i) => i.value === y);
1779
- return /* @__PURE__ */ x(W, { term: k.label, children: [
1780
- T?.label ?? y,
1145
+ o.controls.length > 0 && /* @__PURE__ */ n(te, { title: c.controls, children: o.controls.flatMap(
1146
+ (k) => k.controls.map((E) => {
1147
+ const v = S[E.id] ?? We(E), _ = E.options.find((f) => f.value === v);
1148
+ return /* @__PURE__ */ b(U, { term: E.label, children: [
1149
+ _?.label ?? v,
1781
1150
  " ",
1782
- /* @__PURE__ */ n("code", { children: `c.${k.id}=${y}` })
1783
- ] }, `${f.id}/${k.id}`);
1151
+ /* @__PURE__ */ n("code", { children: `c.${E.id}=${v}` })
1152
+ ] }, `${k.id}/${E.id}`);
1784
1153
  })
1785
1154
  ) }),
1786
- s && /* @__PURE__ */ x(ne, { title: c.variation, children: [
1787
- /* @__PURE__ */ n(W, { term: c.name, children: s.title }),
1788
- /* @__PURE__ */ n(W, { term: c.id, children: /* @__PURE__ */ n("code", { children: s.id }) }),
1789
- E && /* @__PURE__ */ n(W, { term: c.persona, children: E.name }),
1790
- s.intent && /* @__PURE__ */ n(W, { term: c.intent, children: s.intent }),
1791
- /* @__PURE__ */ n(ue, { term: c.preconditions, items: s.preconditions }),
1792
- /* @__PURE__ */ n(ue, { term: c.actions, items: s.actions }),
1793
- /* @__PURE__ */ n(ue, { term: c.rules, items: R.map((f) => f.statement) }),
1794
- s.ticket && /* @__PURE__ */ n(W, { term: c.ticket, children: /* @__PURE__ */ n("code", { children: s.ticket }) })
1155
+ r && /* @__PURE__ */ b(te, { title: c.variation, children: [
1156
+ /* @__PURE__ */ n(U, { term: c.name, children: r.title }),
1157
+ /* @__PURE__ */ n(U, { term: c.id, children: /* @__PURE__ */ n("code", { children: r.id }) }),
1158
+ u && /* @__PURE__ */ n(U, { term: c.persona, children: u.name }),
1159
+ r.intent && /* @__PURE__ */ n(U, { term: c.intent, children: r.intent }),
1160
+ /* @__PURE__ */ n(ie, { term: c.preconditions, items: r.preconditions }),
1161
+ /* @__PURE__ */ n(ie, { term: c.actions, items: r.actions }),
1162
+ /* @__PURE__ */ n(ie, { term: c.rules, items: p.map((k) => k.statement) }),
1163
+ r.ticket && /* @__PURE__ */ n(U, { term: c.ticket, children: /* @__PURE__ */ n("code", { children: r.ticket }) })
1795
1164
  ] }),
1796
- N.length > 0 && /* @__PURE__ */ n(ne, { title: c.components, children: /* @__PURE__ */ n("ul", { className: "ds-links", children: N.map((f) => /* @__PURE__ */ x("li", { "data-ds-filter": !0, children: [
1797
- /* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () => p(f.id), children: f.name }),
1798
- f.source && /* @__PURE__ */ n("code", { className: "ds-muted", children: f.source })
1799
- ] }, f.id)) }) }),
1800
- /* @__PURE__ */ x("button", { type: "button", className: "ds-btn ds-btn--block", onClick: m, children: [
1801
- /* @__PURE__ */ n(H, { name: g ? "check" : "copy", size: 14 }),
1802
- /* @__PURE__ */ n("span", { children: g ? c.copiedForPr : c.copyForPr })
1803
- ] })
1165
+ h.length > 0 && /* @__PURE__ */ n(te, { title: c.components, children: /* @__PURE__ */ n("ul", { className: "ds-links", children: h.map((k) => /* @__PURE__ */ b("li", { "data-ds-filter": !0, children: [
1166
+ /* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () => i(k.id), children: k.name }),
1167
+ k.source && /* @__PURE__ */ n("code", { className: "ds-muted", children: k.source })
1168
+ ] }, k.id)) }) })
1804
1169
  ] });
1805
1170
  }
1806
- function ne({ title: e, children: t }) {
1807
- return /* @__PURE__ */ x("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
1171
+ function te({ title: e, children: t }) {
1172
+ return /* @__PURE__ */ b("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
1808
1173
  /* @__PURE__ */ n("h2", { className: "ds-section__title", children: e }),
1809
1174
  /* @__PURE__ */ n("div", { className: "ds-defs", children: t })
1810
1175
  ] });
1811
1176
  }
1812
- function W({ term: e, children: t }) {
1813
- return /* @__PURE__ */ x("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1177
+ function U({ term: e, children: t }) {
1178
+ return /* @__PURE__ */ b("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1814
1179
  /* @__PURE__ */ n("dt", { children: e }),
1815
1180
  /* @__PURE__ */ n("dd", { children: t })
1816
1181
  ] });
1817
1182
  }
1818
- function ue({ term: e, items: t }) {
1819
- return t?.length ? /* @__PURE__ */ x("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1183
+ function ie({ term: e, items: t }) {
1184
+ return t?.length ? /* @__PURE__ */ b("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1820
1185
  /* @__PURE__ */ n("dt", { children: e }),
1821
- /* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("ul", { className: "ds-list", children: t.map((a) => /* @__PURE__ */ n("li", { children: a }, a)) }) })
1186
+ /* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("ul", { className: "ds-list", children: t.map((o) => /* @__PURE__ */ n("li", { children: o }, o)) }) })
1822
1187
  ] }) : null;
1823
1188
  }
1824
- function on(e) {
1189
+ function Xt(e) {
1825
1190
  return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f";
1826
1191
  }
1827
- function rn(e, t) {
1192
+ function Jt(e, t) {
1828
1193
  if (!e) return !1;
1829
- const a = X(t), r = [...e.querySelectorAll("[data-ds-filter]")];
1830
- for (const o of r)
1831
- o.hidden = a.length > 0 && !X(o.textContent ?? "").includes(a);
1832
- for (const o of e.querySelectorAll("[data-ds-filter-group]")) {
1833
- const s = [...o.querySelectorAll("[data-ds-filter]")], d = X(
1834
- o.querySelector("[data-ds-filter-title], .ds-section__title")?.textContent ?? ""
1194
+ const o = fe(t), r = [...e.querySelectorAll("[data-ds-filter]")];
1195
+ for (const s of r)
1196
+ s.hidden = o.length > 0 && !fe(s.textContent ?? "").includes(o);
1197
+ for (const s of e.querySelectorAll("[data-ds-filter-group]")) {
1198
+ const a = [...s.querySelectorAll("[data-ds-filter]")], i = fe(
1199
+ s.querySelector("[data-ds-filter-title], .ds-section__title")?.textContent ?? ""
1835
1200
  );
1836
- if (a.length > 0 && d.includes(a)) {
1837
- o.hidden = !1;
1838
- for (const l of s) l.hidden = !1;
1201
+ if (o.length > 0 && i.includes(o)) {
1202
+ s.hidden = !1;
1203
+ for (const d of a) d.hidden = !1;
1839
1204
  continue;
1840
1205
  }
1841
- o.hidden = a.length > 0 && s.every((l) => l.hidden);
1206
+ s.hidden = o.length > 0 && a.every((d) => d.hidden);
1842
1207
  }
1843
- return a.length > 0 && r.length > 0 && r.every((o) => o.hidden);
1208
+ return o.length > 0 && r.length > 0 && r.every((s) => s.hidden);
1844
1209
  }
1845
- const an = 24;
1846
- function sn({
1210
+ const en = 24;
1211
+ function tn({
1847
1212
  location: e,
1848
1213
  viewport: t,
1849
- zoom: a,
1214
+ zoom: o,
1850
1215
  title: r,
1851
- resizing: o,
1852
- onFrameNavigate: s,
1853
- onShortcut: d,
1854
- onEffectiveZoom: l,
1855
- frameRef: p
1216
+ resizing: s,
1217
+ onFrameNavigate: a,
1218
+ onShortcut: i,
1219
+ onEffectiveZoom: d,
1220
+ frameRef: l
1856
1221
  }) {
1857
- const h = q(null), u = cn(h), c = ie(e.path, e.search), [g] = z(c), C = q(c), N = q(c), E = typeof window > "u" ? "" : window.location.origin, R = I(
1858
- (w) => {
1859
- N.current = w;
1860
- const S = p.current?.contentWindow;
1222
+ const c = j(null), h = nn(c), u = re(e.path, e.search), [p] = z(u), S = j(u), C = j(u), k = typeof window > "u" ? "" : window.location.origin, E = W(
1223
+ (P) => {
1224
+ C.current = P;
1225
+ const A = l.current?.contentWindow;
1861
1226
  try {
1862
- S?.location.replace(new URL(w, E).toString());
1227
+ A?.location.replace(new URL(P, k).toString());
1863
1228
  } catch {
1864
- p.current && (p.current.src = w);
1229
+ l.current && (l.current.src = P);
1865
1230
  }
1866
1231
  },
1867
- [p, E]
1232
+ [l, k]
1868
1233
  );
1869
- K(() => {
1870
- if (c === C.current) return;
1871
- const w = C.current;
1872
- C.current = c, Fe(w) !== Fe(c) ? R(c) : ae(p.current?.contentWindow, { ds: 1, type: "location", url: c }, E);
1873
- }, [c, p, R, E]), K(() => {
1874
- const w = (S) => {
1875
- const M = Ze(S, {
1876
- origin: E,
1877
- source: p.current?.contentWindow
1234
+ I(() => {
1235
+ if (u === S.current) return;
1236
+ const P = S.current;
1237
+ S.current = u, _e(P) !== _e(u) ? E(u) : ne(l.current?.contentWindow, { ds: 1, type: "location", url: u }, k);
1238
+ }, [u, l, E, k]), I(() => {
1239
+ const P = (A) => {
1240
+ const O = qe(A, {
1241
+ origin: k,
1242
+ source: l.current?.contentWindow
1878
1243
  });
1879
- if (M)
1880
- switch (M.type) {
1244
+ if (O)
1245
+ switch (O.type) {
1881
1246
  case "ready": {
1882
- if (M.url === C.current) return;
1883
- if (M.url === N.current) {
1884
- ae(
1885
- p.current?.contentWindow,
1886
- { ds: 1, type: "location", url: C.current },
1887
- E
1247
+ if (O.url === S.current) return;
1248
+ if (O.url === C.current) {
1249
+ ne(
1250
+ l.current?.contentWindow,
1251
+ { ds: 1, type: "location", url: S.current },
1252
+ k
1888
1253
  );
1889
1254
  return;
1890
1255
  }
1891
- C.current = M.url, N.current = M.url, s(M.url, !0);
1256
+ S.current = O.url, C.current = O.url, a(O.url, !0);
1892
1257
  return;
1893
1258
  }
1894
1259
  case "navigate":
1895
- C.current = M.url, s(M.url, M.replace);
1260
+ S.current = O.url, a(O.url, O.replace);
1896
1261
  return;
1897
1262
  case "shortcut":
1898
- d(M.key);
1263
+ i(O.key);
1899
1264
  return;
1900
1265
  default:
1901
1266
  return;
1902
1267
  }
1903
1268
  };
1904
- return window.addEventListener("message", w), () => window.removeEventListener("message", w);
1905
- }, [p, s, d, E]);
1906
- const v = !!t.width, L = v ? an : 0, b = Math.max(0, u.width - L * 2), m = Math.max(0, u.height - L * 2), f = !t.width || b === 0 || t.width <= b, k = a === 100 && !f ? Math.max(10, Math.floor(b / t.width * 100)) : a, y = k / 100;
1907
- K(() => {
1908
- l?.(k);
1909
- }, [k, l]);
1910
- const T = t.width ?? b / y, i = t.height ?? m / y;
1911
- return /* @__PURE__ */ n("div", { className: "ds-canvas", ref: h, "data-fit": v ? void 0 : "true", children: /* @__PURE__ */ n(
1269
+ return window.addEventListener("message", P), () => window.removeEventListener("message", P);
1270
+ }, [l, a, i, k]);
1271
+ const v = !!t.width, _ = v ? en : 0, f = Math.max(0, h.width - _ * 2), m = Math.max(0, h.height - _ * 2), w = !t.width || f === 0 || t.width <= f, g = o === 100 && !w ? Math.max(10, Math.floor(f / t.width * 100)) : o, N = g / 100;
1272
+ I(() => {
1273
+ d?.(g);
1274
+ }, [g, d]);
1275
+ const T = t.width ?? f / N, L = t.height ?? m / N;
1276
+ return /* @__PURE__ */ n("div", { className: "ds-canvas", ref: c, "data-fit": v ? void 0 : "true", children: /* @__PURE__ */ n(
1912
1277
  "div",
1913
1278
  {
1914
1279
  className: "ds-canvas__box",
1915
- style: { width: Math.floor(T * y), height: Math.floor(i * y) },
1280
+ style: { width: Math.floor(T * N), height: Math.floor(L * N) },
1916
1281
  children: /* @__PURE__ */ n(
1917
1282
  "iframe",
1918
1283
  {
1919
- ref: p,
1920
- [xt]: "",
1284
+ ref: l,
1285
+ [St]: "",
1921
1286
  className: "ds-frame",
1922
- src: g,
1287
+ src: p,
1923
1288
  title: r,
1924
1289
  style: {
1925
1290
  width: Math.floor(T),
1926
- height: Math.floor(i),
1927
- transform: y === 1 ? void 0 : `scale(${y})`,
1928
- pointerEvents: o ? "none" : void 0
1291
+ height: Math.floor(L),
1292
+ transform: N === 1 ? void 0 : `scale(${N})`,
1293
+ pointerEvents: s ? "none" : void 0
1929
1294
  }
1930
1295
  }
1931
1296
  )
1932
1297
  }
1933
1298
  ) });
1934
1299
  }
1935
- function cn(e) {
1936
- const [t, a] = z({ width: 0, height: 0 });
1937
- return Be(() => {
1300
+ function nn(e) {
1301
+ const [t, o] = z({ width: 0, height: 0 });
1302
+ return Ie(() => {
1938
1303
  const r = e.current;
1939
1304
  if (!r) return;
1940
- const o = () => {
1941
- const d = r.clientWidth, l = r.clientHeight;
1942
- a(
1943
- (p) => p.width === d && p.height === l ? p : { width: d, height: l }
1305
+ const s = () => {
1306
+ const i = r.clientWidth, d = r.clientHeight;
1307
+ o(
1308
+ (l) => l.width === i && l.height === d ? l : { width: i, height: d }
1944
1309
  );
1945
1310
  };
1946
- if (o(), typeof ResizeObserver > "u")
1947
- return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
1948
- const s = new ResizeObserver(o);
1949
- return s.observe(r), () => s.disconnect();
1311
+ if (s(), typeof ResizeObserver > "u")
1312
+ return window.addEventListener("resize", s), () => window.removeEventListener("resize", s);
1313
+ const a = new ResizeObserver(s);
1314
+ return a.observe(r), () => a.disconnect();
1950
1315
  }, [e]), t;
1951
1316
  }
1952
- const rt = 2500;
1953
- class at extends Error {
1317
+ const Ye = 2500;
1318
+ class Qe extends Error {
1954
1319
  constructor(t) {
1955
1320
  super(`Falha de rede simulada no cenário "${t}".`), this.name = "SimulatedNetworkError";
1956
1321
  }
1957
1322
  }
1958
- function Me(e) {
1323
+ function ve(e) {
1959
1324
  if (e)
1960
1325
  return typeof e.data == "function" ? e.data() : e.data;
1961
1326
  }
1962
- const Le = {
1327
+ const ke = {
1963
1328
  id: "fixtures",
1964
1329
  label: "Fixtures",
1965
- load: async ({ scenario: e, fixture: t, network: a }) => {
1966
- switch (a) {
1330
+ load: async ({ scenario: e, fixture: t, network: o }) => {
1331
+ switch (o) {
1967
1332
  case "empty":
1968
1333
  return null;
1969
1334
  case "error":
1970
- throw new at(e.id);
1335
+ throw new Qe(e.id);
1971
1336
  case "loading":
1972
1337
  return new Promise(() => {
1973
1338
  });
1974
1339
  case "slow":
1975
- return await ln(rt), Me(t);
1340
+ return await on(Ye), ve(t);
1976
1341
  default:
1977
- return Me(t);
1342
+ return ve(t);
1978
1343
  }
1979
1344
  }
1980
1345
  };
1981
- function yn(e) {
1982
- const { id: t, label: a, baseUrl: r, path: o, init: s, fallbackToFixture: d = !0 } = e;
1346
+ function _n(e) {
1347
+ const { id: t, label: o, baseUrl: r, path: s, init: a, fallbackToFixture: i = !0 } = e;
1983
1348
  return {
1984
1349
  id: t,
1985
- label: a,
1986
- load: async (l) => {
1987
- const p = new URL(o ? o(l) : l.scenario.route, r);
1350
+ label: o,
1351
+ load: async (d) => {
1352
+ const l = new URL(s ? s(d) : d.scenario.route, r);
1988
1353
  try {
1989
- const h = await fetch(p, s);
1990
- if (!h.ok) throw new Error(`${h.status} ${h.statusText}`);
1991
- return await h.json();
1992
- } catch (h) {
1993
- if (d) return Me(l.fixture);
1994
- throw new Error(`Adapter "${t}" falhou em ${p.toString()}`, { cause: h });
1354
+ const c = await fetch(l, a);
1355
+ if (!c.ok) throw new Error(`${c.status} ${c.statusText}`);
1356
+ return await c.json();
1357
+ } catch (c) {
1358
+ if (i) return ve(d.fixture);
1359
+ throw new Error(`Adapter "${t}" falhou em ${l.toString()}`, { cause: c });
1995
1360
  }
1996
1361
  }
1997
1362
  };
1998
1363
  }
1999
- function ln(e) {
1364
+ function on(e) {
2000
1365
  return new Promise((t) => setTimeout(t, e));
2001
1366
  }
2002
- function dn(e) {
2003
- const { scenario: t, fixture: a, network: r, adapter: o } = e, [s, d] = z({
1367
+ function rn(e) {
1368
+ const { scenario: t, fixture: o, network: r, adapter: s } = e, [a, i] = z({
2004
1369
  data: void 0,
2005
1370
  isLoading: !!t || r === "loading" || r === "slow",
2006
1371
  error: void 0
2007
1372
  });
2008
- return K(() => {
1373
+ return I(() => {
2009
1374
  if (!t)
2010
1375
  switch (r) {
2011
1376
  case "loading":
2012
- d({ data: void 0, isLoading: !0, error: void 0 });
1377
+ i({ data: void 0, isLoading: !0, error: void 0 });
2013
1378
  return;
2014
1379
  case "empty":
2015
- d({ data: null, isLoading: !1, error: void 0 });
1380
+ i({ data: null, isLoading: !1, error: void 0 });
2016
1381
  return;
2017
1382
  case "error":
2018
- d({
1383
+ i({
2019
1384
  data: void 0,
2020
1385
  isLoading: !1,
2021
- error: new at(e.screen ?? "—")
1386
+ error: new Qe(e.screen ?? "—")
2022
1387
  });
2023
1388
  return;
2024
1389
  case "slow": {
2025
- d({ data: void 0, isLoading: !0, error: void 0 });
2026
- const h = setTimeout(
2027
- () => d({ data: void 0, isLoading: !1, error: void 0 }),
2028
- rt
1390
+ i({ data: void 0, isLoading: !0, error: void 0 });
1391
+ const c = setTimeout(
1392
+ () => i({ data: void 0, isLoading: !1, error: void 0 }),
1393
+ Ye
2029
1394
  );
2030
- return () => clearTimeout(h);
1395
+ return () => clearTimeout(c);
2031
1396
  }
2032
1397
  default:
2033
- d({ data: void 0, isLoading: !1, error: void 0 });
1398
+ i({ data: void 0, isLoading: !1, error: void 0 });
2034
1399
  return;
2035
1400
  }
2036
- let l = !0;
2037
- d({ data: void 0, isLoading: !0, error: void 0 });
2038
- const p = o ?? Le;
2039
- return Promise.resolve(p.load({ scenario: t, fixture: a, network: r })).then((h) => {
2040
- l && d({ data: h, isLoading: !1, error: void 0 });
2041
- }).catch((h) => {
2042
- l && d({
1401
+ let d = !0;
1402
+ i({ data: void 0, isLoading: !0, error: void 0 });
1403
+ const l = s ?? ke;
1404
+ return Promise.resolve(l.load({ scenario: t, fixture: o, network: r })).then((c) => {
1405
+ d && i({ data: c, isLoading: !1, error: void 0 });
1406
+ }).catch((c) => {
1407
+ d && i({
2043
1408
  data: void 0,
2044
1409
  isLoading: !1,
2045
- error: h instanceof Error ? h : new Error(String(h))
1410
+ error: c instanceof Error ? c : new Error(String(c))
2046
1411
  });
2047
1412
  }), () => {
2048
- l = !1;
1413
+ d = !1;
2049
1414
  };
2050
- }, [t, a, r, o, e.screen]), s;
1415
+ }, [t, o, r, s, e.screen]), a;
2051
1416
  }
2052
- function Ke({ title: e, children: t }) {
2053
- return /* @__PURE__ */ x("div", { className: "ds-stage-empty", children: [
1417
+ function Oe({ title: e, children: t }) {
1418
+ return /* @__PURE__ */ b("div", { className: "ds-stage-empty", children: [
2054
1419
  /* @__PURE__ */ n("h2", { className: "ds-stage-empty__title", children: e }),
2055
1420
  t
2056
1421
  ] });
2057
1422
  }
2058
- function Ie(e) {
1423
+ const sn = /* @__PURE__ */ Symbol.for("react.memo"), an = /* @__PURE__ */ Symbol.for("react.forward_ref");
1424
+ class Xe extends Error {
1425
+ }
1426
+ function Je(e) {
2059
1427
  const t = [];
2060
- return e.querySelectorAll(`[${Oe}]`).forEach((a, r) => {
2061
- const o = a.getBoundingClientRect();
2062
- o.width === 0 && o.height === 0 || t.push({
2063
- key: `${r}`,
2064
- id: a.getAttribute(Oe) ?? "",
2065
- top: o.top,
2066
- left: o.left,
2067
- width: o.width,
2068
- height: o.height
2069
- });
2070
- }), t;
1428
+ let o = e;
1429
+ for (; o && (typeof o == "function" || typeof o == "object") && !t.includes(o); ) {
1430
+ t.push(o);
1431
+ const r = o.$$typeof;
1432
+ if (r === sn) o = o.type;
1433
+ else if (r === an) o = o.render;
1434
+ else break;
1435
+ }
1436
+ return t;
2071
1437
  }
2072
- const un = 16;
2073
- function hn({ registry: e }) {
2074
- const t = J(), [a, r] = z(() => Ie(document));
2075
- return K(() => {
2076
- let o = 0;
2077
- const s = () => {
2078
- o || (o = window.requestAnimationFrame(() => {
2079
- o = 0, r(Ie(document));
1438
+ function cn(e) {
1439
+ const t = /* @__PURE__ */ new Map();
1440
+ for (const o of e) {
1441
+ const r = Array.isArray(o.implementation) ? o.implementation : o.implementation === void 0 ? [] : [o.implementation];
1442
+ for (const s of r)
1443
+ for (const a of Je(s)) {
1444
+ const i = t.get(a) ?? [];
1445
+ i.includes(o.id) || i.push(o.id), t.set(a, i);
1446
+ }
1447
+ }
1448
+ return t;
1449
+ }
1450
+ function ln(e, t) {
1451
+ const o = [];
1452
+ for (const r of [e.type, e.elementType])
1453
+ for (const s of Je(r))
1454
+ for (const a of t.get(s) ?? []) o.includes(a) || o.push(a);
1455
+ return o;
1456
+ }
1457
+ function dn(e) {
1458
+ return !!e && e.nodeType === 1;
1459
+ }
1460
+ function et(e) {
1461
+ return typeof e.type == "string" && dn(e.stateNode);
1462
+ }
1463
+ function ye(e) {
1464
+ if (!e || typeof e != "object" || !("child" in e) || !("sibling" in e) || !("stateNode" in e))
1465
+ throw new Xe("fiber sem child, sibling ou stateNode");
1466
+ }
1467
+ function tt(e, t) {
1468
+ for (let o = e.child; o; o = o.sibling)
1469
+ ye(o), et(o) ? t.push(o.stateNode) : tt(o, t);
1470
+ }
1471
+ function hn(e, t) {
1472
+ const o = [];
1473
+ if (t.size === 0) return o;
1474
+ for (const r of e) {
1475
+ const s = r?.current;
1476
+ if (ye(s), s.stateNode !== r) throw new Xe("raiz sem `current.stateNode` de volta");
1477
+ const a = s.child ? [s.child] : [];
1478
+ for (; a.length > 0; ) {
1479
+ const i = a.pop();
1480
+ if (ye(i), i.sibling && a.push(i.sibling), i.child && a.push(i.child), et(i)) continue;
1481
+ const d = ln(i, t);
1482
+ if (d.length === 0) continue;
1483
+ const l = [];
1484
+ tt(i, l), l.length > 0 && o.push({ ids: d, elements: l });
1485
+ }
1486
+ }
1487
+ return o;
1488
+ }
1489
+ let $e = !1;
1490
+ function ze(e) {
1491
+ $e || ($e = !0, console.warn(`[design-space] ${e}`));
1492
+ }
1493
+ function un(e, t) {
1494
+ if (e.size === 0) return [];
1495
+ const o = Et(t);
1496
+ if (!o)
1497
+ return ze(
1498
+ `Destacar componentes: o React carregou antes do gancho do DevTools, então só a marcação \`${de}\` é contornada. Importe "@brucesantos/design-space/devtools-hook" na primeira linha do ponto de entrada, antes de qualquer import de React.`
1499
+ ), [];
1500
+ try {
1501
+ return hn(o, e);
1502
+ } catch (r) {
1503
+ return ze(
1504
+ "Destacar componentes: a árvore do React não tem a forma esperada, então só a marcação " + `\`${de}\` é contornada. ${r instanceof Error ? r.message : ""}`.trim()
1505
+ ), [];
1506
+ }
1507
+ }
1508
+ function mn(e, t = /* @__PURE__ */ new Map()) {
1509
+ const o = e.defaultView ?? window, r = un(t, o);
1510
+ e.querySelectorAll(`[${de}]`).forEach((d) => {
1511
+ r.push({ ids: [d.getAttribute(de) ?? ""], elements: [d] });
1512
+ });
1513
+ const s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1514
+ for (const d of r) {
1515
+ const l = d.elements.filter((u) => u.isConnected && !u.closest(".ds-highlight"));
1516
+ if (l.length === 0) continue;
1517
+ const c = l.map((u) => (s.has(u) || s.set(u, s.size), s.get(u))).join(","), h = a.get(c) ?? { ids: [], elements: l };
1518
+ for (const u of d.ids) h.ids.includes(u) || h.ids.push(u);
1519
+ a.set(c, h);
1520
+ }
1521
+ const i = [];
1522
+ for (const [d, { ids: l, elements: c }] of a) {
1523
+ let h = 1 / 0, u = 1 / 0, p = -1 / 0, S = -1 / 0;
1524
+ for (const C of c) {
1525
+ const k = C.getBoundingClientRect();
1526
+ k.width === 0 && k.height === 0 || (h = Math.min(h, k.top), u = Math.min(u, k.left), p = Math.max(p, k.right), S = Math.max(S, k.bottom));
1527
+ }
1528
+ h !== 1 / 0 && i.push({ key: d, ids: l, top: h, left: u, width: p - u, height: S - h });
1529
+ }
1530
+ return i;
1531
+ }
1532
+ function fn(e, t) {
1533
+ return e.length === t.length && e.every((o, r) => {
1534
+ const s = t[r];
1535
+ return o.key === s.key && o.top === s.top && o.left === s.left && o.width === s.width && o.height === s.height && o.ids.join(`
1536
+ `) === s.ids.join(`
1537
+ `);
1538
+ });
1539
+ }
1540
+ const pn = 16;
1541
+ function wn({ registry: e }) {
1542
+ const t = X(), o = $(() => cn(e.componentsFor()), [e]), [r, s] = z([]);
1543
+ return I(() => {
1544
+ Lt(window);
1545
+ let a = 0;
1546
+ const i = () => {
1547
+ a || (a = window.requestAnimationFrame(() => {
1548
+ a = 0;
1549
+ const c = mn(document, o);
1550
+ s((h) => fn(h, c) ? h : c);
2080
1551
  }));
2081
- }, d = new MutationObserver((l) => {
2082
- l.some((h) => !(h.target instanceof Element ? h.target : h.target.parentElement)?.closest(".ds-highlight")) && s();
1552
+ }, d = new MutationObserver((c) => {
1553
+ c.some((u) => !(u.target instanceof Element ? u.target : u.target.parentElement)?.closest(".ds-highlight")) && i();
2083
1554
  });
2084
- return d.observe(document.body, { subtree: !0, childList: !0, attributes: !0, characterData: !0 }), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), document.addEventListener("transitionend", s, !0), document.addEventListener("animationend", s, !0), s(), () => {
2085
- o && window.cancelAnimationFrame(o), d.disconnect(), window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s), document.removeEventListener("transitionend", s, !0), document.removeEventListener("animationend", s, !0);
1555
+ d.observe(document.body, { subtree: !0, childList: !0, attributes: !0, characterData: !0 }), window.addEventListener("scroll", i, !0), window.addEventListener("resize", i), document.addEventListener("transitionend", i, !0), document.addEventListener("animationend", i, !0);
1556
+ const l = _t(i, window);
1557
+ return i(), () => {
1558
+ a && window.cancelAnimationFrame(a), d.disconnect(), window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i), document.removeEventListener("transitionend", i, !0), document.removeEventListener("animationend", i, !0), l();
2086
1559
  };
2087
- }, []), Lt(
2088
- /* @__PURE__ */ n("div", { className: "ds-highlight", "aria-hidden": "true", children: a.map((o) => {
2089
- const s = e.component(o.id);
1560
+ }, [o]), Mt(
1561
+ /* @__PURE__ */ n("div", { className: "ds-highlight", "aria-hidden": "true", children: r.map((a) => {
1562
+ const i = a.ids.map((d) => ({ id: d, known: e.component(d) }));
2090
1563
  return /* @__PURE__ */ n(
2091
1564
  "div",
2092
1565
  {
2093
1566
  className: "ds-highlight__box",
2094
- "data-known": s ? "true" : "false",
2095
- "data-label": o.top < un ? "inside" : "above",
2096
- style: { top: o.top, left: o.left, width: o.width, height: o.height },
2097
- children: /* @__PURE__ */ n("span", { className: "ds-highlight__label", children: s ? s.name : t.highlight.notInCatalog(o.id) })
1567
+ "data-known": i.every((d) => d.known) ? "true" : "false",
1568
+ "data-label": a.top < pn ? "inside" : "above",
1569
+ style: { top: a.top, left: a.left, width: a.width, height: a.height },
1570
+ children: /* @__PURE__ */ n("span", { className: "ds-highlight__label", children: i.map((d) => d.known ? d.known.name : t.highlight.notInCatalog(d.id)).join(" · ") })
2098
1571
  },
2099
- o.key
1572
+ a.key
2100
1573
  );
2101
1574
  }) }),
2102
1575
  document.body
2103
1576
  );
2104
1577
  }
2105
- function pn({ product: e, registry: t }) {
2106
- const a = J(), { location: r, controls: o, viewport: s, navigate: d, openScenario: l, setScreenControls: p } = Xe(
1578
+ function bn({ product: e, registry: t }) {
1579
+ const o = X(), { location: r, controls: s, viewport: a, navigate: i, openScenario: d, setScreenControls: l } = je(
2107
1580
  t,
2108
1581
  { frame: !0 }
2109
- ), h = q(null);
2110
- K(() => {
2111
- const P = (A) => {
2112
- if (A.defaultPrevented || A.button !== 0 || A.metaKey || A.ctrlKey || A.shiftKey || A.altKey) return;
2113
- const V = A.target?.closest?.("a[href]");
2114
- if (!(V instanceof HTMLAnchorElement) || V.target && V.target !== "_self" || V.hasAttribute("download")) return;
2115
- const Z = V.getAttribute("href") ?? "";
1582
+ ), c = j(null);
1583
+ I(() => {
1584
+ const x = (R) => {
1585
+ if (R.defaultPrevented || R.button !== 0 || R.metaKey || R.ctrlKey || R.shiftKey || R.altKey) return;
1586
+ const K = R.target?.closest?.("a[href]");
1587
+ if (!(K instanceof HTMLAnchorElement) || K.target && K.target !== "_self" || K.hasAttribute("download")) return;
1588
+ const Z = K.getAttribute("href") ?? "";
2116
1589
  if (Z.startsWith("#")) return;
2117
- let B;
1590
+ let q;
2118
1591
  try {
2119
- B = new URL(Z, window.location.href);
1592
+ q = new URL(Z, window.location.href);
2120
1593
  } catch {
2121
1594
  return;
2122
1595
  }
2123
- B.origin === window.location.origin && (A.preventDefault(), d(`${B.pathname}${B.search}`));
1596
+ q.origin === window.location.origin && (R.preventDefault(), i(`${q.pathname}${q.search}`));
2124
1597
  };
2125
- return document.addEventListener("click", P), () => document.removeEventListener("click", P);
2126
- }, [d]), K(() => {
2127
- const P = (A) => {
1598
+ return document.addEventListener("click", x), () => document.removeEventListener("click", x);
1599
+ }, [i]), I(() => {
1600
+ const x = (R) => {
2128
1601
  if (window.parent === window) return;
2129
- const V = mn(A);
2130
- if (!V) return;
2131
- const Z = A.target;
2132
- V === "C" && Z?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (A.preventDefault(), ae(window.parent, { ds: 1, type: "shortcut", key: V }, window.location.origin));
1602
+ const K = gn(R);
1603
+ if (!K) return;
1604
+ const Z = R.target;
1605
+ K === "C" && Z?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (R.preventDefault(), ne(window.parent, { ds: 1, type: "shortcut", key: K }, window.location.origin));
2133
1606
  };
2134
- return window.addEventListener("keydown", P), () => window.removeEventListener("keydown", P);
2135
- }, []), K(() => {
2136
- const P = h.current;
2137
- if (!P || !o.handoff) return;
2138
- const A = () => {
2139
- for (const Z of P.querySelectorAll("a[href]")) {
2140
- const B = Z.getAttribute("href");
2141
- if (!B || B.startsWith("#")) continue;
1607
+ return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1608
+ }, []), I(() => {
1609
+ const x = c.current;
1610
+ if (!x || !s.handoff) return;
1611
+ const R = () => {
1612
+ for (const Z of x.querySelectorAll("a[href]")) {
1613
+ const q = Z.getAttribute("href");
1614
+ if (!q || q.startsWith("#")) continue;
2142
1615
  let Y;
2143
1616
  try {
2144
- Y = new URL(B, window.location.href);
1617
+ Y = new URL(q, window.location.href);
2145
1618
  } catch {
2146
1619
  continue;
2147
1620
  }
2148
1621
  if (Y.origin !== window.location.origin) continue;
2149
- Ee(Y.searchParams, o.handoff);
2150
- const ce = `${Y.pathname}${Y.search}${Y.hash}`;
2151
- B !== ce && Z.setAttribute("href", ce);
1622
+ Ce(Y.searchParams, s.handoff);
1623
+ const se = `${Y.pathname}${Y.search}${Y.hash}`;
1624
+ q !== se && Z.setAttribute("href", se);
2152
1625
  }
2153
1626
  };
2154
- A();
2155
- const V = new MutationObserver(A);
2156
- return V.observe(P, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => V.disconnect();
2157
- }, [o.handoff]);
2158
- const u = t.scenario(o.scenario), c = t.component(o.component), g = D(() => {
2159
- const P = new URLSearchParams(r.search);
1627
+ R();
1628
+ const K = new MutationObserver(R);
1629
+ return K.observe(x, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => K.disconnect();
1630
+ }, [s.handoff]);
1631
+ const h = t.scenario(s.scenario), u = t.component(s.component), p = $(() => {
1632
+ const x = new URLSearchParams(r.search);
2160
1633
  return {
2161
- scenario: P.get($.scenario) ?? void 0,
2162
- component: P.get($.component) ?? void 0
1634
+ scenario: x.get(y.scenario) ?? void 0,
1635
+ component: x.get(y.component) ?? void 0
2163
1636
  };
2164
- }, [r.search]), C = !!(o.handoff && (g.scenario && !re(o.handoff, g.scenario) || g.component && !ve(o.handoff, g.component) || !g.component && !je(o.handoff, r.path, e.scenarios))), N = D(
2165
- () => t.resolveComponentFixture(c?.id, c ? o.fixture : void 0),
2166
- [c, o.fixture, t]
2167
- ), E = D(() => {
2168
- const P = N.fixture?.data;
2169
- return typeof P == "function" ? P() : P;
2170
- }, [N.fixture]), R = t.persona(o.persona ?? u?.persona), v = t.fixture(o.fixture ?? u?.fixture), L = D(() => {
2171
- const P = o.dataSource ?? "fixtures";
2172
- return P === "fixtures" ? Le : e.dataSources?.adapters?.find((A) => A.id === P) ?? Le;
2173
- }, [o.dataSource, e.dataSources?.adapters]), { data: b, isLoading: m, error: f } = dn({
2174
- scenario: u,
1637
+ }, [r.search]), S = !!(s.handoff && (p.scenario && !Ne(s.handoff, p.scenario) || p.component && !Se(s.handoff, p.component) || !p.component && !gt(s.handoff, r.path, e.scenarios))), C = $(
1638
+ () => t.resolveComponentFixture(u?.id, u ? s.fixture : void 0),
1639
+ [u, s.fixture, t]
1640
+ ), k = $(() => {
1641
+ const x = C.fixture?.data;
1642
+ return typeof x == "function" ? x() : x;
1643
+ }, [C.fixture]), E = t.persona(s.persona ?? h?.persona), v = t.fixture(s.fixture ?? h?.fixture), _ = $(() => {
1644
+ const x = s.dataSource ?? "fixtures";
1645
+ return x === "fixtures" ? ke : e.dataSources?.adapters?.find((R) => R.id === x) ?? ke;
1646
+ }, [s.dataSource, e.dataSources?.adapters]), { data: f, isLoading: m, error: w } = rn({
1647
+ scenario: h,
2175
1648
  fixture: v,
2176
- network: o.network,
2177
- adapter: L,
1649
+ network: s.network,
1650
+ adapter: _,
2178
1651
  screen: r.path
2179
- }), k = D(() => u ? o.persona && o.persona !== (u.persona ?? t.defaultPersona) ? t.persona(o.persona)?.permissions ?? [] : t.permissionsOf(u) : t.persona(o.persona)?.permissions ?? [], [o.persona, t, u]), y = o.screenControls, T = D(() => y ?? {}, [y]), i = I(
2180
- (P, A) => p({ [P]: A }),
2181
- [p]
2182
- ), w = D(
1652
+ }), g = $(() => h ? s.persona && s.persona !== (h.persona ?? t.defaultPersona) ? t.persona(s.persona)?.permissions ?? [] : t.permissionsOf(h) : t.persona(s.persona)?.permissions ?? [], [s.persona, t, h]), N = s.screenControls, T = $(() => N ?? {}, [N]), L = W(
1653
+ (x, R) => l({ [x]: R }),
1654
+ [l]
1655
+ ), P = $(
2183
1656
  () => ({
2184
- scenario: u,
2185
- persona: R,
2186
- permissions: k,
2187
- can: (P) => k.includes(P),
2188
- data: b,
1657
+ scenario: h,
1658
+ persona: E,
1659
+ permissions: g,
1660
+ can: (x) => g.includes(x),
1661
+ data: f,
2189
1662
  fixture: v,
2190
- network: o.network,
1663
+ network: s.network,
2191
1664
  isLoading: m,
2192
- error: f,
2193
- rules: t.rulesOf(u),
2194
- viewport: s,
2195
- themeMode: o.themeMode,
2196
- locale: o.locale,
2197
- navigate: d,
2198
- openScenario: l,
1665
+ error: w,
1666
+ rules: t.rulesOf(h),
1667
+ viewport: a,
1668
+ themeMode: s.themeMode,
1669
+ locale: s.locale,
1670
+ navigate: i,
1671
+ openScenario: d,
2199
1672
  controls: T,
2200
- setControl: i,
2201
- setControls: p
1673
+ setControl: L,
1674
+ setControls: l
2202
1675
  }),
2203
1676
  [
2204
- u,
2205
- R,
2206
- k,
2207
- b,
1677
+ h,
1678
+ E,
1679
+ g,
1680
+ f,
2208
1681
  v,
2209
- o.network,
2210
- o.themeMode,
2211
- o.locale,
1682
+ s.network,
1683
+ s.themeMode,
1684
+ s.locale,
2212
1685
  m,
2213
- f,
1686
+ w,
2214
1687
  t,
2215
- s,
1688
+ a,
1689
+ i,
2216
1690
  d,
2217
- l,
2218
1691
  T,
2219
- i,
2220
- p
1692
+ L,
1693
+ l
2221
1694
  ]
2222
- ), S = ye(e.routes ?? [], r.path), M = e.wrapper, F = e.notFound, O = c?.preview, U = C ? /* @__PURE__ */ n(Ke, { title: a.shell.outsideHandoff, children: /* @__PURE__ */ n("p", { children: a.shell.outsideHandoffHint }) }) : O ? /* @__PURE__ */ n(
2223
- O,
1695
+ ), A = vt(e.routes ?? [], r.path), O = e.wrapper, G = e.notFound, F = u?.preview, D = S ? /* @__PURE__ */ n(Oe, { title: o.shell.outsideHandoff, children: /* @__PURE__ */ n("p", { children: o.shell.outsideHandoffHint }) }) : F ? /* @__PURE__ */ n(
1696
+ F,
2224
1697
  {
2225
- fixture: N.fixture,
2226
- data: E,
2227
- viewport: s,
2228
- themeMode: o.themeMode ?? "default",
2229
- locale: o.locale ?? "default"
1698
+ fixture: C.fixture,
1699
+ data: k,
1700
+ viewport: a,
1701
+ themeMode: s.themeMode ?? "default",
1702
+ locale: s.locale ?? "default"
2230
1703
  }
2231
- ) : S ? /* @__PURE__ */ n(S.definition.screen, { params: S.params, context: w }) : F ? /* @__PURE__ */ n(F, { path: r.path }) : /* @__PURE__ */ n(Ke, { title: a.shell.noRoute, children: /* @__PURE__ */ x("p", { children: [
1704
+ ) : A ? /* @__PURE__ */ n(A.definition.screen, { params: A.params, context: P }) : G ? /* @__PURE__ */ n(G, { path: r.path }) : /* @__PURE__ */ n(Oe, { title: o.shell.noRoute, children: /* @__PURE__ */ b("p", { children: [
2232
1705
  /* @__PURE__ */ n("code", { children: r.path }),
2233
1706
  " ",
2234
- a.shell.noRouteHint
1707
+ o.shell.noRouteHint
2235
1708
  ] }) });
2236
1709
  return (
2237
1710
  // `display: contents` deixa o layout do produto como se este nó não
2238
1711
  // existisse: ele só serve de raiz para observar os links.
2239
- /* @__PURE__ */ x("div", { ref: h, style: { display: "contents" }, children: [
2240
- M && !C ? /* @__PURE__ */ n(M, { context: w, children: U }) : U,
2241
- o.highlight && !C && /* @__PURE__ */ n(hn, { registry: t })
1712
+ /* @__PURE__ */ b("div", { ref: c, style: { display: "contents" }, children: [
1713
+ O && !S ? /* @__PURE__ */ n(O, { context: P, children: D }) : D,
1714
+ s.highlight && !S && /* @__PURE__ */ n(wn, { registry: t })
2242
1715
  ] })
2243
1716
  );
2244
1717
  }
2245
- function mn(e) {
1718
+ function gn(e) {
2246
1719
  if (!e.altKey) {
2247
1720
  if (e.shiftKey && !e.metaKey && !e.ctrlKey && e.key === "C") return "C";
2248
1721
  if ((e.metaKey || e.ctrlKey) && !e.shiftKey) {
@@ -2252,235 +1725,233 @@ function mn(e) {
2252
1725
  }
2253
1726
  }
2254
1727
  }
2255
- const pe = {
1728
+ const le = {
2256
1729
  leftWidth: "ds:left-width",
2257
1730
  rightWidth: "ds:right-width",
2258
1731
  appearance: "ds:appearance"
2259
1732
  };
2260
- function st(e) {
1733
+ function nt(e) {
2261
1734
  try {
2262
1735
  return window.localStorage.getItem(e) ?? void 0;
2263
1736
  } catch {
2264
1737
  return;
2265
1738
  }
2266
1739
  }
2267
- function it(e, t) {
1740
+ function ot(e, t) {
2268
1741
  try {
2269
1742
  window.localStorage.setItem(e, t);
2270
1743
  } catch {
2271
1744
  }
2272
1745
  }
2273
- function He(e, t, a) {
2274
- return Math.round(Math.min(a, Math.max(t, e)));
2275
- }
2276
- function We(e, t, a, r) {
2277
- const [o, s] = z(() => {
2278
- const l = Number.parseInt(st(e) ?? "", 10);
2279
- return Number.isFinite(l) ? He(l, a, r) : t;
2280
- }), d = I(
2281
- (l) => {
2282
- const p = He(l, a, r);
2283
- s(p), it(e, String(p));
1746
+ function De(e, t, o) {
1747
+ return Math.round(Math.min(o, Math.max(t, e)));
1748
+ }
1749
+ function Ke(e, t, o, r) {
1750
+ const [s, a] = z(() => {
1751
+ const d = Number.parseInt(nt(e) ?? "", 10);
1752
+ return Number.isFinite(d) ? De(d, o, r) : t;
1753
+ }), i = W(
1754
+ (d) => {
1755
+ const l = De(d, o, r);
1756
+ a(l), ot(e, String(l));
2284
1757
  },
2285
- [e, r, a]
1758
+ [e, r, o]
2286
1759
  );
2287
- return [o, d];
1760
+ return [s, i];
2288
1761
  }
2289
- function fn() {
1762
+ function vn() {
2290
1763
  const e = "(prefers-color-scheme: dark)", t = () => {
2291
1764
  try {
2292
1765
  return window.matchMedia(e).matches ? "dark" : "light";
2293
1766
  } catch {
2294
1767
  return "light";
2295
1768
  }
2296
- }, [a, r] = z(t);
2297
- return K(() => {
2298
- let o;
1769
+ }, [o, r] = z(t);
1770
+ return I(() => {
1771
+ let s;
2299
1772
  try {
2300
- o = window.matchMedia(e);
1773
+ s = window.matchMedia(e);
2301
1774
  } catch {
2302
1775
  return;
2303
1776
  }
2304
- const s = () => r(o?.matches ? "dark" : "light");
2305
- return o.addEventListener?.("change", s), () => o?.removeEventListener?.("change", s);
2306
- }, []), a;
1777
+ const a = () => r(s?.matches ? "dark" : "light");
1778
+ return s.addEventListener?.("change", a), () => s?.removeEventListener?.("change", a);
1779
+ }, []), o;
2307
1780
  }
2308
- function wn() {
2309
- const e = st(pe.appearance);
1781
+ function kn() {
1782
+ const e = nt(le.appearance);
2310
1783
  return e === "dark" || e === "light" ? e : void 0;
2311
1784
  }
2312
- function Nn({ product: e }) {
2313
- const t = D(() => Et(e), [e]), a = D(() => Ht(e.theme?.labels), [e.theme?.labels]), [r] = z(() => yt());
2314
- return /* @__PURE__ */ n(tt.Provider, { value: a, children: r ? /* @__PURE__ */ n(pn, { product: e, registry: t }) : /* @__PURE__ */ n(gn, { product: e, registry: t }) });
2315
- }
2316
- const Ce = { initial: 290, min: 200, max: 480 }, xe = { initial: 320, min: 260, max: 560 };
2317
- function gn({ product: e, registry: t }) {
2318
- const a = J(), r = D(() => Nt(e.deploy), [e.deploy]), { location: o, controls: s, viewport: d, setControls: l, openScenario: p, openComponent: h, openScreen: u, go: c } = Xe(t), g = q(o);
2319
- g.current = o;
2320
- const C = q(null), N = fn(), [E, R] = z(() => wn()), v = s.chromeTheme ?? E ?? N, [L, b] = We(
2321
- pe.leftWidth,
2322
- Ce.initial,
2323
- Ce.min,
2324
- Ce.max
2325
- ), [m, f] = We(
2326
- pe.rightWidth,
2327
- xe.initial,
2328
- xe.min,
2329
- xe.max
2330
- ), [k, y] = z(!1), T = s.handoff, i = t.component(s.component), w = t.scenario(s.scenario), S = i ? void 0 : t.screensFor({ handoff: T }).find((_) => _.id === t.screenForPath(o.path)?.id), M = S && w && S.variations.some((_) => _.id === w.id) ? w : void 0, F = D(
2331
- () => t.resolveComponentFixture(i?.id, i ? s.fixture : void 0),
2332
- [i, s.fixture, t]
2333
- ), O = D(() => {
2334
- if (!S || S.controls.length === 0) return t.issues;
2335
- const { invalid: _ } = t.resolveControls(S, {
2336
- scenario: M,
2337
- requested: qe(o.search)
1785
+ function Tn({ product: e }) {
1786
+ const t = $(() => mt(e), [e]), o = $(() => ft(e.theme?.labels), [e.theme?.labels]), [r] = z(() => Nt());
1787
+ return /* @__PURE__ */ n(pt.Provider, { value: o, children: r ? /* @__PURE__ */ n(bn, { product: e, registry: t }) : /* @__PURE__ */ n(yn, { product: e, registry: t }) });
1788
+ }
1789
+ const we = { initial: 290, min: 200, max: 480 }, be = { initial: 320, min: 260, max: 560 };
1790
+ function yn({ product: e, registry: t }) {
1791
+ const o = X(), r = $(() => kt(e.deploy), [e.deploy]), { location: s, controls: a, viewport: i, setControls: d, openScenario: l, openComponent: c, openScreen: h, go: u } = je(t), p = j(s);
1792
+ p.current = s;
1793
+ const S = j(null), C = vn(), [k, E] = z(() => kn()), v = a.chromeTheme ?? k ?? C, [_, f] = Ke(
1794
+ le.leftWidth,
1795
+ we.initial,
1796
+ we.min,
1797
+ we.max
1798
+ ), [m, w] = Ke(
1799
+ le.rightWidth,
1800
+ be.initial,
1801
+ be.min,
1802
+ be.max
1803
+ ), [g, N] = z(!1), T = a.handoff, L = t.component(a.component), P = t.scenario(a.scenario), A = L ? void 0 : t.screensFor({ handoff: T }).find((M) => M.id === t.screenForPath(s.path)?.id), O = A && P && A.variations.some((M) => M.id === P.id) ? P : void 0, G = $(
1804
+ () => t.resolveComponentFixture(L?.id, L ? a.fixture : void 0),
1805
+ [L, a.fixture, t]
1806
+ ), F = $(() => {
1807
+ if (!A || A.controls.length === 0) return t.issues;
1808
+ const { invalid: M } = t.resolveControls(A, {
1809
+ scenario: O,
1810
+ requested: Ue(s.search)
2338
1811
  });
2339
- return _.length === 0 ? t.issues : [..._.map((Q) => ({
1812
+ return M.length === 0 ? t.issues : [...M.map((Q) => ({
2340
1813
  level: "warning",
2341
- where: `url:${be}${Q.id}`,
2342
- message: Q.reason === "invalid-value" ? a.diagnostics.invalidControl(Q.id, Q.value, Q.fallback ?? "") : a.diagnostics.unknownControl(Q.id, Q.value)
1814
+ where: `url:${me}${Q.id}`,
1815
+ message: Q.reason === "invalid-value" ? o.diagnostics.invalidControl(Q.id, Q.value, Q.fallback ?? "") : o.diagnostics.unknownControl(Q.id, Q.value)
2343
1816
  })), ...t.issues];
2344
- }, [a, o.search, t, S, M]), U = t.screensFor({ handoff: T })[0], P = t.componentsFor(T)[0], A = !U && !P, V = D(() => {
2345
- const _ = new URLSearchParams(o.search);
2346
- return _.has($.scenario) || _.has($.component);
2347
- }, [o.search]), Z = o.path === "/" && !V && !t.screenForPath("/") && !A;
2348
- K(() => {
2349
- Z && (U ? u(U.id, { replace: !0 }) : P && h(P.id, { replace: !0 }));
2350
- }, [P, U, h, u, Z]);
2351
- const B = I(
2352
- () => l({ chrome: !s.chrome }),
2353
- [s.chrome, l]
2354
- ), Y = I(
2355
- (_) => {
2356
- if (_ === "C") {
2357
- B();
1817
+ }, [o, s.search, t, A, O]), D = t.screensFor({ handoff: T })[0], x = t.componentsFor(T)[0], R = !D && !x, K = $(() => {
1818
+ const M = new URLSearchParams(s.search);
1819
+ return M.has(y.scenario) || M.has(y.component);
1820
+ }, [s.search]), Z = s.path === "/" && !K && !t.screenForPath("/") && !R;
1821
+ I(() => {
1822
+ Z && (D ? h(D.id, { replace: !0 }) : x && c(x.id, { replace: !0 }));
1823
+ }, [x, D, c, h, Z]);
1824
+ const q = W(
1825
+ () => d({ chrome: !a.chrome }),
1826
+ [a.chrome, d]
1827
+ ), Y = W(
1828
+ (M) => {
1829
+ if (M === "C") {
1830
+ q();
2358
1831
  return;
2359
1832
  }
2360
- window.dispatchEvent(new KeyboardEvent("keydown", { key: _.toLowerCase(), metaKey: !0 }));
1833
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: M.toLowerCase(), metaKey: !0 }));
2361
1834
  },
2362
- [B]
1835
+ [q]
2363
1836
  );
2364
- K(() => {
2365
- const _ = (j) => {
2366
- !j.shiftKey || j.metaKey || j.ctrlKey || j.altKey || j.key !== "C" || j.target?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (j.preventDefault(), Y(j.key));
1837
+ I(() => {
1838
+ const M = (B) => {
1839
+ !B.shiftKey || B.metaKey || B.ctrlKey || B.altKey || B.key !== "C" || B.target?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (B.preventDefault(), Y(B.key));
2367
1840
  };
2368
- return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
1841
+ return window.addEventListener("keydown", M), () => window.removeEventListener("keydown", M);
2369
1842
  }, [Y]);
2370
- const ce = I(
2371
- (_, j) => {
2372
- const { path: Q, search: mt } = he(_);
2373
- c(Q, $t(mt, g.current.search), { replace: j });
1843
+ const se = W(
1844
+ (M, B) => {
1845
+ const { path: Q, search: dt } = ce(M);
1846
+ u(Q, Ct(dt, p.current.search), { replace: B });
2374
1847
  },
2375
- [c]
2376
- ), ct = () => {
2377
- let _;
1848
+ [u]
1849
+ ), rt = () => {
1850
+ let M;
2378
1851
  try {
2379
- _ = C.current?.contentWindow?.location.href;
1852
+ M = S.current?.contentWindow?.location.href;
2380
1853
  } catch {
2381
1854
  }
2382
- const j = Mt(_, window.location.origin, g.current);
2383
- window.open(j, "_blank", "noopener");
2384
- }, lt = () => {
2385
- const _ = v === "dark" ? "light" : "dark";
2386
- it(pe.appearance, _), R(_), l({ chromeTheme: _ });
2387
- }, te = (_) => l(_), dt = `${r.origin}${o.path}${o.search}`, ut = s.panelTab ?? "variations", Re = s.zoom ?? 100, [ht, pt] = z(Re);
2388
- return /* @__PURE__ */ x(
1855
+ const B = xt(M, window.location.origin, p.current);
1856
+ window.open(B, "_blank", "noopener");
1857
+ }, st = () => {
1858
+ const M = v === "dark" ? "light" : "dark";
1859
+ ot(le.appearance, M), E(M), d({ chromeTheme: M });
1860
+ }, ee = (M) => d(M), at = `${r.origin}${s.path}${s.search}`, it = a.panelTab ?? "variations", Le = a.zoom ?? 100, [ct, lt] = z(Le);
1861
+ return /* @__PURE__ */ b(
2389
1862
  "div",
2390
1863
  {
2391
1864
  className: "ds-root",
2392
1865
  "data-appearance": v,
2393
- "data-chrome": s.chrome ? "visible" : "hidden",
2394
- "data-resizing": k ? "true" : void 0,
2395
- "data-viewport": d.id,
1866
+ "data-chrome": a.chrome ? "visible" : "hidden",
1867
+ "data-resizing": g ? "true" : void 0,
1868
+ "data-viewport": i.id,
2396
1869
  children: [
2397
- s.chrome && /* @__PURE__ */ n(
2398
- Bt,
1870
+ a.chrome && /* @__PURE__ */ n(
1871
+ Ut,
2399
1872
  {
2400
1873
  productName: e.name,
2401
1874
  deploy: r,
2402
- viewportId: s.viewport,
2403
- viewport: d,
2404
- zoom: ht,
2405
- rotated: !!s.rotated,
2406
- highlight: !!s.highlight,
1875
+ viewportId: a.viewport,
1876
+ viewport: i,
1877
+ zoom: ct,
1878
+ rotated: !!a.rotated,
1879
+ highlight: !!a.highlight,
2407
1880
  theme: v,
2408
- issues: O,
2409
- linkUrl: dt,
2410
- onViewport: (_) => te({ viewport: _ }),
2411
- onRotate: () => te({ rotated: !s.rotated }),
2412
- onHighlight: () => te({ highlight: !s.highlight }),
2413
- onZoom: (_) => te({ zoom: _ }),
2414
- onCleanReview: B,
2415
- onOpenFrame: ct,
2416
- onToggleTheme: lt
1881
+ issues: F,
1882
+ linkUrl: at,
1883
+ onViewport: (M) => ee({ viewport: M }),
1884
+ onRotate: () => ee({ rotated: !a.rotated }),
1885
+ onHighlight: () => ee({ highlight: !a.highlight }),
1886
+ onZoom: (M) => ee({ zoom: M }),
1887
+ onCleanReview: q,
1888
+ onOpenFrame: rt,
1889
+ onToggleTheme: st
2417
1890
  }
2418
1891
  ),
2419
- /* @__PURE__ */ x("div", { className: "ds-body", children: [
2420
- s.chrome && /* @__PURE__ */ n(
2421
- Gt,
1892
+ /* @__PURE__ */ b("div", { className: "ds-body", children: [
1893
+ a.chrome && /* @__PURE__ */ n(
1894
+ Bt,
2422
1895
  {
2423
1896
  registry: t,
2424
1897
  handoff: T,
2425
- activeScreen: S?.id,
2426
- activeComponent: i?.id,
2427
- onOpenScreen: (_) => u(_),
2428
- onOpenComponent: (_) => h(_),
2429
- width: L,
2430
- onResize: b,
2431
- onResizeStart: () => y(!0),
2432
- onResizeEnd: () => y(!1)
1898
+ activeScreen: A?.id,
1899
+ activeComponent: L?.id,
1900
+ onOpenScreen: (M) => h(M),
1901
+ onOpenComponent: (M) => c(M),
1902
+ width: _,
1903
+ onResize: f,
1904
+ onResizeStart: () => N(!0),
1905
+ onResizeEnd: () => N(!1)
2433
1906
  }
2434
1907
  ),
2435
- /* @__PURE__ */ n("main", { className: "ds-main", children: A ? /* @__PURE__ */ x("div", { className: "ds-chrome-empty", children: [
2436
- /* @__PURE__ */ n("h1", { className: "ds-chrome-empty__title", children: a.shell.empty }),
2437
- /* @__PURE__ */ n("p", { className: "ds-muted", children: a.shell.emptyHint })
1908
+ /* @__PURE__ */ n("main", { className: "ds-main", children: R ? /* @__PURE__ */ b("div", { className: "ds-chrome-empty", children: [
1909
+ /* @__PURE__ */ n("h1", { className: "ds-chrome-empty__title", children: o.shell.empty }),
1910
+ /* @__PURE__ */ n("p", { className: "ds-muted", children: o.shell.emptyHint })
2438
1911
  ] }) : Z ? null : /* @__PURE__ */ n(
2439
- sn,
1912
+ tn,
2440
1913
  {
2441
- location: o,
2442
- viewport: d,
2443
- zoom: Re,
2444
- onEffectiveZoom: pt,
2445
- title: a.shell.frameTitle(e.name),
2446
- resizing: k,
2447
- onFrameNavigate: ce,
1914
+ location: s,
1915
+ viewport: i,
1916
+ zoom: Le,
1917
+ onEffectiveZoom: lt,
1918
+ title: o.shell.frameTitle(e.name),
1919
+ resizing: g,
1920
+ onFrameNavigate: se,
2448
1921
  onShortcut: Y,
2449
- frameRef: C
1922
+ frameRef: S
2450
1923
  }
2451
1924
  ) }),
2452
- s.chrome && /* @__PURE__ */ n(
2453
- en,
1925
+ a.chrome && /* @__PURE__ */ n(
1926
+ Zt,
2454
1927
  {
2455
1928
  registry: t,
2456
- controls: s,
2457
- deploy: r,
2458
- location: o,
2459
- screen: S,
2460
- variation: M,
2461
- component: i,
2462
- componentFixture: F,
2463
- tab: ut,
2464
- onTab: (_) => te({ panelTab: _ }),
2465
- onOpenScenario: p,
2466
- onOpenComponent: (_) => h(_),
2467
- onOpenScreen: (_) => u(_),
2468
- onChange: te,
1929
+ controls: a,
1930
+ screen: A,
1931
+ variation: O,
1932
+ component: L,
1933
+ componentFixture: G,
1934
+ tab: it,
1935
+ onTab: (M) => ee({ panelTab: M }),
1936
+ onOpenScenario: l,
1937
+ onOpenComponent: (M) => c(M),
1938
+ onOpenScreen: (M) => h(M),
1939
+ onChange: ee,
2469
1940
  width: m,
2470
- onResize: f,
2471
- onResizeStart: () => y(!0),
2472
- onResizeEnd: () => y(!1)
1941
+ onResize: w,
1942
+ onResizeStart: () => N(!0),
1943
+ onResizeEnd: () => N(!1)
2473
1944
  }
2474
1945
  )
2475
1946
  ] }),
2476
- !s.chrome && /* @__PURE__ */ n(
1947
+ !a.chrome && /* @__PURE__ */ n(
2477
1948
  "button",
2478
1949
  {
2479
1950
  type: "button",
2480
1951
  className: "ds-restore",
2481
- "aria-label": a.shell.restoreChrome,
2482
- title: a.shell.restoreChrome,
2483
- onClick: B,
1952
+ "aria-label": o.shell.restoreChrome,
1953
+ title: o.shell.restoreChrome,
1954
+ onClick: q,
2484
1955
  children: /* @__PURE__ */ n("span", { className: "ds-restore__dot", "aria-hidden": "true" })
2485
1956
  }
2486
1957
  )
@@ -2488,71 +1959,71 @@ function gn({ product: e, registry: t }) {
2488
1959
  }
2489
1960
  );
2490
1961
  }
2491
- function ge(e) {
1962
+ function ue(e) {
2492
1963
  return new Date(e.length === 10 ? `${e}T00:00:00` : e);
2493
1964
  }
2494
- function $n(e, t) {
2495
- const a = ge(e), r = ge(t);
2496
- let o = r.getFullYear() - a.getFullYear();
2497
- const s = r.getMonth() - a.getMonth();
2498
- return (s < 0 || s === 0 && r.getDate() < a.getDate()) && (o -= 1), o;
1965
+ function Rn(e, t) {
1966
+ const o = ue(e), r = ue(t);
1967
+ let s = r.getFullYear() - o.getFullYear();
1968
+ const a = r.getMonth() - o.getMonth();
1969
+ return (a < 0 || a === 0 && r.getDate() < o.getDate()) && (s -= 1), s;
2499
1970
  }
2500
- function Mn(e, t) {
2501
- const a = ge(e), r = ge(t);
2502
- return Math.floor((r.getTime() - a.getTime()) / 864e5);
1971
+ function Pn(e, t) {
1972
+ const o = ue(e), r = ue(t);
1973
+ return Math.floor((r.getTime() - o.getTime()) / 864e5);
2503
1974
  }
2504
1975
  export {
2505
- Oe as COMPONENT_ATTRIBUTE,
2506
- be as CONTROL_PARAM_PREFIX,
2507
- oe as DEFAULT_LABELS,
2508
- Nn as DesignSpace,
2509
- Cn as EN_US_LABELS,
2510
- xt as FRAME_ATTRIBUTE,
2511
- kt as FRAME_PARAM,
2512
- Tn as HANDOFF_PARAM,
2513
- xn as NETWORK_LABELS,
2514
- Ge as NETWORK_STATES,
2515
- $ as PARAM,
2516
- rt as SLOW_NETWORK_DELAY_MS,
2517
- at as SimulatedNetworkError,
2518
- Ke as StageEmpty,
2519
- _t as VIEWPORTS,
2520
- fe as ZOOM_DEFAULT,
2521
- _e as ZOOM_MAX,
2522
- Pe as ZOOM_MIN,
2523
- $n as ageInYears,
2524
- Ee as applyHandoffScope,
2525
- Ne as applyOverrides,
2526
- et as clampZoom,
2527
- Pn as commitUrl,
2528
- _n as componentUrl,
2529
- yn as createHttpAdapter,
2530
- Et as createRegistry,
2531
- Mn as daysBetween,
2532
- Le as fixtureAdapter,
2533
- Rn as formatIssues,
2534
- Nt as getDeployContext,
2535
- ve as handoffAllowsComponent,
2536
- je as handoffAllowsPath,
2537
- re as handoffAllowsScenario,
2538
- Fn as hasErrors,
2539
- On as matchPath,
2540
- An as normalizeHandoffScope,
2541
- X as normalizeSearch,
2542
- $e as parseControls,
2543
- bt as parseHandoffScope,
2544
- ge as parseIsoDate,
2545
- Me as resolveFixture,
2546
- Ht as resolveLabels,
2547
- ye as resolveRoute,
1976
+ de as COMPONENT_ATTRIBUTE,
1977
+ me as CONTROL_PARAM_PREFIX,
1978
+ On as DEFAULT_LABELS,
1979
+ Tn as DesignSpace,
1980
+ $n as EN_US_LABELS,
1981
+ St as FRAME_ATTRIBUTE,
1982
+ yt as FRAME_PARAM,
1983
+ Kn as HANDOFF_PARAM,
1984
+ zn as NETWORK_LABELS,
1985
+ He as NETWORK_STATES,
1986
+ y as PARAM,
1987
+ Ye as SLOW_NETWORK_DELAY_MS,
1988
+ Qe as SimulatedNetworkError,
1989
+ Oe as StageEmpty,
1990
+ Tt as VIEWPORTS,
1991
+ he as ZOOM_DEFAULT,
1992
+ Ee as ZOOM_MAX,
1993
+ Me as ZOOM_MIN,
1994
+ Rn as ageInYears,
1995
+ Ce as applyHandoffScope,
1996
+ In as applyOverrides,
1997
+ Ge as clampZoom,
1998
+ Wn as commitUrl,
1999
+ Un as componentUrl,
2000
+ _n as createHttpAdapter,
2001
+ mt as createRegistry,
2002
+ Pn as daysBetween,
2003
+ ke as fixtureAdapter,
2004
+ Hn as formatIssues,
2005
+ kt as getDeployContext,
2006
+ Se as handoffAllowsComponent,
2007
+ gt as handoffAllowsPath,
2008
+ Ne as handoffAllowsScenario,
2009
+ qn as hasErrors,
2010
+ Bn as matchPath,
2011
+ jn as normalizeHandoffScope,
2012
+ fe as normalizeSearch,
2013
+ ge as parseControls,
2014
+ wt as parseHandoffScope,
2015
+ ue as parseIsoDate,
2016
+ ve as resolveFixture,
2017
+ ft as resolveLabels,
2018
+ vt as resolveRoute,
2548
2019
  At as resolveViewport,
2549
- me as scenarioUrl,
2550
- se as serializeControls,
2551
- zn as serializeValue,
2552
- Xe as useDesignSpaceState,
2553
- J as useLabels,
2554
- dn as useScenarioData,
2555
- vt as validateProduct,
2556
- Dn as validateScenario
2020
+ Vn as scenarioUrl,
2021
+ oe as serializeControls,
2022
+ Gn as serializeValue,
2023
+ je as useDesignSpaceState,
2024
+ X as useLabels,
2025
+ rn as useScenarioData,
2026
+ Zn as validateProduct,
2027
+ Yn as validateScenario
2557
2028
  };
2558
2029
  //# sourceMappingURL=index.js.map