@backmatter/studio 0.0.7 → 0.0.9

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