@clarify-labs/renderer 0.10.0 → 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.
Files changed (91) hide show
  1. package/output/{ClarifyShell-CxhXBtsR.js → ClarifyShell-1LuBliwt.js} +124 -40
  2. package/output/ClarifyShell-1LuBliwt.js.map +1 -0
  3. package/output/{ClarifyShell-DjLRRW8T.cjs → ClarifyShell-C6li72Ce.cjs} +136 -52
  4. package/output/ClarifyShell-C6li72Ce.cjs.map +1 -0
  5. package/output/MermaidViewer-B6-BMCJG.cjs +101 -0
  6. package/output/MermaidViewer-B6-BMCJG.cjs.map +1 -0
  7. package/output/MermaidViewer-dXsomvM7.js +98 -0
  8. package/output/MermaidViewer-dXsomvM7.js.map +1 -0
  9. package/output/{OpenApiOperation-qp5tFaWP.cjs → OpenApiOperation-B52IWlKb.cjs} +405 -243
  10. package/output/OpenApiOperation-B52IWlKb.cjs.map +1 -0
  11. package/output/{OpenApiOperation-CyBkzvob.js → OpenApiOperation-DgrqzeiS.js} +377 -228
  12. package/output/OpenApiOperation-DgrqzeiS.js.map +1 -0
  13. package/output/{PageActions-GS_cxeJN.cjs → PageActions-BjB6PYmL.cjs} +73 -734
  14. package/output/PageActions-BjB6PYmL.cjs.map +1 -0
  15. package/output/{PageActions-Dn8IGWoL.js → PageActions-D7K9LDGf.js} +67 -680
  16. package/output/PageActions-D7K9LDGf.js.map +1 -0
  17. package/output/SearchDialog-CIPvXMT3.cjs +414 -0
  18. package/output/SearchDialog-CIPvXMT3.cjs.map +1 -0
  19. package/output/SearchDialog-CxYLjRi5.js +411 -0
  20. package/output/SearchDialog-CxYLjRi5.js.map +1 -0
  21. package/output/app/AppShell.d.ts +2 -2
  22. package/output/app/SectionHashSync.d.ts +6 -0
  23. package/output/client.cjs +3 -3
  24. package/output/client.js +3 -3
  25. package/output/components/HighlightedCode.d.ts +7 -0
  26. package/output/components/MermaidViewer.d.ts +7 -0
  27. package/output/context.d.ts +1 -1
  28. package/output/core/context.d.ts +3 -4
  29. package/output/core/i18n.d.ts +1 -1
  30. package/output/core/index.d.ts +1 -1
  31. package/output/core/types.d.ts +36 -19
  32. package/output/i18n-DnqZHFT7.js +247 -0
  33. package/output/i18n-DnqZHFT7.js.map +1 -0
  34. package/output/i18n-b4iTLeia.cjs +294 -0
  35. package/output/i18n-b4iTLeia.cjs.map +1 -0
  36. package/output/index.cjs +91 -94
  37. package/output/index.cjs.map +1 -1
  38. package/output/index.d.ts +7 -7
  39. package/output/index.js +83 -87
  40. package/output/index.js.map +1 -1
  41. package/output/markdown.cjs +2 -1
  42. package/output/markdown.d.ts +1 -1
  43. package/output/markdown.js +2 -2
  44. package/output/mdx/remark.d.ts +1 -0
  45. package/output/openapi/components/EndpointSections.d.ts +3 -1
  46. package/output/openapi/components/ExamplePanels.d.ts +5 -2
  47. package/output/openapi/components/OpenApiOperation.d.ts +3 -1
  48. package/output/openapi/components/OpenApiOperation.state.d.ts +3 -3
  49. package/output/openapi/components/SchemaProperties.d.ts +1 -0
  50. package/output/openapi/components/helpers.d.ts +2 -2
  51. package/output/openapi/entry.d.ts +0 -1
  52. package/output/openapi/lib/helpers.d.ts +5 -3
  53. package/output/openapi/lib/request-code.d.ts +2 -1
  54. package/output/openapi/lib/spec-path.d.ts +6 -1
  55. package/output/openapi/lib/utils.d.ts +10 -4
  56. package/output/preview.cjs +7 -5
  57. package/output/preview.cjs.map +1 -1
  58. package/output/preview.js +5 -3
  59. package/output/preview.js.map +1 -1
  60. package/output/{remark-Dd2WU50s.js → remark-C9iRQM0R.js} +4 -3
  61. package/output/remark-C9iRQM0R.js.map +1 -0
  62. package/output/{remark-zSQT0MBv.cjs → remark-DTLbG8PK.cjs} +9 -2
  63. package/output/remark-DTLbG8PK.cjs.map +1 -0
  64. package/output/{render-CV0a-qtD.js → render-DKj24Jqw.js} +15 -8
  65. package/output/render-DKj24Jqw.js.map +1 -0
  66. package/output/{render-CCCoUWDP.cjs → render-Di5B6Zc0.cjs} +15 -8
  67. package/output/render-Di5B6Zc0.cjs.map +1 -0
  68. package/output/renderer.css +234 -20
  69. package/output/runtime/ClarifyShell.d.ts +5 -6
  70. package/output/server.cjs +4 -4
  71. package/output/server.cjs.map +1 -1
  72. package/output/server.js +4 -4
  73. package/output/server.js.map +1 -1
  74. package/output/shell/Navigation.d.ts +1 -0
  75. package/output/shell/search/SearchDialog.d.ts +1 -1
  76. package/output/slots/RuntimeSlot.d.ts +7 -7
  77. package/output/slots/context.d.ts +5 -5
  78. package/output/slots/index.d.ts +2 -2
  79. package/output/slots/types.d.ts +1 -1
  80. package/output/utils/path.d.ts +1 -1
  81. package/package.json +3 -1
  82. package/output/ClarifyShell-CxhXBtsR.js.map +0 -1
  83. package/output/ClarifyShell-DjLRRW8T.cjs.map +0 -1
  84. package/output/OpenApiOperation-CyBkzvob.js.map +0 -1
  85. package/output/OpenApiOperation-qp5tFaWP.cjs.map +0 -1
  86. package/output/PageActions-Dn8IGWoL.js.map +0 -1
  87. package/output/PageActions-GS_cxeJN.cjs.map +0 -1
  88. package/output/remark-Dd2WU50s.js.map +0 -1
  89. package/output/remark-zSQT0MBv.cjs.map +0 -1
  90. package/output/render-CCCoUWDP.cjs.map +0 -1
  91. package/output/render-CV0a-qtD.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
+ const require_i18n = require("./i18n-b4iTLeia.cjs");
2
3
  let clsx = require("clsx");
3
4
  clsx = require_rolldown_runtime.__toESM(clsx, 1);
4
5
  let react = require("react");
@@ -9,243 +10,6 @@ lucide_react = require_rolldown_runtime.__toESM(lucide_react, 1);
9
10
  let react_jsx_runtime = require("react/jsx-runtime");
10
11
  let framer_motion = require("framer-motion");
11
12
  let zustand = require("zustand");
