@orangecheck/app-design 1.0.0 → 1.1.1

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 (66) hide show
  1. package/README.md +21 -5
  2. package/dist/chrome.d.mts +31 -42
  3. package/dist/chrome.d.ts +31 -42
  4. package/dist/chrome.js +502 -24
  5. package/dist/chrome.js.map +1 -1
  6. package/dist/chrome.mjs +497 -26
  7. package/dist/chrome.mjs.map +1 -1
  8. package/dist/code.d.mts +52 -0
  9. package/dist/code.d.ts +52 -0
  10. package/dist/code.js +534 -0
  11. package/dist/code.js.map +1 -0
  12. package/dist/code.mjs +522 -0
  13. package/dist/code.mjs.map +1 -0
  14. package/dist/components.d.mts +61 -117
  15. package/dist/components.d.ts +61 -117
  16. package/dist/components.js +2178 -106
  17. package/dist/components.js.map +1 -1
  18. package/dist/components.mjs +2150 -110
  19. package/dist/components.mjs.map +1 -1
  20. package/dist/docs-DhnstueM.d.ts +219 -0
  21. package/dist/docs-DiR6s43s.d.mts +219 -0
  22. package/dist/family.js +2 -1
  23. package/dist/family.js.map +1 -1
  24. package/dist/family.mjs +2 -1
  25. package/dist/family.mjs.map +1 -1
  26. package/dist/format.d.mts +12 -0
  27. package/dist/format.d.ts +12 -0
  28. package/dist/format.js +65 -0
  29. package/dist/format.js.map +1 -0
  30. package/dist/format.mjs +58 -0
  31. package/dist/format.mjs.map +1 -0
  32. package/dist/hero-Dn37il-9.d.mts +31 -0
  33. package/dist/hero-Dn37il-9.d.ts +31 -0
  34. package/dist/index.d.mts +10 -3
  35. package/dist/index.d.ts +10 -3
  36. package/dist/index.js +2675 -131
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +2621 -134
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/mdx.d.mts +58 -0
  41. package/dist/mdx.d.ts +58 -0
  42. package/dist/mdx.js +1719 -0
  43. package/dist/mdx.js.map +1 -0
  44. package/dist/mdx.mjs +1692 -0
  45. package/dist/mdx.mjs.map +1 -0
  46. package/dist/primitives.d.mts +22 -5
  47. package/dist/primitives.d.ts +22 -5
  48. package/dist/primitives.js +51 -5
  49. package/dist/primitives.js.map +1 -1
  50. package/dist/primitives.mjs +51 -7
  51. package/dist/primitives.mjs.map +1 -1
  52. package/dist/session.d.mts +18 -0
  53. package/dist/session.d.ts +18 -0
  54. package/dist/session.js +432 -0
  55. package/dist/session.js.map +1 -0
  56. package/dist/session.mjs +401 -0
  57. package/dist/session.mjs.map +1 -0
  58. package/dist/styles/code.css +97 -0
  59. package/dist/styles/theme.css +2 -0
  60. package/dist/styles/tokens.css +40 -0
  61. package/dist/styles.css +1 -0
  62. package/dist/tool-shell-B1C7ahKE.d.ts +81 -0
  63. package/dist/tool-shell-BDx_N5ai.d.mts +81 -0
  64. package/dist/tools-BggNN5DV.d.ts +131 -0
  65. package/dist/tools-DFIxIj5p.d.mts +131 -0
  66. package/package.json +31 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Slot } from '@radix-ui/react-slot';
2
2
  import { cva } from 'class-variance-authority';
3
- import { forwardRef, createContext, useContext, useRef, useState, useCallback, useEffect, useId, isValidElement, cloneElement, useSyncExternalStore, useMemo, createElement, Children, Component, Fragment as Fragment$1 } from 'react';
3
+ import { forwardRef, useContext, createContext, useRef, useState, useCallback, useEffect, useMemo, useId, useSyncExternalStore, Children, isValidElement, createElement, cloneElement, Component, Fragment as Fragment$1 } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { extendTailwindMerge } from 'tailwind-merge';
6
6
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
@@ -12,14 +12,14 @@ import * as LabelPrimitive from '@radix-ui/react-label';
12
12
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
13
13
  import * as SelectPrimitive from '@radix-ui/react-select';
14
14
  import * as SwitchPrimitive from '@radix-ui/react-switch';
15
- import { ChevronDown, Check, X, ChevronLeft, ChevronRight, Copy, ArrowUpRight, Menu, Sun, Moon, SunMoon, CircleDashed, CircleMinus, Clock, CircleX, CircleCheck } from 'lucide-react';
15
+ import { ChevronDown, Check, X, Search, ArrowUpRight, ArrowRight, Copy, ChevronLeft, ChevronRight, CornerDownLeft, Download, FileText, Upload, Menu, PanelLeft, Sun, Moon, SunMoon, CircleUser, LogOut, ArrowLeft, Lock, CircleDashed, CircleMinus, Clock, CircleX, CircleCheck } from 'lucide-react';
16
16
  import * as DialogPrimitive from '@radix-ui/react-dialog';
17
17
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
18
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
19
19
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
20
20
  import * as TabsPrimitive from '@radix-ui/react-tabs';
21
21
  import QRCode from 'qrcode';
22
- import Link5 from 'next/link';
22
+ import Link8 from 'next/link';
23
23
  import { useTheme } from 'next-themes';
24
24
 
25
25
  // src/tokens/index.ts
