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