12
- //#region source/core/context.tsx
13
- var ConfigContext = (0, react.createContext)(null);
14
- var LocaleContext = (0, react.createContext)(void 0);
15
- var OpenApisContext = (0, react.createContext)({});
16
- function useConfig() {
17
- const config = (0, react.useContext)(ConfigContext);
18
- if (!config) throw new Error("[clarify] useConfig must be used within a ConfigContext.Provider");
19
- return config;
20
- }
21
- function useConfigOptional() {
22
- return (0, react.useContext)(ConfigContext);
23
- }
24
- function useLocale() {
25
- return (0, react.useContext)(LocaleContext);
26
- }
27
- function useOpenApis() {
28
- return (0, react.useContext)(OpenApisContext);
29
- }
30
- //#endregion
31
- //#region source/core/i18n.ts
32
- var builtInText = {
33
- en: {
34
- "actions.code": "Code",
35
- "actions.copy": "Copy",
36
- "actions.copied": "Copied!",
37
- "builtWith.label": "Built with Clarify",
38
- "builtWith.prefix": "Built with",
39
- "callout.danger": "Danger",
40
- "callout.info": "Info",
41
- "callout.note": "Note",
42
- "callout.success": "Success",
43
- "callout.tip": "Tip",
44
- "callout.warning": "Warning",
45
- "contentActions.copyContent": "Copy page",
46
- "contentActions.copyContentDescription": "Copy this page as {contentType} for LLMs",
47
- "contentActions.copyLink": "Copy {contentType} link",
48
- "contentActions.copyLinkDescription": "Copy the raw {contentType} content link for this page",
49
- "contentActions.copyLlms": "Copy llms.txt",
50
- "contentActions.copyLlmsDescription": "Copy the llms.txt link for this site",
51
- "contentActions.copiedLlms": "Copied llms.txt",
52
- "contentActions.editPage": "Edit this page",
53
- "contentActions.editPageDescription": "Open the source file for this page",
54
- "contentActions.copyOptions": "Choose copy option",
55
- "contentActions.copiedContent": "Copied page",
56
- "contentActions.copiedLink": "Copied link",
57
- "contentActions.viewMarkdown": "View as Markdown",
58
- "contentActions.viewMarkdownDescription": "View this page as plain text",
59
- "contentActions.viewOpenApi": "View raw OpenAPI",
60
- "contentActions.viewOpenApiDescription": "Open the API description file in a new tab",
61
- "feedback.no": "No",
62
- "feedback.prompt": "Was this page helpful?",
63
- "feedback.thanks": "Thanks for your feedback!",
64
- "feedback.yes": "Yes",
65
- "navigation.documentation": "Documentation",
66
- "navigation.next": "Next",
67
- "navigation.previous": "Previous",
68
- "navigation.previousNext": "Previous and next pages",
69
- "navigation.toggle": "Toggle navigation",
70
- "navbar.home": "Home",
71
- "navbar.openLinks": "Open navigation links",
72
- "navbar.sections": "Documentation sections",
73
- "notFound.description": "The page may have moved, been renamed, or never existed. Check the address or return to the homepage.",
74
- "notFound.home": "Back to homepage",
75
- "notFound.label": "404",
76
- "notFound.title": "Page not found",
77
- "openapi.apiDocumentation": "API Documentation",
78
- "openapi.bodyProperties": "Body properties",
79
- "openapi.collapse": "Collapse",
80
- "openapi.endpointNotFound": "Endpoint not found: {endpoint}",
81
- "openapi.example": "Example",
82
- "openapi.expand": "Expand",
83
- "openapi.headers": "Headers",
84
- "openapi.language": "Language",
85
- "openapi.client": "Client",
86
- "openapi.mediaType": "Media type",
87
- "openapi.none": "None",
88
- "openapi.openApiReference": "OpenAPI Reference",
89
- "openapi.operationParameter": "Operation parameter.",
90
- "openapi.optional": "Optional.",
91
- "openapi.parameter": "parameter",
92
- "openapi.pathParameters": "Path parameters",
93
- "openapi.queryParameters": "Query parameters",
94
- "openapi.request": "Request",
95
- "openapi.requestBody": "Request body",
96
- "openapi.requestBodyEmpty": "No request body",
97
- "openapi.responseBodyProperties": "Response body properties",
98
- "openapi.required": "Required.",
99
- "openapi.requiredBadge": "required",
100
- "openapi.response": "Response",
101
- "openapi.responses": "Responses",
102
- "openapi.schemaExample": "Schema example",
103
- "openapi.scrollExamplesLeft": "Scroll examples left",
104
- "openapi.scrollExamplesRight": "Scroll examples right",
105
- "openapi.specNotFound": "OpenAPI spec not found: {specPath}",
106
- "openapi.specPathMissing": "spec or specPath was not provided",
107
- "openapi.status": "Status",
108
- "openapi.version": "Version {version}",
109
- "search.button": "Search...",
110
- "search.noResults": "Nothing found for {query}.",
111
- "search.placeholder": "Find something...",
112
- "search.shortcutCtrl": "Ctrl ",
113
- "renderError.componentStack": "React component stack",
114
- "renderError.description": "Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.",
115
- "renderError.details": "Runtime diagnostics",
116
- "renderError.message": "Message",
117
- "renderError.path": "Route",
118
- "renderError.reload": "Reload route",
119
- "renderError.stack": "JavaScript stack trace",
120
- "renderError.title": "Route render failed",
121
- "renderError.type": "Error type",
122
- "renderError.version": "Clarify version",
123
- "theme.switchToDark": "Switch to dark theme",
124
- "theme.switchToLight": "Switch to light theme",
125
- "theme.switchToSystem": "Follow system theme",
126
- "language.switch": "Switch language",
127
- "mermaid.zoomIn": "Zoom in",
128
- "mermaid.zoomOut": "Zoom out",
129
- "mermaid.resetZoom": "Reset zoom",
130
- "mermaid.renderError": "Mermaid render error",
131
- "mermaid.scrollHint": "Click the diagram to enable scroll-to-zoom"
132
- },
133
- "zh-CN": {
134
- "actions.code": "代码",
135
- "actions.copy": "复制",
136
- "actions.copied": "已复制!",
137
- "builtWith.label": "由 Clarify 构建",
138
- "builtWith.prefix": "构建来自",
139
- "callout.danger": "危险",
140
- "callout.info": "信息",
141
- "callout.note": "注意",
142
- "callout.success": "成功",
143
- "callout.tip": "提示",
144
- "callout.warning": "警告",
145
- "contentActions.copyContent": "复制页面",
146
- "contentActions.copyContentDescription": "将页面以 {contentType} 格式复制给 LLMs",
147
- "contentActions.copyLink": "复制 {contentType} 链接",
148
- "contentActions.copyLinkDescription": "复制当前页面的 {contentType} 原始内容链接",
149
- "contentActions.copyLlms": "复制 llms.txt",
150
- "contentActions.copyLlmsDescription": "复制此站点的 llms.txt 链接",
151
- "contentActions.copiedLlms": "已复制 llms.txt",
152
- "contentActions.editPage": "编辑此页面",
153
- "contentActions.editPageDescription": "打开当前页面的源文件",
154
- "contentActions.copyOptions": "选择复制选项",
155
- "contentActions.copiedContent": "已复制页面",
156
- "contentActions.copiedLink": "已复制链接",
157
- "contentActions.viewMarkdown": "以 Markdown 格式查看",
158
- "contentActions.viewMarkdownDescription": "以纯文本查看此页面",
159
- "contentActions.viewOpenApi": "查看 OpenAPI 原始内容",
160
- "contentActions.viewOpenApiDescription": "在新标签页打开 API 描述文件",
161
- "feedback.no": "否",
162
- "feedback.prompt": "这个页面有帮助吗?",
163
- "feedback.thanks": "感谢你的反馈!",
164
- "feedback.yes": "是",
165
- "navigation.documentation": "文档",
166
- "navigation.next": "下一页",
167
- "navigation.previous": "上一页",
168
- "navigation.previousNext": "上一页和下一页",
169
- "navigation.toggle": "切换导航",
170
- "navbar.home": "首页",
171
- "navbar.openLinks": "打开导航链接",
172
- "navbar.sections": "文档栏目",
173
- "notFound.description": "页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。",
174
- "notFound.home": "返回首页",
175
- "notFound.label": "404",
176
- "notFound.title": "页面未找到",
177
- "openapi.apiDocumentation": "API 文档",
178
- "openapi.bodyProperties": "请求体属性",
179
- "openapi.collapse": "收起",
180
- "openapi.endpointNotFound": "未找到端点:{endpoint}",
181
- "openapi.example": "示例",
182
- "openapi.expand": "展开",
183
- "openapi.headers": "请求头",
184
- "openapi.language": "语言",
185
- "openapi.client": "客户端",
186
- "openapi.mediaType": "媒体类型",
187
- "openapi.none": "无",
188
- "openapi.openApiReference": "OpenAPI 参考",
189
- "openapi.operationParameter": "操作参数。",
190
- "openapi.optional": "可选。",
191
- "openapi.parameter": "参数",
192
- "openapi.pathParameters": "路径参数",
193
- "openapi.queryParameters": "查询参数",
194
- "openapi.request": "请求",
195
- "openapi.requestBody": "请求体",
196
- "openapi.requestBodyEmpty": "暂无请求体",
197
- "openapi.responseBodyProperties": "响应体属性",
198
- "openapi.required": "必填。",
199
- "openapi.requiredBadge": "必填",
200
- "openapi.response": "响应",
201
- "openapi.responses": "响应",
202
- "openapi.schemaExample": "Schema 示例",
203
- "openapi.scrollExamplesLeft": "向左滚动示例",
204
- "openapi.scrollExamplesRight": "向右滚动示例",
205
- "openapi.specNotFound": "未找到 OpenAPI 描述文件:{specPath}",
206
- "openapi.specPathMissing": "未提供 spec 或 specPath",
207
- "openapi.status": "状态",
208
- "openapi.version": "版本 {version}",
209
- "search.button": "搜索...",
210
- "search.noResults": "没有找到与 {query} 相关的结果。",
211
- "search.placeholder": "搜索内容...",
212
- "search.shortcutCtrl": "Ctrl ",
213
- "renderError.componentStack": "React 组件栈",
214
- "renderError.description": "Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。",
215
- "renderError.details": "运行时诊断",
216
- "renderError.message": "错误消息",
217
- "renderError.path": "路由",
218
- "renderError.reload": "重新加载路由",
219
- "renderError.stack": "JavaScript 堆栈",
220
- "renderError.title": "路由渲染失败",
221
- "renderError.type": "错误类型",
222
- "renderError.version": "Clarify 版本",
223
- "theme.switchToDark": "切换到深色主题",
224
- "theme.switchToLight": "切换到浅色主题",
225
- "theme.switchToSystem": "跟随系统主题",
226
- "language.switch": "切换语言",
227
- "mermaid.zoomIn": "放大",
228
- "mermaid.zoomOut": "缩小",
229
- "mermaid.resetZoom": "重置缩放",
230
- "mermaid.renderError": "Mermaid 渲染错误",
231
- "mermaid.scrollHint": "点击图表后即可滚轮缩放"
232
- }
233
- };
234
- function resolveBuiltInLocale(locale) {
235
- return locale === "zh-CN" || locale?.toLowerCase().startsWith("zh") ? "zh-CN" : "en";
236
- }
237
- function translateBuiltInText(locale, key, replacements = {}) {
238
- let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key];
239
- for (const [name, replacement] of Object.entries(replacements)) value = value.replaceAll(`{${name}}`, replacement);
240
- return value;
241
- }
242
- function useBuiltInText(locale) {
243
- const config = (0, react.useContext)(ConfigContext);
244
- const currentLocale = (0, react.useContext)(LocaleContext);
245
- const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
246
- return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
247
- }
248
- //#endregion
249
13
  //#region source/utils/clipboard.ts
