@pstdio/ui 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MermaidComponent-DBJsTOmj.js +60 -0
- package/dist/MermaidComponent-DBJsTOmj.js.map +1 -0
- package/dist/chat-ui.js +1222 -1147
- package/dist/chat-ui.js.map +1 -1
- package/dist/components/bubble-button.d.ts +1 -1
- package/dist/components/chat-ui/components/chat-input-attachments.d.ts +12 -0
- package/dist/components/chat-ui/components/chat-input.d.ts +3 -0
- package/dist/components/chat-ui/components/chat-panel.d.ts +2 -0
- package/dist/components/chat-ui/components/message-parts-renderer.d.ts +1 -1
- package/dist/components/chat-ui/components/message-types.d.ts +90 -3
- package/dist/components/chat-ui/index.d.ts +2 -2
- package/dist/components/chat-ui/mocks/library/index.d.ts +2 -2
- package/dist/components/chat-ui/performance/chat-performance-fixtures.d.ts +1 -1
- package/dist/components/chat-ui/performance/chat-performance-story-utils.d.ts +1 -1
- package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +3 -3
- package/dist/components/chat-ui/tool-rendering/question-renderer.d.ts +1 -1
- package/dist/components/chat-ui/tool-rendering/shared.d.ts +2 -2
- package/dist/components/chat-ui/tool-rendering/todowrite-renderer.d.ts +1 -1
- package/dist/components/chat-ui/tool-rendering/types.d.ts +1 -1
- package/dist/components/data-renderer/data-renderer-board-column-header.d.ts +8 -0
- package/dist/components/data-renderer/data-renderer-board-group-section.d.ts +17 -0
- package/dist/components/data-renderer/data-renderer-board-move.d.ts +21 -0
- package/dist/components/data-renderer/data-renderer-board.d.ts +3 -2
- package/dist/components/data-renderer/data-renderer-content.d.ts +7 -2
- package/dist/components/data-renderer/data-renderer-enum-helpers.d.ts +3 -3
- package/dist/components/data-renderer/data-renderer-helpers.d.ts +2 -0
- package/dist/components/data-renderer/data-renderer.d.ts +2 -2
- package/dist/components/diff-viewer/diff-card-body.d.ts +16 -0
- package/dist/components/diff-viewer/diff-card.d.ts +1 -0
- package/dist/components/diff-viewer/diff-size.d.ts +1 -1
- package/dist/components/diff-viewer/diff-viewer-options-menu.d.ts +16 -0
- package/dist/components/icon-color-picker.d.ts +2 -6
- package/dist/components/list-row/list-row.types.d.ts +1 -1
- package/dist/components/mermaid-renderer/download-png.d.ts +7 -0
- package/dist/components/mermaid-renderer/index.d.ts +2 -0
- package/dist/components/mermaid-renderer/mermaid-error-state.d.ts +6 -0
- package/dist/components/mermaid-renderer/mermaid-fixtures.d.ts +9 -0
- package/dist/components/mermaid-renderer/mermaid-fullscreen.d.ts +10 -0
- package/dist/components/mermaid-renderer/mermaid-renderer.d.ts +8 -0
- package/dist/components/mermaid-renderer/mermaid-svg-view.d.ts +12 -0
- package/dist/components/mermaid-renderer/mermaid-toolbar.d.ts +12 -0
- package/dist/components/mermaid-renderer/mermaid-zoom.d.ts +6 -0
- package/dist/components/mermaid-renderer/svg-data-url.d.ts +6 -0
- package/dist/components/mermaid-renderer/use-mermaid-render.d.ts +5 -0
- package/dist/components/notification-center/index.d.ts +2 -0
- package/dist/components/notification-center/notification-center.d.ts +2 -0
- package/dist/components/notification-center/notification-center.types.d.ts +37 -0
- package/dist/components/palette-shortcut.d.ts +8 -0
- package/dist/components/search-modal-content.d.ts +20 -0
- package/dist/components/style-guide-data.d.ts +0 -6
- package/dist/components/tab-strip/tab-visibility-filter.d.ts +4 -2
- package/dist/components/tree-list/tree-list-visibility-filter.d.ts +11 -3
- package/dist/components/tree-list/tree-list.types.d.ts +7 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +4641 -4326
- package/dist/index.js.map +1 -1
- package/dist/mermaid-renderer-CPGj6vsb.js +570 -0
- package/dist/mermaid-renderer-CPGj6vsb.js.map +1 -0
- package/dist/resource-badge-CeJTOn8F.js +188 -0
- package/dist/resource-badge-CeJTOn8F.js.map +1 -0
- package/dist/{rich-message-CEOSsdR2.js → rich-message-DNSEhxXh.js} +431 -519
- package/dist/rich-message-DNSEhxXh.js.map +1 -0
- package/dist/rich-text.js +405 -399
- package/dist/rich-text.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/theme/shadowless-default-config.d.ts +2 -0
- package/dist/{theme-D2LYEa0j.js → theme-25P7ij4C.js} +211 -241
- package/dist/theme-25P7ij4C.js.map +1 -0
- package/dist/theme.js +1 -1
- package/package.json +3 -2
- package/dist/MermaidComponent-Cz_Iob5U.js +0 -127
- package/dist/MermaidComponent-Cz_Iob5U.js.map +0 -1
- package/dist/components/chat-ui/agent-types.d.ts +0 -220
- package/dist/components/sidebar/sidebar-project-menu.d.ts +0 -7
- package/dist/get-file-type-icon-ufFb0IkR.js +0 -102
- package/dist/get-file-type-icon-ufFb0IkR.js.map +0 -1
- package/dist/rich-message-CEOSsdR2.js.map +0 -1
- package/dist/theme/tokens/shadows.d.ts +0 -64
- package/dist/theme-D2LYEa0j.js.map +0 -1
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
import { jsx as f, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { c as Z } from "react/compiler-runtime";
|
|
3
|
+
import { Text as Q, Box as F, Dialog as $, Stack as J, Portal as Ie, Icon as V, Button as ke, IconButton as W } from "@chakra-ui/react";
|
|
4
|
+
import { createContext as _e, useContext as ze, useState as R, useEffect as re, useRef as he } from "react";
|
|
5
|
+
import { S as Ee, T as ee } from "./resource-badge-CeJTOn8F.js";
|
|
6
|
+
import { Download as Ce, X as Re, Pencil as Ae, Maximize2 as De, Plus as Oe, Minus as Ze } from "lucide-react";
|
|
7
|
+
import ue from "mermaid";
|
|
8
|
+
const G = [{
|
|
9
|
+
id: "pstdio-light",
|
|
10
|
+
mode: "light"
|
|
11
|
+
}, {
|
|
12
|
+
id: "pstdio-dark",
|
|
13
|
+
mode: "dark"
|
|
14
|
+
}], K = (t, e = G) => typeof t == "string" && e.some((n) => n.id === t), X = (t, e = G) => e.find((n) => n.id === t)?.mode ?? "light", ge = (t) => `theme-${t}`, $e = (t, e = X(t)) => [e, ge(t)], te = "data-pstdio-theme-token-paths", ie = (t) => `--chakra-${t.replaceAll(".", "-")}`, Fe = (t, e) => {
|
|
15
|
+
if (e?.tokens)
|
|
16
|
+
for (const n of Object.keys(e.tokens))
|
|
17
|
+
t.style.removeProperty(ie(n));
|
|
18
|
+
}, He = (t) => {
|
|
19
|
+
const e = t.getAttribute(te)?.split(`
|
|
20
|
+
`).filter(Boolean) ?? [];
|
|
21
|
+
for (const n of e)
|
|
22
|
+
t.style.removeProperty(ie(n));
|
|
23
|
+
t.setAttribute(te, "");
|
|
24
|
+
}, Be = (t, e) => {
|
|
25
|
+
if (!e.tokens) {
|
|
26
|
+
t.setAttribute(te, "");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
for (const [n, r] of Object.entries(e.tokens))
|
|
30
|
+
t.style.setProperty(ie(n), r);
|
|
31
|
+
t.setAttribute(te, Object.keys(e.tokens).join(`
|
|
32
|
+
`));
|
|
33
|
+
}, Le = (t, e = G) => {
|
|
34
|
+
if (typeof document > "u") return;
|
|
35
|
+
const n = document.documentElement, r = document.body, i = e.find((l) => l.id === t) ?? {}, c = X(t, e);
|
|
36
|
+
for (const l of [n, r]) {
|
|
37
|
+
if (!l) continue;
|
|
38
|
+
const a = l.getAttribute("data-theme"), o = e.find((u) => u.id === a);
|
|
39
|
+
l.classList.remove("light", "dark"), a && l.classList.remove(ge(a)), He(l), Fe(l, o), Be(l, i), l.classList.add(...$e(t, c)), l.setAttribute("data-theme", t), l.setAttribute("data-color-mode", c), l.style.colorScheme = c;
|
|
40
|
+
}
|
|
41
|
+
}, Ne = {
|
|
42
|
+
getItem: () => null,
|
|
43
|
+
removeItem: () => {
|
|
44
|
+
},
|
|
45
|
+
setItem: () => {
|
|
46
|
+
}
|
|
47
|
+
}, je = () => {
|
|
48
|
+
try {
|
|
49
|
+
return globalThis.localStorage;
|
|
50
|
+
} catch {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}, pe = () => {
|
|
54
|
+
const t = je();
|
|
55
|
+
return t ? {
|
|
56
|
+
getItem(e) {
|
|
57
|
+
try {
|
|
58
|
+
return t.getItem(e);
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
removeItem(e) {
|
|
64
|
+
try {
|
|
65
|
+
t.removeItem(e);
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
setItem(e, n) {
|
|
70
|
+
try {
|
|
71
|
+
t.setItem(e, n);
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} : Ne;
|
|
76
|
+
}, be = "theme-preference", Pe = _e(null), ne = (t, e) => t.find((n) => n.mode === e)?.id ?? t[0]?.id ?? G[0].id, we = () => typeof window > "u" ? null : pe().getItem(be), le = (t) => {
|
|
77
|
+
typeof window > "u" || pe().setItem(be, t);
|
|
78
|
+
}, xe = (t) => typeof t == "string" && t.includes("."), Ue = (t) => {
|
|
79
|
+
const {
|
|
80
|
+
canRestoreStoredPreference: e,
|
|
81
|
+
storedPreference: n,
|
|
82
|
+
themePreference: r,
|
|
83
|
+
themePreferences: i
|
|
84
|
+
} = t;
|
|
85
|
+
return e && n === r && xe(n) && !K(r, i);
|
|
86
|
+
}, Ve = (t = G) => {
|
|
87
|
+
if (typeof window > "u") return ne(t, "light");
|
|
88
|
+
const e = we();
|
|
89
|
+
if (e) return e;
|
|
90
|
+
const n = typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
91
|
+
return ne(t, n ? "dark" : "light");
|
|
92
|
+
}, yt = (t) => {
|
|
93
|
+
const e = Z(25), {
|
|
94
|
+
children: n,
|
|
95
|
+
themePreferences: r
|
|
96
|
+
} = t, i = r === void 0 ? G : r;
|
|
97
|
+
let c;
|
|
98
|
+
e[0] !== t.initialPreference || e[1] !== i ? (c = t.initialPreference ?? Ve(i), e[0] = t.initialPreference, e[1] = i, e[2] = c) : c = e[2];
|
|
99
|
+
const l = c, a = t.initialPreference === void 0, [o, u] = R(l);
|
|
100
|
+
let s, m;
|
|
101
|
+
e[3] !== a || e[4] !== o || e[5] !== i ? (s = a ? we() : null, m = Ue({
|
|
102
|
+
canRestoreStoredPreference: a,
|
|
103
|
+
storedPreference: s,
|
|
104
|
+
themePreference: o,
|
|
105
|
+
themePreferences: i
|
|
106
|
+
}), e[3] = a, e[4] = o, e[5] = i, e[6] = s, e[7] = m) : (s = e[6], m = e[7]);
|
|
107
|
+
const d = m;
|
|
108
|
+
let p, b;
|
|
109
|
+
e[8] !== d || e[9] !== s || e[10] !== o || e[11] !== i ? (p = () => {
|
|
110
|
+
if (s && s !== o && K(s, i)) {
|
|
111
|
+
u(s);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (d)
|
|
115
|
+
return;
|
|
116
|
+
if (!K(o, i)) {
|
|
117
|
+
u(ne(i, X(o, i)));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
Le(o, i), s && s !== o && xe(s) && !K(s, i) || le(o);
|
|
121
|
+
}, b = [d, s, o, i], e[8] = d, e[9] = s, e[10] = o, e[11] = i, e[12] = p, e[13] = b) : (p = e[12], b = e[13]), re(p, b);
|
|
122
|
+
let h;
|
|
123
|
+
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = (y) => {
|
|
124
|
+
le(y), u(y);
|
|
125
|
+
}, e[14] = h) : h = e[14];
|
|
126
|
+
const w = h;
|
|
127
|
+
let P;
|
|
128
|
+
e[15] !== o || e[16] !== i ? (P = () => {
|
|
129
|
+
const y = X(o, i) === "dark" ? "light" : "dark";
|
|
130
|
+
w(ne(i, y));
|
|
131
|
+
}, e[15] = o, e[16] = i, e[17] = P) : P = e[17];
|
|
132
|
+
const x = P;
|
|
133
|
+
if (d)
|
|
134
|
+
return null;
|
|
135
|
+
let g;
|
|
136
|
+
e[18] !== o || e[19] !== i || e[20] !== x ? (g = {
|
|
137
|
+
themePreference: o,
|
|
138
|
+
themePreferences: i,
|
|
139
|
+
setThemePreference: w,
|
|
140
|
+
toggleThemePreference: x
|
|
141
|
+
}, e[18] = o, e[19] = i, e[20] = x, e[21] = g) : g = e[21];
|
|
142
|
+
let S;
|
|
143
|
+
return e[22] !== n || e[23] !== g ? (S = /* @__PURE__ */ f(Pe, { value: g, children: n }), e[22] = n, e[23] = g, e[24] = S) : S = e[24], S;
|
|
144
|
+
}, Ge = () => {
|
|
145
|
+
const t = ze(Pe);
|
|
146
|
+
if (!t)
|
|
147
|
+
throw new Error("useThemePreference must be used within a ThemePreferenceProvider");
|
|
148
|
+
return t;
|
|
149
|
+
}, ye = 0.5, ve = 3, Se = 0.25, se = (t) => Number(Math.min(ve, Math.max(ye, t)).toFixed(2)), qe = (t) => se(t + Se), We = (t) => se(t - Se), ae = (t) => {
|
|
150
|
+
if (!t)
|
|
151
|
+
return 0;
|
|
152
|
+
const e = Number.parseFloat(t);
|
|
153
|
+
return Number.isFinite(e) ? e : 0;
|
|
154
|
+
}, oe = (t, e) => t.match(new RegExp(`\\s${e}="([^"]+)"`))?.[1], Te = (t) => {
|
|
155
|
+
const e = oe(t, "viewBox")?.split(/\s+/).map(Number) ?? [], n = e[2] ?? 0, r = e[3] ?? 0;
|
|
156
|
+
return n > 0 && r > 0 ? {
|
|
157
|
+
width: n,
|
|
158
|
+
height: r
|
|
159
|
+
} : {
|
|
160
|
+
width: Math.max(ae(oe(t, "width")), 1),
|
|
161
|
+
height: Math.max(ae(oe(t, "height")), 1)
|
|
162
|
+
};
|
|
163
|
+
}, Xe = (t) => t.replace(/<br(\s[^>]*)?>/g, "<br$1/>"), Ye = (t) => {
|
|
164
|
+
const {
|
|
165
|
+
width: e,
|
|
166
|
+
height: n
|
|
167
|
+
} = Te(t), r = t.replace(/<svg\b[^>]*>/, (i) => {
|
|
168
|
+
const c = /\swidth=/.test(i) ? i.replace(/\swidth="[^"]*"/, ` width="${e}"`) : i.replace("<svg", `<svg width="${e}"`);
|
|
169
|
+
return /\sheight=/.test(c) ? c.replace(/\sheight="[^"]*"/, ` height="${n}"`) : c.replace("<svg", `<svg height="${n}"`);
|
|
170
|
+
});
|
|
171
|
+
return Xe(r);
|
|
172
|
+
}, Me = (t) => {
|
|
173
|
+
const e = new TextEncoder().encode(Ye(t));
|
|
174
|
+
let n = "";
|
|
175
|
+
for (const r of e)
|
|
176
|
+
n += String.fromCharCode(r);
|
|
177
|
+
return `data:image/svg+xml;base64,${btoa(n)}`;
|
|
178
|
+
}, Ke = (t) => new Promise((e, n) => {
|
|
179
|
+
const r = new Image();
|
|
180
|
+
r.style.position = "fixed", r.style.left = "-10000px", r.style.top = "0", r.style.pointerEvents = "none", r.onload = () => e({
|
|
181
|
+
image: r,
|
|
182
|
+
cleanup: () => r.remove()
|
|
183
|
+
}), r.onerror = () => {
|
|
184
|
+
r.remove(), n(new Error("Failed to load rendered Mermaid SVG for PNG export."));
|
|
185
|
+
}, document.body.append(r), r.src = t;
|
|
186
|
+
}), Qe = (t) => new Promise((e, n) => {
|
|
187
|
+
t.toBlob((r) => {
|
|
188
|
+
if (r) {
|
|
189
|
+
e(r);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
n(new Error("Failed to encode Mermaid diagram as PNG."));
|
|
193
|
+
}, "image/png");
|
|
194
|
+
}), Je = (t, e) => {
|
|
195
|
+
const n = URL.createObjectURL(t), r = document.createElement("a");
|
|
196
|
+
r.href = n, r.download = e, document.body.append(r), r.click(), r.remove(), window.setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
197
|
+
}, et = async (t) => {
|
|
198
|
+
const {
|
|
199
|
+
svg: e,
|
|
200
|
+
zoom: n,
|
|
201
|
+
filename: r = "mermaid-diagram.png"
|
|
202
|
+
} = t, i = Me(e), {
|
|
203
|
+
image: c,
|
|
204
|
+
cleanup: l
|
|
205
|
+
} = await Ke(i);
|
|
206
|
+
try {
|
|
207
|
+
const {
|
|
208
|
+
width: a,
|
|
209
|
+
height: o
|
|
210
|
+
} = Te(e), u = se(n), s = document.createElement("canvas");
|
|
211
|
+
s.width = Math.ceil(a * u), s.height = Math.ceil(o * u);
|
|
212
|
+
const m = s.getContext("2d");
|
|
213
|
+
if (!m)
|
|
214
|
+
throw new Error("Canvas rendering is unavailable for Mermaid PNG export.");
|
|
215
|
+
m.scale(u, u), m.drawImage(c, 0, 0, a, o), Je(await Qe(s), r);
|
|
216
|
+
} finally {
|
|
217
|
+
l();
|
|
218
|
+
}
|
|
219
|
+
}, tt = (t) => {
|
|
220
|
+
const e = Z(9), {
|
|
221
|
+
code: n,
|
|
222
|
+
error: r
|
|
223
|
+
} = t;
|
|
224
|
+
let i;
|
|
225
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ f(Q, { color: "fg.error", textStyle: "label/S/medium", children: "Mermaid parse failed" }), e[0] = i) : i = e[0];
|
|
226
|
+
let c;
|
|
227
|
+
e[1] !== r ? (c = /* @__PURE__ */ f(Q, { color: "fg.muted", textStyle: "label/S/regular", mt: "2xs", whiteSpace: "pre-wrap", children: r }), e[1] = r, e[2] = c) : c = e[2];
|
|
228
|
+
let l;
|
|
229
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = {
|
|
230
|
+
p: "sm"
|
|
231
|
+
}, e[3] = l) : l = e[3];
|
|
232
|
+
let a;
|
|
233
|
+
e[4] !== n ? (a = /* @__PURE__ */ f(Ee, { mt: "sm", borderRadius: "sm", bg: "bg.muted", showHorizontalScrollbar: !0, showVerticalScrollbar: !1, contentProps: l, children: /* @__PURE__ */ f(F, { as: "pre", m: "0", fontSize: "sm", children: n }) }), e[4] = n, e[5] = a) : a = e[5];
|
|
234
|
+
let o;
|
|
235
|
+
return e[6] !== c || e[7] !== a ? (o = /* @__PURE__ */ T(F, { role: "alert", borderRadius: "sm", bg: "bg.panel", p: "sm", children: [
|
|
236
|
+
i,
|
|
237
|
+
c,
|
|
238
|
+
a
|
|
239
|
+
] }), e[6] = c, e[7] = a, e[8] = o) : o = e[8], o;
|
|
240
|
+
}, nt = (t) => {
|
|
241
|
+
const e = Z(23), {
|
|
242
|
+
children: n,
|
|
243
|
+
canDownload: r,
|
|
244
|
+
open: i,
|
|
245
|
+
onClose: c,
|
|
246
|
+
onDownload: l
|
|
247
|
+
} = t;
|
|
248
|
+
let a;
|
|
249
|
+
e[0] !== c ? (a = (g) => !g.open && c(), e[0] = c, e[1] = a) : a = e[1];
|
|
250
|
+
let o;
|
|
251
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ f($.Backdrop, {}), e[2] = o) : o = e[2];
|
|
252
|
+
let u;
|
|
253
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ f($.Title, { asChild: !0, children: /* @__PURE__ */ f(Q, { textStyle: "heading/S", children: "Mermaid diagram" }) }), e[3] = u) : u = e[3];
|
|
254
|
+
const s = !r;
|
|
255
|
+
let m;
|
|
256
|
+
e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ f(V, { as: Ce, boxSize: "16px" }), e[4] = m) : m = e[4];
|
|
257
|
+
let d;
|
|
258
|
+
e[5] !== l || e[6] !== s ? (d = /* @__PURE__ */ T(ke, { size: "sm", variant: "surface", onClick: l, disabled: s, children: [
|
|
259
|
+
m,
|
|
260
|
+
"Download as PNG"
|
|
261
|
+
] }), e[5] = l, e[6] = s, e[7] = d) : d = e[7];
|
|
262
|
+
let p;
|
|
263
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ f(V, { as: Re, boxSize: "16px" }), e[8] = p) : p = e[8];
|
|
264
|
+
let b;
|
|
265
|
+
e[9] !== c ? (b = /* @__PURE__ */ f(W, { "aria-label": "Close", size: "sm", variant: "ghost", onClick: c, children: p }), e[9] = c, e[10] = b) : b = e[10];
|
|
266
|
+
let h;
|
|
267
|
+
e[11] !== d || e[12] !== b ? (h = /* @__PURE__ */ f($.Header, { "data-testid": "mermaid-fullscreen-header", position: "absolute", top: "0", right: "0", left: "0", zIndex: "2", p: "0", children: /* @__PURE__ */ T(J, { direction: "row", align: "center", justify: "space-between", width: "100%", gap: "sm", children: [
|
|
268
|
+
u,
|
|
269
|
+
/* @__PURE__ */ T(J, { direction: "row", align: "center", gap: "xs", children: [
|
|
270
|
+
d,
|
|
271
|
+
b
|
|
272
|
+
] })
|
|
273
|
+
] }) }), e[11] = d, e[12] = b, e[13] = h) : h = e[13];
|
|
274
|
+
let w;
|
|
275
|
+
e[14] !== n ? (w = /* @__PURE__ */ f($.Body, { "data-testid": "mermaid-fullscreen-body", p: "0", flex: "1", minH: "0", children: n }), e[14] = n, e[15] = w) : w = e[15];
|
|
276
|
+
let P;
|
|
277
|
+
e[16] !== h || e[17] !== w ? (P = /* @__PURE__ */ T(Ie, { children: [
|
|
278
|
+
o,
|
|
279
|
+
/* @__PURE__ */ f($.Positioner, { padding: "0", children: /* @__PURE__ */ T($.Content, { width: "100vw", height: "100vh", maxW: "none", borderRadius: "0", overflow: "hidden", children: [
|
|
280
|
+
h,
|
|
281
|
+
w
|
|
282
|
+
] }) })
|
|
283
|
+
] }), e[16] = h, e[17] = w, e[18] = P) : P = e[18];
|
|
284
|
+
let x;
|
|
285
|
+
return e[19] !== i || e[20] !== a || e[21] !== P ? (x = /* @__PURE__ */ f($.Root, { lazyMount: !0, unmountOnExit: !0, open: i, onOpenChange: a, children: P }), e[19] = i, e[20] = a, e[21] = P, e[22] = x) : x = e[22], x;
|
|
286
|
+
}, rt = (t) => {
|
|
287
|
+
const e = Z(9), {
|
|
288
|
+
isEditable: n,
|
|
289
|
+
onRequestEdit: r,
|
|
290
|
+
onOpenFullscreen: i
|
|
291
|
+
} = t;
|
|
292
|
+
let c;
|
|
293
|
+
e[0] !== n || e[1] !== r ? (c = n && r ? /* @__PURE__ */ f(ee, { content: "Edit source", children: /* @__PURE__ */ f(W, { "aria-label": "Edit", size: "xs", variant: "surface", onClick: r, children: /* @__PURE__ */ f(V, { as: Ae, boxSize: "14px" }) }) }) : null, e[0] = n, e[1] = r, e[2] = c) : c = e[2];
|
|
294
|
+
let l;
|
|
295
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ f(V, { as: De, boxSize: "14px" }), e[3] = l) : l = e[3];
|
|
296
|
+
let a;
|
|
297
|
+
e[4] !== i ? (a = /* @__PURE__ */ f(ee, { content: "Fullscreen", children: /* @__PURE__ */ f(W, { "aria-label": "Fullscreen", size: "xs", variant: "surface", onClick: i, children: l }) }), e[4] = i, e[5] = a) : a = e[5];
|
|
298
|
+
let o;
|
|
299
|
+
return e[6] !== c || e[7] !== a ? (o = /* @__PURE__ */ T(J, { "data-testid": "mermaid-inline-toolbar", direction: "row", justify: "flex-end", align: "center", gap: "xs", position: "absolute", top: "sm", right: "sm", zIndex: "1", onPointerDown: it, children: [
|
|
300
|
+
c,
|
|
301
|
+
a
|
|
302
|
+
] }), e[6] = c, e[7] = a, e[8] = o) : o = e[8], o;
|
|
303
|
+
}, ot = (t) => {
|
|
304
|
+
const e = Z(17), {
|
|
305
|
+
zoom: n,
|
|
306
|
+
onZoomChange: r
|
|
307
|
+
} = t;
|
|
308
|
+
let i;
|
|
309
|
+
e[0] !== r || e[1] !== n ? (i = () => r(qe(n)), e[0] = r, e[1] = n, e[2] = i) : i = e[2];
|
|
310
|
+
const c = n >= ve;
|
|
311
|
+
let l;
|
|
312
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ f(V, { as: Oe, boxSize: "14px" }), e[3] = l) : l = e[3];
|
|
313
|
+
let a;
|
|
314
|
+
e[4] !== i || e[5] !== c ? (a = /* @__PURE__ */ f(ee, { content: "Zoom in", children: /* @__PURE__ */ f(W, { "aria-label": "Zoom in", size: "xs", variant: "surface", onClick: i, disabled: c, children: l }) }), e[4] = i, e[5] = c, e[6] = a) : a = e[6];
|
|
315
|
+
let o;
|
|
316
|
+
e[7] !== r || e[8] !== n ? (o = () => r(We(n)), e[7] = r, e[8] = n, e[9] = o) : o = e[9];
|
|
317
|
+
const u = n <= ye;
|
|
318
|
+
let s;
|
|
319
|
+
e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ f(V, { as: Ze, boxSize: "14px" }), e[10] = s) : s = e[10];
|
|
320
|
+
let m;
|
|
321
|
+
e[11] !== o || e[12] !== u ? (m = /* @__PURE__ */ f(ee, { content: "Zoom out", children: /* @__PURE__ */ f(W, { "aria-label": "Zoom out", size: "xs", variant: "surface", onClick: o, disabled: u, children: s }) }), e[11] = o, e[12] = u, e[13] = m) : m = e[13];
|
|
322
|
+
let d;
|
|
323
|
+
return e[14] !== a || e[15] !== m ? (d = /* @__PURE__ */ T(J, { "data-testid": "mermaid-zoom-controls", gap: "2xs", position: "absolute", right: "sm", bottom: "sm", zIndex: "1", onPointerDown: st, children: [
|
|
324
|
+
a,
|
|
325
|
+
m
|
|
326
|
+
] }), e[14] = a, e[15] = m, e[16] = d) : d = e[16], d;
|
|
327
|
+
};
|
|
328
|
+
function it(t) {
|
|
329
|
+
return t.stopPropagation();
|
|
330
|
+
}
|
|
331
|
+
function st(t) {
|
|
332
|
+
return t.stopPropagation();
|
|
333
|
+
}
|
|
334
|
+
const lt = (t) => {
|
|
335
|
+
const e = Z(42), {
|
|
336
|
+
allowPanAtDefaultZoom: n,
|
|
337
|
+
maxHeight: r,
|
|
338
|
+
minHeight: i,
|
|
339
|
+
overlayActions: c,
|
|
340
|
+
svg: l,
|
|
341
|
+
zoom: a,
|
|
342
|
+
onZoomChange: o
|
|
343
|
+
} = t, u = n === void 0 ? !1 : n, s = r === void 0 ? "420px" : r, m = i === void 0 ? "220px" : i;
|
|
344
|
+
let d;
|
|
345
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = {
|
|
346
|
+
x: 0,
|
|
347
|
+
y: 0
|
|
348
|
+
}, e[0] = d) : d = e[0];
|
|
349
|
+
const [p, b] = R(d), [h, w] = R(!1);
|
|
350
|
+
let P;
|
|
351
|
+
e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (P = {
|
|
352
|
+
pointerId: -1,
|
|
353
|
+
x: 0,
|
|
354
|
+
y: 0
|
|
355
|
+
}, e[1] = P) : P = e[1];
|
|
356
|
+
const x = he(P), g = u || a > 1;
|
|
357
|
+
let S;
|
|
358
|
+
e[2] !== g || e[3] !== p.x || e[4] !== p.y ? (S = (v) => {
|
|
359
|
+
g && (x.current = {
|
|
360
|
+
pointerId: v.pointerId,
|
|
361
|
+
x: v.clientX - p.x,
|
|
362
|
+
y: v.clientY - p.y
|
|
363
|
+
}, w(!0), v.currentTarget.setPointerCapture(v.pointerId));
|
|
364
|
+
}, e[2] = g, e[3] = p.x, e[4] = p.y, e[5] = S) : S = e[5];
|
|
365
|
+
const y = S;
|
|
366
|
+
let E;
|
|
367
|
+
e[6] !== g || e[7] !== h ? (E = (v) => {
|
|
368
|
+
!g || !h || x.current.pointerId !== v.pointerId || b({
|
|
369
|
+
x: v.clientX - x.current.x,
|
|
370
|
+
y: v.clientY - x.current.y
|
|
371
|
+
});
|
|
372
|
+
}, e[6] = g, e[7] = h, e[8] = E) : E = e[8];
|
|
373
|
+
const A = E;
|
|
374
|
+
let C;
|
|
375
|
+
e[9] !== g ? (C = (v) => {
|
|
376
|
+
!g || x.current.pointerId !== v.pointerId || (w(!1), v.currentTarget.releasePointerCapture(v.pointerId));
|
|
377
|
+
}, e[9] = g, e[10] = C) : C = e[10];
|
|
378
|
+
const q = C;
|
|
379
|
+
let M, I;
|
|
380
|
+
e[11] !== g ? (M = () => {
|
|
381
|
+
g || (b({
|
|
382
|
+
x: 0,
|
|
383
|
+
y: 0
|
|
384
|
+
}), w(!1));
|
|
385
|
+
}, I = [g], e[11] = g, e[12] = M, e[13] = I) : (M = e[12], I = e[13]), re(M, I);
|
|
386
|
+
const D = g ? h ? "grabbing" : "grab" : "default", _ = g ? "none" : "auto";
|
|
387
|
+
let k;
|
|
388
|
+
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = () => {
|
|
389
|
+
w(!1);
|
|
390
|
+
}, e[14] = k) : k = e[14];
|
|
391
|
+
const z = g ? "true" : "false", O = `translate3d(${p.x}px, ${p.y}px, 0) scale(${a})`, H = g ? h ? "grabbing" : "grab" : "default";
|
|
392
|
+
let B;
|
|
393
|
+
e[15] !== s ? (B = {
|
|
394
|
+
"& img": {
|
|
395
|
+
display: "inline-block",
|
|
396
|
+
width: "auto",
|
|
397
|
+
maxWidth: "100%",
|
|
398
|
+
maxHeight: s,
|
|
399
|
+
height: "auto",
|
|
400
|
+
userSelect: "none"
|
|
401
|
+
}
|
|
402
|
+
}, e[15] = s, e[16] = B) : B = e[16];
|
|
403
|
+
let L;
|
|
404
|
+
e[17] !== l ? (L = Me(l), e[17] = l, e[18] = L) : L = e[18];
|
|
405
|
+
let N;
|
|
406
|
+
e[19] !== L ? (N = /* @__PURE__ */ f("img", { alt: "Mermaid diagram", draggable: !1, src: L }), e[19] = L, e[20] = N) : N = e[20];
|
|
407
|
+
let j;
|
|
408
|
+
e[21] !== s || e[22] !== z || e[23] !== O || e[24] !== H || e[25] !== B || e[26] !== N ? (j = /* @__PURE__ */ f(F, { "data-testid": "mermaid-diagram-transform", "data-pan-enabled": z, width: "100%", maxHeight: s, textAlign: "center", transform: O, transformOrigin: "top left", cursor: H, css: B, children: N }), e[21] = s, e[22] = z, e[23] = O, e[24] = H, e[25] = B, e[26] = N, e[27] = j) : j = e[27];
|
|
409
|
+
let U;
|
|
410
|
+
e[28] !== o || e[29] !== a ? (U = /* @__PURE__ */ f(ot, { zoom: a, onZoomChange: o }), e[28] = o, e[29] = a, e[30] = U) : U = e[30];
|
|
411
|
+
let Y;
|
|
412
|
+
return e[31] !== y || e[32] !== A || e[33] !== q || e[34] !== s || e[35] !== m || e[36] !== c || e[37] !== D || e[38] !== _ || e[39] !== j || e[40] !== U ? (Y = /* @__PURE__ */ T(F, { "data-testid": "mermaid-diagram-surface", position: "relative", minHeight: m, maxHeight: s, overflow: "hidden", cursor: D, touchAction: _, onPointerDown: y, onPointerMove: A, onPointerUp: q, onPointerCancel: k, children: [
|
|
413
|
+
j,
|
|
414
|
+
c,
|
|
415
|
+
U
|
|
416
|
+
] }), e[31] = y, e[32] = A, e[33] = q, e[34] = s, e[35] = m, e[36] = c, e[37] = D, e[38] = _, e[39] = j, e[40] = U, e[41] = Y) : Y = e[41], Y;
|
|
417
|
+
};
|
|
418
|
+
let ce = null, de = 0, me = Promise.resolve();
|
|
419
|
+
const at = (t) => t === "dark" ? "dark" : "default", ct = (t) => {
|
|
420
|
+
ce !== t && (ue.initialize({
|
|
421
|
+
startOnLoad: !1,
|
|
422
|
+
htmlLabels: !0,
|
|
423
|
+
flowchart: {
|
|
424
|
+
htmlLabels: !0
|
|
425
|
+
},
|
|
426
|
+
securityLevel: "antiscript",
|
|
427
|
+
theme: at(t)
|
|
428
|
+
}), ce = t);
|
|
429
|
+
}, dt = () => (de += 1, `mermaid-${de}`), mt = (t, e) => {
|
|
430
|
+
const n = async () => (ct(t), ue.render(dt(), e)), r = me.then(n, n);
|
|
431
|
+
return me = r.then(() => {
|
|
432
|
+
}, () => {
|
|
433
|
+
}), r;
|
|
434
|
+
}, ft = (t) => {
|
|
435
|
+
if (!(t instanceof Error))
|
|
436
|
+
return "Failed to render Mermaid diagram.";
|
|
437
|
+
const e = t.message.trim();
|
|
438
|
+
return e ? e.split(`
|
|
439
|
+
`).filter(Boolean).slice(0, 3).join(`
|
|
440
|
+
`) : "Failed to render Mermaid diagram.";
|
|
441
|
+
}, ht = (t) => {
|
|
442
|
+
const {
|
|
443
|
+
themePreference: e,
|
|
444
|
+
themePreferences: n
|
|
445
|
+
} = Ge(), r = X(e, n), [i, c] = R(""), [l, a] = R(""), [o, u] = R(!1);
|
|
446
|
+
return re(() => {
|
|
447
|
+
let s = !1;
|
|
448
|
+
return (async () => {
|
|
449
|
+
u(!0), a("");
|
|
450
|
+
try {
|
|
451
|
+
const d = await mt(r, t);
|
|
452
|
+
if (s)
|
|
453
|
+
return;
|
|
454
|
+
c(d.svg);
|
|
455
|
+
} catch (d) {
|
|
456
|
+
if (s)
|
|
457
|
+
return;
|
|
458
|
+
c(""), a(ft(d));
|
|
459
|
+
} finally {
|
|
460
|
+
s || u(!1);
|
|
461
|
+
}
|
|
462
|
+
})(), () => {
|
|
463
|
+
s = !0;
|
|
464
|
+
};
|
|
465
|
+
}, [t, r]), {
|
|
466
|
+
svg: i,
|
|
467
|
+
error: l,
|
|
468
|
+
isRendering: o
|
|
469
|
+
};
|
|
470
|
+
}, fe = (t) => {
|
|
471
|
+
const e = Z(21), {
|
|
472
|
+
allowPanAtDefaultZoom: n,
|
|
473
|
+
code: r,
|
|
474
|
+
error: i,
|
|
475
|
+
isRendering: c,
|
|
476
|
+
maxHeight: l,
|
|
477
|
+
minHeight: a,
|
|
478
|
+
overlayActions: o,
|
|
479
|
+
svg: u,
|
|
480
|
+
zoom: s,
|
|
481
|
+
onZoomChange: m
|
|
482
|
+
} = t;
|
|
483
|
+
if (c) {
|
|
484
|
+
const p = a ?? "220px";
|
|
485
|
+
let b;
|
|
486
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ f(Q, { color: "fg.muted", textStyle: "paragraph/S/regular", children: "Rendering diagram..." }), e[0] = b) : b = e[0];
|
|
487
|
+
let h;
|
|
488
|
+
return e[1] !== l || e[2] !== o || e[3] !== p ? (h = /* @__PURE__ */ T(F, { position: "relative", minHeight: p, maxHeight: l, overflow: "hidden", children: [
|
|
489
|
+
b,
|
|
490
|
+
o
|
|
491
|
+
] }), e[1] = l, e[2] = o, e[3] = p, e[4] = h) : h = e[4], h;
|
|
492
|
+
}
|
|
493
|
+
if (i) {
|
|
494
|
+
const p = a ?? "220px";
|
|
495
|
+
let b;
|
|
496
|
+
e[5] !== r || e[6] !== i ? (b = /* @__PURE__ */ f(tt, { code: r, error: i }), e[5] = r, e[6] = i, e[7] = b) : b = e[7];
|
|
497
|
+
let h;
|
|
498
|
+
return e[8] !== l || e[9] !== o || e[10] !== p || e[11] !== b ? (h = /* @__PURE__ */ T(F, { position: "relative", minHeight: p, maxHeight: l, overflow: "hidden", children: [
|
|
499
|
+
b,
|
|
500
|
+
o
|
|
501
|
+
] }), e[8] = l, e[9] = o, e[10] = p, e[11] = b, e[12] = h) : h = e[12], h;
|
|
502
|
+
}
|
|
503
|
+
let d;
|
|
504
|
+
return e[13] !== n || e[14] !== l || e[15] !== a || e[16] !== m || e[17] !== o || e[18] !== u || e[19] !== s ? (d = /* @__PURE__ */ f(lt, { allowPanAtDefaultZoom: n, maxHeight: l, minHeight: a, overlayActions: o, svg: u, zoom: s, onZoomChange: m }, u), e[13] = n, e[14] = l, e[15] = a, e[16] = m, e[17] = o, e[18] = u, e[19] = s, e[20] = d) : d = e[20], d;
|
|
505
|
+
}, vt = (t) => {
|
|
506
|
+
const e = Z(36), {
|
|
507
|
+
code: n,
|
|
508
|
+
initialFullscreenOpen: r,
|
|
509
|
+
initialZoom: i,
|
|
510
|
+
isEditable: c,
|
|
511
|
+
onRequestEdit: l
|
|
512
|
+
} = t, a = r === void 0 ? !1 : r, o = i === void 0 ? 1 : i, u = c === void 0 ? !1 : c, {
|
|
513
|
+
svg: s,
|
|
514
|
+
error: m,
|
|
515
|
+
isRendering: d
|
|
516
|
+
} = ht(n), [p, b] = R(o), [h, w] = R(1), [P, x] = R(a);
|
|
517
|
+
let g;
|
|
518
|
+
e[0] !== n || e[1] !== o ? (g = {
|
|
519
|
+
code: n,
|
|
520
|
+
initialZoom: o
|
|
521
|
+
}, e[0] = n, e[1] = o, e[2] = g) : g = e[2];
|
|
522
|
+
const S = he(g), y = !!s && !m && !d;
|
|
523
|
+
let E, A;
|
|
524
|
+
e[3] !== n || e[4] !== o ? (E = () => {
|
|
525
|
+
const H = S.current;
|
|
526
|
+
H.code === n && H.initialZoom === o || (S.current = {
|
|
527
|
+
code: n,
|
|
528
|
+
initialZoom: o
|
|
529
|
+
}, b(o), w(1));
|
|
530
|
+
}, A = [n, o], e[3] = n, e[4] = o, e[5] = E, e[6] = A) : (E = e[5], A = e[6]), re(E, A);
|
|
531
|
+
let C;
|
|
532
|
+
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = () => {
|
|
533
|
+
w(1), x(!0);
|
|
534
|
+
}, e[7] = C) : C = e[7];
|
|
535
|
+
const q = C;
|
|
536
|
+
let M;
|
|
537
|
+
e[8] !== u || e[9] !== l ? (M = /* @__PURE__ */ f(rt, { isEditable: u, onRequestEdit: l, onOpenFullscreen: q }), e[8] = u, e[9] = l, e[10] = M) : M = e[10];
|
|
538
|
+
let I;
|
|
539
|
+
e[11] !== n || e[12] !== m || e[13] !== p || e[14] !== d || e[15] !== s || e[16] !== M ? (I = /* @__PURE__ */ f(fe, { code: n, error: m, isRendering: d, overlayActions: M, svg: s, zoom: p, onZoomChange: b }), e[11] = n, e[12] = m, e[13] = p, e[14] = d, e[15] = s, e[16] = M, e[17] = I) : I = e[17];
|
|
540
|
+
let D;
|
|
541
|
+
e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = () => x(!1), e[18] = D) : D = e[18];
|
|
542
|
+
let _;
|
|
543
|
+
e[19] !== h || e[20] !== s ? (_ = () => et({
|
|
544
|
+
svg: s,
|
|
545
|
+
zoom: h
|
|
546
|
+
}), e[19] = h, e[20] = s, e[21] = _) : _ = e[21];
|
|
547
|
+
let k;
|
|
548
|
+
e[22] !== n || e[23] !== m || e[24] !== h || e[25] !== d || e[26] !== s ? (k = /* @__PURE__ */ f(fe, { allowPanAtDefaultZoom: !0, code: n, error: m, isRendering: d, maxHeight: "100%", minHeight: "100%", svg: s, zoom: h, onZoomChange: w }), e[22] = n, e[23] = m, e[24] = h, e[25] = d, e[26] = s, e[27] = k) : k = e[27];
|
|
549
|
+
let z;
|
|
550
|
+
e[28] !== y || e[29] !== P || e[30] !== _ || e[31] !== k ? (z = /* @__PURE__ */ f(nt, { open: P, canDownload: y, onClose: D, onDownload: _, children: k }), e[28] = y, e[29] = P, e[30] = _, e[31] = k, e[32] = z) : z = e[32];
|
|
551
|
+
let O;
|
|
552
|
+
return e[33] !== z || e[34] !== I ? (O = /* @__PURE__ */ T(F, { width: "100%", children: [
|
|
553
|
+
I,
|
|
554
|
+
z
|
|
555
|
+
] }), e[33] = z, e[34] = I, e[35] = O) : O = e[35], O;
|
|
556
|
+
};
|
|
557
|
+
export {
|
|
558
|
+
vt as M,
|
|
559
|
+
yt as T,
|
|
560
|
+
Le as a,
|
|
561
|
+
ge as b,
|
|
562
|
+
pe as c,
|
|
563
|
+
G as d,
|
|
564
|
+
$e as e,
|
|
565
|
+
X as f,
|
|
566
|
+
Ve as g,
|
|
567
|
+
K as i,
|
|
568
|
+
Ge as u
|
|
569
|
+
};
|
|
570
|
+
//# sourceMappingURL=mermaid-renderer-CPGj6vsb.js.map
|