@backmatter/studio 0.0.8 → 0.0.10

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.
Files changed (65) hide show
  1. package/dist/chunks/UiKitApp-BxvTwsko.js +2410 -0
  2. package/dist/chunks/WorkspaceRoutes-BKKEkAq7.js +90126 -0
  3. package/dist/chunks/{dashboard-bNp6AbKE.js → dashboard-8rjkfEXl.js} +380 -382
  4. package/dist/chunks/{index-DoDE-hwB.js → index-laWAz5_p.js} +111 -112
  5. package/dist/dashboard.js +2 -2
  6. package/dist/index.js +287 -146
  7. package/dist/site-widget.css +1615 -0
  8. package/dist/site-widget.js +30903 -628
  9. package/dist/studio.css +268 -67
  10. package/package.json +4 -4
  11. package/src/App.tsx +12 -29
  12. package/src/api.ts +55 -0
  13. package/src/chat/ChangeCard.tsx +2 -0
  14. package/src/chat/ChatMessage.tsx +73 -62
  15. package/src/chat/ChatPanel.tsx +110 -15
  16. package/src/chat/DocListCard.tsx +2 -0
  17. package/src/chat/LiveStatus.tsx +78 -8
  18. package/src/chat/Reveal.tsx +34 -0
  19. package/src/chat/Shimmer.tsx +65 -23
  20. package/src/chat/chat-helpers.ts +35 -0
  21. package/src/chat/motion.ts +73 -0
  22. package/src/chat/useStickToBottom.ts +129 -14
  23. package/src/chrome/ContentExplorerSidebar.tsx +23 -8
  24. package/src/chrome/content-tree-visibility.ts +55 -0
  25. package/src/devbar-state.ts +125 -0
  26. package/src/index.css +3 -131
  27. package/src/pages/CliAuthorizePage.tsx +61 -28
  28. package/src/pages/MediaGalleryPage.tsx +74 -11
  29. package/src/pages/MediaLightbox.tsx +93 -1
  30. package/src/pages/SettingsUsagePage.tsx +23 -1
  31. package/src/pages/media-grid.ts +13 -0
  32. package/src/pages/ui-kit/UiKitApp.tsx +164 -0
  33. package/src/pages/ui-kit/buttons.tsx +30 -0
  34. package/src/pages/ui-kit/catalog.tsx +41 -0
  35. package/src/pages/ui-kit/colors.tsx +95 -0
  36. package/src/pages/ui-kit/devbar.tsx +160 -0
  37. package/src/pages/ui-kit/feedback.tsx +39 -0
  38. package/src/pages/ui-kit/fields.tsx +47 -0
  39. package/src/pages/ui-kit/lists.tsx +19 -0
  40. package/src/pages/ui-kit/overlays.tsx +39 -0
  41. package/src/pages/ui-kit/path.ts +9 -0
  42. package/src/pages/ui-kit/sections.tsx +32 -0
  43. package/src/pages/ui-kit/surfaces.tsx +121 -0
  44. package/src/pages/ui-kit/topic.tsx +112 -0
  45. package/src/pages/ui-kit/topics.ts +71 -0
  46. package/src/pages/ui-kit/type.tsx +55 -0
  47. package/src/preview-frame-radius.ts +51 -0
  48. package/src/preview-frame.tsx +108 -49
  49. package/src/shell-resets.css +155 -0
  50. package/src/site-bar.tsx +1810 -425
  51. package/src/site-dashboard-href.ts +21 -0
  52. package/src/site-devbar-overlay-inject.ts +15 -0
  53. package/src/site-devbar-overlay.css +217 -0
  54. package/src/site-pointer.ts +1 -1
  55. package/src/site-publish-menu.tsx +33 -0
  56. package/src/site-widget-styles.ts +7 -0
  57. package/src/site-widget.tsx +61 -21
  58. package/src/studio-prose-ui.css +39 -0
  59. package/src/theme/ThemeProvider.tsx +4 -1
  60. package/src/workspace-path.ts +10 -6
  61. package/dist/chunks/EmbedPublishPage-CtIlaeGO.js +0 -149
  62. package/dist/chunks/UiKitPage-DcnSQ-Hf.js +0 -173
  63. package/dist/chunks/WorkspaceRoutes-DVpUOaMV.js +0 -59550
  64. package/dist/chunks/status-bar-action-C0fsAWvD.js +0 -30618
  65. package/src/pages/UiKitPage.tsx +0 -331