250
14
  async function copyTextToClipboard(text) {
251
15
  if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
@@ -305,9 +69,9 @@ function getAbsoluteUrl(path) {
305
69
  }
306
70
  function ContentActions(arg0) {
307
71
  const { route, routePrefix } = arg0;
308
- const t = useBuiltInText();
72
+ const t = require_i18n.useBuiltInText();
309
73
  const [copied, setCopied] = (0, react.useState)("idle");
310
- if (!route?.contentArtifactUrl && !route?.sourceUrl) return null;
74
+ if (!route?.contentArtifactUrl && !route?.sourceEditUrl) return null;
311
75
  const contentArtifactUrl = route.contentArtifactUrl ? resolveContentArtifactUrl(route.contentArtifactUrl, routePrefix) : void 0;
312
76
  const isOpenApi = route.kind === "openapi";
313
77
  const replacements = { contentType: isOpenApi ? "OpenAPI" : "Markdown" };
@@ -315,7 +79,7 @@ function ContentActions(arg0) {
315
79
  const viewDescription = isOpenApi ? t("contentActions.viewOpenApiDescription") : t("contentActions.viewMarkdownDescription");
316
80
  function markCopied(state) {
317
81
  setCopied(state);
318
- window.setTimeout(() => setCopied("idle"), 1600);
82
+ setTimeout(() => setCopied("idle"), 1600);
319
83
  }
320
84
  async function handleCopyContent() {
321
85
  if (!contentArtifactUrl) return;
@@ -370,7 +134,7 @@ function ContentActions(arg0) {
370
134
  children: copied === primaryAction.key ? t("actions.copied") : primaryAction.label
371
135
  })]
372
136
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
373
- href: route.sourceUrl,
137
+ href: route.sourceEditUrl,
374
138
  target: "_blank",
375
139
  rel: "noreferrer",
376
140
  className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 min-w-0 items-center gap-1.5 px-2.5 no-underline transition sm:px-3",
@@ -388,8 +152,8 @@ function ContentActions(arg0) {
388
152
  anchor: "bottom end",
389
153
  className: "clarify-content-actions-list clarify-ui-menu z-30 mt-2 w-(--clarify-ui-action-menu-width) origin-top-right rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1.5 shadow-xl shadow-zinc-900/5 transition [--anchor-gap:--spacing(2)] focus:outline-none data-closed:scale-95 data-closed:opacity-0",
390
154
  children: [
391
- route.sourceUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
392
- href: route.sourceUrl,
155
+ route.sourceEditUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
156
+ href: route.sourceEditUrl,
393
157
  target: "_blank",
394
158
  rel: "noreferrer",
395
159
  className: "clarify-content-actions-item clarify-ui-menu-item group flex w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) px-1.5 py-1.5 text-left no-underline transition",
@@ -670,7 +434,7 @@ function useTheme() {
670
434
  //#region source/theme/ThemeToggle.tsx
671
435
  function ThemeToggle() {
672
436
  const { theme, setTheme } = useTheme();
673
- const t = useBuiltInText();
437
+ const t = require_i18n.useBuiltInText();
674
438
  const nextTheme = getNextTheme(theme);
675
439
  const label = getThemeLabel(nextTheme, t);
676
440
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -714,9 +478,19 @@ function normalizeRoutePath(path) {
714
478
  const [pathname, suffix = ""] = path.split(/([?#].*)/, 2);
715
479
  return `${pathname.replace(/^\/+/, "/").replace(/\/+$/, "") || "/"}${suffix}`;
716
480
  }
717
- function isSameRoutePath(a, b) {
481
+ function stripLocalePathPrefix(path, locale) {
482
+ if (!locale) return normalizeRoutePath(path);
483
+ const [pathname, suffix = ""] = normalizeRoutePath(path).split(/([?#].*)/, 2);
484
+ const localePrefix = `/${locale}`;
485
+ if (pathname === localePrefix) return `/${suffix}`.replace(/^\/$/, "/");
486
+ if (!pathname.startsWith(`${localePrefix}/`)) return `${pathname}${suffix}`;
487
+ return `${pathname.slice(localePrefix.length) || "/"}${suffix}`;
488
+ }
489
+ function isSameRoutePath(a, b, locale) {
718
490
  if (!a || !b) return false;
719
- return normalizeRoutePath(a) === normalizeRoutePath(b);
491
+ const normalizedA = normalizeRoutePath(a);
492
+ const normalizedB = normalizeRoutePath(b);
493
+ return normalizedA === normalizedB || stripLocalePathPrefix(normalizedA, locale) === normalizedB || normalizedA === stripLocalePathPrefix(normalizedB, locale);
720
494
  }
721
495
  //#endregion
722
496
  //#region source/utils/lucide.ts
@@ -801,7 +575,7 @@ function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom)
801
575
  }
802
576
  return visibleSections;
803
577
  }
804
- function useSectionVisibilityDebug(headerTopAreaRef) {
578
+ function useSectionVisibilityDebug(_headerTopAreaRef) {
805
579
  const lastDebugSignatureRef = (0, react.useRef)("");
806
580
  return (snapshot) => {
807
581
  const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
@@ -813,14 +587,11 @@ function useSectionVisibilityDebug(headerTopAreaRef) {
813
587
  ].join("|");
814
588
  if (lastDebugSignatureRef.current === debugSignature) return;
815
589
  lastDebugSignatureRef.current = debugSignature;
816
- console.info("[clarify][section-visibility]", {
817
- ...snapshot,
818
- topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
819
- });
820
590
  };
821
591
  }
822
592
  function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
823
593
  (0, react.useEffect)(() => {
594
+ if (typeof window === "undefined") return void 0;
824
595
  const raf = window.requestAnimationFrame(() => checkVisibleSections());
825
596
  window.addEventListener("scroll", checkVisibleSections, { passive: true });
826
597
  window.addEventListener("resize", checkVisibleSections);
@@ -841,6 +612,7 @@ function useVisibleSections(sectionStore, headerTopAreaRef) {
841
612
  const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
842
613
  const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
843
614
  useSectionVisibilityObserver((0, react.useCallback)(() => {
615
+ if (typeof window === "undefined") return;
844
616
  const { innerHeight, scrollY } = window;
845
617
  const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
846
618
  const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
@@ -925,7 +697,8 @@ var sectionBadgeColorStyles = {
925
697
  DELETE: "text-red-500 dark:text-rose-500",
926
698
  OPTIONS: "text-violet-500 dark:text-violet-400",
927
699
  HEAD: "text-zinc-500 dark:text-zinc-400",
928
- TRACE: "text-fuchsia-500 dark:text-fuchsia-400"
700
+ TRACE: "text-fuchsia-500 dark:text-fuchsia-400",
701
+ WEBHOOK: "text-violet-500 dark:text-violet-400"
929
702
  };
930
703
  function SectionBadge(arg0) {
931
704
  const { children } = arg0;
@@ -959,13 +732,13 @@ function NavLink(arg0) {
959
732
  });
960
733
  }
961
734
  function VisibleSectionHighlight(arg0) {
962
- const { group, pathname } = arg0;
735
+ const { group, pathname, currentLocale } = arg0;
963
736
  const [sections, visibleSections] = useInitialValue([useSectionStore((s) => s.sections), useSectionStore((s) => s.visibleSections)], useIsInsideMobileNavigation());
964
737
  const isPresent = (0, framer_motion.useIsPresent)();
965
738
  const firstVisibleSectionIndex = Math.max(0, [{ id: "_top" }, ...sections].findIndex((section) => section.id === visibleSections[0]));
966
739
  const itemHeight = remToPx(2);
967
740
  const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight;
968
- const top = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight + firstVisibleSectionIndex * itemHeight;
741
+ const top = group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) * itemHeight + firstVisibleSectionIndex * itemHeight;
969
742
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
970
743
  initial: {
971
744
  opacity: 0,
@@ -997,9 +770,9 @@ function VisibleSectionHighlight(arg0) {
997
770
  });
998
771
  }
999
772
  function ActivePageMarker(arg0) {
1000
- const { group, pathname } = arg0;
773
+ const { group, pathname, currentLocale } = arg0;
1001
774
  const itemHeight = remToPx(2);
1002
- const top = remToPx(.25) + group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight;
775
+ const top = remToPx(.25) + group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) * itemHeight;
1003
776
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
1004
777
  className: "absolute left-2 h-6 w-px bg-(--clarify-theme-tokens-colors-primary)",
1005
778
  initial: {
@@ -1025,10 +798,10 @@ function ActivePageMarker(arg0) {
1025
798
  });
1026
799
  }
1027
800
  function NavigationGroup(arg0) {
1028
- const { group, className } = arg0;
801
+ const { group, className, currentLocale } = arg0;
1029
802
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1030
803
  const [pathname, sections] = useInitialValue([normalizeRoutePath((0, react_router_dom.useLocation)().pathname), useSectionStore((s) => s.sections)], isInsideMobileNavigation);
1031
- const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) !== -1;
804
+ const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) !== -1;
1032
805
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1033
806
  className: (0, clsx.default)("clarify-navigation-group relative mb-6", className),
1034
807
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
@@ -1044,7 +817,8 @@ function NavigationGroup(arg0) {
1044
817
  initial: !isInsideMobileNavigation,
1045
818
  children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisibleSectionHighlight, {
1046
819
  group,
1047
- pathname
820
+ pathname,
821
+ currentLocale
1048
822
  }) : null
1049
823
  }),
1050
824
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "absolute inset-y-0 left-2 w-px bg-(--clarify-theme-tokens-colors-border) dark:bg-white/5" }),
@@ -1052,14 +826,15 @@ function NavigationGroup(arg0) {
1052
826
  initial: false,
1053
827
  children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivePageMarker, {
1054
828
  group,
1055
- pathname
829
+ pathname,
830
+ currentLocale
1056
831
  }) : null
1057
832
  }),
1058
833
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1059
834
  role: "list",
1060
835
  className: "border-l border-transparent",
1061
836
  children: group.links.map((link) => {
1062
- const active = isSameRoutePath(link.href, pathname);
837
+ const active = isSameRoutePath(link.href, pathname, currentLocale);
1063
838
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1064
839
  className: "relative",
1065
840
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavLink, {
@@ -1098,8 +873,8 @@ function NavigationGroup(arg0) {
1098
873
  });
1099
874
  }
1100
875
  function Navigation(arg0) {
1101
- const { navigation, className } = arg0;
1102
- const groups = navigationToGroups(navigation, useBuiltInText()("navigation.documentation"));
876
+ const { navigation, className, currentLocale } = arg0;
877
+ const groups = navigationToGroups(navigation, require_i18n.useBuiltInText()("navigation.documentation"));
1103
878
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
1104
879
  className: (0, clsx.default)("clarify-navigation", className),
1105
880
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
@@ -1107,7 +882,8 @@ function Navigation(arg0) {
1107
882
  className: "clarify-navigation-list",
1108
883
  children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationGroup, {
1109
884
  group,
1110
- className: groupIndex === 0 ? "mt-0" : ""
885
+ className: groupIndex === 0 ? "mt-0" : "",
886
+ currentLocale
1111
887
  }, group.title))
1112
888
  })
1113
889
  });
@@ -1115,17 +891,17 @@ function Navigation(arg0) {
1115
891
  //#endregion
1116
892
  //#region source/shell/mobile.tsx
1117
893
  var IsInsideMobileNavigationContext = (0, react.createContext)(false);
1118
- function hasPath$1(nodes, pathname) {
1119
- return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath$1(node.children ?? [], pathname));
894
+ function hasPath$1(nodes, pathname, currentLocale) {
895
+ return nodes.some((node) => isSameRoutePath(node.path, pathname, currentLocale) || hasPath$1(node.children ?? [], pathname, currentLocale));
1120
896
  }
1121
- function isActiveTab$1(tab, pathname) {
1122
- return isSameRoutePath(tab.path, pathname) || hasPath$1(tab.children, pathname);
897
+ function isActiveTab$1(tab, pathname, currentLocale) {
898
+ return isSameRoutePath(tab.path, pathname, currentLocale) || hasPath$1(tab.children, pathname, currentLocale);
1123
899
  }
1124
900
  function MobileTabsSelect(arg0) {
1125
- const { tabs } = arg0;
901
+ const { tabs, currentLocale } = arg0;
1126
902
  const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
1127
903
  if (!tabs?.length) return null;
1128
- const activeTab = tabs.find((tab) => isActiveTab$1(tab, pathname)) ?? tabs[0];
904
+ const activeTab = tabs.find((tab) => isActiveTab$1(tab, pathname, currentLocale)) ?? tabs[0];
1129
905
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
1130
906
  as: "div",
1131
907
  className: "clarify-mobile-tabs-select mb-6",
@@ -1144,7 +920,7 @@ function MobileTabsSelect(arg0) {
1144
920
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItems, {
1145
921
  className: "clarify-mobile-tabs-select-list clarify-ui-menu mt-2 flex flex-col gap-1 rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1 shadow-lg shadow-zinc-900/5 focus:outline-none dark:border-white/10 dark:bg-zinc-900 dark:shadow-none",
1146
922
  children: tabs.map((tab) => {
1147
- const active = isActiveTab$1(tab, pathname);
923
+ const active = isActiveTab$1(tab, pathname, currentLocale);
1148
924
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
1149
925
  to: tab.path,
1150
926
  className: (0, clsx.default)("clarify-mobile-tabs-select-item clarify-ui-menu-item flex items-center justify-between gap-3 rounded-(--clarify-theme-tokens-radius-lg) px-3 py-2.5 no-underline transition", active && "clarify-ui-menu-item-active"),
@@ -1185,7 +961,13 @@ function MobileNavigationDialog(arg0) {
1185
961
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TransitionChild, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
1186
962
  layoutScroll: true,
1187
963
  className: "clarify-mobile-navigation-panel fixed top-14 bottom-0 left-0 w-full max-w-sm overflow-y-auto bg-(--clarify-theme-tokens-colors-background) px-4 pt-6 pb-4 shadow-lg ring-1 shadow-zinc-900/10 ring-(--clarify-theme-tokens-colors-border) duration-500 ease-in-out data-closed:-translate-x-full sm:px-6 sm:pb-10 dark:bg-zinc-950 dark:ring-zinc-800",
1188
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileTabsSelect, { tabs }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navigation, { navigation })]
964
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileTabsSelect, {
965
+ tabs,
966
+ currentLocale
967
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navigation, {
968
+ navigation,
969
+ currentLocale
970
+ })]
1189
971
  }) })] })]
1190
972
  });
