@nimtech/nimpress 2.10.2 → 2.10.4
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/.claude/rules/deploy.md +11 -1
- package/.claude/rules/docs-sync.md +14 -0
- package/dist/cli.es.js +2 -2
- package/dist/nimpress.es.js +6755 -7139
- package/dist/{plugin-BgOqm_bJ.js → plugin-B-Kv7cY0.js} +1102 -1097
- package/dist/plugin.es.js +2 -2
- package/dist/src/roadmap/layout.d.ts +117 -0
- package/dist/src/roadmap/layout.d.ts.map +1 -0
- package/dist/src/types.d.ts +4 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/typeMembers-B0twE4c_.js +1143 -0
- package/package.json +1 -1
- package/dist/typeMembers-CNvE92EX.js +0 -538
|
@@ -0,0 +1,1143 @@
|
|
|
1
|
+
function Rt(t) {
|
|
2
|
+
const n = String(t ?? "/").trim();
|
|
3
|
+
if (!n || n === "/") return "/";
|
|
4
|
+
const o = n.startsWith("/") ? n : `/${n}`;
|
|
5
|
+
return o.endsWith("/") ? o : `${o}/`;
|
|
6
|
+
}
|
|
7
|
+
function Vn(t, n) {
|
|
8
|
+
const o = Rt(t);
|
|
9
|
+
return o === "/" || !n.startsWith("/") || n.startsWith("//") || n === o.slice(0, -1) || n.startsWith(o) ? n : o.slice(0, -1) + n;
|
|
10
|
+
}
|
|
11
|
+
function Qn(t, n) {
|
|
12
|
+
const o = Rt(t);
|
|
13
|
+
return o === "/" ? n : n === o.slice(0, -1) ? "/" : n.startsWith(o) ? "/" + n.slice(o.length) : n;
|
|
14
|
+
}
|
|
15
|
+
const Q = 96, K = 2, Wt = 16, gt = 8, nt = 12, pt = 12, st = [6, 4, 2], qt = 1.5, Ht = 2, ot = 8, It = 46, at = 0.8, Bt = 8, mt = 20, et = ["compact", "small", "pill"];
|
|
16
|
+
function Gt(t) {
|
|
17
|
+
const n = new Map(t.map((s) => [s.href, s])), o = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const s of t)
|
|
19
|
+
if (s.parent && n.has(s.parent)) {
|
|
20
|
+
const i = o.get(s.parent) ?? [];
|
|
21
|
+
i.push(s), o.set(s.parent, i);
|
|
22
|
+
}
|
|
23
|
+
function e(s, i, c) {
|
|
24
|
+
if (c.has(s.href)) return { entry: s, depth: i, children: [] };
|
|
25
|
+
const a = new Set(c).add(s.href), h = (o.get(s.href) ?? []).slice().sort((f, g) => (g.targetDate ?? "").localeCompare(f.targetDate ?? "")).map((f) => e(f, i + 1, a));
|
|
26
|
+
return { entry: s, depth: i, children: h };
|
|
27
|
+
}
|
|
28
|
+
const r = [];
|
|
29
|
+
for (const s of t)
|
|
30
|
+
(!s.parent || !n.has(s.parent)) && r.push(e(s, 0, /* @__PURE__ */ new Set()));
|
|
31
|
+
return r.sort((s, i) => (i.entry.targetDate ?? "").localeCompare(s.entry.targetDate ?? "")), r;
|
|
32
|
+
}
|
|
33
|
+
const G = {
|
|
34
|
+
head: 0.85,
|
|
35
|
+
smallHead: 0.72,
|
|
36
|
+
title: 1.5,
|
|
37
|
+
compactTitle: 1.2,
|
|
38
|
+
smallTitle: 1.05,
|
|
39
|
+
desc: 1.1,
|
|
40
|
+
pillTitle: 1.05,
|
|
41
|
+
pillDate: 0.75,
|
|
42
|
+
gap: 0.35
|
|
43
|
+
};
|
|
44
|
+
function lt(t, n, o, e) {
|
|
45
|
+
const r = o * e * at, s = (c, a, h) => Math.max(1, Math.min(h, Math.ceil(c.length * a * 0.55 / r)));
|
|
46
|
+
let i;
|
|
47
|
+
if (n === "pill")
|
|
48
|
+
i = (G.pillDate * 1.3 + G.gap + G.pillTitle * 1.1) * e;
|
|
49
|
+
else {
|
|
50
|
+
const c = (n === "small" ? G.smallHead : G.head) * e, a = (n === "card" ? G.title : n === "compact" ? G.compactTitle : G.smallTitle) * e;
|
|
51
|
+
if (i = c * 1.7 + G.gap * e + s(t.title, a, n === "small" ? 1 : 2) * a * 1.25, n === "card" && t.description) {
|
|
52
|
+
const h = G.desc * e;
|
|
53
|
+
i += G.gap * e + s(t.description, h, 3) * h * 1.45;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return Math.ceil(i / at / e) + 1;
|
|
57
|
+
}
|
|
58
|
+
function Yt(t, n) {
|
|
59
|
+
return (t.children.length || t.entry.kind === "epic" || t.entry.kind === "milestone" ? [32, 28, 24, 20] : [24, 20, 18]).map((e) => [e, lt(t.entry, "card", e, n)]);
|
|
60
|
+
}
|
|
61
|
+
function Ut(t, n, o) {
|
|
62
|
+
const e = (n === "compact" ? G.compactTitle : n === "small" ? G.smallTitle : G.pillTitle) * o, r = (n === "small" ? G.smallHead : n === "pill" ? G.pillDate : G.head) * o, s = Math.max(t.entry.title.length * e * 0.55, 10 * r * 0.62) + o, i = Math.max(10, Math.min(n === "compact" ? 24 : 28, Math.ceil(s / at / o)));
|
|
63
|
+
return [i, lt(t.entry, n, i, o)];
|
|
64
|
+
}
|
|
65
|
+
function xt(t) {
|
|
66
|
+
let n = 2166136261;
|
|
67
|
+
for (let o = 0; o < t.length; o++)
|
|
68
|
+
n ^= t.charCodeAt(o), n = Math.imul(n, 16777619);
|
|
69
|
+
return (n >>> 0) % 1e4 / 1e4;
|
|
70
|
+
}
|
|
71
|
+
function Jt(t, n) {
|
|
72
|
+
return Math.round(9 * (1 + 1.5 * Math.sqrt(Math.max(1, t / n) - 1)));
|
|
73
|
+
}
|
|
74
|
+
function J(t) {
|
|
75
|
+
return t.targetDate ? new Date(t.targetDate).getTime() : 0;
|
|
76
|
+
}
|
|
77
|
+
function dt(t, n, o, e, r, s, i) {
|
|
78
|
+
const [c, a] = n;
|
|
79
|
+
if (c > e || a > r) return null;
|
|
80
|
+
const h = new Uint8Array(e * r), f = new Int32Array((e + 1) * (r + 1)), g = (d, p, N, D) => {
|
|
81
|
+
for (let q = Math.max(0, p); q < Math.min(r, p + D); q++)
|
|
82
|
+
for (let W = Math.max(0, d); W < Math.min(e, d + N); W++) h[q * e + W] = 1;
|
|
83
|
+
}, S = () => {
|
|
84
|
+
for (let d = 0; d < r; d++) {
|
|
85
|
+
let p = 0;
|
|
86
|
+
for (let N = 0; N < e; N++)
|
|
87
|
+
p += h[d * e + N], f[(d + 1) * (e + 1) + N + 1] = f[d * (e + 1) + N + 1] + p;
|
|
88
|
+
}
|
|
89
|
+
}, _ = (d, p, N, D) => {
|
|
90
|
+
const q = Math.max(0, d), W = Math.max(0, p), v = Math.min(e, d + N), I = Math.min(r, p + D);
|
|
91
|
+
if (v <= q || I <= W) return 0;
|
|
92
|
+
const L = e + 1;
|
|
93
|
+
return f[I * L + v] - f[W * L + v] - f[I * L + q] + f[W * L + q];
|
|
94
|
+
}, C = Math.floor((r - a) / 2), O = { node: t, parent: null, variant: "card", col: 0, row: C, cols: c, rows: a };
|
|
95
|
+
g(0, C, c, a);
|
|
96
|
+
const w = [O], A = /* @__PURE__ */ new Map([[t, O]]), T = /* @__PURE__ */ new Map(), b = (d) => d.children.forEach((p) => {
|
|
97
|
+
T.set(p, d), b(p);
|
|
98
|
+
});
|
|
99
|
+
b(t);
|
|
100
|
+
const m = ut(t.children).sort((d, p) => J(d.entry) - J(p.entry)), x = new Map(m.map((d, p) => [d, m.length === 1 ? 0.5 : p / (m.length - 1)])), k = [...m].sort((d, p) => d.depth - p.depth || J(d.entry) - J(p.entry)), l = Math.PI * 1.15;
|
|
101
|
+
for (const d of k) {
|
|
102
|
+
S();
|
|
103
|
+
const p = A.get(T.get(d)), N = p.col + p.cols / 2, D = p.row + p.rows / 2, q = p === O ? (0.5 - x.get(d)) * l : Math.atan2(D - (C + a / 2), N - c / 2), W = d.depth > 1 ? et.length - 1 : o;
|
|
104
|
+
let v = null, I = 1 / 0;
|
|
105
|
+
for (let L = 1; L <= 10; L++) {
|
|
106
|
+
const B = et[Math.min(et.length - 1, W + (L > 1 ? 1 : 0))], [u, y] = Ut(d, B, s), j = (xt(d.entry.href + L) - 0.5) * 0.3, H = 1 + (xt(d.entry.href + "r" + L) - 0.5) * 0.14, Y = (p.cols / 2 + i + u / 2 + (L - 1) * (u * 0.8 + i)) * H, U = (p.rows / 2 + i + y / 2 + (L - 1) * (y + i)) * H * qt;
|
|
107
|
+
for (let E = -l * 0.55; E <= l * 0.55; E += 0.03) {
|
|
108
|
+
const P = Math.round(N + Y * Math.cos(E) - u / 2), z = Math.round(D + U * Math.sin(E) - y / 2);
|
|
109
|
+
if (P < Ht || z < 0 || P + u > e || z + y > r) continue;
|
|
110
|
+
const Z = (L - 1) * 1.6 + Math.abs(E - q - j);
|
|
111
|
+
Z >= I || _(P - 1, z - 1, u + 2, y + 2) || (I = Z, v = { node: d, parent: p, variant: B, col: P, row: z, cols: u, rows: y });
|
|
112
|
+
}
|
|
113
|
+
if (v && I < L * 1.6) break;
|
|
114
|
+
}
|
|
115
|
+
if (!v) return null;
|
|
116
|
+
g(v.col, v.row, v.cols, v.rows), w.push(v), A.set(d, v);
|
|
117
|
+
}
|
|
118
|
+
let $ = r, M = 0, R = 0;
|
|
119
|
+
for (const d of w)
|
|
120
|
+
$ = Math.min($, d.row), M = Math.max(M, d.row + d.rows), R = Math.max(R, d.col + d.cols);
|
|
121
|
+
const F = w.slice(1).map((d) => ({
|
|
122
|
+
id: `${d.parent.node.entry.href}->${d.node.entry.href}`,
|
|
123
|
+
points: zt(h, e, r, d.parent, d)
|
|
124
|
+
}));
|
|
125
|
+
for (const d of w) d.row -= $;
|
|
126
|
+
for (const d of F) for (const p of d.points) p.y -= $;
|
|
127
|
+
return { placed: w, width: R, height: M - $, links: F };
|
|
128
|
+
}
|
|
129
|
+
function zt(t, n, o, e, r) {
|
|
130
|
+
const s = (m, x) => m >= 0 && x >= 0 && m < n && x < o && t[x * n + m] === 0, i = (m) => {
|
|
131
|
+
const x = [];
|
|
132
|
+
for (let k = m.col; k < m.col + m.cols; k++) x.push([k, m.row - 1], [k, m.row + m.rows]);
|
|
133
|
+
for (let k = m.row; k < m.row + m.rows; k++) x.push([m.col - 1, k], [m.col + m.cols, k]);
|
|
134
|
+
return x.filter(([k, l]) => s(k, l));
|
|
135
|
+
}, c = (m, x, k) => {
|
|
136
|
+
const l = m.cols / 2, $ = m.rows / 2, M = m.col + l, R = m.row + $, F = x + 0.5 - M, d = k + 0.5 - R, p = Math.pow(Math.pow(Math.abs(F / l), 4) + Math.pow(Math.abs(d / $), 4), -0.25);
|
|
137
|
+
return { x: M + F * p, y: R + d * p };
|
|
138
|
+
}, a = new Set(i(r).map(([m, x]) => x * n + m)), h = [[1, 0], [-1, 0], [0, 1], [0, -1]], f = new Int32Array(n * o * 4).fill(1 << 30), g = new Int32Array(n * o * 4).fill(-1), S = [];
|
|
139
|
+
for (const [m, x] of i(e))
|
|
140
|
+
for (let k = 0; k < 4; k++) {
|
|
141
|
+
const l = (x * n + m) * 4 + k;
|
|
142
|
+
f[l] = 0, (S[0] ??= []).push(l);
|
|
143
|
+
}
|
|
144
|
+
let _ = -1;
|
|
145
|
+
for (let m = 0; m < S.length && _ < 0; m++) {
|
|
146
|
+
const x = S[m];
|
|
147
|
+
if (x)
|
|
148
|
+
for (let k = 0; k < x.length; k++) {
|
|
149
|
+
const l = x[k];
|
|
150
|
+
if (f[l] !== m) continue;
|
|
151
|
+
const $ = l >> 2;
|
|
152
|
+
if (a.has($)) {
|
|
153
|
+
_ = l;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
const M = l & 3, R = $ % n, F = Math.floor($ / n);
|
|
157
|
+
for (let d = 0; d < 4; d++) {
|
|
158
|
+
const p = R + h[d][0], N = F + h[d][1];
|
|
159
|
+
if (!s(p, N)) continue;
|
|
160
|
+
const D = (N * n + p) * 4 + d, q = m + 2 + (d === M ? 0 : 5);
|
|
161
|
+
q < f[D] && (f[D] = q, g[D] = l, (S[q] ??= []).push(D));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const C = { x: e.col + e.cols / 2, y: e.row + e.rows / 2 }, O = { x: r.col + r.cols / 2, y: r.row + r.rows / 2 };
|
|
166
|
+
if (_ < 0) return [C, O];
|
|
167
|
+
const w = [];
|
|
168
|
+
for (let m = _; m >= 0; m = g[m]) {
|
|
169
|
+
const x = m >> 2;
|
|
170
|
+
w.unshift([x % n, Math.floor(x / n)]);
|
|
171
|
+
}
|
|
172
|
+
const A = w[0], T = w[w.length - 1], b = w.filter((m, x) => {
|
|
173
|
+
if (x === 0 || x === w.length - 1) return !0;
|
|
174
|
+
const k = w[x - 1], l = w[x + 1];
|
|
175
|
+
return (m[0] - k[0]) * (l[1] - k[1]) - (m[1] - k[1]) * (l[0] - k[0]) !== 0;
|
|
176
|
+
});
|
|
177
|
+
return [
|
|
178
|
+
c(e, A[0], A[1]),
|
|
179
|
+
...b.map(([m, x]) => ({ x: m + 0.5, y: x + 0.5 })),
|
|
180
|
+
c(r, T[0], T[1])
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
function Vt(t, n) {
|
|
184
|
+
const o = ut(t.children).length, e = Yt(t, n), r = Q - 2 * K - Wt;
|
|
185
|
+
if (!t.children.length) {
|
|
186
|
+
const [i, c] = e[0];
|
|
187
|
+
return dt(t, e[0], 0, i, c, n, st[0]);
|
|
188
|
+
}
|
|
189
|
+
const s = et.flatMap((i, c) => e.map((a, h) => ({ ti: c, size: a, score: c * 2 + h }))).sort((i, c) => i.score - c.score);
|
|
190
|
+
for (const { ti: i, size: c } of s) {
|
|
191
|
+
const a = c[1] + Math.ceil(Math.sqrt(o)) * 14;
|
|
192
|
+
for (const h of st)
|
|
193
|
+
for (const f of [1, 1.3, 1.6, 2]) {
|
|
194
|
+
const g = dt(t, c, i, r, Math.round(a * f), n, h);
|
|
195
|
+
if (g) return g;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return dt(t, e[0], et.length - 1, r, 600, n, st[st.length - 1]);
|
|
199
|
+
}
|
|
200
|
+
function Zn(t, n) {
|
|
201
|
+
const o = n / Q, e = ut(t).sort((f, g) => J(f.entry) - J(g.entry)), r = Math.max(8, Math.round(170 / o)), s = Math.round(96 / o), i = Q - mt - K, c = gt * 2 + e.length * r + Math.max(0, e.length - 1) * s + nt * 2, a = [];
|
|
202
|
+
let h = c - nt * 2;
|
|
203
|
+
for (const f of e) {
|
|
204
|
+
const g = h - r, S = {
|
|
205
|
+
entry: f.entry,
|
|
206
|
+
depth: 0,
|
|
207
|
+
variant: "card",
|
|
208
|
+
col: mt,
|
|
209
|
+
row: g,
|
|
210
|
+
cols: i,
|
|
211
|
+
rows: r,
|
|
212
|
+
x: mt * o,
|
|
213
|
+
y: g * o,
|
|
214
|
+
w: i * o,
|
|
215
|
+
h: r * o,
|
|
216
|
+
anchorSide: "right",
|
|
217
|
+
anchorX: Bt * o,
|
|
218
|
+
anchorY: (g + r / 2) * o,
|
|
219
|
+
date: J(f.entry)
|
|
220
|
+
};
|
|
221
|
+
a.push({
|
|
222
|
+
rootEntry: f.entry,
|
|
223
|
+
side: "right",
|
|
224
|
+
boxes: [S],
|
|
225
|
+
top: S.y,
|
|
226
|
+
cellSide: S.h,
|
|
227
|
+
issueCellX: S.x,
|
|
228
|
+
pathCellX: 0,
|
|
229
|
+
pathCenterX: S.anchorX,
|
|
230
|
+
rowMid: S.anchorY,
|
|
231
|
+
gapAfter: 0,
|
|
232
|
+
spineAnchorX: S.anchorX,
|
|
233
|
+
spineAnchorY: S.anchorY
|
|
234
|
+
}), h = g - s;
|
|
235
|
+
}
|
|
236
|
+
return { rows: a, links: [], blocked: [], budgets: [], cell: o, gridRows: c, totalH: c * o };
|
|
237
|
+
}
|
|
238
|
+
function Qt(t, n) {
|
|
239
|
+
const o = n / Q, e = Q / 2, r = e - K - ot, s = 2, i = 3, c = (C, O, w) => Math.max(O, Math.min(w, Math.ceil(C / at / o) + 2)), h = [...t].sort((C, O) => J(C.entry) - J(O.entry)).map((C) => {
|
|
240
|
+
const O = ut(C.children).sort((M, R) => J(R.entry) - J(M.entry)), w = O.reduce((M, R) => Math.max(M, c(Math.max(R.entry.title.length * G.smallTitle * o * 0.55, 10 * G.smallHead * o * 0.62), 14, r)), 14), A = Math.max(1, Math.min(O.length, Math.floor((r + s) / (w + s)))), T = O.length ? A * w + (A - 1) * s : 0, b = Math.max(C.entry.title.length * G.title * o * 0.55, (C.entry.description ?? "").length * G.desc * o * 0.52 / 2, 10 * o), m = Math.min(r, Math.max(c(b, 16, r), T)), x = lt(C.entry, "card", m, o), k = Array(A).fill(0), l = O.map((M) => {
|
|
241
|
+
const R = lt(M.entry, "small", w, o);
|
|
242
|
+
let F = 0;
|
|
243
|
+
for (let p = 1; p < A; p++) k[p] < k[F] && (F = p);
|
|
244
|
+
const d = k[F];
|
|
245
|
+
return k[F] += R + i, { node: M, rows: R, column: F, offset: d };
|
|
246
|
+
}), $ = x + (O.length ? i + Math.max(...k) - i : 0);
|
|
247
|
+
return { root: C, rootCols: m, rootRows: x, colCols: w, kids: l, height: $ };
|
|
248
|
+
}), f = gt + h.reduce((C, O) => C + O.height, 0) + Math.max(0, h.length - 1) * pt + nt, g = [], S = [];
|
|
249
|
+
let _ = f - nt;
|
|
250
|
+
return h.forEach((C, O) => {
|
|
251
|
+
const w = O % 2 === 0 ? "left" : "right", A = _ - C.height, T = w === "left" ? e - ot : e + ot, b = w === "left" ? T - C.rootCols : T, m = (M, R, F, d, p, N, D) => ({
|
|
252
|
+
entry: M,
|
|
253
|
+
depth: R,
|
|
254
|
+
variant: F,
|
|
255
|
+
col: d,
|
|
256
|
+
row: p,
|
|
257
|
+
cols: N,
|
|
258
|
+
rows: D,
|
|
259
|
+
x: d * o,
|
|
260
|
+
y: p * o,
|
|
261
|
+
w: N * o,
|
|
262
|
+
h: D * o,
|
|
263
|
+
date: J(M)
|
|
264
|
+
}), x = m(C.root.entry, 0, "card", b, A, C.rootCols, C.rootRows);
|
|
265
|
+
x.anchorSide = w, x.anchorX = e * o, x.anchorY = x.y + x.h / 2;
|
|
266
|
+
const k = [x], l = /* @__PURE__ */ new Map(), $ = A + C.rootRows + 3;
|
|
267
|
+
for (const M of C.kids) {
|
|
268
|
+
const R = w === "left" ? T - (M.column + 1) * C.colCols - M.column * s : T + M.column * (C.colCols + s), F = m(M.node.entry, M.node.depth, "small", R, $ + M.offset, C.colCols, M.rows);
|
|
269
|
+
k.push(F);
|
|
270
|
+
const d = F.x + F.w / 2, p = l.get(M.column), N = p ? p.y + p.h : x.y + x.h;
|
|
271
|
+
S.push({
|
|
272
|
+
id: `${C.root.entry.href}->${M.node.entry.href}`,
|
|
273
|
+
d: `M ${d.toFixed(1)} ${N.toFixed(1)} L ${d.toFixed(1)} ${F.y.toFixed(1)}`
|
|
274
|
+
}), l.set(M.column, F);
|
|
275
|
+
}
|
|
276
|
+
g.push({
|
|
277
|
+
rootEntry: C.root.entry,
|
|
278
|
+
side: w,
|
|
279
|
+
boxes: k,
|
|
280
|
+
top: x.y,
|
|
281
|
+
cellSide: x.h,
|
|
282
|
+
issueCellX: x.x,
|
|
283
|
+
pathCellX: 0,
|
|
284
|
+
pathCenterX: x.anchorX,
|
|
285
|
+
rowMid: x.anchorY,
|
|
286
|
+
gapAfter: 0,
|
|
287
|
+
spineAnchorX: x.anchorX,
|
|
288
|
+
spineAnchorY: x.anchorY
|
|
289
|
+
}), _ = A - pt;
|
|
290
|
+
}), { rows: g, links: S, blocked: [], budgets: [], cell: o, gridRows: f, totalH: f * o };
|
|
291
|
+
}
|
|
292
|
+
function Zt(t, n, o) {
|
|
293
|
+
const e = n / Q;
|
|
294
|
+
if (t.length === 0) return { rows: [], links: [], blocked: [], budgets: [], cell: e, gridRows: 0, totalH: 0 };
|
|
295
|
+
if (o === "straight") return Qt(t, n);
|
|
296
|
+
const r = [...t].sort((b, m) => J(b.entry) - J(m.entry)), s = r.length, i = 36e5, c = r.slice(1).map((b, m) => Math.abs(J(b.entry) - J(r[m].entry)) / i), a = c.filter((b) => b > 0), h = a.length ? Math.min(...a) : 1, f = c.map((b) => Jt(b, h)), g = Q - 2 * K, S = f.map((b) => Math.max(pt, Math.ceil(b * 2 * (It / e) ** 2 / g))), _ = r.map((b) => Vt(b, e)), C = gt + _.reduce((b, m) => b + m.height, 0) + S.reduce((b, m) => b + m, 0) + nt, O = [], w = [], A = [];
|
|
297
|
+
let T = C - nt;
|
|
298
|
+
for (let b = 0; b < s; b++) {
|
|
299
|
+
const m = _[b], x = b % 2 === 0 ? "left" : "right", k = T - m.height, l = x === "left" ? K + m.width : Q - K - m.width, $ = (v, I) => x === "left" ? l - v - I : l + v, M = (v) => x === "left" ? l - v : l + v, F = (x === "left" ? l + ot : l - ot) * e, d = m.placed[0], p = (k + d.row + d.rows / 2) * e, N = m.placed.map((v, I) => {
|
|
300
|
+
const L = $(v.col, v.cols), B = k + v.row, u = {
|
|
301
|
+
entry: v.node.entry,
|
|
302
|
+
depth: v.node.depth,
|
|
303
|
+
variant: v.variant,
|
|
304
|
+
col: L,
|
|
305
|
+
row: B,
|
|
306
|
+
cols: v.cols,
|
|
307
|
+
rows: v.rows,
|
|
308
|
+
x: L * e,
|
|
309
|
+
y: B * e,
|
|
310
|
+
w: v.cols * e,
|
|
311
|
+
h: v.rows * e,
|
|
312
|
+
date: J(v.node.entry)
|
|
313
|
+
};
|
|
314
|
+
return I === 0 && (u.anchorSide = x, u.anchorX = F, u.anchorY = p), A.push({ x: u.x - e / 2, y: u.y - e / 2, w: u.w + e, h: u.h + e }), u;
|
|
315
|
+
}), D = N[0], q = x === "left" ? D.x + D.w : F + e, W = x === "left" ? F - e : D.x;
|
|
316
|
+
A.push({ x: q, y: p - e, w: Math.max(0, W - q), h: 2 * e });
|
|
317
|
+
for (const v of m.links) {
|
|
318
|
+
const I = v.points.map((y) => ({ x: M(y.x) * e, y: (k + y.y) * e })), L = I[0], B = I[I.length - 1], u = Math.hypot(B.x - L.x, B.y - L.y);
|
|
319
|
+
if (I.length <= 4 && u < e * 8) {
|
|
320
|
+
const y = (xt(v.id) > 0.5 ? 1 : -1) * u * 0.35, j = (L.x + B.x) / 2 - (B.y - L.y) / (u || 1) * y, H = (L.y + B.y) / 2 + (B.x - L.x) / (u || 1) * y;
|
|
321
|
+
w.push({ id: v.id, d: `M ${L.x.toFixed(1)} ${L.y.toFixed(1)} Q ${j.toFixed(1)} ${H.toFixed(1)}, ${B.x.toFixed(1)} ${B.y.toFixed(1)}` });
|
|
322
|
+
} else w.push({ id: v.id, d: Lt(I) });
|
|
323
|
+
}
|
|
324
|
+
O.push({
|
|
325
|
+
rootEntry: r[b].entry,
|
|
326
|
+
side: x,
|
|
327
|
+
boxes: N,
|
|
328
|
+
top: D.y,
|
|
329
|
+
cellSide: D.h,
|
|
330
|
+
issueCellX: D.x,
|
|
331
|
+
pathCellX: 0,
|
|
332
|
+
pathCenterX: n / 2,
|
|
333
|
+
rowMid: p,
|
|
334
|
+
gapAfter: b < s - 1 ? S[b] * e : 0,
|
|
335
|
+
spineAnchorX: F,
|
|
336
|
+
spineAnchorY: p
|
|
337
|
+
}), T = k - (b < s - 1 ? S[b] : 0);
|
|
338
|
+
}
|
|
339
|
+
return { rows: O, links: w, blocked: A, budgets: f, cell: e, gridRows: C, totalH: C * e };
|
|
340
|
+
}
|
|
341
|
+
function Mt(t, n) {
|
|
342
|
+
const o = [];
|
|
343
|
+
for (const e of t) for (const r of e.boxes)
|
|
344
|
+
r.depth === 0 && o.push(r);
|
|
345
|
+
return o.sort((e, r) => (e.date ?? 0) - (r.date ?? 0)), o.map((e) => ({
|
|
346
|
+
box: e,
|
|
347
|
+
x: e.anchorX ?? e.x,
|
|
348
|
+
y: e.anchorY ?? e.y + e.h / 2,
|
|
349
|
+
side: e.anchorSide === "right" ? -1 : 1,
|
|
350
|
+
date: e.date ?? 0
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
function Kt(t, n, o, e, r, s) {
|
|
354
|
+
let i = s >>> 0;
|
|
355
|
+
const c = () => (i = Math.imul(i, 1664525) + 1013904223 >>> 0, i / 4294967296), a = It, h = Math.max(3, Math.round(o.w / a)), f = Math.max(3, Math.round(o.h / a)), g = o.w / h, S = o.h / f, _ = (u, y) => ({ x: o.x + (u + 0.5) * g, y: o.y + (y + 0.5) * S }), C = (u, y) => u >= 0 && u < h && y >= 0 && y < f, O = new Uint8Array(h * f);
|
|
356
|
+
for (const u of e) {
|
|
357
|
+
const y = Math.max(0, Math.ceil((u.x - g * 0.5 - o.x) / g - 0.5)), j = Math.min(h - 1, Math.floor((u.x + u.w + g * 0.5 - o.x) / g - 0.5)), H = Math.max(0, Math.ceil((u.y - S * 0.5 - o.y) / S - 0.5)), Y = Math.min(f - 1, Math.floor((u.y + u.h + S * 0.5 - o.y) / S - 0.5));
|
|
358
|
+
for (let U = y; U <= j; U++) for (let E = H; E <= Y; E++) O[U * f + E] = 1;
|
|
359
|
+
}
|
|
360
|
+
const w = (u, y) => O[u * f + y] === 1, A = (u, y) => u * f + y, T = new Int32Array(h * f).fill(-1), b = [];
|
|
361
|
+
for (let u = 0; u < h; u++)
|
|
362
|
+
for (let y = 0; y < f; y++)
|
|
363
|
+
(w(u, y) || u === 0 || y === 0 || u === h - 1 || y === f - 1) && (T[A(u, y)] = w(u, y) ? 0 : 1, b.push(A(u, y)));
|
|
364
|
+
for (let u = 0; u < b.length; u++) {
|
|
365
|
+
const y = b[u], j = Math.floor(y / f), H = y % f;
|
|
366
|
+
for (const [Y, U] of [[1, 0], [-1, 0], [0, 1], [0, -1]]) {
|
|
367
|
+
const E = j + Y, P = H + U;
|
|
368
|
+
!C(E, P) || T[A(E, P)] >= 0 || (T[A(E, P)] = T[y] + 1, b.push(A(E, P)));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
let m = 1;
|
|
372
|
+
for (let u = 0; u < T.length; u++) T[u] > m && (m = T[u]);
|
|
373
|
+
const x = (u) => {
|
|
374
|
+
let y = 0, j = 0, H = 1 / 0;
|
|
375
|
+
for (let Y = 0; Y < h; Y++)
|
|
376
|
+
for (let U = 0; U < f; U++) {
|
|
377
|
+
if (w(Y, U)) continue;
|
|
378
|
+
const E = _(Y, U), P = (E.x - u.x) ** 2 + (E.y - u.y) ** 2;
|
|
379
|
+
P < H && (H = P, y = Y, j = U);
|
|
380
|
+
}
|
|
381
|
+
return { c: y, r: j };
|
|
382
|
+
}, k = x(n), l = x(t), $ = (u, y) => u * 1e3 + y;
|
|
383
|
+
let M = 0;
|
|
384
|
+
for (let u = 0; u < h; u++) for (let y = 0; y < f; y++) w(u, y) || M++;
|
|
385
|
+
let R = Math.max(2, Math.min(Math.round(r), Math.floor(M * 0.5)));
|
|
386
|
+
const F = Math.abs(l.c - k.c) + Math.abs(l.r - k.r);
|
|
387
|
+
for (; R > 2 && (R - 1 - F < 0 || (R - 1 - F) % 2 !== 0); ) R--;
|
|
388
|
+
const d = [
|
|
389
|
+
[1, 0],
|
|
390
|
+
[-1, 0],
|
|
391
|
+
[0, 1],
|
|
392
|
+
[0, -1]
|
|
393
|
+
], p = /* @__PURE__ */ new Set();
|
|
394
|
+
let N = 0;
|
|
395
|
+
const D = 1500, q = (u, y, j) => {
|
|
396
|
+
if (N++ > D) return null;
|
|
397
|
+
if (j === R) return u === k.c && y === k.r ? [{ c: u, r: y }] : null;
|
|
398
|
+
if (u === k.c && y === k.r) return null;
|
|
399
|
+
const H = R - j, Y = Math.abs(u - k.c) + Math.abs(y - k.r);
|
|
400
|
+
if (Y > H || (H - Y) % 2 !== 0) return null;
|
|
401
|
+
p.add($(u, y));
|
|
402
|
+
const U = d.map(([E, P]) => [u + E, y + P]).filter(([E, P]) => C(E, P) && !w(E, P) && !p.has($(E, P))).map(([E, P]) => ({ nc: E, nr: P, w: c() - T[A(E, P)] / m })).sort((E, P) => E.w - P.w).map(({ nc: E, nr: P }) => [E, P]);
|
|
403
|
+
for (const [E, P] of U) {
|
|
404
|
+
const z = q(E, P, j + 1);
|
|
405
|
+
if (z)
|
|
406
|
+
return p.delete($(u, y)), [{ c: u, r: y }, ...z];
|
|
407
|
+
}
|
|
408
|
+
return p.delete($(u, y)), null;
|
|
409
|
+
};
|
|
410
|
+
let W = q(l.c, l.r, 1), v = 0;
|
|
411
|
+
for (; !W && R > 2 && v < 5; )
|
|
412
|
+
R -= Math.max(2, 2 * Math.floor(R / 16)), N = 0, p.clear(), W = q(l.c, l.r, 1), v++;
|
|
413
|
+
if (!W) {
|
|
414
|
+
const u = new Int32Array(h * f).fill(-1), y = [A(l.c, l.r)];
|
|
415
|
+
u[y[0]] = y[0];
|
|
416
|
+
for (let j = 0; j < y.length; j++) {
|
|
417
|
+
const H = y[j];
|
|
418
|
+
if (H === A(k.c, k.r)) break;
|
|
419
|
+
const Y = Math.floor(H / f), U = H % f;
|
|
420
|
+
for (const [E, P] of d) {
|
|
421
|
+
const z = Y + E, Z = U + P;
|
|
422
|
+
if (!C(z, Z) || w(z, Z)) continue;
|
|
423
|
+
const ft = A(z, Z);
|
|
424
|
+
u[ft] >= 0 || (u[ft] = H, y.push(ft));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (W = [], u[A(k.c, k.r)] >= 0)
|
|
428
|
+
for (let j = A(k.c, k.r); W.unshift({ c: Math.floor(j / f), r: j % f }), j !== u[j]; j = u[j])
|
|
429
|
+
;
|
|
430
|
+
else W = [{ c: l.c, r: l.r }, { c: k.c, r: k.r }];
|
|
431
|
+
}
|
|
432
|
+
const I = W.map((u) => _(u.c, u.r));
|
|
433
|
+
I[0] = t, I[I.length - 1] = n;
|
|
434
|
+
const L = [I[0]];
|
|
435
|
+
for (let u = 1; u < I.length - 1; u++) {
|
|
436
|
+
const y = I[u - 1], j = I[u], H = I[u + 1], Y = (j.x - y.x) * (H.y - y.y) - (j.y - y.y) * (H.x - y.x);
|
|
437
|
+
Math.abs(Y) > 1e-6 && L.push(j);
|
|
438
|
+
}
|
|
439
|
+
L.push(I[I.length - 1]);
|
|
440
|
+
const B = [L[0]];
|
|
441
|
+
for (let u = 0; u < L.length - 1; u++) {
|
|
442
|
+
const y = L[u], j = L[u + 1];
|
|
443
|
+
B.push({ x: y.x * 0.75 + j.x * 0.25, y: y.y * 0.75 + j.y * 0.25 }), B.push({ x: y.x * 0.25 + j.x * 0.75, y: y.y * 0.25 + j.y * 0.75 });
|
|
444
|
+
}
|
|
445
|
+
return B.push(L[L.length - 1]), B;
|
|
446
|
+
}
|
|
447
|
+
function tn(t, n, o, e) {
|
|
448
|
+
const r = t.rows;
|
|
449
|
+
if (!r.length || n <= 0 || o <= 0) return "";
|
|
450
|
+
const s = Mt(r);
|
|
451
|
+
if (s.length === 0) return "";
|
|
452
|
+
if (e) {
|
|
453
|
+
const l = s[0].x, $ = s[s.length - 1], M = Math.max(40, $.y - 92) - 8, R = n / 2, F = s[0].y, d = (o - F) * 0.5;
|
|
454
|
+
return `M ${R.toFixed(2)} ${o.toFixed(2)} C ${R.toFixed(2)} ${(o - d).toFixed(2)}, ${l.toFixed(2)} ${(F + d).toFixed(2)}, ${l.toFixed(2)} ${F.toFixed(2)} L ${l.toFixed(2)} ${M.toFixed(2)}`;
|
|
455
|
+
}
|
|
456
|
+
const i = 36e5;
|
|
457
|
+
let c = 1 / 0;
|
|
458
|
+
for (let l = 0; l < s.length - 1; l++) {
|
|
459
|
+
const $ = Math.abs((s[l + 1].date ?? 0) - (s[l].date ?? 0)) / i;
|
|
460
|
+
$ > 0 && $ < c && (c = $);
|
|
461
|
+
}
|
|
462
|
+
Number.isFinite(c) || (c = 1);
|
|
463
|
+
const a = 9, h = 1.5, f = [];
|
|
464
|
+
for (let l = 0; l < s.length - 1; l++) {
|
|
465
|
+
const $ = s[l], M = s[l + 1], R = Math.abs((M.date ?? 0) - ($.date ?? 0)) / i, d = { x: 0, y: Math.min($.y, M.y), w: n, h: Math.abs($.y - M.y) }, p = Math.max(a, Math.round(h * a * (R / c))), N = 1013904223 + l * 2654435761 >>> 0;
|
|
466
|
+
f.push(Kt({ x: $.x, y: $.y }, { x: M.x, y: M.y }, d, t.blocked, p, N));
|
|
467
|
+
}
|
|
468
|
+
const g = (l, $) => Math.hypot(l.x - $.x, l.y - $.y), S = (l, $, M) => ({ x: l.x + ($.x - l.x) * M, y: l.y + ($.y - l.y) * M }), _ = (l) => {
|
|
469
|
+
let $ = 0;
|
|
470
|
+
for (let M = 1; M < l.length; M++) $ += g(l[M], l[M - 1]);
|
|
471
|
+
return $;
|
|
472
|
+
}, C = (l, $, M) => {
|
|
473
|
+
if (l.length < 2) return { pt: l[0], idx: 0 };
|
|
474
|
+
if ($) {
|
|
475
|
+
let F = 0;
|
|
476
|
+
for (let d = 1; d < l.length; d++) {
|
|
477
|
+
const p = g(l[d], l[d - 1]);
|
|
478
|
+
if (F + p >= M) return { pt: S(l[d - 1], l[d], p ? (M - F) / p : 0), idx: d };
|
|
479
|
+
F += p;
|
|
480
|
+
}
|
|
481
|
+
return { pt: l[l.length - 1], idx: l.length - 1 };
|
|
482
|
+
}
|
|
483
|
+
let R = 0;
|
|
484
|
+
for (let F = l.length - 2; F >= 0; F--) {
|
|
485
|
+
const d = g(l[F + 1], l[F]);
|
|
486
|
+
if (R + d >= M) return { pt: S(l[F + 1], l[F], d ? (M - R) / d : 0), idx: F };
|
|
487
|
+
R += d;
|
|
488
|
+
}
|
|
489
|
+
return { pt: l[0], idx: 0 };
|
|
490
|
+
}, O = f.map(_), w = 34, A = Math.cos(75 * Math.PI / 180), T = (l) => Math.min(w, Math.max(6, O[l] * 0.42)), b = { x: n / 2, y: o }, m = [];
|
|
491
|
+
m.push(b);
|
|
492
|
+
const x = s.length;
|
|
493
|
+
for (let l = 0; l < x; l++) {
|
|
494
|
+
const $ = { x: s[l].x, y: s[l].y }, M = l > 0 ? T(l - 1) : Math.min(w, g($, b) * 0.4), R = l < x - 1 ? T(l) : 40, F = { x: $.x, y: $.y + M }, d = { x: $.x, y: $.y - R };
|
|
495
|
+
if (m.push(F, $, d), l < x - 1) {
|
|
496
|
+
const p = f[l], N = s[l + 1], D = { x: N.x, y: N.y + T(l) }, q = (I, L, B) => {
|
|
497
|
+
const u = L.x - I.x, y = L.y - I.y, j = Math.hypot(u, y);
|
|
498
|
+
return j > 0 && y * B / j < A;
|
|
499
|
+
};
|
|
500
|
+
let W = C(p, !0, T(l)).idx, v = C(p, !1, T(l)).idx;
|
|
501
|
+
for (let I = 0; I < 6 && W < v && q(d, p[W], -1); I++) W++;
|
|
502
|
+
for (let I = 0; I < 6 && v > W && q(p[v], D, -1); I++) v--;
|
|
503
|
+
for (let I = W; I <= v; I++) m.push(f[l][I]);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
const k = s[x - 1];
|
|
507
|
+
return m.push({ x: k.x, y: Math.max(40, k.y - 92) - 8 }), Lt(m);
|
|
508
|
+
}
|
|
509
|
+
function Kn(t, n) {
|
|
510
|
+
const o = Mt(t);
|
|
511
|
+
return o.length === 0 ? [] : o.map((e) => {
|
|
512
|
+
const r = e.box, s = e.side === 1 ? r.x + r.w : r.x, i = e.y, c = `M ${s.toFixed(1)} ${i.toFixed(1)} L ${e.x.toFixed(1)} ${e.y.toFixed(1)}`;
|
|
513
|
+
return { id: r.entry.href + ":conn", d: c, cx: e.x, cy: e.y };
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function Lt(t) {
|
|
517
|
+
const n = [];
|
|
518
|
+
for (const s of t) {
|
|
519
|
+
const i = n[n.length - 1];
|
|
520
|
+
(!i || Math.hypot(s.x - i.x, s.y - i.y) > 1) && n.push(s);
|
|
521
|
+
}
|
|
522
|
+
const o = n.length;
|
|
523
|
+
if (o < 2) return o === 1 ? `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}` : "";
|
|
524
|
+
const e = 0.5;
|
|
525
|
+
let r = `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)} `;
|
|
526
|
+
for (let s = 0; s < o - 1; s++) {
|
|
527
|
+
const i = n[Math.max(0, s - 1)], c = n[s], a = n[s + 1], h = n[Math.min(o - 1, s + 2)], f = Math.pow(Math.hypot(c.x - i.x, c.y - i.y), e) || 1, g = Math.pow(Math.hypot(a.x - c.x, a.y - c.y), e) || 1, S = Math.pow(Math.hypot(h.x - a.x, h.y - a.y), e) || 1, _ = c.x + (a.x - i.x) * g / (3 * (f + g)), C = c.y + (a.y - i.y) * g / (3 * (f + g)), O = a.x - (h.x - c.x) * g / (3 * (g + S)), w = a.y - (h.y - c.y) * g / (3 * (g + S));
|
|
528
|
+
r += `C ${_.toFixed(2)} ${C.toFixed(2)}, ${O.toFixed(2)} ${w.toFixed(2)}, ${a.x.toFixed(2)} ${a.y.toFixed(2)} `;
|
|
529
|
+
}
|
|
530
|
+
return r;
|
|
531
|
+
}
|
|
532
|
+
function ut(t) {
|
|
533
|
+
const n = [];
|
|
534
|
+
function o(e) {
|
|
535
|
+
n.push(e), e.children.forEach(o);
|
|
536
|
+
}
|
|
537
|
+
return t.forEach(o), n;
|
|
538
|
+
}
|
|
539
|
+
const wt = 12;
|
|
540
|
+
function $t(t, n) {
|
|
541
|
+
return t.replace(/-?\d+(?:\.\d+)?(?:e-?\d+)?/g, (o) => (Number(o) * n).toFixed(2));
|
|
542
|
+
}
|
|
543
|
+
function nn(t) {
|
|
544
|
+
const n = t.match(/[MLQC]|-?\d+(?:\.\d+)?(?:e-?\d+)?/g) ?? [], o = [];
|
|
545
|
+
let e = 0, r = 0, s = 0, i = 0;
|
|
546
|
+
const c = () => Number(n[e++]), a = (h, f) => {
|
|
547
|
+
o.length && (i += Math.hypot(h - r, f - s)), o.push({ x: h, y: f, len: i }), r = h, s = f;
|
|
548
|
+
};
|
|
549
|
+
for (; e < n.length; ) {
|
|
550
|
+
const h = n[e++];
|
|
551
|
+
if (h === "M" || h === "L") a(c(), c());
|
|
552
|
+
else if (h === "Q") {
|
|
553
|
+
const [f, g, S, _] = [c(), c(), c(), c()], [C, O] = [r, s];
|
|
554
|
+
for (let w = 1; w <= 16; w++) {
|
|
555
|
+
const A = w / 16, T = 1 - A;
|
|
556
|
+
a(T * T * C + 2 * T * A * f + A * A * S, T * T * O + 2 * T * A * g + A * A * _);
|
|
557
|
+
}
|
|
558
|
+
} else if (h === "C") {
|
|
559
|
+
const [f, g, S, _, C, O] = [c(), c(), c(), c(), c(), c()], [w, A] = [r, s];
|
|
560
|
+
for (let T = 1; T <= 16; T++) {
|
|
561
|
+
const b = T / 16, m = 1 - b;
|
|
562
|
+
a(
|
|
563
|
+
m * m * m * w + 3 * m * m * b * f + 3 * m * b * b * S + b * b * b * C,
|
|
564
|
+
m * m * m * A + 3 * m * m * b * g + 3 * m * b * b * _ + b * b * b * O
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return o;
|
|
570
|
+
}
|
|
571
|
+
function on(t, n) {
|
|
572
|
+
const o = nn(t), e = [];
|
|
573
|
+
let r = 0;
|
|
574
|
+
for (const s of n) {
|
|
575
|
+
let i = r, c = 1 / 0;
|
|
576
|
+
for (let a = r; a < o.length; a++) {
|
|
577
|
+
const h = (o[a].x - s.x) ** 2 + (o[a].y - s.y) ** 2;
|
|
578
|
+
h < c && (c = h, i = a);
|
|
579
|
+
}
|
|
580
|
+
e.push(o[i]?.len ?? 0), r = i;
|
|
581
|
+
}
|
|
582
|
+
return e;
|
|
583
|
+
}
|
|
584
|
+
function Ct(t, n) {
|
|
585
|
+
const o = Q * wt, e = Zt(Gt(t), o, n), r = tn(e, o, e.totalH, n === "straight"), s = Mt(e.rows), i = 1 / wt;
|
|
586
|
+
return {
|
|
587
|
+
gridRows: e.gridRows,
|
|
588
|
+
rows: e.rows.map((c) => ({
|
|
589
|
+
href: c.rootEntry.href,
|
|
590
|
+
side: c.side,
|
|
591
|
+
boxes: c.boxes.map((a) => ({
|
|
592
|
+
href: a.entry.href,
|
|
593
|
+
depth: a.depth,
|
|
594
|
+
variant: a.variant,
|
|
595
|
+
col: a.col,
|
|
596
|
+
row: a.row,
|
|
597
|
+
cols: a.cols,
|
|
598
|
+
rows: a.rows,
|
|
599
|
+
...a.anchorSide ? { anchorSide: a.anchorSide, anchorX: (a.anchorX ?? 0) * i, anchorY: (a.anchorY ?? 0) * i } : {}
|
|
600
|
+
}))
|
|
601
|
+
})),
|
|
602
|
+
links: e.links.map((c) => ({ id: c.id, d: $t(c.d, i) })),
|
|
603
|
+
spine: $t(r, i),
|
|
604
|
+
anchorLens: on(r, s).map((c) => c * i)
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
function to(t) {
|
|
608
|
+
return { organic: Ct(t, "organic"), straight: Ct(t, "straight") };
|
|
609
|
+
}
|
|
610
|
+
const en = ["Luke Skywalker", "Leia Organa", "Han Solo", "Obi-Wan Kenobi", "Ahsoka Tano", "Lando Calrissian", "Din Djarin", "Padmé Amidala"], jt = ["Luke", "Leia", "Han", "Ahsoka", "Din", "Padmé", "Lando", "Obi-Wan"], rn = ["Skywalker", "Organa", "Solo", "Kenobi", "Tano", "Calrissian", "Amidala", "Djarin"], sn = ["Tatooine", "Coruscant", "Endor", "Hoth", "Naboo", "Dagobah", "Mos Eisley", "Bespin"], _t = ["Millennium Falcon", "X-Wing", "Razor Crest", "Lightsaber", "Holocron", "Beskar Ingot", "Astromech Droid", "Sarlacc Pit"], tt = [
|
|
611
|
+
"Bantha fodder drifts across the dune sea beyond Mos Eisley.",
|
|
612
|
+
"A hyperdrive hums softly as the freighter clears the asteroid field.",
|
|
613
|
+
"Womp rats scatter when the landspeeder skims Beggar’s Canyon.",
|
|
614
|
+
"The council convened on Coruscant to debate the blockade of Naboo.",
|
|
615
|
+
"Moisture vaporators line the ridge above the homestead on Tatooine.",
|
|
616
|
+
"A protocol droid recites etiquette while the astromech beeps in protest.",
|
|
617
|
+
"Snow swirls over the shield generator on the plains of Hoth.",
|
|
618
|
+
"The cantina band strikes up as smugglers haggle over spice."
|
|
619
|
+
], V = ["bantha", "kyber", "hyperdrive", "womp-rat", "sabacc", "holocron", "beskar", "porg"], cn = ["leia.organa@rebellion.org", "luke.skywalker@jedi.temple", "han.solo@falcon.crew", "ahsoka.tano@fulcrum.net"], an = ["#ffe81f", "#2e67f8", "#e5484d", "#30a46c", "#8a63d2"];
|
|
620
|
+
function Et(t) {
|
|
621
|
+
let n = 0;
|
|
622
|
+
for (let o = 0; o < t.length; o++) n = n * 31 + t.charCodeAt(o) >>> 0;
|
|
623
|
+
return n;
|
|
624
|
+
}
|
|
625
|
+
function X(t, n = 0) {
|
|
626
|
+
return t[(Et(String(n)) + n) % t.length];
|
|
627
|
+
}
|
|
628
|
+
function ln(t) {
|
|
629
|
+
return !!t && typeof t == "object" && typeof t.__nimpressFn == "string";
|
|
630
|
+
}
|
|
631
|
+
function bt(t) {
|
|
632
|
+
return `(...args) => {
|
|
633
|
+
console.log(${JSON.stringify(t || "handler")}, ...args)
|
|
634
|
+
}`;
|
|
635
|
+
}
|
|
636
|
+
const un = (t = 0) => X(en, t), fn = (t = 0) => X(jt, t), mn = (t = 0) => X(rn, t), dn = (t = 0) => `${X(jt, t).toLowerCase()}_${X(V, t + 1)}`, hn = (t = 0) => X(cn, t), yn = (t = 0) => `${X(V, t)}-${X(_t, t + 1).replace(/\s+/g, "")}`, Nt = (t = 0) => X(V, t), pn = (t = 0) => X(_t, t), kt = (t = 0) => X(tt, t), xn = (t = 0) => `${X(tt, t)} ${X(tt, t + 1)} ${X(tt, t + 2)}`, kn = (t = 0) => X(sn, t), gn = (t = 0) => `https://holonet.example/${X(V, t)}`, Mn = (t = 0) => `https://holonet.example/${X(V, t)}.png`, bn = (t = 0) => X(an, t), wn = () => "pi pi-star", $n = () => "1977-05-25", Cn = () => "09:41", Sn = () => "+47 555 01138", An = (t = 0) => `${X(V, t)}-1138`, Fn = (t = 0) => X(V, t), Tn = (t = 0) => ({
|
|
637
|
+
[X(V, t)]: X(tt, t),
|
|
638
|
+
[X(V, t + 3)]: X(tt, t + 3)
|
|
639
|
+
}), vn = (t = 0) => [X(V, t), X(V, t + 3)], On = () => !0, Rn = () => 42, In = () => 0, Ln = () => 1.618, jn = () => 7, _n = () => 66, En = () => 320, Nn = () => 240, Pn = () => 199, Xn = () => 1977, Dn = () => 29, Wn = (t = [], n = 0, o = []) => {
|
|
640
|
+
const e = t.filter((r) => !o.includes(r));
|
|
641
|
+
return e.length ? e[(Et(String(n)) + n) % e.length] : void 0;
|
|
642
|
+
}, Pt = (t = "handler") => ({
|
|
643
|
+
__nimpressFn: bt(t)
|
|
644
|
+
}), qn = (t = "event") => Pt(t), Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
645
|
+
__proto__: null,
|
|
646
|
+
fnSource: bt,
|
|
647
|
+
isFnValue: ln,
|
|
648
|
+
mockAge: Dn,
|
|
649
|
+
mockArray: vn,
|
|
650
|
+
mockBoolean: On,
|
|
651
|
+
mockColor: bn,
|
|
652
|
+
mockCount: jn,
|
|
653
|
+
mockDate: $n,
|
|
654
|
+
mockEmail: hn,
|
|
655
|
+
mockEvent: qn,
|
|
656
|
+
mockFamilyName: mn,
|
|
657
|
+
mockFirstName: fn,
|
|
658
|
+
mockFloat: Ln,
|
|
659
|
+
mockFullName: un,
|
|
660
|
+
mockFunction: Pt,
|
|
661
|
+
mockHeight: Nn,
|
|
662
|
+
mockIcon: wn,
|
|
663
|
+
mockId: An,
|
|
664
|
+
mockImageUrl: Mn,
|
|
665
|
+
mockIndex: In,
|
|
666
|
+
mockInt: Rn,
|
|
667
|
+
mockObject: Tn,
|
|
668
|
+
mockOption: Wn,
|
|
669
|
+
mockParagraph: xn,
|
|
670
|
+
mockPassword: yn,
|
|
671
|
+
mockPercent: _n,
|
|
672
|
+
mockPhone: Sn,
|
|
673
|
+
mockPlace: kn,
|
|
674
|
+
mockPrice: Pn,
|
|
675
|
+
mockSentence: kt,
|
|
676
|
+
mockSlug: Fn,
|
|
677
|
+
mockTime: Cn,
|
|
678
|
+
mockTitle: pn,
|
|
679
|
+
mockUrl: gn,
|
|
680
|
+
mockUsername: dn,
|
|
681
|
+
mockWidth: En,
|
|
682
|
+
mockWord: Nt,
|
|
683
|
+
mockYear: Xn
|
|
684
|
+
}, Symbol.toStringTag, { value: "Module" })), ht = 12;
|
|
685
|
+
function Bn(t) {
|
|
686
|
+
const n = {}, o = (f, g) => {
|
|
687
|
+
const S = t.match(new RegExp(`@${f}\\s+(-?[0-9.]+)`));
|
|
688
|
+
S && (n[g] = Number(S[1]));
|
|
689
|
+
};
|
|
690
|
+
o("minimum", "minimum"), o("maximum", "maximum"), o("exclusiveMinimum", "exclusiveMinimum"), o("exclusiveMaximum", "exclusiveMaximum"), o("multipleOf", "multipleOf"), o("minLength", "minLength"), o("maxLength", "maxLength"), o("minItems", "minItems"), o("maxItems", "maxItems");
|
|
691
|
+
const e = (f) => {
|
|
692
|
+
try {
|
|
693
|
+
return JSON.parse(f);
|
|
694
|
+
} catch {
|
|
695
|
+
return f;
|
|
696
|
+
}
|
|
697
|
+
}, r = t.match(/@pattern\s+(.+)/);
|
|
698
|
+
r && (n.pattern = r[1].trim());
|
|
699
|
+
const s = t.match(/@format\s+(\S+)/);
|
|
700
|
+
s && (n.format = s[1]);
|
|
701
|
+
const i = t.match(/@default\s+(.+)/);
|
|
702
|
+
i && (n.default = e(i[1].trim()));
|
|
703
|
+
const c = [...t.matchAll(/@examples?\s+(.+)/g)].map((f) => e(f[1].trim()));
|
|
704
|
+
c.length && (n.examples = c), /@deprecated\b/.test(t) && (n.deprecated = !0), /@readonly\b|@readOnly\b/.test(t) && (n.readOnly = !0), /@uniqueItems\b/.test(t) && (n.uniqueItems = !0);
|
|
705
|
+
const a = t.replace(/^\s*@\w+.*$/gm, "").trim(), h = t.match(/@mock\s+(\w+)/)?.[1];
|
|
706
|
+
return { description: a, annotations: n, mock: h };
|
|
707
|
+
}
|
|
708
|
+
function St(t) {
|
|
709
|
+
let n, o, e, r = t;
|
|
710
|
+
for (; ; ) {
|
|
711
|
+
const s = r.match(/^\/\*\*?([\s\S]*?)\*\/\s*/);
|
|
712
|
+
if (s) {
|
|
713
|
+
const c = s[1].replace(/^\s*\*\s?/gm, "").trim(), a = Bn(c);
|
|
714
|
+
n = a.description || void 0, Object.keys(a.annotations).length && (o = a.annotations), e = a.mock, r = r.slice(s[0].length);
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
const i = r.match(/^\/\/\s*([^\n]*)(?:\n\s*|$)/);
|
|
718
|
+
if (i) {
|
|
719
|
+
n = i[1].trim(), r = r.slice(i[0].length);
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
return { description: n, annotations: o, mock: e, member: r };
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function Gn(t) {
|
|
726
|
+
const n = [];
|
|
727
|
+
let o = 0, e = "", r = "";
|
|
728
|
+
const s = () => {
|
|
729
|
+
const a = e.trim();
|
|
730
|
+
if (e = "", !a) return;
|
|
731
|
+
const { description: h, annotations: f, mock: g, member: S } = St(a), _ = S.match(/^(?:readonly\s+)?([A-Za-z_$][\w$]*)(\?)?\s*:\s*([\s\S]+)$/);
|
|
732
|
+
_ && n.push({ name: _[1], optional: _[2] === "?", type: _[3].trim(), description: h, annotations: f, mock: g });
|
|
733
|
+
};
|
|
734
|
+
let i = !1;
|
|
735
|
+
const c = [...t];
|
|
736
|
+
for (let a = 0; a < c.length; a++) {
|
|
737
|
+
const h = c[a];
|
|
738
|
+
if (!i && h === "/" && c[a + 1] === "*" && (i = !0), i && h === "/" && c[a - 1] === "*" && (i = !1), !i) {
|
|
739
|
+
if (h === "{" || h === "(" || h === "[" ? o++ : h === "}" || h === ")" || h === "]" ? o-- : h === "<" && r !== "=" ? o++ : h === ">" && r !== "=" && o--, (h === ";" || h === ",") && o === 0) {
|
|
740
|
+
s(), r = h;
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
if (h === `
|
|
744
|
+
` && o === 0) {
|
|
745
|
+
if (St(e.trim()).member === "") {
|
|
746
|
+
e += h, r = h;
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
s(), r = h;
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
e += h, r = h;
|
|
754
|
+
}
|
|
755
|
+
return s(), n;
|
|
756
|
+
}
|
|
757
|
+
function no(t) {
|
|
758
|
+
const n = [];
|
|
759
|
+
let o = 0, e = "";
|
|
760
|
+
for (const r of t) {
|
|
761
|
+
if (r === "{" || r === "(" || r === "[" ? o++ : (r === "}" || r === ")" || r === "]") && o--, r === "," && o === 0) {
|
|
762
|
+
e.trim() && n.push(e.trim()), e = "";
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
e += r;
|
|
766
|
+
}
|
|
767
|
+
return e.trim() && n.push(e.trim()), n;
|
|
768
|
+
}
|
|
769
|
+
function At(t) {
|
|
770
|
+
const n = [];
|
|
771
|
+
let o = 0, e = "", r = "";
|
|
772
|
+
for (const s of t) {
|
|
773
|
+
if (s === "{" || s === "(" || s === "[" ? o++ : s === "}" || s === ")" || s === "]" ? o-- : s === "<" && r !== "=" ? o++ : s === ">" && r !== "=" && o--, s === "|" && o === 0) {
|
|
774
|
+
e.trim() && n.push(e.trim()), e = "", r = s;
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
e += s, r = s;
|
|
778
|
+
}
|
|
779
|
+
return e.trim() && n.push(e.trim()), n.filter((s) => s !== "undefined" && s !== "null");
|
|
780
|
+
}
|
|
781
|
+
function Ft(t) {
|
|
782
|
+
const n = t.split("|").map((e) => e.trim()).filter((e) => e !== "" && e !== "undefined" && e !== "null");
|
|
783
|
+
if (!n.length) return null;
|
|
784
|
+
const o = [];
|
|
785
|
+
for (const e of n) {
|
|
786
|
+
const r = e.match(/^['"]([^'"]*)['"]$/);
|
|
787
|
+
if (!r) return null;
|
|
788
|
+
o.push(r[1]);
|
|
789
|
+
}
|
|
790
|
+
return o;
|
|
791
|
+
}
|
|
792
|
+
function Tt(t, n) {
|
|
793
|
+
const o = t.trim();
|
|
794
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(o)) return t;
|
|
795
|
+
const e = new RegExp(`(?:export\\s+)?type\\s+${o}\\s*=\\s*([^\\n;]*(?:\\n\\s*\\|[^\\n;]+)*)`), s = n.match(e)?.[1]?.replace(/\s+/g, " ").trim();
|
|
796
|
+
return s || t;
|
|
797
|
+
}
|
|
798
|
+
function Xt(t) {
|
|
799
|
+
return `{ ${t.map((o) => `${o.name}${o.required ? "" : "?"}: ${o.shape ?? o.type}`).join("; ")} }`;
|
|
800
|
+
}
|
|
801
|
+
function Yn(t) {
|
|
802
|
+
if (t.format) return t.format;
|
|
803
|
+
if (t.kind !== "text" && t.kind !== "slot") return;
|
|
804
|
+
const n = `${t.name} ${t.description ?? ""}`.toLowerCase();
|
|
805
|
+
if (/email/.test(n)) return "email";
|
|
806
|
+
if (/url|href|link|website/.test(n)) return "uri";
|
|
807
|
+
if (/date-time|datetime|timestamp/.test(n)) return "date-time";
|
|
808
|
+
if (/date/.test(t.name.toLowerCase()) || /\bdates?\b/.test((t.description ?? "").toLowerCase())) return "date";
|
|
809
|
+
if (/uuid/.test(n)) return "uuid";
|
|
810
|
+
}
|
|
811
|
+
function Dt(t, n) {
|
|
812
|
+
const o = t.toLowerCase(), e = n.type, r = typeof n.format == "string" ? n.format : void 0;
|
|
813
|
+
if (n.enum) return "mockOption";
|
|
814
|
+
if (e === "boolean") return "mockBoolean";
|
|
815
|
+
if (e === "number" || e === "integer")
|
|
816
|
+
return /index|offset|position/.test(o) ? "mockIndex" : /count|total|amount|quantity/.test(o) ? "mockCount" : /percent|progress|opacity/.test(o) ? "mockPercent" : /width/.test(o) ? "mockWidth" : /height/.test(o) ? "mockHeight" : /price|cost/.test(o) ? "mockPrice" : /year/.test(o) ? "mockYear" : /^age$|(^|[^a-z])age$/.test(o) ? "mockAge" : e === "integer" ? "mockInt" : "mockFloat";
|
|
817
|
+
if (e === "string")
|
|
818
|
+
return r === "email" || /email/.test(o) ? "mockEmail" : /password/.test(o) ? "mockPassword" : /image|avatar|photo|thumbnail|poster|banner|logo|cover/.test(o) ? "mockImageUrl" : r === "uri" || /url|href|link/.test(o) ? "mockUrl" : r === "date" || r === "date-time" || /date/.test(o) ? "mockDate" : r === "uuid" || /uuid|slug/.test(o) ? "mockId" : /color|colour/.test(o) ? "mockColor" : /icon/.test(o) ? "mockIcon" : /username|handle|login/.test(o) ? "mockUsername" : /firstname|first_name/.test(o) ? "mockFirstName" : /lastname|last_name|surname|familyname|family_name/.test(o) ? "mockFamilyName" : /name/.test(o) ? "mockFullName" : /title|label|heading|headline/.test(o) ? "mockTitle" : /description|content|detail|body|paragraph|message|caption|subtitle|placeholder|text|summary/.test(o) ? "mockSentence" : "mockWord";
|
|
819
|
+
if (e === "object") return "mockObject";
|
|
820
|
+
if (e === "array") return "mockArray";
|
|
821
|
+
const s = typeof n.tsType == "string" ? n.tsType : "";
|
|
822
|
+
return s.includes("=>") ? "mockEvent" : s.endsWith("[]") || s.startsWith("Array<") ? "mockArray" : s && s !== "unknown" ? "mockObject" : "mockWord";
|
|
823
|
+
}
|
|
824
|
+
function ct(t) {
|
|
825
|
+
const n = {};
|
|
826
|
+
if (t.description && (n.description = t.description), t.default !== void 0 && (n.default = t.default), t.kind === "select") n.enum = t.options ?? [];
|
|
827
|
+
else if (t.kind === "boolean") n.type = "boolean";
|
|
828
|
+
else if (t.kind === "number") n.type = "number";
|
|
829
|
+
else if (t.kind === "text" || t.kind === "slot") {
|
|
830
|
+
n.type = "string";
|
|
831
|
+
const o = Yn(t);
|
|
832
|
+
o && (n.format = o);
|
|
833
|
+
} else if (t.kind === "array")
|
|
834
|
+
n.type = "array", n.items = t.item ? ct(t.item) : {};
|
|
835
|
+
else if (t.kind === "record")
|
|
836
|
+
n.type = "object", n.additionalProperties = t.item ? ct(t.item) : {};
|
|
837
|
+
else if (t.kind === "object") {
|
|
838
|
+
n.type = "object", n.properties = Object.fromEntries((t.members ?? []).map((e) => [e.name, ct(e)]));
|
|
839
|
+
const o = (t.members ?? []).filter((e) => e.required).map((e) => e.name);
|
|
840
|
+
o.length && (n.required = o);
|
|
841
|
+
} else
|
|
842
|
+
n.tsType = t.type;
|
|
843
|
+
t.bindable && (n.bindable = !0);
|
|
844
|
+
for (const [o, e] of Object.entries(t.annotations ?? {}))
|
|
845
|
+
o in n || (n[o] = e);
|
|
846
|
+
return n;
|
|
847
|
+
}
|
|
848
|
+
function oo(t, n) {
|
|
849
|
+
return n.mock && !t.mock && (t.mock = n.mock), n.annotations && (t.annotations = n.annotations, typeof n.annotations.format == "string" && (t.format = n.annotations.format), n.annotations.default !== void 0 && t.default === void 0 && (t.default = n.annotations.default)), t;
|
|
850
|
+
}
|
|
851
|
+
function vt(t, n) {
|
|
852
|
+
const o = ct(n), e = n.mock ?? (n.kind === "function" || n.kind === "event" ? "mockEvent" : Dt(t, o));
|
|
853
|
+
return { ...o, mock: e };
|
|
854
|
+
}
|
|
855
|
+
function eo(t, n, o = [], e = []) {
|
|
856
|
+
return {
|
|
857
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
858
|
+
title: t,
|
|
859
|
+
type: "object",
|
|
860
|
+
properties: Object.fromEntries(n.map((r) => [r.name, vt(r.name, r)])),
|
|
861
|
+
required: n.filter((r) => r.required).map((r) => r.name),
|
|
862
|
+
slots: Object.fromEntries(o.map((r) => [r.name, vt(r.name, r)])),
|
|
863
|
+
emits: e
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
function Un(t) {
|
|
867
|
+
return t === "array" || t.endsWith("[]") || t.startsWith("Array<") ? "mockArray" : /\bDate\b/.test(t) ? "mockDate" : t === "unknown" ? "mockWord" : "mockObject";
|
|
868
|
+
}
|
|
869
|
+
function it(t, n = 0, o = []) {
|
|
870
|
+
if (t.kind === "function" || t.kind === "event") return { __nimpressFn: bt(t.name) };
|
|
871
|
+
if (t.default !== void 0 && t.kind !== "object" && t.kind !== "array" && t.kind !== "record") {
|
|
872
|
+
const i = t.default;
|
|
873
|
+
return typeof i == "object" && i !== null ? JSON.parse(JSON.stringify(i)) : i;
|
|
874
|
+
}
|
|
875
|
+
if (t.kind === "object") {
|
|
876
|
+
const i = {};
|
|
877
|
+
for (const c of t.members ?? []) {
|
|
878
|
+
const a = it(c, n);
|
|
879
|
+
a !== void 0 && (i[c.name] = a);
|
|
880
|
+
}
|
|
881
|
+
return Object.keys(i).length ? i : void 0;
|
|
882
|
+
}
|
|
883
|
+
if (t.kind === "array") {
|
|
884
|
+
if (!t.item) return;
|
|
885
|
+
const i = t.item.kind === "number" && !t.item.annotations && t.annotations ? { ...t.item, annotations: t.annotations } : t.item, c = it(i, n, o);
|
|
886
|
+
if (c === void 0) return;
|
|
887
|
+
const a = it(i, n + 1, [...o, c]);
|
|
888
|
+
return a === void 0 ? [c] : [c, a];
|
|
889
|
+
}
|
|
890
|
+
if (t.kind === "record") {
|
|
891
|
+
const i = {};
|
|
892
|
+
for (let c = 0; c < 2; c++) {
|
|
893
|
+
const a = Nt(n + c);
|
|
894
|
+
i[a] = t.item ? it(t.item, n + c) ?? kt(n + c) : kt(n + c);
|
|
895
|
+
}
|
|
896
|
+
return i;
|
|
897
|
+
}
|
|
898
|
+
const e = t.mock ?? (t.kind === "select" ? "mockOption" : t.kind === "json" ? Un(t.type) : Dt(t.name, {
|
|
899
|
+
type: t.kind === "boolean" ? "boolean" : t.kind === "number" ? "number" : "string",
|
|
900
|
+
format: t.format
|
|
901
|
+
})), r = Hn[e];
|
|
902
|
+
if (typeof r != "function") return;
|
|
903
|
+
if (e === "mockOption") return r(t.options ?? [], n, o);
|
|
904
|
+
const s = r(n);
|
|
905
|
+
if (t.kind === "number" && typeof s == "number") {
|
|
906
|
+
const i = typeof t.annotations?.minimum == "number" ? t.annotations.minimum : void 0, c = typeof t.annotations?.maximum == "number" ? t.annotations.maximum : void 0;
|
|
907
|
+
if (i !== void 0 && c !== void 0) {
|
|
908
|
+
const a = n * 37 % 100 / 100;
|
|
909
|
+
return Math.round((i + (c - i) * (a || 0.5)) * 1e3) / 1e3;
|
|
910
|
+
}
|
|
911
|
+
if (i !== void 0) return Math.max(i, s);
|
|
912
|
+
if (c !== void 0) return Math.min(c, s);
|
|
913
|
+
}
|
|
914
|
+
return s;
|
|
915
|
+
}
|
|
916
|
+
function ro(t, n) {
|
|
917
|
+
const o = new Set(n.required ?? []), e = Object.entries(n.properties ?? {}).map(
|
|
918
|
+
([i, c]) => rt(i, c, o.has(i))
|
|
919
|
+
), r = Object.entries(n.slots ?? {}).map(([i, c]) => ({
|
|
920
|
+
...rt(i, c),
|
|
921
|
+
kind: "slot"
|
|
922
|
+
})), s = Array.isArray(n.emits) ? n.emits : [];
|
|
923
|
+
return { component: t, props: e, slots: r, emits: s };
|
|
924
|
+
}
|
|
925
|
+
function Ot(t, n = "") {
|
|
926
|
+
const o = [];
|
|
927
|
+
for (const e of t) {
|
|
928
|
+
const r = n ? `${n}.${e.name || "[]"}` : e.name || "[]";
|
|
929
|
+
e.kind === "json" && /^[A-Za-z_$][\w$]*(\[\])?$/.test(e.type) && e.type !== "unknown" && o.push({ path: r, type: e.type }), e.members && o.push(...Ot(e.members, r)), e.item && o.push(...Ot([e.item], r));
|
|
930
|
+
}
|
|
931
|
+
return o;
|
|
932
|
+
}
|
|
933
|
+
function rt(t, n, o = !1, e = 0) {
|
|
934
|
+
const r = n.description, s = { format: n.format, mock: n.mock, bindable: n.bindable };
|
|
935
|
+
if (n.enum) {
|
|
936
|
+
const i = n.enum.map(String);
|
|
937
|
+
return {
|
|
938
|
+
name: t,
|
|
939
|
+
kind: "select",
|
|
940
|
+
type: n.enum.map((c) => JSON.stringify(c)).join(" | "),
|
|
941
|
+
options: i,
|
|
942
|
+
required: o,
|
|
943
|
+
description: r,
|
|
944
|
+
default: n.default,
|
|
945
|
+
...s
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
if (n.type === "boolean")
|
|
949
|
+
return { name: t, kind: "boolean", type: "boolean", required: o, description: r, default: n.default, ...s };
|
|
950
|
+
if (n.type === "number" || n.type === "integer") {
|
|
951
|
+
const i = {};
|
|
952
|
+
return typeof n.minimum == "number" && (i.minimum = n.minimum), typeof n.maximum == "number" && (i.maximum = n.maximum), {
|
|
953
|
+
name: t,
|
|
954
|
+
kind: "number",
|
|
955
|
+
type: "number",
|
|
956
|
+
required: o,
|
|
957
|
+
description: r,
|
|
958
|
+
default: n.default,
|
|
959
|
+
...Object.keys(i).length ? { annotations: i } : {},
|
|
960
|
+
...s
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
if (n.type === "string")
|
|
964
|
+
return { name: t, kind: "text", type: "string", required: o, description: r, default: n.default, ...s };
|
|
965
|
+
if (n.type === "array" && n.items && e < ht) {
|
|
966
|
+
const i = rt("", n.items, !1, e + 1), c = {};
|
|
967
|
+
return typeof n.minimum == "number" && (c.minimum = n.minimum), typeof n.maximum == "number" && (c.maximum = n.maximum), {
|
|
968
|
+
name: t,
|
|
969
|
+
kind: "array",
|
|
970
|
+
type: n.title ?? `${i.type}[]`,
|
|
971
|
+
item: i,
|
|
972
|
+
required: o,
|
|
973
|
+
description: r,
|
|
974
|
+
default: n.default,
|
|
975
|
+
shape: `${i.shape ?? i.type}[]`,
|
|
976
|
+
...Object.keys(c).length ? { annotations: c } : {},
|
|
977
|
+
...s
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
if (n.type === "object" && !n.properties && n.additionalProperties && e < ht) {
|
|
981
|
+
const i = rt("", n.additionalProperties, !1, e + 1);
|
|
982
|
+
return {
|
|
983
|
+
name: t,
|
|
984
|
+
kind: "record",
|
|
985
|
+
type: n.title ?? "object",
|
|
986
|
+
item: i,
|
|
987
|
+
required: o,
|
|
988
|
+
description: r,
|
|
989
|
+
default: n.default,
|
|
990
|
+
shape: `Record<string, ${i.shape ?? i.type}>`,
|
|
991
|
+
...s
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
if (n.type === "object" && n.properties && e < ht) {
|
|
995
|
+
const i = n.required ?? [], c = Object.entries(n.properties).map(
|
|
996
|
+
([a, h]) => rt(a, h, i.includes(a), e + 1)
|
|
997
|
+
);
|
|
998
|
+
return {
|
|
999
|
+
name: t,
|
|
1000
|
+
kind: "object",
|
|
1001
|
+
type: n.title ?? "object",
|
|
1002
|
+
members: c,
|
|
1003
|
+
required: o,
|
|
1004
|
+
description: r,
|
|
1005
|
+
default: n.default,
|
|
1006
|
+
shape: Xt(c),
|
|
1007
|
+
...s
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
return n.tsType?.includes("=>") ? { name: t, kind: "function", type: n.tsType, required: o, description: r, default: n.default, ...s } : { name: t, kind: "json", type: n.tsType ?? n.type ?? "unknown", required: o, description: r, default: n.default, ...s };
|
|
1011
|
+
}
|
|
1012
|
+
function yt(t, n, o, e = "", r, s = 0, i = []) {
|
|
1013
|
+
const a = Tt(n, e).replace(/\s+/g, " ").trim(), h = Ft(a);
|
|
1014
|
+
if (h) return { name: t, kind: "select", type: a, options: h, required: !o, description: r };
|
|
1015
|
+
const f = a.replace(/\s*\|\s*(undefined|null)\s*/g, "").trim();
|
|
1016
|
+
if (f === "boolean") return { name: t, kind: "boolean", type: a, required: !o, description: r };
|
|
1017
|
+
if (f === "number") return { name: t, kind: "number", type: a, required: !o, description: r };
|
|
1018
|
+
if (f === "string") return { name: t, kind: "text", type: a, required: !o, description: r };
|
|
1019
|
+
if (f.includes("|")) {
|
|
1020
|
+
const g = At(f).flatMap((_) => At(Tt(_, e))), S = Ft(g.join(" | "));
|
|
1021
|
+
if (S) return { name: t, kind: "select", type: a, options: S, required: !o, description: r };
|
|
1022
|
+
if (g.includes("string")) return { name: t, kind: "text", type: a, required: !o, description: r };
|
|
1023
|
+
if (g.includes("number")) return { name: t, kind: "number", type: a, required: !o, description: r };
|
|
1024
|
+
if (g.includes("boolean")) return { name: t, kind: "boolean", type: a, required: !o, description: r };
|
|
1025
|
+
}
|
|
1026
|
+
if (/^\([^)]*\)\s*=>/.test(f))
|
|
1027
|
+
return { name: t, kind: "function", type: a, required: !o, description: r };
|
|
1028
|
+
if (s < 4) {
|
|
1029
|
+
const g = f.match(/^Record<\s*string\s*,\s*(.+)>$/)?.[1] ?? f.match(/^\{\s*\[\s*\w+\s*:\s*string\s*\]\s*:\s*(.+?);?\s*\}$/)?.[1];
|
|
1030
|
+
if (g) {
|
|
1031
|
+
const O = yt("", g, !1, e, void 0, s + 1, i);
|
|
1032
|
+
return {
|
|
1033
|
+
name: t,
|
|
1034
|
+
kind: "record",
|
|
1035
|
+
type: a,
|
|
1036
|
+
item: O,
|
|
1037
|
+
required: !o,
|
|
1038
|
+
description: r,
|
|
1039
|
+
shape: `Record<string, ${O.shape ?? O.type}>`
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
const S = f.match(/^(.*\S)\[\]$/)?.[1] ?? f.match(/^Array<(.+)>$/)?.[1];
|
|
1043
|
+
if (S) {
|
|
1044
|
+
const O = yt("", S, !1, e, void 0, s + 1, i);
|
|
1045
|
+
if (O.kind !== "json")
|
|
1046
|
+
return {
|
|
1047
|
+
name: t,
|
|
1048
|
+
kind: "array",
|
|
1049
|
+
type: a,
|
|
1050
|
+
item: O,
|
|
1051
|
+
required: !o,
|
|
1052
|
+
description: r,
|
|
1053
|
+
shape: `${O.shape ?? O.type}[]`
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
let _ = null, C = "";
|
|
1057
|
+
if (f.startsWith("{") && f.endsWith("}") ? _ = f.slice(1, -1) : /^[A-Za-z_$][\w$]*$/.test(f) && !i.includes(f) && (C = f, _ = zn(e, f)), _ !== null) {
|
|
1058
|
+
const O = C ? [...i, C] : i, w = Gn(_).map((A) => {
|
|
1059
|
+
const T = yt(A.name, A.type, A.optional, e, A.description, s + 1, O);
|
|
1060
|
+
return A.mock && !T.mock && (T.mock = A.mock), T;
|
|
1061
|
+
});
|
|
1062
|
+
if (w.length)
|
|
1063
|
+
return {
|
|
1064
|
+
name: t,
|
|
1065
|
+
kind: "object",
|
|
1066
|
+
type: a,
|
|
1067
|
+
members: w,
|
|
1068
|
+
required: !o,
|
|
1069
|
+
description: r,
|
|
1070
|
+
shape: Xt(w)
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
return { name: t, kind: "json", type: a, required: !o, description: r };
|
|
1075
|
+
}
|
|
1076
|
+
function so(t) {
|
|
1077
|
+
const n = t.trim();
|
|
1078
|
+
if (n === "true") return !0;
|
|
1079
|
+
if (n === "false") return !1;
|
|
1080
|
+
if (n === "null") return null;
|
|
1081
|
+
if (/^-?\d+(\.\d+)?$/.test(n)) return Number(n);
|
|
1082
|
+
const o = n.match(/^['"]([\s\S]*)['"]$/);
|
|
1083
|
+
if (o) return o[1];
|
|
1084
|
+
try {
|
|
1085
|
+
return JSON.parse(n);
|
|
1086
|
+
} catch {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
function Jn(t, n, o = "{", e = "}") {
|
|
1091
|
+
let r = 1;
|
|
1092
|
+
for (let s = n; s < t.length; s++) {
|
|
1093
|
+
const i = t[s];
|
|
1094
|
+
if (i === o) r++;
|
|
1095
|
+
else if (i === e && (r--, r === 0))
|
|
1096
|
+
return t.slice(n, s);
|
|
1097
|
+
}
|
|
1098
|
+
return t.slice(n);
|
|
1099
|
+
}
|
|
1100
|
+
function zn(t, n) {
|
|
1101
|
+
const o = [
|
|
1102
|
+
new RegExp(`interface\\s+${n}\\s*(?:extends[^{]+)?\\{`),
|
|
1103
|
+
new RegExp(`type\\s+${n}\\s*=\\s*\\{`)
|
|
1104
|
+
];
|
|
1105
|
+
for (const e of o) {
|
|
1106
|
+
const r = e.exec(t);
|
|
1107
|
+
if (r)
|
|
1108
|
+
return Jn(t, r.index + r[0].length);
|
|
1109
|
+
}
|
|
1110
|
+
return null;
|
|
1111
|
+
}
|
|
1112
|
+
export {
|
|
1113
|
+
Dt as A,
|
|
1114
|
+
ct as B,
|
|
1115
|
+
to as C,
|
|
1116
|
+
Q as G,
|
|
1117
|
+
Qn as a,
|
|
1118
|
+
Gt as b,
|
|
1119
|
+
tn as c,
|
|
1120
|
+
$t as d,
|
|
1121
|
+
Kn as e,
|
|
1122
|
+
Mt as f,
|
|
1123
|
+
ut as g,
|
|
1124
|
+
bt as h,
|
|
1125
|
+
ln as i,
|
|
1126
|
+
Vn as j,
|
|
1127
|
+
zn as k,
|
|
1128
|
+
Zn as l,
|
|
1129
|
+
it as m,
|
|
1130
|
+
Rt as n,
|
|
1131
|
+
no as o,
|
|
1132
|
+
so as p,
|
|
1133
|
+
Gn as q,
|
|
1134
|
+
Jn as r,
|
|
1135
|
+
eo as s,
|
|
1136
|
+
J as t,
|
|
1137
|
+
oo as u,
|
|
1138
|
+
yt as v,
|
|
1139
|
+
Bn as w,
|
|
1140
|
+
ro as x,
|
|
1141
|
+
Ot as y,
|
|
1142
|
+
Yn as z
|
|
1143
|
+
};
|