@clarify-labs/renderer 0.10.1 → 0.10.2

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.
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
2
  const require_i18n = require("./i18n-b4iTLeia.cjs");
3
3
  const require_PageActions = require("./PageActions-BjB6PYmL.cjs");
4
- const require_remark = require("./remark-zSQT0MBv.cjs");
4
+ const require_remark = require("./remark-DTLbG8PK.cjs");
5
5
  let clsx = require("clsx");
6
6
  clsx = require_rolldown_runtime.__toESM(clsx, 1);
7
7
  let react = require("react");
@@ -13,7 +13,10 @@ let framer_motion = require("framer-motion");
13
13
  let zustand = require("zustand");
14
14
  let react_markdown = require("react-markdown");
15
15
  react_markdown = require_rolldown_runtime.__toESM(react_markdown, 1);
16
+ let rehype_raw = require("rehype-raw");
17
+ rehype_raw = require_rolldown_runtime.__toESM(rehype_raw, 1);
16
18
  let github_slugger = require("github-slugger");
19
+ let shiki = require("shiki");
17
20
  let _scalar_snippetz = require("@scalar/snippetz");
18
21
  //#region source/components/LocalizedLink.tsx
19
22
  function useLocalizedHref(href) {
@@ -326,6 +329,14 @@ function getNodeText(node) {
326
329
  if ((0, react.isValidElement)(node)) return getNodeText(node.props.children);
327
330
  return "";
328
331
  }
332
+ function getCodeLanguage(node) {
333
+ if (!(0, react.isValidElement)(node)) return void 0;
334
+ const { className, language, children } = node.props;
335
+ if (language) return language;
336
+ const languageClass = className?.split(/\s+/).find((value) => value.startsWith("language-"));
337
+ if (languageClass) return languageClass.slice(9);
338
+ return react.Children.toArray(children).map(getCodeLanguage).find(Boolean);
339
+ }
329
340
  function CopyButton(arg0) {
330
341
  const { code } = arg0;
331
342
  const t = require_i18n.useBuiltInText();
@@ -395,6 +406,7 @@ function CodeGroupHeader(arg0) {
395
406
  const { title, children, selectedIndex } = arg0;
396
407
  const t = require_i18n.useBuiltInText();
397
408
  const hasTabs = react.Children.count(children) > 1;
409
+ const indicatorLayoutId = (0, react.useId)();
398
410
  if (!title && !hasTabs) return null;
399
411
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
400
412
  className: "clarify-code-group-header flex min-h-(--clarify-code-header-min-height) flex-wrap items-start gap-x-4 border-b border-(--clarify-code-border) bg-(--clarify-code-header-background) px-4",
@@ -402,13 +414,22 @@ function CodeGroupHeader(arg0) {
402
414
  className: "mr-auto pt-3 text-xs font-semibold text-(--clarify-code-text)",
403
415
  children: title
404
416
  }) : null, hasTabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
405
- className: "clarify-code-tabs -mb-px flex gap-4 text-xs font-medium",
406
- children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
407
- className: (0, clsx.default)("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-(--clarify-theme-tokens-colors-primary) text-(--clarify-theme-tokens-colors-primary)" : "border-transparent text-(--clarify-code-muted) hover:text-(--clarify-code-text)"),
408
- children: getPanelTitle({
417
+ className: "clarify-code-tabs -mr-2 -mb-px flex gap-0 text-xs font-medium",
418
+ children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Tab, {
419
+ className: (0, clsx.default)("clarify-code-tab relative border-b border-transparent px-2 py-3 transition-colors hover:bg-(--clarify-code-control-background-hover) data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "text-(--clarify-code-accent-text)" : "text-(--clarify-code-control-text) hover:text-(--clarify-code-text)"),
420
+ children: [getPanelTitle({
409
421
  ...(0, react.isValidElement)(child) ? child.props : {},
410
422
  fallbackTitle: t("actions.code")
411
- })
423
+ }), childIndex === selectedIndex ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
424
+ layoutId: indicatorLayoutId,
425
+ className: "absolute inset-x-2 bottom-0 h-0.5 rounded-full bg-(--clarify-code-accent-text)",
426
+ transition: {
427
+ type: "spring",
428
+ stiffness: 460,
429
+ damping: 34,
430
+ mass: .7
431
+ }
432
+ }) : null]
412
433
  }))
