@pygmalionjs/pygmalion 0.2.39 → 0.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,27 @@
1
- import { jsxs as $, jsx as b } from "react/jsx-runtime";
2
- import { b as re, m as Ye, i as Ze, g as et, e as V, c as tt, a as nt, d as rt, f as ot, h as st, j as it, k as at, l as ct, n as be, o as lt, p as dt, q as ut, r as ft, t as mt, u as pt, v as Ne, w as gt, x as ht, y as yt, z as Re, A as Ae, B as de, C as wt, D as ue, E as Me, S as bt, G as St, H as $e, I as vt, J as Oe, K as It, L as xt, M as Pt, O as Ct, P as Et, Q as Nt, R as De } from "./App-CJz8NrxS.js";
3
- import { T as An, U as Mn, V as $n, W as On, X as Dn, Y as kn, Z as Fn, _ as Tn, $ as zn, a0 as _n, a1 as jn, a2 as Bn, a3 as Un, a4 as Hn, a5 as qn, a6 as Gn, a7 as Kn, a8 as Ln, a9 as Wn, aa as Vn, ab as Jn, ac as Qn, ad as Xn, ae as Yn, af as Zn, ag as er, ah as tr, ai as nr, aj as rr, ak as or, al as sr, am as ir, an as ar, ao as cr, ap as lr, aq as dr, ar as ur, as as fr, at as mr, au as pr, av as gr, aw as hr, ax as yr } from "./App-CJz8NrxS.js";
4
- import { createElement as ke, useMemo as oe, useState as ce, useRef as Ie, useCallback as ne, useEffect as le, useLayoutEffect as Fe } from "react";
5
- function xe(e, t = /* @__PURE__ */ new Set()) {
1
+ import { jsxs as $, jsx as S } from "react/jsx-runtime";
2
+ import { b as se, m as tt, i as lt, g as dt, e as X, S as ut, c as ft, a as mt, d as ht, f as pt, h as gt, j as yt, k as wt, l as bt, n as Se, o as vt, p as St, q as It, r as xt, t as Pt, u as Et, v as Ct, w as je, x as Rt, y as Nt, z as At, A as _e, B as Be, C as oe, D as $t, E as Mt, G as Ue, H as Ot, I as ye, J as we, K as Dt, L as He, M as kt, O as qe, P as Ft, Q as Tt, R as zt, T as jt, U as _t, V as Bt, W as Ke } from "./App-kzN-1Je6.js";
3
+ import { X as qn, Y as Kn, Z as Gn, _ as Ln, $ as Vn, a0 as Wn, a1 as Jn, a2 as Qn, a3 as Xn, a4 as Yn, a5 as Zn, a6 as er, a7 as tr, a8 as nr, a9 as rr, aa as or, ab as sr, ac as ir, ad as ar, ae as cr, af as lr, ag as dr, ah as ur, ai as fr, aj as mr, ak as hr, al as pr, am as gr, an as yr, ao as wr, ap as br, aq as vr, ar as Sr, as as Ir, at as xr, au as Pr, av as Er, aw as Cr, ax as Rr, ay as Nr, az as Ar, aA as $r, aB as Mr } from "./App-kzN-1Je6.js";
4
+ import { createElement as Ge, useMemo as ie, useState as fe, useRef as xe, useCallback as de, useEffect as me, useLayoutEffect as Le } from "react";
5
+ function Ut(e) {
6
+ return e.flatMap((t, o) => {
7
+ const r = t.id.trim() || `path:${o + 1}`, n = t.screenIds.map((s) => s.trim()).filter(Boolean);
8
+ return n.slice(1).map((s, l) => {
9
+ var a, u;
10
+ return {
11
+ id: `${r}:${l + 1}`,
12
+ from: n[l],
13
+ to: s,
14
+ kind: ((a = t.kind) == null ? void 0 : a.trim()) || "authored-path",
15
+ label: ((u = t.label) == null ? void 0 : u.trim()) || void 0
16
+ };
17
+ });
18
+ });
19
+ }
20
+ function De(e, t = /* @__PURE__ */ new Set()) {
6
21
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
7
22
  return e;
8
23
  if (Array.isArray(e))
9
- return e.map((r) => xe(r, t));
24
+ return e.map((r) => De(r, t));
10
25
  if (typeof e != "object") return null;
11
26
  if (t.has(e))
12
27
  throw new Error("A storyboard recipe cannot contain circular references.");
@@ -14,13 +29,13 @@ function xe(e, t = /* @__PURE__ */ new Set()) {
14
29
  const o = {};
15
30
  for (const r of Object.keys(e).sort()) {
16
31
  const n = e[r];
17
- n !== void 0 && (o[r] = xe(n, t));
32
+ n !== void 0 && (o[r] = De(n, t));
18
33
  }
19
34
  return t.delete(e), o;
20
35
  }
21
- function Rt(e) {
36
+ function Ht(e) {
22
37
  return JSON.stringify(
23
- xe({
38
+ De({
24
39
  version: 1,
25
40
  route: e.route ?? null,
26
41
  componentName: e.componentName ?? null,
@@ -39,34 +54,34 @@ function Rt(e) {
39
54
  })
40
55
  );
41
56
  }
42
- function z(e) {
57
+ function B(e) {
43
58
  return [...new Set([...e].map((t) => t == null ? void 0 : t.trim()).filter(Boolean))].sort((t, o) => t.localeCompare(o));
44
59
  }
45
- function At(e, t) {
60
+ function qt(e, t) {
46
61
  var r;
47
62
  return ((r = e.id) == null ? void 0 : r.trim()) || `edge:${t + 1}`;
48
63
  }
49
- function Mt(e) {
64
+ function Kt(e) {
50
65
  const t = [...e.screens].sort((r, n) => r.id.localeCompare(n.id)), o = t[0].id;
51
66
  return {
52
67
  id: `story:${o}`,
53
68
  canonicalScreenId: o,
54
69
  screenIds: t.map((r) => r.id),
55
- names: z(t.map((r) => r.name)),
70
+ names: B(t.map((r) => r.name)),
56
71
  recipeKey: e.recipeKey,
57
- routes: z(t.map((r) => r.route)),
58
- scenarioIds: z(
72
+ routes: B(t.map((r) => r.route)),
73
+ scenarioIds: B(
59
74
  t.flatMap((r) => [
60
75
  r.scenarioId,
61
76
  ...r.scenarioIds ?? []
62
77
  ])
63
78
  ),
64
- sourceKeys: z(t.map((r) => r.sourcePath)),
65
- flows: z(t.map((r) => r.flow)),
66
- states: z(t.map((r) => r.state))
79
+ sourceKeys: B(t.map((r) => r.sourcePath)),
80
+ flows: B(t.map((r) => r.flow)),
81
+ states: B(t.map((r) => r.state))
67
82
  };
68
83
  }
69
- function Te(e) {
84
+ function Ve(e) {
70
85
  return [
71
86
  e.code,
72
87
  e.edgeId,
@@ -75,286 +90,286 @@ function Te(e) {
75
90
  e.scenarioId
76
91
  ].join(":");
77
92
  }
78
- function $t(e) {
79
- var X, W;
93
+ function Gt(e) {
94
+ var Z, V;
80
95
  const t = [], o = [], r = /* @__PURE__ */ new Map();
81
- for (const i of e.screens) {
82
- const c = i.id.trim();
83
- if (!c || r.has(c)) {
96
+ for (const c of e.screens) {
97
+ const i = c.id.trim();
98
+ if (!i || r.has(i)) {
84
99
  t.push({
85
100
  code: "duplicate-screen-id",
86
101
  severity: "error",
87
- message: c ? `Multiple storyboard screens use the id "${c}".` : "A storyboard screen has an empty id.",
88
- screenId: c || void 0
102
+ message: i ? `Multiple storyboard screens use the id "${i}".` : "A storyboard screen has an empty id.",
103
+ screenId: i || void 0
89
104
  });
90
105
  continue;
91
106
  }
92
- const l = c === i.id ? i : { ...i, id: c };
93
- r.set(c, l), o.push(l);
107
+ const d = i === c.id ? c : { ...c, id: i };
108
+ r.set(i, d), o.push(d);
94
109
  }
95
110
  const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
96
- for (const i of o) {
97
- let c;
111
+ for (const c of o) {
112
+ let i;
98
113
  try {
99
- if (c = (e.recipeKey ?? Rt)(i), !c.trim()) throw new Error("Recipe keys cannot be empty.");
114
+ if (i = (e.recipeKey ?? Ht)(c), !i.trim()) throw new Error("Recipe keys cannot be empty.");
100
115
  } catch (g) {
101
- s.add(i.id), t.push({
116
+ s.add(c.id), t.push({
102
117
  code: "invalid-recipe",
103
118
  severity: "error",
104
119
  message: g instanceof Error ? g.message : "Storyboard recipe identity could not be created.",
105
- screenId: i.id
106
- }), c = `invalid:${i.id}`;
120
+ screenId: c.id
121
+ }), i = `invalid:${c.id}`;
107
122
  }
108
- const l = n.get(c);
109
- l ? l.screens.push(i) : n.set(c, { recipeKey: c, screens: [i] });
123
+ const d = n.get(i);
124
+ d ? d.screens.push(c) : n.set(i, { recipeKey: i, screens: [c] });
110
125
  }
111
- const a = [...n.values()].map(Mt).sort((i, c) => i.id.localeCompare(c.id)), d = {};
112
- for (const i of a)
113
- for (const c of i.screenIds) d[c] = i.id;
114
- const u = new Map(a.map((i) => [i.id, i])), h = (i, c) => z([
115
- c,
116
- ...(i ?? []).flatMap((l) => {
117
- const g = l.trim(), P = d[g] ?? (u.has(g) ? g : null);
118
- return P ? [P] : [];
126
+ const l = [...n.values()].map(Kt).sort((c, i) => c.id.localeCompare(i.id)), a = {};
127
+ for (const c of l)
128
+ for (const i of c.screenIds) a[i] = c.id;
129
+ const u = new Map(l.map((c) => [c.id, c])), w = (c, i) => B([
130
+ i,
131
+ ...(c ?? []).flatMap((d) => {
132
+ const g = d.trim(), I = a[g] ?? (u.has(g) ? g : null);
133
+ return I ? [I] : [];
119
134
  })
120
- ]), m = /* @__PURE__ */ new Map();
121
- for (const i of e.assets ?? []) {
122
- const c = m.get(i.pageId);
123
- c ? c.push(i) : m.set(i.pageId, [i]);
135
+ ]), h = /* @__PURE__ */ new Map();
136
+ for (const c of e.assets ?? []) {
137
+ const i = h.get(c.pageId);
138
+ i ? i.push(c) : h.set(c.pageId, [c]);
124
139
  }
125
- const y = a.map((i) => {
126
- const c = i.screenIds.flatMap(
127
- (l) => m.get(l) ?? []
140
+ const p = l.map((c) => {
141
+ const i = c.screenIds.flatMap(
142
+ (d) => h.get(d) ?? []
128
143
  );
129
144
  return {
130
- ...i,
131
- scenarioIds: z([
132
- ...i.scenarioIds,
133
- ...c.map((l) => l.scenarioId)
145
+ ...c,
146
+ scenarioIds: B([
147
+ ...c.scenarioIds,
148
+ ...i.map((d) => d.scenarioId)
134
149
  ]),
135
- sourceKeys: z([
136
- ...i.sourceKeys,
137
- ...c.map((l) => l.sourcePath)
150
+ sourceKeys: B([
151
+ ...c.sourceKeys,
152
+ ...i.map((d) => d.sourcePath)
138
153
  ])
139
154
  };
140
- }), I = /* @__PURE__ */ new Map();
141
- for (const i of y)
142
- for (const c of i.routes) {
143
- const l = I.get(c);
144
- l ? l.push(i.id) : I.set(c, [i.id]);
155
+ }), E = /* @__PURE__ */ new Map();
156
+ for (const c of p)
157
+ for (const i of c.routes) {
158
+ const d = E.get(i);
159
+ d ? d.push(c.id) : E.set(i, [c.id]);
145
160
  }
146
- const x = (i, c, l) => {
147
- const g = i.trim(), P = d[g] ?? (u.has(g) ? g : null);
148
- if (P) return P;
149
- const A = z(I.get(g) ?? []);
150
- return A.length === 1 ? A[0] : A.length > 1 ? (t.push({
151
- code: l === "source" ? "ambiguous-edge-source" : "ambiguous-edge-target",
161
+ const b = (c, i, d) => {
162
+ const g = c.trim(), I = a[g] ?? (u.has(g) ? g : null);
163
+ if (I) return I;
164
+ const m = B(E.get(g) ?? []);
165
+ return m.length === 1 ? m[0] : m.length > 1 ? (t.push({
166
+ code: d === "source" ? "ambiguous-edge-source" : "ambiguous-edge-target",
152
167
  severity: "error",
153
- message: `Storyboard edge "${c}" references an ambiguous ${l} route.`,
154
- edgeId: c,
168
+ message: `Storyboard edge "${i}" references an ambiguous ${d} route.`,
169
+ edgeId: i,
155
170
  screenId: g || void 0
156
171
  }), null) : (t.push({
157
- code: l === "source" ? "unknown-edge-source" : "unknown-edge-target",
172
+ code: d === "source" ? "unknown-edge-source" : "unknown-edge-target",
158
173
  severity: "error",
159
- message: `Storyboard edge "${c}" references an unknown ${l}.`,
160
- edgeId: c,
174
+ message: `Storyboard edge "${i}" references an unknown ${d}.`,
175
+ edgeId: i,
161
176
  screenId: g || void 0
162
177
  }), null);
163
- }, p = [], C = /* @__PURE__ */ new Map(), f = [
178
+ }, y = [], P = /* @__PURE__ */ new Map(), f = [
164
179
  ["explicit", e.explicitEdges ?? []],
165
180
  ["inferred", e.inferredEdges ?? []]
166
181
  ];
167
- let M = 0;
168
- for (const [i, c] of f)
169
- for (const l of c) {
170
- const g = At(l, M);
171
- M += 1;
172
- const P = x(l.from, g, "source"), A = x(l.to, g, "target");
173
- if (!P || !A || P === A) continue;
174
- const k = h(l.fromScope, P), q = h(l.toScope, A), E = `${P}\0${A}`, v = C.get(E);
175
- if (v) {
176
- const T = {
177
- ...v,
178
- fromNodeIds: z([
179
- ...v.fromNodeIds ?? [v.from],
180
- ...k
182
+ let R = 0;
183
+ for (const [c, i] of f)
184
+ for (const d of i) {
185
+ const g = qt(d, R);
186
+ R += 1;
187
+ const I = b(d.from, g, "source"), m = b(d.to, g, "target");
188
+ if (!I || !m || I === m) continue;
189
+ const N = w(d.fromScope, I), O = w(d.toScope, m), K = `${I}\0${m}`, F = P.get(K);
190
+ if (F) {
191
+ const ce = {
192
+ ...F,
193
+ fromNodeIds: B([
194
+ ...F.fromNodeIds ?? [F.from],
195
+ ...N
181
196
  ]),
182
- toNodeIds: z([
183
- ...v.toNodeIds ?? [v.to],
184
- ...q
197
+ toNodeIds: B([
198
+ ...F.toNodeIds ?? [F.to],
199
+ ...O
185
200
  ]),
186
- sourceEdgeIds: z([
187
- ...v.sourceEdgeIds,
201
+ sourceEdgeIds: B([
202
+ ...F.sourceEdgeIds,
188
203
  g
189
204
  ])
190
205
  };
191
- C.set(E, T);
192
- const G = p.indexOf(v);
193
- G >= 0 && (p[G] = T);
206
+ P.set(K, ce);
207
+ const pe = y.indexOf(F);
208
+ pe >= 0 && (y[pe] = ce);
194
209
  continue;
195
210
  }
196
- const R = {
211
+ const q = {
197
212
  id: g,
198
- from: P,
199
- to: A,
200
- fromNodeIds: k,
201
- toNodeIds: q,
202
- kind: ((X = l.kind) == null ? void 0 : X.trim()) || void 0,
203
- label: ((W = l.label) == null ? void 0 : W.trim()) || void 0,
204
- origin: i,
213
+ from: I,
214
+ to: m,
215
+ fromNodeIds: N,
216
+ toNodeIds: O,
217
+ kind: ((Z = d.kind) == null ? void 0 : Z.trim()) || void 0,
218
+ label: ((V = d.label) == null ? void 0 : V.trim()) || void 0,
219
+ origin: c,
205
220
  sourceEdgeIds: [g]
206
221
  };
207
- C.set(E, R), p.push(R);
222
+ P.set(K, q), y.push(q);
208
223
  }
209
- p.sort(
210
- (i, c) => `${i.from}:${i.to}:${i.id}`.localeCompare(`${c.from}:${c.to}:${c.id}`)
224
+ y.sort(
225
+ (c, i) => `${c.from}:${c.to}:${c.id}`.localeCompare(`${i.from}:${i.to}:${i.id}`)
211
226
  );
212
- const D = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
213
- for (const i of p) {
214
- for (const c of i.fromNodeIds ?? [i.from]) {
215
- const l = w.get(c);
216
- l ? l.push(i) : w.set(c, [i]);
227
+ const D = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
228
+ for (const c of y) {
229
+ for (const i of c.fromNodeIds ?? [c.from]) {
230
+ const d = v.get(i);
231
+ d ? d.push(c) : v.set(i, [c]);
217
232
  }
218
- for (const c of i.toNodeIds ?? [i.to]) {
219
- const l = D.get(c);
220
- l ? l.push(i) : D.set(c, [i]);
233
+ for (const i of c.toNodeIds ?? [c.to]) {
234
+ const d = D.get(i);
235
+ d ? d.push(c) : D.set(i, [c]);
221
236
  }
222
237
  }
223
- const O = [];
224
- for (const i of e.startScreenIds ?? []) {
225
- const c = i.trim(), l = d[c] ?? (u.has(c) ? c : null);
226
- if (!l) {
238
+ const M = [];
239
+ for (const c of e.startScreenIds ?? []) {
240
+ const i = c.trim(), d = a[i] ?? (u.has(i) ? i : null);
241
+ if (!d) {
227
242
  t.push({
228
243
  code: "unknown-start-screen",
229
244
  severity: "error",
230
- message: `Storyboard start references an unknown screen "${c}".`,
231
- screenId: c || void 0
245
+ message: `Storyboard start references an unknown screen "${i}".`,
246
+ screenId: i || void 0
232
247
  });
233
248
  continue;
234
249
  }
235
- O.push(l);
250
+ M.push(d);
236
251
  }
237
- const Z = new Set(O);
238
- let S = z(O);
239
- S.length || (S = y.filter((i) => {
240
- var c;
241
- return (((c = D.get(i.id)) == null ? void 0 : c.length) ?? 0) === 0;
242
- }).map((i) => i.id).sort((i, c) => i.localeCompare(c))), !S.length && y.length && (S = [y[0].id]);
243
- const N = /* @__PURE__ */ new Set(), F = [...S];
244
- for (; F.length; ) {
245
- const i = F.shift();
246
- if (!N.has(i)) {
247
- N.add(i);
248
- for (const c of w.get(i) ?? [])
249
- F.push(c.to), i === c.from && F.push(...c.toNodeIds ?? [c.to]);
252
+ const te = new Set(M);
253
+ let x = B(M);
254
+ x.length || (x = p.filter((c) => {
255
+ var i;
256
+ return (((i = D.get(c.id)) == null ? void 0 : i.length) ?? 0) === 0;
257
+ }).map((c) => c.id).sort((c, i) => c.localeCompare(i))), !x.length && p.length && (x = [p[0].id]);
258
+ const C = /* @__PURE__ */ new Set(), j = [...x];
259
+ for (; j.length; ) {
260
+ const c = j.shift();
261
+ if (!C.has(c)) {
262
+ C.add(c);
263
+ for (const i of v.get(c) ?? [])
264
+ j.push(i.to), c === i.from && j.push(...i.toNodeIds ?? [i.to]);
250
265
  }
251
266
  }
252
- const _ = y.filter((i) => {
253
- var l, g;
254
- const c = (((l = D.get(i.id)) == null ? void 0 : l.length) ?? 0) === 0 && (((g = w.get(i.id)) == null ? void 0 : g.length) ?? 0) === 0 && !Z.has(i.id);
255
- return !N.has(i.id) || c && y.length > 1;
267
+ const H = p.filter((c) => {
268
+ var d, g;
269
+ const i = (((d = D.get(c.id)) == null ? void 0 : d.length) ?? 0) === 0 && (((g = v.get(c.id)) == null ? void 0 : g.length) ?? 0) === 0 && !te.has(c.id);
270
+ return !C.has(c.id) || i && p.length > 1;
256
271
  });
257
- for (const i of _)
258
- for (const c of i.screenIds)
272
+ for (const c of H)
273
+ for (const i of c.screenIds)
259
274
  t.push({
260
275
  code: "disconnected-screen",
261
276
  severity: "warning",
262
- message: `Storyboard screen "${c}" is not connected to a graph branch.`,
263
- screenId: c,
264
- nodeId: i.id
277
+ message: `Storyboard screen "${i}" is not connected to a graph branch.`,
278
+ screenId: i,
279
+ nodeId: c.id
265
280
  });
266
- const J = /* @__PURE__ */ new Map();
267
- for (const i of y)
268
- for (const c of i.sourceKeys) {
269
- const l = J.get(c) ?? {
281
+ const Q = /* @__PURE__ */ new Map();
282
+ for (const c of p)
283
+ for (const i of c.sourceKeys) {
284
+ const d = Q.get(i) ?? {
270
285
  nodeIds: /* @__PURE__ */ new Set(),
271
286
  screenIds: /* @__PURE__ */ new Set()
272
287
  };
273
- l.nodeIds.add(i.id);
274
- for (const g of i.screenIds) l.screenIds.add(g);
275
- J.set(c, l);
288
+ d.nodeIds.add(c.id);
289
+ for (const g of c.screenIds) d.screenIds.add(g);
290
+ Q.set(i, d);
276
291
  }
277
- const se = [...J.entries()].map(([i, c]) => ({
278
- sourceKey: i,
279
- nodeIds: [...c.nodeIds].sort((l, g) => l.localeCompare(g)),
280
- screenIds: [...c.screenIds].sort((l, g) => l.localeCompare(g)),
281
- shared: c.nodeIds.size > 1
282
- })).sort((i, c) => i.sourceKey.localeCompare(c.sourceKey)), ie = y.map((i) => {
283
- const c = [...w.get(i.id) ?? []].sort(
284
- (l, g) => l.id.localeCompare(g.id)
292
+ const he = [...Q.entries()].map(([c, i]) => ({
293
+ sourceKey: c,
294
+ nodeIds: [...i.nodeIds].sort((d, g) => d.localeCompare(g)),
295
+ screenIds: [...i.screenIds].sort((d, g) => d.localeCompare(g)),
296
+ shared: i.nodeIds.size > 1
297
+ })).sort((c, i) => c.sourceKey.localeCompare(i.sourceKey)), ue = p.map((c) => {
298
+ const i = [...v.get(c.id) ?? []].sort(
299
+ (d, g) => d.id.localeCompare(g.id)
285
300
  );
286
301
  return {
287
- nodeId: i.id,
288
- edgeIds: c.map((l) => l.id),
289
- targetNodeIds: z(c.map((l) => l.to))
302
+ nodeId: c.id,
303
+ edgeIds: i.map((d) => d.id),
304
+ targetNodeIds: B(i.map((d) => d.to))
290
305
  };
291
- }).filter((i) => i.targetNodeIds.length > 1).sort((i, c) => i.nodeId.localeCompare(c.nodeId)), ee = new Set(
292
- y.flatMap((i) => i.scenarioIds)
293
- ), K = new Set(
294
- (e.nonVisualScenarioIds ?? []).map((i) => i.trim())
295
- ), Q = z(
296
- (e.scenarios ?? []).map((i) => i.id)
297
- ), B = Q.filter(
298
- (i) => !ee.has(i) && !K.has(i)
306
+ }).filter((c) => c.targetNodeIds.length > 1).sort((c, i) => c.nodeId.localeCompare(i.nodeId)), W = new Set(
307
+ p.flatMap((c) => c.scenarioIds)
308
+ ), ae = new Set(
309
+ (e.nonVisualScenarioIds ?? []).map((c) => c.trim())
310
+ ), ne = B(
311
+ (e.scenarios ?? []).map((c) => c.id)
312
+ ), Y = ne.filter(
313
+ (c) => !W.has(c) && !ae.has(c)
299
314
  );
300
- for (const i of B)
315
+ for (const c of Y)
301
316
  t.push({
302
317
  code: "missing-code-scenario",
303
318
  severity: "warning",
304
- message: `Code scenario "${i}" is not represented in the storyboard.`,
305
- scenarioId: i
319
+ message: `Code scenario "${c}" is not represented in the storyboard.`,
320
+ scenarioId: c
306
321
  });
307
322
  t.sort(
308
- (i, c) => Te(i).localeCompare(Te(c))
323
+ (c, i) => Ve(c).localeCompare(Ve(i))
309
324
  );
310
- const L = z(
311
- _.flatMap((i) => i.screenIds)
312
- ), te = {
325
+ const re = B(
326
+ H.flatMap((c) => c.screenIds)
327
+ ), J = {
313
328
  screens: o.length,
314
- canonicalNodes: y.length,
315
- mergedScreens: Math.max(0, o.length - y.length),
316
- edges: p.length,
317
- connectedNodes: y.length - _.length,
318
- disconnectedScreens: L,
319
- codeScenarios: Q.length,
320
- representedScenarios: Q.filter(
321
- (i) => ee.has(i)
329
+ canonicalNodes: p.length,
330
+ mergedScreens: Math.max(0, o.length - p.length),
331
+ edges: y.length,
332
+ connectedNodes: p.length - H.length,
333
+ disconnectedScreens: re,
334
+ codeScenarios: ne.length,
335
+ representedScenarios: ne.filter(
336
+ (c) => W.has(c)
322
337
  ).length,
323
- missingScenarios: B,
324
- complete: L.length === 0 && B.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
338
+ missingScenarios: Y,
339
+ complete: re.length === 0 && Y.length === 0 && !t.some((c) => c.severity === "error") && s.size === 0
325
340
  };
326
341
  return {
327
342
  version: 1,
328
- nodes: y,
329
- edges: p,
343
+ nodes: p,
344
+ edges: y,
330
345
  aliases: Object.fromEntries(
331
- Object.entries(d).sort(([i], [c]) => i.localeCompare(c))
346
+ Object.entries(a).sort(([c], [i]) => c.localeCompare(i))
332
347
  ),
333
- sourceGroups: se,
334
- startNodeIds: S,
335
- branches: ie,
348
+ sourceGroups: he,
349
+ startNodeIds: x,
350
+ branches: ue,
336
351
  warnings: t,
337
- coverage: te
352
+ coverage: J
338
353
  };
339
354
  }
340
- function Ot(e) {
355
+ function Lt(e) {
341
356
  return e ? JSON.parse(JSON.stringify(e)) : void 0;
342
357
  }
343
- function me(e) {
344
- if (Array.isArray(e)) return e.map(me);
358
+ function Pe(e) {
359
+ if (Array.isArray(e)) return e.map(Pe);
345
360
  if (e && typeof e == "object") {
346
- const t = Object.entries(e).filter(([, o]) => o !== void 0).sort(([o], [r]) => o.localeCompare(r)).map(([o, r]) => [o, me(r)]).filter(([, o]) => o !== void 0);
361
+ const t = Object.entries(e).filter(([, o]) => o !== void 0).sort(([o], [r]) => o.localeCompare(r)).map(([o, r]) => [o, Pe(r)]).filter(([, o]) => o !== void 0);
347
362
  return t.length ? Object.fromEntries(t) : void 0;
348
363
  }
349
364
  return e;
350
365
  }
351
- function ze(e) {
352
- return JSON.stringify(me(e ?? null));
366
+ function We(e) {
367
+ return JSON.stringify(Pe(e ?? null));
353
368
  }
354
- function Dt(e) {
369
+ function Vt(e) {
355
370
  return !!(e && typeof e == "object" && !Array.isArray(e));
356
371
  }
357
- function H(e) {
372
+ function L(e) {
358
373
  const t = e == null ? void 0 : e.trim();
359
374
  if (!t) return null;
360
375
  let o = t;
@@ -365,25 +380,28 @@ function H(e) {
365
380
  }
366
381
  return o = o.split(/[?#]/, 1)[0].replace(/\/{2,}/g, "/"), o.startsWith("/") || (o = `/${o}`), o.length > 1 && (o = o.replace(/\/+$/, "")), o || "/";
367
382
  }
368
- function Ge(e) {
369
- return `source-route:${encodeURIComponent(e)}`;
383
+ function nt(e) {
384
+ const t = L(e);
385
+ if (!t)
386
+ throw new Error("A storyboard source route must be a non-empty path.");
387
+ return `source-route:${encodeURIComponent(t)}`;
370
388
  }
371
- function Ee(e, t) {
389
+ function Te(e, t) {
372
390
  const o = e.split("/").filter(Boolean), r = t.split("/").filter(Boolean);
373
391
  let n = 0;
374
392
  for (let s = 0; s < o.length; s += 1) {
375
- const a = o[s];
376
- if (a === "*" || a.startsWith("*")) return !0;
377
- const d = r[n];
378
- if (!(a.endsWith("?") && d == null)) {
379
- if (d == null || !a.startsWith(":") && a !== d) return !1;
393
+ const l = o[s];
394
+ if (l === "*" || l.startsWith("*")) return !0;
395
+ const a = r[n];
396
+ if (!(l.endsWith("?") && a == null)) {
397
+ if (a == null || !l.startsWith(":") && l !== a) return !1;
380
398
  n += 1;
381
399
  }
382
400
  }
383
401
  return n === r.length;
384
402
  }
385
- function _e(e, t, o) {
386
- const r = H(e);
403
+ function Je(e, t, o) {
404
+ const r = L(e);
387
405
  if (!r) return [];
388
406
  const n = t.get(r);
389
407
  return n && !/[:*]/.test(r) ? [
@@ -391,18 +409,18 @@ function _e(e, t, o) {
391
409
  representativeId: n,
392
410
  screenIds: o.get(r) ?? [n]
393
411
  }
394
- ] : [...t.entries()].filter(([s]) => Ee(r, s)).map(([s, a]) => ({
395
- representativeId: a,
396
- screenIds: o.get(s) ?? [a]
397
- })).sort((s, a) => s.representativeId.localeCompare(a.representativeId));
412
+ ] : [...t.entries()].filter(([s]) => Te(r, s)).map(([s, l]) => ({
413
+ representativeId: l,
414
+ screenIds: o.get(s) ?? [l]
415
+ })).sort((s, l) => s.representativeId.localeCompare(l.representativeId));
398
416
  }
399
- function kt(e) {
417
+ function Wt(e) {
400
418
  var o;
401
419
  const t = /* @__PURE__ */ new Map();
402
420
  for (const r of e ?? []) {
403
- const n = H(r.path);
421
+ const n = L(r.path);
404
422
  !n || t.has(n) || t.set(n, {
405
- id: Ge(n),
423
+ id: nt(n),
406
424
  name: n,
407
425
  section: "Source routes",
408
426
  codeName: ((o = r.id) == null ? void 0 : o.trim()) || void 0
@@ -410,56 +428,56 @@ function kt(e) {
410
428
  }
411
429
  return [...t.values()].sort((r, n) => r.id.localeCompare(n.id));
412
430
  }
413
- function Ft(e, t, o, r) {
431
+ function Jt(e, t, o, r) {
414
432
  return (e ?? []).flatMap((n, s) => {
415
- var y, I, x;
416
- const a = (y = n.from) == null ? void 0 : y.trim(), d = (I = n.to) == null ? void 0 : I.trim();
417
- if (!a || !d || n.unresolvedTarget) return [];
418
- const u = r.has(a) ? [{ representativeId: a, screenIds: [a] }] : _e(a, t, o), h = r.has(d) ? [{ representativeId: d, screenIds: [d] }] : _e(d, t, o);
419
- if (!u.length || !h.length) return [];
420
- const m = ((x = n.id) == null ? void 0 : x.trim()) || `discovery-edge:${s + 1}`;
433
+ var p, E, b;
434
+ const l = (p = n.from) == null ? void 0 : p.trim(), a = (E = n.to) == null ? void 0 : E.trim();
435
+ if (!l || !a || n.unresolvedTarget) return [];
436
+ const u = r.has(l) ? [{ representativeId: l, screenIds: [l] }] : Je(l, t, o), w = r.has(a) ? [{ representativeId: a, screenIds: [a] }] : Je(a, t, o);
437
+ if (!u.length || !w.length) return [];
438
+ const h = ((b = n.id) == null ? void 0 : b.trim()) || `discovery-edge:${s + 1}`;
421
439
  return u.flatMap(
422
- (p, C) => h.map((f, M) => {
423
- var D, w;
440
+ (y, P) => w.map((f, R) => {
441
+ var D, v;
424
442
  return {
425
- id: u.length === 1 && h.length === 1 ? m : `${m}:${C + 1}:${M + 1}`,
426
- from: p.representativeId,
443
+ id: u.length === 1 && w.length === 1 ? h : `${h}:${P + 1}:${R + 1}`,
444
+ from: y.representativeId,
427
445
  to: f.representativeId,
428
- fromScope: p.screenIds,
446
+ fromScope: y.screenIds,
429
447
  toScope: f.screenIds,
430
448
  kind: ((D = n.kind) == null ? void 0 : D.trim()) || void 0,
431
- label: ((w = n.label) == null ? void 0 : w.trim()) || void 0
449
+ label: ((v = n.label) == null ? void 0 : v.trim()) || void 0
432
450
  };
433
451
  })
434
452
  );
435
453
  });
436
454
  }
437
- function Tt(e, t, o) {
438
- const r = H(e.route);
455
+ function Qt(e, t, o) {
456
+ const r = L(e.route);
439
457
  if (!r) return [];
440
458
  const n = t.filter(
441
- (d) => {
442
- const u = H(d.route);
443
- return u ? Ee(u, r) : !1;
459
+ (a) => {
460
+ const u = L(a.route);
461
+ return u ? Te(u, r) : !1;
444
462
  }
445
463
  );
446
464
  if (!n.length) return [];
447
- const s = ze(
448
- Ye(o, e.environment)
449
- ), a = n.filter(
450
- (d) => ze(d.environment) === s
465
+ const s = We(
466
+ tt(o, e.environment)
467
+ ), l = n.filter(
468
+ (a) => We(a.environment) === s
451
469
  );
452
470
  return [
453
471
  ...new Set(
454
- a.map((d) => {
472
+ l.map((a) => {
455
473
  var u;
456
- return (u = d.scenarioId) == null ? void 0 : u.trim();
457
- }).filter((d) => !!d)
474
+ return (u = a.scenarioId) == null ? void 0 : u.trim();
475
+ }).filter((a) => !!a)
458
476
  )
459
- ].sort((d, u) => d.localeCompare(u));
477
+ ].sort((a, u) => a.localeCompare(u));
460
478
  }
461
- function zt(e, t) {
462
- const o = e.some((s) => s.importKind != null), r = t.candidates ?? [], n = Le(t);
479
+ function Xt(e, t) {
480
+ const o = e.some((s) => s.importKind != null), r = t.candidates ?? [], n = ot(t);
463
481
  return e.filter(
464
482
  (s) => o ? s.importKind === "screens" : !!s.route
465
483
  ).map((s) => ({
@@ -480,42 +498,42 @@ function zt(e, t) {
480
498
  scenario: s.scenario,
481
499
  state: s.state,
482
500
  scenarioId: s.scenarioId,
483
- scenarioIds: Tt(s, r, n),
501
+ scenarioIds: Qt(s, r, n),
484
502
  interactions: s.interactions,
485
503
  environment: s.environment,
486
504
  preset: s.preset,
487
505
  assertions: s.assertions,
488
- sourcePath: [...s.sourcePaths ?? []].filter(Boolean).sort((a, d) => a.localeCompare(d))[0]
506
+ sourcePath: [...s.sourcePaths ?? []].filter(Boolean).sort((l, a) => l.localeCompare(a))[0]
489
507
  }));
490
508
  }
491
- function ye(e, t) {
492
- var d, u, h, m;
493
- const o = (((d = e.interactions) == null ? void 0 : d.length) ?? 0) - (((u = t.interactions) == null ? void 0 : u.length) ?? 0);
509
+ function Ne(e, t) {
510
+ var a, u, w, h;
511
+ const o = (((a = e.interactions) == null ? void 0 : a.length) ?? 0) - (((u = t.interactions) == null ? void 0 : u.length) ?? 0);
494
512
  if (o !== 0) return o;
495
- const r = (h = e.scenarioIds) != null && h.includes("environment:baseline") ? 0 : 1, n = (m = t.scenarioIds) != null && m.includes("environment:baseline") ? 0 : 1;
513
+ const r = (w = e.scenarioIds) != null && w.includes("environment:baseline") ? 0 : 1, n = (h = t.scenarioIds) != null && h.includes("environment:baseline") ? 0 : 1;
496
514
  if (r !== n) return r - n;
497
- const s = !e.environment && !e.preset ? 0 : 1, a = !t.environment && !t.preset ? 0 : 1;
498
- return s !== a ? s - a : e.id.localeCompare(t.id);
515
+ const s = !e.environment && !e.preset ? 0 : 1, l = !t.environment && !t.preset ? 0 : 1;
516
+ return s !== l ? s - l : e.id.localeCompare(t.id);
499
517
  }
500
- function _t(e) {
518
+ function Yt(e) {
501
519
  const t = /* @__PURE__ */ new Map();
502
520
  for (const o of e) {
503
- const r = H(o.route);
521
+ const r = L(o.route);
504
522
  if (!r) continue;
505
523
  const n = t.get(r);
506
524
  n ? n.push(o) : t.set(r, [o]);
507
525
  }
508
526
  return new Map(
509
527
  [...t.entries()].map(([o, r]) => {
510
- const n = [...r].sort(ye);
528
+ const n = [...r].sort(Ne);
511
529
  return [o, n[0].id];
512
530
  })
513
531
  );
514
532
  }
515
- function jt(e) {
533
+ function Zt(e) {
516
534
  const t = /* @__PURE__ */ new Map();
517
535
  for (const o of e) {
518
- const r = H(o.route);
536
+ const r = L(o.route);
519
537
  if (!r) continue;
520
538
  const n = t.get(r);
521
539
  n ? n.push(o.id) : t.set(r, [o.id]);
@@ -527,9 +545,9 @@ function jt(e) {
527
545
  ])
528
546
  );
529
547
  }
530
- function Bt(e) {
548
+ function en(e) {
531
549
  return e.action === "wait" ? null : JSON.stringify(
532
- me({
550
+ Pe({
533
551
  action: e.action,
534
552
  selector: e.selector,
535
553
  text: e.text,
@@ -543,74 +561,74 @@ function Bt(e) {
543
561
  })
544
562
  );
545
563
  }
546
- function Ke(e) {
547
- return (e.interactions ?? []).map(Bt).filter((t) => t != null);
564
+ function rt(e) {
565
+ return (e.interactions ?? []).map(en).filter((t) => t != null);
548
566
  }
549
- function Ut(e, t) {
567
+ function tn(e, t) {
550
568
  return e.length < t.length && e.every((o, r) => o === t[r]);
551
569
  }
552
- function Ht(e, t) {
570
+ function nn(e, t) {
553
571
  const o = /* @__PURE__ */ new Map();
554
572
  for (const r of e) {
555
- const n = H(r.route);
573
+ const n = L(r.route);
556
574
  if (!n) continue;
557
- const s = `${n}\0${Ke(r).join("")}`, a = o.get(s);
558
- a ? a.push(r) : o.set(s, [r]);
575
+ const s = `${n}\0${rt(r).join("")}`, l = o.get(s);
576
+ l ? l.push(r) : o.set(s, [r]);
559
577
  }
560
578
  return [...o.values()].flatMap((r) => {
561
579
  if (r.length < 2) return [];
562
- const n = H(r[0].route), s = t.get(n), a = r.find((d) => d.id === s) ?? [...r].sort(ye)[0];
563
- return r.filter((d) => d.id !== a.id).sort((d, u) => d.id.localeCompare(u.id)).map((d) => ({
564
- id: `discovery-variant:${encodeURIComponent(a.id)}:${encodeURIComponent(d.id)}`,
565
- from: a.id,
566
- to: d.id,
580
+ const n = L(r[0].route), s = t.get(n), l = r.find((a) => a.id === s) ?? [...r].sort(Ne)[0];
581
+ return r.filter((a) => a.id !== l.id).sort((a, u) => a.id.localeCompare(u.id)).map((a) => ({
582
+ id: `discovery-variant:${encodeURIComponent(l.id)}:${encodeURIComponent(a.id)}`,
583
+ from: l.id,
584
+ to: a.id,
567
585
  kind: "variant"
568
586
  }));
569
587
  });
570
588
  }
571
- function qt(e, t) {
589
+ function rn(e, t) {
572
590
  const o = /* @__PURE__ */ new Map();
573
591
  for (const r of e) {
574
- const n = H(r.route);
592
+ const n = L(r.route);
575
593
  if (!n) continue;
576
594
  const s = o.get(n);
577
595
  s ? s.push(r) : o.set(n, [r]);
578
596
  }
579
597
  return [...o.entries()].flatMap(([r, n]) => {
580
598
  const s = new Map(
581
- n.map((u) => [u.id, Ke(u)])
582
- ), a = t.get(r), d = n.find(
583
- (u) => u.id === a
599
+ n.map((u) => [u.id, rt(u)])
600
+ ), l = t.get(r), a = n.find(
601
+ (u) => u.id === l
584
602
  );
585
603
  return n.flatMap((u) => {
586
- const h = s.get(u.id);
587
- if (!h.length) return [];
588
- const y = n.filter(
589
- (I) => Ut(
590
- s.get(I.id),
591
- h
604
+ const w = s.get(u.id);
605
+ if (!w.length) return [];
606
+ const p = n.filter(
607
+ (E) => tn(
608
+ s.get(E.id),
609
+ w
592
610
  )
593
- ).sort((I, x) => {
594
- const p = s.get(x.id).length - s.get(I.id).length;
595
- if (p !== 0) return p;
596
- const C = I.flow && I.flow === u.flow ? 0 : 1, f = x.flow && x.flow === u.flow ? 0 : 1;
597
- if (C !== f) return C - f;
598
- const M = I.section && I.section === u.section ? 0 : 1, D = x.section && x.section === u.section ? 0 : 1;
599
- if (M !== D) return M - D;
600
- const w = I.id === a ? 0 : 1, O = x.id === a ? 0 : 1;
601
- return w !== O ? w - O : ye(I, x);
611
+ ).sort((E, b) => {
612
+ const y = s.get(b.id).length - s.get(E.id).length;
613
+ if (y !== 0) return y;
614
+ const P = E.flow && E.flow === u.flow ? 0 : 1, f = b.flow && b.flow === u.flow ? 0 : 1;
615
+ if (P !== f) return P - f;
616
+ const R = E.section && E.section === u.section ? 0 : 1, D = b.section && b.section === u.section ? 0 : 1;
617
+ if (R !== D) return R - D;
618
+ const v = E.id === l ? 0 : 1, M = b.id === l ? 0 : 1;
619
+ return v !== M ? v - M : Ne(E, b);
602
620
  })[0];
603
- return y ? [
621
+ return p ? [
604
622
  {
605
- id: `discovery-recipe:${encodeURIComponent(y.id)}:${encodeURIComponent(u.id)}`,
606
- from: y.id,
623
+ id: `discovery-recipe:${encodeURIComponent(p.id)}:${encodeURIComponent(u.id)}`,
624
+ from: p.id,
607
625
  to: u.id,
608
626
  kind: "recipe-step"
609
627
  }
610
- ] : d && d.id !== u.id && s.get(d.id).join("") !== h.join("") ? [
628
+ ] : a && a.id !== u.id && s.get(a.id).join("") !== w.join("") ? [
611
629
  {
612
- id: `discovery-route-case:${encodeURIComponent(d.id)}:${encodeURIComponent(u.id)}`,
613
- from: d.id,
630
+ id: `discovery-route-case:${encodeURIComponent(a.id)}:${encodeURIComponent(u.id)}`,
631
+ from: a.id,
614
632
  to: u.id,
615
633
  kind: "route-case"
616
634
  }
@@ -618,7 +636,7 @@ function qt(e, t) {
618
636
  });
619
637
  });
620
638
  }
621
- function Gt(e) {
639
+ function on(e) {
622
640
  var o;
623
641
  const t = /* @__PURE__ */ new Map();
624
642
  for (const r of e) {
@@ -629,148 +647,154 @@ function Gt(e) {
629
647
  }
630
648
  return [...t.values()].flatMap((r) => {
631
649
  const n = r[0], s = /* @__PURE__ */ new Map();
632
- for (const a of r) {
633
- const d = H(a.route);
634
- if (!d) continue;
635
- const u = s.get(d);
636
- u ? u.push(a) : s.set(d, [a]);
650
+ for (const l of r) {
651
+ const a = L(l.route);
652
+ if (!a) continue;
653
+ const u = s.get(a);
654
+ u ? u.push(l) : s.set(a, [l]);
637
655
  }
638
- return s.size < 2 ? [] : [...s.values()].flatMap((a) => {
639
- const d = [...a].sort(
640
- ye
656
+ return s.size < 2 ? [] : [...s.values()].flatMap((l) => {
657
+ const a = [...l].sort(
658
+ Ne
641
659
  )[0];
642
- return d.id === n.id ? [] : [
660
+ return a.id === n.id ? [] : [
643
661
  {
644
- id: `discovery-flow-route:${encodeURIComponent(n.id)}:${encodeURIComponent(d.id)}`,
662
+ id: `discovery-flow-route:${encodeURIComponent(n.id)}:${encodeURIComponent(a.id)}`,
645
663
  from: n.id,
646
- to: d.id,
664
+ to: a.id,
647
665
  kind: "flow-route"
648
666
  }
649
667
  ];
650
668
  });
651
669
  });
652
670
  }
653
- function Kt(e, t, o) {
671
+ function sn(e, t, o) {
654
672
  const r = new Set(
655
- (t.routes ?? []).map((n) => H(n.path)).filter((n) => !!n)
673
+ (t.routes ?? []).map((n) => L(n.path)).filter((n) => !!n)
656
674
  );
657
675
  return e.map((n) => {
658
- const s = H(n.route);
676
+ const s = L(n.route);
659
677
  if (!s || o.get(s) !== n.id)
660
678
  return n;
661
- const a = [...r].filter(
662
- (d) => Ee(d, s)
679
+ const l = [...r].filter(
680
+ (a) => Te(a, s)
663
681
  );
664
- return a.length ? {
682
+ return l.length ? {
665
683
  ...n,
666
684
  scenarioIds: [
667
685
  .../* @__PURE__ */ new Set([
668
686
  ...n.scenarioIds ?? [],
669
- ...a.map(Ge)
687
+ ...l.map(nt)
670
688
  ])
671
- ].sort((d, u) => d.localeCompare(u))
689
+ ].sort((a, u) => a.localeCompare(u))
672
690
  } : n;
673
691
  });
674
692
  }
675
- function Lt(e, t) {
676
- var h, m, y, I, x;
677
- const o = new Set(e.map((p) => p.id)), r = new Map(
678
- e.map((p, C) => [p.id, C])
679
- ), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
680
- for (const p of o)
681
- n.set(p, /* @__PURE__ */ new Set()), s.set(p, /* @__PURE__ */ new Set()), a.set(p, /* @__PURE__ */ new Set());
682
- for (const p of t) {
683
- const C = [
684
- ...(p.fromScope ?? [p.from]).map(
685
- (f) => [f, p.to]
693
+ function an(e, t) {
694
+ var w, h, p, E, b;
695
+ const o = new Set(e.map((y) => y.id)), r = new Map(
696
+ e.map((y, P) => [y.id, P])
697
+ ), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
698
+ for (const y of o)
699
+ n.set(y, /* @__PURE__ */ new Set()), s.set(y, /* @__PURE__ */ new Set()), l.set(y, /* @__PURE__ */ new Set());
700
+ for (const y of t) {
701
+ const P = [
702
+ ...(y.fromScope ?? [y.from]).map(
703
+ (f) => [f, y.to]
686
704
  ),
687
- ...(p.toScope ?? [p.to]).map(
688
- (f) => [p.from, f]
705
+ ...(y.toScope ?? [y.to]).map(
706
+ (f) => [y.from, f]
689
707
  )
690
708
  ];
691
- for (const [f, M] of C)
692
- !o.has(f) || !o.has(M) || ((h = n.get(M)) == null || h.add(f), (m = s.get(f)) == null || m.add(M), (y = a.get(f)) == null || y.add(M), (I = a.get(M)) == null || I.add(f));
709
+ for (const [f, R] of P)
710
+ !o.has(f) || !o.has(R) || ((w = n.get(R)) == null || w.add(f), (h = s.get(f)) == null || h.add(R), (p = l.get(f)) == null || p.add(R), (E = l.get(R)) == null || E.add(f));
693
711
  }
694
- const d = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
695
- for (const p of o) {
696
- if (u.has(p)) continue;
697
- const C = [], f = [p];
712
+ const a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
713
+ for (const y of o) {
714
+ if (u.has(y)) continue;
715
+ const P = [], f = [y];
698
716
  for (; f.length; ) {
699
- const S = f.shift();
700
- if (!u.has(S)) {
701
- u.add(S), C.push(S);
702
- for (const N of a.get(S) ?? [])
703
- u.has(N) || f.push(N);
717
+ const x = f.shift();
718
+ if (!u.has(x)) {
719
+ u.add(x), P.push(x);
720
+ for (const C of l.get(x) ?? [])
721
+ u.has(C) || f.push(C);
704
722
  }
705
723
  }
706
- if (C.length === 1 && (((x = a.get(C[0])) == null ? void 0 : x.size) ?? 0) === 0)
724
+ if (P.length === 1 && (((b = l.get(P[0])) == null ? void 0 : b.size) ?? 0) === 0)
707
725
  continue;
708
- const M = C.filter((S) => {
709
- var N;
710
- return (((N = n.get(S)) == null ? void 0 : N.size) ?? 0) === 0;
726
+ const R = P.filter((x) => {
727
+ var C;
728
+ return (((C = n.get(x)) == null ? void 0 : C.size) ?? 0) === 0;
711
729
  }).sort(
712
- (S, N) => (r.get(S) ?? Number.MAX_SAFE_INTEGER) - (r.get(N) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(N)
713
- ), D = [...C].sort(
714
- (S, N) => (r.get(S) ?? Number.MAX_SAFE_INTEGER) - (r.get(N) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(N)
730
+ (x, C) => (r.get(x) ?? Number.MAX_SAFE_INTEGER) - (r.get(C) ?? Number.MAX_SAFE_INTEGER) || x.localeCompare(C)
731
+ ), D = [...P].sort(
732
+ (x, C) => (r.get(x) ?? Number.MAX_SAFE_INTEGER) - (r.get(C) ?? Number.MAX_SAFE_INTEGER) || x.localeCompare(C)
715
733
  )[0];
716
734
  if (!D) continue;
717
- const w = [D], O = /* @__PURE__ */ new Set(), Z = (S) => {
718
- const N = [S];
719
- for (; N.length; ) {
720
- const F = N.shift();
721
- if (!O.has(F)) {
722
- O.add(F);
723
- for (const _ of s.get(F) ?? [])
724
- O.has(_) || N.push(_);
735
+ const v = [D], M = /* @__PURE__ */ new Set(), te = (x) => {
736
+ const C = [x];
737
+ for (; C.length; ) {
738
+ const j = C.shift();
739
+ if (!M.has(j)) {
740
+ M.add(j);
741
+ for (const H of s.get(j) ?? [])
742
+ M.has(H) || C.push(H);
725
743
  }
726
744
  }
727
745
  };
728
- Z(D);
729
- for (const S of M)
730
- O.has(S) || (w.push(S), Z(S));
731
- for (const S of w)
732
- d.add(S);
746
+ te(D);
747
+ for (const x of R)
748
+ M.has(x) || (v.push(x), te(x));
749
+ for (const x of v)
750
+ a.add(x);
733
751
  }
734
- return [...d].sort(
735
- (p, C) => (r.get(p) ?? Number.MAX_SAFE_INTEGER) - (r.get(C) ?? Number.MAX_SAFE_INTEGER) || p.localeCompare(C)
752
+ return [...a].sort(
753
+ (y, P) => (r.get(y) ?? Number.MAX_SAFE_INTEGER) - (r.get(P) ?? Number.MAX_SAFE_INTEGER) || y.localeCompare(P)
736
754
  );
737
755
  }
738
- function Le(e) {
756
+ function ot(e) {
739
757
  var t, o;
740
- return Ot(
758
+ return Lt(
741
759
  (o = (t = e.scenarios) == null ? void 0 : t.find(
742
760
  (r) => r.id === "environment:baseline"
743
761
  )) == null ? void 0 : o.environment
744
762
  );
745
763
  }
746
- function Wt(e) {
747
- const t = zt(
764
+ function cn(e) {
765
+ var u, w, h, p, E;
766
+ const t = Xt(
748
767
  e.pages,
749
768
  e.manifest
750
- ), o = _t(t), r = jt(t), n = Kt(
769
+ ), o = Yt(t), r = Zt(t), n = sn(
751
770
  t,
752
771
  e.manifest,
753
772
  o
754
- ), a = [
755
- ...Ft(
773
+ ), l = [
774
+ ...Jt(
756
775
  e.manifest.edges,
757
776
  o,
758
777
  r,
759
- new Set(n.map((d) => d.id))
778
+ new Set(n.map((b) => b.id))
760
779
  ),
761
- ...Ht(n, o),
762
- ...qt(n, o),
763
- ...Gt(n)
780
+ ...nn(n, o),
781
+ ...rn(n, o),
782
+ ...on(n)
783
+ ], a = [
784
+ ...((u = e.storyboard) == null ? void 0 : u.edges) ?? [],
785
+ ...Ut(((w = e.storyboard) == null ? void 0 : w.paths) ?? [])
764
786
  ];
765
- return $t({
787
+ return Gt({
766
788
  screens: n,
767
789
  assets: e.assets,
768
- scenarios: kt(e.manifest.routes),
769
- inferredEdges: a,
770
- startScreenIds: Lt(n, a)
790
+ scenarios: Wt(e.manifest.routes),
791
+ explicitEdges: a,
792
+ inferredEdges: l,
793
+ startScreenIds: (p = (h = e.storyboard) == null ? void 0 : h.startScreenIds) != null && p.length ? e.storyboard.startScreenIds : an(n, [...a, ...l]),
794
+ nonVisualScenarioIds: (E = e.storyboard) == null ? void 0 : E.nonVisualScenarioIds
771
795
  });
772
796
  }
773
- async function We(e) {
797
+ async function st(e) {
774
798
  const o = await (e.fetcher ?? ((n, s) => fetch(n, s)))(e.endpoint, {
775
799
  headers: { accept: "application/json" },
776
800
  cache: "no-store",
@@ -779,39 +803,40 @@ async function We(e) {
779
803
  if (!o.ok)
780
804
  throw new Error(`Storyboard discovery failed (${o.status})`);
781
805
  const r = await o.json();
782
- if (!Dt(r))
806
+ if (!Vt(r))
783
807
  throw new Error("Storyboard discovery returned an invalid manifest.");
784
808
  return {
785
809
  manifest: r,
786
- baselineEnvironment: Le(r),
787
- graph: Wt({
810
+ baselineEnvironment: ot(r),
811
+ graph: cn({
788
812
  manifest: r,
789
813
  pages: e.pages,
790
- assets: e.assets
814
+ assets: e.assets,
815
+ storyboard: e.storyboard
791
816
  })
792
817
  };
793
818
  }
794
- async function pn(e) {
795
- re(null);
819
+ async function Nn(e) {
820
+ se(null);
796
821
  try {
797
- const t = await We(e);
798
- return re(t.graph), t;
822
+ const t = await st(e);
823
+ return se(t.graph), t;
799
824
  } catch (t) {
800
- throw re(null), t;
825
+ throw se(null), t;
801
826
  }
802
827
  }
803
- const pe = "var(--pygmalion-catalog-surface, #ffffff)", ge = "var(--pygmalion-catalog-canvas, #f5f5f5)", Pe = "var(--pygmalion-catalog-border, #e5e7eb)", he = "var(--pygmalion-catalog-text, #202124)", j = "var(--pygmalion-catalog-muted, #6b7280)", Vt = "var(--pygmalion-catalog-header, #11182f)", Jt = "var(--pygmalion-catalog-accent, #7c6cf2)";
804
- function gn({
828
+ const Ee = "var(--pygmalion-catalog-surface, #ffffff)", Ce = "var(--pygmalion-catalog-canvas, #f5f5f5)", ke = "var(--pygmalion-catalog-border, #e5e7eb)", Re = "var(--pygmalion-catalog-text, #202124)", G = "var(--pygmalion-catalog-muted, #6b7280)", ln = "var(--pygmalion-catalog-header, #11182f)", dn = "var(--pygmalion-catalog-accent, #7c6cf2)";
829
+ function An({
805
830
  title: e,
806
831
  eyebrow: t,
807
832
  description: o,
808
833
  version: r,
809
834
  meta: n,
810
835
  children: s,
811
- headerBackground: a = Vt,
812
- headerColor: d = "#ffffff",
813
- bodyBackground: u = pe,
814
- bodyGap: h = 40
836
+ headerBackground: l = ln,
837
+ headerColor: a = "#ffffff",
838
+ bodyBackground: u = Ee,
839
+ bodyGap: w = 40
815
840
  }) {
816
841
  return /* @__PURE__ */ $(
817
842
  "section",
@@ -825,7 +850,7 @@ function gn({
825
850
  maxWidth: "none",
826
851
  flexDirection: "column",
827
852
  overflow: "visible",
828
- color: he,
853
+ color: Re,
829
854
  background: u,
830
855
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
831
856
  },
@@ -840,12 +865,12 @@ function gn({
840
865
  justifyContent: "space-between",
841
866
  gap: 48,
842
867
  padding: "44px 48px 48px",
843
- color: d,
844
- background: a
868
+ color: a,
869
+ background: l
845
870
  },
846
871
  children: [
847
872
  /* @__PURE__ */ $("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
848
- t ? /* @__PURE__ */ b(
873
+ t ? /* @__PURE__ */ S(
849
874
  "div",
850
875
  {
851
876
  style: {
@@ -858,7 +883,7 @@ function gn({
858
883
  children: t
859
884
  }
860
885
  ) : null,
861
- /* @__PURE__ */ b(
886
+ /* @__PURE__ */ S(
862
887
  "h1",
863
888
  {
864
889
  style: {
@@ -872,7 +897,7 @@ function gn({
872
897
  children: e
873
898
  }
874
899
  ),
875
- o ? /* @__PURE__ */ b(
900
+ o ? /* @__PURE__ */ S(
876
901
  "div",
877
902
  {
878
903
  style: {
@@ -897,15 +922,15 @@ function gn({
897
922
  whiteSpace: "nowrap"
898
923
  },
899
924
  children: [
900
- r ? /* @__PURE__ */ b("span", { children: r }) : null,
901
- n ? /* @__PURE__ */ b("span", { children: n }) : null
925
+ r ? /* @__PURE__ */ S("span", { children: r }) : null,
926
+ n ? /* @__PURE__ */ S("span", { children: n }) : null
902
927
  ]
903
928
  }
904
929
  ) : null
905
930
  ]
906
931
  }
907
932
  ),
908
- /* @__PURE__ */ b(
933
+ /* @__PURE__ */ S(
909
934
  "div",
910
935
  {
911
936
  "data-pygmalion-catalog-document-body": "",
@@ -914,7 +939,7 @@ function gn({
914
939
  display: "inline-flex",
915
940
  flexDirection: "column",
916
941
  alignItems: "flex-start",
917
- gap: h,
942
+ gap: w,
918
943
  padding: 48,
919
944
  background: u
920
945
  },
@@ -925,7 +950,7 @@ function gn({
925
950
  }
926
951
  );
927
952
  }
928
- function hn({
953
+ function $n({
929
954
  title: e,
930
955
  itemId: t,
931
956
  count: o,
@@ -946,11 +971,11 @@ function hn({
946
971
  alignItems: "flex-start",
947
972
  gap: 18,
948
973
  padding: s === "tinted" ? 24 : 0,
949
- background: s === "tinted" ? ge : "transparent"
974
+ background: s === "tinted" ? Ce : "transparent"
950
975
  },
951
976
  children: [
952
977
  /* @__PURE__ */ $("header", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
953
- /* @__PURE__ */ b(
978
+ /* @__PURE__ */ S(
954
979
  "h2",
955
980
  {
956
981
  style: {
@@ -962,25 +987,25 @@ function hn({
962
987
  children: e
963
988
  }
964
989
  ),
965
- typeof o == "number" ? /* @__PURE__ */ b("span", { style: { color: j, fontSize: 11 }, children: o }) : null
990
+ typeof o == "number" ? /* @__PURE__ */ S("span", { style: { color: G, fontSize: 11 }, children: o }) : null
966
991
  ] }),
967
- r ? /* @__PURE__ */ b("div", { style: { marginTop: -10, color: j, fontSize: 11 }, children: r }) : null,
992
+ r ? /* @__PURE__ */ S("div", { style: { marginTop: -10, color: G, fontSize: 11 }, children: r }) : null,
968
993
  n
969
994
  ]
970
995
  }
971
996
  );
972
997
  }
973
- function yn({
998
+ function Mn({
974
999
  rows: e,
975
1000
  columns: t,
976
1001
  cornerLabel: o,
977
1002
  renderCell: r,
978
1003
  renderRowLabel: n = (u) => u,
979
1004
  renderColumnLabel: s = (u) => u,
980
- boundary: a = !0,
981
- cellStyle: d
1005
+ boundary: l = !0,
1006
+ cellStyle: a
982
1007
  }) {
983
- return /* @__PURE__ */ b(
1008
+ return /* @__PURE__ */ S(
984
1009
  "div",
985
1010
  {
986
1011
  "data-pygmalion-catalog-matrix": "",
@@ -988,9 +1013,9 @@ function yn({
988
1013
  boxSizing: "border-box",
989
1014
  display: "inline-block",
990
1015
  width: "max-content",
991
- padding: a ? 16 : 0,
992
- border: a ? `1px dashed ${Jt}` : void 0,
993
- borderRadius: a ? 4 : void 0
1016
+ padding: l ? 16 : 0,
1017
+ border: l ? `1px dashed ${dn}` : void 0,
1018
+ borderRadius: l ? 4 : void 0
994
1019
  },
995
1020
  children: /* @__PURE__ */ $(
996
1021
  "table",
@@ -1001,13 +1026,13 @@ function yn({
1001
1026
  borderSpacing: 0
1002
1027
  },
1003
1028
  children: [
1004
- /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ $("tr", { children: [
1005
- /* @__PURE__ */ b(
1029
+ /* @__PURE__ */ S("thead", { children: /* @__PURE__ */ $("tr", { children: [
1030
+ /* @__PURE__ */ S(
1006
1031
  "th",
1007
1032
  {
1008
1033
  style: {
1009
1034
  padding: "0 16px 12px 0",
1010
- color: j,
1035
+ color: G,
1011
1036
  fontSize: 10,
1012
1037
  fontWeight: 600,
1013
1038
  textAlign: "left",
@@ -1016,12 +1041,12 @@ function yn({
1016
1041
  children: o
1017
1042
  }
1018
1043
  ),
1019
- t.map((u) => /* @__PURE__ */ b(
1044
+ t.map((u) => /* @__PURE__ */ S(
1020
1045
  "th",
1021
1046
  {
1022
1047
  style: {
1023
1048
  padding: "0 16px 12px",
1024
- color: j,
1049
+ color: G,
1025
1050
  fontSize: 10,
1026
1051
  fontWeight: 600,
1027
1052
  textAlign: "center",
@@ -1032,13 +1057,13 @@ function yn({
1032
1057
  u
1033
1058
  ))
1034
1059
  ] }) }),
1035
- /* @__PURE__ */ b("tbody", { children: e.map((u) => /* @__PURE__ */ $("tr", { children: [
1036
- /* @__PURE__ */ b(
1060
+ /* @__PURE__ */ S("tbody", { children: e.map((u) => /* @__PURE__ */ $("tr", { children: [
1061
+ /* @__PURE__ */ S(
1037
1062
  "th",
1038
1063
  {
1039
1064
  style: {
1040
1065
  padding: "12px 16px 12px 0",
1041
- color: j,
1066
+ color: G,
1042
1067
  fontSize: 10,
1043
1068
  fontWeight: 600,
1044
1069
  textAlign: "left",
@@ -1047,18 +1072,18 @@ function yn({
1047
1072
  children: n(u)
1048
1073
  }
1049
1074
  ),
1050
- t.map((h) => /* @__PURE__ */ b(
1075
+ t.map((w) => /* @__PURE__ */ S(
1051
1076
  "td",
1052
1077
  {
1053
1078
  style: {
1054
1079
  padding: "12px 16px",
1055
1080
  textAlign: "center",
1056
1081
  verticalAlign: "middle",
1057
- ...d
1082
+ ...a
1058
1083
  },
1059
- children: r(u, h)
1084
+ children: r(u, w)
1060
1085
  },
1061
- h
1086
+ w
1062
1087
  ))
1063
1088
  ] }, u)) })
1064
1089
  ]
@@ -1067,14 +1092,14 @@ function yn({
1067
1092
  }
1068
1093
  );
1069
1094
  }
1070
- function Qt(e) {
1095
+ function un(e) {
1071
1096
  return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase() || "page";
1072
1097
  }
1073
- function Ve(e, t, o = "PygmalionCatalog") {
1074
- const r = (n) => Qt(n).replace(/-/g, "_");
1098
+ function it(e, t, o = "PygmalionCatalog") {
1099
+ const r = (n) => un(n).replace(/-/g, "_");
1075
1100
  return `${o}_${r(e)}_${r(t)}`;
1076
1101
  }
1077
- function Je(e, t) {
1102
+ function at(e, t) {
1078
1103
  return {
1079
1104
  id: e.id,
1080
1105
  name: e.name,
@@ -1085,7 +1110,7 @@ function Je(e, t) {
1085
1110
  description: e.description
1086
1111
  };
1087
1112
  }
1088
- function Qe(e) {
1113
+ function ct(e) {
1089
1114
  const t = /* @__PURE__ */ new Set();
1090
1115
  for (const o of e) {
1091
1116
  if (t.has(o.id))
@@ -1093,10 +1118,10 @@ function Qe(e) {
1093
1118
  t.add(o.id);
1094
1119
  }
1095
1120
  }
1096
- function Xt(e, t, o) {
1121
+ function fn(e, t, o) {
1097
1122
  return typeof e == "function" ? e(t, o) : e;
1098
1123
  }
1099
- function Yt({
1124
+ function mn({
1100
1125
  page: e,
1101
1126
  items: t,
1102
1127
  renderPreview: o,
@@ -1113,19 +1138,19 @@ function Yt({
1113
1138
  display: "inline-block",
1114
1139
  width: "max-content",
1115
1140
  padding: 32,
1116
- color: he,
1117
- background: ge,
1141
+ color: Re,
1142
+ background: Ce,
1118
1143
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1119
1144
  },
1120
1145
  children: [
1121
1146
  /* @__PURE__ */ $("header", { style: { marginBottom: 24 }, children: [
1122
- /* @__PURE__ */ b("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
1123
- /* @__PURE__ */ $("p", { style: { margin: "6px 0 0", color: j, fontSize: 13 }, children: [
1147
+ /* @__PURE__ */ S("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
1148
+ /* @__PURE__ */ $("p", { style: { margin: "6px 0 0", color: G, fontSize: 13 }, children: [
1124
1149
  t.length,
1125
1150
  " assets"
1126
1151
  ] })
1127
1152
  ] }),
1128
- /* @__PURE__ */ b(
1153
+ /* @__PURE__ */ S(
1129
1154
  "div",
1130
1155
  {
1131
1156
  style: {
@@ -1141,12 +1166,12 @@ function Yt({
1141
1166
  minWidth: n,
1142
1167
  width: n,
1143
1168
  padding: 16,
1144
- border: `1px solid ${Pe}`,
1169
+ border: `1px solid ${ke}`,
1145
1170
  borderRadius: 12,
1146
- background: pe
1171
+ background: Ee
1147
1172
  },
1148
1173
  children: [
1149
- /* @__PURE__ */ b(
1174
+ /* @__PURE__ */ S(
1150
1175
  "div",
1151
1176
  {
1152
1177
  style: {
@@ -1159,7 +1184,7 @@ function Yt({
1159
1184
  children: o(s)
1160
1185
  }
1161
1186
  ),
1162
- /* @__PURE__ */ b(
1187
+ /* @__PURE__ */ S(
1163
1188
  "div",
1164
1189
  {
1165
1190
  style: {
@@ -1174,13 +1199,13 @@ function Yt({
1174
1199
  children: s.name
1175
1200
  }
1176
1201
  ),
1177
- r ? /* @__PURE__ */ b("div", { style: { marginTop: 4, color: j, fontSize: 11, lineHeight: 1.45 }, children: r(s) }) : s.codeName ? /* @__PURE__ */ b(
1202
+ r ? /* @__PURE__ */ S("div", { style: { marginTop: 4, color: G, fontSize: 11, lineHeight: 1.45 }, children: r(s) }) : s.codeName ? /* @__PURE__ */ S(
1178
1203
  "div",
1179
1204
  {
1180
1205
  style: {
1181
1206
  marginTop: 4,
1182
1207
  overflow: "hidden",
1183
- color: j,
1208
+ color: G,
1184
1209
  fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
1185
1210
  fontSize: 11,
1186
1211
  textOverflow: "ellipsis",
@@ -1200,21 +1225,21 @@ function Yt({
1200
1225
  }
1201
1226
  );
1202
1227
  }
1203
- function wn(e) {
1204
- Qe(e.items);
1228
+ function On(e) {
1229
+ ct(e.items);
1205
1230
  const t = /* @__PURE__ */ new Map();
1206
1231
  for (const n of e.items) {
1207
- const s = e.pageFor(n), a = t.get(s.id);
1208
- if (a) {
1209
- if (a.page.name !== s.name || a.page.section !== s.section)
1232
+ const s = e.pageFor(n), l = t.get(s.id);
1233
+ if (l) {
1234
+ if (l.page.name !== s.name || l.page.section !== s.section)
1210
1235
  throw new Error(`Conflicting design catalog page descriptor: ${s.id}`);
1211
- a.items.push(n);
1236
+ l.items.push(n);
1212
1237
  continue;
1213
1238
  }
1214
1239
  t.set(s.id, {
1215
1240
  page: s,
1216
1241
  items: [n],
1217
- registryName: Ve(
1242
+ registryName: it(
1218
1243
  e.kind,
1219
1244
  s.id,
1220
1245
  e.registryPrefix
@@ -1223,8 +1248,8 @@ function wn(e) {
1223
1248
  }
1224
1249
  const o = {}, r = [];
1225
1250
  for (const n of t.values()) {
1226
- const s = () => /* @__PURE__ */ b(
1227
- Yt,
1251
+ const s = () => /* @__PURE__ */ S(
1252
+ mn,
1228
1253
  {
1229
1254
  page: n.page,
1230
1255
  items: n.items,
@@ -1237,34 +1262,34 @@ function wn(e) {
1237
1262
  component: s,
1238
1263
  children: "none"
1239
1264
  };
1240
- const a = Xt(e.frame, n.page, n.items);
1265
+ const l = fn(e.frame, n.page, n.items);
1241
1266
  r.push({
1242
1267
  ...n.page,
1243
1268
  componentName: n.registryName,
1244
- width: (a == null ? void 0 : a.width) ?? 1,
1245
- height: (a == null ? void 0 : a.height) ?? 1,
1246
- frameSizeMode: a ? "fixed" : "content"
1269
+ width: (l == null ? void 0 : l.width) ?? 1,
1270
+ height: (l == null ? void 0 : l.height) ?? 1,
1271
+ frameSizeMode: l ? "fixed" : "content"
1247
1272
  });
1248
1273
  }
1249
1274
  return {
1250
1275
  registry: o,
1251
1276
  collection: {
1252
1277
  expectedCount: e.expectedCount ?? e.items.length,
1253
- assets: e.items.map((n) => Je(n, e.pageFor(n).id)),
1278
+ assets: e.items.map((n) => at(n, e.pageFor(n).id)),
1254
1279
  pages: r
1255
1280
  }
1256
1281
  };
1257
1282
  }
1258
- function Zt(e, t = 60) {
1259
- const o = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, d]) => d.length > 0).sort(([d, u], [h, m]) => m.length - u.length || d.localeCompare(h)), r = o[0], n = o[1], s = Math.max(1, (r == null ? void 0 : r[1].length) ?? 1), a = n == null ? void 0 : n[1].slice(0, Math.max(1, Math.floor(t / s)));
1283
+ function hn(e, t = 60) {
1284
+ const o = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, a]) => a.length > 0).sort(([a, u], [w, h]) => h.length - u.length || a.localeCompare(w)), r = o[0], n = o[1], s = Math.max(1, (r == null ? void 0 : r[1].length) ?? 1), l = n == null ? void 0 : n[1].slice(0, Math.max(1, Math.floor(t / s)));
1260
1285
  return {
1261
1286
  row: r,
1262
- column: n ? [n[0], a ?? []] : void 0,
1263
- fixed: o.slice(2).map(([d, u]) => [d, u[0]]),
1287
+ column: n ? [n[0], l ?? []] : void 0,
1288
+ fixed: o.slice(2).map(([a, u]) => [a, u[0]]),
1264
1289
  additional: o.slice(2)
1265
1290
  };
1266
1291
  }
1267
- function en(e, t, o, r) {
1292
+ function pn(e, t, o, r) {
1268
1293
  return {
1269
1294
  ...e.defaultProps,
1270
1295
  ...Object.fromEntries(t.fixed),
@@ -1272,12 +1297,12 @@ function en(e, t, o, r) {
1272
1297
  ...t.column && r ? { [t.column[0]]: r } : {}
1273
1298
  };
1274
1299
  }
1275
- function tn({
1300
+ function gn({
1276
1301
  item: e,
1277
1302
  entry: t,
1278
1303
  maxVariantCells: o
1279
1304
  }) {
1280
- var d, u;
1305
+ var a, u;
1281
1306
  if (!t)
1282
1307
  return /* @__PURE__ */ $(
1283
1308
  "section",
@@ -1289,16 +1314,16 @@ function tn({
1289
1314
  display: "inline-block",
1290
1315
  width: "max-content",
1291
1316
  padding: 32,
1292
- color: he,
1293
- background: ge
1317
+ color: Re,
1318
+ background: Ce
1294
1319
  },
1295
1320
  children: [
1296
- /* @__PURE__ */ b("strong", { children: e.name }),
1297
- /* @__PURE__ */ b("p", { style: { color: j }, children: "The component is not registered." })
1321
+ /* @__PURE__ */ S("strong", { children: e.name }),
1322
+ /* @__PURE__ */ S("p", { style: { color: G }, children: "The component is not registered." })
1298
1323
  ]
1299
1324
  }
1300
1325
  );
1301
- const r = Zt(t, o), n = ((d = r.row) == null ? void 0 : d[1]) ?? [void 0], s = ((u = r.column) == null ? void 0 : u[1]) ?? [void 0], a = t.component;
1326
+ const r = hn(t, o), n = ((a = r.row) == null ? void 0 : a[1]) ?? [void 0], s = ((u = r.column) == null ? void 0 : u[1]) ?? [void 0], l = t.component;
1302
1327
  return /* @__PURE__ */ $(
1303
1328
  "section",
1304
1329
  {
@@ -1309,16 +1334,16 @@ function tn({
1309
1334
  display: "inline-block",
1310
1335
  width: "max-content",
1311
1336
  padding: 32,
1312
- color: he,
1313
- background: ge,
1337
+ color: Re,
1338
+ background: Ce,
1314
1339
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1315
1340
  },
1316
1341
  children: [
1317
1342
  /* @__PURE__ */ $("header", { style: { marginBottom: 24 }, children: [
1318
- /* @__PURE__ */ b("h1", { style: { margin: 0, fontSize: 24 }, children: e.name }),
1319
- e.sourcePath ? /* @__PURE__ */ b("p", { style: { margin: "6px 0 0", color: j, fontSize: 12 }, children: e.sourcePath }) : null
1343
+ /* @__PURE__ */ S("h1", { style: { margin: 0, fontSize: 24 }, children: e.name }),
1344
+ e.sourcePath ? /* @__PURE__ */ S("p", { style: { margin: "6px 0 0", color: G, fontSize: 12 }, children: e.sourcePath }) : null
1320
1345
  ] }),
1321
- /* @__PURE__ */ b(
1346
+ /* @__PURE__ */ S(
1322
1347
  "div",
1323
1348
  {
1324
1349
  style: {
@@ -1327,10 +1352,10 @@ function tn({
1327
1352
  gap: 12
1328
1353
  },
1329
1354
  children: n.flatMap(
1330
- (h) => s.map((m) => {
1331
- const y = en(t, r, h, m), I = [
1332
- r.row && h ? `${r.row[0]}=${h}` : "",
1333
- r.column && m ? `${r.column[0]}=${m}` : ""
1355
+ (w) => s.map((h) => {
1356
+ const p = pn(t, r, w, h), E = [
1357
+ r.row && w ? `${r.row[0]}=${w}` : "",
1358
+ r.column && h ? `${r.column[0]}=${h}` : ""
1334
1359
  ].filter(Boolean).join(" · ");
1335
1360
  return /* @__PURE__ */ $(
1336
1361
  "article",
@@ -1338,79 +1363,79 @@ function tn({
1338
1363
  style: {
1339
1364
  width: "max-content",
1340
1365
  padding: 16,
1341
- border: `1px solid ${Pe}`,
1366
+ border: `1px solid ${ke}`,
1342
1367
  borderRadius: 10,
1343
- background: pe
1368
+ background: Ee
1344
1369
  },
1345
1370
  children: [
1346
- I ? /* @__PURE__ */ b("div", { style: { marginBottom: 12, color: j, fontSize: 11 }, children: I }) : null,
1347
- /* @__PURE__ */ b("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: ke(
1348
- a,
1349
- y,
1371
+ E ? /* @__PURE__ */ S("div", { style: { marginBottom: 12, color: G, fontSize: 11 }, children: E }) : null,
1372
+ /* @__PURE__ */ S("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: Ge(
1373
+ l,
1374
+ p,
1350
1375
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1351
1376
  ) })
1352
1377
  ]
1353
1378
  },
1354
- `${h ?? "default"}:${m ?? "default"}`
1379
+ `${w ?? "default"}:${h ?? "default"}`
1355
1380
  );
1356
1381
  })
1357
1382
  )
1358
1383
  }
1359
1384
  ),
1360
- r.additional.map(([h, m]) => /* @__PURE__ */ $("section", { style: { marginTop: 20 }, children: [
1361
- /* @__PURE__ */ b("h2", { style: { margin: "0 0 10px", color: j, fontSize: 12 }, children: h }),
1362
- /* @__PURE__ */ b("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: m.map((y) => /* @__PURE__ */ $(
1385
+ r.additional.map(([w, h]) => /* @__PURE__ */ $("section", { style: { marginTop: 20 }, children: [
1386
+ /* @__PURE__ */ S("h2", { style: { margin: "0 0 10px", color: G, fontSize: 12 }, children: w }),
1387
+ /* @__PURE__ */ S("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: h.map((p) => /* @__PURE__ */ $(
1363
1388
  "article",
1364
1389
  {
1365
1390
  style: {
1366
1391
  padding: 16,
1367
- border: `1px solid ${Pe}`,
1392
+ border: `1px solid ${ke}`,
1368
1393
  borderRadius: 10,
1369
- background: pe
1394
+ background: Ee
1370
1395
  },
1371
1396
  children: [
1372
- /* @__PURE__ */ b("div", { style: { marginBottom: 12, color: j, fontSize: 11 }, children: y }),
1373
- ke(
1374
- a,
1375
- { ...t.defaultProps, [h]: y },
1397
+ /* @__PURE__ */ S("div", { style: { marginBottom: 12, color: G, fontSize: 11 }, children: p }),
1398
+ Ge(
1399
+ l,
1400
+ { ...t.defaultProps, [w]: p },
1376
1401
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1377
1402
  )
1378
1403
  ]
1379
1404
  },
1380
- y
1405
+ p
1381
1406
  )) })
1382
- ] }, h))
1407
+ ] }, w))
1383
1408
  ]
1384
1409
  }
1385
1410
  );
1386
1411
  }
1387
- function bn(e) {
1388
- Qe(e.items);
1412
+ function Dn(e) {
1413
+ ct(e.items);
1389
1414
  const t = {}, o = [], r = [], n = e.maxVariantCells ?? 60;
1390
1415
  for (const s of e.items) {
1391
- const a = Ve(
1416
+ const l = it(
1392
1417
  e.kind,
1393
1418
  s.id,
1394
1419
  e.registryPrefix
1395
- ), d = e.registry[s.name], u = () => /* @__PURE__ */ b(
1396
- tn,
1420
+ ), a = e.registry[s.name], u = () => /* @__PURE__ */ S(
1421
+ gn,
1397
1422
  {
1398
1423
  item: s,
1399
- entry: d,
1424
+ entry: a,
1400
1425
  maxVariantCells: n
1401
1426
  }
1402
1427
  );
1403
- t[a] = { component: u, children: "none" }, o.push({
1428
+ t[l] = { component: u, children: "none" }, o.push({
1404
1429
  id: s.id,
1405
1430
  name: s.name,
1406
1431
  section: s.section,
1407
- componentName: a,
1432
+ componentName: l,
1408
1433
  // The seed exists only long enough to mount the intrinsic max-content
1409
1434
  // catalog root. The editor replaces it with actual rendered DOM bounds.
1410
1435
  width: 1,
1411
1436
  height: 1,
1412
1437
  frameSizeMode: "content"
1413
- }), r.push(Je(s, s.id));
1438
+ }), r.push(at(s, s.id));
1414
1439
  }
1415
1440
  return {
1416
1441
  registry: t,
@@ -1421,34 +1446,34 @@ function bn(e) {
1421
1446
  }
1422
1447
  };
1423
1448
  }
1424
- const je = /^[a-f0-9]{64}$/, nn = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, rn = /^p\d+$/;
1425
- function Ce(e) {
1426
- return typeof e == "string" && nn.test(e) ? e : void 0;
1449
+ const Qe = /^[a-f0-9]{64}$/, yn = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, wn = /^p\d+$/;
1450
+ function Fe(e) {
1451
+ return typeof e == "string" && yn.test(e) ? e : void 0;
1427
1452
  }
1428
- function Be(e, t) {
1453
+ function Xe(e, t) {
1429
1454
  const o = new URL(e, t);
1430
1455
  return o.search = "", o.hash = "", o.pathname.endsWith("/") || (o.pathname = `${o.pathname}/`), o.href;
1431
1456
  }
1432
- function Se(e) {
1457
+ function Me(e) {
1433
1458
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1434
1459
  const t = e;
1435
- return typeof t.domStructureHash != "string" || !je.test(t.domStructureHash) || typeof t.screenshotHash != "string" || !je.test(t.screenshotHash) ? null : {
1460
+ return typeof t.domStructureHash != "string" || !Qe.test(t.domStructureHash) || typeof t.screenshotHash != "string" || !Qe.test(t.screenshotHash) ? null : {
1436
1461
  domStructureHash: t.domStructureHash,
1437
1462
  screenshotHash: t.screenshotHash,
1438
- ...Ce(t.screenshotUrl) ? { screenshotUrl: Ce(t.screenshotUrl) } : {}
1463
+ ...Fe(t.screenshotUrl) ? { screenshotUrl: Fe(t.screenshotUrl) } : {}
1439
1464
  };
1440
1465
  }
1441
- function Ue(e) {
1466
+ function Ye(e) {
1442
1467
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1443
1468
  const t = e;
1444
1469
  return !Number.isSafeInteger(t.width) || !Number.isSafeInteger(t.height) || Number(t.width) < 1 || Number(t.height) < 1 || Number(t.width) > 65536 || Number(t.height) > 65536 ? null : { width: Number(t.width), height: Number(t.height) };
1445
1470
  }
1446
- function on(e) {
1471
+ function bn(e) {
1447
1472
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1448
- const t = e, o = Ue(t.before), r = Ue(t.after);
1473
+ const t = e, o = Ye(t.before), r = Ye(t.after);
1449
1474
  if (!o || !r || !Number.isSafeInteger(t.changedPixels) || !Number.isSafeInteger(t.totalPixels) || Number(t.changedPixels) < 0 || Number(t.totalPixels) < 1 || Number(t.changedPixels) > Number(t.totalPixels) || typeof t.threshold != "number" || !Number.isFinite(t.threshold) || t.threshold < 0 || t.threshold > 1)
1450
1475
  return null;
1451
- const n = t.heatmapUrl == null ? null : Ce(t.heatmapUrl) ?? null;
1476
+ const n = t.heatmapUrl == null ? null : Fe(t.heatmapUrl) ?? null;
1452
1477
  return {
1453
1478
  before: o,
1454
1479
  after: r,
@@ -1460,15 +1485,15 @@ function on(e) {
1460
1485
  heatmapUrl: n
1461
1486
  };
1462
1487
  }
1463
- function sn(e, t) {
1488
+ function vn(e, t) {
1464
1489
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1465
1490
  const o = e;
1466
1491
  if (typeof o.id != "string" || !o.id) return null;
1467
- const r = Se(o), n = Se(o.before) ?? r;
1492
+ const r = Me(o), n = Me(o.before) ?? r;
1468
1493
  if (!n) return null;
1469
- const s = Se(o.after);
1494
+ const s = Me(o.after);
1470
1495
  if (t === "changed" && !s) return null;
1471
- const a = s ? on(o.pixelDiff) : null;
1496
+ const l = s ? bn(o.pixelDiff) : null;
1472
1497
  return {
1473
1498
  id: o.id,
1474
1499
  before: n,
@@ -1477,26 +1502,26 @@ function sn(e, t) {
1477
1502
  domChanged: n.domStructureHash !== s.domStructureHash,
1478
1503
  screenshotChanged: n.screenshotHash !== s.screenshotHash
1479
1504
  } : {},
1480
- ...a ? { pixelDiff: a } : {}
1505
+ ...l ? { pixelDiff: l } : {}
1481
1506
  };
1482
1507
  }
1483
- function an(e, t = []) {
1508
+ function Sn(e, t = []) {
1484
1509
  const o = new Set(t), r = o.size > 0, n = /* @__PURE__ */ new Set(), s = [
1485
- ...e.styles.map((a) => a.affectedFrames ?? []),
1486
- ...e.texts.map((a) => a.affectedFrames ?? []),
1487
- ...e.operations.map((a) => a.affectedFrames ?? [])
1510
+ ...e.styles.map((l) => l.affectedFrames ?? []),
1511
+ ...e.texts.map((l) => l.affectedFrames ?? []),
1512
+ ...e.operations.map((l) => l.affectedFrames ?? [])
1488
1513
  ];
1489
- for (const a of s)
1490
- for (const d of a) {
1491
- if (r && rn.test(d.id) && !o.has(d.id))
1514
+ for (const l of s)
1515
+ for (const a of l) {
1516
+ if (r && wn.test(a.id) && !o.has(a.id))
1492
1517
  throw new Error(
1493
- `"Impact Screen"${d.name}"This internal editor ID (${d.id}) is used. A canonical screen ID is required.`
1518
+ `"Impact Screen"${a.name}"This internal editor ID (${a.id}) is used. A canonical screen ID is required.`
1494
1519
  );
1495
- !d.id || r && !o.has(d.id) || n.add(d.id);
1520
+ !a.id || r && !o.has(a.id) || n.add(a.id);
1496
1521
  }
1497
1522
  return [...n].sort();
1498
1523
  }
1499
- async function He(e, t, o) {
1524
+ async function Ze(e, t, o) {
1500
1525
  const r = await e(`${t.replace(/\/$/, "")}/capture`, {
1501
1526
  method: "POST",
1502
1527
  headers: { "content-type": "application/json" },
@@ -1508,63 +1533,63 @@ async function He(e, t, o) {
1508
1533
  );
1509
1534
  if (typeof n.baselineId != "string" || !n.baselineId)
1510
1535
  throw new Error("Pygmalion visual QA response has no baselineId");
1511
- const s = Array.isArray(n.frames) ? n.frames.map((m) => sn(m, o.phase)).filter((m) => m != null) : [], a = Array.isArray(n.failures) ? n.failures.map((m) => {
1512
- if (!m || typeof m != "object" || Array.isArray(m)) return null;
1513
- const y = m;
1514
- return typeof y.id == "string" && typeof y.error == "string" ? { id: y.id, error: y.error } : null;
1515
- }).filter((m) => m != null) : [], d = new Set(o.frameIds), h = new Set(s.map((m) => m.id)).size === s.length && s.every((m) => d.has(m.id)) && a.every((m) => d.has(m.id));
1536
+ const s = Array.isArray(n.frames) ? n.frames.map((h) => vn(h, o.phase)).filter((h) => h != null) : [], l = Array.isArray(n.failures) ? n.failures.map((h) => {
1537
+ if (!h || typeof h != "object" || Array.isArray(h)) return null;
1538
+ const p = h;
1539
+ return typeof p.id == "string" && typeof p.error == "string" ? { id: p.id, error: p.error } : null;
1540
+ }).filter((h) => h != null) : [], a = new Set(o.frameIds), w = new Set(s.map((h) => h.id)).size === s.length && s.every((h) => a.has(h.id)) && l.every((h) => a.has(h.id));
1516
1541
  return {
1517
1542
  phase: o.phase,
1518
1543
  baselineId: n.baselineId,
1519
- complete: n.complete !== !1 && h && a.length === 0 && s.length === o.frameIds.length,
1544
+ complete: n.complete !== !1 && w && l.length === 0 && s.length === o.frameIds.length,
1520
1545
  frames: s,
1521
- failures: a
1546
+ failures: l
1522
1547
  };
1523
1548
  }
1524
- const ve = {
1549
+ const Oe = {
1525
1550
  mirror: "/__pygmalion-dev-control",
1526
1551
  sessions: "/__pygmalion-design-session",
1527
1552
  inspect: "/__pygmalion-inspect"
1528
- }, cn = "pygmalion.designSessionId", ln = "/__pygmalion-qa", fe = /* @__PURE__ */ new Map();
1529
- function qe() {
1553
+ }, In = "pygmalion.designSessionId", xn = "/__pygmalion-qa", Ie = /* @__PURE__ */ new Map();
1554
+ function et() {
1530
1555
  var e;
1531
1556
  return typeof window < "u" && ((e = window.crypto) != null && e.randomUUID) ? window.crypto.randomUUID() : `pygmalion-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1532
1557
  }
1533
- function dn(e, t) {
1558
+ function Pn(e, t) {
1534
1559
  if (e) return e;
1535
- const o = fe.get(t);
1560
+ const o = Ie.get(t);
1536
1561
  if (o) return o;
1537
1562
  try {
1538
1563
  const r = window.localStorage.getItem(t);
1539
1564
  if (r)
1540
- return fe.set(t, r), r;
1541
- const n = qe();
1542
- return window.localStorage.setItem(t, n), fe.set(t, n), n;
1565
+ return Ie.set(t, r), r;
1566
+ const n = et();
1567
+ return window.localStorage.setItem(t, n), Ie.set(t, n), n;
1543
1568
  } catch {
1544
- const r = qe();
1545
- return fe.set(t, r), r;
1569
+ const r = et();
1570
+ return Ie.set(t, r), r;
1546
1571
  }
1547
1572
  }
1548
- async function Y(e) {
1573
+ async function ee(e) {
1549
1574
  const t = await e.json();
1550
1575
  if (!e.ok) throw new Error(t.error ?? `Pygmalion request failed (${e.status})`);
1551
1576
  return t;
1552
1577
  }
1553
- function Sn(e = {}) {
1554
- var L, te, X, W, i;
1578
+ function kn(e = {}) {
1579
+ var re, J, Z, V, c;
1555
1580
  const {
1556
1581
  sessionId: t,
1557
- sessionStorageKey: o = cn,
1582
+ sessionStorageKey: o = In,
1558
1583
  autoStart: r = !0,
1559
1584
  fetcher: n = fetch,
1560
1585
  formatApplyMessage: s
1561
- } = e, a = ((L = e.endpoints) == null ? void 0 : L.mirror) ?? ve.mirror, d = ((te = e.endpoints) == null ? void 0 : te.sessions) ?? ve.sessions, u = ((X = e.endpoints) == null ? void 0 : X.inspect) ?? ve.inspect, h = e.visualQa != null, m = ((W = e.visualQa) == null ? void 0 : W.endpoint) ?? ln, y = JSON.stringify(((i = e.visualQa) == null ? void 0 : i.eligibleFrameIds) ?? []), I = oe(
1562
- () => JSON.parse(y),
1563
- [y]
1564
- ), x = oe(
1565
- () => dn(t, o),
1586
+ } = e, l = ((re = e.endpoints) == null ? void 0 : re.mirror) ?? Oe.mirror, a = ((J = e.endpoints) == null ? void 0 : J.sessions) ?? Oe.sessions, u = ((Z = e.endpoints) == null ? void 0 : Z.inspect) ?? Oe.inspect, w = e.visualQa != null, h = ((V = e.visualQa) == null ? void 0 : V.endpoint) ?? xn, p = JSON.stringify(((c = e.visualQa) == null ? void 0 : c.eligibleFrameIds) ?? []), E = ie(
1587
+ () => JSON.parse(p),
1588
+ [p]
1589
+ ), b = ie(
1590
+ () => Pn(t, o),
1566
1591
  [t, o]
1567
- ), [p, C] = ce({
1592
+ ), [y, P] = fe({
1568
1593
  state: "idle",
1569
1594
  commit: null,
1570
1595
  shortCommit: null,
@@ -1574,219 +1599,219 @@ function Sn(e = {}) {
1574
1599
  warning: null,
1575
1600
  error: null,
1576
1601
  appOrigin: null
1577
- }), [f, M] = ce(null), [D, w] = ce(null), [O, Z] = ce({
1602
+ }), [f, R] = fe(null), [D, v] = fe(null), [M, te] = fe({
1578
1603
  refs: [],
1579
1604
  defaultRef: null,
1580
1605
  worktreeRef: null
1581
- }), S = Ie(null), N = Ie(null), F = ne(
1582
- async (c = !0, l) => {
1583
- if (l != null && S.current && await S.current.catch(() => {
1584
- }), S.current) return S.current;
1606
+ }), x = xe(null), C = xe(null), j = de(
1607
+ async (i = !0, d) => {
1608
+ if (d != null && x.current && await x.current.catch(() => {
1609
+ }), x.current) return x.current;
1585
1610
  const g = (async () => {
1586
- C((P) => ({ ...P, state: "syncing", error: null }));
1611
+ P((I) => ({ ...I, state: "syncing", error: null }));
1587
1612
  try {
1588
- const P = l != null;
1589
- let A = await n(`${a}/${c || P ? "refresh" : "status"}`, {
1590
- method: c || P ? "POST" : "GET",
1591
- ...P ? {
1613
+ const I = d != null;
1614
+ let m = await n(`${l}/${i || I ? "refresh" : "status"}`, {
1615
+ method: i || I ? "POST" : "GET",
1616
+ ...I ? {
1592
1617
  headers: { "content-type": "application/json" },
1593
- body: JSON.stringify({ ref: l })
1618
+ body: JSON.stringify({ ref: d })
1594
1619
  } : {}
1595
- }), k = await Y(A);
1596
- const q = Date.now();
1597
- for (; !c && k.state === "syncing" && Date.now() - q < 12e4; )
1598
- await new Promise((R) => window.setTimeout(R, 500)), A = await n(`${a}/status`), k = await Y(A);
1599
- if (k.state !== "ready" || !k.appOrigin || !k.commit)
1600
- throw new Error(k.error ?? "Pygmalion could not prepare the source preview");
1601
- const E = await Y(
1602
- await n(`${d}/open`, {
1620
+ }), N = await ee(m);
1621
+ const O = Date.now();
1622
+ for (; !i && N.state === "syncing" && Date.now() - O < 12e4; )
1623
+ await new Promise((q) => window.setTimeout(q, 500)), m = await n(`${l}/status`), N = await ee(m);
1624
+ if (N.state !== "ready" || !N.appOrigin || !N.commit)
1625
+ throw new Error(N.error ?? "Pygmalion could not prepare the source preview");
1626
+ const K = await ee(
1627
+ await n(`${a}/open`, {
1603
1628
  method: "POST",
1604
1629
  headers: { "content-type": "application/json" },
1605
- body: JSON.stringify({ sessionId: x, baseDevSha: k.commit })
1630
+ body: JSON.stringify({ sessionId: b, baseDevSha: N.commit })
1606
1631
  })
1607
1632
  );
1608
- if (!E.ok || !E.session)
1609
- throw new Error(E.error ?? "Pygmalion could not open the design session");
1610
- let v = E.session;
1611
- if (v.branchName) {
1612
- const R = await Y(
1613
- await n(`${d}/check`, {
1633
+ if (!K.ok || !K.session)
1634
+ throw new Error(K.error ?? "Pygmalion could not open the design session");
1635
+ let F = K.session;
1636
+ if (F.branchName) {
1637
+ const q = await ee(
1638
+ await n(`${a}/check`, {
1614
1639
  method: "POST",
1615
1640
  headers: { "content-type": "application/json" },
1616
- body: JSON.stringify({ sessionId: v.id })
1641
+ body: JSON.stringify({ sessionId: F.id })
1617
1642
  })
1618
1643
  );
1619
- if (!R.ok || !R.session)
1620
- throw new Error(R.error ?? "Pygmalion could not check the design session");
1621
- v = R.session;
1644
+ if (!q.ok || !q.session)
1645
+ throw new Error(q.error ?? "Pygmalion could not check the design session");
1646
+ F = q.session;
1622
1647
  }
1623
- C(k), M(v), w(v.appOrigin ?? k.appOrigin);
1624
- } catch (P) {
1625
- C((A) => ({
1626
- ...A,
1648
+ P(N), R(F), v(F.appOrigin ?? N.appOrigin);
1649
+ } catch (I) {
1650
+ P((m) => ({
1651
+ ...m,
1627
1652
  state: "error",
1628
- error: P instanceof Error ? P.message : String(P)
1653
+ error: I instanceof Error ? I.message : String(I)
1629
1654
  }));
1630
1655
  }
1631
1656
  })();
1632
- S.current = g;
1657
+ x.current = g;
1633
1658
  try {
1634
1659
  await g;
1635
1660
  } finally {
1636
- S.current === g && (S.current = null);
1661
+ x.current === g && (x.current = null);
1637
1662
  }
1638
1663
  },
1639
- [n, a, d, x]
1640
- ), _ = ne(async () => {
1664
+ [n, l, a, b]
1665
+ ), H = de(async () => {
1641
1666
  try {
1642
- const c = await Y(
1643
- await n(`${a}/refs`)
1644
- ), l = {
1645
- refs: c.refs ?? [],
1646
- defaultRef: c.defaultRef ?? null,
1647
- worktreeRef: c.worktreeRef ?? null
1667
+ const i = await ee(
1668
+ await n(`${l}/refs`)
1669
+ ), d = {
1670
+ refs: i.refs ?? [],
1671
+ defaultRef: i.defaultRef ?? null,
1672
+ worktreeRef: i.worktreeRef ?? null
1648
1673
  };
1649
- return Z(l), l;
1674
+ return te(d), d;
1650
1675
  } catch {
1651
- return O;
1676
+ return M;
1652
1677
  }
1653
- }, [n, a, O]), J = ne(
1654
- async (c, l) => {
1655
- if (f != null && f.branchName && !(l != null && l.discardEdits))
1678
+ }, [n, l, M]), Q = de(
1679
+ async (i, d) => {
1680
+ if (f != null && f.branchName && !(d != null && d.discardEdits))
1656
1681
  throw new Error(
1657
1682
  "This design session has unapplied edits against the current source. Apply or revert them, or pass discardEdits to switch anyway."
1658
1683
  );
1659
- await F(!0, c), await _();
1684
+ await j(!0, i), await H();
1660
1685
  },
1661
- [_, F, f == null ? void 0 : f.branchName]
1662
- ), se = ne(
1663
- async (c) => {
1664
- var k;
1686
+ [H, j, f == null ? void 0 : f.branchName]
1687
+ ), he = de(
1688
+ async (i) => {
1689
+ var N;
1665
1690
  if (!f) throw new Error("Pygmalion design session is not ready");
1666
- const l = N.current;
1667
- if (l && (l.sessionId !== f.id || l.baseDevSha !== f.baseDevSha || l.revision !== f.revision || l.fingerprint !== JSON.stringify(c)))
1691
+ const d = C.current;
1692
+ if (d && (d.sessionId !== f.id || d.baseDevSha !== f.baseDevSha || d.revision !== f.revision || d.fingerprint !== JSON.stringify(i)))
1668
1693
  throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
1669
- const g = await Y(
1670
- await n(`${d}/apply-visual`, {
1694
+ const g = await ee(
1695
+ await n(`${a}/apply-visual`, {
1671
1696
  method: "POST",
1672
1697
  headers: { "content-type": "application/json" },
1673
1698
  body: JSON.stringify({
1674
1699
  sessionId: f.id,
1675
1700
  baseDevSha: f.baseDevSha,
1676
1701
  expectedRevision: f.revision,
1677
- ...l ? { previewRevision: l.revision } : {},
1678
- changes: c
1702
+ ...d ? { previewRevision: d.revision } : {},
1703
+ changes: i
1679
1704
  })
1680
1705
  })
1681
1706
  );
1682
1707
  if (!g.ok || !g.session)
1683
1708
  throw new Error(g.error ?? "Pygmalion could not apply the visual changes");
1684
- M(g.session), g.session.appOrigin && w(g.session.appOrigin);
1685
- const P = g.applied ?? c.styles.length + c.texts.length + c.operations.length;
1686
- let A;
1687
- if (l != null && l.qaBaselineId && ((k = l.qaFrameIds) != null && k.length) && g.session.appOrigin)
1709
+ R(g.session), g.session.appOrigin && v(g.session.appOrigin);
1710
+ const I = g.applied ?? i.styles.length + i.texts.length + i.operations.length;
1711
+ let m;
1712
+ if (d != null && d.qaBaselineId && ((N = d.qaFrameIds) != null && N.length) && g.session.appOrigin)
1688
1713
  try {
1689
- A = await He(n, m, {
1714
+ m = await Ze(n, h, {
1690
1715
  phase: "changed",
1691
- baselineId: l.qaBaselineId,
1692
- basePath: Be(g.session.appOrigin, window.location.origin),
1693
- frameIds: l.qaFrameIds
1716
+ baselineId: d.qaBaselineId,
1717
+ basePath: Xe(g.session.appOrigin, window.location.origin),
1718
+ frameIds: d.qaFrameIds
1694
1719
  });
1695
- } catch (q) {
1696
- const E = q instanceof Error ? q.message : String(q);
1697
- A = {
1720
+ } catch (O) {
1721
+ const K = O instanceof Error ? O.message : String(O);
1722
+ m = {
1698
1723
  phase: "changed",
1699
- baselineId: l.qaBaselineId,
1724
+ baselineId: d.qaBaselineId,
1700
1725
  complete: !1,
1701
1726
  frames: [],
1702
- failures: l.qaFrameIds.map((v) => ({ id: v, error: E }))
1727
+ failures: d.qaFrameIds.map((F) => ({ id: F, error: K }))
1703
1728
  };
1704
1729
  }
1705
- return N.current = null, {
1706
- applied: P,
1730
+ return C.current = null, {
1731
+ applied: I,
1707
1732
  branch: g.session.branchName ?? void 0,
1708
1733
  integration: g.session.integration.state,
1709
- message: s == null ? void 0 : s(g.session, P),
1710
- ...A ? { qa: A } : {}
1734
+ message: s == null ? void 0 : s(g.session, I),
1735
+ ...m ? { qa: m } : {}
1711
1736
  };
1712
1737
  },
1713
- [n, s, m, f, d]
1714
- ), ie = ne(
1715
- async (c) => {
1716
- var k;
1738
+ [n, s, h, f, a]
1739
+ ), ue = de(
1740
+ async (i) => {
1741
+ var N;
1717
1742
  if (!f) throw new Error("Pygmalion design session is not ready");
1718
- N.current = null;
1719
- const l = await Y(
1720
- await n(`${d}/preview-visual`, {
1743
+ C.current = null;
1744
+ const d = await ee(
1745
+ await n(`${a}/preview-visual`, {
1721
1746
  method: "POST",
1722
1747
  headers: { "content-type": "application/json" },
1723
1748
  body: JSON.stringify({
1724
1749
  sessionId: f.id,
1725
1750
  baseDevSha: f.baseDevSha,
1726
1751
  expectedRevision: f.revision,
1727
- changes: c
1752
+ changes: i
1728
1753
  })
1729
1754
  })
1730
1755
  );
1731
- if (!l.ok || !Number.isSafeInteger(l.revision))
1732
- throw new Error(l.error ?? "Pygmalion could not preview the visual changes");
1733
- const g = h ? an(c, I) : [];
1734
- let P;
1735
- const A = f.appOrigin ?? p.appOrigin;
1756
+ if (!d.ok || !Number.isSafeInteger(d.revision))
1757
+ throw new Error(d.error ?? "Pygmalion could not preview the visual changes");
1758
+ const g = w ? Sn(i, E) : [];
1759
+ let I;
1760
+ const m = f.appOrigin ?? y.appOrigin;
1736
1761
  if (g.length > 0) {
1737
- if (!A)
1762
+ if (!m)
1738
1763
  throw new Error("Impact screen QA baseline preview not ready");
1739
- if (P = await He(n, m, {
1764
+ if (I = await Ze(n, h, {
1740
1765
  phase: "baseline",
1741
- basePath: Be(A, window.location.origin),
1766
+ basePath: Xe(m, window.location.origin),
1742
1767
  frameIds: g
1743
- }), !P.complete)
1768
+ }), !I.complete)
1744
1769
  throw new Error(
1745
- ((k = P.failures[0]) == null ? void 0 : k.error) ?? `Failed to capture ${g.length - P.frames.length} affected frames`
1770
+ ((N = I.failures[0]) == null ? void 0 : N.error) ?? `Failed to capture ${g.length - I.frames.length} affected frames`
1746
1771
  );
1747
1772
  }
1748
- return N.current = {
1773
+ return C.current = {
1749
1774
  sessionId: f.id,
1750
1775
  baseDevSha: f.baseDevSha,
1751
- revision: l.revision,
1752
- fingerprint: JSON.stringify(c),
1753
- ...P ? { qaBaselineId: P.baselineId, qaFrameIds: g } : {}
1776
+ revision: d.revision,
1777
+ fingerprint: JSON.stringify(i),
1778
+ ...I ? { qaBaselineId: I.baselineId, qaFrameIds: g } : {}
1754
1779
  }, {
1755
- revision: l.revision,
1756
- files: Array.isArray(l.files) ? l.files : [],
1757
- affectedFiles: Array.isArray(l.affectedFiles) ? l.affectedFiles : [],
1758
- ...P ? { qa: P } : {}
1780
+ revision: d.revision,
1781
+ files: Array.isArray(d.files) ? d.files : [],
1782
+ affectedFiles: Array.isArray(d.affectedFiles) ? d.affectedFiles : [],
1783
+ ...I ? { qa: I } : {}
1759
1784
  };
1760
1785
  },
1761
1786
  [
1762
1787
  n,
1763
- p.appOrigin,
1764
- I,
1765
- m,
1788
+ y.appOrigin,
1789
+ E,
1790
+ h,
1766
1791
  f,
1767
- d,
1768
- h
1792
+ a,
1793
+ w
1769
1794
  ]
1770
- ), ee = ne(
1771
- async (c) => {
1772
- if (c.length === 0) return { files: [] };
1773
- const l = await Y(
1795
+ ), W = de(
1796
+ async (i) => {
1797
+ if (i.length === 0) return { files: [] };
1798
+ const d = await ee(
1774
1799
  await n(`${u}/impact`, {
1775
1800
  method: "POST",
1776
1801
  headers: { "content-type": "application/json" },
1777
- body: JSON.stringify({ componentFiles: c })
1802
+ body: JSON.stringify({ componentFiles: i })
1778
1803
  })
1779
1804
  );
1780
- if (l.error || l.ok === !1)
1781
- throw new Error(l.error ?? "Pygmalion could not calculate source impact");
1782
- return { files: Array.isArray(l.files) ? l.files : [] };
1805
+ if (d.error || d.ok === !1)
1806
+ throw new Error(d.error ?? "Pygmalion could not calculate source impact");
1807
+ return { files: Array.isArray(d.files) ? d.files : [] };
1783
1808
  },
1784
1809
  [n, u]
1785
- ), K = ne(async () => {
1810
+ ), ae = de(async () => {
1786
1811
  if (!(f != null && f.canRevert) || !f.headSha)
1787
1812
  throw new Error("There are no reversible changes applied");
1788
- const c = await Y(
1789
- await n(`${d}/revert-visual`, {
1813
+ const i = await ee(
1814
+ await n(`${a}/revert-visual`, {
1790
1815
  method: "POST",
1791
1816
  headers: { "content-type": "application/json" },
1792
1817
  body: JSON.stringify({
@@ -1797,88 +1822,88 @@ function Sn(e = {}) {
1797
1822
  })
1798
1823
  })
1799
1824
  );
1800
- if (!c.ok || c.reverted !== !0 || !c.operation || c.operation.kind !== "visual-revert" || !c.session)
1801
- throw new Error(c.error ?? "Pygmalion could not revert the last visual change");
1802
- return N.current = null, M(c.session), c.session.appOrigin && w(c.session.appOrigin), {
1825
+ if (!i.ok || i.reverted !== !0 || !i.operation || i.operation.kind !== "visual-revert" || !i.session)
1826
+ throw new Error(i.error ?? "Pygmalion could not revert the last visual change");
1827
+ return C.current = null, R(i.session), i.session.appOrigin && v(i.session.appOrigin), {
1803
1828
  reverted: !0,
1804
- operation: c.operation,
1805
- session: c.session
1829
+ operation: i.operation,
1830
+ session: i.session
1806
1831
  };
1807
- }, [n, f, d]);
1808
- le(() => {
1809
- r && F(!1);
1810
- }, [r, F]), le(() => {
1811
- r && _();
1832
+ }, [n, f, a]);
1833
+ me(() => {
1834
+ r && j(!1);
1835
+ }, [r, j]), me(() => {
1836
+ r && H();
1812
1837
  }, [r]);
1813
- const Q = (f == null ? void 0 : f.appOrigin) ?? p.appOrigin ?? D, B = (f == null ? void 0 : f.headSha) ?? (f == null ? void 0 : f.baseDevSha) ?? p.commit ?? "pending";
1838
+ const ne = (f == null ? void 0 : f.appOrigin) ?? y.appOrigin ?? D, Y = (f == null ? void 0 : f.headSha) ?? (f == null ? void 0 : f.baseDevSha) ?? y.commit ?? "pending";
1814
1839
  return {
1815
- mirror: p,
1840
+ mirror: y,
1816
1841
  session: f,
1817
1842
  ready: D != null,
1818
- appOrigin: Q,
1819
- previewRevision: `${B}:${(f == null ? void 0 : f.revision) ?? 0}`,
1820
- previewSourceRevision: B,
1821
- refresh: F,
1822
- switchSource: J,
1823
- sourceRefs: O,
1824
- loadSourceRefs: _,
1825
- previewVisual: ie,
1826
- inspectImpact: ee,
1827
- applyVisual: se,
1828
- revertLastVisual: K
1843
+ appOrigin: ne,
1844
+ previewRevision: `${Y}:${(f == null ? void 0 : f.revision) ?? 0}`,
1845
+ previewSourceRevision: Y,
1846
+ refresh: j,
1847
+ switchSource: Q,
1848
+ sourceRefs: M,
1849
+ loadSourceRefs: H,
1850
+ previewVisual: ue,
1851
+ inspectImpact: W,
1852
+ applyVisual: he,
1853
+ revertLastVisual: ae
1829
1854
  };
1830
1855
  }
1831
- function vn({
1856
+ function Fn({
1832
1857
  value: e,
1833
1858
  currentCommit: t = null,
1834
1859
  refs: o,
1835
1860
  onChange: r,
1836
1861
  busy: n = !1,
1837
1862
  defaultRef: s = null,
1838
- worktreeRef: a = null,
1839
- label: d = "Source revision",
1863
+ worktreeRef: l = null,
1864
+ label: a = "Source revision",
1840
1865
  refreshLabel: u = "Refresh current revision",
1841
- children: h,
1842
- className: m
1866
+ children: w,
1867
+ className: h
1843
1868
  }) {
1844
- const y = oe(
1869
+ const p = ie(
1845
1870
  () => ({
1846
- local: o.filter((w) => w.kind === "local"),
1847
- remote: o.filter((w) => w.kind === "remote")
1871
+ local: o.filter((v) => v.kind === "local"),
1872
+ remote: o.filter((v) => v.kind === "remote")
1848
1873
  }),
1849
1874
  [o]
1850
- ), I = oe(() => {
1851
- const w = new Set(o.map((O) => O.name));
1852
- return s && w.add(s), a && w.add(a), w;
1853
- }, [s, o, a]), x = e ?? s ?? "", p = oe(
1854
- () => o.find((w) => w.name === x) ?? null,
1855
- [o, x]
1856
- ), C = (t == null ? void 0 : t.toLowerCase()) ?? null, f = (p == null ? void 0 : p.commit.toLowerCase()) ?? null, M = !!(C && f && C !== f && !C.startsWith(f) && !f.startsWith(C)), D = (t == null ? void 0 : t.slice(0, 8)) ?? null;
1875
+ ), E = ie(() => {
1876
+ const v = new Set(o.map((M) => M.name));
1877
+ return s && v.add(s), l && v.add(l), v;
1878
+ }, [s, o, l]), b = e ?? s ?? "", y = ie(
1879
+ () => o.find((v) => v.name === b) ?? null,
1880
+ [o, b]
1881
+ ), P = (t == null ? void 0 : t.toLowerCase()) ?? null, f = (y == null ? void 0 : y.commit.toLowerCase()) ?? null, R = !!(P && f && P !== f && !P.startsWith(f) && !f.startsWith(P)), D = (t == null ? void 0 : t.slice(0, 8)) ?? null;
1857
1882
  return /* @__PURE__ */ $(
1858
1883
  "span",
1859
1884
  {
1860
- className: m,
1885
+ className: h,
1861
1886
  "data-pygmalion-source-ref": "",
1862
1887
  "data-busy": n ? "" : void 0,
1863
- "data-update-available": M ? "" : void 0,
1864
- "data-latest-commit": M ? p == null ? void 0 : p.commit : void 0,
1888
+ "data-update-available": R ? "" : void 0,
1889
+ "data-latest-commit": R ? y == null ? void 0 : y.commit : void 0,
1865
1890
  style: { position: "relative", display: "inline-flex", alignItems: "center" },
1866
1891
  children: [
1867
- h ?? /* @__PURE__ */ b("span", { "data-pygmalion-source-ref-value": "", children: x || d }),
1892
+ w ?? /* @__PURE__ */ S("span", { "data-pygmalion-source-ref-value": "", children: b || a }),
1868
1893
  /* @__PURE__ */ $(
1869
1894
  "select",
1870
1895
  {
1871
- value: x,
1896
+ value: b,
1872
1897
  disabled: n,
1873
- "aria-label": d,
1898
+ "aria-label": a,
1874
1899
  "data-pygmalion-source-ref-select": "",
1875
- onChange: (w) => {
1876
- const O = w.target.value;
1877
- if (!O) {
1878
- x && r(x);
1900
+ onChange: (v) => {
1901
+ const M = v.target.value;
1902
+ if (!M) {
1903
+ b && r(b);
1879
1904
  return;
1880
1905
  }
1881
- O && O !== x && r(O);
1906
+ M && M !== b && r(M);
1882
1907
  },
1883
1908
  style: {
1884
1909
  position: "absolute",
@@ -1894,27 +1919,27 @@ function vn({
1894
1919
  margin: 0
1895
1920
  },
1896
1921
  children: [
1897
- x ? /* @__PURE__ */ $("option", { value: "", children: [
1922
+ b ? /* @__PURE__ */ $("option", { value: "", children: [
1898
1923
  u,
1899
1924
  " · ",
1900
- x,
1901
- M ? ` · ${D ?? "unknown"} → ${(p == null ? void 0 : p.commit) ?? "latest"}` : ""
1925
+ b,
1926
+ R ? ` · ${D ?? "unknown"} → ${(y == null ? void 0 : y.commit) ?? "latest"}` : ""
1902
1927
  ] }) : null,
1903
- x && !I.has(x) ? /* @__PURE__ */ b("option", { value: x, children: x }) : null,
1904
- a ? /* @__PURE__ */ $("option", { value: a, children: [
1905
- a,
1928
+ b && !E.has(b) ? /* @__PURE__ */ S("option", { value: b, children: b }) : null,
1929
+ l ? /* @__PURE__ */ $("option", { value: l, children: [
1930
+ l,
1906
1931
  " · uncommitted work"
1907
1932
  ] }) : null,
1908
- y.local.length > 0 ? /* @__PURE__ */ b("optgroup", { label: "local", children: y.local.map((w) => /* @__PURE__ */ $("option", { value: w.name, children: [
1909
- w.name,
1933
+ p.local.length > 0 ? /* @__PURE__ */ S("optgroup", { label: "local", children: p.local.map((v) => /* @__PURE__ */ $("option", { value: v.name, children: [
1934
+ v.name,
1910
1935
  " · ",
1911
- w.commit
1912
- ] }, w.fullName)) }) : null,
1913
- y.remote.length > 0 ? /* @__PURE__ */ b("optgroup", { label: "remote", children: y.remote.map((w) => /* @__PURE__ */ $("option", { value: w.name, children: [
1914
- w.name,
1936
+ v.commit
1937
+ ] }, v.fullName)) }) : null,
1938
+ p.remote.length > 0 ? /* @__PURE__ */ S("optgroup", { label: "remote", children: p.remote.map((v) => /* @__PURE__ */ $("option", { value: v.name, children: [
1939
+ v.name,
1915
1940
  " · ",
1916
- w.commit
1917
- ] }, w.fullName)) }) : null
1941
+ v.commit
1942
+ ] }, v.fullName)) }) : null
1918
1943
  ]
1919
1944
  }
1920
1945
  )
@@ -1922,376 +1947,446 @@ function vn({
1922
1947
  }
1923
1948
  );
1924
1949
  }
1925
- const In = {
1926
- editor: V,
1927
- getObserverTree: et,
1928
- isObservableProp: Ze
1950
+ const Tn = {
1951
+ editor: X,
1952
+ getObserverTree: dt,
1953
+ isObservableProp: lt
1929
1954
  };
1930
- function xn(e) {
1931
- V.navigateToPageByName(e);
1955
+ function zn(e) {
1956
+ X.navigateToPageByName(e);
1932
1957
  }
1933
- function Pn() {
1934
- V.openPreview();
1958
+ function jn() {
1959
+ X.openPreview();
1935
1960
  }
1936
- function Cn() {
1937
- const e = $e.entries.length > 0;
1938
- return e && $e.discardPending(), V.resetCurrentEdits() || e;
1961
+ function _n() {
1962
+ const e = He.entries.length > 0;
1963
+ return e && He.discardPending(), X.resetCurrentEdits() || e;
1939
1964
  }
1940
- function En({
1965
+ function Bn({
1941
1966
  registry: e,
1942
1967
  tokens: t,
1943
1968
  initialPages: o,
1944
- componentConnections: r,
1945
- viewportPresets: n,
1946
- previewEnvironmentControls: s,
1969
+ initialCanvas: r,
1970
+ componentConnections: n,
1971
+ viewportPresets: s,
1972
+ previewEnvironmentControls: l,
1947
1973
  designImport: a,
1948
- onTokensChange: d,
1949
- appOrigin: u,
1974
+ onTokensChange: u,
1975
+ appOrigin: w,
1950
1976
  previewRevision: h,
1951
- previewCacheNamespace: m,
1952
- previewArtifacts: y,
1953
- previewArtifactEndpoint: I,
1954
- previewConcurrency: x,
1955
- previewOpen: p,
1956
- onPreviewOpenChange: C,
1957
- flowCanvas: f,
1958
- onApply: M,
1959
- onDesignChange: D,
1960
- onInspectApply: w,
1961
- onInspectPreview: O,
1962
- onInspectImpact: Z,
1963
- storyboardDiscovery: S = !0,
1964
- storyboardDiscoveryEndpoint: N = bt
1977
+ previewCacheNamespace: p,
1978
+ previewArtifacts: E,
1979
+ previewArtifactEndpoint: b,
1980
+ previewConcurrency: y,
1981
+ previewOpen: P,
1982
+ onPreviewOpenChange: f,
1983
+ flowCanvas: R,
1984
+ onApply: D,
1985
+ onDesignChange: v,
1986
+ onInspectApply: M,
1987
+ onInspectPreview: te,
1988
+ onInspectImpact: x,
1989
+ storyboard: C,
1990
+ storyboardDiscovery: j = !0,
1991
+ storyboardDiscoveryEndpoint: H = ut
1965
1992
  }) {
1966
- const [F, _] = ce(!S), [J, se] = ce();
1967
- a && (a.assertComplete(), tt(a));
1968
- const ie = e ?? (a == null ? void 0 : a.getRegistry()), ee = t ?? (a == null ? void 0 : a.getTokens()), K = o ?? (a == null ? void 0 : a.getInitialPages());
1969
- ie && nt(ie), rt(r ?? []), ee && ot(ee), n && st(n), xt(d ?? null), it(m), at(
1970
- !!(I != null && I.trim())
1993
+ const Q = ie(
1994
+ () => ({}),
1995
+ [
1996
+ a,
1997
+ o,
1998
+ j,
1999
+ H,
2000
+ C
2001
+ ]
2002
+ ), [he, ue] = fe(null), W = he === Q, [ae, ne] = fe();
2003
+ a && (a.assertComplete(), ft(a));
2004
+ const Y = e ?? (a == null ? void 0 : a.getRegistry()), re = t ?? (a == null ? void 0 : a.getTokens()), J = o ?? (a == null ? void 0 : a.getInitialPages());
2005
+ Y && mt(Y), ht(n ?? []), re && pt(re), s && gt(s), Tt(u ?? null), yt(p), wt(
2006
+ !!(b != null && b.trim())
1971
2007
  );
1972
- const Q = J ?? y, B = oe(
1973
- () => (K ?? []).flatMap(
1974
- (i) => i.route && i.importPageId ? [
2008
+ const Z = ae ?? E, V = ie(
2009
+ () => (J ?? []).flatMap(
2010
+ (m) => m.route && m.importPageId ? [
1975
2011
  {
1976
- canonicalId: i.importPageId,
1977
- route: i.route,
1978
- width: i.width,
1979
- height: i.height,
1980
- environment: i.environment,
1981
- preset: i.preset,
1982
- interactions: i.interactions,
1983
- assertions: i.assertions
2012
+ canonicalId: m.importPageId,
2013
+ route: m.route,
2014
+ width: m.width,
2015
+ height: m.height,
2016
+ environment: m.environment,
2017
+ preset: m.preset,
2018
+ interactions: m.interactions,
2019
+ assertions: m.assertions
1984
2020
  }
1985
2021
  ] : []
1986
2022
  ),
1987
- [K]
1988
- ), L = h ?? vt(), te = u ?? Oe(), X = Ie([]), W = oe(
1989
- () => B.map((i) => ({
1990
- id: i.canonicalId,
1991
- fingerprint: ct(
1992
- i,
1993
- L,
1994
- be()
2023
+ [J]
2024
+ ), c = h ?? kt(), i = w ?? qe(), d = xe([]), g = xe([]), I = ie(
2025
+ () => V.map((m) => ({
2026
+ id: m.canonicalId,
2027
+ fingerprint: bt(
2028
+ m,
2029
+ c,
2030
+ Se()
1995
2031
  )
1996
2032
  })),
1997
- [B, L, F]
2033
+ [V, c, W]
1998
2034
  );
1999
- return X.current = W, x != null && lt(x), Pt(C ?? null), f != null && dt(f), Ct(M ?? null), Et(w ?? null), ut(O ?? null), Nt(Z ?? null), K && V.initPagesFromComponents(K), Fe(() => {
2000
- u != null && ft(u), h != null && mt(h), pt(s ?? []);
2001
- }, [u, s, h]), Fe(() => {
2002
- !Q || !K || !F || Ne(Q, {
2003
- namespace: m ?? "",
2004
- previewRevision: L,
2005
- appOrigin: te,
2006
- baselineEnvironment: be(),
2007
- allowStaleIdentity: !!I,
2008
- allowMatchingFrameIdentity: J != null,
2009
- pages: B.map((i, c) => {
2010
- var l;
2035
+ return d.current = I, g.current = V.map(
2036
+ (m) => vt({
2037
+ namespace: p ?? "",
2038
+ previewRevision: c,
2039
+ route: m.route,
2040
+ width: m.width ?? 390,
2041
+ height: m.height ?? 600,
2042
+ environment: tt(
2043
+ Se(),
2044
+ m.environment
2045
+ ),
2046
+ preset: m.preset,
2047
+ interactions: m.interactions,
2048
+ assertions: m.assertions
2049
+ })
2050
+ ), y != null && St(y), zt(f ?? null), R != null && It(R), jt(D ?? null), _t(M ?? null), xt(te ?? null), Bt(x ?? null), J && X.initPagesFromComponents(J, { initialCanvas: r }), Le(() => {
2051
+ w != null && Pt(w), h != null && Et(h), Ct(l ?? []);
2052
+ }, [w, l, h]), Le(() => {
2053
+ !Z || !J || !W || je(Z, {
2054
+ namespace: p ?? "",
2055
+ previewRevision: c,
2056
+ appOrigin: i,
2057
+ baselineEnvironment: Se(),
2058
+ allowStaleIdentity: !!b,
2059
+ allowMatchingFrameIdentity: ae != null,
2060
+ pages: V.map((m, N) => {
2061
+ var O;
2011
2062
  return {
2012
- ...i,
2013
- fingerprint: (l = W[c]) == null ? void 0 : l.fingerprint
2063
+ ...m,
2064
+ fingerprint: (O = I[N]) == null ? void 0 : O.fingerprint
2014
2065
  };
2015
2066
  })
2016
2067
  });
2017
2068
  }, [
2018
- Q,
2019
- W,
2020
- B,
2069
+ Z,
2021
2070
  I,
2022
- m,
2071
+ V,
2072
+ b,
2073
+ p,
2074
+ ae,
2075
+ i,
2023
2076
  J,
2024
- te,
2025
- K,
2026
- L,
2027
- F
2028
- ]), le(() => {
2029
- De(D ?? null);
2030
- const i = gt(V);
2077
+ c,
2078
+ W
2079
+ ]), me(() => {
2080
+ Ke(v ?? null);
2081
+ const m = Rt(X);
2031
2082
  return () => {
2032
- i(), De(null);
2083
+ m(), Ke(null);
2033
2084
  };
2034
- }, [D]), le(() => {
2035
- if (se(void 0), !F || !I || !(m != null && m.trim()) || !(h != null && h.trim()))
2085
+ }, [v]), me(() => {
2086
+ if (ne(void 0), !W || !b || !(p != null && p.trim()) || !(h != null && h.trim()))
2036
2087
  return;
2037
- const i = new AbortController(), c = ht({
2038
- endpoint: I,
2039
- captureBaseUrl: u
2040
- }), l = yt(h), g = (E) => {
2041
- Ne(E, {
2042
- namespace: m,
2088
+ const m = new AbortController(), N = Nt({
2089
+ endpoint: b,
2090
+ captureBaseUrl: w
2091
+ }), O = At(h), K = (T) => {
2092
+ je(T, {
2093
+ namespace: p,
2043
2094
  previewRevision: h,
2044
- appOrigin: Oe(),
2045
- baselineEnvironment: be(),
2095
+ appOrigin: qe(),
2096
+ baselineEnvironment: Se(),
2046
2097
  allowStaleIdentity: !0,
2047
2098
  allowMatchingFrameIdentity: !0,
2048
- pages: B.map((v, R) => {
2049
- var T;
2099
+ pages: V.map((A, z) => {
2100
+ var _;
2050
2101
  return {
2051
- ...v,
2052
- fingerprint: (T = W[R]) == null ? void 0 : T.fingerprint
2102
+ ...A,
2103
+ fingerprint: (_ = I[z]) == null ? void 0 : _.fingerprint
2053
2104
  };
2054
2105
  })
2055
- }), se(E);
2056
- }, P = (E, v, R) => It({
2057
- namespace: m,
2058
- sourceRevision: l,
2059
- transport: c,
2060
- signal: R,
2061
- ...E.length ? { frames: E } : {},
2062
- ...v ? {} : { generate: !1 }
2063
- }), A = (E, v) => {
2064
- const R = new Set(v);
2065
- return E.filter((T) => R.has(T.id));
2066
- }, k = (E, v) => E instanceof Error && E.message ? E.message : v, q = new AbortController();
2067
- if (Re(async (E) => {
2068
- var R, T, G;
2069
- const v = await P(E, !0, q.signal);
2070
- if (v.status === "accepted") {
2071
- g(v.artifact);
2072
- const ae = new Set(((R = v.frameResolution) == null ? void 0 : R.exact) ?? []);
2073
- if (E.every((we) => ae.has(we.id)))
2106
+ }), ne(T);
2107
+ }, F = (T, A, z) => Ft({
2108
+ namespace: p,
2109
+ sourceRevision: O,
2110
+ transport: N,
2111
+ signal: z,
2112
+ ...T.length ? { frames: T } : {},
2113
+ ...A ? {} : { generate: !1 }
2114
+ }), q = (T, A) => {
2115
+ const z = new Set(A);
2116
+ return T.filter((_) => z.has(_.id));
2117
+ }, ce = (T, A) => T instanceof Error && T.message ? T.message : A, pe = new AbortController();
2118
+ if (_e(async (T) => {
2119
+ var z, _, le;
2120
+ const A = await F(T, !0, pe.signal);
2121
+ if (A.status === "accepted") {
2122
+ K(A.artifact);
2123
+ const be = new Set(((z = A.frameResolution) == null ? void 0 : z.exact) ?? []);
2124
+ if (T.every((ve) => be.has(ve.id)))
2074
2125
  return { status: "accepted" };
2075
- const U = [
2076
- ...((T = v.frameResolution) == null ? void 0 : T.missing) ?? [],
2077
- ...((G = v.frameResolution) == null ? void 0 : G.stale) ?? []
2126
+ const ge = [
2127
+ ...((_ = A.frameResolution) == null ? void 0 : _.missing) ?? [],
2128
+ ...((le = A.frameResolution) == null ? void 0 : le.stale) ?? []
2078
2129
  ];
2079
2130
  return {
2080
2131
  status: "unavailable",
2081
- message: U.length ? `The exact preview endpoint did not return a current capture for ${U.join(", ")}.` : "The exact preview endpoint returned no current capture."
2132
+ message: ge.length ? `The exact preview endpoint did not return a current capture for ${ge.join(", ")}.` : "The exact preview endpoint returned no current capture."
2082
2133
  };
2083
2134
  }
2084
- return v.status === "rejected" ? {
2135
+ return A.status === "rejected" ? {
2085
2136
  status: "rejected",
2086
- message: v.errors.join(" ") || "The preview artifact was rejected."
2137
+ message: A.errors.join(" ") || "The preview artifact was rejected."
2087
2138
  } : {
2088
2139
  status: "unavailable",
2089
- message: k(
2090
- v.error,
2140
+ message: ce(
2141
+ A.error,
2091
2142
  "The exact preview endpoint is unavailable."
2092
2143
  )
2093
2144
  };
2094
- }), X.current.length) {
2095
- const E = X.current.filter((R) => {
2096
- const T = Ae(
2097
- R.id,
2098
- R.fingerprint
2145
+ }), d.current.length) {
2146
+ const T = d.current.filter((z) => {
2147
+ const _ = Be(
2148
+ z.id,
2149
+ z.fingerprint
2099
2150
  ).status;
2100
- return T !== "exact" && T !== "generating";
2151
+ return _ !== "exact" && _ !== "generating";
2101
2152
  });
2102
- de(E, { status: "checking" });
2103
- const v = (R) => R.filter((T) => {
2104
- const G = Ae(
2105
- T.id,
2106
- T.fingerprint
2153
+ oe(T, { status: "checking" });
2154
+ const A = (z) => z.filter((_) => {
2155
+ const le = Be(
2156
+ _.id,
2157
+ _.fingerprint
2107
2158
  ).status;
2108
- return G !== "generating" && G !== "exact";
2159
+ return le !== "generating" && le !== "exact";
2109
2160
  });
2110
2161
  (async () => {
2111
- var R, T, G;
2112
- for (const ae of wt(E)) {
2113
- const U = await P(
2114
- ae,
2162
+ var ge, ve, ze;
2163
+ const z = g.current.slice(
2164
+ 0,
2165
+ d.current.length
2166
+ );
2167
+ if (await $t(z), m.signal.aborted) return;
2168
+ const _ = new Set(
2169
+ d.current.filter(
2170
+ (U, k) => z[k] ? Mt(z[k]) : !1
2171
+ ).map((U) => U.id)
2172
+ );
2173
+ oe(
2174
+ A(
2175
+ T.filter((U) => _.has(U.id))
2176
+ ),
2177
+ { status: "exact" }
2178
+ );
2179
+ const le = A(
2180
+ T.filter((U) => !_.has(U.id))
2181
+ ), be = [];
2182
+ for (const U of Ue(
2183
+ le
2184
+ )) {
2185
+ const k = await Ot({
2186
+ namespace: p,
2187
+ sourceRevision: O,
2188
+ transport: N,
2189
+ frames: U,
2190
+ signal: m.signal
2191
+ });
2192
+ if (m.signal.aborted) return;
2193
+ if (k.status === "accepted") {
2194
+ be.push(
2195
+ ...q(U, k.resolution.exact)
2196
+ );
2197
+ const $e = q(U, [
2198
+ ...k.resolution.missing,
2199
+ ...k.resolution.stale
2200
+ ]);
2201
+ oe(A($e), {
2202
+ status: "outdated",
2203
+ message: "Select this frame to generate the exact preview."
2204
+ });
2205
+ continue;
2206
+ }
2207
+ const Ae = k.status === "rejected" ? k.errors.join(" ") || "The preview artifact probe was rejected." : ce(
2208
+ k.error,
2209
+ "The exact preview endpoint is unavailable."
2210
+ );
2211
+ oe(A(U), {
2212
+ status: "error",
2213
+ reason: k.status === "rejected" ? "rejected" : "unavailable",
2214
+ message: Ae
2215
+ });
2216
+ }
2217
+ for (const U of Ue(
2218
+ A(be)
2219
+ )) {
2220
+ const k = await F(
2221
+ U,
2115
2222
  !1,
2116
- i.signal
2223
+ m.signal
2117
2224
  );
2118
- if (i.signal.aborted) return;
2119
- if (U.status === "accepted") {
2120
- g(U.artifact), de(
2121
- A(ae, ((R = U.frameResolution) == null ? void 0 : R.exact) ?? []),
2225
+ if (m.signal.aborted) return;
2226
+ if (k.status === "accepted") {
2227
+ K(k.artifact), oe(
2228
+ q(U, ((ge = k.frameResolution) == null ? void 0 : ge.exact) ?? []),
2122
2229
  { status: "exact" }
2123
2230
  );
2124
- const Xe = A(ae, [
2125
- ...((T = U.frameResolution) == null ? void 0 : T.missing) ?? [],
2126
- ...((G = U.frameResolution) == null ? void 0 : G.stale) ?? []
2231
+ const $e = q(U, [
2232
+ ...((ve = k.frameResolution) == null ? void 0 : ve.missing) ?? [],
2233
+ ...((ze = k.frameResolution) == null ? void 0 : ze.stale) ?? []
2127
2234
  ]);
2128
- de(v(Xe), {
2235
+ oe(A($e), {
2129
2236
  status: "outdated",
2130
2237
  message: "Select this frame to generate the exact preview."
2131
2238
  });
2132
2239
  continue;
2133
2240
  }
2134
- const we = U.status === "rejected" ? U.errors.join(" ") || "The preview artifact was rejected." : k(
2135
- U.error,
2241
+ const Ae = k.status === "rejected" ? k.errors.join(" ") || "The preview artifact was rejected." : ce(
2242
+ k.error,
2136
2243
  "The exact preview endpoint is unavailable."
2137
2244
  );
2138
- de(v(ae), {
2245
+ oe(A(U), {
2139
2246
  status: "error",
2140
- reason: U.status === "rejected" ? "rejected" : "unavailable",
2141
- message: we
2247
+ reason: k.status === "rejected" ? "rejected" : "unavailable",
2248
+ message: Ae
2142
2249
  });
2143
2250
  }
2144
- })().catch((R) => {
2145
- if (i.signal.aborted) return;
2146
- const T = v(E);
2147
- de(T, {
2251
+ })().catch((z) => {
2252
+ if (m.signal.aborted) return;
2253
+ const _ = A(T);
2254
+ oe(_, {
2148
2255
  status: "error",
2149
2256
  reason: "unavailable",
2150
- message: k(
2151
- R,
2257
+ message: ce(
2258
+ z,
2152
2259
  "The exact preview endpoint is unavailable."
2153
2260
  )
2154
2261
  });
2155
2262
  });
2156
2263
  }
2157
2264
  return () => {
2158
- Re(null), q.abort(), i.abort();
2265
+ _e(null), pe.abort(), m.abort();
2159
2266
  };
2160
2267
  }, [
2161
- I,
2162
- m,
2268
+ b,
2269
+ p,
2163
2270
  h,
2164
- u,
2165
- F
2166
- ]), le(() => {
2167
- let i = !0;
2168
- if (!S)
2169
- return ue(void 0), _(!0), () => {
2170
- i = !1;
2271
+ w,
2272
+ W
2273
+ ]), me(() => {
2274
+ let m = !0;
2275
+ if (!j)
2276
+ return ye(void 0), we(null), se(null), ue(Q), () => {
2277
+ m = !1;
2171
2278
  };
2172
- const c = new AbortController();
2173
- return _(!1), ue(void 0), re(null), We({
2174
- endpoint: N,
2175
- signal: c.signal,
2176
- pages: V.pages.map((l) => ({
2177
- ...l,
2178
- id: l.importPageId ?? l.id,
2179
- importKind: l.importKind
2279
+ const N = new AbortController();
2280
+ return ye(void 0), we(null), se(null), st({
2281
+ endpoint: H,
2282
+ signal: N.signal,
2283
+ pages: X.pages.map((O) => ({
2284
+ ...O,
2285
+ id: O.importPageId ?? O.id,
2286
+ importKind: O.importKind
2180
2287
  })),
2181
- assets: (a == null ? void 0 : a.getAssets("screens")) ?? []
2182
- }).then((l) => {
2183
- i && (ue(l.baselineEnvironment), Me(l.manifest.routes ?? null), re(l.graph));
2288
+ assets: (a == null ? void 0 : a.getAssets("screens")) ?? [],
2289
+ storyboard: C
2290
+ }).then((O) => {
2291
+ m && (ye(O.baselineEnvironment), we(O.manifest.routes ?? null), se(O.graph));
2184
2292
  }).catch(() => {
2185
- i && (ue(void 0), Me(null), re(null));
2293
+ m && (ye(void 0), we(null), se(null));
2186
2294
  }).finally(() => {
2187
- i && _(!0);
2295
+ m && ue(Q);
2188
2296
  }), () => {
2189
- i = !1, c.abort(), ue(void 0), re(null);
2297
+ m = !1, N.abort(), ye(void 0), we(null), se(null);
2190
2298
  };
2191
2299
  }, [
2192
2300
  a,
2193
- o,
2194
- S,
2195
- N
2196
- ]), le(() => {
2197
- p == null || p === V.previewOpen || (p ? V.openPreview({ notifyHost: !1 }) : V.closePreview({ notifyHost: !1 }));
2198
- }, [p]), F ? /* @__PURE__ */ b(St, {}) : /* @__PURE__ */ b(
2199
- "div",
2200
- {
2201
- "data-pygmalion-storyboard-loading": "",
2202
- role: "status",
2203
- style: {
2204
- display: "grid",
2205
- width: "100%",
2206
- height: "100%",
2207
- placeItems: "center",
2208
- color: "#777777",
2209
- background: "#f5f5f5",
2210
- font: "12px system-ui, sans-serif"
2211
- },
2212
- children: "Discovering storyboard branches"
2213
- }
2214
- );
2301
+ C,
2302
+ j,
2303
+ H,
2304
+ Q
2305
+ ]), me(() => {
2306
+ P == null || P === X.previewOpen || (P ? X.openPreview({ notifyHost: !1 }) : X.closePreview({ notifyHost: !1 }));
2307
+ }, [P]), /* @__PURE__ */ S(Dt, { previewIdentityReady: W });
2215
2308
  }
2216
2309
  export {
2217
- An as DEFAULT_DESIGN_COMPILE_LIMITS,
2218
- Mn as DESIGN_IMPORT_KINDS,
2219
- $n as DESIGN_IR_SCHEMA,
2220
- On as DESIGN_IR_VERSION,
2221
- gn as PygmalionCatalogDocument,
2222
- yn as PygmalionCatalogMatrix,
2223
- hn as PygmalionCatalogSection,
2224
- En as PygmalionEditor,
2225
- bt as STORYBOARD_ENVIRONMENT_CONTROL,
2226
- Dn as STORYBOARD_ENVIRONMENT_QUERY,
2227
- vn as SourceRefControl,
2228
- In as __debug,
2229
- kn as applyTokenOverride,
2230
- It as bootstrapPreviewArtifact,
2231
- Fn as clearPreviewEnvironmentControlValues,
2232
- Tn as clearPygmalionPreviewCache,
2233
- zn as compileDesignDocument,
2234
- bn as createDesignComponentCatalog,
2235
- Zt as createDesignComponentVariantMatrix,
2236
- wn as createDesignGalleryCatalog,
2237
- _n as createDesignImportController,
2238
- jn as createDesignIntermediateDocument,
2239
- Bn as createDesignScreenCollection,
2240
- ht as createPreviewArtifactHttpTransport,
2241
- Un as createPreviewCacheNamespace,
2242
- Hn as createPreviewFrameFingerprint,
2243
- qn as createPreviewRecipeFingerprint,
2244
- Gn as createStoryboardCaptureRecipeIdentity,
2245
- $t as createStoryboardGraph,
2246
- Wt as createStoryboardGraphFromDiscovery,
2247
- Kn as createStoryboardGraphViewModel,
2248
- Ln as createStoryboardRouteUrl,
2249
- Qt as designCatalogKey,
2250
- Ve as designCatalogRegistryName,
2251
- Wn as enumerateDesignComponentConnectionCases,
2252
- Vn as expandDesignScreenCasesViewports,
2253
- Jn as expandDesignScreenCollectionViewports,
2254
- Qn as getDesignCodegenAdapters,
2255
- Xn as getDesignComponentConnection,
2256
- Yn as getDesignComponentConnectionForComponent,
2257
- Zn as getDesignComponentConnections,
2258
- er as getPreviewEnvironmentControlValue,
2259
- tr as getPreviewEnvironmentControls,
2260
- nr as getPreviewEnvironmentOverride,
2261
- rr as getRecommendedPygmalionPreviewConcurrency,
2262
- be as getStoryboardBaselineEnvironment,
2263
- Le as getStoryboardDiscoveryBaselineEnvironment,
2264
- or as getStoryboardGraph,
2265
- sr as getViewportPresets,
2266
- We as loadStoryboardDiscovery,
2267
- ir as mergeScreenPresets,
2268
- Ye as mergeStoryboardEnvironment,
2269
- pn as publishStoryboardDiscovery,
2270
- xn as pygmalionNavigate,
2271
- Pn as pygmalionOpenPreview,
2272
- Cn as pygmalionResetCurrentEdits,
2273
- ar as reconstructRoutePreviewArtifactScreenshotV3,
2274
- cr as reconstructRoutePreviewArtifactSnapshotV3,
2275
- lr as registerDesignCodegenAdapter,
2276
- dr as resetTokenOverrides,
2277
- ur as resolvePreviewArtifactFrames,
2278
- zt as resolveStoryboardScreenCases,
2279
- nt as setComponentRegistry,
2280
- rt as setDesignComponentConnections,
2281
- fr as setPreviewEnvironmentControlValue,
2282
- pt as setPreviewEnvironmentControls,
2283
- ft as setPygmalionAppOrigin,
2284
- lt as setPygmalionPreviewConcurrency,
2285
- mt as setPygmalionPreviewRevision,
2286
- ue as setStoryboardBaselineEnvironment,
2287
- re as setStoryboardGraph,
2288
- ot as setTokens,
2289
- st as setViewportPresets,
2290
- Rt as storyboardScreenRecipeKey,
2291
- mr as subscribePreviewEnvironmentControls,
2292
- pr as subscribeStoryboardGraph,
2293
- Sn as usePygmalionProject,
2294
- gr as validateDesignComponentConnections,
2295
- hr as validatePreviewArtifactBundle,
2296
- yr as validateRoutePreviewArtifactV3Browser
2310
+ qn as DEFAULT_DESIGN_COMPILE_LIMITS,
2311
+ Kn as DESIGN_IMPORT_KINDS,
2312
+ Gn as DESIGN_IR_SCHEMA,
2313
+ Ln as DESIGN_IR_VERSION,
2314
+ An as PygmalionCatalogDocument,
2315
+ Mn as PygmalionCatalogMatrix,
2316
+ $n as PygmalionCatalogSection,
2317
+ Bn as PygmalionEditor,
2318
+ ut as STORYBOARD_ENVIRONMENT_CONTROL,
2319
+ Vn as STORYBOARD_ENVIRONMENT_QUERY,
2320
+ Fn as SourceRefControl,
2321
+ Tn as __debug,
2322
+ Wn as applyTokenOverride,
2323
+ Ft as bootstrapPreviewArtifact,
2324
+ Jn as clearPreviewEnvironmentControlValues,
2325
+ Qn as clearPygmalionPreviewCache,
2326
+ Xn as compileDesignDocument,
2327
+ Dn as createDesignComponentCatalog,
2328
+ hn as createDesignComponentVariantMatrix,
2329
+ On as createDesignGalleryCatalog,
2330
+ Yn as createDesignImportController,
2331
+ Zn as createDesignIntermediateDocument,
2332
+ er as createDesignScreenCollection,
2333
+ Nt as createPreviewArtifactHttpTransport,
2334
+ tr as createPreviewCacheNamespace,
2335
+ nr as createPreviewFrameFingerprint,
2336
+ rr as createPreviewRecipeFingerprint,
2337
+ or as createStoryboardCaptureRecipeIdentity,
2338
+ Gt as createStoryboardGraph,
2339
+ cn as createStoryboardGraphFromDiscovery,
2340
+ sr as createStoryboardGraphViewModel,
2341
+ Ut as createStoryboardPathEdges,
2342
+ nt as createStoryboardRouteScenarioId,
2343
+ ir as createStoryboardRouteUrl,
2344
+ un as designCatalogKey,
2345
+ it as designCatalogRegistryName,
2346
+ ar as enumerateDesignComponentConnectionCases,
2347
+ cr as expandDesignScreenCasesViewports,
2348
+ lr as expandDesignScreenCollectionViewports,
2349
+ dr as getDesignCodegenAdapters,
2350
+ ur as getDesignComponentConnection,
2351
+ fr as getDesignComponentConnectionForComponent,
2352
+ mr as getDesignComponentConnections,
2353
+ hr as getPreviewEnvironmentControlValue,
2354
+ pr as getPreviewEnvironmentControls,
2355
+ gr as getPreviewEnvironmentOverride,
2356
+ yr as getRecommendedPygmalionPreviewConcurrency,
2357
+ Se as getStoryboardBaselineEnvironment,
2358
+ ot as getStoryboardDiscoveryBaselineEnvironment,
2359
+ wr as getStoryboardGraph,
2360
+ br as getViewportPresets,
2361
+ st as loadStoryboardDiscovery,
2362
+ vr as mergeScreenPresets,
2363
+ tt as mergeStoryboardEnvironment,
2364
+ Nn as publishStoryboardDiscovery,
2365
+ zn as pygmalionNavigate,
2366
+ jn as pygmalionOpenPreview,
2367
+ _n as pygmalionResetCurrentEdits,
2368
+ Sr as reconstructRoutePreviewArtifactScreenshotV3,
2369
+ Ir as reconstructRoutePreviewArtifactSnapshotV3,
2370
+ xr as registerDesignCodegenAdapter,
2371
+ Pr as resetTokenOverrides,
2372
+ Er as resolvePreviewArtifactFrames,
2373
+ Xt as resolveStoryboardScreenCases,
2374
+ mt as setComponentRegistry,
2375
+ ht as setDesignComponentConnections,
2376
+ Cr as setPreviewEnvironmentControlValue,
2377
+ Ct as setPreviewEnvironmentControls,
2378
+ Pt as setPygmalionAppOrigin,
2379
+ St as setPygmalionPreviewConcurrency,
2380
+ Et as setPygmalionPreviewRevision,
2381
+ ye as setStoryboardBaselineEnvironment,
2382
+ se as setStoryboardGraph,
2383
+ pt as setTokens,
2384
+ gt as setViewportPresets,
2385
+ Ht as storyboardScreenRecipeKey,
2386
+ Rr as subscribePreviewEnvironmentControls,
2387
+ Nr as subscribeStoryboardGraph,
2388
+ kn as usePygmalionProject,
2389
+ Ar as validateDesignComponentConnections,
2390
+ $r as validatePreviewArtifactBundle,
2391
+ Mr as validateRoutePreviewArtifactV3Browser
2297
2392
  };