@@ -0,0 +1,2410 @@
1
+ import { jsxs as s, jsx as t, Fragment as U } from "react/jsx-runtime";
2
+ import { K as $, P as ue, Q as Zt, p as Rt, U as Qt, f as at, V as Fe, W as Jt, X as en, Y as tn, Z as nn, _ as rn, z as on, k as an, $ as sn, a0 as ln, a1 as cn, a2 as He, a3 as me, a4 as Ne, a5 as st, a6 as dn, a7 as un, T as hn, a8 as pn, a9 as gn, aa as mn, ab as fn, ac as bn, ad as xn, y as vn, ae as $n, N as kn, af as wn } from "./WorkspaceRoutes-BKKEkAq7.js";
3
+ import { useRef as k, useState as f, useLayoutEffect as te, useCallback as Ke, useEffect as z, useMemo as yn, useId as Ue } from "react";
4
+ import { createPortal as Me } from "react-dom";
5
+ import { L as Nn, a as lt } from "./dashboard-8rjkfEXl.js";
6
+ function O({
7
+ title: n,
8
+ lede: r,
9
+ children: o
10
+ }) {
11
+ return /* @__PURE__ */ s("div", { className: "x78zum5 xdt5ytf x14n5cft x1kozois", children: [
12
+ /* @__PURE__ */ s("header", { className: "x78zum5 xdt5ytf x1ndbd79 xiky8lt", children: [
13
+ /* @__PURE__ */ t($, { as: "h1", size: "display", weight: "semibold", children: n }),
14
+ /* @__PURE__ */ t($, { tone: "muted", size: "sm", children: r })
15
+ ] }),
16
+ /* @__PURE__ */ t("div", { className: "x78zum5 xdt5ytf x14n5cft", children: o })
17
+ ] });
18
+ }
19
+ function Ee({
20
+ children: n
21
+ }) {
22
+ return /* @__PURE__ */ t("div", { className: "xrvj5dj xnby9oq xwaa2ar xe93d63 x7a106z xcqouw7", children: n });
23
+ }
24
+ function Sn({
25
+ children: n
26
+ }) {
27
+ return /* @__PURE__ */ t("div", { className: "x78zum5 x1a02dak x6s0dn4 x3smv4v", children: n });
28
+ }
29
+ function b({
30
+ label: n,
31
+ children: r
32
+ }) {
33
+ return /* @__PURE__ */ s("section", { className: "x78zum5 xdt5ytf x1ndbd79 xeuugli", children: [
34
+ /* @__PURE__ */ t("h2", { className: "x1ghz6dp x1l3a84d x1s688f xjat59b xwn7fz2 xqjzbou", children: n }),
35
+ /* @__PURE__ */ t("div", { className: "x78zum5 xdt5ytf x1qjc9v5 x3smv4v xh8yej3 xeuugli", children: r })
36
+ ] });
37
+ }
38
+ const P = [
39
+ {
40
+ slug: "colors",
41
+ title: "Colors",
42
+ group: "Foundations",
43
+ lede: "Color tokens paint surfaces, text, and status, and follow the active theme."
44
+ },
45
+ {
46
+ slug: "type",
47
+ title: "Type",
48
+ group: "Foundations",
49
+ lede: "Text sizes and tones for titles, body copy, and metadata."
50
+ },
51
+ {
52
+ slug: "surfaces",
53
+ title: "Surfaces",
54
+ group: "Foundations",
55
+ lede: "Spacing, radii, and the background roles stacked the way a page stacks them."
56
+ },
57
+ {
58
+ slug: "sections",
59
+ title: "Sections",
60
+ group: "Foundations",
61
+ lede: "Page header, panel, and stack are how a settings page is built."
62
+ },
63
+ {
64
+ slug: "buttons",
65
+ title: "Buttons",
66
+ group: "Components",
67
+ lede: "Variants for a primary action, a secondary action, a quiet action, and danger."
68
+ },
69
+ {
70
+ slug: "fields",
71
+ title: "Fields",
72
+ group: "Components",
73
+ lede: "Text, select, and multiline fields, including a hint and a disabled control."
74
+ },
75
+ {
76
+ slug: "lists",
77
+ title: "Lists",
78
+ group: "Components",
79
+ lede: "A list of rows that link to a document."
80
+ },
81
+ {
82
+ slug: "overlays",
83
+ title: "Overlays",
84
+ group: "Components",
85
+ lede: "A confirm dialog and a tooltip."
86
+ },
87
+ {
88
+ slug: "feedback",
89
+ title: "Feedback",
90
+ group: "Components",
91
+ lede: "Status bars, and the success and danger text tones."
92
+ },
93
+ {
94
+ slug: "devbar",
95
+ title: "DevBar",
96
+ group: "Host",
97
+ lede: "The host bar a site mounts. These specimens do not call the preview API."
98
+ }
99
+ ];
100
+ function Mn(n) {
101
+ const r = P.find((o) => o.slug === n);
102
+ return r ? r.slug : "colors";
103
+ }
104
+ const ct = P.find((n) => n.slug === "buttons"), En = ["primary", "secondary", "ghost", "danger"];
105
+ function Cn() {
106
+ return /* @__PURE__ */ t(O, { title: ct.title, lede: ct.lede, children: /* @__PURE__ */ t(Ee, { children: En.map((n) => /* @__PURE__ */ t(b, { label: n, children: /* @__PURE__ */ s(Sn, { children: [
107
+ /* @__PURE__ */ t(ue, { variant: n, children: n }),
108
+ /* @__PURE__ */ t(ue, { variant: n, disabled: !0, children: "disabled" }),
109
+ /* @__PURE__ */ t(Zt, { variant: n, to: "/__ui/buttons", children: "link" })
110
+ ] }) }, n)) }) });
111
+ }
112
+ const dt = P.find((n) => n.slug === "colors");
113
+ function zn() {
114
+ return /* @__PURE__ */ t(O, { title: dt.title, lede: dt.lede, children: /* @__PURE__ */ t("div", { className: "xrvj5dj x1sipb5g x11cgr9k x1kk4rku", children: Rn.map(([n, r]) => /* @__PURE__ */ s("figure", { className: "x78zum5 xdt5ytf x3smv4v x1ghz6dp xeuugli", children: [
115
+ /* @__PURE__ */ t("div", { ...Rt(w.chip, r) }),
116
+ /* @__PURE__ */ t("figcaption", { className: "x1ar5oo6 x10qp4ay x111yfic", children: n })
117
+ ] }, n)) }) });
118
+ }
119
+ const w = {
120
+ chip: {
121
+ kZKoxP: "xy75621",
122
+ kaIpWk: "x13oidi",
123
+ kMzoRj: "xmkeg23",
124
+ ksu8eU: "x1y0btm7",
125
+ kVAM5u: "x1j0qoeq",
126
+ $$css: !0
127
+ },
128
+ bgApp: {
129
+ kWkggS: "x86kjsi",
130
+ $$css: !0
131
+ },
132
+ bgSidebar: {
133
+ kWkggS: "x1jtkcfc",
134
+ $$css: !0
135
+ },
136
+ bgPanel: {
137
+ kWkggS: "x1d0qn7y",
138
+ $$css: !0
139
+ },
140
+ bgPanelInset: {
141
+ kWkggS: "x69djma",
142
+ $$css: !0
143
+ },
144
+ bgSurface: {
145
+ kWkggS: "x1hb2obb",
146
+ $$css: !0
147
+ },
148
+ bgHover: {
149
+ kWkggS: "xofhlkk",
150
+ $$css: !0
151
+ },
152
+ bgActive: {
153
+ kWkggS: "xaaunc5",
154
+ $$css: !0
155
+ },
156
+ bgInput: {
157
+ kWkggS: "xawfm1v",
158
+ $$css: !0
159
+ },
160
+ bgStatus: {
161
+ kWkggS: "x1f2181x",
162
+ $$css: !0
163
+ },
164
+ text: {
165
+ kWkggS: "x1bldc27",
166
+ $$css: !0
167
+ },
168
+ textMuted: {
169
+ kWkggS: "x1nc039n",
170
+ $$css: !0
171
+ },
172
+ textInverse: {
173
+ kWkggS: "xoor36a",
174
+ $$css: !0
175
+ },
176
+ border: {
177
+ kWkggS: "xz7mq1p",
178
+ $$css: !0
179
+ },
180
+ accent: {
181
+ kWkggS: "xrb6rkd",
182
+ $$css: !0
183
+ },
184
+ accentHover: {
185
+ kWkggS: "x1iiistc",
186
+ $$css: !0
187
+ },
188
+ accentMuted: {
189
+ kWkggS: "xkkeql0",
190
+ $$css: !0
191
+ },
192
+ danger: {
193
+ kWkggS: "x1qc5ydl",
194
+ $$css: !0
195
+ },
196
+ success: {
197
+ kWkggS: "x1c15u7q",
198
+ $$css: !0
199
+ },
200
+ overlay: {
201
+ kWkggS: "xplmcw3",
202
+ $$css: !0
203
+ },
204
+ focus: {
205
+ kWkggS: "xc54rw4",
206
+ $$css: !0
207
+ }
208
+ }, Rn = [["bgApp", w.bgApp], ["bgSidebar", w.bgSidebar], ["bgPanel", w.bgPanel], ["bgPanelInset", w.bgPanelInset], ["bgSurface", w.bgSurface], ["bgHover", w.bgHover], ["bgActive", w.bgActive], ["bgInput", w.bgInput], ["bgStatus", w.bgStatus], ["text", w.text], ["textMuted", w.textMuted], ["textInverse", w.textInverse], ["border", w.border], ["accent", w.accent], ["accentHover", w.accentHover], ["accentMuted", w.accentMuted], ["danger", w.danger], ["success", w.success], ["overlay", w.overlay], ["focus", w.focus]];
209
+ function ut(n, r, o, a = "en") {
210
+ if (!(n != null && n.trim())) return;
211
+ const d = n.replace(/\/+$/, "");
212
+ return !r || !o ? d : `${d}${Qt(o, r.type, r.slug, r.locale, a)}`;
213
+ }
214
+ const he = "cubic-bezier(0.23, 1, 0.32, 1)", Oe = "cubic-bezier(0.55, 0, 1, 0.45)", In = "cubic-bezier(0.32, 0.72, 0, 1)", _n = 550, An = 300, Ln = 750, Bn = 360, It = "backmatter.devbar.mode";
215
+ function Pn(n) {
216
+ const r = n.activity ?? null, o = r ? r.type : n.siteMode === "preview" && n.changeCount > 0 ? "changes" : "idle", a = o === "published" ? "live" : n.siteMode;
217
+ return { mode: a, row: o, modeLabel: a === "preview" ? "Exit preview" : "Enter preview", announce: a === "preview" ? "Preview on, drafts visible" : "Live site" };
218
+ }
219
+ function Tn(n, r) {
220
+ return {
221
+ x: r.left + r.width / 2 - n.left,
222
+ y: r.top + r.height / 2 - n.top
223
+ };
224
+ }
225
+ function Wn(n, r) {
226
+ return Math.abs(r - n) > 1;
227
+ }
228
+ function se() {
229
+ return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
230
+ }
231
+ function Hn() {
232
+ if (typeof sessionStorage > "u") return null;
233
+ try {
234
+ const n = sessionStorage.getItem(It);
235
+ return n === "live" || n === "preview" ? n : null;
236
+ } catch {
237
+ return null;
238
+ }
239
+ }
240
+ const ht = "backmatter.devbar.highlight", pt = "backmatter.devbar.agent-preview", Dn = "backmatter-theme";
241
+ function qn(n) {
242
+ const r = n == null ? void 0 : n.getItem(Dn);
243
+ return r === "light" || r === "dark" || r === "system" ? r : "system";
244
+ }
245
+ function jn(n, r) {
246
+ return n === "system" ? r ? "dark" : "light" : n;
247
+ }
248
+ function gt(n, r, o) {
249
+ const a = n == null ? void 0 : n.getItem(r);
250
+ return a === "1" ? !0 : a === "0" ? !1 : o;
251
+ }
252
+ function mt(n, r, o) {
253
+ n == null || n.setItem(r, o ? "1" : "0");
254
+ }
255
+ function De(n) {
256
+ if (!(typeof sessionStorage > "u"))
257
+ try {
258
+ sessionStorage.setItem(It, n);
259
+ } catch {
260
+ }
261
+ }
262
+ const Fn = 20, ft = 16, Kn = 12, Vn = 8, _t = 12;
263
+ function Un(n) {
264
+ if (!n) return null;
265
+ const r = Number.parseInt(n.split(".")[0] ?? "", 10);
266
+ return Number.isFinite(r) ? r : null;
267
+ }
268
+ function At(n) {
269
+ return /Macintosh|Mac OS X/.test(n);
270
+ }
271
+ function On(n) {
272
+ return !At(n) || /Firefox\//.test(n) ? !1 : /Chrome\/|Chromium\/|Edg\/|OPR\/|Brave\//.test(n);
273
+ }
274
+ function Ve(n, r) {
275
+ if (/Windows/.test(n)) return Vn;
276
+ if (!At(n)) return _t;
277
+ const o = Un(r);
278
+ return On(n) ? o !== null && o >= 26 ? Fn : (o !== null && o >= 15, ft) : Kn;
279
+ }
280
+ const be = "backmatter-preview-frame";
281
+ function Gn() {
282
+ if (typeof navigator > "u") return Promise.resolve(void 0);
283
+ const n = navigator.userAgentData;
284
+ return n != null && n.getHighEntropyValues ? n.getHighEntropyValues(["platformVersion"]).then((r) => r.platformVersion) : Promise.resolve(void 0);
285
+ }
286
+ function Xn() {
287
+ return typeof navigator > "u" ? _t : Ve(navigator.userAgent);
288
+ }
289
+ function bt(n) {
290
+ if (n !== void 0 && Number.isFinite(n) && n >= 0) return n;
291
+ if (typeof document < "u") {
292
+ const r = getComputedStyle(document.documentElement).getPropertyValue("--bm-preview-frame-radius").trim();
293
+ if (r) {
294
+ const o = Number.parseFloat(r);
295
+ if (Number.isFinite(o) && o >= 0) return o;
296
+ }
297
+ }
298
+ return Xn();
299
+ }
300
+ const Lt = "oklch(0.56 0.21 295)";
301
+ function Yn({
302
+ active: n,
303
+ radius: r
304
+ }) {
305
+ const o = k(null), a = k(null), [d, m] = f(() => bt(r));
306
+ return te(() => {
307
+ if (r !== void 0) {
308
+ m(bt(r));
309
+ return;
310
+ }
311
+ const h = navigator.userAgent;
312
+ m(Ve(h)), Gn().then((u) => {
313
+ u !== void 0 && m(Ve(h, u));
314
+ });
315
+ }, [r]), te(() => {
316
+ const h = o.current, u = a.current;
317
+ a.current = n, !(!h || u === null || u || !n || se()) && h.animate(
318
+ [
319
+ { borderWidth: "3px" },
320
+ { borderWidth: "7px", offset: 0.5 },
321
+ { borderWidth: "3px" }
322
+ ],
323
+ { duration: 700, delay: 180, easing: he }
324
+ );
325
+ }, [n]), /* @__PURE__ */ s(U, { children: [
326
+ /* @__PURE__ */ t("style", { children: Zn }),
327
+ /* @__PURE__ */ t(
328
+ "div",
329
+ {
330
+ ref: o,
331
+ className: be,
332
+ "data-backmatter-preview-frame": "",
333
+ "data-active": n ? "true" : "false",
334
+ style: { "--bm-preview-frame-radius": `${d}px` },
335
+ "aria-hidden": !0
336
+ }
337
+ )
338
+ ] });
339
+ }
340
+ const Zn = `
341
+ .${be} {
342
+ position: fixed;
343
+ inset: 0;
344
+ z-index: 2147482999;
345
+ box-sizing: border-box;
346
+ pointer-events: none;
347
+ border: 3px solid ${Lt};
348
+ border-radius: 0 0 var(--bm-preview-frame-radius, 12px) var(--bm-preview-frame-radius, 12px);
349
+ background: transparent;
350
+ clip-path: circle(0% at 100% 100%);
351
+ transition: clip-path ${Bn}ms ${Oe};
352
+ }
353
+ .${be}[data-active="true"] {
354
+ /* 150% is shorter than the viewport diagonal — the ring never reached the top. */
355
+ clip-path: circle(150vmax at 100% 100%);
356
+ transition: clip-path ${Ln}ms ${he} 80ms;
357
+ }
358
+ @media (prefers-reduced-motion: reduce) {
359
+ .${be} {
360
+ transition: none;
361
+ clip-path: none;
362
+ opacity: 0;
363
+ }
364
+ .${be}[data-active="true"] {
365
+ opacity: 1;
366
+ }
367
+ }
368
+ `, e = "backmatter-devbar", Qn = "/api/backmatter/preview", Jn = 10, er = 360;
369
+ function xt(n, r) {
370
+ return `${n}:${r.trim().toLowerCase()}`;
371
+ }
372
+ function tr({
373
+ label: n,
374
+ branch: r,
375
+ tree: o,
376
+ doc: a,
377
+ exiting: d,
378
+ chatOpen: m,
379
+ publishOpen: h,
380
+ changeCount: u,
381
+ lineDiff: p,
382
+ activity: c = null,
383
+ previewEntryPath: R = Qn,
384
+ siteMode: y = "preview",
385
+ frame: D = !1,
386
+ frameRadius: X,
387
+ entrance: I = "auto",
388
+ dashboardHref: N,
389
+ onExit: C,
390
+ onEnterPreview: S,
391
+ onToggleChat: E,
392
+ onTogglePublish: g,
393
+ onStop: M,
394
+ onViewLive: q,
395
+ onPublishedDone: _,
396
+ onSignOut: j,
397
+ onPublishAnchor: Y
398
+ }) {
399
+ const le = k(null), ce = k(null), Z = k(null), G = k(null), x = k(null), A = k(null), T = k(null), Q = k(null), [ne, pe] = f(null), re = Ke((i) => {
400
+ if (le.current = i, !i) {
401
+ pe(null);
402
+ return;
403
+ }
404
+ const l = i.shadowRoot ?? i.attachShadow({ mode: "open" });
405
+ pe((v) => v === l ? v : l);
406
+ }, []), [ie, xe] = f(null), [F, L] = f(null), [ve, Ce] = f(y), [ze, Tt] = f(!1), Re = k(!1), oe = k(null), Ge = k(0), Xe = k(!1), Ye = k(!1), W = k({
407
+ toggleHidden: () => {
408
+ },
409
+ onModeKey: (i) => {
410
+ },
411
+ onEscape: () => {
412
+ },
413
+ openDashboard: () => !1,
414
+ openShortcuts: () => {
415
+ }
416
+ }), Ze = k(!0), [Ie, Wt] = f("system"), [_e, Qe] = f(!0), [Je, et] = f(!0), [Ht, $e] = f("main"), [Dt, qt] = f(""), [Ae, Le] = f(null), [tt, jt] = f("en");
417
+ z(() => {
418
+ const i = a == null ? void 0 : a.workspaceId;
419
+ if (!i) {
420
+ Le(null);
421
+ return;
422
+ }
423
+ let l = !1;
424
+ return at(i).then(({ workspace: v }) => {
425
+ l || (Le(v.slug), jt(v.locales[0] ?? "en"));
426
+ }).catch(() => {
427
+ l || Le(null);
428
+ }), () => {
429
+ l = !0;
430
+ };
431
+ }, [a == null ? void 0 : a.workspaceId]);
432
+ const Be = yn(
433
+ () => ut(N, a, Ae, tt),
434
+ [N, a, Ae, tt]
435
+ ), Ft = Ke((i) => {
436
+ Z.current = i, !(i && !(i.getRootNode() instanceof ShadowRoot)) && xe(i);
437
+ }, []), Pe = Pn({ siteMode: ve, changeCount: u, activity: c }), de = Pe.mode, Kt = (c == null ? void 0 : c.type) === "editing" ? `editing:${c.field}` : (c == null ? void 0 : c.type) === "publishing" ? `publishing:${c.steps.map((i) => `${i.state}:${i.label}`).join("|")}` : (c == null ? void 0 : c.type) === "published" ? `published:${c.sha}` : "", Te = `${ve}|${Pe.row}|${u}|${(p == null ? void 0 : p.added) ?? ""}|${(p == null ? void 0 : p.removed) ?? ""}|${n}|${Kt}`;
438
+ z(() => {
439
+ qt(location.host);
440
+ const i = je(), l = qn(i);
441
+ et(gt(i, pt, !0)), Wt(l), Qe(gt(i, ht, !0));
442
+ }, []), z(() => {
443
+ if (kt(Ie), Ie !== "system" || typeof matchMedia != "function") return;
444
+ const i = matchMedia("(prefers-color-scheme: dark)"), l = () => kt("system");
445
+ return i.addEventListener("change", l), () => i.removeEventListener("change", l);
446
+ }, [Ie]), z(() => (document.documentElement.classList.toggle("backmatter-blocks", _e), () => document.documentElement.classList.remove("backmatter-blocks")), [_e]), z(() => {
447
+ const i = le.current;
448
+ if (!i) return;
449
+ const l = document.documentElement, v = `${e}-pointing`, H = () => i.classList.toggle(v, l.classList.contains("backmatter-pointing"));
450
+ H();
451
+ const J = new MutationObserver(H);
452
+ return J.observe(l, { attributes: !0, attributeFilter: ["class"] }), () => J.disconnect();
453
+ }, []), z(() => {
454
+ if (oe.current && oe.current !== y && !d) {
455
+ oe.current = null, De(y), Ce(y);
456
+ return;
457
+ }
458
+ oe.current || Ce(y), oe.current === y && (oe.current = null);
459
+ }, [y, d]), z(() => {
460
+ if (!F) return;
461
+ function i(l) {
462
+ const v = ce.current;
463
+ v && l.composedPath().includes(v) || L(null);
464
+ }
465
+ return document.addEventListener("pointerdown", i), () => document.removeEventListener("pointerdown", i);
466
+ }, [F]), te(() => {
467
+ const i = Z.current, l = T.current;
468
+ !i || !l || F !== "settings" || cr(i, l);
469
+ }, [F, ie, Te]), te(() => {
470
+ if (!Y) return;
471
+ const i = A.current;
472
+ if (!h || !i) {
473
+ Y(null);
474
+ return;
475
+ }
476
+ const l = () => Y(i.getBoundingClientRect());
477
+ return l(), window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
478
+ window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
479
+ };
480
+ }, [h, Y, Te, ie]), z(() => {
481
+ function i(l) {
482
+ if (!ar(l.composedPath()[0] ?? null)) {
483
+ if ((l.metaKey || l.ctrlKey) && l.key === ".") {
484
+ l.preventDefault(), W.current.toggleHidden();
485
+ return;
486
+ }
487
+ if ((l.metaKey || l.ctrlKey) && l.shiftKey && l.key.toLowerCase() === "p") {
488
+ l.preventDefault();
489
+ const v = x.current;
490
+ if (!v || v.disabled) return;
491
+ W.current.onModeKey(v);
492
+ return;
493
+ }
494
+ if ((l.metaKey || l.ctrlKey) && !l.shiftKey && l.key.toLowerCase() === "d") {
495
+ if (!W.current.openDashboard()) return;
496
+ l.preventDefault();
497
+ return;
498
+ }
499
+ if (l.key === "?" && !l.metaKey && !l.ctrlKey && !l.altKey) {
500
+ l.preventDefault(), W.current.openShortcuts();
501
+ return;
502
+ }
503
+ if (l.key === "Escape") {
504
+ W.current.onEscape();
505
+ return;
506
+ }
507
+ Jt(l) === "chat" && L(null);
508
+ }
509
+ }
510
+ return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
511
+ }, []), te(() => {
512
+ var ot;
513
+ const i = Z.current;
514
+ if (!ne || !i || !(i.getRootNode() instanceof ShadowRoot)) return;
515
+ if (!Ye.current) {
516
+ Ye.current = !0;
517
+ const ae = I !== "play" && Hn() === y;
518
+ if (I !== "play" && De(y), ae)
519
+ (ot = ce.current) == null || ot.setAttribute("data-settled", "true"), requestAnimationFrame(() => {
520
+ requestAnimationFrame(() => {
521
+ var ye;
522
+ return (ye = ce.current) == null ? void 0 : ye.removeAttribute("data-settled");
523
+ });
524
+ });
525
+ else if (se())
526
+ i.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 200, easing: "ease", fill: "backwards" });
527
+ else {
528
+ const ye = i.animate(
529
+ [{ transform: "translateY(100%)" }, { transform: "none" }],
530
+ { duration: 460, easing: he, delay: 600, fill: "backwards" }
531
+ );
532
+ ye.id = "rise", G.current && qe(G.current, { delay: 740 });
533
+ }
534
+ }
535
+ const l = !Xe.current;
536
+ Xe.current = !0;
537
+ const H = i.getAnimations().some((ae) => ae.id === "w") ? i.offsetWidth : Ge.current;
538
+ i.getAnimations().filter((ae) => ae.id === "w").forEach((ae) => ae.cancel());
539
+ const J = i.offsetWidth;
540
+ if (Ge.current = J, l) return;
541
+ const B = G.current;
542
+ if (B && (se() ? B.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: "ease", fill: "backwards" }) : qe(B, { delay: 40, blur: !0 })), se() || !Wn(H, J)) return;
543
+ const Yt = i.animate(
544
+ [{ width: `${H}px` }, { width: `${J}px` }],
545
+ { duration: 380, easing: In }
546
+ );
547
+ Yt.id = "w";
548
+ }, [ne, Te, I, y]);
549
+ const ke = (c == null ? void 0 : c.type) === "published" ? c.sha : "";
550
+ te(() => {
551
+ const i = Q.current;
552
+ !ke || !i || se() || i.animate(
553
+ [
554
+ { transform: "scale(0.5)", opacity: 0 },
555
+ { transform: "none", opacity: 1 }
556
+ ],
557
+ { duration: 420, delay: 140, easing: "cubic-bezier(.34, 1.56, .64, 1)", fill: "backwards" }
558
+ );
559
+ }, [ke]), z(() => {
560
+ if (!ke || !_) return;
561
+ const i = window.setTimeout(_, 3200);
562
+ return () => window.clearTimeout(i);
563
+ }, [ke, _]);
564
+ function We(i, l) {
565
+ if (d || i === ve || i === "preview" && !S) return;
566
+ const v = Z.current;
567
+ if (v) {
568
+ const H = Tn(v.getBoundingClientRect(), l.getBoundingClientRect());
569
+ v.style.setProperty("--ox", `${H.x}px`), v.style.setProperty("--oy", `${H.y}px`);
570
+ }
571
+ i === "live" && (L(null), m && E(), h && g()), oe.current = i, De(i), Ce(i), i === "preview" ? S == null || S() : C();
572
+ }
573
+ function nt(i) {
574
+ if (Re.current === i) return;
575
+ Re.current = i, L(null), Tt(i);
576
+ const l = Z.current;
577
+ if (!l || !(l.getRootNode() instanceof ShadowRoot)) return;
578
+ const v = l.getRootNode(), H = v instanceof ShadowRoot ? v.activeElement : null;
579
+ if (i && H instanceof HTMLElement && H.blur(), l.getAnimations().filter((B) => B.id === "hide" || B.id === "rise").forEach((B) => B.cancel()), se()) {
580
+ const B = l.animate(
581
+ [{ opacity: i ? 1 : 0 }, { opacity: i ? 0 : 1 }],
582
+ { duration: 200, easing: "ease", fill: "forwards" }
583
+ );
584
+ B.id = i ? "hide" : "rise";
585
+ return;
586
+ }
587
+ if (i) {
588
+ const B = l.animate(
589
+ [{ transform: "translateY(0)" }, { transform: "translateY(100%)" }],
590
+ { duration: 220, easing: Oe, fill: "forwards" }
591
+ );
592
+ B.id = "hide";
593
+ return;
594
+ }
595
+ const J = l.animate(
596
+ [{ transform: "translateY(100%)" }, { transform: "none" }],
597
+ { duration: 460, easing: he, fill: "backwards" }
598
+ );
599
+ J.id = "rise", G.current && qe(G.current, { delay: 140 });
600
+ }
601
+ W.current.openDashboard = () => N ? ((async () => {
602
+ let i = Be ?? N;
603
+ if (a != null && a.workspaceId && a.type && a.slug && !Ae)
604
+ try {
605
+ const { workspace: l } = await at(a.workspaceId);
606
+ i = ut(N, a, l.slug, l.locales[0] ?? "en") ?? i;
607
+ } catch {
608
+ }
609
+ location.assign(i);
610
+ })(), !0) : !1, W.current.openShortcuts = () => {
611
+ $e("shortcuts"), L("settings");
612
+ }, W.current.toggleHidden = () => nt(!Re.current), W.current.onModeKey = (i) => We(de === "preview" ? "live" : "preview", i), W.current.onEscape = () => {
613
+ if (F) {
614
+ L(null);
615
+ return;
616
+ }
617
+ if (h) {
618
+ g();
619
+ return;
620
+ }
621
+ (c == null ? void 0 : c.type) === "editing" && (M == null || M());
622
+ };
623
+ function rt(i) {
624
+ d || (L(null), h && g(), ve === "live" && Ze.current && We("preview", i), E());
625
+ }
626
+ function Vt() {
627
+ d || (L(null), m && E(), g());
628
+ }
629
+ Ze.current = Je;
630
+ function Ut(i) {
631
+ h && g(), $e(i), L((l) => l === "settings" && i === "main" ? null : "settings");
632
+ }
633
+ function Ot() {
634
+ h && g(), L((i) => i === "page" ? null : "page");
635
+ }
636
+ const Gt = !!d || de === "live" && !S, Xt = !a || u <= 0, we = /* @__PURE__ */ t(
637
+ nr,
638
+ {
639
+ mode: de,
640
+ disabled: Gt,
641
+ buttonRef: x,
642
+ onClick: (i) => We(de === "preview" ? "live" : "preview", i.currentTarget)
643
+ }
644
+ );
645
+ let ge;
646
+ (c == null ? void 0 : c.type) === "editing" ? ge = /* @__PURE__ */ s(U, { children: [
647
+ we,
648
+ /* @__PURE__ */ t("span", { className: `${e}-spin`, "aria-hidden": !0 }),
649
+ /* @__PURE__ */ t("span", { className: `${e}-shimmer`, children: "Agent is editing" }),
650
+ /* @__PURE__ */ t("code", { className: `${e}-field`, children: c.field }),
651
+ /* @__PURE__ */ s("button", { type: "button", className: `${e}-btn`, onClick: () => M == null ? void 0 : M(), children: [
652
+ "Stop",
653
+ /* @__PURE__ */ t("kbd", { className: `${e}-kbd`, children: "esc" })
654
+ ] })
655
+ ] }) : (c == null ? void 0 : c.type) === "publishing" ? ge = /* @__PURE__ */ s(U, { children: [
656
+ we,
657
+ /* @__PURE__ */ t("span", { className: `${e}-steps`, children: c.steps.map((i, l) => /* @__PURE__ */ s("span", { className: `${e}-step`, children: [
658
+ l > 0 ? /* @__PURE__ */ t("span", { className: `${e}-dash`, "aria-hidden": !0, children: "—" }) : null,
659
+ /* @__PURE__ */ t(or, { state: i.state }),
660
+ /* @__PURE__ */ t("span", { children: i.label })
661
+ ] }, `${i.label}:${l}`)) })
662
+ ] }) : (c == null ? void 0 : c.type) === "published" ? ge = /* @__PURE__ */ s(U, { children: [
663
+ we,
664
+ /* @__PURE__ */ t("span", { ref: Q, className: `${e}-check`, "aria-hidden": !0, children: "✓" }),
665
+ /* @__PURE__ */ s("span", { className: `${e}-published`, children: [
666
+ "Published ",
667
+ /* @__PURE__ */ t("code", { className: `${e}-field`, children: c.sha }),
668
+ /* @__PURE__ */ s("span", { className: `${e}-when`, children: [
669
+ " · ",
670
+ c.when
671
+ ] })
672
+ ] }),
673
+ /* @__PURE__ */ t("button", { type: "button", className: `${e}-btn`, onClick: () => (q ?? C)(), children: "View live" }),
674
+ /* @__PURE__ */ t(
675
+ vt,
676
+ {
677
+ pressed: m,
678
+ disabled: !a,
679
+ shortcut: Fe(),
680
+ onClick: (i) => rt(i.currentTarget)
681
+ }
682
+ )
683
+ ] }) : ge = /* @__PURE__ */ s(U, { children: [
684
+ we,
685
+ /* @__PURE__ */ t(
686
+ br,
687
+ {
688
+ label: n,
689
+ doc: a,
690
+ dashboardHref: Be,
691
+ bar: ie,
692
+ open: F === "page",
693
+ expanded: F === "page",
694
+ onToggle: Ot
695
+ }
696
+ ),
697
+ /* @__PURE__ */ t("span", { className: `${e}-rule`, "aria-hidden": !0 }),
698
+ /* @__PURE__ */ t(
699
+ vt,
700
+ {
701
+ pressed: m,
702
+ disabled: !a,
703
+ shortcut: Fe(),
704
+ onClick: (i) => rt(i.currentTarget)
705
+ }
706
+ ),
707
+ /* @__PURE__ */ t(
708
+ rr,
709
+ {
710
+ buttonRef: A,
711
+ open: h,
712
+ count: u,
713
+ disabled: Xt,
714
+ onClick: Vt
715
+ }
716
+ ),
717
+ /* @__PURE__ */ t(
718
+ sr,
719
+ {
720
+ buttonRef: T,
721
+ open: F === "settings",
722
+ onClick: () => Ut("main")
723
+ }
724
+ )
725
+ ] });
726
+ const it = /* @__PURE__ */ s(U, { children: [
727
+ /* @__PURE__ */ t("style", { children: wr }),
728
+ /* @__PURE__ */ s(
729
+ "div",
730
+ {
731
+ ref: ce,
732
+ className: `${e}-root`,
733
+ "data-mode": de,
734
+ "data-branch": r || void 0,
735
+ children: [
736
+ D ? /* @__PURE__ */ t(Yn, { active: de === "preview", radius: X }) : null,
737
+ /* @__PURE__ */ s(
738
+ "footer",
739
+ {
740
+ ref: Ft,
741
+ "aria-label": "Backmatter",
742
+ "aria-hidden": ze || void 0,
743
+ inert: ze ? !0 : void 0,
744
+ "data-hidden": ze ? "true" : "false",
745
+ "data-branch": r || void 0,
746
+ className: e,
747
+ children: [
748
+ /* @__PURE__ */ s("div", { className: `${e}-clip`, children: [
749
+ /* @__PURE__ */ t("span", { className: `${e}-flood`, "aria-hidden": !0 }),
750
+ /* @__PURE__ */ t("div", { ref: G, className: `${e}-row`, children: ge }),
751
+ (c == null ? void 0 : c.type) === "publishing" ? /* @__PURE__ */ t(
752
+ "span",
753
+ {
754
+ className: `${e}-progress`,
755
+ style: { width: `${Math.max(0, Math.min(1, c.progress)) * 100}%` },
756
+ "aria-hidden": !0
757
+ }
758
+ ) : null
759
+ ] }),
760
+ /* @__PURE__ */ t("div", { className: `${e}-sr`, "aria-live": "polite", children: Pe.announce })
761
+ ]
762
+ }
763
+ ),
764
+ /* @__PURE__ */ t(
765
+ lr,
766
+ {
767
+ open: F === "settings",
768
+ pane: Ht,
769
+ hostName: Dt,
770
+ branch: r,
771
+ bar: ie,
772
+ highlightBlocks: _e,
773
+ previewAgent: Je,
774
+ dashboardHref: Be,
775
+ onHighlight: (i) => {
776
+ Qe(i), mt(je(), ht, i);
777
+ },
778
+ onPreviewAgent: (i) => {
779
+ et(i), mt(je(), pt, i);
780
+ },
781
+ onShortcuts: () => $e("shortcuts"),
782
+ onBack: () => $e("main"),
783
+ onDashboard: () => {
784
+ W.current.openDashboard();
785
+ },
786
+ onHide: () => nt(!0),
787
+ onSwitchBranch: r ? () => L("branch") : void 0,
788
+ onSignOut: j
789
+ }
790
+ ),
791
+ r ? /* @__PURE__ */ t(
792
+ xr,
793
+ {
794
+ branch: r,
795
+ tree: o,
796
+ workspaceId: (a == null ? void 0 : a.workspaceId) ?? null,
797
+ previewEntryPath: R,
798
+ bar: ie,
799
+ open: F === "branch",
800
+ onClose: () => L(null)
801
+ }
802
+ ) : null
803
+ ]
804
+ }
805
+ )
806
+ ] });
807
+ return /* @__PURE__ */ s("div", { ref: re, className: `${e}-host`, "data-backmatter-devbar": "", children: [
808
+ /* @__PURE__ */ t("style", { children: kr }),
809
+ ne ? Me(it, ne) : /* @__PURE__ */ t(
810
+ "template",
811
+ {
812
+ shadowrootmode: "open",
813
+ children: it
814
+ }
815
+ )
816
+ ] });
817
+ }
818
+ function nr({
819
+ mode: n,
820
+ disabled: r,
821
+ buttonRef: o,
822
+ onClick: a
823
+ }) {
824
+ const d = n === "preview";
825
+ return /* @__PURE__ */ s(
826
+ "button",
827
+ {
828
+ ref: o,
829
+ type: "button",
830
+ "data-mode-button": "",
831
+ className: `${e}-mode`,
832
+ "aria-pressed": d,
833
+ "aria-keyshortcuts": "Meta+Shift+P Control+Shift+P",
834
+ title: d ? "View the published site" : "View draft content",
835
+ disabled: r,
836
+ onClick: a,
837
+ children: [
838
+ /* @__PURE__ */ t(ir, { exit: d }),
839
+ d ? "Exit preview" : "Enter preview"
840
+ ]
841
+ }
842
+ );
843
+ }
844
+ function vt({
845
+ pressed: n,
846
+ disabled: r,
847
+ shortcut: o,
848
+ onClick: a
849
+ }) {
850
+ return /* @__PURE__ */ s(
851
+ "button",
852
+ {
853
+ type: "button",
854
+ className: `${e}-btn ${e}-agent${n ? ` ${e}-on` : ""}`,
855
+ "aria-pressed": n,
856
+ "aria-keyshortcuts": "Meta+J Control+J",
857
+ disabled: r,
858
+ onClick: a,
859
+ children: [
860
+ /* @__PURE__ */ t(en, {}),
861
+ /* @__PURE__ */ t("span", { children: "Agent" }),
862
+ /* @__PURE__ */ s("kbd", { className: `${e}-kbd`, children: [
863
+ o,
864
+ "J"
865
+ ] })
866
+ ]
867
+ }
868
+ );
869
+ }
870
+ function rr({
871
+ buttonRef: n,
872
+ open: r,
873
+ count: o,
874
+ disabled: a,
875
+ onClick: d
876
+ }) {
877
+ return /* @__PURE__ */ s(
878
+ "button",
879
+ {
880
+ ref: n,
881
+ type: "button",
882
+ className: `${e}-publish${r ? ` ${e}-publish-on` : ""}`,
883
+ "aria-haspopup": "dialog",
884
+ "aria-expanded": r ?? !1,
885
+ disabled: a,
886
+ onClick: d,
887
+ children: [
888
+ /* @__PURE__ */ t(nn, {}),
889
+ /* @__PURE__ */ s("span", { children: [
890
+ "Publish",
891
+ o > 0 ? /* @__PURE__ */ s("span", { className: `${e}-count`, children: [
892
+ " ",
893
+ o
894
+ ] }) : null
895
+ ] })
896
+ ]
897
+ }
898
+ );
899
+ }
900
+ function ir({ exit: n }) {
901
+ return n ? /* @__PURE__ */ t("svg", { className: `${e}-mark`, width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": !0, children: /* @__PURE__ */ t("path", { d: "M3 3l6 6M9 3 3 9", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round" }) }) : /* @__PURE__ */ s("svg", { className: `${e}-mark`, width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": !0, children: [
902
+ /* @__PURE__ */ t("circle", { cx: "6", cy: "6", r: "3.25", stroke: "currentColor", strokeWidth: "1.25" }),
903
+ /* @__PURE__ */ t("circle", { cx: "6", cy: "6", r: "1.35", fill: "currentColor" })
904
+ ] });
905
+ }
906
+ function or({ state: n }) {
907
+ return n === "done" ? /* @__PURE__ */ t("span", { className: `${e}-done`, "aria-hidden": !0, children: "✓" }) : n === "active" ? /* @__PURE__ */ t("span", { className: `${e}-spin`, "aria-hidden": !0 }) : /* @__PURE__ */ t("span", { className: `${e}-ring`, "aria-hidden": !0 });
908
+ }
909
+ function qe(n, r = {}) {
910
+ const o = r.delay ?? 0;
911
+ if (se()) {
912
+ n.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: "ease", fill: "backwards" });
913
+ return;
914
+ }
915
+ [...n.children].forEach((a, d) => {
916
+ a.animate(
917
+ [
918
+ { opacity: 0, transform: "translateY(4px)", filter: r.blur ? "blur(2px)" : "none" },
919
+ { opacity: 1, transform: "none", filter: "none" }
920
+ ],
921
+ { duration: 300, delay: o + d * 28, easing: he, fill: "backwards" }
922
+ );
923
+ });
924
+ }
925
+ function ar(n) {
926
+ if (!(n instanceof HTMLElement)) return !1;
927
+ const r = n.tagName;
928
+ return r === "INPUT" || r === "TEXTAREA" || r === "SELECT" ? !0 : n.isContentEditable;
929
+ }
930
+ function sr({
931
+ buttonRef: n,
932
+ open: r,
933
+ onClick: o
934
+ }) {
935
+ return /* @__PURE__ */ t(
936
+ "button",
937
+ {
938
+ ref: n,
939
+ type: "button",
940
+ className: `${e}-gear${r ? ` ${e}-gear-on` : ""}`,
941
+ "aria-label": "Settings",
942
+ "aria-haspopup": "dialog",
943
+ "aria-expanded": r,
944
+ onClick: o,
945
+ children: /* @__PURE__ */ t(rn, {})
946
+ }
947
+ );
948
+ }
949
+ function lr({
950
+ open: n,
951
+ pane: r,
952
+ hostName: o,
953
+ branch: a,
954
+ bar: d,
955
+ highlightBlocks: m,
956
+ previewAgent: h,
957
+ dashboardHref: u,
958
+ onHighlight: p,
959
+ onPreviewAgent: c,
960
+ onShortcuts: R,
961
+ onBack: y,
962
+ onDashboard: D,
963
+ onHide: X,
964
+ onSwitchBranch: I,
965
+ onSignOut: N
966
+ }) {
967
+ const C = Ue(), [S, E] = f(null), g = Fe();
968
+ if (z(() => {
969
+ if (!n) return;
970
+ let _ = !1;
971
+ return on().then((j) => {
972
+ _ || E((j == null ? void 0 : j.user.email) ?? null);
973
+ }).catch(() => {
974
+ _ || E(null);
975
+ }), () => {
976
+ _ = !0;
977
+ };
978
+ }, [n]), !n || !d) return null;
979
+ const M = o && a ? `${o} · ${a}` : o || a || "", q = r === "shortcuts" ? /* @__PURE__ */ s("div", { role: "dialog", "aria-labelledby": C, className: `${e}-menu ${e}-settings`, children: [
980
+ /* @__PURE__ */ t("div", { className: `${e}-settings-head`, children: /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-back`, onClick: y, children: [
981
+ /* @__PURE__ */ t(Pt, {}),
982
+ /* @__PURE__ */ t("span", { id: C, children: "Shortcuts" })
983
+ ] }) }),
984
+ /* @__PURE__ */ t(fe, { label: "Toggle preview", keys: `${g}⇧P` }),
985
+ /* @__PURE__ */ t(fe, { label: "Agent", keys: `${g}J` }),
986
+ /* @__PURE__ */ t(fe, { label: "Open in dashboard", keys: `${g}D` }),
987
+ /* @__PURE__ */ t(fe, { label: "Hide toolbar", keys: `${g}.` }),
988
+ /* @__PURE__ */ t(fe, { label: "Keyboard shortcuts", keys: "?" })
989
+ ] }) : /* @__PURE__ */ s("div", { role: "dialog", "aria-labelledby": C, className: `${e}-menu ${e}-settings`, children: [
990
+ /* @__PURE__ */ s("div", { className: `${e}-settings-head`, children: [
991
+ /* @__PURE__ */ t("span", { id: C, className: `${e}-settings-kicker`, children: "Settings" }),
992
+ M ? /* @__PURE__ */ t("span", { className: `${e}-settings-place`, children: M }) : null
993
+ ] }),
994
+ /* @__PURE__ */ s("div", { className: `${e}-settings-row`, children: [
995
+ /* @__PURE__ */ t(ur, {}),
996
+ /* @__PURE__ */ t("span", { children: "Highlight editable blocks" }),
997
+ /* @__PURE__ */ t($t, { on: m, label: "Highlight editable blocks", onClick: () => p(!m) })
998
+ ] }),
999
+ /* @__PURE__ */ s("div", { className: `${e}-settings-row`, children: [
1000
+ /* @__PURE__ */ t(hr, {}),
1001
+ /* @__PURE__ */ t("span", { children: "Preview when Agent edits" }),
1002
+ /* @__PURE__ */ t($t, { on: h, label: "Preview when Agent edits", onClick: () => c(!h) })
1003
+ ] }),
1004
+ /* @__PURE__ */ t("div", { className: `${e}-settings-rule` }),
1005
+ u ? /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-action`, onClick: D, children: [
1006
+ /* @__PURE__ */ t(pr, {}),
1007
+ /* @__PURE__ */ t("span", { children: "Open in dashboard" }),
1008
+ /* @__PURE__ */ s("kbd", { className: `${e}-kbd`, children: [
1009
+ g,
1010
+ "D"
1011
+ ] })
1012
+ ] }) : null,
1013
+ I ? /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-action`, onClick: I, children: [
1014
+ /* @__PURE__ */ t("span", { className: `${e}-settings-icon`, "aria-hidden": !0, children: /* @__PURE__ */ t(sn, {}) }),
1015
+ /* @__PURE__ */ t("span", { children: "Switch branch" }),
1016
+ a ? /* @__PURE__ */ t("span", { className: `${e}-settings-email`, children: a }) : null
1017
+ ] }) : null,
1018
+ /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-action`, onClick: R, children: [
1019
+ /* @__PURE__ */ t(gr, {}),
1020
+ /* @__PURE__ */ t("span", { children: "Keyboard shortcuts" }),
1021
+ /* @__PURE__ */ t("kbd", { className: `${e}-kbd`, children: "?" })
1022
+ ] }),
1023
+ /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-action`, "aria-keyshortcuts": "Meta+. Control+.", onClick: X, children: [
1024
+ /* @__PURE__ */ t(mr, {}),
1025
+ /* @__PURE__ */ t("span", { children: "Hide toolbar" }),
1026
+ /* @__PURE__ */ s("kbd", { className: `${e}-kbd`, children: [
1027
+ g,
1028
+ "."
1029
+ ] })
1030
+ ] }),
1031
+ N ? /* @__PURE__ */ s(U, { children: [
1032
+ /* @__PURE__ */ t("div", { className: `${e}-settings-rule` }),
1033
+ /* @__PURE__ */ s("button", { type: "button", className: `${e}-settings-action`, onClick: N, children: [
1034
+ /* @__PURE__ */ t(fr, {}),
1035
+ /* @__PURE__ */ t("span", { children: "Sign out" }),
1036
+ S ? /* @__PURE__ */ t("span", { className: `${e}-settings-email`, children: S }) : null
1037
+ ] })
1038
+ ] }) : null
1039
+ ] });
1040
+ return Me(q, d);
1041
+ }
1042
+ function fe({ label: n, keys: r }) {
1043
+ return /* @__PURE__ */ s("div", { className: `${e}-settings-action ${e}-settings-static`, children: [
1044
+ /* @__PURE__ */ t("span", { children: n }),
1045
+ /* @__PURE__ */ t("kbd", { className: `${e}-kbd`, children: r })
1046
+ ] });
1047
+ }
1048
+ function $t({ on: n, label: r, onClick: o }) {
1049
+ return /* @__PURE__ */ t(
1050
+ "button",
1051
+ {
1052
+ type: "button",
1053
+ role: "switch",
1054
+ className: `${e}-switch${n ? ` ${e}-switch-on` : ""}`,
1055
+ "aria-checked": n,
1056
+ "aria-label": r,
1057
+ onClick: o,
1058
+ children: /* @__PURE__ */ t("span", { className: `${e}-knob` })
1059
+ }
1060
+ );
1061
+ }
1062
+ function cr(n, r) {
1063
+ const o = n.getBoundingClientRect(), a = r.getBoundingClientRect();
1064
+ n.style.setProperty("--menu-right", `${Math.max(0, o.right - a.right)}px`);
1065
+ }
1066
+ function dr(n, r) {
1067
+ const o = n.getBoundingClientRect(), a = r.getBoundingClientRect(), d = Math.min(er, window.innerWidth - 32);
1068
+ let h = a.left + a.width / 2 - o.left - d / 2;
1069
+ const u = 16, p = u - o.left, c = window.innerWidth - u - d - o.left;
1070
+ n.style.setProperty("--menu-x", `${Math.max(p, Math.min(h, c))}px`);
1071
+ }
1072
+ function ur() {
1073
+ return /* @__PURE__ */ s("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
1074
+ /* @__PURE__ */ t("path", { d: "M3 3h4.2v4.2H3zM8.8 3H13v4.2H8.8zM3 8.8h4.2V13H3z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
1075
+ /* @__PURE__ */ t("path", { d: "M8.8 10.2h4.2", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeDasharray: "1.4 1.5" })
1076
+ ] });
1077
+ }
1078
+ function hr() {
1079
+ return /* @__PURE__ */ s("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
1080
+ /* @__PURE__ */ t("path", { d: "M1.6 8S4 3.8 8 3.8 14.4 8 14.4 8 12 12.2 8 12.2 1.6 8 1.6 8Z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
1081
+ /* @__PURE__ */ t("circle", { cx: "8", cy: "8", r: "1.8", fill: "none", stroke: "currentColor", strokeWidth: "1.3" })
1082
+ ] });
1083
+ }
1084
+ function pr() {
1085
+ return /* @__PURE__ */ t("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: /* @__PURE__ */ t("path", { d: "M2.5 2.5h4.2v4.2H2.5zM9.3 2.5h4.2v4.2H9.3zM2.5 9.3h4.2v4.2H2.5zM9.3 9.3h4.2v4.2H9.3z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }) });
1086
+ }
1087
+ function gr() {
1088
+ return /* @__PURE__ */ s("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
1089
+ /* @__PURE__ */ t("rect", { x: "1.8", y: "3.6", width: "12.4", height: "8.8", rx: "1.4", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
1090
+ /* @__PURE__ */ t("path", { d: "M4 6.2h.1M6.4 6.2h.1M8.8 6.2h.1M11.2 6.2h.1M4.8 8.4h6.4", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
1091
+ ] });
1092
+ }
1093
+ function mr() {
1094
+ return /* @__PURE__ */ s("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
1095
+ /* @__PURE__ */ t("path", { d: "M2 8s2.2-3.6 6-3.6S14 8 14 8s-2.2 3.6-6 3.6S2 8 2 8Z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
1096
+ /* @__PURE__ */ t("path", { d: "M3 13 13 3", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
1097
+ ] });
1098
+ }
1099
+ function fr() {
1100
+ return /* @__PURE__ */ s("svg", { className: `${e}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
1101
+ /* @__PURE__ */ t("path", { d: "M6.5 3.2H3.8v9.6h2.7", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" }),
1102
+ /* @__PURE__ */ t("path", { d: "M7 8h6.2M11 5.4 13.6 8 11 10.6", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" })
1103
+ ] });
1104
+ }
1105
+ function je() {
1106
+ try {
1107
+ return typeof localStorage > "u" ? null : localStorage;
1108
+ } catch {
1109
+ return null;
1110
+ }
1111
+ }
1112
+ function kt(n) {
1113
+ if (typeof document > "u") return;
1114
+ const r = typeof matchMedia == "function" && matchMedia("(prefers-color-scheme: dark)").matches, o = jn(n, r) === "dark", a = document.documentElement;
1115
+ a.dataset.theme = o ? "dark" : "light", a.style.colorScheme = n === "system" ? "light dark" : o ? "dark" : "light", a.classList.toggle("dark", o), a.classList.toggle("light", !o);
1116
+ }
1117
+ function br({
1118
+ label: n,
1119
+ doc: r,
1120
+ dashboardHref: o,
1121
+ bar: a,
1122
+ open: d,
1123
+ expanded: m,
1124
+ onToggle: h
1125
+ }) {
1126
+ const [u, p] = f([]), [c, R] = f(0), [y, D] = f(!1), [X, I] = f(!1), [N, C] = f(null), [S, E] = f(""), g = Ue(), M = k(null), q = k(null), _ = k(null), j = k(0), Y = k(/* @__PURE__ */ new Map());
1127
+ z(() => {
1128
+ d || E("");
1129
+ }, [d]), te(() => {
1130
+ var x;
1131
+ d && ((x = _.current) == null || x.focus({ preventScroll: !0 }));
1132
+ }, [d]), te(() => {
1133
+ const x = M.current;
1134
+ if (!d || !a || !x) return;
1135
+ const A = () => dr(a, x);
1136
+ return A(), window.addEventListener("resize", A), () => window.removeEventListener("resize", A);
1137
+ }, [d, a]);
1138
+ const le = Ke(
1139
+ (x, A, T) => {
1140
+ if (!r) return;
1141
+ const Q = ++j.current, ne = S.trim(), pe = xt(r.workspaceId, ne);
1142
+ A ? I(!0) : T != null && T.silent || D(!0), tn(r.workspaceId, {
1143
+ q: ne || void 0,
1144
+ limit: Jn,
1145
+ offset: x,
1146
+ current: r
1147
+ }).then((re) => {
1148
+ Q === j.current && (R(re.total), p((ie) => {
1149
+ const xe = A ? [...ie, ...re.items] : re.items;
1150
+ return Y.current.set(pe, { rows: xe, total: re.total }), xe;
1151
+ }), C(null));
1152
+ }).catch(() => {
1153
+ Q === j.current && (A || Y.current.get(pe) || p([]), C("Couldn't load pages"));
1154
+ }).finally(() => {
1155
+ Q === j.current && (D(!1), I(!1));
1156
+ });
1157
+ },
1158
+ [r, S]
1159
+ );
1160
+ z(() => {
1161
+ if (!d || !r) return;
1162
+ const x = S.trim(), A = xt(r.workspaceId, x), T = Y.current.get(A);
1163
+ T && (p(T.rows), R(T.total), C(null));
1164
+ const Q = window.setTimeout(
1165
+ () => le(0, !1, { silent: !!T }),
1166
+ x ? 200 : 0
1167
+ );
1168
+ return () => window.clearTimeout(Q);
1169
+ }, [d, r, S, le]);
1170
+ function ce() {
1171
+ const x = q.current;
1172
+ !x || y || X || u.length >= c || x.scrollTop + x.clientHeight < x.scrollHeight - 48 || le(u.length, !0);
1173
+ }
1174
+ if (!r) return /* @__PURE__ */ t("span", { className: `${e}-crumb`, children: n });
1175
+ const Z = !y && !N && u.length === 0, G = d ? /* @__PURE__ */ s(
1176
+ "div",
1177
+ {
1178
+ id: g,
1179
+ role: "menu",
1180
+ "aria-label": "Pages",
1181
+ className: `${e}-menu ${e}-page-menu`,
1182
+ children: [
1183
+ /* @__PURE__ */ t(
1184
+ Bt,
1185
+ {
1186
+ query: S,
1187
+ onQuery: E,
1188
+ inputRef: _,
1189
+ searchClassName: `${e}-page-search`,
1190
+ showFilter: !0,
1191
+ empty: Z,
1192
+ emptyLabel: S.trim() ? "Nothing matches" : "No pages",
1193
+ error: N,
1194
+ loading: y && u.length === 0
1195
+ }
1196
+ ),
1197
+ /* @__PURE__ */ s("div", { ref: q, className: `${e}-page-menu-list`, onScroll: ce, children: [
1198
+ u.map((x) => /* @__PURE__ */ t(
1199
+ "button",
1200
+ {
1201
+ type: "button",
1202
+ role: "menuitem",
1203
+ className: `${e}-option${x.current ? ` ${e}-current` : ""}`,
1204
+ "aria-current": x.current ? "page" : void 0,
1205
+ onClick: () => {
1206
+ if (x.current || x.href === location.pathname) {
1207
+ h();
1208
+ return;
1209
+ }
1210
+ location.assign(x.href);
1211
+ },
1212
+ children: /* @__PURE__ */ t("span", { children: x.label })
1213
+ },
1214
+ x.key
1215
+ )),
1216
+ X ? /* @__PURE__ */ t("p", { className: `${e}-note`, children: "Loading more…" }) : null,
1217
+ Z && !N ? /* @__PURE__ */ t("p", { className: `${e}-note`, children: S.trim() ? "Nothing matches" : "No pages" }) : null,
1218
+ N ? /* @__PURE__ */ t("p", { className: `${e}-note ${e}-note-error`, children: N }) : null,
1219
+ y && u.length === 0 ? /* @__PURE__ */ t("p", { className: `${e}-note ${e}-note-muted`, children: "Loading pages…" }) : null
1220
+ ] }),
1221
+ o ? /* @__PURE__ */ t("div", { className: `${e}-page-menu-foot`, children: /* @__PURE__ */ t(
1222
+ "button",
1223
+ {
1224
+ type: "button",
1225
+ role: "menuitem",
1226
+ className: `${e}-option`,
1227
+ onClick: () => location.assign(o),
1228
+ children: /* @__PURE__ */ t("span", { children: "Open in dashboard" })
1229
+ }
1230
+ ) }) : null
1231
+ ]
1232
+ }
1233
+ ) : null;
1234
+ return /* @__PURE__ */ s(U, { children: [
1235
+ /* @__PURE__ */ s(
1236
+ "button",
1237
+ {
1238
+ ref: M,
1239
+ type: "button",
1240
+ className: `${e}-btn ${e}-page${m ? ` ${e}-page-on` : ""}`,
1241
+ "aria-haspopup": "menu",
1242
+ "aria-expanded": m,
1243
+ "aria-controls": g,
1244
+ onClick: h,
1245
+ children: [
1246
+ /* @__PURE__ */ t("span", { children: n }),
1247
+ /* @__PURE__ */ t(Pt, {})
1248
+ ]
1249
+ }
1250
+ ),
1251
+ G && a ? Me(G, a) : null
1252
+ ] });
1253
+ }
1254
+ function xr({
1255
+ branch: n,
1256
+ tree: r,
1257
+ workspaceId: o,
1258
+ previewEntryPath: a,
1259
+ bar: d,
1260
+ open: m,
1261
+ onClose: h
1262
+ }) {
1263
+ const [u, p] = f(null), [c, R] = f(null), [y, D] = f(null), [X, I] = f(!1), [N, C] = f(""), S = Ue();
1264
+ if (z(() => {
1265
+ m || C("");
1266
+ }, [m]), z(() => {
1267
+ if (!m || !o || u) return;
1268
+ let g = !1;
1269
+ return an(o).then((M) => {
1270
+ if (g) return;
1271
+ const q = M.branches.map((_) => _.name);
1272
+ q.includes(n) || q.unshift(n), p(q), R(M.defaultBranch);
1273
+ }).catch(() => {
1274
+ g || D("Couldn't load branches");
1275
+ }), () => {
1276
+ g = !0;
1277
+ };
1278
+ }, [m, o, u, n]), !m || !d) return null;
1279
+ const E = u ? vr(u.map((g) => ({ key: g, label: g })), N) : null;
1280
+ return Me(
1281
+ /* @__PURE__ */ t("div", { id: S, role: "menu", "aria-label": "Branches", className: `${e}-menu ${e}-page-menu`, children: o ? /* @__PURE__ */ t(
1282
+ Bt,
1283
+ {
1284
+ query: N,
1285
+ onQuery: C,
1286
+ showFilter: ((u == null ? void 0 : u.length) ?? 0) > 7,
1287
+ empty: (E == null ? void 0 : E.length) === 0,
1288
+ emptyLabel: N.trim() ? "Nothing matches" : "No branches",
1289
+ error: y,
1290
+ loading: E === null && !y,
1291
+ children: E == null ? void 0 : E.map((g) => /* @__PURE__ */ s(
1292
+ "button",
1293
+ {
1294
+ type: "button",
1295
+ role: "menuitem",
1296
+ className: `${e}-option${g.label === n ? ` ${e}-current` : ""}`,
1297
+ "aria-current": g.label === n ? "true" : void 0,
1298
+ disabled: X,
1299
+ onClick: () => {
1300
+ if (g.label === n) {
1301
+ h();
1302
+ return;
1303
+ }
1304
+ I(!0), D(null), $r({
1305
+ workspaceId: o,
1306
+ branch: g.label,
1307
+ tree: r,
1308
+ redirect: location.pathname + location.search + location.hash,
1309
+ previewEntryPath: a
1310
+ }).catch((M) => {
1311
+ I(!1), D(M instanceof Error ? M.message : "Couldn't switch branch");
1312
+ });
1313
+ },
1314
+ children: [
1315
+ /* @__PURE__ */ t("span", { children: g.label }),
1316
+ g.label === c ? /* @__PURE__ */ t("span", { className: `${e}-meta`, children: "default" }) : null
1317
+ ]
1318
+ },
1319
+ g.key
1320
+ ))
1321
+ }
1322
+ ) : /* @__PURE__ */ t("p", { className: `${e}-note`, children: n }) }),
1323
+ d
1324
+ );
1325
+ }
1326
+ function Bt({
1327
+ query: n,
1328
+ onQuery: r,
1329
+ inputRef: o,
1330
+ searchClassName: a,
1331
+ showFilter: d,
1332
+ empty: m,
1333
+ emptyLabel: h,
1334
+ error: u,
1335
+ loading: p,
1336
+ children: c
1337
+ }) {
1338
+ return /* @__PURE__ */ s(U, { children: [
1339
+ d ? /* @__PURE__ */ t("div", { className: `${e}-page-menu-search`, children: /* @__PURE__ */ t(
1340
+ "input",
1341
+ {
1342
+ ref: o,
1343
+ value: n,
1344
+ onChange: (R) => r(R.target.value),
1345
+ placeholder: "Search files",
1346
+ "aria-label": "Search files",
1347
+ autoComplete: "off",
1348
+ spellCheck: !1,
1349
+ className: a
1350
+ }
1351
+ ) }) : null,
1352
+ c ? /* @__PURE__ */ s(U, { children: [
1353
+ u ? /* @__PURE__ */ t("p", { className: `${e}-note ${e}-note-error`, children: u }) : null,
1354
+ p ? /* @__PURE__ */ t("p", { className: `${e}-note`, children: "Loading…" }) : null,
1355
+ m && !u ? /* @__PURE__ */ t("p", { className: `${e}-note`, children: h }) : null,
1356
+ c
1357
+ ] }) : null
1358
+ ] });
1359
+ }
1360
+ function Pt() {
1361
+ return /* @__PURE__ */ t("svg", { className: `${e}-chevron`, width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", "aria-hidden": !0, children: /* @__PURE__ */ t("path", { d: "M2.5 4.5 6 8l3.5-3.5", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) });
1362
+ }
1363
+ function vr(n, r) {
1364
+ const o = r.trim().toLowerCase();
1365
+ return o ? n.filter((a) => a.label.toLowerCase().includes(o)) : [...n];
1366
+ }
1367
+ async function $r(n) {
1368
+ const r = n.checkout ?? cn, o = n.ticket ?? ln, a = n.assign ?? ((h) => location.assign(h));
1369
+ await r(n.workspaceId, n.branch);
1370
+ let d;
1371
+ try {
1372
+ d = await o(n.workspaceId, {
1373
+ redirect: n.redirect,
1374
+ branch: n.branch,
1375
+ tree: n.tree
1376
+ });
1377
+ } catch (h) {
1378
+ const u = h instanceof Error ? h.message : "Couldn't open the branch";
1379
+ throw new Error(`Checked out ${n.branch}, but the preview didn't update. ${u}`);
1380
+ }
1381
+ const m = n.previewEntryPath.includes("?") ? "&" : "?";
1382
+ a(`${n.previewEntryPath}${m}ticket=${encodeURIComponent(d.ticket)}`);
1383
+ }
1384
+ const kr = `
1385
+ .${e}-host {
1386
+ position: absolute;
1387
+ width: 0;
1388
+ height: 0;
1389
+ overflow: visible;
1390
+ border: 0;
1391
+ padding: 0;
1392
+ text-decoration: none;
1393
+ color: inherit;
1394
+ }
1395
+ html.backmatter-pointing, html.backmatter-pointing * { cursor: crosshair !important; }
1396
+ html.backmatter-pointing [data-backmatter-panel],
1397
+ html.backmatter-pointing [data-backmatter-panel] *,
1398
+ html.backmatter-pointing [data-backmatter-devbar] { cursor: pointer !important; }
1399
+ html.backmatter-blocks [data-backmatter-block] {
1400
+ outline: 1.5px solid oklch(0.56 0.21 295);
1401
+ outline-offset: 2px;
1402
+ }
1403
+ `, wr = `
1404
+ .${e}-root {
1405
+ --preview: ${Lt};
1406
+ --preview-hover: oklch(0.50 0.20 295);
1407
+ --preview-deep: oklch(0.48 0.20 295);
1408
+ --preview-line: oklch(0.66 0.16 295);
1409
+ --preview-outline: oklch(0.72 0.13 295);
1410
+ --preview-ink: oklch(0.98 0.01 295);
1411
+ --preview-ink-soft: oklch(0.88 0.05 295);
1412
+ --preview-on-white: oklch(0.36 0.16 295);
1413
+ --panel: #ffffff;
1414
+ --line: #e7e7e4;
1415
+ --line2: #d8d8d4;
1416
+ --fg: #17171a;
1417
+ --fg2: #5d5d62;
1418
+ --fg3: #8e8e93;
1419
+ --hover: #f3f3f1;
1420
+ --live: oklch(0.66 0.13 150);
1421
+ --shadow-live: 0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 28px -8px rgba(0, 0, 0, 0.18);
1422
+ --shadow-preview: 0 1px 2px rgba(0, 0, 0, 0.08), 0 10px 28px -8px oklch(0.45 0.2 295 / 0.5);
1423
+ --ease-out: ${he};
1424
+ --ease-in: ${Oe};
1425
+ --ox: 28px;
1426
+ --oy: 20px;
1427
+ color-scheme: light;
1428
+ text-decoration: none;
1429
+ }
1430
+ .${e} {
1431
+ all: initial;
1432
+ position: var(--bm-devbar-position, fixed);
1433
+ right: var(--bm-devbar-right, max(16px, env(safe-area-inset-right, 0px)));
1434
+ left: var(--bm-devbar-left, auto);
1435
+ bottom: var(--bm-devbar-bottom, 0px);
1436
+ z-index: 2147483000;
1437
+ display: block;
1438
+ width: max-content;
1439
+ max-width: calc(100vw - 32px);
1440
+ height: 40px;
1441
+ box-sizing: border-box;
1442
+ transform-origin: 100% 100%;
1443
+ pointer-events: auto;
1444
+ color: var(--fg);
1445
+ font-family: "Geist Sans", Geist, ui-sans-serif, system-ui, sans-serif;
1446
+ font-size: 12.5px;
1447
+ font-weight: 500;
1448
+ font-style: normal;
1449
+ line-height: 1;
1450
+ letter-spacing: normal;
1451
+ font-variant-numeric: tabular-nums;
1452
+ -webkit-font-smoothing: antialiased;
1453
+ text-align: left;
1454
+ cursor: default;
1455
+ user-select: none;
1456
+ transition: color 250ms ease;
1457
+ }
1458
+ .${e}[data-hidden="true"] { pointer-events: none; }
1459
+ .${e}-root[data-mode="preview"] .${e} { color: var(--preview-ink); }
1460
+ .${e} button, .${e} input {
1461
+ all: unset;
1462
+ box-sizing: border-box;
1463
+ font: inherit;
1464
+ color: inherit;
1465
+ cursor: pointer;
1466
+ text-decoration: none;
1467
+ -webkit-appearance: none;
1468
+ appearance: none;
1469
+ }
1470
+ .${e} button {
1471
+ transition: transform 160ms var(--ease-out), background-color 150ms ease, color 250ms ease, border-color 300ms ease;
1472
+ }
1473
+ .${e} button:active:not(:disabled) { transform: scale(0.97); }
1474
+ .${e} button:disabled { cursor: default; }
1475
+ .${e} button:focus-visible, .${e}-menu input:focus-visible {
1476
+ outline: none;
1477
+ box-shadow: inset 0 0 0 1.5px currentColor;
1478
+ }
1479
+ .${e} input.${e}-page-search:focus,
1480
+ .${e} input.${e}-page-search:focus-visible {
1481
+ outline: none;
1482
+ box-shadow: none;
1483
+ }
1484
+ .${e}-clip {
1485
+ position: relative;
1486
+ height: 40px;
1487
+ overflow: hidden;
1488
+ box-sizing: border-box;
1489
+ border: 1px solid var(--line);
1490
+ border-bottom: 0;
1491
+ border-radius: 12px 12px 0 0;
1492
+ background: var(--panel);
1493
+ box-shadow: var(--shadow-live);
1494
+ transition: border-color 300ms ease;
1495
+ }
1496
+ .${e}-root[data-mode="preview"] .${e}-clip {
1497
+ border-color: transparent;
1498
+ background: transparent;
1499
+ box-shadow: none;
1500
+ }
1501
+ .${e}-flood {
1502
+ position: absolute;
1503
+ z-index: 0;
1504
+ inset: -1px -1px 0 -1px;
1505
+ border-radius: 12px 12px 0 0;
1506
+ background: var(--preview);
1507
+ pointer-events: none;
1508
+ clip-path: circle(0px at var(--ox) var(--oy));
1509
+ transition: clip-path ${An}ms var(--ease-in);
1510
+ }
1511
+ .${e}-root[data-mode="preview"] .${e}-flood {
1512
+ clip-path: circle(150% at var(--ox) var(--oy));
1513
+ transition: clip-path ${_n}ms var(--ease-out);
1514
+ }
1515
+ .${e}-root[data-settled] .${e}-flood { transition: none; }
1516
+ .${e}-row {
1517
+ position: relative;
1518
+ z-index: 1;
1519
+ display: flex;
1520
+ align-items: center;
1521
+ gap: 2px;
1522
+ height: 39px;
1523
+ padding: 0 8px 0 12px;
1524
+ white-space: nowrap;
1525
+ }
1526
+ .${e} button.${e}-mode {
1527
+ display: inline-flex;
1528
+ flex-shrink: 0;
1529
+ align-items: center;
1530
+ gap: 6px;
1531
+ height: 28px;
1532
+ margin-right: 10px;
1533
+ padding: 0 10px;
1534
+ border: 1px solid transparent;
1535
+ border-radius: 8px;
1536
+ background: var(--preview);
1537
+ color: var(--preview-ink);
1538
+ }
1539
+ .${e}-root[data-mode="preview"] button.${e}-mode {
1540
+ background: transparent;
1541
+ border-color: var(--preview-outline);
1542
+ }
1543
+ .${e} button.${e}-mode:active:not(:disabled) { background: var(--preview-deep); }
1544
+ .${e}-mark { flex-shrink: 0; }
1545
+ .${e}-crumb {
1546
+ display: inline-flex;
1547
+ align-items: center;
1548
+ min-width: 0;
1549
+ max-width: min(180px, 28vw);
1550
+ height: 28px;
1551
+ padding: 0 8px;
1552
+ border-radius: 8px;
1553
+ color: var(--fg2);
1554
+ }
1555
+ .${e}-root[data-mode="preview"] .${e}-crumb { color: var(--preview-ink-soft); }
1556
+ .${e} button.${e}-page {
1557
+ min-width: 0;
1558
+ max-width: min(200px, 34vw);
1559
+ }
1560
+ .${e} button.${e}-page > span {
1561
+ min-width: 0;
1562
+ overflow: hidden;
1563
+ text-overflow: ellipsis;
1564
+ white-space: nowrap;
1565
+ }
1566
+ .${e}-page-on { background: var(--hover); }
1567
+ .${e}-root[data-mode="preview"] .${e}-page-on {
1568
+ background: rgba(255, 255, 255, 0.18);
1569
+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
1570
+ }
1571
+ .${e}-chevron { flex-shrink: 0; color: var(--fg3); }
1572
+ .${e}-root[data-mode="preview"] .${e}-chevron { color: var(--preview-ink-soft); }
1573
+ .${e}-rule {
1574
+ width: 1px;
1575
+ height: 16px;
1576
+ flex-shrink: 0;
1577
+ margin: 0 6px;
1578
+ background: var(--line2);
1579
+ }
1580
+ .${e}-root[data-mode="preview"] .${e}-rule { background: var(--preview-line); }
1581
+ .${e} button.${e}-btn,
1582
+ .${e} button.${e}-publish {
1583
+ display: inline-flex;
1584
+ flex-shrink: 0;
1585
+ align-items: center;
1586
+ gap: 6px;
1587
+ height: 28px;
1588
+ padding: 0 8px;
1589
+ border-radius: 8px;
1590
+ border: 0;
1591
+ text-decoration: none;
1592
+ }
1593
+ .${e} button.${e}-btn span,
1594
+ .${e} button.${e}-publish span {
1595
+ text-decoration: none;
1596
+ }
1597
+ .${e}-kbd, .${e}-field, .${e}-when {
1598
+ font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
1599
+ font-size: 11px;
1600
+ font-weight: 500;
1601
+ }
1602
+ .${e}-kbd, .${e}-when, .${e}-field { color: var(--fg3); }
1603
+ .${e}-root[data-mode="preview"] .${e}-kbd,
1604
+ .${e}-root[data-mode="preview"] .${e}-field,
1605
+ .${e}-root[data-mode="preview"] .${e}-when { color: var(--preview-ink-soft); }
1606
+ .${e}-count { font-variant-numeric: tabular-nums; }
1607
+ .${e} button.${e}-publish:not(:disabled) { background: #17171a; color: #fff; }
1608
+ .${e}-root[data-mode="live"] button.${e}-publish:disabled {
1609
+ background: #f0f0ee;
1610
+ color: var(--fg3);
1611
+ }
1612
+ .${e}-root[data-mode="preview"] button.${e}-publish:not(:disabled) {
1613
+ background: #fff;
1614
+ color: var(--preview-on-white);
1615
+ }
1616
+ .${e}-root[data-mode="preview"] button.${e}-publish:disabled {
1617
+ background: rgba(255, 255, 255, 0.14);
1618
+ color: var(--preview-ink-soft);
1619
+ }
1620
+ .${e} button.${e}-btn:disabled { opacity: 0.45; }
1621
+ .${e}-changes, .${e}-steps, .${e}-published, .${e}-step {
1622
+ display: inline-flex;
1623
+ align-items: center;
1624
+ gap: 6px;
1625
+ min-width: 0;
1626
+ }
1627
+ .${e}-diff { display: inline-flex; gap: 4px; }
1628
+ .${e}-add, .${e}-del { font-variant-numeric: tabular-nums; }
1629
+ .${e}-dash { color: var(--preview-ink-soft); }
1630
+ .${e}-spin {
1631
+ width: 12px;
1632
+ height: 12px;
1633
+ flex-shrink: 0;
1634
+ box-sizing: border-box;
1635
+ border: 1.5px solid var(--preview-line);
1636
+ border-top-color: #fff;
1637
+ border-radius: 999px;
1638
+ animation: ${e}-spin 800ms linear infinite;
1639
+ }
1640
+ .${e}-ring {
1641
+ width: 12px;
1642
+ height: 12px;
1643
+ flex-shrink: 0;
1644
+ box-sizing: border-box;
1645
+ border: 1.5px solid var(--preview-line);
1646
+ border-radius: 999px;
1647
+ }
1648
+ .${e}-done, .${e}-check { color: var(--live); }
1649
+ .${e}-root[data-mode="preview"] .${e}-done { color: var(--preview-ink); }
1650
+ .${e}-shimmer {
1651
+ display: inline-block;
1652
+ background-image: linear-gradient(90deg, var(--preview-ink-soft) 0%, #fff 45%, var(--preview-ink-soft) 90%);
1653
+ background-size: 200% 100%;
1654
+ -webkit-background-clip: text;
1655
+ background-clip: text;
1656
+ color: transparent;
1657
+ animation: ${e}-shimmer 1.4s linear infinite;
1658
+ }
1659
+ .${e}-progress {
1660
+ position: absolute;
1661
+ left: 0;
1662
+ bottom: 0;
1663
+ z-index: 2;
1664
+ height: 2px;
1665
+ background: #fff;
1666
+ pointer-events: none;
1667
+ transition: width 300ms linear;
1668
+ }
1669
+ .${e}-sr {
1670
+ position: absolute;
1671
+ width: 1px;
1672
+ height: 1px;
1673
+ padding: 0;
1674
+ margin: -1px;
1675
+ overflow: hidden;
1676
+ clip: rect(0 0 0 0);
1677
+ white-space: nowrap;
1678
+ border: 0;
1679
+ }
1680
+ .${e}-menu {
1681
+ position: absolute;
1682
+ bottom: calc(100% + 8px);
1683
+ left: var(--menu-x, 12px);
1684
+ z-index: 3;
1685
+ display: flex;
1686
+ flex-direction: column;
1687
+ width: 240px;
1688
+ max-height: 280px;
1689
+ overflow: auto;
1690
+ padding: 4px;
1691
+ border: 1px solid var(--line);
1692
+ border-radius: 10px;
1693
+ background: var(--panel);
1694
+ color: var(--fg);
1695
+ box-shadow: var(--shadow-live);
1696
+ box-sizing: border-box;
1697
+ }
1698
+ .${e}-page-menu {
1699
+ display: flex;
1700
+ flex-direction: column;
1701
+ width: min(360px, calc(100vw - 32px));
1702
+ max-height: min(420px, calc(100vh - 96px));
1703
+ padding: 0;
1704
+ border-radius: 16px;
1705
+ overflow: hidden;
1706
+ }
1707
+ .${e}-page-menu-search {
1708
+ flex-shrink: 0;
1709
+ padding: 8px 12px 0;
1710
+ border-bottom: 1px solid var(--line);
1711
+ }
1712
+ .${e}-page-menu-list {
1713
+ display: flex;
1714
+ flex-direction: column;
1715
+ flex: 1 1 auto;
1716
+ gap: 1px;
1717
+ min-height: 240px;
1718
+ max-height: 320px;
1719
+ overflow: auto;
1720
+ padding: 4px 6px 6px;
1721
+ box-sizing: border-box;
1722
+ }
1723
+ .${e}-root[data-mode="preview"] .${e}-page-menu {
1724
+ border-color: var(--preview-line);
1725
+ background: #fff;
1726
+ color: var(--fg);
1727
+ box-shadow: 0 16px 40px rgba(24, 24, 27, 0.14), 0 2px 8px rgba(24, 24, 27, 0.06);
1728
+ }
1729
+ .${e}-menu input {
1730
+ width: 100%;
1731
+ height: 32px;
1732
+ margin: 2px 0 4px;
1733
+ padding: 0 8px;
1734
+ border: 1px solid var(--line);
1735
+ border-radius: 7px;
1736
+ background: #fff;
1737
+ color: var(--fg);
1738
+ font-size: 16px;
1739
+ cursor: text;
1740
+ user-select: text;
1741
+ }
1742
+ .${e} input.${e}-page-search {
1743
+ display: block;
1744
+ width: 100%;
1745
+ height: 40px;
1746
+ margin: 0;
1747
+ padding: 0 4px 10px;
1748
+ border: 0;
1749
+ border-radius: 0;
1750
+ background: transparent;
1751
+ color: var(--fg);
1752
+ font-size: 13px;
1753
+ font-weight: 500;
1754
+ line-height: 1.3;
1755
+ cursor: text;
1756
+ user-select: text;
1757
+ box-sizing: border-box;
1758
+ }
1759
+ .${e} input.${e}-page-search::placeholder {
1760
+ color: var(--fg3);
1761
+ font-weight: 400;
1762
+ }
1763
+ .${e}-page-menu-foot {
1764
+ display: flex;
1765
+ flex-direction: column;
1766
+ flex-shrink: 0;
1767
+ padding: 0 8px 8px;
1768
+ }
1769
+ .${e}-page-menu-foot::before {
1770
+ content: "";
1771
+ display: block;
1772
+ height: 1px;
1773
+ margin: 0 4px 6px;
1774
+ background: var(--line);
1775
+ }
1776
+ .${e}-option {
1777
+ display: flex;
1778
+ align-items: center;
1779
+ gap: 8px;
1780
+ width: 100%;
1781
+ min-height: 32px;
1782
+ padding: 0 8px;
1783
+ border-radius: 7px;
1784
+ text-align: left;
1785
+ box-sizing: border-box;
1786
+ }
1787
+ .${e}-page-menu .${e}-option {
1788
+ flex-shrink: 0;
1789
+ min-height: 30px;
1790
+ padding: 5px 12px;
1791
+ border-radius: 7px;
1792
+ font-size: 12.5px;
1793
+ line-height: 1.25;
1794
+ }
1795
+ .${e}-option > span:first-child {
1796
+ min-width: 0;
1797
+ overflow: hidden;
1798
+ text-overflow: ellipsis;
1799
+ white-space: nowrap;
1800
+ }
1801
+ .${e}-current { background: var(--hover); }
1802
+ .${e}-meta {
1803
+ margin-left: auto;
1804
+ flex-shrink: 0;
1805
+ color: var(--fg3);
1806
+ font-size: 11px;
1807
+ font-weight: 500;
1808
+ }
1809
+ .${e} button.${e}-gear {
1810
+ display: inline-flex;
1811
+ align-items: center;
1812
+ justify-content: center;
1813
+ width: 28px;
1814
+ height: 28px;
1815
+ margin-left: 4px;
1816
+ border-radius: 8px;
1817
+ background: var(--hover);
1818
+ color: var(--fg2);
1819
+ }
1820
+ .${e} button.${e}-gear svg {
1821
+ display: block;
1822
+ flex-shrink: 0;
1823
+ }
1824
+ .${e}-gear-on { background: var(--line); color: var(--fg); }
1825
+ .${e}-publish-on { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
1826
+ .${e}-root[data-mode="live"] button.${e}-publish-on {
1827
+ box-shadow: inset 0 0 0 1px var(--line2);
1828
+ }
1829
+ .${e}-root[data-mode="preview"] button.${e}-gear {
1830
+ background: rgba(255, 255, 255, 0.14);
1831
+ color: var(--preview-ink);
1832
+ }
1833
+ .${e}-settings {
1834
+ right: var(--menu-right, 8px);
1835
+ left: auto;
1836
+ width: 328px;
1837
+ max-height: min(480px, calc(100vh - 80px));
1838
+ padding: 8px;
1839
+ border-radius: 16px;
1840
+ overflow: auto;
1841
+ box-sizing: border-box;
1842
+ }
1843
+ .${e}-settings-head {
1844
+ display: flex;
1845
+ align-items: center;
1846
+ justify-content: space-between;
1847
+ gap: 12px;
1848
+ min-height: 28px;
1849
+ padding: 4px 12px 8px;
1850
+ }
1851
+ .${e}-settings-kicker {
1852
+ color: var(--fg3);
1853
+ font-size: 11px;
1854
+ font-weight: 600;
1855
+ letter-spacing: 0.08em;
1856
+ text-transform: uppercase;
1857
+ }
1858
+ .${e}-settings-place {
1859
+ min-width: 0;
1860
+ overflow: hidden;
1861
+ color: var(--fg3);
1862
+ font-size: 12px;
1863
+ font-weight: 500;
1864
+ text-overflow: ellipsis;
1865
+ white-space: nowrap;
1866
+ }
1867
+ .${e}-settings-row,
1868
+ .${e}-settings-action,
1869
+ .${e} button.${e}-settings-action {
1870
+ display: flex;
1871
+ align-items: center;
1872
+ gap: 10px;
1873
+ width: 100%;
1874
+ min-height: 40px;
1875
+ padding: 0 12px;
1876
+ border-radius: 8px;
1877
+ color: var(--fg);
1878
+ text-align: left;
1879
+ box-sizing: border-box;
1880
+ }
1881
+ .${e}-settings-row.${e}-settings-theme {
1882
+ flex-wrap: wrap;
1883
+ row-gap: 8px;
1884
+ padding-bottom: 4px;
1885
+ }
1886
+ .${e}-settings-theme > span:nth-child(2) {
1887
+ flex: 1 1 auto;
1888
+ }
1889
+ .${e}-settings-row > span:nth-child(2),
1890
+ .${e} button.${e}-settings-action > span:nth-child(2) {
1891
+ min-width: 0;
1892
+ flex: 1;
1893
+ }
1894
+ .${e}-settings-icon { flex-shrink: 0; color: var(--fg2); }
1895
+ .${e}-settings-rule { height: 1px; margin: 6px 12px; background: var(--line); }
1896
+ .${e}-segment {
1897
+ display: inline-flex;
1898
+ flex-shrink: 0;
1899
+ padding: 2px;
1900
+ border-radius: 9px;
1901
+ background: var(--hover);
1902
+ }
1903
+ .${e} button.${e}-segment-btn {
1904
+ height: 26px;
1905
+ padding: 0 10px;
1906
+ border-radius: 7px;
1907
+ color: var(--fg2);
1908
+ font-size: 12.5px;
1909
+ }
1910
+ .${e} button.${e}-segment-on {
1911
+ background: #fff;
1912
+ color: var(--fg);
1913
+ font-weight: 600;
1914
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
1915
+ }
1916
+ .${e} button.${e}-switch {
1917
+ position: relative;
1918
+ flex-shrink: 0;
1919
+ width: 36px;
1920
+ height: 22px;
1921
+ margin-left: auto;
1922
+ border-radius: 999px;
1923
+ background: #e4e4e1;
1924
+ }
1925
+ .${e} button.${e}-switch-on { background: var(--preview); }
1926
+ .${e}-knob {
1927
+ position: absolute;
1928
+ top: 2px;
1929
+ left: 2px;
1930
+ width: 18px;
1931
+ height: 18px;
1932
+ border-radius: 999px;
1933
+ background: #fff;
1934
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
1935
+ transition: transform 160ms var(--ease-out);
1936
+ }
1937
+ .${e}-switch-on .${e}-knob { transform: translateX(14px); }
1938
+ .${e}-settings .${e}-kbd { margin-left: auto; color: var(--fg3); }
1939
+ .${e}-settings-email {
1940
+ margin-left: auto;
1941
+ max-width: 46%;
1942
+ overflow: hidden;
1943
+ color: var(--fg3);
1944
+ font-size: 12px;
1945
+ font-weight: 500;
1946
+ text-align: right;
1947
+ text-overflow: ellipsis;
1948
+ white-space: nowrap;
1949
+ }
1950
+ .${e} button.${e}-settings-back {
1951
+ display: inline-flex;
1952
+ align-items: center;
1953
+ gap: 6px;
1954
+ min-height: 28px;
1955
+ color: var(--fg);
1956
+ font-weight: 600;
1957
+ }
1958
+ .${e}-settings-back svg { transform: rotate(90deg); }
1959
+ .${e}-settings-static { cursor: default; }
1960
+ .${e}-menu-split {
1961
+ display: flex;
1962
+ flex-direction: column;
1963
+ margin-top: 4px;
1964
+ padding-top: 4px;
1965
+ border-top: 1px solid var(--line);
1966
+ }
1967
+ .${e}-note {
1968
+ margin: 0;
1969
+ padding: 8px;
1970
+ color: var(--fg2);
1971
+ font-size: 12px;
1972
+ font-weight: 500;
1973
+ }
1974
+ .${e}-page-menu .${e}-note {
1975
+ padding: 8px 12px;
1976
+ font-size: 12.5px;
1977
+ }
1978
+ .${e}-note-error { color: #b91c1c; }
1979
+ .${e}-note-muted { color: var(--fg3); }
1980
+ @media (hover: hover) {
1981
+ .${e} button.${e}-mode:hover:not(:disabled) { background: var(--preview-hover); }
1982
+ .${e}-root[data-mode="preview"] button.${e}-mode:hover:not(:disabled) { background: var(--preview-hover); }
1983
+ .${e}-root[data-mode="live"] button.${e}-btn:hover:not(:disabled),
1984
+ .${e}-root[data-mode="live"] button.${e}-page:hover:not(:disabled),
1985
+ .${e}-root[data-mode="live"] button.${e}-gear:hover,
1986
+ .${e}-option:hover:not(:disabled),
1987
+ .${e} button.${e}-settings-action:hover { background: var(--hover); }
1988
+ .${e}-root[data-mode="preview"] button.${e}-btn:hover:not(:disabled),
1989
+ .${e}-root[data-mode="preview"] button.${e}-page:hover:not(:disabled) { background: var(--preview-hover); }
1990
+ .${e}-root[data-mode="preview"] button.${e}-publish:hover:not(:disabled),
1991
+ .${e}-root[data-mode="preview"] button.${e}-publish:active:not(:disabled) { background: #fff; }
1992
+ .${e}-root[data-mode="preview"] button.${e}-btn:active:not(:disabled) { background: var(--preview-deep); }
1993
+ }
1994
+ @media (prefers-reduced-motion: reduce) {
1995
+ .${e}-flood,
1996
+ .${e} button,
1997
+ .${e}-clip,
1998
+ .${e}-progress,
1999
+ .${e}-knob { transition: none !important; }
2000
+ .${e}-flood { clip-path: none; opacity: 0; }
2001
+ .${e}-root[data-mode="preview"] .${e}-flood { opacity: 1; }
2002
+ }
2003
+ @keyframes ${e}-spin { to { transform: rotate(360deg); } }
2004
+ @keyframes ${e}-shimmer {
2005
+ from { background-position: 200% 0; }
2006
+ to { background-position: -200% 0; }
2007
+ }
2008
+ :host(.${e}-pointing) .${e},
2009
+ :host(.${e}-pointing) .${e} * { cursor: pointer !important; }
2010
+ :host(.${e}-pointing) .${e} button:disabled { cursor: default !important; }
2011
+ `, Se = () => {
2012
+ }, yr = {
2013
+ position: "relative",
2014
+ height: 96,
2015
+ overflow: "hidden",
2016
+ transform: "translateZ(0)",
2017
+ "--bm-devbar-right": "auto",
2018
+ "--bm-devbar-left": "12px"
2019
+ }, Nr = {
2020
+ locale: "en",
2021
+ type: "page",
2022
+ slug: "home",
2023
+ workspaceId: "ws_sample"
2024
+ };
2025
+ function Sr() {
2026
+ const [n, r] = f(0);
2027
+ return /* @__PURE__ */ s("div", { style: { display: "flex", flexDirection: "column", gap: 40 }, children: [
2028
+ /* @__PURE__ */ t("style", { children: `
2029
+ .ui-kit-devbar-label {
2030
+ margin: 0 0 8px;
2031
+ font-size: 14px;
2032
+ font-weight: 600;
2033
+ letter-spacing: -0.01em;
2034
+ line-height: 1.3;
2035
+ }
2036
+ .ui-kit-devbar-stage {
2037
+ width: 100%;
2038
+ }
2039
+ .ui-kit-devbar-reset {
2040
+ align-self: flex-start;
2041
+ height: 28px;
2042
+ padding: 0 10px;
2043
+ border: 1px solid currentColor;
2044
+ border-radius: 8px;
2045
+ background: transparent;
2046
+ color: inherit;
2047
+ font: 500 13px/1 ui-sans-serif, system-ui, sans-serif;
2048
+ cursor: pointer;
2049
+ }
2050
+ .ui-kit-devbar-reset:focus-visible {
2051
+ outline: 2px solid currentColor;
2052
+ outline-offset: 2px;
2053
+ }
2054
+ ` }),
2055
+ /* @__PURE__ */ t(
2056
+ "button",
2057
+ {
2058
+ type: "button",
2059
+ className: "ui-kit-devbar-reset",
2060
+ onClick: () => r((o) => o + 1),
2061
+ children: "Reset"
2062
+ }
2063
+ ),
2064
+ /* @__PURE__ */ t(K, { play: n, heading: "Preview", siteMode: "preview" }),
2065
+ /* @__PURE__ */ t(K, { play: n, heading: "Live", siteMode: "live" }),
2066
+ /* @__PURE__ */ t(K, { play: n, heading: "Branch", siteMode: "preview", branch: "feat/sale", doc: !0 }),
2067
+ /* @__PURE__ */ t(K, { play: n, heading: "Exiting", siteMode: "preview", exiting: !0 }),
2068
+ /* @__PURE__ */ t(K, { play: n, heading: "Agent", siteMode: "preview", doc: !0, chatOpen: !0 }),
2069
+ /* @__PURE__ */ t(K, { play: n, heading: "Publish", siteMode: "live", doc: !0, changeCount: 3 }),
2070
+ /* @__PURE__ */ t(
2071
+ K,
2072
+ {
2073
+ play: n,
2074
+ heading: "Changes",
2075
+ siteMode: "preview",
2076
+ doc: !0,
2077
+ changeCount: 3,
2078
+ lineDiff: { added: 14, removed: 2 }
2079
+ }
2080
+ ),
2081
+ /* @__PURE__ */ t(
2082
+ K,
2083
+ {
2084
+ play: n,
2085
+ heading: "Editing",
2086
+ siteMode: "preview",
2087
+ doc: !0,
2088
+ activity: { type: "editing", field: "hero.title" }
2089
+ }
2090
+ ),
2091
+ /* @__PURE__ */ t(
2092
+ K,
2093
+ {
2094
+ play: n,
2095
+ heading: "Publishing",
2096
+ siteMode: "preview",
2097
+ doc: !0,
2098
+ activity: {
2099
+ type: "publishing",
2100
+ progress: 0.45,
2101
+ steps: [
2102
+ { label: "Commit", state: "done" },
2103
+ { label: "PR #42", state: "done" },
2104
+ { label: "Deploying 0:14", state: "active" }
2105
+ ]
2106
+ }
2107
+ }
2108
+ ),
2109
+ /* @__PURE__ */ t(
2110
+ K,
2111
+ {
2112
+ play: n,
2113
+ heading: "Published",
2114
+ siteMode: "live",
2115
+ doc: !0,
2116
+ activity: { type: "published", sha: "3a9f21", when: "just now" }
2117
+ }
2118
+ )
2119
+ ] });
2120
+ }
2121
+ function K({
2122
+ play: n,
2123
+ heading: r,
2124
+ siteMode: o,
2125
+ branch: a,
2126
+ exiting: d = !1,
2127
+ doc: m = !1,
2128
+ chatOpen: h = !1,
2129
+ changeCount: u = 0,
2130
+ lineDiff: p,
2131
+ activity: c = null
2132
+ }) {
2133
+ return /* @__PURE__ */ s("section", { style: { display: "flex", flexDirection: "column" }, children: [
2134
+ /* @__PURE__ */ t("h2", { className: "ui-kit-devbar-label", children: r }),
2135
+ /* @__PURE__ */ t("div", { className: "ui-kit-devbar-stage", style: yr, children: /* @__PURE__ */ t(
2136
+ tr,
2137
+ {
2138
+ label: "page/home",
2139
+ branch: a,
2140
+ doc: m ? Nr : null,
2141
+ siteMode: o,
2142
+ exiting: d,
2143
+ chatOpen: h,
2144
+ publishOpen: !1,
2145
+ changeCount: u,
2146
+ lineDiff: p,
2147
+ activity: c,
2148
+ entrance: "play",
2149
+ onExit: Se,
2150
+ onEnterPreview: Se,
2151
+ onToggleChat: Se,
2152
+ onTogglePublish: Se
2153
+ },
2154
+ n
2155
+ ) })
2156
+ ] });
2157
+ }
2158
+ const wt = P.find((n) => n.slug === "feedback");
2159
+ function Mr() {
2160
+ return /* @__PURE__ */ t(O, { title: wt.title, lede: wt.lede, children: /* @__PURE__ */ s(Ee, { children: [
2161
+ /* @__PURE__ */ t(b, { label: "StatusBar", block: !0, children: /* @__PURE__ */ s(He, { children: [
2162
+ /* @__PURE__ */ t(me, { children: "main" }),
2163
+ /* @__PURE__ */ t(me, { children: "2 uncommitted" })
2164
+ ] }) }),
2165
+ /* @__PURE__ */ t(b, { label: "StatusBar", block: !0, children: /* @__PURE__ */ s(He, { children: [
2166
+ /* @__PURE__ */ t(me, { children: "feat/sale" }),
2167
+ /* @__PURE__ */ t(me, { children: "Unsaved" })
2168
+ ] }) }),
2169
+ /* @__PURE__ */ t(b, { label: "danger", block: !0, children: /* @__PURE__ */ t(He, { children: /* @__PURE__ */ t(me, { tone: "danger", children: "Save failed" }) }) }),
2170
+ /* @__PURE__ */ t(b, { label: "success", children: /* @__PURE__ */ t($, { tone: "success", children: "Success" }) }),
2171
+ /* @__PURE__ */ t(b, { label: "danger", children: /* @__PURE__ */ t($, { tone: "danger", children: "Danger" }) })
2172
+ ] }) });
2173
+ }
2174
+ const yt = P.find((n) => n.slug === "fields");
2175
+ function Er() {
2176
+ const [n, r] = f("en");
2177
+ return /* @__PURE__ */ t(O, { title: yt.title, lede: yt.lede, children: /* @__PURE__ */ s(Ee, { children: [
2178
+ /* @__PURE__ */ t(b, { label: "Input", block: !0, children: /* @__PURE__ */ t(Ne, { label: "Text", hint: "Shown under the field.", children: /* @__PURE__ */ t(st, { defaultValue: "Ada Lovelace", autoComplete: "off", spellCheck: !1 }) }) }),
2179
+ /* @__PURE__ */ t(b, { label: "disabled", block: !0, children: /* @__PURE__ */ t(Ne, { label: "Disabled", children: /* @__PURE__ */ t(st, { defaultValue: "Locked", disabled: !0 }) }) }),
2180
+ /* @__PURE__ */ t(b, { label: "Select", block: !0, children: /* @__PURE__ */ t(Ne, { label: "Select", children: /* @__PURE__ */ t(
2181
+ dn,
2182
+ {
2183
+ "aria-label": "Locale",
2184
+ value: n,
2185
+ onValueChange: (o) => r(o ?? "en"),
2186
+ options: [
2187
+ { value: "en", label: "English (en)" },
2188
+ { value: "da", label: "Dansk (da)" }
2189
+ ]
2190
+ }
2191
+ ) }) }),
2192
+ /* @__PURE__ */ t(b, { label: "Textarea", block: !0, children: /* @__PURE__ */ t(Ne, { label: "Body", children: /* @__PURE__ */ t(un, { mono: !0, rows: 4, defaultValue: `---
2193
+ title: Hello
2194
+ ---
2195
+
2196
+ Paragraph.` }) }) })
2197
+ ] }) });
2198
+ }
2199
+ const Nt = P.find((n) => n.slug === "lists");
2200
+ function Cr() {
2201
+ return /* @__PURE__ */ t(O, { title: Nt.title, lede: Nt.lede, children: /* @__PURE__ */ t(b, { label: "List", block: !0, children: /* @__PURE__ */ s(Nn, { children: [
2202
+ /* @__PURE__ */ t(lt, { to: "/__ui/lists", title: "hello", meta: "en" }),
2203
+ /* @__PURE__ */ t(lt, { to: "/__ui/lists", title: "about", meta: "da" })
2204
+ ] }) }) });
2205
+ }
2206
+ const St = P.find((n) => n.slug === "overlays");
2207
+ function zr() {
2208
+ const [n, r] = f(!1);
2209
+ return /* @__PURE__ */ t(hn, { children: /* @__PURE__ */ t(O, { title: St.title, lede: St.lede, children: /* @__PURE__ */ s(Ee, { children: [
2210
+ /* @__PURE__ */ s(b, { label: "ConfirmDialog", children: [
2211
+ /* @__PURE__ */ t(ue, { onClick: () => r(!0), children: "Open dialog" }),
2212
+ /* @__PURE__ */ t(
2213
+ pn,
2214
+ {
2215
+ open: n,
2216
+ onOpenChange: r,
2217
+ title: "Delete this sample?",
2218
+ confirmLabel: "Delete",
2219
+ cancelLabel: "Cancel",
2220
+ destructive: !0,
2221
+ onConfirm: () => r(!1)
2222
+ }
2223
+ )
2224
+ ] }),
2225
+ /* @__PURE__ */ t(b, { label: "Tooltip", children: /* @__PURE__ */ t(gn, { label: "Sample tooltip", children: /* @__PURE__ */ t(ue, { variant: "secondary", children: "Hover" }) }) })
2226
+ ] }) }) });
2227
+ }
2228
+ const Mt = P.find((n) => n.slug === "sections");
2229
+ function Rr() {
2230
+ return /* @__PURE__ */ s(O, { title: Mt.title, lede: Mt.lede, children: [
2231
+ /* @__PURE__ */ t(b, { label: "PageHeader", block: !0, children: /* @__PURE__ */ t(
2232
+ mn,
2233
+ {
2234
+ kicker: /* @__PURE__ */ t(fn, { to: "/__ui/sections", children: "Sections" }),
2235
+ title: "Documents",
2236
+ description: "Sample page header with action.",
2237
+ action: /* @__PURE__ */ t(ue, { children: "New" })
2238
+ }
2239
+ ) }),
2240
+ /* @__PURE__ */ t(b, { label: "Panel", block: !0, children: /* @__PURE__ */ t(bn, { children: /* @__PURE__ */ s(xn, { children: [
2241
+ /* @__PURE__ */ t($, { children: "First line" }),
2242
+ /* @__PURE__ */ t($, { children: "Second line" })
2243
+ ] }) }) })
2244
+ ] });
2245
+ }
2246
+ const Et = P.find((n) => n.slug === "surfaces");
2247
+ function Ir() {
2248
+ return /* @__PURE__ */ s(O, { title: Et.title, lede: Et.lede, children: [
2249
+ /* @__PURE__ */ t(b, { label: "Space", children: /* @__PURE__ */ s("div", { className: "x78zum5 x1a02dak xuk3077 x1n5939r", children: [
2250
+ /* @__PURE__ */ t(ee, { label: "xs", bar: V.xs }),
2251
+ /* @__PURE__ */ t(ee, { label: "sm", bar: V.sm }),
2252
+ /* @__PURE__ */ t(ee, { label: "md", bar: V.md }),
2253
+ /* @__PURE__ */ t(ee, { label: "lg", bar: V.lg }),
2254
+ /* @__PURE__ */ t(ee, { label: "xl", bar: V.xl }),
2255
+ /* @__PURE__ */ t(ee, { label: "xxl", bar: V.xxl })
2256
+ ] }) }),
2257
+ /* @__PURE__ */ t(b, { label: "Radius", children: /* @__PURE__ */ s("div", { className: "x78zum5 x1a02dak xuk3077 x1n5939r", children: [
2258
+ /* @__PURE__ */ t(ee, { label: "sm", box: V.radiusSm }),
2259
+ /* @__PURE__ */ t(ee, { label: "md", box: V.radiusMd })
2260
+ ] }) }),
2261
+ /* @__PURE__ */ t(b, { label: "Backgrounds", children: /* @__PURE__ */ s("div", { className: "xk7greg x13oidi x86kjsi", children: [
2262
+ /* @__PURE__ */ t($, { size: "xs", tone: "muted", mono: !0, children: "bgApp" }),
2263
+ /* @__PURE__ */ s("div", { className: "xk7greg x13oidi x1jtkcfc", children: [
2264
+ /* @__PURE__ */ t($, { size: "xs", tone: "muted", mono: !0, children: "bgSidebar" }),
2265
+ /* @__PURE__ */ s("div", { className: "xk7greg x13oidi x1d0qn7y", children: [
2266
+ /* @__PURE__ */ t($, { size: "xs", tone: "muted", mono: !0, children: "bgPanel" }),
2267
+ /* @__PURE__ */ t("div", { className: "xk7greg x13oidi x1hb2obb xmkeg23 x1y0btm7 x1j0qoeq", children: /* @__PURE__ */ t($, { size: "xs", mono: !0, children: "bgSurface" }) })
2268
+ ] })
2269
+ ] })
2270
+ ] }) })
2271
+ ] });
2272
+ }
2273
+ function ee({
2274
+ label: n,
2275
+ bar: r,
2276
+ box: o
2277
+ }) {
2278
+ return /* @__PURE__ */ s("div", { className: "x78zum5 xdt5ytf x1cy8zhl x3smv4v", children: [
2279
+ /* @__PURE__ */ t("div", { ...Rt(r ? V.bar : V.radiusBox, r, o) }),
2280
+ /* @__PURE__ */ t($, { size: "xs", tone: "muted", mono: !0, children: n })
2281
+ ] });
2282
+ }
2283
+ const V = {
2284
+ bar: {
2285
+ kZKoxP: "xlup9mm",
2286
+ kWkggS: "xrb6rkd",
2287
+ kaIpWk: "xjdkmwh",
2288
+ $$css: !0
2289
+ },
2290
+ xs: {
2291
+ kzqmXN: "x1ezurc1",
2292
+ $$css: !0
2293
+ },
2294
+ sm: {
2295
+ kzqmXN: "x1odspls",
2296
+ $$css: !0
2297
+ },
2298
+ md: {
2299
+ kzqmXN: "x1w3uvz2",
2300
+ $$css: !0
2301
+ },
2302
+ lg: {
2303
+ kzqmXN: "xuuo8to",
2304
+ $$css: !0
2305
+ },
2306
+ xl: {
2307
+ kzqmXN: "x11jbs3w",
2308
+ $$css: !0
2309
+ },
2310
+ xxl: {
2311
+ kzqmXN: "x1y0qqsj",
2312
+ $$css: !0
2313
+ },
2314
+ radiusBox: {
2315
+ kzqmXN: "x1fu8urw",
2316
+ kZKoxP: "x1vqgdyp",
2317
+ kWkggS: "x1hb2obb",
2318
+ kMzoRj: "xmkeg23",
2319
+ ksu8eU: "x1y0btm7",
2320
+ kVAM5u: "x1j0qoeq",
2321
+ $$css: !0
2322
+ },
2323
+ radiusSm: {
2324
+ kaIpWk: "xjdkmwh",
2325
+ $$css: !0
2326
+ },
2327
+ radiusMd: {
2328
+ kaIpWk: "x13oidi",
2329
+ $$css: !0
2330
+ }
2331
+ }, Ct = P.find((n) => n.slug === "type");
2332
+ function _r() {
2333
+ return /* @__PURE__ */ s(O, { title: Ct.title, lede: Ct.lede, children: [
2334
+ /* @__PURE__ */ t(b, { label: "display", children: /* @__PURE__ */ t($, { size: "display", weight: "semibold", children: "Display" }) }),
2335
+ /* @__PURE__ */ t(b, { label: "xl", children: /* @__PURE__ */ t($, { size: "xl", weight: "semibold", children: "Title" }) }),
2336
+ /* @__PURE__ */ t(b, { label: "lg", children: /* @__PURE__ */ t($, { size: "lg", weight: "medium", children: "Heading" }) }),
2337
+ /* @__PURE__ */ t(b, { label: "md", children: /* @__PURE__ */ t($, { children: "Body" }) }),
2338
+ /* @__PURE__ */ t(b, { label: "sm", children: /* @__PURE__ */ t($, { size: "sm", children: "Small" }) }),
2339
+ /* @__PURE__ */ t(b, { label: "xs", children: /* @__PURE__ */ t($, { size: "xs", weight: "semibold", children: "Overline" }) }),
2340
+ /* @__PURE__ */ t(b, { label: "muted", children: /* @__PURE__ */ t($, { tone: "muted", size: "sm", children: "Muted" }) }),
2341
+ /* @__PURE__ */ t(b, { label: "danger", children: /* @__PURE__ */ t($, { tone: "danger", children: "Danger" }) }),
2342
+ /* @__PURE__ */ t(b, { label: "success", children: /* @__PURE__ */ t($, { tone: "success", children: "Success" }) }),
2343
+ /* @__PURE__ */ t(b, { label: "mono", children: /* @__PURE__ */ t($, { mono: !0, size: "sm", children: "content/blog/hello.mdx" }) })
2344
+ ] });
2345
+ }
2346
+ const Ar = {
2347
+ colors: zn,
2348
+ type: _r,
2349
+ surfaces: Ir,
2350
+ sections: Rr,
2351
+ buttons: Cn,
2352
+ fields: Er,
2353
+ lists: Cr,
2354
+ overlays: zr,
2355
+ feedback: Mr,
2356
+ devbar: Lr
2357
+ };
2358
+ function Lr() {
2359
+ const n = P.find((r) => r.slug === "devbar");
2360
+ return /* @__PURE__ */ t(O, { title: n.title, lede: n.lede, children: /* @__PURE__ */ t(Sr, {}) });
2361
+ }
2362
+ const zt = P.map((n) => ({
2363
+ ...n,
2364
+ Page: Ar[n.slug]
2365
+ })), Br = [{
2366
+ value: "system",
2367
+ label: "System"
2368
+ }, {
2369
+ value: "light",
2370
+ label: "Light"
2371
+ }, {
2372
+ value: "dark",
2373
+ label: "Dark"
2374
+ }], Pr = ["Foundations", "Components", "Host"];
2375
+ function jr() {
2376
+ const {
2377
+ pathname: n
2378
+ } = vn(), r = n.replace(/\/$/, "") || "/", o = r === "/__ui" ? void 0 : r.slice(6), a = Mn(o), {
2379
+ preference: d,
2380
+ setPreference: m
2381
+ } = $n();
2382
+ if (r !== `/__ui/${a}`)
2383
+ return /* @__PURE__ */ t(kn, { to: `/__ui/${a}`, replace: !0 });
2384
+ const u = zt.find((p) => p.slug === a).Page;
2385
+ return /* @__PURE__ */ s("div", { className: "x78zum5 xdt5ytf x1ov3xa9 x86kjsi xqjzbou xnezs1t", children: [
2386
+ /* @__PURE__ */ s("header", { className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x173sf5p x15jjofa xso031l x1q0q8m5 x4b2zrn x1hb2obb", children: [
2387
+ /* @__PURE__ */ t($, { as: "p", size: "lg", weight: "semibold", children: "UI kit" }),
2388
+ /* @__PURE__ */ t("div", { className: "x78zum5 x1a02dak x3smv4v", role: "group", "aria-label": "Theme", children: Br.map((p) => /* @__PURE__ */ t(ue, { variant: d === p.value ? "primary" : "secondary", "aria-pressed": d === p.value, onClick: () => m(p.value), children: p.label }, p.value)) })
2389
+ ] }),
2390
+ /* @__PURE__ */ s("div", { className: "x78zum5 x98rzlu x2lwn1j", children: [
2391
+ /* @__PURE__ */ t("nav", { className: "x16grhtn x2lah0s x1odjw0f xk7greg x1jtkcfc xs1s249 x32b0ac xpozbvl", "aria-label": "UI kit", children: Pr.map((p) => /* @__PURE__ */ s("div", { className: "x78zum5 xdt5ytf xpw8yq9 x31bu4j", children: [
2392
+ /* @__PURE__ */ t($, { as: "p", size: "xs", tone: "muted", weight: "semibold", children: p }),
2393
+ zt.filter((c) => c.group === p).map((c) => /* @__PURE__ */ t(wn, { to: `/__ui/${c.slug}`, className: "x1lliihq x1heor9g x1hl2dhg", children: ({
2394
+ isActive: R
2395
+ }) => /* @__PURE__ */ t("span", { ...{
2396
+ 0: {
2397
+ className: "x78zum5 x6s0dn4 x13oidi x1l8q8zy x1om5956 x17tv04q xk50ysn xqjzbou x1xcxyqb"
2398
+ },
2399
+ 1: {
2400
+ className: "x78zum5 x6s0dn4 x13oidi x1l8q8zy x1om5956 x17tv04q xk50ysn xqjzbou x1xcxyqb xaaunc5"
2401
+ }
2402
+ }[!!R << 0], children: c.title }) }, c.slug))
2403
+ ] }, p)) }),
2404
+ /* @__PURE__ */ t("main", { className: "x98rzlu xeuugli x1odjw0f xm8shrt x198e4go", children: /* @__PURE__ */ t(u, {}) })
2405
+ ] })
2406
+ ] });
2407
+ }
2408
+ export {
2409
+ jr as UiKitApp
2410
+ };