413
434
  }) : null]
414
435
  });
@@ -520,7 +541,9 @@ function Code(arg0) {
520
541
  function Pre(arg0) {
521
542
  const { children, language, code, ...props } = arg0;
522
543
  const isGrouped = (0, react.useContext)(CodeGroupContext);
523
- if (language === "mermaid") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mermaid, { chart: code ?? getNodeText(children) });
544
+ const resolvedLanguage = language ?? getCodeLanguage(children);
545
+ const resolvedCode = code ?? getNodeText(children);
546
+ if (resolvedLanguage === "mermaid") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mermaid, { chart: resolvedCode });
524
547
  if (isGrouped) return children;
525
548
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroup, {
526
549
  ...props,
@@ -859,16 +882,17 @@ function Tabs(arg0) {
859
882
  onChange: handleChange,
860
883
  className,
861
884
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
862
- className: (0, clsx.default)("flex flex-wrap items-center gap-6 border-b border-(--clarify-theme-tokens-colors-border) pb-0", listClassName),
885
+ className: (0, clsx.default)("-mx-2 flex flex-wrap items-center gap-2 border-b border-(--clarify-theme-tokens-colors-border) px-2 pb-0", listClassName),
863
886
  children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
864
- className: ({ selected }) => (0, clsx.default)("clarify-ui-tab relative inline-flex h-10 shrink-0 items-center px-0 py-0 text-sm font-medium transition focus:outline-none", selected && "clarify-ui-tab-active"),
887
+ className: ({ selected }) => (0, clsx.default)("clarify-content-tab clarify-ui-tab relative inline-flex h-10 shrink-0 items-center rounded-t-md px-2 py-0 text-sm font-medium transition-colors focus:outline-none", selected && "clarify-ui-tab-active"),
865
888
  children: ({ selected }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
866
889
  layoutId: indicatorLayoutId,
867
- className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-(--clarify-theme-tokens-colors-foreground)",
890
+ className: "absolute inset-x-2 bottom-0 h-0.5 rounded-full bg-(--clarify-ui-tab-indicator) shadow-[0_0_0.5rem_var(--clarify-ui-accent-glow)]",
868
891
  transition: {
869
- type: "tween",
870
- duration: .16,
871
- ease: "easeOut"
892
+ type: "spring",
893
+ stiffness: 460,
894
+ damping: 34,
895
+ mass: .7
872
896
  }
873
897
  }) : null] })
874
898
  }, item.id))
@@ -1123,6 +1147,7 @@ function Markdown(arg0) {
1123
1147
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_markdown.default, {
1124
1148
  components: markdownComponents,
1125
1149
  remarkPlugins: require_remark.markdownRemarkPlugins,
1150
+ rehypePlugins: [rehype_raw.default],
1126
1151
  children
1127
1152
  })
1128
1153
  });
@@ -1384,8 +1409,72 @@ function listOpenApiOperations(spec) {
1384
1409
  return [...listOperationsFromPathItems(paths, "path", spec), ...isRecord(webhooks) ? listOperationsFromPathItems(webhooks, "webhook", spec) : []];
1385
1410
  }
1386
1411
  //#endregion