1191
973
  }
@@ -1202,7 +984,7 @@ function MobileNavigation(arg0) {
1202
984
  const { config, navigation, tabs, routes, currentLocale, currentRoute } = arg0;
1203
985
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1204
986
  const { isOpen, toggle, close } = useMobileNavigationStore();
1205
- const t = useBuiltInText();
987
+ const t = require_i18n.useBuiltInText();
1206
988
  const ToggleIcon = isOpen ? lucide_react.X : lucide_react.Menu;
1207
989
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(IsInsideMobileNavigationContext.Provider, {
1208
990
  value: true,
@@ -1228,405 +1010,6 @@ function MobileNavigation(arg0) {
1228
1010
  });
1229
1011
  }
1230
1012
  //#endregion
1231
- //#region source/shell/search/items.ts
1232
- function routeGroupTitles(navigation) {
1233
- const titles = /* @__PURE__ */ new Map();
1234
- for (const node of navigation) if (node.children?.length) for (const child of node.children) titles.set(child.path, node.title);
1235
- else titles.set(node.path, node.title);
1236
- return titles;
1237
- }
1238
- function buildSearchItems(routes, navigation) {
1239
- const groupTitles = routeGroupTitles(navigation);
1240
- return routes.flatMap((route) => {
1241
- if (route.isBareAlias) return [];
1242
- const groupTitle = groupTitles.get(route.path);
1243
- return [{
1244
- title: route.title,
1245
- pageTitle: route.title,
1246
- sectionTitle: groupTitle,
1247
- url: route.path,
1248
- keywords: [
1249
- groupTitle,
1250
- route.title,
1251
- route.path,
1252
- route.kind
1253
- ].filter(Boolean).join(" ").toLowerCase()
1254
- }, ...route.sections?.map((section) => ({
1255
- title: section.title,
1256
- pageTitle: route.title,
1257
- sectionTitle: groupTitle,
1258
- url: `${route.path}#${section.id}`,
1259
- keywords: [
1260
- groupTitle,
1261
- route.title,
1262
- section.title,
1263
- route.path,
1264
- section.id
1265
- ].filter(Boolean).join(" ").toLowerCase()
1266
- })) ?? []];
1267
- });
1268
- }
1269
- //#endregion
1270
- //#region source/shell/search/pagefind.ts
1271
- var pagefindPromises = /* @__PURE__ */ new Map();
1272
- function pagefindCacheKey(routePrefix, locale) {
1273
- return `${routePrefix || "/"}:${locale || "default"}`;
1274
- }
1275
- function loadPagefind(routePrefix, locale) {
1276
- if (typeof window === "undefined") return Promise.resolve(null);
1277
- const language = locale ?? document.documentElement.lang;
1278
- const cacheKey = pagefindCacheKey(routePrefix, language);
1279
- const cachedPagefind = pagefindPromises.get(cacheKey);
1280
- if (cachedPagefind) return cachedPagefind;
1281
- const pagefindPromise = import(
1282
- /* @vite-ignore */
1283
- prefixHref("/pagefind/pagefind.js", routePrefix)
1284
- ).then(async (module) => {
1285
- const previousLanguage = document.documentElement.lang;
1286
- if (language) document.documentElement.lang = language;
1287
- const pagefind = module.createInstance();
1288
- if (previousLanguage && previousLanguage !== language) document.documentElement.lang = previousLanguage;
1289
- await pagefind.init?.();
1290
- return pagefind;
1291
- }).catch((error) => {
1292
- pagefindPromises.delete(cacheKey);
1293
- console.warn("[clarify:search] Pagefind instance failed", {
1294
- cacheKey,
1295
- language,
1296
- error
1297
- });
1298
- return null;
1299
- });
1300
- pagefindPromises.set(cacheKey, pagefindPromise);
1301
- return pagefindPromise;
1302
- }
1303
- function normalizePagefindUrl(url, routePrefix) {
1304
- const parsedUrl = new URL(url, window.location.origin);
1305
- let pathname = parsedUrl.pathname;
1306
- const prefix = routePrefix && routePrefix !== "/" ? `/${routePrefix.replace(/^\/+|\/+$/g, "")}` : "";
1307
- if (prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))) pathname = pathname.slice(prefix.length) || "/";
1308
- return `${pathname}${parsedUrl.search}${parsedUrl.hash}`;
1309
- }
1310
- //#endregion
1311
- //#region source/shell/search/SearchInput.tsx
1312
- var SearchInput = (0, react.forwardRef)(function SearchInput(arg0, inputRef) {
1313
- const { query, setQuery, onClose, onSubmit, activeDescendantId, loading = false } = arg0;
1314
- const t = useBuiltInText();
1315
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1316
- className: "clarify-search-input group relative flex h-12",
1317
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(loading ? lucide_react.LoaderCircle : lucide_react.Search, {
1318
- "aria-hidden": "true",
1319
- className: (0, clsx.default)("pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)", loading && "animate-spin")
1320
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1321
- ref: inputRef,
1322
- "data-autofocus": true,
1323
- role: "combobox",
1324
- "aria-expanded": query !== "",
1325
- "aria-controls": "clarify-search-results",
1326
- "aria-activedescendant": activeDescendantId,
1327
- value: query,
1328
- onChange: (event) => setQuery(event.currentTarget.value),
1329
- onKeyDown: (event) => {
1330
- if (event.key === "Escape") if (query) setQuery("");
1331
- else onClose();
1332
- if (event.key === "Enter") {
1333
- event.preventDefault();
1334
- onSubmit();
1335
- }
1336
- },
1337
- placeholder: t("search.placeholder"),
1338
- className: "clarify-search-field flex-auto appearance-none bg-transparent pr-4 pl-10 outline-hidden focus:w-full focus:flex-none [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden"
1339
- })]
1340
- });
1341
- });
1342
- //#endregion
1343
- //#region source/shell/search/Highlight.tsx
1344
- function stripHtml(value) {
1345
- if (typeof document === "undefined") return value.replace(/<[^>]*>/g, "");
1346
- const template = document.createElement("template");
1347
- template.innerHTML = value;
1348
- return template.content.textContent ?? "";
1349
- }
1350
- function escapeRegExp(value) {
1351
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1352
- }
1353
- function HighlightQuery(arg0) {
1354
- const { text, query } = arg0;
1355
- if (!query) return text;
1356
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
1357
- className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
1358
- children: part
1359
- }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: part }, index)) });
1360
- }
1361
- function renderExcerptNode(node, key) {
1362
- if (node.nodeType === Node.TEXT_NODE) return node.textContent;
1363
- if (node.nodeType !== Node.ELEMENT_NODE) return null;
1364
- const element = node;
1365
- const children = Array.from(element.childNodes).map((child, index) => renderExcerptNode(child, `${key}-${index}`));
1366
- if (element.tagName.toLowerCase() === "mark") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
1367
- className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
1368
- children
1369
- }, key);
1370
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children }, key);
1371
- }
1372
- function HighlightExcerpt(arg0) {
1373
- const { excerpt, query } = arg0;
1374
- if (typeof document === "undefined" || !excerpt.includes("<mark")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1375
- text: stripHtml(excerpt),
1376
- query
1377
- });
1378
- const template = document.createElement("template");
1379
- template.innerHTML = excerpt;
1380
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Array.from(template.content.childNodes).map((node, index) => renderExcerptNode(node, String(index))) });
1381
- }
1382
- //#endregion
1383
- //#region source/shell/search/SearchResult.tsx
1384
- function SearchResult(arg0) {
1385
- const { result, query, active, onActive, onSelect } = arg0;
1386
- const id = (0, react.useId)();
1387
- const hierarchy = result.type === "quick" ? [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string") : [];
1388
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1389
- id,
1390
- className: (0, clsx.default)("clarify-search-result group block cursor-pointer px-4 py-3", active && "clarify-search-result-active"),
1391
- "aria-selected": active,
1392
- onMouseEnter: onActive,
1393
- onMouseMove: onActive,
1394
- onMouseDown: (event) => {
1395
- event.preventDefault();
1396
- onSelect();
1397
- },
1398
- children: [
1399
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1400
- className: "clarify-search-result-title",
1401
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1402
- text: result.title,
1403
- query
1404
- })
1405
- }),
1406
- hierarchy.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1407
- className: "clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap",
1408
- children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1409
- text: item,
1410
- query
1411
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1412
- className: itemIndex === items.length - 1 ? "sr-only" : "clarify-search-result-separator mx-2",
1413
- children: "/"
1414
- })] }, `${item}-${itemIndex}`))
1415
- }) : null,
1416
- result.type === "full-text" && result.excerpt ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1417
- className: "clarify-search-result-excerpt mt-1 line-clamp-2 text-xs leading-5 text-(--clarify-theme-tokens-colors-muted)",
1418
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightExcerpt, {
1419
- excerpt: result.excerpt,
1420
- query
1421
- })
1422
- }) : null
1423
- ]
1424
- });
1425
- }
1426
- //#endregion
1427
- //#region source/shell/search/SearchDialog.tsx
1428
- function useSearchDialogLifecycle(arg0) {
1429
- const { open, setOpen } = arg0;
1430
- const location = (0, react_router_dom.useLocation)();
1431
- (0, react.useEffect)(() => {
1432
- setOpen(false);
1433
- }, [
1434
- location.pathname,
1435
- location.search,
1436
- location.hash,
1437
- setOpen
1438
- ]);
1439
- (0, react.useEffect)(() => {
1440
- if (open) return void 0;
1441
- function onKeyDown(event) {
1442
- if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
1443
- event.preventDefault();
1444
- setOpen(true);
1445
- }
1446
- }
1447
- window.addEventListener("keydown", onKeyDown);
1448
- return () => window.removeEventListener("keydown", onKeyDown);
1449
- }, [open, setOpen]);
1450
- }
1451
- function useSearchData(arg0) {
1452
- const { query, searchItems, routePrefix, currentLocale } = arg0;
1453
- const [fullTextState, setFullTextState] = (0, react.useState)(null);
1454
- const [pagefindState, setPagefindState] = (0, react.useState)(null);
1455
- const quickResults = (0, react.useMemo)(() => {
1456
- const normalizedQuery = query.trim().toLowerCase();
1457
- if (!normalizedQuery) return [];
1458
- return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8).map((item) => ({
1459
- ...item,
1460
- type: "quick"
1461
- }));
1462
- }, [query, searchItems]);
1463
- const pagefindKey = pagefindCacheKey(routePrefix, currentLocale);
1464
- const activePagefindState = pagefindState?.key === pagefindKey ? pagefindState : null;
1465
- const pagefind = activePagefindState?.pagefind ?? null;
1466
- const pagefindAvailable = activePagefindState?.available ?? null;
1467
- const trimmedQuery = query.trim();
1468
- const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
1469
- const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
1470
- const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
1471
- const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
1472
- (0, react.useEffect)(() => {
1473
- let cancelled = false;
1474
- loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
1475
- if (cancelled) return;
1476
- setPagefindState({
1477
- key: pagefindKey,
1478
- pagefind: loadedPagefind,
1479
- available: Boolean(loadedPagefind)
1480
- });
1481
- });
1482
- return () => {
1483
- cancelled = true;
1484
- };
1485
- }, [
1486
- currentLocale,
1487
- pagefindKey,
1488
- routePrefix
1489
- ]);
1490
- (0, react.useEffect)(() => {
1491
- let cancelled = false;
1492
- if (!trimmedQuery || !pagefind) return void 0;
1493
- Promise.resolve().then(async () => {
1494
- if (cancelled) return;
1495
- try {
1496
- const search = await pagefind.search(trimmedQuery, { limit: 8 });
1497
- const data = await Promise.all(search.results.map(async (result) => ({
1498
- id: result.id,
1499
- data: await result.data()
1500
- })));
1501
- if (cancelled) return;
1502
- setFullTextState({
1503
- key: fullTextKey,
1504
- results: data.map(({ id, data }) => ({
1505
- type: "full-text",
1506
- id,
1507
- title: data.meta.title || data.url,
1508
- url: normalizePagefindUrl(data.url, routePrefix),
1509
- excerpt: data.excerpt
1510
- }))
1511
- });
1512
- } catch (error) {
1513
- console.warn("[clarify:search] Pagefind search failed", {
1514
- currentLocale,
1515
- query: trimmedQuery,
1516
- error
1517
- });
1518
- if (!cancelled) setFullTextState({
1519
- key: fullTextKey,
1520
- results: null
1521
- });
1522
- }
1523
- });
1524
- return () => {
1525
- cancelled = true;
1526
- };
1527
- }, [
1528
- currentLocale,
1529
- fullTextKey,
1530
- pagefind,
1531
- routePrefix,
1532
- trimmedQuery
1533
- ]);
1534
- return {
1535
- results,
1536
- searchInputLoading,
1537
- showNoResults
1538
- };
1539
- }
1540
- function SearchDialog(arg0) {
1541
- const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
1542
- const t = useBuiltInText();
1543
- const navigate = (0, react_router_dom.useNavigate)();
1544
- const inputRef = (0, react.useRef)(null);
1545
- const [query, setQuery] = (0, react.useState)("");
1546
- const [activeIndex, setActiveIndex] = (0, react.useState)(0);
1547
- const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
1548
- useSearchDialogLifecycle({
1549
- open,
1550
- setOpen
1551
- });
1552
- const { results, searchInputLoading, showNoResults } = useSearchData({
1553
- query,
1554
- searchItems,
1555
- routePrefix,
1556
- currentLocale
1557
- });
1558
- const updateQuery = (value) => {
1559
- setQuery(value);
1560
- setActiveIndex(0);
1561
- };
1562
- function closeDialog() {
1563
- updateQuery("");
1564
- setOpen(false);
1565
- }
1566
- function selectResult(result = results[activeIndex]) {
1567
- if (!result) return;
1568
- navigate(result.url);
1569
- onNavigate();
1570
- closeDialog();
1571
- }
1572
- function renderResultsPanel() {
1573
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1574
- className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
1575
- children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1576
- className: "p-6 text-center",
1577
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1578
- className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
1579
- children: t("search.noResults", { query })
1580
- })]
1581
- }) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1582
- id: "clarify-search-results",
1583
- className: "clarify-search-results",
1584
- role: "listbox",
1585
- children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
1586
- result,
1587
- query,
1588
- active: resultIndex === activeIndex,
1589
- onActive: () => setActiveIndex(resultIndex),
1590
- onSelect: () => selectResult(result)
1591
- }, result.type === "full-text" ? result.id : result.url))
1592
- }) : null]
1593
- });
1594
- }
1595
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
1596
- open,
1597
- onClose: closeDialog,
1598
- className: (0, clsx.default)("clarify-search-dialog fixed inset-0 z-50", className),
1599
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.DialogBackdrop, {
1600
- transition: true,
1601
- className: "clarify-search-backdrop clarify-ui-backdrop fixed inset-0 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
1602
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1603
- className: "fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-(--clarify-search-dialog-padding-block-lg)",
1604
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.DialogPanel, {
1605
- transition: true,
1606
- className: "clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-surface) shadow-xl ring-1 ring-(--clarify-theme-tokens-colors-border) data-closed:scale-95 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:max-w-xl dark:bg-zinc-900 dark:ring-zinc-800",
1607
- onKeyDown: (event) => {
1608
- if (event.key === "ArrowDown") {
1609
- event.preventDefault();
1610
- setActiveIndex((index) => results.length ? (index + 1) % results.length : 0);
1611
- }
1612
- if (event.key === "ArrowUp") {
1613
- event.preventDefault();
1614
- setActiveIndex((index) => results.length ? (index - 1 + results.length) % results.length : 0);
1615
- }
1616
- },
1617
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
1618
- ref: inputRef,
1619
- query,
1620
- setQuery: updateQuery,
1621
- onClose: closeDialog,
1622
- onSubmit: () => selectResult(),
1623
- loading: searchInputLoading
1624
- }), renderResultsPanel()]
1625
- })
1626
- })]
1627
- });
1628
- }
1629
- //#endregion
1630
1013
  //#region source/shell/search/useSearchProps.ts
