@pygmalionjs/pygmalion 0.2.20 → 0.2.21

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,7 +1,7 @@
1
1
  import { jsxs as N, jsx as w } from "react/jsx-runtime";
2
- import { b as W, m as Ke, v as qe, c as Ge, i as Ve, g as Je, e as K, d as Le, a as We, f as Qe, h as Xe, j as Ye, k as Ze, l as et, n as tt, o as nt, p as rt, q as ot, r as it, t as st, u as at, w as ie, S as ct, A as lt, x as xe, y as dt, z as ft, B as ut, C as pt, D as ht, E as mt, G as gt, H as Pe } from "./App-BncfvzKi.js";
3
- import { I as Dn, J as zn, K as _n, L as Fn, M as jn, O as Bn, P as Un, Q as Hn, R as Kn, T as qn, U as Gn, V as Vn, W as Jn, X as Ln, Y as Wn, Z as Qn, _ as Xn, $ as Yn } from "./App-BncfvzKi.js";
4
- import { createElement as Ee, useMemo as le, useState as te, useRef as Ne, useCallback as L, useEffect as ne } from "react";
2
+ import { b as Q, m as Ge, v as Ve, c as qe, i as Je, g as Le, e as K, d as We, a as Qe, f as Xe, h as Ye, j as Ze, k as et, l as tt, n as nt, o as rt, p as ot, q as it, r as st, t as at, u as ct, w as ie, S as lt, A as dt, x as xe, y as ft, z as ut, B as pt, C as ht, D as mt, E as gt, G as yt, H as Pe } from "./App-B_6qmxhS.js";
3
+ import { I as zn, J as _n, K as Fn, L as jn, M as Bn, O as Un, P as Hn, Q as Kn, R as Gn, T as Vn, U as qn, V as Jn, W as Ln, X as Wn, Y as Qn, Z as Xn, _ as Yn, $ as Zn } from "./App-B_6qmxhS.js";
4
+ import { createElement as Ee, useMemo as de, useState as te, useRef as Ne, useCallback as W, useEffect as ne } from "react";
5
5
  function we(e, t = /* @__PURE__ */ new Set()) {
6
6
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
7
7
  return e;
@@ -18,7 +18,7 @@ function we(e, t = /* @__PURE__ */ new Set()) {
18
18
  }
19
19
  return t.delete(e), o;
20
20
  }