@@ -362,6 +362,20 @@ function CardContent({ className, ...props }) {
362
362
  function CardFooter({ className, ...props }) {
363
363
  return /* @__PURE__ */ jsx("div", { className: cn("mt-6 flex flex-wrap items-center gap-3", className), ...props });
364
364
  }
365
+ function sharedContext(name, initial) {
366
+ const key = /* @__PURE__ */ Symbol.for(`@orangecheck/app-design/${name}`);
367
+ const store = globalThis;
368
+ return store[key] ?? (store[key] = createContext(initial));
369
+ }
370
+
371
+ // src/lib/density.ts
372
+ var DensityContext = sharedContext("density", "comfortable");
373
+ function DensityProvider({ density, children }) {
374
+ return createElement(DensityContext.Provider, { value: density }, children);
375
+ }
376
+ function useDensity() {
377
+ return useContext(DensityContext);
378
+ }
365
379
  var fieldBase = [
366
380
  "w-full rounded-xl border border-input bg-card text-foreground placeholder:text-oca-subtle",
367
381
  "text-base md:text-[0.9375rem] outline-none transition-[border-color,box-shadow]",
@@ -369,8 +383,24 @@ var fieldBase = [
369
383
  "disabled:cursor-not-allowed disabled:opacity-55",
370
384
  "aria-[invalid=true]:border-destructive aria-[invalid=true]:focus:ring-[color-mix(in_oklab,var(--destructive)_14%,transparent)]"
371
385
  ];
372
- var Input = forwardRef(function Input2({ className, type = "text", ...props }, ref) {
373
- return /* @__PURE__ */ jsx("input", { ref, type, "data-ui": "input", className: cn(fieldBase, "h-11 px-3.5", className), ...props });
386
+ var FIELD_SIZE = {
387
+ md: "h-11 px-3.5",
388
+ sm: "h-9 rounded-[0.625rem] px-3 md:text-[0.875rem]"
389
+ };
390
+ var Input = forwardRef(function Input2({ className, type = "text", size, ...props }, ref) {
391
+ const density = useDensity();
392
+ const s = size ?? (density === "compact" ? "sm" : "md");
393
+ return /* @__PURE__ */ jsx(
394
+ "input",
395
+ {
396
+ ref,
397
+ type,
398
+ "data-ui": "input",
399
+ "data-size": s,
400
+ className: cn(fieldBase, FIELD_SIZE[s], className),
401
+ ...props
402
+ }
403
+ );
374
404
  });
375
405
  var Textarea = forwardRef(
376
406
  function Textarea2({ className, ...props }, ref) {
@@ -427,15 +457,29 @@ function Field({ label, hint, optional, error, children, className, hideLabel, a
427
457
  error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-[0.8125rem] leading-snug text-destructive", children: error }) : null
428
458
  ] });
429
459
  }
430
- var Select = SelectPrimitive.Root;
460
+ var SelectFieldContext = sharedContext("select-field", null);
461
+ function Select({
462
+ id,
463
+ "aria-describedby": describedBy,
464
+ "aria-invalid": invalid,
465
+ ...props
466
+ }) {
467
+ return /* @__PURE__ */ jsx(SelectFieldContext.Provider, { value: { id, "aria-describedby": describedBy, "aria-invalid": invalid }, children: /* @__PURE__ */ jsx(SelectPrimitive.Root, { ...props }) });
468
+ }
431
469
  var SelectGroup = SelectPrimitive.Group;
432
470
  var SelectValue = SelectPrimitive.Value;
433
- var SelectTrigger = forwardRef(function SelectTrigger2({ className, children, ...props }, ref) {
471
+ var SelectTrigger = forwardRef(function SelectTrigger2({ className, children, size, ...props }, ref) {
472
+ const density = useDensity();
473
+ const field = useContext(SelectFieldContext);
474
+ const s = size ?? (density === "compact" ? "sm" : "md");
434
475
  return /* @__PURE__ */ jsxs(
435
476
  SelectPrimitive.Trigger,
436
477
  {
437
478
  ref,
438
- className: cn(fieldBase, "flex h-11 items-center justify-between gap-2 px-3.5 text-left", className),
479
+ id: field?.id,
480
+ "aria-describedby": field?.["aria-describedby"],
481
+ "aria-invalid": field?.["aria-invalid"],
482
+ className: cn(fieldBase, FIELD_SIZE[s], "flex items-center justify-between gap-2 text-left", className),
439
483
  ...props,
440
484
  children: [
441
485
  /* @__PURE__ */ jsx("span", { className: "truncate", children }),
@@ -1751,6 +1795,7 @@ function useActiveHeading(ids) {
1751
1795
  const [active, setActive] = useState(ids[0]);
1752
1796
  const key = ids.join("|");
1753
1797
  useEffect(() => {
1798
+ setActive(key.split("|")[0] || void 0);
1754
1799
  const els = key.split("|").map((id) => document.getElementById(id)).filter((el) => el !== null);
1755
1800
  if (els.length === 0 || typeof IntersectionObserver === "undefined") return;
1756
1801
  const io = new IntersectionObserver(
@@ -1843,7 +1888,563 @@ function StepGrid({ items, look = "cards", className }) {
1843
1888
  ] }) }, i)
1844
1889
  ) });
1845
1890
  }
1846
- var ShellContext = createContext({});
1891
+ var KIND = {
1892
+ package: "text-oca-code-package",
1893
+ tag: "text-oca-code-tag",
1894
+ link: "text-oca-code-link"
1895
+ };
1896
+ function PackageCard({ items, className }) {
1897
+ return /* @__PURE__ */ jsx(
1898
+ "div",
1899
+ {
1900
+ className: cn(
1901
+ "grid gap-x-10 gap-y-7 rounded-[1.25rem] border border-oca-ink-line bg-oca-ink-card p-6 text-oca-ink-foreground md:grid-cols-2 md:p-9",
1902
+ className
1903
+ ),
1904
+ children: items.map((it, i) => {
1905
+ const code = /* @__PURE__ */ jsx("span", { className: cn("text-[0.9375rem]", KIND[it.kind ?? "package"]), children: it.code });
1906
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
1907
+ /* @__PURE__ */ jsx("h3", { className: "text-[1.125rem] font-semibold tracking-[-0.01em] text-oca-ink-title", children: it.title }),
1908
+ it.href ? /* @__PURE__ */ jsx("a", { href: it.href, className: "w-fit underline decoration-transparent underline-offset-4 hover:decoration-current", children: code }) : code,
1909
+ it.note ? /* @__PURE__ */ jsxs("p", { className: "text-[0.9375rem] leading-relaxed text-oca-ink-subtle", children: [
1910
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "// " }),
1911
+ it.note
1912
+ ] }) : null
1913
+ ] }, i);
1914
+ })
1915
+ }
1916
+ );
1917
+ }
1918
+
1919
+ // src/code/highlight.ts
1920
+ var TOKEN_CLASS = {
1921
+ keyword: "oca-k",
1922
+ string: "oca-s",
1923
+ number: "oca-n",
1924
+ function: "oca-f",
1925
+ type: "oca-y",
1926
+ property: "oca-p",
1927
+ comment: "oca-c",
1928
+ tag: "oca-g",
1929
+ url: "oca-u"
1930
+ };
1931
+ var ALIASES = {
1932
+ ts: "js",
1933
+ typescript: "js",
1934
+ tsx: "js",
1935
+ js: "js",
1936
+ javascript: "js",
1937
+ jsx: "js",
1938
+ mjs: "js",
1939
+ cjs: "js",
1940
+ json: "json",
1941
+ jsonc: "json",
1942
+ json5: "json",
1943
+ bash: "shell",
1944
+ sh: "shell",
1945
+ shell: "shell",
1946
+ zsh: "shell",
1947
+ console: "shell",
1948
+ terminal: "shell",
1949
+ py: "python",
1950
+ python: "python",
1951
+ yaml: "yaml",
1952
+ yml: "yaml",
1953
+ diff: "diff"
1954
+ };
1955
+ var CODE_LANGS = Object.keys(ALIASES);
1956
+ function grammarOf(lang) {
1957
+ return lang && ALIASES[lang.toLowerCase()] || "plain";
1958
+ }
1959
+ function collector() {
1960
+ const tokens = [];
1961
+ const emit2 = (text, kind) => {
1962
+ if (!text) return;
1963
+ const last = tokens[tokens.length - 1];
1964
+ if (last && last.kind === kind) last.text += text;
1965
+ else tokens.push(kind ? { text, kind } : { text });
1966
+ };
1967
+ return { emit: emit2, tokens };
1968
+ }
1969
+ function at(re, src, i) {
1970
+ re.lastIndex = i;
1971
+ const m = re.exec(src);
1972
+ return m ? m[0] : null;
1973
+ }
1974
+ var WS = /[ \t]+/y;
1975
+ var NEWLINE = /\r?\n/y;
1976
+ var JS_KEYWORDS = new Set(
1977
+ "abstract as async await break case catch class const continue debugger declare default delete do else enum export extends finally for from function get if implements import in infer instanceof interface is keyof let module namespace new of override private protected public readonly return satisfies set static super switch this throw try type typeof unique var void while with yield".split(" ")
1978
+ );
1979
+ var JS_CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "null", "undefined", "NaN", "Infinity"]);
1980
+ var TS_PRIMITIVES = /* @__PURE__ */ new Set(["string", "number", "boolean", "bigint", "symbol", "object", "unknown", "any", "never"]);
1981
+ var isConstant = (m) => /^[A-Z][A-Z\d_]+$/.test(m) && (m.includes("_") || m.length > 4);
1982
+ var JS_LINE_COMMENT = /\/\/[^\n]*/y;
1983
+ var JS_BLOCK_COMMENT = /\/\*[\s\S]*?(?:\*\/|$)/y;
1984
+ var JS_TEMPLATE = /`(?:\\[\s\S]|[^\\`])*`?/y;
1985
+ var JS_STRING = /'(?:\\.|[^\\'\n])*'?|"(?:\\.|[^\\"\n])*"?/y;
1986
+ var JS_NUMBER = /(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?|\.\d[\d_]*(?:[eE][+-]?\d+)?)n?/y;
1987
+ var JS_IDENT = /[A-Za-z_$][\w$]*/y;
1988
+ var JS_DECORATOR = /@[A-Za-z_$][\w$.]*/y;
1989
+ var JS_CALL_AFTER = /\s*(?:<[\w$\s,.[\]|&'"]*>)?\s*\(/y;
1990
+ var JS_TAG = /<\/?(?=[A-Za-z])/y;
1991
+ var JS_TAG_NAME = /[A-Za-z][\w$.:-]*/y;
1992
+ var JS_PUNCT = /=>|\.\.\.|[{}()[\];,.<>=+\-*/%!?:&|^~#]/y;
1993
+ var JSX_BEFORE = /* @__PURE__ */ new Set(["(", ",", "=", "?", ":", "{", "[", ";", ">", "&&", "||", "=>", "return"]);
1994
+ function scanJs(src, emit2, jsx50) {
1995
+ let i = 0;
1996
+ let prev = "";
1997
+ let tagDepth = 0;
1998
+ let braceInTag = 0;
1999
+ const sig = (t) => {
2000
+ prev = t;
2001
+ };
2002
+ while (i < src.length) {
2003
+ let m;
2004
+ if ((m = at(WS, src, i)) || (m = at(NEWLINE, src, i))) {
2005
+ emit2(m);
2006
+ i += m.length;
2007
+ continue;
2008
+ }
2009
+ if ((m = at(JS_LINE_COMMENT, src, i)) || (m = at(JS_BLOCK_COMMENT, src, i))) {
2010
+ emit2(m, "comment");
2011
+ i += m.length;
2012
+ continue;
2013
+ }
2014
+ if ((m = at(JS_TEMPLATE, src, i)) || (m = at(JS_STRING, src, i))) {
2015
+ emit2(m, "string");
2016
+ i += m.length;
2017
+ sig('"');
2018
+ continue;
2019
+ }
2020
+ if (jsx50 && tagDepth === 0 && (m = at(JS_TAG, src, i)) && (prev === "" || JSX_BEFORE.has(prev))) {
2021
+ const name = at(JS_TAG_NAME, src, i + m.length);
2022
+ if (name) {
2023
+ emit2(m);
2024
+ emit2(name, "tag");
2025
+ i += m.length + name.length;
2026
+ tagDepth = 1;
2027
+ braceInTag = 0;
2028
+ sig("tag");
2029
+ continue;
2030
+ }
2031
+ }
2032
+ if (jsx50 && tagDepth > 0 && braceInTag === 0) {
2033
+ if (src.startsWith("/>", i) || src[i] === ">") {
2034
+ const close = src[i] === ">" ? ">" : "/>";
2035
+ emit2(close);
2036
+ i += close.length;
2037
+ tagDepth = 0;
2038
+ sig(">");
2039
+ continue;
2040
+ }
2041
+ if ((m = at(JS_IDENT, src, i)) && /^\s*=/.test(src.slice(i + m.length, i + m.length + 4))) {
2042
+ emit2(m, "property");
2043
+ i += m.length;
2044
+ continue;
2045
+ }
2046
+ if (m = at(JS_IDENT, src, i)) {
2047
+ emit2(m, "property");
2048
+ i += m.length;
2049
+ continue;
2050
+ }
2051
+ if (src[i] === "{") braceInTag = 1;
2052
+ } else if (jsx50 && tagDepth > 0 && braceInTag > 0) {
2053
+ if (src[i] === "{") braceInTag++;
2054
+ else if (src[i] === "}") braceInTag--;
2055
+ }
2056
+ if (m = at(JS_DECORATOR, src, i)) {
2057
+ emit2(m, "function");
2058
+ i += m.length;
2059
+ sig("@");
2060
+ continue;
2061
+ }
2062
+ if (m = at(JS_IDENT, src, i)) {
2063
+ const end = i + m.length;
2064
+ let kind;
2065
+ if (prev !== "." && JS_CONSTANTS.has(m)) kind = "number";
2066
+ else if (prev !== "." && JS_KEYWORDS.has(m)) kind = "keyword";
2067
+ else if (at(JS_CALL_AFTER, src, end) !== null) kind = "function";
2068
+ else if (prev !== "." && TS_PRIMITIVES.has(m)) kind = "type";
2069
+ else if (isConstant(m)) kind = "number";
2070
+ else if (/^[A-Z]/.test(m)) kind = "type";
2071
+ emit2(m, kind);
2072
+ i = end;
2073
+ sig(kind === "keyword" ? m : "id");
2074
+ continue;
2075
+ }
2076
+ if (m = at(JS_NUMBER, src, i)) {
2077
+ emit2(m, "number");
2078
+ i += m.length;
2079
+ sig("0");
2080
+ continue;
2081
+ }
2082
+ if (m = at(JS_PUNCT, src, i)) {
2083
+ emit2(m);
2084
+ i += m.length;
2085
+ sig(m === "." ? "." : m);
2086
+ continue;
2087
+ }
2088
+ emit2(src[i]);
2089
+ i++;
2090
+ }
2091
+ }
2092
+ var JSON_STRING = /"(?:\\.|[^\\"\n])*"?/y;
2093
+ var JSON_KEY_AFTER = /\s*:/y;
2094
+ var JSON_NUMBER = /-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
2095
+ var JSON_WORD = /true|false|null/y;
2096
+ function scanJson(src, emit2) {
2097
+ let i = 0;
2098
+ while (i < src.length) {
2099
+ let m;
2100
+ if ((m = at(JS_LINE_COMMENT, src, i)) || (m = at(JS_BLOCK_COMMENT, src, i))) {
2101
+ emit2(m, "comment");
2102
+ } else if (m = at(JSON_STRING, src, i)) {
2103
+ emit2(m, at(JSON_KEY_AFTER, src, i + m.length) !== null ? "property" : "string");
2104
+ } else if ((m = at(JSON_NUMBER, src, i)) || (m = at(JSON_WORD, src, i))) {
2105
+ emit2(m, "number");
2106
+ } else {
2107
+ m = src[i];
2108
+ emit2(m);
2109
+ }
2110
+ i += m.length;
2111
+ }
2112
+ }
2113
+ var SH_KEYWORDS = new Set(
2114
+ "if then else elif fi for in do done case esac while until function return export local select time".split(" ")
2115
+ );
2116
+ var SH_PROMPT = /\$ (?=\S)/y;
2117
+ var SH_COMMENT = /#[^\n]*/y;
2118
+ var SH_SINGLE = /'[^']*'?/y;
2119
+ var SH_DOUBLE = /"(?:\\.|[^\\"])*"?/y;
2120
+ var SH_VAR = /\$(?:\{[^}\n]*\}?|[A-Za-z_][\w]*|[@*#?$!\d])/y;
2121
+ var SH_URL = /https?:\/\/[^\s'"`)]+/y;
2122
+ var SH_FLAG = /--?[A-Za-z][\w-]*/y;
2123
+ var SH_ASSIGN = /[A-Za-z_][\w]*(?==)/y;
2124
+ var SH_VALUE = /=[^\s|&;()<>'"`$]*/y;
2125
+ var SH_WORD = /[^\s|&;()<>'"`$#]+/y;
2126
+ var SH_OPERATOR = /\|\||&&|[|;&]|\$\(|[()<>]/y;
2127
+ function scanShell(src, emit2) {
2128
+ let i = 0;
2129
+ let command = true;
2130
+ let lineStart = true;
2131
+ while (i < src.length) {
2132
+ let m;
2133
+ if (m = at(NEWLINE, src, i)) {
2134
+ emit2(m);
2135
+ i += m.length;
2136
+ command = !/\\\s*$/.test(src.slice(0, i - m.length));
2137
+ lineStart = true;
2138
+ continue;
2139
+ }
2140
+ if (m = at(WS, src, i)) {
2141
+ emit2(m);
2142
+ i += m.length;
2143
+ continue;
2144
+ }
2145
+ if (lineStart && (m = at(SH_PROMPT, src, i))) {
2146
+ emit2(m, "comment");
2147
+ i += m.length;
2148
+ lineStart = false;
2149
+ continue;
2150
+ }
2151
+ lineStart = false;
2152
+ if ((m = at(SH_COMMENT, src, i)) && (i === 0 || /\s/.test(src[i - 1]))) {
2153
+ emit2(m, "comment");
2154
+ i += m.length;
2155
+ continue;
2156
+ }
2157
+ if ((m = at(SH_SINGLE, src, i)) || (m = at(SH_DOUBLE, src, i))) {
2158
+ emit2(m, "string");
2159
+ i += m.length;
2160
+ command = false;
2161
+ continue;
2162
+ }
2163
+ if (m = at(SH_OPERATOR, src, i)) {
2164
+ emit2(m);
2165
+ i += m.length;
2166
+ command = m !== ")" && m !== ">" && m !== "<";
2167
+ continue;
2168
+ }
2169
+ if (m = at(SH_VAR, src, i)) {
2170
+ emit2(m, "type");
2171
+ i += m.length;
2172
+ command = false;
2173
+ continue;
2174
+ }
2175
+ if (m = at(SH_URL, src, i)) {
2176
+ emit2(m, "url");
2177
+ i += m.length;
2178
+ command = false;
2179
+ continue;
2180
+ }
2181
+ if (command && (m = at(SH_ASSIGN, src, i))) {
2182
+ emit2(m, "property");
2183
+ i += m.length;
2184
+ const v = at(SH_VALUE, src, i);
2185
+ emit2(v);
2186
+ i += v.length;
2187
+ continue;
2188
+ }
2189
+ if ((m = at(SH_FLAG, src, i)) && !command) {
2190
+ emit2(m, "keyword");
2191
+ i += m.length;
2192
+ continue;
2193
+ }
2194
+ if (m = at(SH_WORD, src, i)) {
2195
+ if (command && SH_KEYWORDS.has(m)) emit2(m, "keyword");
2196
+ else if (command) {
2197
+ emit2(m, "function");
2198
+ command = m === "sudo" || m === "npx" || m === "env" || m === "time";
2199
+ i += m.length;
2200
+ continue;
2201
+ } else emit2(m);
2202
+ i += m.length;
2203
+ continue;
2204
+ }
2205
+ emit2(src[i]);
2206
+ i++;
2207
+ }
2208
+ }
2209
+ var PY_KEYWORDS = new Set(
2210
+ "and as assert async await break class continue def del elif else except finally for from global if import in is lambda match case nonlocal not or pass raise return try while with yield self cls".split(" ")
2211
+ );
2212
+ var PY_CONSTANTS = /* @__PURE__ */ new Set(["True", "False", "None"]);
2213
+ var PY_TYPES = /* @__PURE__ */ new Set(["int", "str", "bool", "float", "bytes", "list", "dict", "tuple", "set", "object"]);
2214
+ var PY_COMMENT = /#[^\n]*/y;
2215
+ var PY_TRIPLE = /[rRbBuUfF]{0,2}(?:"""[\s\S]*?(?:"""|$)|'''[\s\S]*?(?:'''|$))/y;
2216
+ var PY_STRING = /[rRbBuUfF]{0,2}(?:'(?:\\.|[^\\'\n])*'?|"(?:\\.|[^\\"\n])*"?)/y;
2217
+ var PY_NUMBER = /(?:0[xX][\da-fA-F_]+|\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?\d+)?j?)/y;
2218
+ var PY_IDENT = /[A-Za-z_]\w*/y;
2219
+ var PY_DECORATOR = /@[A-Za-z_][\w.]*/y;
2220
+ var PY_CALL_AFTER = /\s*\(/y;
2221
+ function scanPython(src, emit2) {
2222
+ let i = 0;
2223
+ let prev = "";
2224
+ while (i < src.length) {
2225
+ let m;
2226
+ if ((m = at(WS, src, i)) || (m = at(NEWLINE, src, i))) {
2227
+ emit2(m);
2228
+ i += m.length;
2229
+ continue;
2230
+ }
2231
+ if (m = at(PY_COMMENT, src, i)) {
2232
+ emit2(m, "comment");
2233
+ } else if ((m = at(PY_TRIPLE, src, i)) || (m = at(PY_STRING, src, i))) {
2234
+ if (/^[A-Za-z]+$/.test(m)) {
2235
+ emit2(m);
2236
+ } else emit2(m, "string");
2237
+ prev = '"';
2238
+ } else if (m = at(PY_DECORATOR, src, i)) {
2239
+ emit2(m, "function");
2240
+ prev = "@";
2241
+ } else if (m = at(PY_IDENT, src, i)) {
2242
+ let kind;
2243
+ if (PY_CONSTANTS.has(m)) kind = "number";
2244
+ else if (prev !== "." && PY_KEYWORDS.has(m)) kind = "keyword";
2245
+ else if (prev === "def" || at(PY_CALL_AFTER, src, i + m.length) !== null) kind = "function";
2246
+ else if (prev === "class" || /^[A-Z][a-z]/.test(m) || PY_TYPES.has(m)) kind = "type";
2247
+ else if (isConstant(m)) kind = "number";
2248
+ emit2(m, kind);
2249
+ prev = kind === "keyword" ? m : "id";
2250
+ } else if (m = at(PY_NUMBER, src, i)) {
2251
+ emit2(m, "number");
2252
+ prev = "0";
2253
+ } else {
2254
+ m = src[i];
2255
+ emit2(m);
2256
+ prev = m;
2257
+ }
2258
+ i += m.length;
2259
+ }
2260
+ }
2261
+ var YAML_KEY = /[ \t]*(?:- )?[\w.$/-]+(?=[ \t]*:(?:\s|$))/y;
2262
+ var YAML_VALUE_WORD = /(?:true|false|null|yes|no|~|-?\d+(?:\.\d+)?)(?=\s*(?:#|$))/y;
2263
+ function scanYaml(src, emit2) {
2264
+ let i = 0;
2265
+ let lineStart = true;
2266
+ while (i < src.length) {
2267
+ let m;
2268
+ if (m = at(NEWLINE, src, i)) {
2269
+ emit2(m);
2270
+ i += m.length;
2271
+ lineStart = true;
2272
+ continue;
2273
+ }
2274
+ if (lineStart && (m = at(YAML_KEY, src, i))) {
2275
+ const dash = m.match(/^([ \t]*(?:- )?)/)[1];
2276
+ emit2(dash);
2277
+ emit2(m.slice(dash.length), "property");
2278
+ i += m.length;
2279
+ lineStart = false;
2280
+ continue;
2281
+ }
2282
+ lineStart = false;
2283
+ if ((m = at(SH_COMMENT, src, i)) && (i === 0 || /\s/.test(src[i - 1]))) emit2(m, "comment");
2284
+ else if ((m = at(SH_SINGLE, src, i)) || (m = at(JSON_STRING, src, i))) emit2(m, "string");
2285
+ else if (m = at(YAML_VALUE_WORD, src, i)) emit2(m, "number");
2286
+ else if (m = at(SH_URL, src, i)) emit2(m, "url");
2287
+ else {
2288
+ m = src[i];
2289
+ emit2(m);
2290
+ }
2291
+ i += m.length;
2292
+ }
2293
+ }
2294
+ function toLines(tokens) {
2295
+ const lines = [[]];
2296
+ for (const t of tokens) {
2297
+ const parts = t.text.split(/\r?\n/);
2298
+ parts.forEach((part, j) => {
2299
+ if (j > 0) lines.push([]);
2300
+ if (part) lines[lines.length - 1].push(t.kind ? { text: part, kind: t.kind } : { text: part });
2301
+ });
2302
+ }
2303
+ return lines;
2304
+ }
2305
+ function highlight(code, lang) {
2306
+ const src = code.replace(/\r?\n$/, "");
2307
+ const grammar = grammarOf(lang);
2308
+ const { emit: emit2, tokens } = collector();
2309
+ const name = (lang ?? "").toLowerCase();
2310
+ switch (grammar) {
2311
+ case "js":
2312
+ scanJs(src, emit2, name === "tsx" || name === "jsx");
2313
+ break;
2314
+ case "json":
2315
+ scanJson(src, emit2);
2316
+ break;
2317
+ case "shell":
2318
+ scanShell(src, emit2);
2319
+ break;
2320
+ case "python":
2321
+ scanPython(src, emit2);
2322
+ break;
2323
+ case "yaml":
2324
+ scanYaml(src, emit2);
2325
+ break;
2326
+ default:
2327
+ emit2(src);
2328
+ }
2329
+ return toLines(tokens);
2330
+ }
2331
+ function readDiff(code) {
2332
+ const diff = /* @__PURE__ */ new Map();
2333
+ const lines = code.replace(/\r?\n$/, "").split(/\r?\n/);
2334
+ const out = lines.map((line, i) => {
2335
+ const c = line[0];
2336
+ if (c === "+" || c === "-") {
2337
+ diff.set(i + 1, c === "+" ? "add" : "remove");
2338
+ return line.slice(1);
2339
+ }
2340
+ return c === " " ? line.slice(1) : line;
2341
+ });
2342
+ return { code: out.join("\n"), diff };
2343
+ }
2344
+ function parseLineRanges(spec) {
2345
+ if (!spec) return /* @__PURE__ */ new Set();
2346
+ if (typeof spec !== "string") return new Set(spec);
2347
+ const out = /* @__PURE__ */ new Set();
2348
+ for (const part of spec.split(",")) {
2349
+ const m = part.trim().match(/^(\d+)(?:\s*-\s*(\d+))?$/);
2350
+ if (!m) continue;
2351
+ const a = Number(m[1]);
2352
+ const b = m[2] ? Number(m[2]) : a;
2353
+ for (let n = Math.min(a, b); n <= Math.max(a, b) && n - a < 1e4; n++) out.add(n);
2354
+ }
2355
+ return out;
2356
+ }
2357
+ function parseCodeMeta(meta) {
2358
+ if (!meta) return {};
2359
+ const out = {};
2360
+ const title = meta.match(/(?:title|filename)=(?:"([^"]*)"|'([^']*)'|(\S+))/);
2361
+ if (title) out.title = title[1] ?? title[2] ?? title[3];
2362
+ const lines = meta.match(/\{([\d,\s-]+)\}/);
2363
+ if (lines) out.highlight = lines[1].replace(/\s+/g, "");
2364
+ const rest = meta.replace(/(?:title|filename)=(?:"[^"]*"|'[^']*'|\S+)/, "");
2365
+ if (/\bdiff\b/.test(rest)) out.diff = true;
2366
+ if (/\b(?:showLineNumbers|lineNumbers|numbers)\b/.test(rest)) out.lineNumbers = true;
2367
+ return out;
2368
+ }
2369
+ var ESCAPE = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" };
2370
+ function escapeHtml(s) {
2371
+ return s.replace(/[&<>"]/g, (c) => ESCAPE[c]);
2372
+ }
2373
+ function linesToHtml(lines, marks = {}) {
2374
+ return lines.map((line, i) => {
2375
+ const n = i + 1;
2376
+ const attrs = [
2377
+ 'data-line=""',
2378
+ marks.highlight?.has(n) ? 'data-mark=""' : "",
2379
+ marks.diff?.has(n) ? `data-diff="${marks.diff.get(n)}"` : ""
2380
+ ].filter(Boolean).join(" ");
2381
+ const body = line.map((t) => t.kind ? `<span class="${TOKEN_CLASS[t.kind]}">${escapeHtml(t.text)}</span>` : escapeHtml(t.text)).join("");
2382
+ return `<span ${attrs}>${body}</span>`;
2383
+ }).join("\n");
2384
+ }
2385
+ function highlightToHtml(code, lang, opts = {}) {
2386
+ const d = opts.diff ? readDiff(code) : null;
2387
+ return linesToHtml(highlight(d ? d.code : code, lang), {
2388
+ highlight: parseLineRanges(opts.highlight),
2389
+ diff: d?.diff
2390
+ });
2391
+ }
2392
+
2393
+ // src/format/index.ts
2394
+ var EXPLORER = "https://mempool.space";
2395
+ function explorerUrl(kind, value, network = "mainnet") {
2396
+ const net = network === "mainnet" ? "" : `/${network}`;
2397
+ return `${EXPLORER}${net}/${kind}/${encodeURIComponent(String(value))}`;
2398
+ }
2399
+ function shortenMiddle(value, head = 8, tail = 6) {
2400
+ return value.length <= head + tail + 1 ? value : `${value.slice(0, head)}\u2026${value.slice(-tail)}`;
2401
+ }
2402
+ function formatBlockHeight(height) {
2403
+ return Math.trunc(height).toLocaleString("en-US");
2404
+ }
2405
+ function blocksToDuration(blocks, minutesPerBlock = 10) {
2406
+ const minutes = Math.max(0, Math.round(blocks * minutesPerBlock));
2407
+ if (minutes < 60) return `about ${minutes} minute${minutes === 1 ? "" : "s"}`;
2408
+ const units = [
2409
+ [60 * 24 * 7, "week"],
2410
+ [60 * 24, "day"],
2411
+ [60, "hour"],
2412
+ [1, "minute"]
2413
+ ];
2414
+ const parts = [];
2415
+ let rest = minutes;
2416
+ for (const [size, word] of units) {
2417
+ const n = Math.floor(rest / size);
2418
+ if (n > 0 && parts.length < 2) {
2419
+ parts.push(`${n} ${word}${n === 1 ? "" : "s"}`);
2420
+ rest -= n * size;
2421
+ } else if (parts.length > 0) break;
2422
+ }
2423
+ return `about ${parts.join(" ")}`;
2424
+ }
2425
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2426
+ function formatUtc(at2, opts = {}) {
2427
+ const d = typeof at2 === "number" ? new Date(at2 * 1e3) : new Date(at2);
2428
+ if (Number.isNaN(d.getTime())) return "\u2014";
2429
+ const day = `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
2430
+ if (opts.date) return day;
2431
+ const hh = String(d.getUTCHours()).padStart(2, "0");
2432
+ const mm = String(d.getUTCMinutes()).padStart(2, "0");
2433
+ return `${day}, ${hh}:${mm} UTC`;
2434
+ }
2435
+ function formatBytes(bytes) {
2436
+ if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
2437
+ if (bytes < 1024) return `${bytes} B`;
2438
+ const units = ["KB", "MB", "GB", "TB"];
2439
+ let v = bytes / 1024;
2440
+ let u = 0;
2441
+ while (v >= 1024 && u < units.length - 1) {
2442
+ v /= 1024;
2443
+ u++;
2444
+ }
2445
+ return `${v < 10 ? v.toFixed(1).replace(/\.0$/, "") : Math.round(v)} ${units[u]}`;
2446
+ }
2447
+ var ShellContext = sharedContext("shell-place", {});
1847
2448
  function useShellPlace() {
1848
2449
  return useContext(ShellContext);
1849
2450
  }
@@ -1866,26 +2467,30 @@ function PageHeader({
1866
2467
  ] });
1867
2468
  }
1868
2469
  var InStatGrid = createContext(false);
1869
- function StatCard({ label, value, hint, className }) {
2470
+ function StatCard({ label, value, hint, size, className }) {
1870
2471
  const inGrid = useContext(InStatGrid);
2472
+ const density = useDensity();
2473
+ const sm = (size ?? (density === "compact" ? "sm" : "md")) === "sm";
1871
2474
  return /* @__PURE__ */ jsxs(
1872
2475
  "div",
1873
2476
  {
1874
2477
  "data-ui": "stat",
1875
2478
  className: cn(
1876
- "rounded-[1.25rem] border border-border bg-card p-5 md:p-6",
2479
+ "border border-border bg-card",
2480
+ sm ? "rounded-2xl p-4" : "rounded-[1.25rem] p-5 md:p-6",
1877
2481
  // In a grid, label, value and hint each share a row with their
1878
2482
  // neighbours, so values line up whatever wraps above them.
1879
2483
  inGrid ? "row-span-3 grid grid-rows-subgrid gap-1.5" : "flex flex-col gap-2",
1880
2484
  className
1881
2485
  ),
1882
2486
  children: [
1883
- /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-snug text-muted-foreground", children: label }),
2487
+ /* @__PURE__ */ jsx("span", { className: cn("leading-snug text-muted-foreground", sm ? "text-[0.8125rem]" : "text-[0.875rem]"), children: label }),
1884
2488
  /* @__PURE__ */ jsx(
1885
2489
  "span",
1886
2490
  {
1887
2491
  className: cn(
1888
- "break-words oca-tabular text-[1.5rem] leading-tight tracking-[-0.02em] md:text-[1.75rem]",
2492
+ "break-words oca-tabular leading-tight tracking-[-0.02em]",
2493
+ sm ? "text-[1.25rem]" : "text-[1.5rem] md:text-[1.75rem]",
1889
2494
  inGrid && "self-end"
1890
2495
  ),
1891
2496
  children: value
@@ -1947,6 +2552,7 @@ function StatGrid({ columns, empty, isEmpty, className, children, ...props }) {
1947
2552
  const items = Children.toArray(children).filter(isValidElement);
1948
2553
  const n = items.length;
1949
2554
  const allZero = n > 0 && items.every((el) => "raw" in el.props && (el.props.raw === 0 || el.props.raw === null));
2555
+ const compact = useDensity() === "compact";
1950
2556
  if (isEmpty ?? allZero) return /* @__PURE__ */ jsx(EmptyLine, { className, children: empty ?? "Nothing here yet." });
1951
2557
  const lg = columns ?? statColumns(n);
1952
2558
  const md = lg > 4 ? 3 : lg;
@@ -1956,7 +2562,8 @@ function StatGrid({ columns, empty, isEmpty, className, children, ...props }) {
1956
2562
  "div",
1957
2563
  {
1958
2564
  className: cn(
1959
- "grid gap-3 md:gap-4",
2565
+ "grid",
2566
+ compact ? "gap-2.5 md:gap-3" : "gap-3 md:gap-4",
1960
2567
  n === 1 ? "grid-cols-1" : "grid-cols-2",
1961
2568
  MD_COLS[md],
1962
2569
  LG_COLS[lg],
@@ -1975,11 +2582,40 @@ function StatGrid({ columns, empty, isEmpty, className, children, ...props }) {
1975
2582
  }
1976
2583
  ) });
1977
2584
  }
1978
- function KeyValueList({ items, className }) {
1979
- return /* @__PURE__ */ jsx("dl", { className: cn("divide-y divide-border rounded-[1.25rem] border border-border bg-card", className), children: items.map((it, i) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 px-5 py-3.5 sm:flex-row sm:items-baseline sm:gap-6", children: [
1980
- /* @__PURE__ */ jsx("dt", { className: "shrink-0 text-[0.875rem] text-muted-foreground sm:w-48", children: it.label }),
1981
- /* @__PURE__ */ jsx("dd", { className: cn("min-w-0 break-words text-[0.9375rem]", it.mono && "font-mono text-[0.875rem]"), children: it.value })
1982
- ] }, i)) });
2585
+ function KeyValueList({
2586
+ items,
2587
+ dense,
2588
+ className
2589
+ }) {
2590
+ const density = useDensity();
2591
+ const tight = dense ?? density === "compact";
2592
+ return (
2593
+ // The rows go side by side when the list itself is wide enough, wherever it sits: a narrow card stacks them.
2594
+ /* @__PURE__ */ jsx("dl", { className: cn("@container divide-y divide-border border border-border bg-card", tight ? "rounded-2xl" : "rounded-[1.25rem]", className), children: items.map((it, i) => /* @__PURE__ */ jsxs(
2595
+ "div",
2596
+ {
2597
+ className: cn(
2598
+ "flex flex-col gap-1 @md:flex-row @md:items-baseline",
2599
+ tight ? "px-4 py-2.5 @md:gap-5" : "px-5 py-3.5 @md:gap-6"
2600
+ ),
2601
+ children: [
2602
+ /* @__PURE__ */ jsx("dt", { className: cn("shrink-0 text-muted-foreground", tight ? "text-[0.8125rem] @md:w-36" : "text-[0.875rem] @md:w-48"), children: it.label }),
2603
+ /* @__PURE__ */ jsx(
2604
+ "dd",
2605
+ {
2606
+ className: cn(
2607
+ "min-w-0 break-words",
2608
+ tight ? "text-[0.875rem]" : "text-[0.9375rem]",
2609
+ it.mono && (tight ? "font-mono text-[0.8125rem]" : "font-mono text-[0.875rem]")
2610
+ ),
2611
+ children: it.value
2612
+ }
2613
+ )
2614
+ ]
2615
+ },
2616
+ i
2617
+ )) })
2618
+ );
1983
2619
  }
1984
2620
  function DataTable({
1985
2621
  columns,
@@ -1988,8 +2624,11 @@ function DataTable({
1988
2624
  empty,
1989
2625
  caption,
1990
2626
  phone = "cards",
2627
+ dense,
1991
2628
  className
1992
2629
  }) {
2630
+ const density = useDensity();
2631
+ const tight = dense ?? density === "compact";
1993
2632
  if (rows.length === 0 && empty) return /* @__PURE__ */ jsx(Fragment, { children: empty });
1994
2633
  const primary = columns.find((c) => c.primary) ?? columns[0];
1995
2634
  const right = (c) => c.numeric || c.align === "end";
@@ -1997,11 +2636,12 @@ function DataTable({
1997
2636
  "div",
1998
2637
  {
1999
2638
  className: cn(
2000
- "overflow-hidden rounded-[1.25rem] border border-border bg-card",
2639
+ "overflow-hidden border border-border bg-card",
2640
+ tight ? "rounded-2xl" : "rounded-[1.25rem]",
2001
2641
  phone === "cards" && "max-sm:hidden",
2002
2642
  className
2003
2643
  ),
2004
- children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.9375rem]", children: [
2644
+ children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: cn("w-full border-collapse text-left", tight ? "text-[0.875rem]" : "text-[0.9375rem]"), children: [
2005
2645
  caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
2006
2646
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { className: "border-b border-border", children: columns.map((c) => /* @__PURE__ */ jsx(
2007
2647
  "th",
@@ -2009,7 +2649,8 @@ function DataTable({
2009
2649
  scope: "col",
2010
2650
  style: { width: c.width, minWidth: c.minWidth },
2011
2651
  className: cn(
2012
- "whitespace-nowrap px-5 py-3 text-[0.8125rem] font-medium text-muted-foreground",
2652
+ "whitespace-nowrap text-[0.8125rem] font-medium text-muted-foreground",
2653
+ tight ? "px-4 py-2.5" : "px-5 py-3",
2013
2654
  right(c) && "text-right",
2014
2655
  c.wide && "hidden md:table-cell"
2015
2656
  ),
@@ -2022,7 +2663,8 @@ function DataTable({
2022
2663
  {
2023
2664
  style: { minWidth: c.minWidth },
2024
2665
  className: cn(
2025
- "px-5 py-3.5 align-middle",
2666
+ "align-middle",
2667
+ tight ? "px-4 py-2" : "px-5 py-3.5",
2026
2668
  right(c) && "text-right",
2027
2669
  c.numeric && "whitespace-nowrap oca-tabular",
2028
2670
  c.wide && "hidden md:table-cell"
@@ -2042,8 +2684,12 @@ function DataTable({
2042
2684
  "ul",
2043
2685
  {
2044
2686
  "aria-label": caption,
2045
- className: cn("divide-y divide-border rounded-[1.25rem] border border-border bg-card sm:hidden", className),
2046
- children: rows.map((r, i) => /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-2.5 px-4 py-4", children: [
2687
+ className: cn(
2688
+ "divide-y divide-border border border-border bg-card sm:hidden",
2689
+ tight ? "rounded-2xl" : "rounded-[1.25rem]",
2690
+ className
2691
+ ),
2692
+ children: rows.map((r, i) => /* @__PURE__ */ jsxs("li", { className: cn("flex flex-col gap-2.5 px-4", tight ? "py-3" : "py-4"), children: [
2047
2693
  /* @__PURE__ */ jsx("div", { className: "min-w-0 break-words text-[0.9375rem] font-medium", children: primary?.cell(r) }),
2048
2694
  rest.length > 0 ? /* @__PURE__ */ jsx("dl", { className: "grid grid-cols-[minmax(5.5rem,auto)_minmax(0,1fr)] gap-x-4 gap-y-1.5 text-[0.875rem]", children: rest.map((c) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
2049
2695
  /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: c.header }),
@@ -2090,13 +2736,14 @@ function Notice({
2090
2736
  title,
2091
2737
  children,
2092
2738
  action,
2739
+ role,
2093
2740
  className
2094
2741
  }) {
2095
2742
  const kind = NOTICE_KIND[tone];
2096
2743
  return /* @__PURE__ */ jsxs(
2097
2744
  "div",
2098
2745
  {
2099
- role: tone === "danger" || tone === "warning" ? "alert" : "note",
2746
+ role: role ?? (tone === "danger" || tone === "warning" ? "alert" : "note"),
2100
2747
  "data-tone": kind,
2101
2748
  className: cn(
2102
2749
  "flex flex-col gap-3 rounded-2xl border border-border bg-card px-5 py-4 sm:flex-row sm:items-start sm:justify-between",
@@ -2146,45 +2793,66 @@ function LoadingBlock({
2146
2793
  }
2147
2794
  return /* @__PURE__ */ jsx("div", { role: "status", "aria-label": label, className: cn("flex flex-col gap-3", className), children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-16 rounded-2xl" }, i)) });
2148
2795
  }
2149
- function middle(v, head, tail) {
2150
- return v.length <= head + tail + 1 ? v : `${v.slice(0, head)}\u2026${v.slice(-tail)}`;
2796
+ async function wipeIfUnchanged(expected) {
2797
+ try {
2798
+ if (await navigator.clipboard.readText() !== expected) return;
2799
+ } catch {
2800
+ }
2801
+ try {
2802
+ await navigator.clipboard.writeText("");
2803
+ } catch {
2804
+ }
2151
2805
  }
2152
2806
  function useCopy(timeoutMs = 1600) {
2153
2807
  const [copied, setCopied] = useState(false);
2154
2808
  const t = useRef(null);
2155
- useEffect(() => () => {
2156
- if (t.current) clearTimeout(t.current);
2157
- }, []);
2809
+ const wipe = useRef(null);
2810
+ useEffect(
2811
+ () => () => {
2812
+ if (t.current) clearTimeout(t.current);
2813
+ },
2814
+ []
2815
+ );
2158
2816
  const copy = useCallback(
2159
- async (text) => {
2817
+ async (text, opts = {}) => {
2160
2818
  try {
2161
2819
  await navigator.clipboard.writeText(text);
2162
2820
  setCopied(true);
2163
2821
  if (t.current) clearTimeout(t.current);
2164
2822
  t.current = setTimeout(() => setCopied(false), timeoutMs);
2823
+ if (opts.clearAfter && opts.clearAfter > 0) {
2824
+ if (wipe.current) clearTimeout(wipe.current);
2825
+ wipe.current = setTimeout(() => void wipeIfUnchanged(text), opts.clearAfter);
2826
+ }
2827
+ return true;
2165
2828
  } catch {
2166
2829
  setCopied(false);
2830
+ return false;
2167
2831
  }
2168
2832
  },
2169
2833
  [timeoutMs]
2170
2834
  );
2171
2835
  return { copied, copy };
2172
2836
  }
2173
- function CopyButton({ value, label = "Copy", className }) {
2837
+ function CopyButton({ value, label = "Copy", clearAfter, onCopied, className }) {
2174
2838
  const { copied, copy } = useCopy();
2839
+ const done2 = copied ? clearAfter ? `Copied. Cleared in ${Math.round(clearAfter / 1e3)} seconds` : "Copied" : "";
2175
2840
  return /* @__PURE__ */ jsxs(
2176
2841
  "button",
2177
2842
  {
2178
2843
  type: "button",
2179
- onClick: () => void copy(value),
2844
+ onClick: async () => {
2845
+ if (await copy(typeof value === "function" ? value() : value, { clearAfter })) onCopied?.();
2846
+ },
2180
2847
  "aria-label": copied ? "Copied" : label,
2848
+ title: label,
2181
2849
  className: cn(
2182
2850
  "inline-flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
2183
2851
  className
2184
2852
  ),
2185
2853
  children: [
2186
2854
  copied ? /* @__PURE__ */ jsx(Check, { className: "size-4 text-success" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
2187
- /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", children: copied ? "Copied" : "" })
2855
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", children: done2 })
2188
2856
  ]
2189
2857
  }
2190
2858
  );
@@ -2195,12 +2863,27 @@ function HashChip({
2195
2863
  tail = 6,
2196
2864
  copy = true,
2197
2865
  href,
2866
+ explorer,
2867
+ network = "mainnet",
2198
2868
  className
2199
2869
  }) {
2200
- const shown = middle(value, head, tail);
2870
+ const shown = shortenMiddle(value, head, tail);
2871
+ const link = href ?? (explorer ? explorerUrl(explorer, value, network) : void 0);
2872
+ const offsite = !!link && /^https?:\/\//.test(link);
2201
2873
  const text = /* @__PURE__ */ jsx("span", { title: value, className: "font-mono text-[0.875rem]", children: shown });
2202
2874
  return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex max-w-full items-center gap-1", className), children: [
2203
- href ? /* @__PURE__ */ jsx("a", { href, className: "underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground", children: text }) : text,
2875
+ link ? /* @__PURE__ */ jsxs(
2876
+ "a",
2877
+ {
2878
+ href: link,
2879
+ ...offsite ? { target: "_blank", rel: "noreferrer" } : {},
2880
+ className: "underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground",
2881
+ children: [
2882
+ text,
2883
+ offsite ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
2884
+ ]
2885
+ }
2886
+ ) : text,
2204
2887
  copy ? /* @__PURE__ */ jsx(CopyButton, { value, label: "Copy full value" }) : null
2205
2888
  ] });
2206
2889
  }
@@ -2254,96 +2937,269 @@ function ActivityList({ items, empty, className }) {
2254
2937
  return /* @__PURE__ */ jsx("li", { children: it.href ? /* @__PURE__ */ jsx("a", { href: it.href, className: "block transition-colors hover:bg-accent/60", children: body }) : body }, it.id);
2255
2938
  }) });
2256
2939
  }
2257
- var KIND = {
2258
- package: "text-oca-code-package",
2259
- tag: "text-oca-code-tag",
2260
- link: "text-oca-code-link"
2940
+ var LANG_NAME = {
2941
+ ts: "TypeScript",
2942
+ typescript: "TypeScript",
2943
+ tsx: "TSX",
2944
+ js: "JavaScript",
2945
+ javascript: "JavaScript",
2946
+ jsx: "JSX",
2947
+ mjs: "JavaScript",
2948
+ json: "JSON",
2949
+ jsonc: "JSON",
2950
+ bash: "Shell",
2951
+ sh: "Shell",
2952
+ shell: "Shell",
2953
+ zsh: "Shell",
2954
+ console: "Terminal",
2955
+ terminal: "Terminal",
2956
+ python: "Python",
2957
+ py: "Python",
2958
+ yaml: "YAML",
2959
+ yml: "YAML",
2960
+ diff: "Diff",
2961
+ text: "Text"
2261
2962
  };
2262
- function PackageCard({ items, className }) {
2263
- return /* @__PURE__ */ jsx(
2264
- "div",
2265
- {
2266
- className: cn(
2267
- "grid gap-x-10 gap-y-7 rounded-[1.25rem] border border-oca-ink-line bg-oca-ink-card p-6 text-oca-ink-foreground md:grid-cols-2 md:p-9",
2268
- className
2269
- ),
2270
- children: items.map((it, i) => {
2271
- const code = /* @__PURE__ */ jsx("span", { className: cn("text-[0.9375rem]", KIND[it.kind ?? "package"]), children: it.code });
2272
- return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
2273
- /* @__PURE__ */ jsx("h3", { className: "text-[1.125rem] font-semibold tracking-[-0.01em] text-oca-ink-title", children: it.title }),
2274
- it.href ? /* @__PURE__ */ jsx("a", { href: it.href, className: "w-fit underline decoration-transparent underline-offset-4 hover:decoration-current", children: code }) : code,
2275
- it.note ? /* @__PURE__ */ jsxs("p", { className: "text-[0.9375rem] leading-relaxed text-oca-ink-subtle", children: [
2276
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "// " }),
2277
- it.note
2278
- ] }) : null
2279
- ] }, i);
2280
- })
2281
- }
2282
- );
2963
+ function languageName(lang) {
2964
+ return lang ? LANG_NAME[lang.toLowerCase()] ?? lang : void 0;
2965
+ }
2966
+ function forClipboard(text, lang) {
2967
+ if (grammarOf(lang) !== "shell") return text;
2968
+ const lines = text.split("\n");
2969
+ if (!lines.some((l) => l.startsWith("$ "))) return text;
2970
+ return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
2971
+ }
2972
+ function linesFromDom(pre) {
2973
+ if (!pre) return null;
2974
+ const lines = pre.querySelectorAll("[data-line]");
2975
+ if (lines.length === 0) return pre.textContent ?? "";
2976
+ return Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
2977
+ }
2978
+ function prepare(code, lang, marks, diff) {
2979
+ const d = diff ? readDiff(code) : null;
2980
+ const src = d ? d.code : code.replace(/\r?\n$/, "");
2981
+ const lines = highlight(src, lang === "diff" ? void 0 : lang);
2982
+ const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
2983
+ return {
2984
+ html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
2985
+ copy: kept ? kept.join("\n") : src,
2986
+ lines: lines.length,
2987
+ diff: !!d
2988
+ };
2989
+ }
2990
+ function Well({
2991
+ preRef,
2992
+ html,
2993
+ children,
2994
+ lang,
2995
+ lines,
2996
+ maxLines,
2997
+ diff,
2998
+ lineNumbers
2999
+ }) {
3000
+ const foldable = maxLines !== void 0 && lines > maxLines + 2;
3001
+ const [open, setOpen] = useState(false);
3002
+ const folded = foldable && !open;
3003
+ const lined = html !== void 0;
3004
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3005
+ /* @__PURE__ */ jsx(
3006
+ "div",
3007
+ {
3008
+ className: cn(folded && "overflow-hidden"),
3009
+ style: folded ? { maxHeight: `calc(${maxLines} * 1.625em + 2rem)` } : void 0,
3010
+ children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--oca-code-surface)", children: /* @__PURE__ */ jsx(
3011
+ "pre",
3012
+ {
3013
+ ref: preRef,
3014
+ "data-diff": diff ? "" : void 0,
3015
+ "data-line-numbers": lineNumbers ? "" : void 0,
3016
+ className: cn(
3017
+ "oca-code w-max min-w-full py-4 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]",
3018
+ !lined && "px-5"
3019
+ ),
3020
+ children: lined ? /* @__PURE__ */ jsx("code", { className: "block", "data-lang": lang, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx("code", { className: "block", "data-lang": lang, children })
3021
+ }
3022
+ ) })
3023
+ }
3024
+ ),
3025
+ foldable ? /* @__PURE__ */ jsx(
3026
+ "div",
3027
+ {
3028
+ className: cn("flex justify-center px-5 pb-4", folded && "absolute inset-x-0 bottom-0 pt-16"),
3029
+ style: folded ? { background: "linear-gradient(to top, var(--oca-code-surface) 40%, transparent)" } : void 0,
3030
+ children: /* @__PURE__ */ jsx(
3031
+ "button",
3032
+ {
3033
+ type: "button",
3034
+ onClick: () => setOpen((v) => !v),
3035
+ "aria-expanded": open,
3036
+ className: "rounded-full border border-white/20 px-4 py-1.5 text-[0.8125rem] text-white transition-colors hover:bg-white/10",
3037
+ children: open ? "Show less" : `Show all ${lines} lines`
3038
+ }
3039
+ )
3040
+ }
3041
+ ) : null
3042
+ ] });
2283
3043
  }
3044
+ var FRAME = "overflow-hidden rounded-[1.25rem] border border-[var(--oca-code-line)] bg-[var(--oca-code-surface)]";
3045
+ var COPY_ON_INK = "text-oca-ink-subtle hover:bg-white/10 hover:text-white";
2284
3046
  function CodeBlock({
2285
3047
  code,
3048
+ html,
3049
+ children,
3050
+ lang,
2286
3051
  caption,
2287
3052
  copy = true,
3053
+ clearAfter,
2288
3054
  maxLines,
3055
+ highlight: marks,
3056
+ diff,
3057
+ lineNumbers,
3058
+ actions,
2289
3059
  className
2290
3060
  }) {
2291
- const lines = code.split("\n").length;
2292
- const foldable = maxLines !== void 0 && lines > maxLines + 2;
2293
- const [open, setOpen] = useState(false);
2294
- const folded = foldable && !open;
3061
+ const preRef = useRef(null);
3062
+ const isDiff = diff || lang === "diff";
3063
+ const markKey = typeof marks === "string" ? marks : marks?.join(",");
3064
+ const prepared = useMemo(
3065
+ () => html === void 0 && children === void 0 && code !== void 0 ? prepare(code, lang, markKey, !!isDiff) : null,
3066
+ [code, html, children, lang, markKey, isDiff]
3067
+ );
3068
+ const markup = prepared?.html ?? html;
3069
+ const lines = prepared?.lines ?? (html !== void 0 ? html.split("\n").length : code?.split("\n").length ?? 0);
3070
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current) ?? code ?? "", lang);
3071
+ return /* @__PURE__ */ jsxs("figure", { className: cn(FRAME, className), children: [
3072
+ /* @__PURE__ */ jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
3073
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
3074
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-1", children: [
3075
+ actions,
3076
+ copy ? /* @__PURE__ */ jsx(CopyButton, { value: read, label: "Copy code", clearAfter, className: COPY_ON_INK }) : null
3077
+ ] })
3078
+ ] }),
3079
+ /* @__PURE__ */ jsx(
3080
+ Well,
3081
+ {
3082
+ preRef,
3083
+ html: markup,
3084
+ lang,
3085
+ lines,
3086
+ maxLines,
3087
+ diff: prepared ? prepared.diff : isDiff,
3088
+ lineNumbers,
3089
+ children
3090
+ }
3091
+ )
3092
+ ] });
3093
+ }
3094
+ var tabListeners = /* @__PURE__ */ new Map();
3095
+ var tabMemory = /* @__PURE__ */ new Map();
3096
+ var storeKey = (k) => `oca-code-tab:${k}`;
3097
+ function readTab(key) {
3098
+ if (tabMemory.has(key)) return tabMemory.get(key);
3099
+ try {
3100
+ return window.localStorage.getItem(storeKey(key));
3101
+ } catch {
3102
+ return null;
3103
+ }
3104
+ }
3105
+ function writeTab(key, value) {
3106
+ tabMemory.set(key, value);
3107
+ try {
3108
+ window.localStorage.setItem(storeKey(key), value);
3109
+ } catch {
3110
+ }
3111
+ tabListeners.get(key)?.forEach((l) => l());
3112
+ }
3113
+ function useSyncedTab(key) {
3114
+ const subscribe2 = useCallback(
3115
+ (cb) => {
3116
+ if (!key) return () => {
3117
+ };
3118
+ const set = tabListeners.get(key) ?? /* @__PURE__ */ new Set();
3119
+ set.add(cb);
3120
+ tabListeners.set(key, set);
3121
+ return () => {
3122
+ set.delete(cb);
3123
+ };
3124
+ },
3125
+ [key]
3126
+ );
3127
+ const value = useSyncExternalStore(
3128
+ subscribe2,
3129
+ () => key ? readTab(key) : null,
3130
+ () => null
3131
+ );
3132
+ return [value, (v) => key && writeTab(key, v)];
3133
+ }
3134
+ function CodeTabs({
3135
+ items,
3136
+ syncKey,
3137
+ defaultValue,
3138
+ maxLines,
3139
+ className
3140
+ }) {
3141
+ const [synced, setSynced] = useSyncedTab(syncKey);
3142
+ const [local, setLocal] = useState(null);
3143
+ const labels = items.map((it) => it.label);
3144
+ const pick = [local, synced, defaultValue].find((v) => !!v && labels.includes(v)) ?? labels[0] ?? "";
3145
+ const active = items.find((it) => it.label === pick);
3146
+ const prepared = useMemo(() => items.map((it) => prepare(it.code, it.lang, void 0, it.lang === "diff")), [items]);
2295
3147
  return /* @__PURE__ */ jsxs(
2296
- "figure",
3148
+ TabsPrimitive.Root,
2297
3149
  {
2298
- className: cn(
2299
- "overflow-hidden rounded-[1.25rem] border border-[var(--oca-code-line)] bg-[var(--oca-code-surface)]",
2300
- className
2301
- ),
3150
+ value: pick,
3151
+ onValueChange: (v) => {
3152
+ setLocal(v);
3153
+ setSynced(v);
3154
+ },
3155
+ className: cn(FRAME, className),
2302
3156
  children: [
2303
- /* @__PURE__ */ jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
2304
- /* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? "Code" }),
2305
- copy ? /* @__PURE__ */ jsx(
2306
- CopyButton,
2307
- {
2308
- value: code,
2309
- label: "Copy code",
2310
- className: "text-oca-ink-subtle hover:bg-white/10 hover:text-white"
2311
- }
2312
- ) : null
2313
- ] }),
2314
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2315
- /* @__PURE__ */ jsx(
2316
- "div",
2317
- {
2318
- className: cn(folded && "overflow-hidden"),
2319
- style: folded ? { maxHeight: `calc(${maxLines} * 1.625em + 2.5rem)` } : void 0,
2320
- children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--oca-code-surface)", children: /* @__PURE__ */ jsx("pre", { className: "w-max min-w-full p-5 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]", children: /* @__PURE__ */ jsx("code", { children: code }) }) })
2321
- }
2322
- ),
2323
- foldable ? /* @__PURE__ */ jsx(
2324
- "div",
3157
+ /* @__PURE__ */ jsxs("div", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-2 pr-2", children: [
3158
+ /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--oca-code-surface)", className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(TabsPrimitive.List, { "aria-label": "Versions", className: "flex w-max items-center gap-0.5", children: items.map((it) => /* @__PURE__ */ jsx(
3159
+ TabsPrimitive.Trigger,
2325
3160
  {
3161
+ value: it.label,
2326
3162
  className: cn(
2327
- "flex justify-center px-5 pb-4",
2328
- folded && "absolute inset-x-0 bottom-0 pt-16"
3163
+ "relative inline-flex h-11 items-center whitespace-nowrap px-3 text-[0.8125rem] text-oca-ink-subtle outline-none transition-colors",
3164
+ "hover:text-white focus-visible:text-white focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
3165
+ "data-[state=active]:text-white",
3166
+ "after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:rounded-full after:bg-transparent data-[state=active]:after:bg-oca-orange"
2329
3167
  ),
2330
- style: folded ? { background: "linear-gradient(to top, var(--oca-code-surface) 40%, transparent)" } : void 0,
2331
- children: /* @__PURE__ */ jsx(
2332
- "button",
2333
- {
2334
- type: "button",
2335
- onClick: () => setOpen((v) => !v),
2336
- className: "rounded-full border border-white/20 px-4 py-1.5 text-[0.8125rem] text-white transition-colors hover:bg-white/10",
2337
- children: open ? "Show less" : `Show all ${lines} lines`
2338
- }
2339
- )
3168
+ children: it.label
3169
+ },
3170
+ it.label
3171
+ )) }) }),
3172
+ active ? /* @__PURE__ */ jsx(
3173
+ CopyButton,
3174
+ {
3175
+ value: () => forClipboard(prepared[items.indexOf(active)]?.copy ?? active.code, active.lang),
3176
+ label: `Copy ${active.label}`,
3177
+ className: COPY_ON_INK
2340
3178
  }
2341
3179
  ) : null
2342
- ] })
3180
+ ] }),
3181
+ items.map((it, i) => /* @__PURE__ */ jsx(TabsPrimitive.Content, { value: it.label, className: "outline-none", tabIndex: -1, children: /* @__PURE__ */ jsx(
3182
+ Well,
3183
+ {
3184
+ html: prepared[i].html,
3185
+ lang: it.lang,
3186
+ lines: prepared[i].lines,
3187
+ maxLines,
3188
+ diff: prepared[i].diff
3189
+ }
3190
+ ) }, it.label))
2343
3191
  ]
2344
3192
  }
2345
3193
  );
2346
3194
  }
3195
+ function InstallTabs({ pkg, dev = false, className }) {
3196
+ const items = [
3197
+ { label: "npm", code: `npm install ${dev ? "--save-dev " : ""}${pkg}`, lang: "bash" },
3198
+ { label: "yarn", code: `yarn add ${dev ? "--dev " : ""}${pkg}`, lang: "bash" },
3199
+ { label: "pnpm", code: `pnpm add ${dev ? "--save-dev " : ""}${pkg}`, lang: "bash" }
3200
+ ];
3201
+ return /* @__PURE__ */ jsx(CodeTabs, { items, syncKey: "package-manager", className });
3202
+ }
2347
3203
  function SplitBar({
2348
3204
  segments,
2349
3205
  caption,
@@ -2728,7 +3584,7 @@ function ErrorPage({
2728
3584
  /* @__PURE__ */ jsx("p", { className: "oca-lead oca-enter [--enter-delay:150ms]", children: detail ?? words.detail }),
2729
3585
  /* @__PURE__ */ jsx("div", { className: "oca-enter flex flex-wrap gap-3 [--enter-delay:230ms]", children: actions ?? /* @__PURE__ */ jsxs(Fragment, { children: [
2730
3586
  server ? /* @__PURE__ */ jsx(Button, { onClick: () => window.location.reload(), children: "Try again" }) : null,
2731
- /* @__PURE__ */ jsx(Button, { asChild: true, variant: server ? "secondary" : "primary", children: /* @__PURE__ */ jsx(Link5, { href: home, children: "Go home" }) })
3587
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: server ? "secondary" : "primary", children: /* @__PURE__ */ jsx(Link8, { href: home, children: "Go home" }) })
2732
3588
  ] }) })
2733
3589
  ] }),
2734
3590
  art !== null ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "oca-enter hidden justify-center md:col-span-5 md:flex [--enter-delay:120ms]", children: art ?? /* @__PURE__ */ jsx(MarkOutline, { className: "w-full max-w-[20rem] text-oca-hairline-strong" }) }) : null
@@ -2856,7 +3712,7 @@ function TextLink({
2856
3712
  const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
2857
3713
  const offsite = external ?? /^https?:\/\//.test(href);
2858
3714
  if (internal && !offsite) {
2859
- return /* @__PURE__ */ jsx(Link5, { href, className: cn(LINK, className), children });
3715
+ return /* @__PURE__ */ jsx(Link8, { href, className: cn(LINK, className), children });
2860
3716
  }
2861
3717
  return /* @__PURE__ */ jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
2862
3718
  children,
@@ -3044,7 +3900,8 @@ var FAMILY = [
3044
3900
  group: "app",
3045
3901
  line: "Builders find co-founders and backers.",
3046
3902
  status: "testing",
3047
- protocols: ["attest"]
3903
+ // Signs in with an orangecheck account and a wallet; uses none of the six directly.
3904
+ protocols: []
3048
3905
  },
3049
3906
  {
3050
3907
  slug: "me-demo",
@@ -3136,19 +3993,32 @@ function ProtocolGrid({
3136
3993
  ] }),
3137
3994
  p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
3138
3995
  ] }),
3139
- /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsx("a", { href: link === "tool" ? p.toolHref : p.pageHref, className: STRETCH, children: p.label }) }),
3996
+ /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsx(
3997
+ "a",
3998
+ {
3999
+ href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
4000
+ className: STRETCH,
4001
+ children: p.label
4002
+ }
4003
+ ) }),
3140
4004
  /* @__PURE__ */ jsx("p", { className: "oca-body", children: p.line }),
3141
4005
  /* @__PURE__ */ jsxs("div", { className: "mt-auto flex items-center justify-between gap-3 pt-2 text-[0.875rem] text-muted-foreground", children: [
3142
4006
  /* @__PURE__ */ jsxs("span", { className: "oca-tabular", children: [
3143
4007
  "Nostr kind ",
3144
4008
  p.kinds
3145
4009
  ] }),
3146
- /* @__PURE__ */ jsx(
4010
+ link === "tool" ? /* @__PURE__ */ jsx(
3147
4011
  ArrowUpRight,
3148
4012
  {
3149
4013
  "aria-hidden": true,
3150
4014
  className: "size-4 transition-transform duration-200 group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-foreground"
3151
4015
  }
4016
+ ) : /* @__PURE__ */ jsx(
4017
+ ArrowRight,
4018
+ {
4019
+ "aria-hidden": true,
4020
+ className: "size-4 transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-foreground"
4021
+ }
3152
4022
  )
3153
4023
  ] })
3154
4024
  ] }) }, slug);
@@ -3434,6 +4304,7 @@ function VerifyReport({
3434
4304
  facts,
3435
4305
  notChecked,
3436
4306
  actions,
4307
+ as: Heading = "h2",
3437
4308
  className
3438
4309
  }) {
3439
4310
  return /* @__PURE__ */ jsxs(
@@ -3444,7 +4315,7 @@ function VerifyReport({
3444
4315
  children: [
3445
4316
  /* @__PURE__ */ jsxs("header", { className: "flex flex-col items-start gap-3 p-6 md:p-8", children: [
3446
4317
  /* @__PURE__ */ jsx(StatusBadge, { status: verdict }),
3447
- /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: title }),
4318
+ /* @__PURE__ */ jsx(Heading, { className: "oca-display-3", children: title }),
3448
4319
  summary ? /* @__PURE__ */ jsx("p", { className: "oca-body max-w-[40rem]", children: summary }) : null
3449
4320
  ] }),
3450
4321
  /* @__PURE__ */ jsx("ul", { "aria-label": "Checks", className: "divide-y divide-border border-t border-border", children: checks.map((c, i) => {
@@ -3544,9 +4415,1207 @@ function SignMessage({
3544
4415
  )
3545
4416
  ] });
3546
4417
  }
3547
- function SiteRow({ site, here, onNavigate }) {
3548
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
3549
- "a",
4418
+ var isInternal = (href) => href.startsWith("/") || href.startsWith("#");
4419
+ function DocLink({ href, className, children, ...rest }) {
4420
+ return isInternal(href) ? /* @__PURE__ */ jsx(Link8, { href, className, ...rest, children }) : /* @__PURE__ */ jsx("a", { href, className, ...rest, children });
4421
+ }
4422
+ function Breadcrumbs({ items, action, className }) {
4423
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-11 items-center justify-between gap-4 sm:min-h-0", className), children: [
4424
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "min-w-0", children: /* @__PURE__ */ jsx("ol", { className: "flex min-w-0 items-center gap-1.5 text-[0.875rem] text-muted-foreground", children: items.map((c, i) => {
4425
+ const last = i === items.length - 1;
4426
+ return /* @__PURE__ */ jsxs("li", { className: cn("flex items-center gap-1.5", last ? "min-w-0" : "shrink-0"), children: [
4427
+ c.href && !last ? /* @__PURE__ */ jsx(DocLink, { href: c.href, className: "inline-flex min-h-11 items-center transition-colors hover:text-foreground sm:min-h-0", children: c.label }) : /* @__PURE__ */ jsx("span", { "aria-current": last ? "page" : void 0, className: cn("truncate", last && "text-foreground"), children: c.label }),
4428
+ !last ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }) : null
4429
+ ] }, i);
4430
+ }) }) }),
4431
+ action ? /* @__PURE__ */ jsx("div", { className: "shrink-0 text-[0.875rem]", children: action }) : null
4432
+ ] });
4433
+ }
4434
+ function DocsPager({ prev, next, className }) {
4435
+ if (!prev && !next) return null;
4436
+ const card = (l, dir) => /* @__PURE__ */ jsxs(
4437
+ DocLink,
4438
+ {
4439
+ href: l.href,
4440
+ className: cn(
4441
+ "group flex min-h-20 flex-col justify-center gap-1 rounded-2xl border border-border bg-card px-5 py-4 transition-colors hover:border-oca-hairline-strong",
4442
+ dir === "next" && "items-end text-right sm:col-start-2"
4443
+ ),
4444
+ children: [
4445
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-[0.8125rem] text-muted-foreground", children: [
4446
+ dir === "prev" ? /* @__PURE__ */ jsx(ArrowLeft, { "aria-hidden": true, className: "size-3.5" }) : null,
4447
+ dir === "prev" ? "Previous" : "Next",
4448
+ l.section ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }) : null,
4449
+ l.section ? /* @__PURE__ */ jsx("span", { className: "truncate", children: l.section }) : null,
4450
+ dir === "next" ? /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": true, className: "size-3.5" }) : null
4451
+ ] }),
4452
+ /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: l.label })
4453
+ ]
4454
+ }
4455
+ );
4456
+ return /* @__PURE__ */ jsxs("nav", { "aria-label": "Previous and next page", className: cn("grid grid-cols-1 gap-3 border-t border-border pt-8 sm:grid-cols-2", className), children: [
4457
+ prev ? card(prev, "prev") : null,
4458
+ next ? card(next, "next") : null
4459
+ ] });
4460
+ }
4461
+ function useHeadings(selector = "#docs-content", key) {
4462
+ const [items, setItems] = useState([]);
4463
+ useEffect(() => {
4464
+ const read = () => {
4465
+ const root = document.querySelector(selector);
4466
+ if (!root) return setItems([]);
4467
+ setItems(
4468
+ Array.from(root.querySelectorAll("h2[id], h3[id]")).map((h) => ({
4469
+ id: h.id,
4470
+ // The anchor link's "#" is not part of the name.
4471
+ label: (h.querySelector("[data-heading-text]") ?? h).textContent?.trim() ?? "",
4472
+ level: h.tagName === "H3" ? 3 : 2
4473
+ }))
4474
+ );
4475
+ };
4476
+ const raf = requestAnimationFrame(read);
4477
+ const t = setTimeout(read, 80);
4478
+ return () => {
4479
+ cancelAnimationFrame(raf);
4480
+ clearTimeout(t);
4481
+ };
4482
+ }, [selector, key]);
4483
+ const activeId = useActiveHeading(items.map((i) => i.id));
4484
+ return { items, activeId };
4485
+ }
4486
+ function OnThisPage({
4487
+ items,
4488
+ activeId,
4489
+ title = "On this page",
4490
+ onNavigate,
4491
+ className
4492
+ }) {
4493
+ const id = useId();
4494
+ if (items.length === 0) return null;
4495
+ return (
4496
+ // With no visible title (a folded list under its own summary) the name is still "On this page".
4497
+ /* @__PURE__ */ jsxs("nav", { "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : "On this page", className, children: [
4498
+ title ? /* @__PURE__ */ jsx("p", { id, className: "mb-3 text-[0.875rem] font-medium", children: title }) : null,
4499
+ /* @__PURE__ */ jsx("ul", { children: items.map((t) => {
4500
+ const on = t.id === activeId;
4501
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
4502
+ "a",
4503
+ {
4504
+ href: `#${t.id}`,
4505
+ onClick: onNavigate,
4506
+ "aria-current": on ? "location" : void 0,
4507
+ className: cn(
4508
+ "block border-l py-1.5 text-[0.875rem] leading-snug transition-colors",
4509
+ t.level === 3 ? "pl-7" : "pl-4",
4510
+ on ? "border-foreground text-foreground" : "border-border text-muted-foreground hover:text-foreground"
4511
+ ),
4512
+ children: t.label
4513
+ }
4514
+ ) }, t.id);
4515
+ }) })
4516
+ ] })
4517
+ );
4518
+ }
4519
+ var CALLOUT_TONE = { note: "neutral", warning: "brand", danger: "danger" };
4520
+ function Callout({
4521
+ tone = "note",
4522
+ title,
4523
+ children,
4524
+ className
4525
+ }) {
4526
+ return /* @__PURE__ */ jsx(
4527
+ Notice,
4528
+ {
4529
+ tone: CALLOUT_TONE[tone],
4530
+ title,
4531
+ role: "note",
4532
+ className: cn("my-6 [&_p]:my-0 [&_p]:text-[0.9375rem] [&_p]:leading-relaxed [&_p+p]:mt-3", className),
4533
+ children
4534
+ }
4535
+ );
4536
+ }
4537
+ function Step({ title, id, children }) {
4538
+ return /* @__PURE__ */ jsxs("li", { className: "relative pb-8 pl-11 last:pb-0 [counter-increment:oca-step]", children: [
4539
+ /* @__PURE__ */ jsx(
4540
+ "span",
4541
+ {
4542
+ "aria-hidden": true,
4543
+ className: "absolute left-0 top-0 flex size-7 items-center justify-center rounded-full border border-oca-hairline-strong bg-card text-[0.8125rem] oca-tabular text-foreground before:content-[counter(oca-step)]"
4544
+ }
4545
+ ),
4546
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute bottom-1 left-[0.8125rem] top-9 w-px bg-border" }),
4547
+ /* @__PURE__ */ jsx("h3", { id, className: "scroll-mt-28 pt-0.5 text-[1.0625rem] font-medium leading-snug tracking-[-0.008em] text-foreground", children: title }),
4548
+ /* @__PURE__ */ jsx("div", { className: "mt-2 text-muted-foreground [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", children })
4549
+ ] });
4550
+ }
4551
+ function Steps({ children, className }) {
4552
+ return /* @__PURE__ */ jsx("ol", { className: cn("not-prose my-8 flex flex-col [counter-reset:oca-step] [&>li:last-child>span:nth-child(2)]:hidden", className), children });
4553
+ }
4554
+ function LinkCard({
4555
+ href,
4556
+ title,
4557
+ description,
4558
+ icon,
4559
+ meta,
4560
+ className
4561
+ }) {
4562
+ const Arrow = isInternal(href) ? ArrowRight : ArrowUpRight;
4563
+ return /* @__PURE__ */ jsxs(
4564
+ DocLink,
4565
+ {
4566
+ href,
4567
+ className: cn(
4568
+ "group flex h-full flex-col gap-3 rounded-[1.25rem] border border-border bg-card p-5 transition-colors hover:border-oca-hairline-strong",
4569
+ className
4570
+ ),
4571
+ children: [
4572
+ /* @__PURE__ */ jsxs("span", { className: "flex items-start justify-between gap-3", children: [
4573
+ icon ? /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground [&_svg]:size-[1.125rem]", children: icon }) : /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }),
4574
+ /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
4575
+ meta,
4576
+ /* @__PURE__ */ jsx(Arrow, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground" })
4577
+ ] })
4578
+ ] }),
4579
+ icon ? /* @__PURE__ */ jsx("span", { className: "text-[1rem] font-medium leading-snug text-foreground", children: title }) : null,
4580
+ description ? /* @__PURE__ */ jsx("span", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children: description }) : null
4581
+ ]
4582
+ }
4583
+ );
4584
+ }
4585
+ function CardGrid({ columns = 2, children, className }) {
4586
+ return /* @__PURE__ */ jsx("div", { className: cn("not-prose my-6 grid grid-cols-1 gap-3 sm:grid-cols-2", columns === 3 && "lg:grid-cols-3", className), children });
4587
+ }
4588
+ function MdxTable({ className, ...props }) {
4589
+ return /* @__PURE__ */ jsx("div", { className: "not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4590
+ "table",
4591
+ {
4592
+ className: cn(
4593
+ "w-full border-collapse text-left text-[0.875rem] leading-relaxed",
4594
+ "[&_th]:whitespace-nowrap [&_th]:border-b [&_th]:border-oca-hairline-strong [&_th]:bg-oca-table-head [&_th]:px-4 [&_th]:py-2.5 [&_th]:text-[0.8125rem] [&_th]:font-medium [&_th]:text-foreground",
4595
+ "[&_td]:border-t [&_td]:border-border [&_td]:px-4 [&_td]:py-2.5 [&_td]:align-top [&_td]:text-muted-foreground [&_tbody_tr:first-child_td]:border-t-0",
4596
+ "[&_td_code]:bg-transparent [&_td_code]:p-0 [&_td_code]:text-foreground [&_td:first-child]:text-foreground",
4597
+ "[&_[align=center]]:text-center [&_[align=right]]:text-right",
4598
+ // On a phone a cell keeps a readable width; the table scrolls instead of crushing it.
4599
+ "max-sm:[&_td]:min-w-[9rem]",
4600
+ className
4601
+ ),
4602
+ ...props
4603
+ }
4604
+ ) }) });
4605
+ }
4606
+ function ApiTable({
4607
+ rows,
4608
+ caption,
4609
+ nameHeader = "Name",
4610
+ className
4611
+ }) {
4612
+ const hasDefault = rows.some((r) => r.default !== void 0);
4613
+ const marks = (r) => /* @__PURE__ */ jsxs(Fragment, { children: [
4614
+ r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
4615
+ r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
4616
+ r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
4617
+ ] });
4618
+ return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
4619
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-2xl border border-border bg-card max-sm:hidden", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem]", children: [
4620
+ caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
4621
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
4622
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
4623
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
4624
+ hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
4625
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" })
4626
+ ] }) }),
4627
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: rows.map((r) => /* @__PURE__ */ jsxs("tr", { className: "align-top", children: [
4628
+ /* @__PURE__ */ jsx("th", { scope: "row", className: "px-4 py-3 text-left font-normal", children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start gap-1", children: [
4629
+ /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
4630
+ marks(r)
4631
+ ] }) }),
4632
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.type ?? "\u2014" }),
4633
+ hasDefault ? /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.default ?? "\u2014" }) : null,
4634
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-3 leading-relaxed text-muted-foreground", children: r.description })
4635
+ ] }, r.name)) })
4636
+ ] }) }) }),
4637
+ /* @__PURE__ */ jsx("ul", { "aria-label": caption, className: "divide-y divide-border rounded-2xl border border-border bg-card sm:hidden", children: rows.map((r) => /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1.5 px-4 py-3.5", children: [
4638
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
4639
+ /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.875rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
4640
+ r.type ? /* @__PURE__ */ jsx("code", { className: "break-all font-mono text-[0.8125rem] text-muted-foreground", children: r.type }) : null
4641
+ ] }),
4642
+ /* @__PURE__ */ jsx("span", { className: "flex flex-wrap items-center gap-2 empty:hidden", children: marks(r) }),
4643
+ r.description ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-relaxed text-muted-foreground", children: r.description }) : null,
4644
+ r.default !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "text-[0.8125rem] text-muted-foreground", children: [
4645
+ "Default ",
4646
+ /* @__PURE__ */ jsx("code", { className: "font-mono text-foreground", children: r.default })
4647
+ ] }) : null
4648
+ ] }, r.name)) })
4649
+ ] });
4650
+ }
4651
+ function useDarkMode() {
4652
+ const [dark, setDark] = useState(false);
4653
+ useEffect(() => {
4654
+ const root = document.documentElement;
4655
+ const read = () => setDark(root.classList.contains("dark"));
4656
+ read();
4657
+ const mo = new MutationObserver(read);
4658
+ mo.observe(root, { attributes: true, attributeFilter: ["class"] });
4659
+ return () => mo.disconnect();
4660
+ }, []);
4661
+ return dark;
4662
+ }
4663
+ function mermaidTheme(el) {
4664
+ const css = getComputedStyle(el);
4665
+ const v = (name) => css.getPropertyValue(name).trim();
4666
+ const card = v("--card");
4667
+ const muted = v("--muted");
4668
+ const text = v("--foreground");
4669
+ const subtle = v("--muted-foreground");
4670
+ const line = v("--input");
4671
+ const hair = v("--oca-hairline-strong");
4672
+ return {
4673
+ background: "transparent",
4674
+ fontFamily: css.fontFamily,
4675
+ fontSize: "14px",
4676
+ textColor: text,
4677
+ mainBkg: card,
4678
+ primaryColor: card,
4679
+ primaryTextColor: text,
4680
+ primaryBorderColor: hair,
4681
+ secondaryColor: muted,
4682
+ secondaryTextColor: text,
4683
+ secondaryBorderColor: hair,
4684
+ tertiaryColor: muted,
4685
+ tertiaryTextColor: text,
4686
+ tertiaryBorderColor: hair,
4687
+ nodeBorder: hair,
4688
+ lineColor: line,
4689
+ edgeLabelBackground: card,
4690
+ clusterBkg: muted,
4691
+ clusterBorder: hair,
4692
+ titleColor: text,
4693
+ noteBkgColor: muted,
4694
+ noteTextColor: text,
4695
+ noteBorderColor: hair,
4696
+ actorBkg: card,
4697
+ actorBorder: hair,
4698
+ actorTextColor: text,
4699
+ actorLineColor: line,
4700
+ signalColor: text,
4701
+ signalTextColor: text,
4702
+ labelBoxBkgColor: card,
4703
+ labelBoxBorderColor: hair,
4704
+ labelTextColor: text,
4705
+ loopTextColor: subtle,
4706
+ activationBkgColor: muted,
4707
+ activationBorderColor: hair,
4708
+ sequenceNumberColor: card
4709
+ };
4710
+ }
4711
+ function naturalSize(svg) {
4712
+ const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
4713
+ if (!w) return svg;
4714
+ return svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${Math.ceil(Number(w))}"`).replace(/max-width:\s*[\d.]+px;?/, "");
4715
+ }
4716
+ function Diagram({ chart, caption, load, className }) {
4717
+ const ref = useRef(null);
4718
+ const dark = useDarkMode();
4719
+ const raw = useId();
4720
+ const [svg, setSvg] = useState(null);
4721
+ const [failed, setFailed] = useState(false);
4722
+ useEffect(() => {
4723
+ let live = true;
4724
+ const el = ref.current;
4725
+ if (!el) return;
4726
+ (async () => {
4727
+ try {
4728
+ const mod = await load();
4729
+ const mermaid = "default" in mod ? mod.default : mod;
4730
+ mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
4731
+ const { svg: drawn } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
4732
+ if (live) {
4733
+ setSvg(naturalSize(drawn));
4734
+ setFailed(false);
4735
+ }
4736
+ } catch {
4737
+ if (live) setFailed(true);
4738
+ }
4739
+ })();
4740
+ return () => {
4741
+ live = false;
4742
+ };
4743
+ }, [chart, dark, load, raw]);
4744
+ if (failed) return /* @__PURE__ */ jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
4745
+ return /* @__PURE__ */ jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
4746
+ svg ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
4747
+ "div",
4748
+ {
4749
+ className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
4750
+ role: "img",
4751
+ "aria-label": typeof caption === "string" ? caption : "Diagram",
4752
+ dangerouslySetInnerHTML: { __html: svg }
4753
+ }
4754
+ ) }) : /* @__PURE__ */ jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
4755
+ caption ? /* @__PURE__ */ jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
4756
+ ] });
4757
+ }
4758
+ var HEADING = {
4759
+ h1: "oca-display-3 mb-4 text-foreground",
4760
+ h2: "mb-3 mt-12 text-[1.375rem] font-medium leading-tight tracking-[-0.015em] text-foreground md:text-[1.5rem]",
4761
+ h3: "mb-2 mt-9 text-[1.125rem] font-medium leading-snug tracking-[-0.01em] text-foreground",
4762
+ h4: "mb-2 mt-7 text-[1rem] font-medium leading-snug text-foreground"
4763
+ };
4764
+ function DocsHeading({
4765
+ as: Tag,
4766
+ id,
4767
+ children,
4768
+ className,
4769
+ ...props
4770
+ }) {
4771
+ return /* @__PURE__ */ jsxs(Tag, { id, className: cn("group scroll-mt-28", HEADING[Tag], className), ...props, children: [
4772
+ /* @__PURE__ */ jsx("span", { "data-heading-text": "", children }),
4773
+ id && Tag !== "h1" ? /* @__PURE__ */ jsxs(
4774
+ "a",
4775
+ {
4776
+ href: `#${id}`,
4777
+ className: "ml-2 inline-block rounded-md px-1 align-baseline text-[0.85em] font-normal text-oca-subtle no-underline opacity-0 transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100",
4778
+ children: [
4779
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "#" }),
4780
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Link to this section" })
4781
+ ]
4782
+ }
4783
+ ) : null
4784
+ ] });
4785
+ }
4786
+ function codeText(node) {
4787
+ if (typeof node === "string") return node;
4788
+ if (typeof node === "number") return String(node);
4789
+ if (Array.isArray(node)) return node.map(codeText).join("");
4790
+ if (isValidElement(node)) return codeText(node.props.children);
4791
+ return "";
4792
+ }
4793
+ function codeLang(node) {
4794
+ const child = Children.toArray(node)[0];
4795
+ if (!isValidElement(child)) return void 0;
4796
+ const cls = child.props.className ?? "";
4797
+ return cls.match(/language-([\w+-]+)/)?.[1];
4798
+ }
4799
+ function useMacKeys() {
4800
+ const [mac, setMac] = useState(true);
4801
+ useEffect(() => {
4802
+ setMac(/Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent));
4803
+ }, []);
4804
+ return mac;
4805
+ }
4806
+ var typing = (el) => el instanceof HTMLElement && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
4807
+ var SearchButton = forwardRef(function SearchButton2({ label = "Search", onClick, className }, ref) {
4808
+ const mac = useMacKeys();
4809
+ return /* @__PURE__ */ jsxs(
4810
+ "button",
4811
+ {
4812
+ ref,
4813
+ type: "button",
4814
+ onClick,
4815
+ "aria-keyshortcuts": mac ? "Meta+K" : "Control+K",
4816
+ className: cn(
4817
+ "inline-flex size-10 items-center justify-center gap-2 rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
4818
+ "md:h-10 md:w-56 md:justify-start md:border md:border-border md:bg-card md:pl-3.5 md:pr-2 md:hover:border-oca-hairline-strong md:hover:bg-card",
4819
+ className
4820
+ ),
4821
+ children: [
4822
+ /* @__PURE__ */ jsx(Search, { "aria-hidden": true, className: "size-[1.125rem] shrink-0 md:size-4" }),
4823
+ /* @__PURE__ */ jsx("span", { className: "sr-only flex-1 text-left text-[0.9375rem] md:not-sr-only", children: label }),
4824
+ /* @__PURE__ */ jsx(Kbd, { "aria-hidden": true, className: "hidden md:inline-flex", children: mac ? "\u2318K" : "Ctrl K" })
4825
+ ]
4826
+ }
4827
+ );
4828
+ });
4829
+ function SearchDialog({
4830
+ onQuery,
4831
+ open: openProp,
4832
+ onOpenChange,
4833
+ onSelect,
4834
+ button = true,
4835
+ hotkey = true,
4836
+ label = "Search",
4837
+ placeholder = "Search the docs",
4838
+ idle,
4839
+ defaultQuery = "",
4840
+ debounceMs = 120,
4841
+ className
4842
+ }) {
4843
+ const [own, setOwn] = useState(false);
4844
+ const open = openProp ?? own;
4845
+ const setOpen = (v) => {
4846
+ if (openProp === void 0) setOwn(v);
4847
+ onOpenChange?.(v);
4848
+ };
4849
+ const [query, setQuery] = useState(defaultQuery);
4850
+ const [groups, setGroups] = useState([]);
4851
+ const [state, setState] = useState("idle");
4852
+ const [active, setActive] = useState(0);
4853
+ const listId = useId();
4854
+ const listRef = useRef(null);
4855
+ const buttonRef = useRef(null);
4856
+ const returnTo = useRef(null);
4857
+ const flat = useMemo(() => groups.flatMap((g) => g.results), [groups]);
4858
+ const latest = useRef({ open, setOpen, onQuery });
4859
+ latest.current = { open, setOpen, onQuery };
4860
+ useEffect(() => {
4861
+ if (!hotkey) return;
4862
+ const onKey = (e) => {
4863
+ const { open: isOpen, setOpen: set } = latest.current;
4864
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
4865
+ e.preventDefault();
4866
+ set(!isOpen);
4867
+ } else if (e.key === "/" && !isOpen && !typing(e.target)) {
4868
+ e.preventDefault();
4869
+ set(true);
4870
+ }
4871
+ };
4872
+ window.addEventListener("keydown", onKey);
4873
+ return () => window.removeEventListener("keydown", onKey);
4874
+ }, [hotkey]);
4875
+ useEffect(() => {
4876
+ const q = query.trim();
4877
+ if (!q) {
4878
+ setGroups([]);
4879
+ setState("idle");
4880
+ return;
4881
+ }
4882
+ const ctl = new AbortController();
4883
+ setState("loading");
4884
+ const t = setTimeout(async () => {
4885
+ try {
4886
+ const out = await latest.current.onQuery(q, ctl.signal);
4887
+ if (ctl.signal.aborted) return;
4888
+ setGroups(out.filter((g) => g.results.length > 0));
4889
+ setActive(0);
4890
+ setState("done");
4891
+ } catch {
4892
+ if (!ctl.signal.aborted) setState("error");
4893
+ }
4894
+ }, debounceMs);
4895
+ return () => {
4896
+ clearTimeout(t);
4897
+ ctl.abort();
4898
+ };
4899
+ }, [query, debounceMs]);
4900
+ useEffect(() => {
4901
+ listRef.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
4902
+ }, [active]);
4903
+ const choose = (r) => {
4904
+ setOpen(false);
4905
+ if (onSelect) onSelect(r);
4906
+ else window.location.assign(r.href);
4907
+ };
4908
+ const optionId = (i) => `${listId}-o${i}`;
4909
+ const showList = state === "done" && flat.length > 0;
4910
+ let index = -1;
4911
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4912
+ button ? /* @__PURE__ */ jsx(SearchButton, { ref: buttonRef, label, onClick: () => setOpen(true), className }) : null,
4913
+ /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
4914
+ /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "oca-animate-fade fixed inset-0 z-50 bg-[rgb(10_10_10/0.38)] backdrop-blur-[2px]" }),
4915
+ /* @__PURE__ */ jsxs(
4916
+ DialogPrimitive.Content,
4917
+ {
4918
+ "aria-describedby": void 0,
4919
+ onOpenAutoFocus: () => {
4920
+ const el = document.activeElement;
4921
+ returnTo.current = el instanceof HTMLElement && el !== document.body ? el : null;
4922
+ },
4923
+ onCloseAutoFocus: (e) => {
4924
+ const back = returnTo.current?.isConnected ? returnTo.current : buttonRef.current;
4925
+ if (back) {
4926
+ e.preventDefault();
4927
+ back.focus();
4928
+ }
4929
+ },
4930
+ className: "oca-animate-rise fixed left-1/2 top-3 z-50 flex max-h-[calc(100dvh-1.5rem)] w-[calc(100vw-1.5rem)] -translate-x-1/2 flex-col overflow-hidden rounded-[1.5rem] border border-border bg-popover text-popover-foreground shadow-xl outline-none sm:top-[12vh] sm:max-h-[min(36rem,76vh)] sm:w-[min(92vw,40rem)]",
4931
+ children: [
4932
+ /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: label }),
4933
+ /* @__PURE__ */ jsxs("div", { className: "flex h-14 shrink-0 items-center gap-3 border-b border-border pl-5 pr-3", children: [
4934
+ state === "loading" ? /* @__PURE__ */ jsx(Spinner, { className: "size-[1.125rem] text-muted-foreground" }) : /* @__PURE__ */ jsx(Search, { "aria-hidden": true, className: "size-[1.125rem] shrink-0 text-muted-foreground" }),
4935
+ /* @__PURE__ */ jsx(
4936
+ "input",
4937
+ {
4938
+ autoFocus: true,
4939
+ value: query,
4940
+ onChange: (e) => setQuery(e.target.value),
4941
+ onKeyDown: (e) => {
4942
+ if (!showList) return;
4943
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
4944
+ e.preventDefault();
4945
+ const d = e.key === "ArrowDown" ? 1 : -1;
4946
+ setActive((a) => (a + d + flat.length) % flat.length);
4947
+ } else if (e.key === "Enter" && flat[active]) {
4948
+ e.preventDefault();
4949
+ choose(flat[active]);
4950
+ }
4951
+ },
4952
+ placeholder,
4953
+ role: "combobox",
4954
+ "aria-label": label,
4955
+ "aria-expanded": showList,
4956
+ "aria-controls": listId,
4957
+ "aria-autocomplete": "list",
4958
+ "aria-activedescendant": showList ? optionId(active) : void 0,
4959
+ spellCheck: false,
4960
+ autoComplete: "off",
4961
+ className: "h-full min-w-0 flex-1 bg-transparent text-base text-foreground outline-none placeholder:text-oca-subtle"
4962
+ }
4963
+ ),
4964
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "inline-flex h-8 shrink-0 items-center rounded-md border border-border px-2 text-[0.75rem] text-muted-foreground transition-colors hover:text-foreground", children: [
4965
+ /* @__PURE__ */ jsx("span", { className: "sm:hidden", children: "Close" }),
4966
+ /* @__PURE__ */ jsx("span", { className: "max-sm:hidden", "aria-hidden": true, children: "Esc" }),
4967
+ /* @__PURE__ */ jsx("span", { className: "sr-only max-sm:hidden", children: "Close search" })
4968
+ ] })
4969
+ ] }),
4970
+ /* @__PURE__ */ jsxs("div", { ref: listRef, className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-2", children: [
4971
+ /* @__PURE__ */ jsx("div", { id: listId, role: "listbox", "aria-label": "Results", className: cn(!showList && "hidden"), children: groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": typeof g.label === "string" ? g.label : void 0, className: "pb-1", children: [
4972
+ /* @__PURE__ */ jsx("p", { "aria-hidden": true, className: "px-3 pb-1.5 pt-3 text-[0.8125rem] text-muted-foreground", children: g.label }),
4973
+ g.results.map((r) => {
4974
+ index++;
4975
+ const i = index;
4976
+ const on = i === active;
4977
+ return /* @__PURE__ */ jsxs(
4978
+ "a",
4979
+ {
4980
+ id: optionId(i),
4981
+ href: r.href,
4982
+ role: "option",
4983
+ "aria-selected": on,
4984
+ tabIndex: -1,
4985
+ onMouseMove: () => setActive(i),
4986
+ onClick: (e) => {
4987
+ if (e.metaKey || e.ctrlKey || e.shiftKey) return;
4988
+ e.preventDefault();
4989
+ choose(r);
4990
+ },
4991
+ className: cn(
4992
+ "flex items-start gap-3 rounded-xl px-3 py-2.5 transition-colors",
4993
+ on ? "bg-accent" : "hover:bg-accent"
4994
+ ),
4995
+ children: [
4996
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
4997
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[0.9375rem] font-medium text-foreground", children: r.title }),
4998
+ r.section ? /* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-muted-foreground", children: r.section }) : null,
4999
+ r.excerptHtml ? /* @__PURE__ */ jsx(
5000
+ "span",
5001
+ {
5002
+ className: "line-clamp-2 text-[0.875rem] leading-snug text-muted-foreground [&_mark]:rounded-sm [&_mark]:bg-[color-mix(in_oklab,var(--oca-orange)_22%,transparent)] [&_mark]:px-0.5 [&_mark]:text-foreground",
5003
+ dangerouslySetInnerHTML: { __html: r.excerptHtml }
5004
+ }
5005
+ ) : r.excerpt ? /* @__PURE__ */ jsx("span", { className: "line-clamp-2 text-[0.875rem] leading-snug text-muted-foreground", children: r.excerpt }) : null
5006
+ ] }),
5007
+ /* @__PURE__ */ jsx(CornerDownLeft, { "aria-hidden": true, className: cn("mt-1 size-4 shrink-0 text-muted-foreground", !on && "invisible") })
5008
+ ]
5009
+ },
5010
+ r.id
5011
+ );
5012
+ })
5013
+ ] }, gi)) }),
5014
+ state === "idle" ? /* @__PURE__ */ jsx("div", { className: "px-3 py-6 text-[0.9375rem] text-muted-foreground", children: idle ?? "Type a word: a protocol, a function, an error." }) : null,
5015
+ state === "done" && flat.length === 0 ? /* @__PURE__ */ jsxs("p", { role: "status", className: "px-3 py-6 text-[0.9375rem] text-muted-foreground", children: [
5016
+ "No results for \u201C",
5017
+ query.trim(),
5018
+ "\u201D."
5019
+ ] }) : null,
5020
+ state === "error" ? /* @__PURE__ */ jsx("p", { role: "status", className: "px-3 py-6 text-[0.9375rem] text-muted-foreground", children: "Search is not available right now. Try again in a moment." }) : null
5021
+ ] }),
5022
+ /* @__PURE__ */ jsxs("div", { "aria-hidden": true, className: "hidden shrink-0 items-center gap-4 border-t border-border px-5 py-2.5 text-[0.75rem] text-muted-foreground sm:flex", children: [
5023
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
5024
+ /* @__PURE__ */ jsx(Kbd, { children: "\u2191" }),
5025
+ /* @__PURE__ */ jsx(Kbd, { children: "\u2193" }),
5026
+ " to move"
5027
+ ] }),
5028
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
5029
+ /* @__PURE__ */ jsx(Kbd, { children: "\u21B5" }),
5030
+ " to open"
5031
+ ] }),
5032
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
5033
+ /* @__PURE__ */ jsx(Kbd, { children: "esc" }),
5034
+ " to close"
5035
+ ] })
5036
+ ] }),
5037
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", children: state === "done" ? `${flat.length} result${flat.length === 1 ? "" : "s"}` : "" })
5038
+ ]
5039
+ }
5040
+ )
5041
+ ] }) })
5042
+ ] });
5043
+ }
5044
+ function pretty(content) {
5045
+ try {
5046
+ return JSON.stringify(JSON.parse(content), null, 2);
5047
+ } catch {
5048
+ return null;
5049
+ }
5050
+ }
5051
+ function download(content, filename, mime) {
5052
+ const url = URL.createObjectURL(new Blob([content], { type: mime }));
5053
+ const a = document.createElement("a");
5054
+ a.href = url;
5055
+ a.download = filename;
5056
+ document.body.appendChild(a);
5057
+ a.click();
5058
+ a.remove();
5059
+ setTimeout(() => URL.revokeObjectURL(url), 0);
5060
+ }
5061
+ var BAR_BUTTON = "inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-[0.75rem] text-oca-ink-subtle transition-colors hover:bg-white/10 hover:text-white";
5062
+ function ArtifactView({
5063
+ content,
5064
+ title,
5065
+ filename,
5066
+ mime,
5067
+ defaultView = "formatted",
5068
+ maxLines = 28,
5069
+ className
5070
+ }) {
5071
+ const formatted = useMemo(() => pretty(content), [content]);
5072
+ const [view, setView] = useState(formatted ? defaultView : "raw");
5073
+ const shown = view === "formatted" && formatted ? formatted : content;
5074
+ const json = formatted !== null;
5075
+ return /* @__PURE__ */ jsx(
5076
+ CodeBlock,
5077
+ {
5078
+ code: shown,
5079
+ lang: json ? "json" : void 0,
5080
+ caption: title,
5081
+ maxLines,
5082
+ className,
5083
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
5084
+ json ? /* @__PURE__ */ jsx("span", { role: "group", "aria-label": "View", className: "mr-1 flex items-center rounded-full bg-white/[0.06] p-0.5", children: ["formatted", "raw"].map((v) => /* @__PURE__ */ jsx(
5085
+ "button",
5086
+ {
5087
+ type: "button",
5088
+ "aria-pressed": view === v,
5089
+ onClick: () => setView(v),
5090
+ className: cn(
5091
+ "h-7 rounded-full px-2.5 text-[0.75rem] transition-colors",
5092
+ view === v ? "bg-white/[0.12] text-white" : "text-oca-ink-subtle hover:text-white"
5093
+ ),
5094
+ children: v === "formatted" ? "Formatted" : "Raw"
5095
+ },
5096
+ v
5097
+ )) }) : null,
5098
+ filename ? /* @__PURE__ */ jsxs(
5099
+ "button",
5100
+ {
5101
+ type: "button",
5102
+ onClick: () => download(content, filename, mime ?? (json ? "application/json" : "text/plain")),
5103
+ className: BAR_BUTTON,
5104
+ "aria-label": `Download ${filename}`,
5105
+ children: [
5106
+ /* @__PURE__ */ jsx(Download, { "aria-hidden": true, className: "size-3.5" }),
5107
+ /* @__PURE__ */ jsx("span", { className: "max-sm:hidden", children: "Download" })
5108
+ ]
5109
+ }
5110
+ ) : null
5111
+ ] })
5112
+ }
5113
+ );
5114
+ }
5115
+ function DropZone({
5116
+ onFile,
5117
+ onText,
5118
+ accept,
5119
+ title = "Drop a file here, or choose one",
5120
+ hint,
5121
+ privacy = "It stays in your browser. Only its hash leaves this page.",
5122
+ file,
5123
+ progress,
5124
+ progressLabel = "Hashing",
5125
+ onClear,
5126
+ error,
5127
+ disabled = false,
5128
+ className
5129
+ }) {
5130
+ const input = useRef(null);
5131
+ const [over, setOver] = useState(false);
5132
+ const depth = useRef(0);
5133
+ const [mode, setMode] = useState("file");
5134
+ const [text, setText] = useState("");
5135
+ const errorId = useId();
5136
+ const titleId = useId();
5137
+ const busy = progress !== null && progress !== void 0;
5138
+ const pct = busy ? Math.round(Math.max(0, Math.min(1, progress)) * 100) : 0;
5139
+ const take = (f) => {
5140
+ if (f && !disabled) onFile(f);
5141
+ };
5142
+ const privacyLine = privacy === null ? null : /* @__PURE__ */ jsxs("p", { className: "flex items-start gap-2 text-[0.8125rem] leading-snug text-muted-foreground", children: [
5143
+ /* @__PURE__ */ jsx(Lock, { "aria-hidden": true, className: "mt-0.5 size-3.5 shrink-0" }),
5144
+ /* @__PURE__ */ jsx("span", { children: privacy })
5145
+ ] });
5146
+ if (mode === "text" && onText) {
5147
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), children: [
5148
+ /* @__PURE__ */ jsx(
5149
+ Textarea,
5150
+ {
5151
+ value: text,
5152
+ onChange: (e) => setText(e.target.value),
5153
+ rows: 6,
5154
+ "aria-label": "Text",
5155
+ "aria-describedby": error ? errorId : void 0,
5156
+ "aria-invalid": error ? true : void 0,
5157
+ placeholder: "Paste the text here",
5158
+ className: "font-mono text-base md:text-[0.875rem]"
5159
+ }
5160
+ ),
5161
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
5162
+ /* @__PURE__ */ jsx(Button, { size: "sm", disabled: !text.trim() || disabled, onClick: () => onText(text), children: "Use this text" }),
5163
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: () => setMode("file"), children: "Choose a file instead" })
5164
+ ] }),
5165
+ error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-[0.8125rem] text-destructive", children: error }) : null,
5166
+ privacyLine
5167
+ ] });
5168
+ }
5169
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), children: [
5170
+ /* @__PURE__ */ jsxs(
5171
+ "div",
5172
+ {
5173
+ role: "group",
5174
+ "aria-labelledby": titleId,
5175
+ "aria-describedby": error ? errorId : void 0,
5176
+ "aria-busy": busy || void 0,
5177
+ onDragEnter: (e) => {
5178
+ e.preventDefault();
5179
+ depth.current++;
5180
+ if (!disabled) setOver(true);
5181
+ },
5182
+ onDragOver: (e) => e.preventDefault(),
5183
+ onDragLeave: () => {
5184
+ depth.current = Math.max(0, depth.current - 1);
5185
+ if (depth.current === 0) setOver(false);
5186
+ },
5187
+ onDrop: (e) => {
5188
+ e.preventDefault();
5189
+ depth.current = 0;
5190
+ setOver(false);
5191
+ take(e.dataTransfer.files?.[0]);
5192
+ },
5193
+ className: cn(
5194
+ "relative flex flex-col gap-3 rounded-[1.25rem] border border-dashed transition-colors",
5195
+ file ? "px-4 py-4 sm:px-5" : "items-center px-5 py-8 text-center md:py-10",
5196
+ over ? "border-foreground bg-accent" : "border-oca-hairline-strong bg-card",
5197
+ error && "border-destructive",
5198
+ disabled && "opacity-55"
5199
+ ),
5200
+ children: [
5201
+ /* @__PURE__ */ jsx(
5202
+ "input",
5203
+ {
5204
+ ref: input,
5205
+ type: "file",
5206
+ accept,
5207
+ disabled,
5208
+ tabIndex: -1,
5209
+ "aria-hidden": true,
5210
+ className: "sr-only",
5211
+ onChange: (e) => {
5212
+ take(e.target.files?.[0]);
5213
+ e.target.value = "";
5214
+ }
5215
+ }
5216
+ ),
5217
+ file ? /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-3", children: [
5218
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
5219
+ /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground", children: busy ? /* @__PURE__ */ jsx(FileText, { "aria-hidden": true, className: "size-5" }) : /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: "size-5" }) }),
5220
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
5221
+ /* @__PURE__ */ jsx("span", { id: titleId, className: "truncate text-[0.9375rem] font-medium", title: file.name, children: file.name }),
5222
+ /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] text-muted-foreground", children: [formatBytes(file.size), file.type].filter(Boolean).join(" \xB7 ") })
5223
+ ] }),
5224
+ !busy && onClear ? /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", onClick: onClear, disabled, className: "shrink-0", children: "Choose another" }) : null
5225
+ ] }),
5226
+ busy ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
5227
+ /* @__PURE__ */ jsx(
5228
+ "div",
5229
+ {
5230
+ role: "progressbar",
5231
+ "aria-valuemin": 0,
5232
+ "aria-valuemax": 100,
5233
+ "aria-valuenow": pct,
5234
+ "aria-label": typeof progressLabel === "string" ? progressLabel : "Progress",
5235
+ className: "h-1.5 overflow-hidden rounded-full bg-muted",
5236
+ children: /* @__PURE__ */ jsx("div", { className: "h-full rounded-full bg-foreground transition-[width] duration-200", style: { width: `${pct}%` } })
5237
+ }
5238
+ ),
5239
+ /* @__PURE__ */ jsxs("span", { className: "text-[0.8125rem] text-muted-foreground oca-tabular", children: [
5240
+ progressLabel,
5241
+ " ",
5242
+ pct,
5243
+ "%"
5244
+ ] })
5245
+ ] }) : null
5246
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5247
+ /* @__PURE__ */ jsx("span", { className: "flex size-11 items-center justify-center rounded-full bg-muted text-foreground", children: /* @__PURE__ */ jsx(Upload, { "aria-hidden": true, className: "size-5" }) }),
5248
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5249
+ /* @__PURE__ */ jsx("p", { id: titleId, className: "text-[1rem] font-medium", children: over ? "Drop it to add it" : title }),
5250
+ hint ? /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: hint }) : null
5251
+ ] }),
5252
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap items-center justify-center gap-2", children: [
5253
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "secondary", disabled, onClick: () => input.current?.click(), children: "Choose a file" }),
5254
+ onText ? /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", disabled, onClick: () => setMode("text"), children: "Paste text instead" }) : null
5255
+ ] })
5256
+ ] })
5257
+ ]
5258
+ }
5259
+ ),
5260
+ error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-[0.8125rem] text-destructive", children: error }) : null,
5261
+ privacyLine
5262
+ ] });
5263
+ }
5264
+ function FormSection({
5265
+ n,
5266
+ title,
5267
+ hint,
5268
+ status,
5269
+ action,
5270
+ as: Heading = "h2",
5271
+ id,
5272
+ children,
5273
+ className
5274
+ }) {
5275
+ const titleId = useId();
5276
+ const tight = useDensity() === "compact";
5277
+ return /* @__PURE__ */ jsxs(
5278
+ "section",
5279
+ {
5280
+ id,
5281
+ "aria-labelledby": titleId,
5282
+ "aria-current": status === "current" ? "step" : void 0,
5283
+ className: cn("scroll-mt-24 rounded-[1.25rem] border border-border bg-card", className),
5284
+ children: [
5285
+ /* @__PURE__ */ jsxs("header", { className: cn("flex items-start gap-3.5", tight ? "px-5 pt-5" : "px-6 pt-6"), children: [
5286
+ n !== void 0 ? /* @__PURE__ */ jsx(
5287
+ "span",
5288
+ {
5289
+ "aria-hidden": true,
5290
+ className: cn(
5291
+ "mt-px flex size-7 shrink-0 items-center justify-center rounded-full border text-[0.8125rem] oca-tabular",
5292
+ status === "done" && "border-primary bg-primary text-primary-foreground",
5293
+ status === "current" && "border-brand text-oca-accent-ink",
5294
+ status === "blocked" && "border-destructive text-destructive",
5295
+ (status === "upcoming" || status === void 0) && "border-oca-hairline-strong text-muted-foreground"
5296
+ ),
5297
+ children: status === "done" ? /* @__PURE__ */ jsx(Check, { className: "size-3.5", strokeWidth: 3 }) : n
5298
+ }
5299
+ ) : null,
5300
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
5301
+ /* @__PURE__ */ jsxs(Heading, { id: titleId, className: "text-[1.0625rem] font-medium leading-snug tracking-[-0.008em]", children: [
5302
+ n !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
5303
+ "Step ",
5304
+ n,
5305
+ ": "
5306
+ ] }) : null,
5307
+ title,
5308
+ status === "done" ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (done)" }) : null
5309
+ ] }),
5310
+ hint ? /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] leading-snug text-muted-foreground", children: hint }) : null
5311
+ ] }),
5312
+ action ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
5313
+ ] }),
5314
+ /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", tight ? "gap-4 p-5" : "gap-5 p-6", n !== void 0 && (tight ? "sm:pl-[3.875rem]" : "sm:pl-[4.125rem]")), children })
5315
+ ]
5316
+ }
5317
+ );
5318
+ }
5319
+ var STATE_TONE = { good: "success", attention: "brand", bad: "danger", neutral: "neutral", quiet: "muted" };
5320
+ function StateBadge({
5321
+ tone = "neutral",
5322
+ children,
5323
+ title,
5324
+ className
5325
+ }) {
5326
+ return /* @__PURE__ */ jsx(Badge, { tone: STATE_TONE[tone], title, className, children });
5327
+ }
5328
+ function createStateBadge(states) {
5329
+ function ProtocolStateBadge({ state, className }) {
5330
+ const def = states[state];
5331
+ if (!def) {
5332
+ if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
5333
+ console.warn(`StateBadge: no state "${state}"; known: ${Object.keys(states).join(", ")}`);
5334
+ }
5335
+ return /* @__PURE__ */ jsx(StateBadge, { className, children: String(state) });
5336
+ }
5337
+ return /* @__PURE__ */ jsx(StateBadge, { tone: def.tone, title: def.hint, className, children: def.label });
5338
+ }
5339
+ return ProtocolStateBadge;
5340
+ }
5341
+ function BlockHeight({
5342
+ height,
5343
+ label = false,
5344
+ link = true,
5345
+ network = "mainnet",
5346
+ className
5347
+ }) {
5348
+ const text = `${label ? "block " : ""}${formatBlockHeight(height)}`;
5349
+ if (!link) return /* @__PURE__ */ jsx("span", { className: cn("oca-tabular", className), children: text });
5350
+ return /* @__PURE__ */ jsxs(
5351
+ "a",
5352
+ {
5353
+ href: explorerUrl("block", Math.trunc(height), network),
5354
+ target: "_blank",
5355
+ rel: "noreferrer",
5356
+ title: `Block ${formatBlockHeight(height)} on mempool.space`,
5357
+ className: cn("oca-tabular underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground", className),
5358
+ children: [
5359
+ text,
5360
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens mempool.space in a new tab)" })
5361
+ ]
5362
+ }
5363
+ );
5364
+ }
5365
+ var ANCHOR = {
5366
+ anchored: { label: "Anchored", tone: "good" },
5367
+ pending: { label: "Anchor pending", tone: "attention" },
5368
+ unverified: { label: "Not checked", tone: "quiet" },
5369
+ none: { label: "Not anchored", tone: "quiet" },
5370
+ fail: { label: "Does not check out", tone: "bad" }
5371
+ };
5372
+ function hostOf(url) {
5373
+ try {
5374
+ return new URL(url).host;
5375
+ } catch {
5376
+ return url;
5377
+ }
5378
+ }
5379
+ function AnchorStatus({
5380
+ state,
5381
+ blockHeight,
5382
+ blockTime,
5383
+ submittedAt,
5384
+ calendar,
5385
+ message,
5386
+ network = "mainnet",
5387
+ variant = "detail",
5388
+ className
5389
+ }) {
5390
+ const def = ANCHOR[state];
5391
+ const block = blockHeight !== void 0 ? /* @__PURE__ */ jsx(BlockHeight, { height: blockHeight, label: true, network }) : null;
5392
+ const line = message ?? (state === "anchored" ? block ? /* @__PURE__ */ jsxs(Fragment, { children: [
5393
+ "In ",
5394
+ block,
5395
+ blockTime !== void 0 ? ` \xB7 ${formatUtc(blockTime)}` : null
5396
+ ] }) : "Its hash is in a Bitcoin block." : state === "pending" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5397
+ "Submitted",
5398
+ submittedAt !== void 0 ? ` ${formatUtc(submittedAt)}` : "",
5399
+ " to",
5400
+ " ",
5401
+ calendar ? hostOf(calendar) : "an OpenTimestamps calendar",
5402
+ ". Waiting for a Bitcoin block."
5403
+ ] }) : state === "unverified" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5404
+ "The proof names ",
5405
+ block ?? "a block",
5406
+ ", but its header could not be fetched to check it."
5407
+ ] }) : state === "fail" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5408
+ "The proof does not lead to ",
5409
+ block ?? "the block it names",
5410
+ "."
5411
+ ] }) : "No timestamp yet. The signature still checks offline.");
5412
+ if (variant === "badge") {
5413
+ const plain = typeof line === "string" ? line : void 0;
5414
+ return /* @__PURE__ */ jsx(StateBadge, { tone: def.tone, title: plain, className, children: def.label });
5415
+ }
5416
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col items-start gap-1.5", className), children: [
5417
+ /* @__PURE__ */ jsx(StateBadge, { tone: def.tone, children: def.label }),
5418
+ /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] leading-snug text-muted-foreground", children: line })
5419
+ ] });
5420
+ }
5421
+ function BlockCountdown({
5422
+ target,
5423
+ tip,
5424
+ from,
5425
+ reached = "Reached",
5426
+ minutesPerBlock = 10,
5427
+ network = "mainnet",
5428
+ className
5429
+ }) {
5430
+ const known = typeof tip === "number";
5431
+ const left = known ? target - tip : null;
5432
+ const done2 = left !== null && left <= 0;
5433
+ const share = known && from !== void 0 && target > from ? Math.min(1, Math.max(0, (tip - from) / (target - from))) : null;
5434
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
5435
+ /* @__PURE__ */ jsx("p", { className: "text-[0.9375rem] leading-snug", children: !known ? /* @__PURE__ */ jsxs(Fragment, { children: [
5436
+ "At ",
5437
+ /* @__PURE__ */ jsx(BlockHeight, { height: target, label: true, network })
5438
+ ] }) : done2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
5439
+ reached,
5440
+ " at ",
5441
+ /* @__PURE__ */ jsx(BlockHeight, { height: target, label: true, network })
5442
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5443
+ "In ",
5444
+ /* @__PURE__ */ jsx("span", { className: "oca-tabular font-medium", children: formatBlockHeight(left) }),
5445
+ " block",
5446
+ left === 1 ? "" : "s",
5447
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
5448
+ ", ",
5449
+ blocksToDuration(left, minutesPerBlock)
5450
+ ] })
5451
+ ] }) }),
5452
+ share !== null ? /* @__PURE__ */ jsx(
5453
+ "div",
5454
+ {
5455
+ role: "progressbar",
5456
+ "aria-valuemin": 0,
5457
+ "aria-valuemax": 100,
5458
+ "aria-valuenow": Math.round(share * 100),
5459
+ "aria-label": "Blocks passed",
5460
+ className: "h-1.5 overflow-hidden rounded-full bg-muted",
5461
+ children: /* @__PURE__ */ jsx("div", { className: "h-full rounded-full bg-foreground", style: { width: `${share * 100}%` } })
5462
+ }
5463
+ ) : null,
5464
+ known && !done2 ? /* @__PURE__ */ jsxs("p", { className: "text-[0.8125rem] text-muted-foreground", children: [
5465
+ "Target ",
5466
+ /* @__PURE__ */ jsx(BlockHeight, { height: target, network }),
5467
+ " \xB7 tip ",
5468
+ /* @__PURE__ */ jsx("span", { className: "oca-tabular", children: formatBlockHeight(tip) })
5469
+ ] }) : null
5470
+ ] });
5471
+ }
5472
+ function Meter({
5473
+ value,
5474
+ max,
5475
+ ghost,
5476
+ label,
5477
+ figure,
5478
+ tone = "ink",
5479
+ size = "md",
5480
+ className
5481
+ }) {
5482
+ const id = useId();
5483
+ const total = max > 0 ? max : 1;
5484
+ const v = Math.max(0, Math.min(1, value / total));
5485
+ const g = ghost ? Math.max(0, Math.min(1 - v, ghost / total)) : 0;
5486
+ const pct = `${Math.round(v * 100)}%`;
5487
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
5488
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-4 text-[0.875rem]", children: [
5489
+ /* @__PURE__ */ jsx("span", { id, className: "min-w-0 truncate", children: label }),
5490
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 oca-tabular text-muted-foreground", children: figure ?? pct })
5491
+ ] }),
5492
+ /* @__PURE__ */ jsxs(
5493
+ "div",
5494
+ {
5495
+ role: "meter",
5496
+ "aria-labelledby": id,
5497
+ "aria-valuemin": 0,
5498
+ "aria-valuemax": max,
5499
+ "aria-valuenow": value,
5500
+ "aria-valuetext": typeof figure === "string" ? figure : pct,
5501
+ className: cn("flex overflow-hidden rounded-full bg-muted", size === "sm" ? "h-1.5" : "h-2.5"),
5502
+ children: [
5503
+ /* @__PURE__ */ jsx(
5504
+ "div",
5505
+ {
5506
+ className: cn("h-full shrink-0 rounded-full", tone === "brand" ? "bg-oca-orange-deep" : "bg-foreground"),
5507
+ style: { width: `${v * 100}%` }
5508
+ }
5509
+ ),
5510
+ g > 0 ? /* @__PURE__ */ jsx(
5511
+ "div",
5512
+ {
5513
+ "aria-hidden": true,
5514
+ className: "-ml-1.5 h-full shrink-0 rounded-r-full pl-1.5 text-foreground/45",
5515
+ style: {
5516
+ width: `calc(${g * 100}% + 0.375rem)`,
5517
+ backgroundImage: "repeating-linear-gradient(-45deg, currentColor 0 2px, transparent 2px 6px)"
5518
+ }
5519
+ }
5520
+ ) : null
5521
+ ]
5522
+ }
5523
+ )
5524
+ ] });
5525
+ }
5526
+ function FilterChips({
5527
+ options,
5528
+ value,
5529
+ onChange,
5530
+ label,
5531
+ className
5532
+ }) {
5533
+ const tight = useDensity() === "compact";
5534
+ const multi = Array.isArray(value);
5535
+ const isOn = (v) => multi ? value.includes(v) : value === v;
5536
+ const press = (v) => {
5537
+ if (multi) {
5538
+ const cur = value;
5539
+ onChange(cur.includes(v) ? cur.filter((x) => x !== v) : [...cur, v]);
5540
+ } else onChange(v);
5541
+ };
5542
+ return /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--background)", className: cn("w-full", className), children: /* @__PURE__ */ jsx("div", { role: "group", "aria-label": label, className: "flex w-max items-center gap-2 py-0.5", children: options.map((o) => {
5543
+ const on = isOn(o.value);
5544
+ return /* @__PURE__ */ jsxs(
5545
+ "button",
5546
+ {
5547
+ type: "button",
5548
+ "aria-pressed": on,
5549
+ onClick: () => press(o.value),
5550
+ className: cn(
5551
+ "inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3.5 text-[0.875rem] transition-colors",
5552
+ tight ? "h-8" : "h-9",
5553
+ on ? "border-foreground bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:border-oca-hairline-strong hover:text-foreground"
5554
+ ),
5555
+ children: [
5556
+ o.label,
5557
+ o.count !== void 0 ? /* @__PURE__ */ jsx("span", { className: "oca-tabular", children: o.count.toLocaleString("en-US") }) : null
5558
+ ]
5559
+ },
5560
+ o.value
5561
+ );
5562
+ }) }) });
5563
+ }
5564
+ function ToolGrid({
5565
+ tools,
5566
+ as: Heading = "h2",
5567
+ className
5568
+ }) {
5569
+ const tight = useDensity() === "compact";
5570
+ const n = tools.length;
5571
+ return /* @__PURE__ */ jsx(
5572
+ "ul",
5573
+ {
5574
+ className: cn(
5575
+ "grid grid-cols-1 gap-3 sm:grid-cols-2 md:gap-4",
5576
+ // Three or four sit in one row on a wide screen.
5577
+ n === 3 || n === 6 ? "lg:grid-cols-3" : n === 4 ? "xl:grid-cols-4" : null,
5578
+ className
5579
+ ),
5580
+ children: tools.map((t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
5581
+ "div",
5582
+ {
5583
+ className: cn(
5584
+ "group relative flex h-full flex-col rounded-[1.25rem] border border-border bg-card transition-colors",
5585
+ tight ? "gap-3 p-5" : "gap-4 p-6",
5586
+ "hover:border-oca-hairline-strong has-[a:focus-visible]:ring-2 has-[a:focus-visible]:ring-ring has-[a:focus-visible]:ring-offset-2 has-[a:focus-visible]:ring-offset-background"
5587
+ ),
5588
+ children: [
5589
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
5590
+ t.icon ? /* @__PURE__ */ jsx("span", { className: "flex size-10 items-center justify-center rounded-xl bg-muted text-foreground [&_svg]:size-5", children: t.icon }) : /* @__PURE__ */ jsx("span", {}),
5591
+ /* @__PURE__ */ jsx(
5592
+ ArrowRight,
5593
+ {
5594
+ "aria-hidden": true,
5595
+ className: "size-4 text-muted-foreground transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-foreground"
5596
+ }
5597
+ )
5598
+ ] }),
5599
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
5600
+ /* @__PURE__ */ jsx(Heading, { className: "oca-title-sm", children: /* @__PURE__ */ jsx(
5601
+ Link8,
5602
+ {
5603
+ href: t.href,
5604
+ className: "outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-['']",
5605
+ children: t.label
5606
+ }
5607
+ ) }),
5608
+ t.description ? /* @__PURE__ */ jsx("p", { className: "text-[0.9375rem] leading-relaxed text-muted-foreground", children: t.description }) : null
5609
+ ] })
5610
+ ]
5611
+ }
5612
+ ) }, t.href))
5613
+ }
5614
+ );
5615
+ }
5616
+ function SiteRow({ site, here, onNavigate }) {
5617
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
5618
+ "a",
3550
5619
  {
3551
5620
  href: site.href,
3552
5621
  onClick: onNavigate,
@@ -3622,16 +5691,23 @@ function FamilyMenu({ current: current2, className }) {
3622
5691
  )
3623
5692
  ] });