1631
1014
  function useSearchProps() {
1632
1015
  const buttonRef = (0, react.useRef)(null);
@@ -1646,13 +1029,14 @@ function useSearchProps() {
1646
1029
  }
1647
1030
  //#endregion
1648
1031
  //#region source/shell/Search.tsx
1032
+ var SearchDialog = (0, react.lazy)(() => Promise.resolve().then(() => require("./SearchDialog-CIPvXMT3.cjs")));
1649
1033
  function getModifierKey() {
1650
1034
  if (typeof navigator === "undefined") return "Ctrl ";
1651
1035
  return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘" : "Ctrl ";
1652
1036
  }
1653
1037
  function Search(arg0) {
1654
1038
  const { routes, navigation, routePrefix, currentLocale } = arg0;
1655
- const t = useBuiltInText();
1039
+ const t = require_i18n.useBuiltInText();
1656
1040
  const modifierKey = getModifierKey();
1657
1041
  const { buttonProps, dialogProps } = useSearchProps();
1658
1042
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1690,7 +1074,7 @@ function Search(arg0) {
1690
1074
  }
1691
1075
  function MobileSearch(arg0) {
1692
1076
  const { routes, navigation, routePrefix, currentLocale, onNavigate } = arg0;
1693
- const t = useBuiltInText();
1077
+ const t = require_i18n.useBuiltInText();
1694
1078
  const { buttonProps, dialogProps } = useSearchProps();
1695
1079
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1696
1080
  className: "clarify-mobile-search contents lg:hidden",
@@ -1752,7 +1136,7 @@ function localizedRoutePath(config, locale, route) {
1752
1136
  }
1753
1137
  function LanguageSwitcher(arg0) {
1754
1138
  const { config, currentLocale, currentRoute } = arg0;
1755
- const t = useBuiltInText();
1139
+ const t = require_i18n.useBuiltInText();
1756
1140
  const location = (0, react_router_dom.useLocation)();
1757
1141
  const i18n = config.i18n;
1758
1142
  if (!i18n || i18n.locales.length < 2) return null;
@@ -1817,7 +1201,7 @@ function resolveHomeHref(config, currentLocale) {
1817
1201
  }
1818
1202
  function MobileNavbarMenu(arg0) {
1819
1203
  const { links, config, currentLocale } = arg0;
1820
- const t = useBuiltInText();
1204
+ const t = require_i18n.useBuiltInText();
1821
1205
  if (!links?.length) return null;
1822
1206
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
1823
1207
  as: "div",
@@ -1852,15 +1236,15 @@ function MobileNavbarMenu(arg0) {
1852
1236
  })]
1853
1237
  });
1854
1238
  }