21
- function yt(e) {
21
+ function wt(e) {
22
22
  return JSON.stringify(
23
23
  we({
24
24
  version: 1,
@@ -42,11 +42,11 @@ function yt(e) {
42
42
  function z(e) {
43
43
  return [...new Set([...e].map((t) => t == null ? void 0 : t.trim()).filter(Boolean))].sort((t, o) => t.localeCompare(o));
44
44
  }
45
- function wt(e, t) {
45
+ function bt(e, t) {
46
46
  var n;
47
47
  return ((n = e.id) == null ? void 0 : n.trim()) || `edge:${t + 1}`;
48
48
  }
49
- function bt(e) {
49
+ function St(e) {
50
50
  const t = [...e.screens].sort((n, r) => n.id.localeCompare(r.id)), o = t[0].id;
51
51
  return {
52
52
  id: `story:${o}`,
@@ -75,7 +75,7 @@ function Re(e) {
75
75
  e.scenarioId
76
76
  ].join(":");
77
77
  }
78
- function St(e) {
78
+ function vt(e) {
79
79
  var re, oe;
80
80
  const t = [], o = [], n = /* @__PURE__ */ new Map();
81
81
  for (const c of e.screens) {
@@ -96,7 +96,7 @@ function St(e) {
96
96
  for (const c of o) {
97
97
  let f;
98
98
  try {
99
- if (f = (e.recipeKey ?? yt)(c), !f.trim()) throw new Error("Recipe keys cannot be empty.");
99
+ if (f = (e.recipeKey ?? wt)(c), !f.trim()) throw new Error("Recipe keys cannot be empty.");
100
100
  } catch (u) {
101
101
  i.add(c.id), t.push({
102
102
  code: "invalid-recipe",
@@ -108,7 +108,7 @@ function St(e) {
108
108
  const d = r.get(f);
109
109
  d ? d.screens.push(c) : r.set(f, { recipeKey: f, screens: [c] });
110
110
  }
111
- const s = [...r.values()].map(bt).sort((c, f) => c.id.localeCompare(f.id)), a = {};
111
+ const s = [...r.values()].map(St).sort((c, f) => c.id.localeCompare(f.id)), a = {};
112
112
  for (const c of s)
113
113
  for (const f of c.screenIds) a[f] = c.id;
114
114
  const l = new Map(s.map((c) => [c.id, c])), g = /* @__PURE__ */ new Map();
@@ -161,27 +161,27 @@ function St(e) {
161
161
  let h = 0;
162
162
  for (const [c, f] of R)
163
163
  for (const d of f) {
164
- const u = wt(d, h);
164
+ const u = bt(d, h);
165
165
  h += 1;
166
166
  const P = m(d.from, u, "source"), I = m(d.to, u, "target");
167
167
  if (!P || !I || P === I) continue;
168
168
  const M = `${P}\0${I}`, C = y.get(M);
169
169
  if (C) {
170
170
  if (!C.sourceEdgeIds.includes(u)) {
171
- const G = {
171
+ const V = {
172
172
  ...C,
173
173
  sourceEdgeIds: z([
174
174
  ...C.sourceEdgeIds,
175
175
  u
176
176
  ])
177
177
  };
178
- y.set(M, G);
178
+ y.set(M, V);
179
179
  const H = v.indexOf(C);
180
- H >= 0 && (v[H] = G);
180
+ H >= 0 && (v[H] = V);
181
181
  }
182
182
  continue;
183
183
  }
184
- const J = {
184
+ const L = {
185
185
  id: u,
186
186
  from: P,
187
187
  to: I,
@@ -190,7 +190,7 @@ function St(e) {
190
190
  origin: c,
191
191
  sourceEdgeIds: [u]
192
192
  };
193
- y.set(M, J), v.push(J);
193
+ y.set(M, L), v.push(L);
194
194
  }
195
195
  v.sort(
196
196
  (c, f) => `${c.from}:${c.to}:${c.id}`.localeCompare(`${f.from}:${f.to}:${f.id}`)
@@ -202,7 +202,7 @@ function St(e) {
202
202
  const d = O.get(c.to);
203
203
  d ? d.push(c) : O.set(c.to, [c]);
204
204
  }
205
- const k = [];
205
+ const D = [];
206
206
  for (const c of e.startScreenIds ?? []) {
207
207
  const f = c.trim(), d = a[f] ?? (l.has(f) ? f : null);
208
208
  if (!d) {
@@ -214,15 +214,15 @@ function St(e) {
214
214
  });
215
215
  continue;
216
216
  }
217
- k.push(d);
217
+ D.push(d);
218
218
  }
219
- const $ = new Set(k);
220
- let D = z(k);
221
- D.length || (D = p.filter((c) => {
219
+ const $ = new Set(D);
220
+ let k = z(D);
221
+ k.length || (k = p.filter((c) => {
222
222
  var f;
223
223
  return (((f = O.get(c.id)) == null ? void 0 : f.length) ?? 0) === 0;
224
- }).map((c) => c.id).sort((c, f) => c.localeCompare(f))), !D.length && p.length && (D = [p[0].id]);
225
- const S = /* @__PURE__ */ new Set(), x = [...D];
224
+ }).map((c) => c.id).sort((c, f) => c.localeCompare(f))), !k.length && p.length && (k = [p[0].id]);
225
+ const S = /* @__PURE__ */ new Set(), x = [...k];
226
226
  for (; x.length; ) {
227
227
  const c = x.shift();
228
228
  if (!S.has(c)) {
@@ -269,14 +269,14 @@ function St(e) {
269
269
  edgeIds: f.map((d) => d.id),
270
270
  targetNodeIds: z(f.map((d) => d.to))
271
271
  };
272
- }).filter((c) => c.targetNodeIds.length > 1).sort((c, f) => c.nodeId.localeCompare(f.nodeId)), q = new Set(
272
+ }).filter((c) => c.targetNodeIds.length > 1).sort((c, f) => c.nodeId.localeCompare(f.nodeId)), G = new Set(
273
273
  p.flatMap((c) => c.scenarioIds)
274
274
  ), Z = new Set(
275
275
  (e.nonVisualScenarioIds ?? []).map((c) => c.trim())
276
276
  ), E = z(
277
277
  (e.scenarios ?? []).map((c) => c.id)
278
278
  ), B = E.filter(
279
- (c) => !q.has(c) && !Z.has(c)
279
+ (c) => !G.has(c) && !Z.has(c)
280
280
  );
281
281
  for (const c of B)
282
282
  t.push({
@@ -290,7 +290,7 @@ function St(e) {
290
290
  );
291
291
  const _ = z(
292
292
  T.flatMap((c) => c.screenIds)
293
- ), se = {
293
+ ), ae = {
294
294
  screens: o.length,
295
295
  canonicalNodes: p.length,
296
296
  mergedScreens: Math.max(0, o.length - p.length),
@@ -299,7 +299,7 @@ function St(e) {
299
299
  disconnectedScreens: _,
300
300
  codeScenarios: E.length,
301
301
  representedScenarios: E.filter(
302
- (c) => q.has(c)
302
+ (c) => G.has(c)
303
303
  ).length,
304
304
  missingScenarios: B,
305
305
  complete: _.length === 0 && B.length === 0 && !t.some((c) => c.severity === "error") && i.size === 0
@@ -312,27 +312,27 @@ function St(e) {
312
312
  Object.entries(a).sort(([c], [f]) => c.localeCompare(f))
313
313
  ),
314
314
  sourceGroups: X,
315
- startNodeIds: D,
315
+ startNodeIds: k,
316
316
  branches: Y,
317
317
  warnings: t,
318
- coverage: se
318
+ coverage: ae
319
319
  };
320
320
  }
321
- function vt(e) {
321
+ function It(e) {
322
322
  return e ? JSON.parse(JSON.stringify(e)) : void 0;
323
323
  }
324
- function de(e) {
325
- if (Array.isArray(e)) return e.map(de);
324
+ function fe(e) {
325
+ if (Array.isArray(e)) return e.map(fe);
326
326
  if (e && typeof e == "object") {
327
- const t = Object.entries(e).filter(([, o]) => o !== void 0).sort(([o], [n]) => o.localeCompare(n)).map(([o, n]) => [o, de(n)]).filter(([, o]) => o !== void 0);
327
+ const t = Object.entries(e).filter(([, o]) => o !== void 0).sort(([o], [n]) => o.localeCompare(n)).map(([o, n]) => [o, fe(n)]).filter(([, o]) => o !== void 0);
328
328
  return t.length ? Object.fromEntries(t) : void 0;
329
329
  }
330
330
  return e;
331
331
  }
332
332
  function Ce(e) {
333
- return JSON.stringify(de(e ?? null));
333
+ return JSON.stringify(fe(e ?? null));
334
334
  }
335
- function It(e) {
335
+ function xt(e) {
336
336
  return !!(e && typeof e == "object" && !Array.isArray(e));
337
337
  }
338
338
  function U(e) {
@@ -346,7 +346,7 @@ function U(e) {
346
346
  }
347
347
  return o = o.split(/[?#]/, 1)[0].replace(/\/{2,}/g, "/"), o.startsWith("/") || (o = `/${o}`), o.length > 1 && (o = o.replace(/\/+$/, "")), o || "/";
348
348
  }
349
- function De(e) {
349
+ function ke(e) {
350
350
  return `source-route:${encodeURIComponent(e)}`;
351
351
  }
352
352
  function Ie(e, t) {
@@ -373,13 +373,13 @@ function Ae(e, t) {
373
373
  )
374
374
  ].sort((r, i) => r.localeCompare(i));
375
375
  }
376
- function xt(e) {
376
+ function Pt(e) {
377
377
  var o;
378
378
  const t = /* @__PURE__ */ new Map();
379
379
  for (const n of e ?? []) {
380
380
  const r = U(n.path);
381
381
  !r || t.has(r) || t.set(r, {
382
- id: De(r),
382
+ id: ke(r),
383
383
  name: r,
384
384
  section: "Source routes",
385
385
  codeName: ((o = n.id) == null ? void 0 : o.trim()) || void 0
@@ -387,7 +387,7 @@ function xt(e) {
387
387
  }
388
388
  return [...t.values()].sort((n, r) => n.id.localeCompare(r.id));
389
389
  }
390
- function Pt(e, t, o) {
390
+ function Et(e, t, o) {
391
391
  return (e ?? []).flatMap((n, r) => {
392
392
  var p, b, m;
393
393
  const i = (p = n.from) == null ? void 0 : p.trim(), s = (b = n.to) == null ? void 0 : b.trim();
@@ -409,7 +409,7 @@ function Pt(e, t, o) {
409
409
  );
410
410
  });
411
411
  }
412
- function Et(e, t, o) {
412
+ function Nt(e, t, o) {
413
413
  const n = U(e.route);
414
414
  if (!n) return [];
415
415
  const r = t.filter(
@@ -420,7 +420,7 @@ function Et(e, t, o) {
420
420
  );
421
421
  if (!r.length) return [];
422
422
  const i = Ce(
423
- Ke(o, e.environment)
423
+ Ge(o, e.environment)
424
424
  ), s = r.filter(
425
425
  (a) => Ce(a.environment) === i
426
426
  );
@@ -433,7 +433,7 @@ function Et(e, t, o) {
433
433
  )
434
434
  ].sort((a, l) => a.localeCompare(l));
435
435
  }
436
- function Nt(e, t) {
436
+ function Rt(e, t) {
437
437
  const o = e.some((i) => i.importKind != null), n = t.candidates ?? [], r = _e(t);
438
438
  return e.filter(
439
439
  (i) => o ? i.importKind === "screens" : !!i.route
@@ -455,7 +455,7 @@ function Nt(e, t) {
455
455
  scenario: i.scenario,
456
456
  state: i.state,
457
457
  scenarioId: i.scenarioId,
458
- scenarioIds: Et(i, n, r),
458
+ scenarioIds: Nt(i, n, r),
459
459
  interactions: i.interactions,
460
460
  environment: i.environment,
461
461
  preset: i.preset,
@@ -472,7 +472,7 @@ function me(e, t) {
472
472
  const i = !e.environment && !e.preset ? 0 : 1, s = !t.environment && !t.preset ? 0 : 1;
473
473
  return i !== s ? i - s : e.id.localeCompare(t.id);
474
474
  }
475
- function Rt(e) {
475
+ function Ct(e) {
476
476
  const t = /* @__PURE__ */ new Map();
477
477
  for (const o of e) {
478
478
  const n = U(o.route);
@@ -487,9 +487,9 @@ function Rt(e) {
487
487
  })
488
488
  );
489
489
  }
490
- function Ct(e) {
490
+ function At(e) {
491
491
  return e.action === "wait" ? null : JSON.stringify(
492
- de({
492
+ fe({
493
493
  action: e.action,
494
494
  selector: e.selector,
495
495
  text: e.text,
@@ -504,12 +504,12 @@ function Ct(e) {
504
504
  );
505
505
  }
506
506
  function ze(e) {
507
- return (e.interactions ?? []).map(Ct).filter((t) => t != null);
507
+ return (e.interactions ?? []).map(At).filter((t) => t != null);
508
508
  }
509
- function At(e, t) {
509
+ function Ot(e, t) {
510
510
  return e.length < t.length && e.every((o, n) => o === t[n]);
511
511
  }
512
- function Ot(e, t) {
512
+ function $t(e, t) {
513
513
  const o = /* @__PURE__ */ new Map();
514
514
  for (const n of e) {
515
515
  const r = U(n.route);
@@ -528,7 +528,7 @@ function Ot(e, t) {
528
528
  }));
529
529
  });
530
530
  }
531
- function $t(e, t) {
531
+ function Mt(e, t) {
532
532
  const o = /* @__PURE__ */ new Map();
533
533
  for (const n of e) {
534
534
  const r = U(n.route);
@@ -546,7 +546,7 @@ function $t(e, t) {
546
546
  const g = i.get(l.id);
547
547
  if (!g.length) return [];
548
548
  const b = r.filter(
549
- (m) => At(
549
+ (m) => Ot(
550
550
  i.get(m.id),
551
551
  g
552
552
  )
@@ -557,8 +557,8 @@ function $t(e, t) {
557
557
  if (R !== h) return R - h;
558
558
  const O = m.section && m.section === l.section ? 0 : 1, A = v.section && v.section === l.section ? 0 : 1;
559
559
  if (O !== A) return O - A;
560
- const k = m.id === s ? 0 : 1, $ = v.id === s ? 0 : 1;
561
- return k !== $ ? k - $ : me(m, v);
560
+ const D = m.id === s ? 0 : 1, $ = v.id === s ? 0 : 1;
561
+ return D !== $ ? D - $ : me(m, v);
562
562
  })[0];
563
563
  return b ? [
564
564
  {
@@ -578,7 +578,7 @@ function $t(e, t) {
578
578
  });
579
579
  });
580
580
  }
581
- function Mt(e) {
581
+ function Tt(e) {
582
582
  var o;
583
583
  const t = /* @__PURE__ */ new Map();
584
584
  for (const n of e) {
@@ -610,7 +610,7 @@ function Mt(e) {
610
610
  });
611
611
  });
612
612
  }
613
- function Tt(e, t, o) {
613
+ function Dt(e, t, o) {
614
614
  const n = new Set(
615
615
  (t.routes ?? []).map((r) => U(r.path)).filter((r) => !!r)
616
616
  );
@@ -626,7 +626,7 @@ function Tt(e, t, o) {
626
626
  scenarioIds: [
627
627
  .../* @__PURE__ */ new Set([
628
628
  ...r.scenarioIds ?? [],
629
- ...s.map(De)
629
+ ...s.map(ke)
630
630
  ])
631
631
  ].sort((a, l) => a.localeCompare(l))
632
632
  } : r;
@@ -664,7 +664,7 @@ function kt(e, t) {
664
664
  (S, x) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(x) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(x)
665
665
  )[0];
666
666
  if (!A) continue;
667
- const k = [A], $ = /* @__PURE__ */ new Set(), D = (S) => {
667
+ const D = [A], $ = /* @__PURE__ */ new Set(), k = (S) => {
668
668
  const x = [S];
669
669
  for (; x.length; ) {
670
670
  const T = x.shift();
@@ -675,10 +675,10 @@ function kt(e, t) {
675
675
  }
676
676
  }
677
677
  };
678
- D(A);
678
+ k(A);
679
679
  for (const S of O)
680
- $.has(S) || (k.push(S), D(S));
681
- for (const S of k)
680
+ $.has(S) || (D.push(S), k(S));
681
+ for (const S of D)
682
682
  a.add(S);
683
683
  }
684
684
  return [...a].sort(
@@ -687,34 +687,34 @@ function kt(e, t) {
687
687
  }
688
688
  function _e(e) {
689
689
  var t, o;
690
- return vt(
690
+ return It(
691
691
  (o = (t = e.scenarios) == null ? void 0 : t.find(
692
692
  (n) => n.id === "environment:baseline"
693
693
  )) == null ? void 0 : o.environment
694
694
  );
695
695
  }
696
- function Dt(e) {
697
- const t = Nt(
696
+ function zt(e) {
697
+ const t = Rt(
698
698
  e.pages,
699
699
  e.manifest
700
- ), o = Rt(t), n = Tt(
700
+ ), o = Ct(t), n = Dt(
701
701
  t,
702
702
  e.manifest,
703
703
  o
704
704
  ), i = [
705
- ...Pt(
705
+ ...Et(
706
706
  e.manifest.edges,
707
707
  o,
708
708
  new Set(n.map((s) => s.id))
709
709
  ),
710
- ...Ot(n, o),
711
710
  ...$t(n, o),
712
- ...Mt(n)
711
+ ...Mt(n, o),
712
+ ...Tt(n)
713
713
  ];
714
- return St({
714
+ return vt({
715
715
  screens: n,
716
716
  assets: e.assets,
717
- scenarios: xt(e.manifest.routes),
717
+ scenarios: Pt(e.manifest.routes),
718
718
  inferredEdges: i,
719
719
  startScreenIds: kt(n, i)
720
720
  });
@@ -728,39 +728,39 @@ async function Fe(e) {
728
728
  if (!o.ok)
729
729
  throw new Error(`Storyboard discovery failed (${o.status})`);
730
730
  const n = await o.json();
731
- if (!It(n))
731
+ if (!xt(n))
732
732
  throw new Error("Storyboard discovery returned an invalid manifest.");
733
733
  return {
734
734
  manifest: n,
735
735
  baselineEnvironment: _e(n),
736
- graph: Dt({
736
+ graph: zt({
737
737
  manifest: n,
738
738
  pages: e.pages,
739
739
  assets: e.assets
740
740
  })
741
741
  };
742
742
  }
743
- async function wn(e) {
744
- W(null);
743
+ async function bn(e) {
744
+ Q(null);
745
745
  try {
746
746
  const t = await Fe(e);
747
- return W(t.graph), t;
747
+ return Q(t.graph), t;
748
748
  } catch (t) {
749
- throw W(null), t;
749
+ throw Q(null), t;
750
750
  }
751
751
  }
752
- const zt = "pygmalion-preview", _t = "unknown", Ft = 512, jt = 2048, Bt = 8 * 1024 * 1024, Ut = 128 * 1024 * 1024, Ht = /* @__PURE__ */ new Set([
752
+ const _t = "pygmalion-preview", Ft = "unknown", jt = 512, Bt = 2048, Ut = 8 * 1024 * 1024, Ht = 128 * 1024 * 1024, Kt = /* @__PURE__ */ new Set([
753
753
  "__proto__",
754
754
  "constructor",
755
755
  "prototype"
756
756
  ]);
757
- function Q(e, t) {
757
+ function J(e, t) {
758
758
  const o = e.trim();
759
759
  if (!o && t != null) return t;
760
- if (ce(o)) return o;
760
+ if (le(o)) return o;
761
761
  throw new TypeError("Preview identity must be a non-empty bounded string.");
762
762
  }
763
- function Kt(e) {
763
+ function Gt(e) {
764
764
  const t = e ?? 1;
765
765
  if (!Number.isSafeInteger(t) || t < 1)
766
766
  throw new TypeError(
@@ -787,7 +787,7 @@ function be(e, t = /* @__PURE__ */ new Set()) {
787
787
  }
788
788
  return t.delete(e), o;
789
789
  }
790
- function qt(e) {
790
+ function Vt(e) {
791
791
  let t = 2166136261, o = 2654435769;
792
792
  for (let n = 0; n < e.length; n += 1) {
793
793
  const r = e.charCodeAt(n);
@@ -795,11 +795,11 @@ function qt(e) {
795
795
  }
796
796
  return `${(t >>> 0).toString(16).padStart(8, "0")}${(o >>> 0).toString(16).padStart(8, "0")}`;
797
797
  }
798
- function Gt(e) {
798
+ function je(e) {
799
799
  if (!Array.isArray(e))
800
800
  throw new TypeError("Preview recipes must be an array.");
801
801
  const t = /* @__PURE__ */ new Set(), o = e.map(({ id: n, recipe: r }) => {
802
- const i = Q(n);
802
+ const i = J(n);
803
803
  if (t.has(i))
804
804
  throw new TypeError(`Duplicate preview recipe identity: ${i}`);
805
805
  return t.add(i), {
@@ -807,21 +807,30 @@ function Gt(e) {
807
807
  recipe: be(r)
808
808
  };
809
809
  });
810
- return qt(JSON.stringify(o));
810
+ return Vt(JSON.stringify(o));
811
+ }
812
+ function Sn(e, t = {}) {
813
+ const o = qt(e), n = t.dependencyDigest;
814
+ return je([
815
+ {
816
+ id: J(e.id ?? "", "frame"),
817
+ recipe: n == null ? o : { recipe: o, dependencyDigest: J(n) }
818
+ }
819
+ ]);
811
820
  }
812
- function bn({
821
+ function vn({
813
822
  sourceRevision: e,
814
823
  recipes: t,
815
824
  recipeVersion: o,
816
- scope: n = zt
825
+ scope: n = _t
817
826
  }) {
818
- const r = Q(n), i = Q(
827
+ const r = J(n), i = J(
819
828
  e,
820
- _t
821
- ), s = Kt(o), a = Gt(t);
829
+ Ft
830
+ ), s = Gt(o), a = je(t);
822
831
  return `${r}:${encodeURIComponent(i)}:recipe-v${s}:${a}`;
823
832
  }
824
- function Sn(e) {
833
+ function qt(e) {
825
834
  return {
826
835
  route: e.route,
827
836
  path: e.path,
@@ -848,7 +857,7 @@ function Sn(e) {
848
857
  assertions: e.assertions
849
858
  };
850
859
  }
851
- function Vt({
860
+ function Jt({
852
861
  endpoint: e,
853
862
  fetcher: t,
854
863
  captureBaseUrl: o
@@ -863,7 +872,9 @@ function Vt({
863
872
  const s = new URLSearchParams({
864
873
  namespace: i.namespace,
865
874
  sourceRevision: i.sourceRevision
866
- }), a = i.captureBaseUrl ?? o;
875
+ });
876
+ i.frames && s.set("frames", JSON.stringify(i.frames));
877
+ const a = i.captureBaseUrl ?? o;
867
878
  a && s.set("captureBaseUrl", a);
868
879
  const l = n.includes("?") ? "&" : "?", g = await r(
869
880
  `${n}${l}${s}`,
@@ -874,21 +885,23 @@ function Vt({
874
885
  signal: i.signal
875
886
  }
876
887
  );
877
- return g.ok ? g.json().catch(() => null) : null;
888
+ if (!g.ok) return null;
889
+ const p = await g.json().catch(() => null);
890
+ return se(p) && p.artifact !== void 0 ? p.artifact : p;
878
891
  };
879
892
  }
880
- function fe(e) {
893
+ function se(e) {
881
894
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
882
895
  const t = Object.getPrototypeOf(e);
883
896
  return t === Object.prototype || t === null;
884
897
  }
885
- function je(e) {
898
+ function Be(e) {
886
899
  return new TextEncoder().encode(e).byteLength;
887
900
  }
888
- function ce(e) {
889
- return typeof e == "string" && e.length > 0 && e.length <= Ft && e === e.trim() && !Ht.has(e);
901
+ function le(e) {
902
+ return typeof e == "string" && e.length > 0 && e.length <= jt && e === e.trim() && !Kt.has(e);
890
903
  }
891
- function Jt(e) {
904
+ function Lt(e) {
892
905
  const t = /(?:expression\s*\(|-moz-binding\s*:|(?:^|[;{])\s*behavior\s*:)/i;
893
906
  for (const o of e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi))
894
907
  if (t.test(o[1] ?? "")) return !0;
@@ -898,14 +911,14 @@ function Jt(e) {
898
911
  if (t.test(o[1] ?? o[2] ?? o[3] ?? "")) return !0;
899
912
  return !1;
900
913
  }
901
- function Lt(e) {
902
- return typeof e != "string" || e.length === 0 || je(e) > Bt ? !1 : !(/<\s*(?:script|iframe|object|embed|applet|portal)\b/i.test(e) || /<\s*meta\b[^>]*http-equiv\s*=\s*["']?\s*refresh\b/i.test(e) || /\s(?:on[a-z][\w:-]*|srcdoc)\s*=/i.test(e) || /\s(?:href|src|action|formaction|xlink:href)\s*=\s*(?:"\s*|'?\s*)(?:javascript|vbscript|data\s*:\s*text\/html)\s*:/i.test(
914
+ function Wt(e) {
915
+ return typeof e != "string" || e.length === 0 || Be(e) > Ut ? !1 : !(/<\s*(?:script|iframe|object|embed|applet|portal)\b/i.test(e) || /<\s*meta\b[^>]*http-equiv\s*=\s*["']?\s*refresh\b/i.test(e) || /\s(?:on[a-z][\w:-]*|srcdoc)\s*=/i.test(e) || /\s(?:href|src|action|formaction|xlink:href)\s*=\s*(?:"\s*|'?\s*)(?:javascript|vbscript|data\s*:\s*text\/html)\s*:/i.test(
903
916
  e
904
- ) || Jt(e));
917
+ ) || Lt(e));
905
918
  }
906
- function Wt(e) {
919
+ function Qt(e) {
907
920
  const t = [];
908
- if (!fe(e) || e.version !== 1)
921
+ if (!se(e) || e.version !== 1)
909
922
  return {
910
923
  valid: !1,
911
924
  artifact: null,
@@ -913,16 +926,16 @@ function Wt(e) {
913
926
  "Preview artifact must be a version 1, version 2, or version 3 bundle."
914
927
  ]
915
928
  };
916
- if (ce(e.namespace) || t.push("Preview artifact namespace is invalid."), e.sourceRevision != null && !ce(e.sourceRevision) && t.push("Preview artifact source revision is invalid."), !fe(e.snapshots))
929
+ if (le(e.namespace) || t.push("Preview artifact namespace is invalid."), e.sourceRevision != null && !le(e.sourceRevision) && t.push("Preview artifact source revision is invalid."), !se(e.snapshots))
917
930
  t.push("Preview artifact snapshots must be a record.");
918
931
  else {
919
932
  const o = Object.entries(e.snapshots);
920
- o.length > jt && t.push("Preview artifact has too many frames.");
933
+ o.length > Bt && t.push("Preview artifact has too many frames.");
921
934
  for (const [n, r] of o)
922
- (!ce(n) || !Lt(r)) && t.push(`Preview artifact frame "${n}" is invalid.`);
935
+ (!le(n) || !Wt(r)) && t.push(`Preview artifact frame "${n}" is invalid.`);
923
936
  }
924
937
  try {
925
- je(JSON.stringify(e)) > Ut && t.push("Preview artifact exceeds the bundle byte limit.");
938
+ Be(JSON.stringify(e)) > Ht && t.push("Preview artifact exceeds the bundle byte limit.");
926
939
  } catch {
927
940
  t.push("Preview artifact is not serializable.");
928
941
  }
@@ -932,35 +945,35 @@ function Wt(e) {
932
945
  errors: t
933
946
  };
934
947
  }
935
- function Qt(e, t) {
936
- const o = fe(e) && e.version === 3 ? (() => {
937
- const n = qe(e);
948
+ function Xt(e, t) {
949
+ const o = se(e) && e.version === 3 ? (() => {
950
+ const n = Ve(e);
938
951
  return {
939
952
  valid: n.valid,
940
953
  artifact: n.valid ? e : null,
941
954
  errors: n.errors
942
955
  };
943
- })() : fe(e) && e.version === 2 ? (() => {
944
- const n = Ge(e);
956
+ })() : se(e) && e.version === 2 ? (() => {
957
+ const n = qe(e);
945
958
  return {
946
959
  valid: n.valid,
947
960
  artifact: n.valid ? e : null,
948
961
  errors: n.errors
949
962
  };
950
- })() : Wt(e);
963
+ })() : Qt(e);
951
964
  return !o.valid || !o.artifact ? {
952
965
  valid: !1,
953
966
  artifact: null,
954
967
  reason: "invalid-bundle",
955
968
  errors: o.errors
956
- } : t && o.artifact.namespace !== Q(t.namespace) ? {
969
+ } : t && o.artifact.namespace !== J(t.namespace) ? {
957
970
  valid: !1,
958
971
  artifact: null,
959
972
  reason: "namespace-mismatch",
960
973
  errors: [
961
974
  "Preview artifact namespace does not match the runtime namespace."
962
975
  ]
963
- } : t && o.artifact.sourceRevision !== Q(t.sourceRevision) ? {
976
+ } : t && o.artifact.sourceRevision !== J(t.sourceRevision) ? {
964
977
  valid: !1,
965
978
  artifact: null,
966
979
  reason: "revision-mismatch",
@@ -973,15 +986,15 @@ function Qt(e, t) {
973
986
  errors: []
974
987
  };
975
988
  }
976
- async function Xt({
989
+ async function Yt({
977
990
  namespace: e,
978
991
  sourceRevision: t,
979
992
  transport: o,
980
993
  signal: n
981
994
  }) {
982
995
  const r = {
983
- namespace: Q(e),
984
- sourceRevision: Q(t)
996
+ namespace: J(e),
997
+ sourceRevision: J(t)
985
998
  };
986
999
  let i;
987
1000
  try {
@@ -992,7 +1005,7 @@ async function Xt({
992
1005
  }
993
1006
  if (i == null)
994
1007
  return { status: "unavailable", artifact: null };
995
- const s = Qt(i, r);
1008
+ const s = Xt(i, r);
996
1009
  return s.valid ? { status: "accepted", artifact: s.artifact } : {
997
1010
  status: "rejected",
998
1011
  artifact: null,
@@ -1000,15 +1013,15 @@ async function Xt({
1000
1013
  errors: s.errors
1001
1014
  };
1002
1015
  }
1003
- const ue = "var(--pygmalion-catalog-surface, #ffffff)", pe = "var(--pygmalion-catalog-canvas, #f5f5f5)", Se = "var(--pygmalion-catalog-border, #e5e7eb)", he = "var(--pygmalion-catalog-text, #202124)", F = "var(--pygmalion-catalog-muted, #6b7280)", Yt = "var(--pygmalion-catalog-header, #11182f)", Zt = "var(--pygmalion-catalog-accent, #7c6cf2)";
1004
- function vn({
1016
+ const ue = "var(--pygmalion-catalog-surface, #ffffff)", pe = "var(--pygmalion-catalog-canvas, #f5f5f5)", Se = "var(--pygmalion-catalog-border, #e5e7eb)", he = "var(--pygmalion-catalog-text, #202124)", F = "var(--pygmalion-catalog-muted, #6b7280)", Zt = "var(--pygmalion-catalog-header, #11182f)", en = "var(--pygmalion-catalog-accent, #7c6cf2)";
1017
+ function In({
1005
1018
  title: e,
1006
1019
  eyebrow: t,
1007
1020
  description: o,
1008
1021
  version: n,
1009
1022
  meta: r,
1010
1023
  children: i,
1011
- headerBackground: s = Yt,
1024
+ headerBackground: s = Zt,
1012
1025
  headerColor: a = "#ffffff",
1013
1026
  bodyBackground: l = ue,
1014
1027
  bodyGap: g = 40
@@ -1125,7 +1138,7 @@ function vn({
1125
1138
  }
1126
1139
  );
1127
1140
  }
1128
- function In({
1141
+ function xn({
1129
1142
  title: e,
1130
1143
  count: t,
1131
1144
  description: o,
@@ -1168,7 +1181,7 @@ function In({
1168
1181
  }
1169
1182
  );
1170
1183
  }
1171
- function xn({
1184
+ function Pn({
1172
1185
  rows: e,
1173
1186
  columns: t,
1174
1187
  cornerLabel: o,
@@ -1187,7 +1200,7 @@ function xn({
1187
1200
  display: "inline-block",
1188
1201
  width: "max-content",
1189
1202
  padding: s ? 16 : 0,
1190
- border: s ? `1px dashed ${Zt}` : void 0,
1203
+ border: s ? `1px dashed ${en}` : void 0,
1191
1204
  borderRadius: s ? 4 : void 0
1192
1205
  },
1193
1206
  children: /* @__PURE__ */ N(
@@ -1265,14 +1278,14 @@ function xn({
1265
1278
  }
1266
1279
  );
1267
1280
  }
1268
- function en(e) {
1281
+ function tn(e) {
1269
1282
  return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase() || "page";
1270
1283
  }
1271
- function Be(e, t, o = "PygmalionCatalog") {
1272
- const n = (r) => en(r).replace(/-/g, "_");
1284
+ function Ue(e, t, o = "PygmalionCatalog") {
1285
+ const n = (r) => tn(r).replace(/-/g, "_");
1273
1286
  return `${o}_${n(e)}_${n(t)}`;
1274
1287
  }
1275
- function Ue(e, t) {
1288
+ function He(e, t) {
1276
1289
  return {
1277
1290
  id: e.id,
1278
1291
  name: e.name,
@@ -1283,7 +1296,7 @@ function Ue(e, t) {
1283
1296
  description: e.description
1284
1297
  };
1285
1298
  }
1286
- function He(e) {
1299
+ function Ke(e) {
1287
1300
  const t = /* @__PURE__ */ new Set();
1288
1301
  for (const o of e) {
1289
1302
  if (t.has(o.id))
@@ -1291,10 +1304,10 @@ function He(e) {
1291
1304
  t.add(o.id);
1292
1305
  }
1293
1306
  }
1294
- function tn(e, t, o) {
1307
+ function nn(e, t, o) {
1295
1308
  return typeof e == "function" ? e(t, o) : e;
1296
1309
  }
1297
- function nn({
1310
+ function rn({
1298
1311
  page: e,
1299
1312
  items: t,
1300
1313
  renderPreview: o,
@@ -1398,8 +1411,8 @@ function nn({
1398
1411
  }
1399
1412
  );
1400
1413
  }
1401
- function Pn(e) {
1402
- He(e.items);
1414
+ function En(e) {
1415
+ Ke(e.items);
1403
1416
  const t = /* @__PURE__ */ new Map();
1404
1417
  for (const r of e.items) {
1405
1418
  const i = e.pageFor(r), s = t.get(i.id);
@@ -1412,7 +1425,7 @@ function Pn(e) {
1412
1425
  t.set(i.id, {
1413
1426
  page: i,
1414
1427
  items: [r],
1415
- registryName: Be(
1428
+ registryName: Ue(
1416
1429
  e.kind,
1417
1430
  i.id,
1418
1431
  e.registryPrefix
@@ -1422,7 +1435,7 @@ function Pn(e) {
1422
1435
  const o = {}, n = [];
1423
1436
  for (const r of t.values()) {
1424
1437
  const i = () => /* @__PURE__ */ w(
1425
- nn,
1438
+ rn,
1426
1439
  {
1427
1440
  page: r.page,
1428
1441
  items: r.items,
@@ -1435,7 +1448,7 @@ function Pn(e) {
1435
1448
  component: i,
1436
1449
  children: "none"
1437
1450
  };
1438
- const s = tn(e.frame, r.page, r.items);
1451
+ const s = nn(e.frame, r.page, r.items);
1439
1452
  n.push({
1440
1453
  ...r.page,
1441
1454
  componentName: r.registryName,
@@ -1448,12 +1461,12 @@ function Pn(e) {
1448
1461
  registry: o,
1449
1462
  collection: {
1450
1463
  expectedCount: e.expectedCount ?? e.items.length,
1451
- assets: e.items.map((r) => Ue(r, e.pageFor(r).id)),
1464
+ assets: e.items.map((r) => He(r, e.pageFor(r).id)),
1452
1465
  pages: n
1453
1466
  }
1454
1467
  };
1455
1468
  }
1456
- function rn(e, t = 60) {
1469
+ function on(e, t = 60) {
1457
1470
  const o = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, a]) => a.length > 0).sort(([a, l], [g, p]) => p.length - l.length || a.localeCompare(g)), n = o[0], r = o[1], i = Math.max(1, (n == null ? void 0 : n[1].length) ?? 1), s = r == null ? void 0 : r[1].slice(0, Math.max(1, Math.floor(t / i)));
1458
1471
  return {
1459
1472
  row: n,
@@ -1462,7 +1475,7 @@ function rn(e, t = 60) {
1462
1475
  additional: o.slice(2)
1463
1476
  };
1464
1477
  }
1465
- function on(e, t, o, n) {
1478
+ function sn(e, t, o, n) {
1466
1479
  return {
1467
1480
  ...e.defaultProps,
1468
1481
  ...Object.fromEntries(t.fixed),
@@ -1470,7 +1483,7 @@ function on(e, t, o, n) {
1470
1483
  ...t.column && n ? { [t.column[0]]: n } : {}
1471
1484
  };
1472
1485
  }
1473
- function sn({
1486
+ function an({
1474
1487
  item: e,
1475
1488
  entry: t,
1476
1489
  maxVariantCells: o
@@ -1496,7 +1509,7 @@ function sn({
1496
1509
  ]
1497
1510
  }
1498
1511
  );
1499
- const n = rn(t, o), r = ((a = n.row) == null ? void 0 : a[1]) ?? [void 0], i = ((l = n.column) == null ? void 0 : l[1]) ?? [void 0], s = t.component;
1512
+ const n = on(t, o), r = ((a = n.row) == null ? void 0 : a[1]) ?? [void 0], i = ((l = n.column) == null ? void 0 : l[1]) ?? [void 0], s = t.component;
1500
1513
  return /* @__PURE__ */ N(
1501
1514
  "section",
1502
1515
  {
@@ -1526,7 +1539,7 @@ function sn({
1526
1539
  },
1527
1540
  children: r.flatMap(
1528
1541
  (g) => i.map((p) => {
1529
- const b = on(t, n, g, p), m = [
1542
+ const b = sn(t, n, g, p), m = [
1530
1543
  n.row && g ? `${n.row[0]}=${g}` : "",
1531
1544
  n.column && p ? `${n.column[0]}=${p}` : ""
1532
1545
  ].filter(Boolean).join(" · ");
@@ -1582,16 +1595,16 @@ function sn({
1582
1595
  }
1583
1596
  );
1584
1597
  }
1585
- function En(e) {
1586
- He(e.items);
1598
+ function Nn(e) {
1599
+ Ke(e.items);
1587
1600
  const t = {}, o = [], n = [], r = e.maxVariantCells ?? 60;
1588
1601
  for (const i of e.items) {
1589
- const s = Be(
1602
+ const s = Ue(
1590
1603
  e.kind,
1591
1604
  i.id,
1592
1605
  e.registryPrefix
1593
1606
  ), a = e.registry[i.name], l = () => /* @__PURE__ */ w(
1594
- sn,
1607
+ an,
1595
1608
  {
1596
1609
  item: i,
1597
1610
  entry: a,
@@ -1608,7 +1621,7 @@ function En(e) {
1608
1621
  width: 1,
1609
1622
  height: 1,
1610
1623
  frameSizeMode: "content"
1611
- }), n.push(Ue(i, i.id));
1624
+ }), n.push(He(i, i.id));
1612
1625
  }
1613
1626
  return {
1614
1627
  registry: t,
@@ -1619,9 +1632,9 @@ function En(e) {
1619
1632
  }
1620
1633
  };
1621
1634
  }
1622
- const Oe = /^[a-f0-9]{64}$/, an = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, cn = /^p\d+$/;
1635
+ const Oe = /^[a-f0-9]{64}$/, cn = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, ln = /^p\d+$/;
1623
1636
  function ve(e) {
1624
- return typeof e == "string" && an.test(e) ? e : void 0;
1637
+ return typeof e == "string" && cn.test(e) ? e : void 0;
1625
1638
  }
1626
1639
  function $e(e, t) {
1627
1640
  const o = new URL(e, t);
@@ -1641,7 +1654,7 @@ function Me(e) {
1641
1654
  const t = e;
1642
1655
  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) };
1643
1656
  }
1644
- function ln(e) {
1657
+ function dn(e) {
1645
1658
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1646
1659
  const t = e, o = Me(t.before), n = Me(t.after);
1647
1660
  if (!o || !n || !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)
@@ -1658,7 +1671,7 @@ function ln(e) {
1658
1671
  heatmapUrl: r
1659
1672
  };
1660
1673
  }
1661
- function dn(e, t) {
1674
+ function fn(e, t) {
1662
1675
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1663
1676
  const o = e;
1664
1677
  if (typeof o.id != "string" || !o.id) return null;
@@ -1666,7 +1679,7 @@ function dn(e, t) {
1666
1679
  if (!r) return null;
1667
1680
  const i = ge(o.after);
1668
1681
  if (t === "changed" && !i) return null;
1669
- const s = i ? ln(o.pixelDiff) : null;
1682
+ const s = i ? dn(o.pixelDiff) : null;
1670
1683
  return {
1671
1684
  id: o.id,
1672
1685
  before: r,
@@ -1678,7 +1691,7 @@ function dn(e, t) {
1678
1691
  ...s ? { pixelDiff: s } : {}
1679
1692
  };
1680
1693
  }
1681
- function fn(e, t = []) {
1694
+ function un(e, t = []) {
1682
1695
  const o = new Set(t), n = o.size > 0, r = /* @__PURE__ */ new Set(), i = [
1683
1696
  ...e.styles.map((s) => s.affectedFrames ?? []),
1684
1697
  ...e.texts.map((s) => s.affectedFrames ?? []),
@@ -1686,7 +1699,7 @@ function fn(e, t = []) {
1686
1699
  ];
1687
1700
  for (const s of i)
1688
1701
  for (const a of s) {
1689
- if (n && cn.test(a.id) && !o.has(a.id))
1702
+ if (n && ln.test(a.id) && !o.has(a.id))
1690
1703
  throw new Error(
1691
1704
  `"Impact Screen"${a.name}"This internal editor ID (${a.id}) is used. A canonical screen ID is required.`
1692
1705
  );
@@ -1706,7 +1719,7 @@ async function Te(e, t, o) {
1706
1719
  );
1707
1720
  if (typeof r.baselineId != "string" || !r.baselineId)
1708
1721
  throw new Error("Pygmalion visual QA response has no baselineId");
1709
- const i = Array.isArray(r.frames) ? r.frames.map((p) => dn(p, o.phase)).filter((p) => p != null) : [], s = Array.isArray(r.failures) ? r.failures.map((p) => {
1722
+ const i = Array.isArray(r.frames) ? r.frames.map((p) => fn(p, o.phase)).filter((p) => p != null) : [], s = Array.isArray(r.failures) ? r.failures.map((p) => {
1710
1723
  if (!p || typeof p != "object" || Array.isArray(p)) return null;
1711
1724
  const b = p;
1712
1725
  return typeof b.id == "string" && typeof b.error == "string" ? { id: b.id, error: b.error } : null;
@@ -1723,44 +1736,44 @@ const ye = {
1723
1736
  mirror: "/__pygmalion-dev-control",
1724
1737
  sessions: "/__pygmalion-design-session",
1725
1738
  inspect: "/__pygmalion-inspect"
1726
- }, un = "pygmalion.designSessionId", pn = "/__pygmalion-qa", ae = /* @__PURE__ */ new Map();
1727
- function ke() {
1739
+ }, pn = "pygmalion.designSessionId", hn = "/__pygmalion-qa", ce = /* @__PURE__ */ new Map();
1740
+ function De() {
1728
1741
  var e;
1729
1742
  return typeof window < "u" && ((e = window.crypto) != null && e.randomUUID) ? window.crypto.randomUUID() : `pygmalion-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1730
1743
  }
1731
- function hn(e, t) {
1744
+ function mn(e, t) {
1732
1745
  if (e) return e;
1733
- const o = ae.get(t);
1746
+ const o = ce.get(t);
1734
1747
  if (o) return o;
1735
1748
  try {
1736
1749
  const n = window.localStorage.getItem(t);
1737
1750
  if (n)
1738
- return ae.set(t, n), n;
1739
- const r = ke();
1740
- return window.localStorage.setItem(t, r), ae.set(t, r), r;
1751
+ return ce.set(t, n), n;
1752
+ const r = De();
1753
+ return window.localStorage.setItem(t, r), ce.set(t, r), r;
1741
1754
  } catch {
1742
- const n = ke();
1743
- return ae.set(t, n), n;
1755
+ const n = De();
1756
+ return ce.set(t, n), n;
1744
1757
  }
1745
1758
  }
1746
- async function V(e) {
1759
+ async function q(e) {
1747
1760
  const t = await e.json();
1748
1761
  if (!e.ok) throw new Error(t.error ?? `Pygmalion request failed (${e.status})`);
1749
1762
  return t;
1750
1763
  }
1751
- function Nn(e = {}) {
1752
- var se, re, oe, c, f;
1764
+ function Rn(e = {}) {
1765
+ var ae, re, oe, c, f;
1753
1766
  const {
1754
1767
  sessionId: t,
1755
- sessionStorageKey: o = un,
1768
+ sessionStorageKey: o = pn,
1756
1769
  autoStart: n = !0,
1757
1770
  fetcher: r = fetch,
1758
1771
  formatApplyMessage: i
1759
- } = e, s = ((se = e.endpoints) == null ? void 0 : se.mirror) ?? ye.mirror, a = ((re = e.endpoints) == null ? void 0 : re.sessions) ?? ye.sessions, l = ((oe = e.endpoints) == null ? void 0 : oe.inspect) ?? ye.inspect, g = e.visualQa != null, p = ((c = e.visualQa) == null ? void 0 : c.endpoint) ?? pn, b = JSON.stringify(((f = e.visualQa) == null ? void 0 : f.eligibleFrameIds) ?? []), m = le(
1772
+ } = e, s = ((ae = e.endpoints) == null ? void 0 : ae.mirror) ?? ye.mirror, a = ((re = e.endpoints) == null ? void 0 : re.sessions) ?? ye.sessions, l = ((oe = e.endpoints) == null ? void 0 : oe.inspect) ?? ye.inspect, g = e.visualQa != null, p = ((c = e.visualQa) == null ? void 0 : c.endpoint) ?? hn, b = JSON.stringify(((f = e.visualQa) == null ? void 0 : f.eligibleFrameIds) ?? []), m = de(
1760
1773
  () => JSON.parse(b),
1761
1774
  [b]
1762
- ), v = le(
1763
- () => hn(t, o),
1775
+ ), v = de(
1776
+ () => mn(t, o),
1764
1777
  [t, o]
1765
1778
  ), [y, R] = te({
1766
1779
  state: "idle",
@@ -1772,11 +1785,11 @@ function Nn(e = {}) {
1772
1785
  warning: null,
1773
1786
  error: null,
1774
1787
  appOrigin: null
1775
- }), [h, O] = te(null), [A, k] = te(null), [$, D] = te({
1788
+ }), [h, O] = te(null), [A, D] = te(null), [$, k] = te({
1776
1789
  refs: [],
1777
1790
  defaultRef: null,
1778
1791
  worktreeRef: null
1779
- }), S = Ne(null), x = Ne(null), T = L(
1792
+ }), S = Ne(null), x = Ne(null), T = W(
1780
1793
  async (d = !0, u) => {
1781
1794
  if (u != null && S.current && await S.current.catch(() => {
1782
1795
  }), S.current) return S.current;
@@ -1790,24 +1803,24 @@ function Nn(e = {}) {
1790
1803
  headers: { "content-type": "application/json" },
1791
1804
  body: JSON.stringify({ ref: u })
1792
1805
  } : {}
1793
- }), C = await V(M);
1794
- const J = Date.now();
1795
- for (; !d && C.state === "syncing" && Date.now() - J < 12e4; )
1796
- await new Promise((ee) => window.setTimeout(ee, 500)), M = await r(`${s}/status`), C = await V(M);
1806
+ }), C = await q(M);
1807
+ const L = Date.now();
1808
+ for (; !d && C.state === "syncing" && Date.now() - L < 12e4; )
1809
+ await new Promise((ee) => window.setTimeout(ee, 500)), M = await r(`${s}/status`), C = await q(M);
1797
1810
  if (C.state !== "ready" || !C.appOrigin || !C.commit)
1798
1811
  throw new Error(C.error ?? "Pygmalion could not prepare the source preview");
1799
- const G = await V(
1812
+ const V = await q(
1800
1813
  await r(`${a}/open`, {
1801
1814
  method: "POST",
1802
1815
  headers: { "content-type": "application/json" },
1803
1816
  body: JSON.stringify({ sessionId: v, baseDevSha: C.commit })
1804
1817
  })
1805
1818
  );
1806
- if (!G.ok || !G.session)
1807
- throw new Error(G.error ?? "Pygmalion could not open the design session");
1808
- let H = G.session;
1819
+ if (!V.ok || !V.session)
1820
+ throw new Error(V.error ?? "Pygmalion could not open the design session");
1821
+ let H = V.session;
1809
1822
  if (H.branchName) {
1810
- const ee = await V(
1823
+ const ee = await q(
1811
1824
  await r(`${a}/check`, {
1812
1825
  method: "POST",
1813
1826
  headers: { "content-type": "application/json" },
@@ -1818,7 +1831,7 @@ function Nn(e = {}) {
1818
1831
  throw new Error(ee.error ?? "Pygmalion could not check the design session");
1819
1832
  H = ee.session;
1820
1833
  }
1821
- R(C), O(H), k(H.appOrigin ?? C.appOrigin);
1834
+ R(C), O(H), D(H.appOrigin ?? C.appOrigin);
1822
1835
  } catch (I) {
1823
1836
  R((M) => ({
1824
1837
  ...M,
@@ -1835,20 +1848,20 @@ function Nn(e = {}) {
1835
1848
  }
1836
1849
  },
1837
1850
  [r, s, a, v]
1838
- ), j = L(async () => {
1851
+ ), j = W(async () => {
1839
1852
  try {
1840
- const d = await V(
1853
+ const d = await q(
1841
1854
  await r(`${s}/refs`)
1842
1855
  ), u = {
1843
1856
  refs: d.refs ?? [],
1844
1857
  defaultRef: d.defaultRef ?? null,
1845
1858
  worktreeRef: d.worktreeRef ?? null
1846
1859
  };
1847
- return D(u), u;
1860
+ return k(u), u;
1848
1861
  } catch {
1849
1862
  return $;
1850
1863
  }
1851
- }, [r, s, $]), X = L(
1864
+ }, [r, s, $]), X = W(
1852
1865
  async (d, u) => {
1853
1866
  if (h != null && h.branchName && !(u != null && u.discardEdits))
1854
1867
  throw new Error(
@@ -1857,14 +1870,14 @@ function Nn(e = {}) {
1857
1870
  await T(!0, d);
1858
1871
  },
1859
1872
  [T, h == null ? void 0 : h.branchName]
1860
- ), Y = L(
1873
+ ), Y = W(
1861
1874
  async (d) => {
1862
1875
  var C;
1863
1876
  if (!h) throw new Error("Pygmalion design session is not ready");
1864
1877
  const u = x.current;
1865
1878
  if (u && (u.sessionId !== h.id || u.baseDevSha !== h.baseDevSha || u.revision !== h.revision || u.fingerprint !== JSON.stringify(d)))
1866
1879
  throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
1867
- const P = await V(
1880
+ const P = await q(
1868
1881
  await r(`${a}/apply-visual`, {
1869
1882
  method: "POST",
1870
1883
  headers: { "content-type": "application/json" },
@@ -1879,7 +1892,7 @@ function Nn(e = {}) {
1879
1892
  );
1880
1893
  if (!P.ok || !P.session)
1881
1894
  throw new Error(P.error ?? "Pygmalion could not apply the visual changes");
1882
- O(P.session), P.session.appOrigin && k(P.session.appOrigin);
1895
+ O(P.session), P.session.appOrigin && D(P.session.appOrigin);
1883
1896
  const I = P.applied ?? d.styles.length + d.texts.length + d.operations.length;
1884
1897
  let M;
1885
1898
  if (u != null && u.qaBaselineId && ((C = u.qaFrameIds) != null && C.length) && P.session.appOrigin)
@@ -1890,14 +1903,14 @@ function Nn(e = {}) {
1890
1903
  basePath: $e(P.session.appOrigin, window.location.origin),
1891
1904
  frameIds: u.qaFrameIds
1892
1905
  });
1893
- } catch (J) {
1894
- const G = J instanceof Error ? J.message : String(J);
1906
+ } catch (L) {
1907
+ const V = L instanceof Error ? L.message : String(L);
1895
1908
  M = {
1896
1909
  phase: "changed",
1897
1910
  baselineId: u.qaBaselineId,
1898
1911
  complete: !1,
1899
1912
  frames: [],
1900
- failures: u.qaFrameIds.map((H) => ({ id: H, error: G }))
1913
+ failures: u.qaFrameIds.map((H) => ({ id: H, error: V }))
1901
1914
  };
1902
1915
  }
1903
1916
  return x.current = null, {
@@ -1909,12 +1922,12 @@ function Nn(e = {}) {
1909
1922
  };
1910
1923
  },
1911
1924
  [r, i, p, h, a]
1912
- ), q = L(
1925
+ ), G = W(
1913
1926
  async (d) => {
1914
1927
  var C;
1915
1928
  if (!h) throw new Error("Pygmalion design session is not ready");
1916
1929
  x.current = null;
1917
- const u = await V(
1930
+ const u = await q(
1918
1931
  await r(`${a}/preview-visual`, {
1919
1932
  method: "POST",
1920
1933
  headers: { "content-type": "application/json" },
@@ -1928,7 +1941,7 @@ function Nn(e = {}) {
1928
1941
  );
1929
1942
  if (!u.ok || !Number.isSafeInteger(u.revision))
1930
1943
  throw new Error(u.error ?? "Pygmalion could not preview the visual changes");
1931
- const P = g ? fn(d, m) : [];
1944
+ const P = g ? un(d, m) : [];
1932
1945
  let I;
1933
1946
  const M = h.appOrigin ?? y.appOrigin;
1934
1947
  if (P.length > 0) {
@@ -1965,10 +1978,10 @@ function Nn(e = {}) {
1965
1978
  a,
1966
1979
  g
1967
1980
  ]
1968
- ), Z = L(
1981
+ ), Z = W(
1969
1982
  async (d) => {
1970
1983
  if (d.length === 0) return { files: [] };
1971
- const u = await V(
1984
+ const u = await q(
1972
1985
  await r(`${l}/impact`, {
1973
1986
  method: "POST",
1974
1987
  headers: { "content-type": "application/json" },
@@ -1980,10 +1993,10 @@ function Nn(e = {}) {
1980
1993
  return { files: Array.isArray(u.files) ? u.files : [] };
1981
1994
  },
1982
1995
  [r, l]
1983
- ), E = L(async () => {
1996
+ ), E = W(async () => {
1984
1997
  if (!(h != null && h.canRevert) || !h.headSha)
1985
1998
  throw new Error("There are no reversible changes applied");
1986
- const d = await V(
1999
+ const d = await q(
1987
2000
  await r(`${a}/revert-visual`, {
1988
2001
  method: "POST",
1989
2002
  headers: { "content-type": "application/json" },
@@ -1997,7 +2010,7 @@ function Nn(e = {}) {
1997
2010
  );
1998
2011
  if (!d.ok || d.reverted !== !0 || !d.operation || d.operation.kind !== "visual-revert" || !d.session)
1999
2012
  throw new Error(d.error ?? "Pygmalion could not revert the last visual change");
2000
- return x.current = null, O(d.session), d.session.appOrigin && k(d.session.appOrigin), {
2013
+ return x.current = null, O(d.session), d.session.appOrigin && D(d.session.appOrigin), {
2001
2014
  reverted: !0,
2002
2015
  operation: d.operation,
2003
2016
  session: d.session
@@ -2020,13 +2033,13 @@ function Nn(e = {}) {
2020
2033
  switchSource: X,
2021
2034
  sourceRefs: $,
2022
2035
  loadSourceRefs: j,
2023
- previewVisual: q,
2036
+ previewVisual: G,
2024
2037
  inspectImpact: Z,
2025
2038
  applyVisual: Y,
2026
2039
  revertLastVisual: E
2027
2040
  };
2028
2041
  }
2029
- function Rn({
2042
+ function Cn({
2030
2043
  value: e,
2031
2044
  refs: t,
2032
2045
  onChange: o,
@@ -2037,13 +2050,13 @@ function Rn({
2037
2050
  children: a,
2038
2051
  className: l
2039
2052
  }) {
2040
- const g = le(
2053
+ const g = de(
2041
2054
  () => ({
2042
2055
  local: t.filter((m) => m.kind === "local"),
2043
2056
  remote: t.filter((m) => m.kind === "remote")
2044
2057
  }),
2045
2058
  [t]
2046
- ), p = le(() => {
2059
+ ), p = de(() => {
2047
2060
  const m = new Set(t.map((v) => v.name));
2048
2061
  return r && m.add(r), i && m.add(i), m;
2049
2062
  }, [r, t, i]), b = e ?? r ?? "";
@@ -2103,22 +2116,22 @@ function Rn({
2103
2116
  }
2104
2117
  );
2105
2118
  }
2106
- const Cn = {
2119
+ const An = {
2107
2120
  editor: K,
2108
- getObserverTree: Je,
2109
- isObservableProp: Ve
2121
+ getObserverTree: Le,
2122
+ isObservableProp: Je
2110
2123
  };
2111
- function An(e) {
2124
+ function On(e) {
2112
2125
  K.navigateToPageByName(e);
2113
2126
  }
2114
- function On() {
2127
+ function $n() {
2115
2128
  K.openPreview();
2116
2129
  }
2117
- function $n() {
2130
+ function Mn() {
2118
2131
  const e = xe.entries.length > 0;
2119
2132
  return e && xe.discardPending(), K.resetCurrentEdits() || e;
2120
2133
  }
2121
- function Mn({
2134
+ function Tn({
2122
2135
  registry: e,
2123
2136
  tokens: t,
2124
2137
  initialPages: o,
@@ -2138,22 +2151,22 @@ function Mn({
2138
2151
  onDesignChange: h,
2139
2152
  onInspectApply: O,
2140
2153
  onInspectPreview: A,
2141
- onInspectImpact: k,
2154
+ onInspectImpact: D,
2142
2155
  storyboardDiscovery: $ = !0,
2143
- storyboardDiscoveryEndpoint: D = ct
2156
+ storyboardDiscoveryEndpoint: k = lt
2144
2157
  }) {
2145
2158
  const [S, x] = te(!$), [T, j] = te();
2146
- r && (r.assertComplete(), Le(r));
2147
- const X = e ?? (r == null ? void 0 : r.getRegistry()), Y = t ?? (r == null ? void 0 : r.getTokens()), q = o ?? (r == null ? void 0 : r.getInitialPages());
2148
- X && We(X), Y && Qe(Y), n && Xe(n), dt(i ?? null), s != null && Ye(s), a != null && Ze(a), et(l);
2159
+ r && (r.assertComplete(), We(r));
2160
+ const X = e ?? (r == null ? void 0 : r.getRegistry()), Y = t ?? (r == null ? void 0 : r.getTokens()), G = o ?? (r == null ? void 0 : r.getInitialPages());
2161
+ X && Qe(X), Y && Xe(Y), n && Ye(n), ft(i ?? null), s != null && Ze(s), a != null && et(a), tt(l);
2149
2162
  const Z = T ?? g;
2150
- return Z && q && S && tt(Z, {
2163
+ return Z && G && S && nt(Z, {
2151
2164
  namespace: l ?? "",
2152
- previewRevision: ut(),
2153
- appOrigin: ft(),
2154
- baselineEnvironment: nt(),
2165
+ previewRevision: pt(),
2166
+ appOrigin: ut(),
2167
+ baselineEnvironment: rt(),
2155
2168
  allowStaleIdentity: T == null && !!p,
2156
- pages: q.flatMap(
2169
+ pages: G.flatMap(
2157
2170
  (E) => E.route && E.importPageId ? [
2158
2171
  {
2159
2172
  canonicalId: E.importPageId,
@@ -2167,9 +2180,9 @@ function Mn({
2167
2180
  }
2168
2181
  ] : []
2169
2182
  )
2170
- }), b != null && rt(b), pt(v ?? null), y != null && ot(y), ht(R ?? null), mt(O ?? null), it(A ?? null), gt(k ?? null), q && K.initPagesFromComponents(q), ne(() => {
2183
+ }), b != null && ot(b), ht(v ?? null), y != null && it(y), mt(R ?? null), gt(O ?? null), st(A ?? null), yt(D ?? null), G && K.initPagesFromComponents(G), ne(() => {
2171
2184
  Pe(h ?? null);
2172
- const E = st(K);
2185
+ const E = at(K);
2173
2186
  return () => {
2174
2187
  E(), Pe(null);
2175
2188
  };
@@ -2177,10 +2190,10 @@ function Mn({
2177
2190
  if (j(void 0), !S || !p || !(l != null && l.trim()) || !(a != null && a.trim()))
2178
2191
  return;
2179
2192
  const E = new AbortController();
2180
- return Xt({
2193
+ return Yt({
2181
2194
  namespace: l,
2182
- sourceRevision: at(a),
2183
- transport: Vt({
2195
+ sourceRevision: ct(a),
2196
+ transport: Jt({
2184
2197
  endpoint: p,
2185
2198
  captureBaseUrl: s
2186
2199
  }),
@@ -2201,8 +2214,8 @@ function Mn({
2201
2214
  E = !1;
2202
2215
  };
2203
2216
  const B = new AbortController();
2204
- return x(!1), ie(void 0), W(null), Fe({
2205
- endpoint: D,
2217
+ return x(!1), ie(void 0), Q(null), Fe({
2218
+ endpoint: k,
2206
2219
  signal: B.signal,
2207
2220
  pages: K.pages.map((_) => ({
2208
2221
  ..._,
@@ -2211,22 +2224,22 @@ function Mn({
2211
2224
  })),
2212
2225
  assets: (r == null ? void 0 : r.getAssets("screens")) ?? []
2213
2226
  }).then((_) => {
2214
- E && (ie(_.baselineEnvironment), W(_.graph));
2227
+ E && (ie(_.baselineEnvironment), Q(_.graph));
2215
2228
  }).catch(() => {
2216
- E && (ie(void 0), W(null));
2229
+ E && (ie(void 0), Q(null));
2217
2230
  }).finally(() => {
2218
2231
  E && x(!0);
2219
2232
  }), () => {
2220
- E = !1, B.abort(), ie(void 0), W(null);
2233
+ E = !1, B.abort(), ie(void 0), Q(null);
2221
2234
  };
2222
2235
  }, [
2223
2236
  r,
2224
2237
  o,
2225
2238
  $,
2226
- D
2239
+ k
2227
2240
  ]), ne(() => {
2228
2241
  m == null || m === K.previewOpen || (m ? K.openPreview({ notifyHost: !1 }) : K.closePreview({ notifyHost: !1 }));
2229
- }, [m]), S ? /* @__PURE__ */ w(lt, {}) : /* @__PURE__ */ w(
2242
+ }, [m]), S ? /* @__PURE__ */ w(dt, {}) : /* @__PURE__ */ w(
2230
2243
  "div",
2231
2244
  {
2232
2245
  "data-pygmalion-storyboard-loading": "",
@@ -2245,62 +2258,63 @@ function Mn({
2245
2258
  );
2246
2259
  }
2247
2260
  export {
2248
- Dn as DESIGN_IMPORT_KINDS,
2249
- vn as PygmalionCatalogDocument,
2250
- xn as PygmalionCatalogMatrix,
2251
- In as PygmalionCatalogSection,
2252
- Mn as PygmalionEditor,
2253
- ct as STORYBOARD_ENVIRONMENT_CONTROL,
2254
- zn as STORYBOARD_ENVIRONMENT_QUERY,
2255
- Rn as SourceRefControl,
2256
- Cn as __debug,
2257
- _n as applyTokenOverride,
2258
- Xt as bootstrapPreviewArtifact,
2259
- Fn as clearPygmalionPreviewCache,
2260
- En as createDesignComponentCatalog,
2261
- rn as createDesignComponentVariantMatrix,
2262
- Pn as createDesignGalleryCatalog,
2263
- jn as createDesignImportController,
2264
- Bn as createDesignScreenCollection,
2265
- Vt as createPreviewArtifactHttpTransport,
2266
- bn as createPreviewCacheNamespace,
2267
- Gt as createPreviewRecipeFingerprint,
2268
- Sn as createStoryboardCaptureRecipeIdentity,
2269
- St as createStoryboardGraph,
2270
- Dt as createStoryboardGraphFromDiscovery,
2271
- Un as createStoryboardGraphViewModel,
2272
- Hn as createStoryboardRouteUrl,
2273
- en as designCatalogKey,
2274
- Be as designCatalogRegistryName,
2275
- Kn as expandDesignScreenCasesViewports,
2276
- qn as expandDesignScreenCollectionViewports,
2277
- Gn as getRecommendedPygmalionPreviewConcurrency,
2278
- nt as getStoryboardBaselineEnvironment,
2261
+ zn as DESIGN_IMPORT_KINDS,
2262
+ In as PygmalionCatalogDocument,
2263
+ Pn as PygmalionCatalogMatrix,
2264
+ xn as PygmalionCatalogSection,
2265
+ Tn as PygmalionEditor,
2266
+ lt as STORYBOARD_ENVIRONMENT_CONTROL,
2267
+ _n as STORYBOARD_ENVIRONMENT_QUERY,
2268
+ Cn as SourceRefControl,
2269
+ An as __debug,
2270
+ Fn as applyTokenOverride,
2271
+ Yt as bootstrapPreviewArtifact,
2272
+ jn as clearPygmalionPreviewCache,
2273
+ Nn as createDesignComponentCatalog,
2274
+ on as createDesignComponentVariantMatrix,
2275
+ En as createDesignGalleryCatalog,
2276
+ Bn as createDesignImportController,
2277
+ Un as createDesignScreenCollection,
2278
+ Jt as createPreviewArtifactHttpTransport,
2279
+ vn as createPreviewCacheNamespace,
2280
+ Sn as createPreviewFrameFingerprint,
2281
+ je as createPreviewRecipeFingerprint,
2282
+ qt as createStoryboardCaptureRecipeIdentity,
2283
+ vt as createStoryboardGraph,
2284
+ zt as createStoryboardGraphFromDiscovery,
2285
+ Hn as createStoryboardGraphViewModel,
2286
+ Kn as createStoryboardRouteUrl,
2287
+ tn as designCatalogKey,
2288
+ Ue as designCatalogRegistryName,
2289
+ Gn as expandDesignScreenCasesViewports,
2290
+ Vn as expandDesignScreenCollectionViewports,
2291
+ qn as getRecommendedPygmalionPreviewConcurrency,
2292
+ rt as getStoryboardBaselineEnvironment,
2279
2293
  _e as getStoryboardDiscoveryBaselineEnvironment,
2280
- Vn as getStoryboardGraph,
2281
- Jn as getViewportPresets,
2294
+ Jn as getStoryboardGraph,
2295
+ Ln as getViewportPresets,
2282
2296
  Fe as loadStoryboardDiscovery,
2283
- Ln as mergeScreenPresets,
2284
- Ke as mergeStoryboardEnvironment,
2285
- wn as publishStoryboardDiscovery,
2286
- An as pygmalionNavigate,
2287
- On as pygmalionOpenPreview,
2288
- $n as pygmalionResetCurrentEdits,
2289
- Wn as reconstructRoutePreviewArtifactScreenshotV3,
2290
- Qn as reconstructRoutePreviewArtifactSnapshotV3,
2291
- Xn as resetTokenOverrides,
2292
- Nt as resolveStoryboardScreenCases,
2293
- We as setComponentRegistry,
2294
- Ye as setPygmalionAppOrigin,
2295
- rt as setPygmalionPreviewConcurrency,
2296
- Ze as setPygmalionPreviewRevision,
2297
+ Wn as mergeScreenPresets,
2298
+ Ge as mergeStoryboardEnvironment,
2299
+ bn as publishStoryboardDiscovery,
2300
+ On as pygmalionNavigate,
2301
+ $n as pygmalionOpenPreview,
2302
+ Mn as pygmalionResetCurrentEdits,
2303
+ Qn as reconstructRoutePreviewArtifactScreenshotV3,
2304
+ Xn as reconstructRoutePreviewArtifactSnapshotV3,
2305
+ Yn as resetTokenOverrides,
2306
+ Rt as resolveStoryboardScreenCases,
2307
+ Qe as setComponentRegistry,
2308
+ Ze as setPygmalionAppOrigin,
2309
+ ot as setPygmalionPreviewConcurrency,
2310
+ et as setPygmalionPreviewRevision,
2297
2311
  ie as setStoryboardBaselineEnvironment,
2298
- W as setStoryboardGraph,
2299
- Qe as setTokens,
2300
- Xe as setViewportPresets,
2301
- yt as storyboardScreenRecipeKey,
2302
- Yn as subscribeStoryboardGraph,
2303
- Nn as usePygmalionProject,
2304
- Qt as validatePreviewArtifactBundle,
2305
- qe as validateRoutePreviewArtifactV3Browser
2312
+ Q as setStoryboardGraph,
2313
+ Xe as setTokens,
2314
+ Ye as setViewportPresets,
2315
+ wt as storyboardScreenRecipeKey,
2316
+ Zn as subscribeStoryboardGraph,
2317
+ Rn as usePygmalionProject,
2318
+ Xt as validatePreviewArtifactBundle,
2319
+ Ve as validateRoutePreviewArtifactV3Browser
2306
2320
  };