3624
5693
  }
3625
- function NavLink({ item, className, onNavigate }) {
5694
+ function NavLink({
5695
+ item,
5696
+ className,
5697
+ onNavigate,
5698
+ line = false
5699
+ }) {
3626
5700
  const cls = cn(
3627
5701
  "rounded-full px-3 py-2 text-[0.9375rem] transition-colors",
3628
5702
  item.active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
5703
+ line && "relative after:absolute after:inset-x-3 after:-bottom-[0.625rem] after:h-0.5 after:rounded-full",
5704
+ line && item.active && "after:bg-foreground",
3629
5705
  className
3630
5706
  );
3631
5707
  if (item.external) {
3632
5708
  return /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: item.label });
3633
5709
  }
3634
- return /* @__PURE__ */ jsx(Link5, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: item.label });
5710
+ return /* @__PURE__ */ jsx(Link8, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: item.label });
3635
5711
  }
3636
5712
  function NavRow({ item, onNavigate }) {
3637
5713
  const body = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -3642,7 +5718,7 @@ function NavRow({ item, onNavigate }) {
3642
5718
  "flex flex-col gap-0.5 rounded-xl px-3 py-2 transition-colors hover:bg-accent",
3643
5719
  item.active && "bg-muted hover:bg-muted dark:bg-white/[0.06]"
3644
5720
  );
3645
- return item.external ? /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: body }) : /* @__PURE__ */ jsx(Link5, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: body });
5721
+ return item.external ? /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: body }) : /* @__PURE__ */ jsx(Link8, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: body });
3646
5722
  }