1855
- function hasPath(nodes, pathname) {
1856
- return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath(node.children ?? [], pathname));
1239
+ function hasPath(nodes, pathname, currentLocale) {
1240
+ return nodes.some((node) => isSameRoutePath(node.path, pathname, currentLocale) || hasPath(node.children ?? [], pathname, currentLocale));
1857
1241
  }
1858
- function isActiveTab(tab, pathname) {
1859
- return isSameRoutePath(tab.path, pathname) || hasPath(tab.children, pathname);
1242
+ function isActiveTab(tab, pathname, currentLocale) {
1243
+ return isSameRoutePath(tab.path, pathname, currentLocale) || hasPath(tab.children, pathname, currentLocale);
1860
1244
  }
1861
1245
  function ProductTabs(arg0) {
1862
- const { tabs } = arg0;
1863
- const t = useBuiltInText();
1246
+ const { tabs, currentLocale } = arg0;
1247
+ const t = require_i18n.useBuiltInText();
1864
1248
  const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
1865
1249
  if (!tabs?.length) return null;
1866
1250
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1870,7 +1254,7 @@ function ProductTabs(arg0) {
1870
1254
  className: "clarify-product-tabs-nav mx-auto flex h-full w-full max-w-(--clarify-theme-layout-max-width) items-stretch gap-6 overflow-x-auto px-5",
1871
1255
  "aria-label": t("navbar.sections"),
1872
1256
  children: tabs.map((tab) => {
1873
- const active = isActiveTab(tab, pathname);
1257
+ const active = isActiveTab(tab, pathname, currentLocale);
1874
1258
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
1875
1259
  to: tab.path,
1876
1260
  "aria-current": active ? "page" : void 0,
@@ -1898,7 +1282,7 @@ function ProductTabs(arg0) {
1898
1282
  }
1899
1283
  var Header = (0, react.forwardRef)(function Header(arg0, ref) {
1900
1284
  const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
1901
- const t = useBuiltInText();
1285
+ const t = require_i18n.useBuiltInText();
1902
1286
  const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
1903
1287
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1904
1288
  const homeHref = resolveHomeHref(config, currentLocale);
@@ -2016,7 +1400,10 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
2016
1400
  "data-clarify-header-banner": true,
2017
1401
  children: banner
2018
1402
  }),
2019
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
1403
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, {
1404
+ tabs,
1405
+ currentLocale
1406
+ })
2020
1407
  ]
2021
1408
  });
2022
1409
  }