1412
+ //#region source/components/HighlightedCode.tsx
1413
+ var cssVariablesTheme = (0, shiki.createCssVariablesTheme)();
1414
+ function HighlightedCode(arg0) {
1415
+ const { code, language } = arg0;
1416
+ const [lines, setLines] = (0, react.useState)();
1417
+ (0, react.useEffect)(() => {
1418
+ let active = true;
1419
+ (0, shiki.codeToTokens)(code, {
1420
+ lang: language,
1421
+ theme: cssVariablesTheme
1422
+ }).then((result) => {
1423
+ if (active) setLines(result.tokens);
1424
+ }).catch(() => {
1425
+ if (active) setLines(void 0);
1426
+ });
1427
+ return () => {
1428
+ active = false;
1429
+ };
1430
+ }, [code, language]);
1431
+ if (!lines) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
1432
+ className: `language-${language}`,
1433
+ children: code
1434
+ });
1435
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
1436
+ className: `language-${language}`,
1437
+ children: lines.map((line, lineIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1438
+ className: "line",
1439
+ children: [line.map((token, tokenIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1440
+ style: {
1441
+ color: token.color,
1442
+ ...token.htmlStyle
1443
+ },
1444
+ children: token.content
1445
+ }, tokenIndex)), lineIndex < lines.length - 1 ? "\n" : null]
1446
+ }, lineIndex))
1447
+ });
1448
+ }
1449
+ //#endregion
1387
1450
  //#region source/openapi/lib/request-code.ts
1451
+ var snippetControlCharacters = [
1452
+ {
1453
+ character: "\n",
1454
+ placeholder: "",
1455
+ escape: "\\n"
1456
+ },
1457
+ {
1458
+ character: "\r",
1459
+ placeholder: "",
1460
+ escape: "\\r"
1461
+ },
1462
+ {
1463
+ character: " ",
1464
+ placeholder: "",
1465
+ escape: "\\t"
1466
+ }
1467
+ ];
1388
1468
  var snippetGenerator = (0, _scalar_snippetz.snippetz)();
1469
+ function protectSnippetControlCharacters(value) {
1470
+ if (typeof value === "string") return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.character, item.placeholder), value);
1471
+ if (Array.isArray(value)) return value.map(protectSnippetControlCharacters);
1472
+ if (!isRecord$1(value)) return value;
1473
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, protectSnippetControlCharacters(item)]));
1474
+ }
1475
+ function restoreSnippetControlCharacters(code) {
1476
+ return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.placeholder, item.escape), code);
1477
+ }
1389
1478
  function getDefaultServer(spec) {
1390
1479
  const servers = spec.servers;
1391
1480
  if (!Array.isArray(servers)) return { url: "https://api.example.com" };
@@ -1453,7 +1542,7 @@ function getRequestBody(requestContent) {
1453
1542
  const params = getFormParams(value, requestContent);
1454
1543
  return params.length > 0 ? { params } : void 0;
1455
1544
  }
1456
- return { serialized: stringifyExample(value) };
1545
+ return { serialized: stringifyExample(protectSnippetControlCharacters(value)) };
1457
1546
  }
1458
1547
  function getAuthorizationValue(auth) {
1459
1548
  if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "bearer") return `Bearer ${auth.value}`;
@@ -1506,7 +1595,7 @@ function buildSnippetErrorMessage(error) {
1506
1595
  }
1507
1596
  function buildSnippet(input, target) {
1508
1597
  try {
1509
- return decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || "");
1598
+ return restoreSnippetControlCharacters(decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || ""));
1510
1599
  } catch (error) {
1511
1600
  return buildSnippetErrorMessage(error);
1512
1601
  }