3647
5723
  var seeAll = (item) => typeof item.label === "string" ? `All ${item.label.toLowerCase()}` : "See all";
3648
5724
  function NavDropdown({ item }) {
@@ -3684,13 +5760,16 @@ function SiteHeader({
3684
5760
  search,
3685
5761
  actions,
3686
5762
  variant = "site",
5763
+ navOnPhone = true,
5764
+ menu: menuExtra,
3687
5765
  className
3688
5766
  }) {
3689
5767
  const [open, setOpen] = useState(false);
3690
5768
  const tool = variant === "tool";
3691
5769
  const size = tool ? 24 : 28;
3692
5770
  const current2 = typeof family === "string" ? family : void 0;
3693
- const menu = nav.length > 0 || Boolean(family);
5771
+ const phoneNav = navOnPhone ? nav : [];
5772
+ const menu = phoneNav.length > 0 || Boolean(family) || Boolean(menuExtra);
3694
5773
  const brandNode = brand ?? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
3695
5774
  /* @__PURE__ */ jsx(Lockup, { size }),
3696
5775
  product ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -3698,7 +5777,9 @@ function SiteHeader({
3698
5777
  /* @__PURE__ */ jsx("span", { className: "font-medium tracking-[-0.01em]", style: { fontSize: size * 0.56 }, children: product })
3699
5778
  ] }) : null
3700
5779
  ] });
