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