@@ -1815,7 +1904,7 @@ function SelectControl(arg0) {
1815
1904
  className: wrapperClassName,
1816
1905
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxButton, {
1817
1906
  "aria-label": label,
1818
- className: `clarify-api-select-button flex ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg bg-(--clarify-code-control-background) px-2 py-1 text-xs font-medium whitespace-nowrap text-(--clarify-code-text) outline-hidden transition hover:bg-(--clarify-code-control-background-hover) focus:ring-2 focus:ring-(--clarify-ui-accent-border) data-open:bg-(--clarify-code-control-background-hover) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)`,
1907
+ className: `clarify-api-select-button flex min-h-8 ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg border border-(--clarify-code-border) bg-(--clarify-code-control-background) px-2.5 py-1 text-xs font-medium whitespace-nowrap text-(--clarify-code-text) outline-hidden transition hover:border-white/20 hover:bg-(--clarify-code-control-background-hover) focus:ring-2 focus:ring-(--clarify-ui-accent-border) data-open:border-white/20 data-open:bg-(--clarify-code-control-background-active) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)`,
1819
1908
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1820
1909
  className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
1821
1910
  children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1834,7 +1923,7 @@ function SelectControl(arg0) {
1834
1923
  className: "clarify-api-select-options z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-(--clarify-popover-max-width) overflow-auto rounded-xl bg-(--clarify-code-surface) p-1 text-xs shadow-lg shadow-black/20 ring-1 ring-(--clarify-code-border) [--anchor-gap:--spacing(1)] focus:outline-none",
1835
1924
  children: normalizedOptions.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
1836
1925
  value: option.value,
1837
- className: "clarify-api-select-option group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs whitespace-nowrap text-(--clarify-code-muted) select-none data-focus:bg-(--clarify-code-control-background-hover) data-focus:text-(--clarify-code-text) data-selected:text-(--clarify-theme-tokens-colors-primary)",
1926
+ className: "clarify-api-select-option group flex min-h-9 cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs whitespace-nowrap text-(--clarify-code-control-text) select-none data-focus:bg-(--clarify-code-control-background-hover) data-focus:text-(--clarify-code-text) data-selected:bg-(--clarify-code-accent-background) data-selected:text-(--clarify-code-accent-text)",
1838
1927
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
1839
1928
  className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
1840
1929
  "aria-hidden": "true"
@@ -1859,7 +1948,7 @@ function CopyCodeButton(arg0) {
1859
1948
  setTimeout(() => setCopied(false), 1e3);
1860
1949
  });
1861
1950
  },
1862
- className: "flex items-center gap-1.5 rounded-full bg-(--clarify-code-control-background) px-2.5 py-1.5 text-2xs font-medium text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus:bg-(--clarify-code-control-background-hover) focus:text-(--clarify-code-text)",
1951
+ className: "ml-auto flex shrink-0 items-center gap-1.5 rounded-full bg-(--clarify-code-control-background) px-2.5 py-1.5 text-2xs font-medium whitespace-nowrap text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus:bg-(--clarify-code-control-background-hover) focus:text-(--clarify-code-text)",
1863
1952
  children: [copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
1864
1953
  className: "h-3.5 w-3.5 text-(--clarify-theme-tokens-colors-primary)",
1865
1954
  "aria-hidden": "true"
@@ -1886,9 +1975,9 @@ function CodeToolbar(arg0) {
1886
1975
  const { code, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
1887
1976
  const t = require_i18n.useBuiltInText();
1888
1977
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1889
- className: "absolute top-3.5 right-4 left-4 z-10 flex items-center justify-between gap-3",
1978
+ className: "clarify-api-code-toolbar flex items-center gap-2 px-4 pt-3",
1890
1979
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1891
- className: "flex min-w-0 items-center gap-2",
1980
+ className: "clarify-api-code-toolbar-controls flex min-w-0 flex-1 flex-wrap items-center gap-2",
1892
1981
  children: [languageOptions && languageOptions.length > 1 && selectedLanguageKey && onSelectLanguage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectControl, {
1893
1982
  label: t("openapi.language"),
1894
1983
  value: selectedLanguageKey,
@@ -1993,7 +2082,7 @@ function ApiExampleCodeGroup(arg0) {
1993
2082
  className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-(--clarify-code-text)",
1994
2083
  children: title
1995
2084
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1996
- className: "ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
2085
+ className: "clarify-api-example-header-controls ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
1997
2086
  children: [mediaTypes && mediaTypes.length > 1 && selectedMediaType && onSelectMediaType ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectControl, {
1998
2087
  label: t("openapi.mediaType"),
1999
2088
  value: selectedMediaType,
@@ -2033,7 +2122,7 @@ function ApiExampleCodeGroup(arg0) {
2033
2122
  ]
2034
2123
  }) : null,
2035
2124
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2036
- className: "clarify-api-example-code group relative bg-(--clarify-code-background)",
2125
+ className: "clarify-api-example-code group bg-(--clarify-code-background)",
2037
2126
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeToolbar, {
2038
2127
  code,
2039
2128
  languageOptions,
@@ -2043,10 +2132,10 @@ function ApiExampleCodeGroup(arg0) {
2043
2132
  selectedClientKey,
2044
2133
  onSelectClient
2045
2134
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
2046
- className: `max-h-128 overflow-auto overscroll-contain p-4 text-xs text-(--clarify-code-text) ${languageOptions && languageOptions.length > 1 ? "pt-14" : ""}`,
2047
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
2048
- className: `language-${language}`,
2049
- children: code
2135
+ className: "max-h-128 overflow-auto overscroll-contain px-4 pt-3 pb-4 text-xs text-(--clarify-code-text)",
2136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightedCode, {
2137
+ code,
2138
+ language
2050
2139
  })
2051
2140
  })]
2052
2141
  })
@@ -2150,6 +2239,9 @@ function RequestExamplesPanel(arg0) {
2150
2239
  function firstExampleKeyForResponseContent(content, spec) {
2151
2240
  return getExampleEntries(content?.value, spec)[0]?.key ?? "";
2152
2241
  }
2242
+ function getResponseExampleBody(content, example) {
2243
+ return content ? stringifyExample(example?.value) : "";
2244
+ }
2153
2245
  function useResponseExamplesState(arg0) {
2154
2246
  const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2155
2247
  const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
@@ -2160,8 +2252,7 @@ function useResponseExamplesState(arg0) {
2160
2252
  if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
2161
2253
  return left.status.localeCompare(right.status);
2162
2254
  });
2163
- const defaultStatus = orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
2164
- const [internalSelectedStatus, setInternalSelectedStatus] = (0, react.useState)(defaultStatus);
2255
+ const [internalSelectedStatus, setInternalSelectedStatus] = (0, react.useState)(orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "");
2165
2256
  const activeStatus = selectedStatus ?? internalSelectedStatus;
2166
2257
  const selectedResponse = orderedResponses.find(({ status }) => status === activeStatus) ?? orderedResponses[0];
2167
2258
  const responseContents = getMediaTypeEntries(selectedResponse?.response.content, spec);
@@ -2187,7 +2278,7 @@ function useResponseExamplesState(arg0) {
2187
2278
  selectedContent,
2188
2279
  examples,
2189
2280
  selectedExample,
2190
- responseCode: selectedContent ? stringifyExample(selectedExample?.value) : `HTTP/1.1 ${selectedResponse?.status ?? defaultStatus}${selectedResponse?.status === "204" ? " No Content" : ""}`,
2281
+ responseBody: getResponseExampleBody(selectedContent, selectedExample),
2191
2282
  onSelectStatus: (value) => {
2192
2283
  const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
2193
2284
  if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
@@ -2226,18 +2317,14 @@ function ResponseExamplesPanel(arg0) {
2226
2317
  selectedStatus,
2227
2318
  onSelectStatus
2228
2319
  });
2229
- if (!state.selectedResponse || !state.responseCode) return null;
2320
+ if (!state.selectedContent || !state.responseBody) return null;
2230
2321
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiExampleCodeGroup, {
2231
2322
  title: title ?? t("openapi.response"),
2232
- tag: state.selectedResponse.status,
2233
- tagOptions: state.responses.map(({ status }) => status),
2234
- onSelectTag: state.onSelectStatus,
2235
2323
  label: state.selectedContent?.mediaType,
2236
2324
  labelOptions: state.responseContents.map((content) => content.mediaType),
2237
2325
  onSelectLabel: state.responseContents.length > 0 ? state.onSelectMediaType : void 0,
2238
- comfortableMeta: true,
2239
- code: state.responseCode,
2240
- language: state.selectedContent ? codeLanguageForMediaType(state.selectedContent.mediaType) : "http",
2326
+ code: state.responseBody,
2327
+ language: codeLanguageForMediaType(state.selectedContent.mediaType),
2241
2328
  examples: state.examples,
2242
2329
  selectedExampleKey: state.selectedExample?.key,
2243
2330
  onSelectExample: state.onSelectExample
@@ -2496,7 +2583,7 @@ function SchemaNode(arg0) {
2496
2583
  className: "*:first:mt-0 *:last:mb-0",
2497
2584
  children: node.description
2498
2585
  }) : fallbackDescription, node.details ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2499
- className: "text-xs text-(--clarify-ui-text-faint)",
2586
+ className: "text-xs text-(--clarify-ui-text-soft)",
2500
2587
  children: node.details
2501
2588
  }) : null]
2502
2589
  })]