3701
- const navigation = nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-1 md:flex", children: nav.map((n) => n.children?.length ? /* @__PURE__ */ jsx(NavDropdown, { item: n }, n.href) : /* @__PURE__ */ jsx(NavLink, { item: n }, n.href)) }) : null;
5780
+ const navigation = nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-1 md:flex", children: nav.map(
5781
+ (n) => n.children?.length ? /* @__PURE__ */ jsx(NavDropdown, { item: n }, n.href) : /* @__PURE__ */ jsx(NavLink, { item: n, line: tool }, n.href)
5782
+ ) }) : null;
3702
5783
  return /* @__PURE__ */ jsx(
3703
5784
  "header",
3704
5785
  {
@@ -3720,7 +5801,7 @@ function SiteHeader({
3720
5801
  ),
3721
5802
  children: [
3722
5803
  /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-center gap-1", tool ? "md:gap-1" : "justify-self-start"), children: [
3723
- /* @__PURE__ */ jsxs(Link5, { href: home, className: "-ml-1 min-w-0 rounded-lg p-1", children: [
5804
+ /* @__PURE__ */ jsxs(Link8, { href: home, className: "-ml-1 min-w-0 rounded-lg p-1", children: [
3724
5805
  brandNode,
3725
5806
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
3726
5807
  ] }),
@@ -3742,7 +5823,8 @@ function SiteHeader({
3742
5823
  ),
3743
5824
  /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "pt-16", children: [
3744
5825
  /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Menu" }),
3745
- nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: nav.map(
5826
+ menuExtra ? /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", (phoneNav.length > 0 || family) && "border-b border-border pb-3"), children: menuExtra }) : null,
5827
+ phoneNav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: phoneNav.map(
3746
5828
  (n) => n.children?.length ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col py-2", children: [
3747
5829
  /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: n.label }),
3748
5830
  n.children.map((c) => /* @__PURE__ */ jsx(
@@ -3764,7 +5846,7 @@ function SiteHeader({
3764
5846
  n.href
3765
5847
  )
3766
5848
  ) }) : null,
3767
- family ? /* @__PURE__ */ jsxs("details", { className: cn("group", nav.length > 0 && "mt-2 border-t border-border pt-4"), children: [
5849
+ family ? /* @__PURE__ */ jsxs("details", { className: cn("group", phoneNav.length > 0 && "mt-2 border-t border-border pt-4"), children: [
3768
5850
  /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer list-none items-center justify-between rounded-xl px-3 py-2.5 text-[1.0625rem] [&::-webkit-details-marker]:hidden", children: [
3769
5851
  "All orangecheck sites",
3770
5852
  /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
@@ -3931,12 +6013,12 @@ function SignInFrame({
3931
6013
  children: [
3932
6014
  /* @__PURE__ */ jsxs("section", { className: "flex flex-col px-4 pb-8 pt-5 sm:px-8 lg:px-14 lg:pt-8", children: [
3933
6015
  /* @__PURE__ */ jsxs("header", { className: "flex items-center justify-between gap-4", children: [
3934
- /* @__PURE__ */ jsxs(Link5, { href: home, className: "w-fit rounded-lg", children: [
6016
+ /* @__PURE__ */ jsxs(Link8, { href: home, className: "w-fit rounded-lg", children: [
3935
6017
  brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }),
3936
6018
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
3937
6019
  ] }),
3938
6020
  back === void 0 ? /* @__PURE__ */ jsx(
3939
- Link5,
6021
+ Link8,
3940
6022
  {
3941
6023
  href: home,
3942
6024
  className: "text-[0.9375rem] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline",
@@ -3969,11 +6051,156 @@ function SignInFrame({
3969
6051
  }
3970
6052
  );
3971
6053
  }
6054
+ var STATUS_WORDS = /* @__PURE__ */ new Set(["live", "testing", "not-yet", "paused", "good", "caution", "refused"]);
6055
+ var pathOf = (href) => href.split(/[?#]/)[0].replace(/(.)\/$/, "$1");
6056
+ function DocsNav({
6057
+ sections,
6058
+ current: current2,
6059
+ onNavigate,
6060
+ className
6061
+ }) {
6062
+ const here = pathOf(current2);
6063
+ const activeSection = useMemo(
6064
+ () => sections.findIndex((s) => s.items.some((i) => pathOf(i.href) === here)),
6065
+ [sections, here]
6066
+ );
6067
+ const [peeked, setPeeked] = useState(() => /* @__PURE__ */ new Set());
6068
+ useEffect(() => setPeeked(/* @__PURE__ */ new Set()), [activeSection]);
6069
+ const activeRef = useRef(null);
6070
+ useEffect(() => {
6071
+ const id = requestAnimationFrame(() => activeRef.current?.scrollIntoView({ block: "nearest" }));
6072
+ return () => cancelAnimationFrame(id);
6073
+ }, [here]);
6074
+ const base = useId();
6075
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Docs", className: cn("flex flex-col gap-0.5", className), children: sections.map((section, si) => {
6076
+ const isActive = si === activeSection;
6077
+ const open = isActive || peeked.has(si);
6078
+ const panel = `${base}-s${si}`;
6079
+ return /* @__PURE__ */ jsxs("div", { children: [
6080
+ /* @__PURE__ */ jsxs(
6081
+ "button",
6082
+ {
6083
+ type: "button",
6084
+ "aria-expanded": open,
6085
+ "aria-controls": panel,
6086
+ onClick: () => {
6087
+ if (isActive) return;
6088
+ setPeeked((p) => {
6089
+ const n = new Set(p);
6090
+ if (n.has(si)) n.delete(si);
6091
+ else n.add(si);
6092
+ return n;
6093
+ });
6094
+ },
6095
+ className: cn(
6096
+ "flex min-h-9 w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-[0.875rem] transition-colors",
6097
+ isActive ? "font-medium text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground",
6098
+ isActive && "cursor-default"
6099
+ ),
6100
+ children: [
6101
+ section.label,
6102
+ /* @__PURE__ */ jsx(
6103
+ ChevronRight,
6104
+ {
6105
+ "aria-hidden": true,
6106
+ className: cn("size-3.5 shrink-0 text-oca-subtle transition-transform duration-200", open && "rotate-90")
6107
+ }
6108
+ )
6109
+ ]
6110
+ }
6111
+ ),
6112
+ /* @__PURE__ */ jsx("ul", { id: panel, hidden: !open, className: "mb-2 ml-2.5 mt-0.5 border-l border-border", children: section.items.map((item) => {
6113
+ const on = pathOf(item.href) === here;
6114
+ const badge = typeof item.badge === "string" && STATUS_WORDS.has(item.badge) ? /* @__PURE__ */ jsx(StatusBadge, { status: item.badge }) : item.badge ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: item.badge }) : null;
6115
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
6116
+ Link8,
6117
+ {
6118
+ href: item.href,
6119
+ ref: on ? activeRef : void 0,
6120
+ onClick: onNavigate,
6121
+ "aria-current": on ? "page" : void 0,
6122
+ className: cn(
6123
+ "-ml-px flex min-h-9 items-center gap-2 border-l-2 py-1.5 pl-3.5 pr-2 text-[0.875rem] leading-snug transition-colors",
6124
+ on ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:border-oca-hairline-strong hover:text-foreground"
6125
+ ),
6126
+ children: [
6127
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: item.label }),
6128
+ badge
6129
+ ]
6130
+ }
6131
+ ) }, item.href);
6132
+ }) })
6133
+ ] }, section.label);
6134
+ }) });
6135
+ }
6136
+ var DOCS_HEADER_NAV = OCHK_IO_NAV.map((n) => n.href === DOCS_HREF ? { ...n, active: true } : n);
6137
+ function DocsShell({
6138
+ nav,
6139
+ current: current2,
6140
+ header,
6141
+ search,
6142
+ actions,
6143
+ breadcrumbs,
6144
+ toc,
6145
+ pager,
6146
+ footer,
6147
+ children
6148
+ }) {
6149
+ const [menu, setMenu] = useState(false);
6150
+ useEffect(() => setMenu(false), [current2]);
6151
+ const read = useHeadings("#docs-content", current2);
6152
+ const items = toc ?? read.items;
6153
+ const activeId = toc ? void 0 : read.activeId;
6154
+ const here = pathOf(current2);
6155
+ const place = useMemo(() => {
6156
+ for (const s of nav) {
6157
+ const it = s.items.find((i) => pathOf(i.href) === here);
6158
+ if (it) return { section: s.label, page: it.label };
6159
+ }
6160
+ return null;
6161
+ }, [nav, here]);
6162
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-dvh flex-col bg-background", children: [
6163
+ /* @__PURE__ */ jsx(SkipLink, {}),
6164
+ header ?? /* @__PURE__ */ jsx(SiteHeader, { home: OCHK_IO, family: "docs", nav: DOCS_HEADER_NAV, search, actions }),
6165
+ /* @__PURE__ */ jsx("div", { className: "sticky top-16 z-30 border-b border-border bg-background/95 backdrop-blur-md supports-[backdrop-filter]:bg-background/90 md:top-[4.5rem] lg:hidden", children: /* @__PURE__ */ jsx("div", { className: "oca-container flex h-12 items-center gap-2", children: /* @__PURE__ */ jsxs(Sheet, { open: menu, onOpenChange: setMenu, children: [
6166
+ /* @__PURE__ */ jsxs(SheetTrigger, { className: "-ml-2 inline-flex h-10 min-w-0 items-center gap-2 rounded-full px-2.5 text-[0.875rem] hover:bg-accent", children: [
6167
+ /* @__PURE__ */ jsx(PanelLeft, { "aria-hidden": true, className: "size-[1.125rem] shrink-0" }),
6168
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Docs menu. " }),
6169
+ place ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
6170
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: place.section }),
6171
+ /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5 shrink-0 text-oca-subtle" }),
6172
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: place.page })
6173
+ ] }) : /* @__PURE__ */ jsx("span", { className: "font-medium", children: "Docs" })
6174
+ ] }),
6175
+ /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-[min(88vw,22rem)] gap-0 p-0", children: [
6176
+ /* @__PURE__ */ jsx("div", { className: "border-b border-border px-5 py-4 pr-14", children: /* @__PURE__ */ jsx(SheetTitle, { className: "text-[1.0625rem] font-medium", children: "Docs" }) }),
6177
+ /* @__PURE__ */ jsx("div", { className: "overflow-y-auto p-3", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: current2, onNavigate: () => setMenu(false) }) })
6178
+ ] })
6179
+ ] }) }) }),
6180
+ /* @__PURE__ */ jsx("div", { className: "oca-container flex-1", children: /* @__PURE__ */ jsxs("div", { className: "lg:grid lg:grid-cols-[13.5rem_minmax(0,1fr)] lg:gap-x-10 xl:grid-cols-[13.5rem_minmax(0,1fr)_11rem]", children: [
6181
+ /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto overscroll-contain py-8 pr-1 lg:block", children: /* @__PURE__ */ jsx(DocsNav, { sections: nav, current: current2 }) }),
6182
+ /* @__PURE__ */ jsxs("main", { id: "main-content", className: "min-w-0 pb-16 pt-6 md:pt-8", children: [
6183
+ breadcrumbs ? /* @__PURE__ */ jsx("div", { className: "mb-6 max-lg:hidden", children: breadcrumbs }) : null,
6184
+ items.length > 1 ? /* @__PURE__ */ jsxs("details", { className: "group mb-8 rounded-2xl border border-border bg-card xl:hidden", children: [
6185
+ /* @__PURE__ */ jsxs("summary", { className: "flex min-h-12 cursor-pointer list-none items-center justify-between px-4 text-[0.9375rem] font-medium [&::-webkit-details-marker]:hidden", children: [
6186
+ "On this page",
6187
+ /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-4 text-muted-foreground transition-transform group-open:rotate-180" })
6188
+ ] }),
6189
+ /* @__PURE__ */ jsx(OnThisPage, { items, activeId, title: null, className: "px-4 pb-4" })
6190
+ ] }) : null,
6191
+ /* @__PURE__ */ jsx("article", { id: "docs-content", className: "max-w-[46rem]", children }),
6192
+ pager ? /* @__PURE__ */ jsx("div", { className: "mt-16 max-w-[46rem]", children: pager }) : null
6193
+ ] }),
6194
+ /* @__PURE__ */ jsx("div", { className: "sticky top-[4.5rem] hidden max-h-[calc(100dvh-4.5rem)] self-start overflow-y-auto py-10 xl:block", children: items.length > 1 ? /* @__PURE__ */ jsx(OnThisPage, { items, activeId }) : null })
6195
+ ] }) }),
6196
+ footer ?? /* @__PURE__ */ jsx(SiteFooter, { columns: OCHK_IO_FOOTER, family: true, legal: true, signature: false })
6197
+ ] });
6198
+ }
3972
6199
  function SideNav({ groups, onNavigate }) {
3973
6200
  return /* @__PURE__ */ jsx("nav", { "aria-label": "Pages", className: "flex flex-col gap-5", children: groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
3974
6201
  g.label ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-[0.8125rem] text-muted-foreground", children: g.label }) : null,
3975
6202
  g.items.map((it) => /* @__PURE__ */ jsxs(
3976
- Link5,
6203
+ Link8,
3977
6204
  {
3978
6205
  href: it.href,
3979
6206
  onClick: onNavigate,
@@ -4008,7 +6235,7 @@ function SectionSwitch({
4008
6235
  children: sections.map((sec) => {
4009
6236
  const on = sec.id === current2.id;
4010
6237
  return /* @__PURE__ */ jsx(
4011
- Link5,
6238
+ Link8,
4012
6239
  {
4013
6240
  href: sec.href,
4014
6241
  onClick: onNavigate,
@@ -4038,7 +6265,7 @@ function TabBar({ items }) {
4038
6265
  className: "mx-auto grid h-14 max-w-[32rem] px-1.5",
4039
6266
  style: { gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` },
4040
6267
  children: items.map((it) => /* @__PURE__ */ jsxs(
4041
- Link5,
6268
+ Link8,
4042
6269
  {
4043
6270
  href: it.href,
4044
6271
  "aria-current": it.active ? "page" : void 0,
@@ -4147,7 +6374,7 @@ function AppShell({
4147
6374
  footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer }) : null
4148
6375
  ] })
4149
6376
  ] }),
4150
- /* @__PURE__ */ jsx(Link5, { href: home, "aria-label": "Home", className: "rounded-lg p-1", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
6377
+ /* @__PURE__ */ jsx(Link8, { href: home, "aria-label": "Home", className: "rounded-lg p-1", children: /* @__PURE__ */ jsx(Lockup, { size: 22 }) }),
4151
6378
  /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: account })
4152
6379
  ] }),
4153
6380
  place.page ? /* @__PURE__ */ jsxs(
@@ -4170,7 +6397,7 @@ function AppShell({
4170
6397
  ] }),
4171
6398
  /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-[90rem]", children: [
4172
6399
  /* @__PURE__ */ jsxs("aside", { className: "sticky top-0 hidden h-dvh w-[17rem] shrink-0 flex-col gap-6 overflow-y-auto px-4 py-6 lg:flex", children: [
4173
- /* @__PURE__ */ jsx(Link5, { href: home, className: "px-2", "aria-label": "Home", children: /* @__PURE__ */ jsx(Lockup, { size: 26 }) }),
6400
+ /* @__PURE__ */ jsx(Link8, { href: home, className: "px-2", "aria-label": "Home", children: /* @__PURE__ */ jsx(Lockup, { size: 26 }) }),
4174
6401
  switcher,
4175
6402
  /* @__PURE__ */ jsx(SideNav, { groups }),
4176
6403
  /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-3", children: footer })
@@ -4201,9 +6428,16 @@ function AccountMenu({
4201
6428
  "inline-flex h-10 items-center gap-2.5 rounded-full border border-border bg-card pl-1 pr-1 text-[0.9375rem] outline-none transition-colors hover:border-oca-hairline-strong focus-visible:ring-2 focus-visible:ring-ring",
4202
6429
  nameFrom === "lg" ? "lg:pr-3.5" : "sm:pr-3.5"
4203
6430
  ),
4204
- "aria-label": `Account: ${name}`,
6431
+ "aria-label": `${name}, account menu`,
4205
6432
  children: [
4206
- /* @__PURE__ */ jsx("span", { className: "flex size-8 items-center justify-center rounded-full bg-foreground text-[0.8125rem] font-medium text-background", children: initial }),
6433
+ /* @__PURE__ */ jsx(
6434
+ "span",
6435
+ {
6436
+ "aria-hidden": true,
6437
+ "data-initial": initial,
6438
+ className: "flex size-8 items-center justify-center rounded-full bg-foreground text-[0.8125rem] font-medium text-background before:content-[attr(data-initial)]"
6439
+ }
6440
+ ),
4207
6441
  /* @__PURE__ */ jsx("span", { className: cn("max-w-[10rem] truncate", nameFrom === "lg" ? "max-lg:hidden" : "max-sm:hidden"), children: name })
4208
6442
  ]
4209
6443
  }
@@ -4215,7 +6449,7 @@ function AccountMenu({
4215
6449
  ] }),
4216
6450
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
4217
6451
  items.map(
4218
- (it, i) => it === "separator" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `sep-${i}`) : it.href ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, destructive: it.destructive, children: /* @__PURE__ */ jsxs(Link5, { href: it.href, children: [
6452
+ (it, i) => it === "separator" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, `sep-${i}`) : it.href ? /* @__PURE__ */ jsx(DropdownMenuItem, { asChild: true, destructive: it.destructive, children: /* @__PURE__ */ jsxs(Link8, { href: it.href, children: [
4219
6453
  it.icon,
4220
6454
  it.label
4221
6455
  ] }) }, it.label) : /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: it.onSelect, destructive: it.destructive, children: [
@@ -4248,7 +6482,260 @@ function ThemeToggle({ className }) {
4248
6482
  }
4249
6483
  );
4250
6484
  }
6485
+ var OCHK_APP_ACCOUNT = "https://ochk.app/me/account";
6486
+ function SessionAccountView({
6487
+ state,
6488
+ name,
6489
+ detail,
6490
+ items = [],
6491
+ signInHref,
6492
+ signInLabel = "Sign in",
6493
+ accountHref = OCHK_APP_ACCOUNT,
6494
+ onSignOut,
6495
+ nameFrom = "lg"
6496
+ }) {
6497
+ if (state === "in") {
6498
+ return /* @__PURE__ */ jsx(
6499
+ AccountMenu,
6500
+ {
6501
+ name: name || "Your account",
6502
+ detail,
6503
+ nameFrom,
6504
+ items: [
6505
+ ...items,
6506
+ ...items.length > 0 ? ["separator"] : [],
6507
+ { label: "Your account", href: accountHref, icon: /* @__PURE__ */ jsx(CircleUser, {}) },
6508
+ "separator",
6509
+ { label: "Sign out", onSelect: onSignOut, icon: /* @__PURE__ */ jsx(LogOut, {}) }
6510
+ ]
6511
+ }
6512
+ );
6513
+ }
6514
+ if (state === "unknown") {
6515
+ return /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", variant: "secondary", children: /* @__PURE__ */ jsx("a", { href: accountHref, children: "Your account" }) });
6516
+ }
6517
+ return (
6518
+ // No box of its own: it sits exactly where the signed-in chip will. While checking it is only unseen.
6519
+ /* @__PURE__ */ jsx("span", { className: state === "checking" ? "contents invisible" : "contents", "aria-hidden": state === "checking" || void 0, children: /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", variant: "secondary", tabIndex: state === "checking" ? -1 : void 0, children: /* @__PURE__ */ jsx("a", { href: signInHref, children: signInLabel }) }) })
6520
+ );
6521
+ }
6522
+ function ToolShell({
6523
+ protocol: protocol2,
6524
+ tools,
6525
+ home = "/",
6526
+ account,
6527
+ rail = false,
6528
+ railFooter,
6529
+ variant = "tool",
6530
+ banner,
6531
+ footer,
6532
+ children
6533
+ }) {
6534
+ const p = protocolSite(protocol2);
6535
+ const app = variant === "app";
6536
+ const tabs = app ? null : tabsFor([{ items: [...tools] }]);
6537
+ const about = /* @__PURE__ */ jsxs(
6538
+ "a",
6539
+ {
6540
+ href: p.pageHref,
6541
+ className: "inline-flex items-center gap-1 rounded-full px-3 py-2 text-[0.9375rem] text-muted-foreground transition-colors hover:text-foreground",
6542
+ children: [
6543
+ "About ",
6544
+ p.label,
6545
+ /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true, className: "size-3.5" })
6546
+ ]
6547
+ }
6548
+ );
6549
+ return /* @__PURE__ */ jsx(DensityProvider, { density: "compact", children: /* @__PURE__ */ jsxs(
6550
+ "div",
6551
+ {
6552
+ className: cn(
6553
+ "flex flex-col bg-background",
6554
+ app ? "h-dvh overflow-hidden" : "min-h-dvh",
6555
+ tabs && "max-md:pb-[calc(3.5rem_+_env(safe-area-inset-bottom))]"
6556
+ ),
6557
+ children: [
6558
+ /* @__PURE__ */ jsx(SkipLink, {}),
6559
+ banner,
6560
+ /* @__PURE__ */ jsx(
6561
+ SiteHeader,
6562
+ {
6563
+ variant: "tool",
6564
+ home,
6565
+ product: p.label,
6566
+ family: protocol2,
6567
+ nav: tools.map((t) => ({ href: t.href, label: t.label, active: t.active })),
6568
+ navOnPhone: !tabs,
6569
+ menu: /* @__PURE__ */ jsx("div", { className: "[&>a]:px-3 [&>a]:py-3 [&>a]:text-[1.0625rem]", children: about }),
6570
+ className: cn(rail && "lg:[&_nav[aria-label=Main]]:hidden"),
6571
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6572
+ /* @__PURE__ */ jsx("span", { className: "hidden lg:contents", children: about }),
6573
+ p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status, className: "max-sm:hidden" }) : null,
6574
+ /* @__PURE__ */ jsx(ThemeToggle, { className: "max-sm:hidden" }),
6575
+ account
6576
+ ] })
6577
+ }
6578
+ ),
6579
+ /* @__PURE__ */ jsxs("div", { className: cn("mx-auto flex w-full", app ? "min-h-0 flex-1" : "max-w-[90rem] flex-1"), children: [
6580
+ rail ? /* @__PURE__ */ jsxs("aside", { className: "sticky top-14 hidden h-[calc(100dvh-3.5rem)] w-60 shrink-0 flex-col gap-6 overflow-y-auto px-4 py-6 lg:flex", children: [
6581
+ /* @__PURE__ */ jsx(SideNav, { groups: [{ label: "Tools", items: tools.map(({ href, label, icon, active }) => ({ href, label, icon, active })) }] }),
6582
+ railFooter ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col gap-0.5 px-3 text-[0.875rem] text-muted-foreground [&_a:hover]:text-foreground [&_a]:py-1.5 [&_a]:transition-colors", children: railFooter }) : null
6583
+ ] }) : null,
6584
+ /* @__PURE__ */ jsx(
6585
+ "main",
6586
+ {
6587
+ id: "main-content",
6588
+ className: cn("min-w-0 flex-1", app ? "flex min-h-0 flex-col" : "px-4 pb-16 pt-8 md:px-8 md:pt-10"),
6589
+ children: app ? children : /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[72rem]", children })
6590
+ }
6591
+ )
6592
+ ] }),
6593
+ app || footer === false ? null : footer ?? /* @__PURE__ */ jsx(SiteFooter, { compact: true, family: true, legal: true }),
6594
+ tabs ? /* @__PURE__ */ jsx(TabBar, { items: tabs }) : null
6595
+ ]
6596
+ }
6597
+ ) });
6598
+ }
6599
+
6600
+ // src/code/rehype.ts
6601
+ function textOf(node) {
6602
+ if (node.type === "text") return node.value ?? "";
6603
+ return (node.children ?? []).map(textOf).join("");
6604
+ }
6605
+ function langOf(code) {
6606
+ const cls = code.properties?.className;
6607
+ const list = Array.isArray(cls) ? cls : typeof cls === "string" ? cls.split(" ") : [];
6608
+ for (const c of list) {
6609
+ const m = String(c).match(/^language-(.+)$/);
6610
+ if (m) return m[1];
6611
+ }
6612
+ return void 0;
6613
+ }
6614
+ function rehypeCode(options = {}) {
6615
+ const skip = new Set(options.skip ?? ["mermaid"]);
6616
+ const visit = (node) => {
6617
+ for (const child of node.children ?? []) {
6618
+ const code = child.type === "element" && child.tagName === "pre" ? child.children?.[0] : void 0;
6619
+ if (code && code.type === "element" && code.tagName === "code" && child.children?.length === 1) {
6620
+ const lang = langOf(code);
6621
+ if (lang && skip.has(lang)) continue;
6622
+ const meta = parseCodeMeta(code.data?.meta);
6623
+ let source = textOf(code);
6624
+ const diff = meta.diff || lang === "diff" ? readDiff(source) : null;
6625
+ if (diff) source = diff.code;
6626
+ const lines = options.tokenize?.(source, lang) ?? highlight(source, lang === "diff" ? void 0 : lang);
6627
+ child.properties = {
6628
+ ...child.properties,
6629
+ dataOcaCode: "",
6630
+ dataHtml: linesToHtml(lines, { highlight: parseLineRanges(meta.highlight), diff: diff?.diff }),
6631
+ ...lang ? { dataLang: lang } : {},
6632
+ ...meta.title ? { dataTitle: meta.title } : {},
6633
+ ...diff ? { dataDiff: "" } : {},
6634
+ ...meta.lineNumbers ? { dataLineNumbers: "" } : {}
6635
+ };
6636
+ child.children = [];
6637
+ continue;
6638
+ }
6639
+ visit(child);
6640
+ }
6641
+ };
6642
+ return (tree) => visit(tree);
6643
+ }
6644
+ function createMdxComponents({ mermaid } = {}) {
6645
+ function Pre(props) {
6646
+ if (props["data-oca-code"] !== void 0) {
6647
+ return /* @__PURE__ */ jsx(
6648
+ CodeBlock,
6649
+ {
6650
+ html: props["data-html"] ?? "",
6651
+ lang: props["data-lang"],
6652
+ caption: props["data-title"],
6653
+ diff: props["data-diff"] !== void 0,
6654
+ lineNumbers: props["data-line-numbers"] !== void 0,
6655
+ className: "my-6"
6656
+ }
6657
+ );
6658
+ }
6659
+ const lang = codeLang(props.children);
6660
+ const code = codeText(props.children);
6661
+ if (lang === "mermaid" && mermaid) return /* @__PURE__ */ jsx(Diagram, { chart: code, load: mermaid });
6662
+ return /* @__PURE__ */ jsx(
6663
+ CodeBlock,
6664
+ {
6665
+ code,
6666
+ lang: lang === "mermaid" ? void 0 : lang,
6667
+ caption: lang === "mermaid" ? "Diagram source" : void 0,
6668
+ className: "my-6"
6669
+ }
6670
+ );
6671
+ }
6672
+ function A({ href, children, ...rest }) {
6673
+ if (!href || href.startsWith("#")) {
6674
+ return /* @__PURE__ */ jsx("a", { href, ...rest, className: "text-foreground underline decoration-foreground/35 underline-offset-4 hover:decoration-foreground", children });
6675
+ }
6676
+ return /* @__PURE__ */ jsx(TextLink, { href, children });
6677
+ }
6678
+ const heading = (as) => function Heading(props) {
6679
+ return /* @__PURE__ */ jsx(DocsHeading, { as, ...props });
6680
+ };
6681
+ return {
6682
+ h1: heading("h1"),
6683
+ h2: heading("h2"),
6684
+ h3: heading("h3"),
6685
+ h4: heading("h4"),
6686
+ p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cn("my-4 text-[1rem] leading-[1.75] text-muted-foreground md:text-[1.0625rem]", className), ...props }),
6687
+ a: A,
6688
+ strong: (props) => /* @__PURE__ */ jsx("strong", { className: "font-medium text-foreground", ...props }),
6689
+ ul: ({ className, ...props }) => /* @__PURE__ */ jsx(
6690
+ "ul",
6691
+ {
6692
+ className: cn(
6693
+ "my-4 list-disc space-y-1.5 pl-5 text-[1rem] leading-[1.7] text-muted-foreground marker:text-oca-subtle md:text-[1.0625rem]",
6694
+ className
6695
+ ),
6696
+ ...props
6697
+ }
6698
+ ),
6699
+ ol: ({ className, ...props }) => /* @__PURE__ */ jsx(
6700
+ "ol",
6701
+ {
6702
+ className: cn(
6703
+ "my-4 list-decimal space-y-1.5 pl-5 text-[1rem] leading-[1.7] text-muted-foreground marker:text-oca-subtle md:text-[1.0625rem]",
6704
+ className
6705
+ ),
6706
+ ...props
6707
+ }
6708
+ ),
6709
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", { className: cn("pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5", className), ...props }),
6710
+ blockquote: ({ children }) => /* @__PURE__ */ jsx(Callout, { children }),
6711
+ hr: () => /* @__PURE__ */ jsx("hr", { className: "my-10 border-border" }),
6712
+ table: MdxTable,
6713
+ code: ({ className, ...props }) => /* @__PURE__ */ jsx(
6714
+ "code",
6715
+ {
6716
+ className: cn("break-words rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.875em] text-foreground", className),
6717
+ ...props
6718
+ }
6719
+ ),
6720
+ pre: Pre,
6721
+ img: ({ className, alt = "", ...props }) => /* @__PURE__ */ jsx("img", { alt, loading: "lazy", className: cn("my-6 h-auto max-w-full rounded-2xl border border-border", className), ...props }),
6722
+ Callout,
6723
+ Steps,
6724
+ Step,
6725
+ LinkCard,
6726
+ CardGrid,
6727
+ ApiTable,
6728
+ CodeBlock,
6729
+ CodeTabs,
6730
+ InstallTabs,
6731
+ SpecCard,
6732
+ ProtocolGrid,
6733
+ StatusBadge,
6734
+ ...mermaid ? { Diagram: (p) => /* @__PURE__ */ jsx(Diagram, { ...p, load: mermaid }) } : {}
6735
+ };
6736
+ }
6737
+ var mdxComponents = createMdxComponents();
4251
6738
 
4252
- export { APP_ATTRIBUTE, APP_ID, Accent, Accordion, AccordionItem, AccountMenu, ActivityList, AppCard, AppGrid, AppIcon, AppShell, Badge, BrowserFrame, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, CardTitle, Checkbox, Closing, CodeBlock, ComparisonTable, Container, CopyButton, Crowd, DOCS_HREF, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FAMILY, FAMILY_GROUPS, FactBlock, FactRows, FamilyMenu, Faq, Field, FloatChip, Footnote, HalftoneCanvas, HalftoneSphere, HashChip, Input, IsoCheck, Kbd, KeyValueList, LEGAL_LINKS, Label, Lead, LegalDocument, LoadingBlock, Lockup, MARK_FACES, Mark, Monogram, Notice, OCHK_IO, OCHK_IO_FOOTER, OCHK_IO_NAV, PROTOCOLS, PROTOCOL_ORDER, PackageCard, PageHeader, PageHero, Pagination, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, QrCode, RadioGroup, RadioGroupItem, Reveal, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, Section, SectionHeading, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SignInFrame, SignMessage, SiteBanner, SiteFooter, SiteHeader, Skeleton, SkipLink, SpecCard, Spinner, SplitBar, StatCard, StatGrid, StatusBadge, StatusDot, StatusPill, StepGrid, Switch, Tabs, TabsContent, TabsList, TabsTrigger, TextLink, Textarea, ThemeToggle, Ticker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, VerifyBox, VerifyReport, appColors, appFonts, badgeVariants, buttonVariants, cardVariants, cn, confirm, familyByGroup, familySite, monogramGround, monogramLetter, portraitTone, prompt, protocolSite, satsText, sectionVariants, statusWord, useCopy, useInView, useShellPlace, useTimedOut };
6739
+ export { APP_ATTRIBUTE, APP_ID, Accent, Accordion, AccordionItem, AccountMenu, ActivityList, AnchorStatus, ApiTable, AppCard, AppGrid, AppIcon, AppShell, ArtifactView, Badge, BlockCountdown, BlockHeight, Breadcrumbs, BrowserFrame, Button, CODE_LANGS, Callout, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardNumeral, CardTitle, Checkbox, Closing, CodeBlock, CodeTabs, ComparisonTable, Container, CopyButton, Crowd, DOCS_HEADER_NAV, DOCS_HREF, DataTable, DensityProvider, Diagram, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogHost, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DocsHeading, DocsNav, DocsPager, DocsShell, DropZone, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FAMILY, FAMILY_GROUPS, FactBlock, FactRows, FamilyMenu, Faq, Field, FilterChips, FloatChip, Footnote, FormSection, HalftoneCanvas, HalftoneSphere, HashChip, Input, InstallTabs, IsoCheck, Kbd, KeyValueList, LEGAL_LINKS, Label, Lead, LegalDocument, LinkCard, LoadingBlock, Lockup, MARK_FACES, Mark, MdxTable, Meter, Monogram, Notice, OCHK_APP_ACCOUNT, OCHK_IO, OCHK_IO_FOOTER, OCHK_IO_NAV, OnThisPage, PROTOCOLS, PROTOCOL_ORDER, PackageCard, PageHeader, PageHero, Pagination, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, QrCode, RadioGroup, RadioGroupItem, Reveal, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, SearchButton, SearchDialog, Section, SectionHeading, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, SessionAccountView, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SignInFrame, SignMessage, SiteBanner, SiteFooter, SiteHeader, Skeleton, SkipLink, SpecCard, Spinner, SplitBar, StatCard, StatGrid, StateBadge, StatusBadge, StatusDot, StatusPill, Step, StepGrid, Steps, Switch, TOKEN_CLASS, Tabs, TabsContent, TabsList, TabsTrigger, TextLink, Textarea, ThemeToggle, Ticker, Toaster, ToolGrid, ToolShell, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, VerifyBox, VerifyReport, appColors, appFonts, badgeVariants, blocksToDuration, buttonVariants, cardVariants, cn, confirm, createMdxComponents, createStateBadge, escapeHtml, explorerUrl, familyByGroup, familySite, formatBlockHeight, formatBytes, formatUtc, grammarOf, highlight, highlightToHtml, languageName, linesToHtml, mdxComponents, monogramGround, monogramLetter, parseCodeMeta, parseLineRanges, portraitTone, prompt, protocolSite, readDiff, rehypeCode, satsText, sectionVariants, shortenMiddle, statusWord, useActiveHeading, useCopy, useDensity, useHeadings, useInView, useShellPlace, useTimedOut };
4253
6740
  //# sourceMappingURL=index.mjs.map
4254
6741
  //# sourceMappingURL=index.mjs.map