@@ -2053,36 +1440,18 @@ function PageTitleActions() {
2053
1440
  });
2054
1441
  }
2055
1442
  //#endregion
2056
- Object.defineProperty(exports, "ConfigContext", {
2057
- enumerable: true,
2058
- get: function() {
2059
- return ConfigContext;
2060
- }
2061
- });
2062
1443
  Object.defineProperty(exports, "Header", {
2063
1444
  enumerable: true,
2064
1445
  get: function() {
2065
1446
  return Header;
2066
1447
  }
2067
1448
  });
2068
- Object.defineProperty(exports, "LocaleContext", {
2069
- enumerable: true,
2070
- get: function() {
2071
- return LocaleContext;
2072
- }
2073
- });
2074
1449
  Object.defineProperty(exports, "Navigation", {
2075
1450
  enumerable: true,
2076
1451
  get: function() {
2077
1452
  return Navigation;
2078
1453
  }
2079
1454
  });
2080
- Object.defineProperty(exports, "OpenApisContext", {
2081
- enumerable: true,
2082
- get: function() {
2083
- return OpenApisContext;
2084
- }
2085
- });
2086
1455
  Object.defineProperty(exports, "PageActionsProvider", {
2087
1456
  enumerable: true,
2088
1457
  get: function() {
@@ -2215,36 +1584,6 @@ Object.defineProperty(exports, "themeCookieName", {
2215
1584
  return themeCookieName;
2216
1585
  }
2217
1586
  });
2218
- Object.defineProperty(exports, "useBuiltInText", {
2219
- enumerable: true,
2220
- get: function() {
2221
- return useBuiltInText;
2222
- }
2223
- });
2224
- Object.defineProperty(exports, "useConfig", {
2225
- enumerable: true,
2226
- get: function() {
2227
- return useConfig;
2228
- }
2229
- });
2230
- Object.defineProperty(exports, "useConfigOptional", {
2231
- enumerable: true,
2232
- get: function() {
2233
- return useConfigOptional;
2234
- }
2235
- });
2236
- Object.defineProperty(exports, "useLocale", {
2237
- enumerable: true,
2238
- get: function() {
2239
- return useLocale;
2240
- }
2241
- });
2242
- Object.defineProperty(exports, "useOpenApis", {
2243
- enumerable: true,
2244
- get: function() {
2245
- return useOpenApis;
2246
- }
2247
- });
2248
1587
  Object.defineProperty(exports, "useSectionStore", {
2249
1588
  enumerable: true,
2250
1589
  get: function() {
@@ -2258,4 +1597,4 @@ Object.defineProperty(exports, "useTheme", {
2258
1597
  }
2259
1598
  });
2260
1599
 
2261
- //# sourceMappingURL=PageActions-GS_cxeJN.cjs.map
1600
+ //# sourceMappingURL=PageActions-BjB6PYmL.cjs.map