@@ -2512,7 +2599,7 @@ function SchemaNode(arg0) {
2512
2599
  "aria-label": expanded ? t("openapi.collapse") : t("openapi.expand"),
2513
2600
  "aria-expanded": expanded,
2514
2601
  onClick: () => setExpanded((value) => !value),
2515
- className: (0, clsx.default)(rowClassName, "cursor-pointer transition"),
2602
+ className: (0, clsx.default)(rowClassName, "cursor-pointer transition hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)"),
2516
2603
  children: content
2517
2604
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2518
2605
  className: rowClassName,
@@ -2580,10 +2667,10 @@ function ResponseList(arg0) {
2580
2667
  children: [
2581
2668
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2582
2669
  className: "flex flex-wrap items-center gap-2",
2583
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2670
+ children: [orderedResponses.length === 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2584
2671
  className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2585
2672
  children: status
2586
- }), type ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2673
+ }) : null, type ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2587
2674
  className: "text-xs text-(--clarify-theme-tokens-colors-muted)",
2588
2675
  children: type
2589
2676
  }) : null]
@@ -2836,7 +2923,7 @@ function EndpointPath(arg0) {
2836
2923
  "aria-label": copied ? t("actions.copied") : t("actions.copy"),
2837
2924
  title: copied ? t("actions.copied") : t("actions.copy"),
2838
2925
  onClick: onCopy,
2839
- className: (0, clsx.default)("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
2926
+ className: (0, clsx.default)("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
2840
2927
  children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
2841
2928
  className: "h-3.5 w-3.5",
2842
2929
  "aria-hidden": "true"
@@ -2857,7 +2944,7 @@ function InlineListbox(arg0) {
2857
2944
  className: "pointer-events-auto relative inline-flex min-w-0",
2858
2945
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxButton, {
2859
2946
  "aria-label": label,
2860
- className: (0, clsx.default)("inline-flex min-w-0 items-center gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) font-semibold text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) data-open:border-(--clarify-ui-text-faint) data-open:bg-(--clarify-ui-hover-background)", compact ? "max-w-32 px-1.5 py-0.5 text-xs" : "w-full px-2.5 py-1.5 text-xs"),
2947
+ className: (0, clsx.default)("inline-flex min-w-0 items-center gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) font-semibold text-(--clarify-ui-text-strong) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) data-open:border-(--clarify-ui-accent-border) data-open:bg-(--clarify-ui-active-background) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)", compact ? "min-h-7 max-w-32 px-2 py-0.5 text-xs" : "min-h-8 w-full px-2.5 py-1.5 text-xs"),
2861
2948
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2862
2949
  className: "truncate",
2863
2950
  children: selected?.label ?? value
@@ -2870,7 +2957,7 @@ function InlineListbox(arg0) {
2870
2957
  className: "z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-(--clarify-popover-max-width) overflow-auto rounded-xl bg-(--clarify-theme-tokens-colors-surface) p-1 text-xs shadow-lg shadow-black/10 ring-1 ring-(--clarify-theme-tokens-colors-border) [--anchor-gap:--spacing(1)] focus:outline-none",
2871
2958
  children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
2872
2959
  value: option.value,
2873
- className: "group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs text-(--clarify-ui-text) select-none data-focus:bg-(--clarify-ui-hover-background) data-selected:text-(--clarify-theme-tokens-colors-primary)",
2960
+ className: "group flex min-h-9 cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs text-(--clarify-ui-text) select-none data-focus:bg-(--clarify-ui-hover-background) data-focus:text-(--clarify-ui-text-strong) data-selected:bg-(--clarify-ui-active-background) data-selected:text-(--clarify-ui-accent-text)",
2874
2961
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2875
2962
  className: "min-w-0",
2876
2963
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2917,7 +3004,7 @@ function ServerUrlValue(arg0) {
2917
3004
  const protocolLabel = getServerProtocolLabel(server, variables);
2918
3005
  if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2919
3006
  "aria-label": "Server",
2920
- className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-foreground) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5",
3007
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5",
2921
3008
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2922
3009
  className: "sm:hidden",
2923
3010
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
@@ -2940,7 +3027,7 @@ function ServerUrlValue(arg0) {
2940
3027
  "aria-expanded": open,
2941
3028
  "aria-label": "Server",
2942
3029
  onClick: onToggle,
2943
- className: (0, clsx.default)("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-foreground) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5", open ? "bg-(--clarify-ui-active-background) text-(--clarify-theme-tokens-colors-foreground)" : null),
3030
+ className: (0, clsx.default)("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5", open ? "bg-(--clarify-ui-active-background) text-(--clarify-theme-tokens-colors-foreground)" : null),
2944
3031
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2945
3032
  className: "sm:hidden",
2946
3033
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
@@ -3059,7 +3146,8 @@ function AuthPanel(arg0) {
3059
3146
  className: "mr-2 shrink-0 text-2xs font-semibold text-(--clarify-ui-text-soft)",
3060
3147
  children: selectedAuth.scheme.type === "apiKey" ? selectedAuth.scheme.in ?? "apiKey" : selectedAuth.scheme.scheme ?? selectedAuth.scheme.type ?? "token"
3061
3148
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3062
- value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth),
3149
+ value: authValues[selectedAuth.name] ?? "",
3150
+ placeholder: authPlaceholder(selectedAuth),
3063
3151
  onChange: (event) => onChangeAuthValue(selectedAuth.name, event.target.value),
3064
3152
  className: "min-w-0 flex-1 border-0 bg-transparent px-0 py-0 text-xs font-semibold text-(--clarify-theme-tokens-colors-foreground) outline-hidden placeholder:text-(--clarify-ui-text-faint)"
3065
3153
  })]
@@ -3106,7 +3194,7 @@ function EndpointIdentity(arg0) {
3106
3194
  "aria-expanded": authOpen,
3107
3195
  "aria-label": "Auth",
3108
3196
  onClick: onToggleAuth,
3109
- className: (0, clsx.default)("ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-emerald-700 dark:hover:text-emerald-200", authOpen ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-400/15 dark:text-emerald-100" : "bg-(--clarify-ui-subtle-background)"),
3197
+ className: (0, clsx.default)("ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-emerald-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) dark:hover:text-emerald-200", authOpen ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-400/15 dark:text-emerald-100" : "bg-(--clarify-ui-subtle-background)"),
3110
3198
  children: authOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.UnlockKeyholeIcon, {
3111
3199
  className: "h-4 w-4",
3112
3200
  "aria-hidden": "true"
@@ -3406,4 +3494,4 @@ Object.defineProperty(exports, "primitives_exports", {
3406
3494
  }
3407
3495
  });
3408
3496
 
3409
- //# sourceMappingURL=OpenApiOperation-DK46w2dq.cjs.map
3497
+ //# sourceMappingURL=OpenApiOperation-B52IWlKb.cjs.map