@rspress/core 1.2.0 → 1.3.0

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 (158) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +53 -40
  3. package/dist/index.js.map +1 -1
  4. package/dist/loader.d.ts +1 -1
  5. package/dist/loader.js.map +1 -1
  6. package/dist/runtime/App.js +8 -4
  7. package/dist/runtime/clientEntry.js +7 -4
  8. package/dist/runtime/ssrEntry.js +2 -2
  9. package/package.json +19 -15
  10. package/runtime.ts +1 -1
  11. package/src/runtime/App.tsx +8 -4
  12. package/src/runtime/clientEntry.tsx +7 -4
  13. package/src/runtime/ssrEntry.tsx +2 -2
  14. package/theme.ts +2 -2
  15. package/dist/runtime/Content.d.ts +0 -6
  16. package/dist/runtime/Content.js +0 -33
  17. package/dist/runtime/NoSSR.d.ts +0 -4
  18. package/dist/runtime/NoSSR.js +0 -17
  19. package/dist/runtime/hooks.d.ts +0 -39
  20. package/dist/runtime/hooks.js +0 -54
  21. package/dist/runtime/index.d.ts +0 -6
  22. package/dist/runtime/index.js +0 -34
  23. package/dist/runtime/utils.d.ts +0 -8
  24. package/dist/runtime/utils.js +0 -45
  25. package/dist/theme/bundle.css +0 -2691
  26. package/dist/theme/bundle.d.ts +0 -176
  27. package/dist/theme/bundle.js +0 -4433
  28. package/dist/theme/bundle.js.map +0 -1
  29. package/dist/theme/index.js +0 -6
  30. package/src/runtime/Content.tsx +0 -43
  31. package/src/runtime/NoSSR.tsx +0 -16
  32. package/src/runtime/hooks.ts +0 -110
  33. package/src/runtime/index.ts +0 -17
  34. package/src/runtime/utils.ts +0 -46
  35. package/src/theme-default/assets/arrow-down.svg +0 -1
  36. package/src/theme-default/assets/arrow-right.svg +0 -1
  37. package/src/theme-default/assets/copy.svg +0 -1
  38. package/src/theme-default/assets/down.svg +0 -1
  39. package/src/theme-default/assets/github.svg +0 -1
  40. package/src/theme-default/assets/loading.svg +0 -1
  41. package/src/theme-default/assets/menu.svg +0 -1
  42. package/src/theme-default/assets/moon.svg +0 -3
  43. package/src/theme-default/assets/right.svg +0 -1
  44. package/src/theme-default/assets/small-menu.svg +0 -1
  45. package/src/theme-default/assets/success.svg +0 -1
  46. package/src/theme-default/assets/sun.svg +0 -11
  47. package/src/theme-default/assets/translator.svg +0 -1
  48. package/src/theme-default/components/Aside/index.css +0 -22
  49. package/src/theme-default/components/Aside/index.tsx +0 -75
  50. package/src/theme-default/components/BackDrop/index.module.scss +0 -14
  51. package/src/theme-default/components/BackDrop/index.tsx +0 -13
  52. package/src/theme-default/components/Button/index.module.scss +0 -68
  53. package/src/theme-default/components/Button/index.tsx +0 -40
  54. package/src/theme-default/components/DocFooter/index.module.scss +0 -60
  55. package/src/theme-default/components/DocFooter/index.tsx +0 -66
  56. package/src/theme-default/components/EditLink/index.module.scss +0 -11
  57. package/src/theme-default/components/EditLink/index.tsx +0 -18
  58. package/src/theme-default/components/HomeFeatures/index.module.scss +0 -50
  59. package/src/theme-default/components/HomeFeatures/index.tsx +0 -65
  60. package/src/theme-default/components/HomeFooter/index.tsx +0 -15
  61. package/src/theme-default/components/HomeHero/index.module.scss +0 -42
  62. package/src/theme-default/components/HomeHero/index.tsx +0 -75
  63. package/src/theme-default/components/Link/index.module.scss +0 -9
  64. package/src/theme-default/components/Link/index.tsx +0 -90
  65. package/src/theme-default/components/LocalSideBar/index.scss +0 -40
  66. package/src/theme-default/components/LocalSideBar/index.tsx +0 -39
  67. package/src/theme-default/components/Nav/NavBarTitle.tsx +0 -43
  68. package/src/theme-default/components/Nav/NavMenuGroup.tsx +0 -156
  69. package/src/theme-default/components/Nav/NavMenuSingleItem.tsx +0 -40
  70. package/src/theme-default/components/Nav/NavTranslations.tsx +0 -16
  71. package/src/theme-default/components/Nav/NavVersions.tsx +0 -16
  72. package/src/theme-default/components/Nav/index.module.scss +0 -115
  73. package/src/theme-default/components/Nav/index.tsx +0 -150
  74. package/src/theme-default/components/Nav/menuDataHooks.tsx +0 -75
  75. package/src/theme-default/components/NavHambmger/index.module.scss +0 -81
  76. package/src/theme-default/components/NavHambmger/index.tsx +0 -39
  77. package/src/theme-default/components/NavScreen/NavScreenMenuGroup.tsx +0 -95
  78. package/src/theme-default/components/NavScreen/index.module.scss +0 -88
  79. package/src/theme-default/components/NavScreen/index.tsx +0 -123
  80. package/src/theme-default/components/Overview/index.module.scss +0 -154
  81. package/src/theme-default/components/Overview/index.tsx +0 -136
  82. package/src/theme-default/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  83. package/src/theme-default/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  84. package/src/theme-default/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  85. package/src/theme-default/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  86. package/src/theme-default/components/PackageManagerTabs/index.scss +0 -5
  87. package/src/theme-default/components/PackageManagerTabs/index.tsx +0 -110
  88. package/src/theme-default/components/Search/NoSearchResult.tsx +0 -13
  89. package/src/theme-default/components/Search/SearchPanel.tsx +0 -340
  90. package/src/theme-default/components/Search/SuggestItem.tsx +0 -135
  91. package/src/theme-default/components/Search/assets/close.svg +0 -1
  92. package/src/theme-default/components/Search/assets/file.svg +0 -1
  93. package/src/theme-default/components/Search/assets/header.svg +0 -1
  94. package/src/theme-default/components/Search/assets/jump.svg +0 -1
  95. package/src/theme-default/components/Search/assets/loading.svg +0 -1
  96. package/src/theme-default/components/Search/assets/search.svg +0 -1
  97. package/src/theme-default/components/Search/assets/title.svg +0 -1
  98. package/src/theme-default/components/Search/empty.svg +0 -4
  99. package/src/theme-default/components/Search/index.module.scss +0 -236
  100. package/src/theme-default/components/Search/index.tsx +0 -39
  101. package/src/theme-default/components/Search/logic/Provider.ts +0 -35
  102. package/src/theme-default/components/Search/logic/providers/LocalProvider.ts +0 -102
  103. package/src/theme-default/components/Search/logic/providers/RemoteProvider.ts +0 -40
  104. package/src/theme-default/components/Search/logic/search.ts +0 -341
  105. package/src/theme-default/components/Search/logic/util.test.ts +0 -21
  106. package/src/theme-default/components/Search/logic/util.ts +0 -127
  107. package/src/theme-default/components/Sidebar/SidebarGroup.tsx +0 -180
  108. package/src/theme-default/components/Sidebar/SidebarItem.tsx +0 -61
  109. package/src/theme-default/components/Sidebar/index.module.scss +0 -142
  110. package/src/theme-default/components/Sidebar/index.tsx +0 -156
  111. package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +0 -30
  112. package/src/theme-default/components/SocialLinks/LinkContent.tsx +0 -90
  113. package/src/theme-default/components/SocialLinks/ShownLinks.tsx +0 -32
  114. package/src/theme-default/components/SocialLinks/index.module.scss +0 -18
  115. package/src/theme-default/components/SocialLinks/index.tsx +0 -36
  116. package/src/theme-default/components/SocialLinks/presetIcons.tsx +0 -165
  117. package/src/theme-default/components/SwitchAppearance/index.module.scss +0 -15
  118. package/src/theme-default/components/SwitchAppearance/index.tsx +0 -35
  119. package/src/theme-default/components/Tabs/index.module.scss +0 -46
  120. package/src/theme-default/components/Tabs/index.tsx +0 -123
  121. package/src/theme-default/components/Tag/index.tsx +0 -18
  122. package/src/theme-default/components/Toc/index.css +0 -18
  123. package/src/theme-default/components/Toc/index.tsx +0 -42
  124. package/src/theme-default/index.ts +0 -26
  125. package/src/theme-default/layout/DocLayout/docComponents/code.tsx +0 -112
  126. package/src/theme-default/layout/DocLayout/docComponents/hr.tsx +0 -10
  127. package/src/theme-default/layout/DocLayout/docComponents/index.module.scss +0 -69
  128. package/src/theme-default/layout/DocLayout/docComponents/index.tsx +0 -33
  129. package/src/theme-default/layout/DocLayout/docComponents/link.tsx +0 -22
  130. package/src/theme-default/layout/DocLayout/docComponents/list.tsx +0 -13
  131. package/src/theme-default/layout/DocLayout/docComponents/paragraph.tsx +0 -19
  132. package/src/theme-default/layout/DocLayout/docComponents/pre.tsx +0 -37
  133. package/src/theme-default/layout/DocLayout/docComponents/prisim-theme.ts +0 -73
  134. package/src/theme-default/layout/DocLayout/docComponents/table.tsx +0 -37
  135. package/src/theme-default/layout/DocLayout/docComponents/title.tsx +0 -40
  136. package/src/theme-default/layout/DocLayout/index.module.scss +0 -138
  137. package/src/theme-default/layout/DocLayout/index.tsx +0 -125
  138. package/src/theme-default/layout/HomeLayout/index.css +0 -18
  139. package/src/theme-default/layout/HomeLayout/index.tsx +0 -39
  140. package/src/theme-default/layout/Layout/index.tsx +0 -176
  141. package/src/theme-default/layout/NotFountLayout/index.tsx +0 -40
  142. package/src/theme-default/logic/TabDataContext.ts +0 -14
  143. package/src/theme-default/logic/index.ts +0 -8
  144. package/src/theme-default/logic/sideEffects.ts +0 -174
  145. package/src/theme-default/logic/useAppearance.ts +0 -57
  146. package/src/theme-default/logic/useEditLink.ts +0 -33
  147. package/src/theme-default/logic/useHiddenNav.ts +0 -58
  148. package/src/theme-default/logic/useLocaleSiteData.ts +0 -26
  149. package/src/theme-default/logic/useNav.ts +0 -36
  150. package/src/theme-default/logic/usePathUtils.ts +0 -73
  151. package/src/theme-default/logic/usePrevNextPage.ts +0 -40
  152. package/src/theme-default/logic/useSidebarData.ts +0 -73
  153. package/src/theme-default/logic/utils.ts +0 -38
  154. package/src/theme-default/styles/base.css +0 -102
  155. package/src/theme-default/styles/code.css +0 -177
  156. package/src/theme-default/styles/index.ts +0 -7
  157. package/src/theme-default/styles/scrollbar.css +0 -28
  158. package/src/theme-default/styles/vars.css +0 -81
@@ -1,4433 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __accessCheck = (obj, member, msg) => {
33
- if (!member.has(obj))
34
- throw TypeError("Cannot " + msg);
35
- };
36
- var __privateGet = (obj, member, getter) => {
37
- __accessCheck(obj, member, "read from private field");
38
- return getter ? getter.call(obj) : member.get(obj);
39
- };
40
- var __privateAdd = (obj, member, value) => {
41
- if (member.has(obj))
42
- throw TypeError("Cannot add the same private member more than once");
43
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
44
- };
45
- var __privateSet = (obj, member, value, setter) => {
46
- __accessCheck(obj, member, "write to private field");
47
- setter ? setter.call(obj, value) : member.set(obj, value);
48
- return value;
49
- };
50
- var __privateMethod = (obj, member, method) => {
51
- __accessCheck(obj, member, "access private method");
52
- return method;
53
- };
54
- var __async = (__this, __arguments, generator) => {
55
- return new Promise((resolve, reject) => {
56
- var fulfilled = (value) => {
57
- try {
58
- step(generator.next(value));
59
- } catch (e) {
60
- reject(e);
61
- }
62
- };
63
- var rejected = (value) => {
64
- try {
65
- step(generator.throw(value));
66
- } catch (e) {
67
- reject(e);
68
- }
69
- };
70
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
71
- step((generator = generator.apply(__this, __arguments)).next());
72
- });
73
- };
74
-
75
- // src/theme-default/layout/NotFountLayout/index.tsx
76
- import { usePageData } from "@/runtime";
77
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
78
- function NotFoundLayout() {
79
- const { siteData: siteData2 } = usePageData();
80
- const defaultLang = siteData2.lang;
81
- if (defaultLang && typeof window !== "undefined" && location.pathname.includes(`/${defaultLang}/`)) {
82
- const redirectUrl = location.pathname.replace(`/${defaultLang}/`, "/");
83
- window.location.replace(redirectUrl);
84
- return /* @__PURE__ */ jsx(Fragment, {});
85
- } else {
86
- return /* @__PURE__ */ jsxs("div", { className: "m-auto mt-50 p-16 sm:p-8 sm:pt-24 sm:pb-40 text-center flex-center flex-col", children: [
87
- /* @__PURE__ */ jsx("p", { className: "text-6xl font-semibold", children: "404" }),
88
- /* @__PURE__ */ jsx("h1", { className: "leading-5 pt-3 text-xl font-bold", children: "PAGE NOT FOUND" }),
89
- /* @__PURE__ */ jsx(
90
- "div",
91
- {
92
- style: { height: "1px" },
93
- className: "mt-6 mx-auto mb-4.5 w-16 bg-gray-light-1"
94
- }
95
- ),
96
- /* @__PURE__ */ jsx("div", { className: "pt-5", children: /* @__PURE__ */ jsx(
97
- "a",
98
- {
99
- className: "py-2 px-4 rounded-2xl inline-block border-solid border-brand text-brand font-medium hover:border-brand-dark hover:text-brand-dark transition-colors duration-300",
100
- href: siteData2.base,
101
- "aria-label": "go to home",
102
- children: "Take me home"
103
- }
104
- ) })
105
- ] });
106
- }
107
- }
108
-
109
- // src/theme-default/layout/Layout/index.tsx
110
- import "nprogress/nprogress.css";
111
- import { useEffect as useEffect10 } from "react";
112
- import { Helmet } from "react-helmet-async";
113
- import Theme, { Nav } from "@theme";
114
-
115
- // src/theme-default/layout/DocLayout/index.tsx
116
- import { useEffect as useEffect9, useState as useState6 } from "react";
117
- import { MDXProvider } from "@mdx-js/react";
118
- import { getCustomMDXComponent } from "@theme";
119
-
120
- // src/theme-default/components/Aside/index.tsx
121
- import { useEffect as useEffect3 } from "react";
122
-
123
- // src/theme-default/logic/usePrevNextPage.ts
124
- import { useLocation as useLocation2 } from "react-router-dom";
125
-
126
- // src/theme-default/logic/useSidebarData.ts
127
- import { useEffect, useState } from "react";
128
-
129
- // src/theme-default/logic/useLocaleSiteData.ts
130
- import { usePageData as usePageData2 } from "@/runtime";
131
- function useLocaleSiteData() {
132
- var _a, _b, _c;
133
- const pageData = usePageData2();
134
- const {
135
- page: { lang }
136
- } = pageData;
137
- const themeConfig = (_b = (_a = pageData == null ? void 0 : pageData.siteData) == null ? void 0 : _a.themeConfig) != null ? _b : {};
138
- const defaultLang = (_c = pageData.siteData.lang) != null ? _c : "";
139
- const locales = themeConfig == null ? void 0 : themeConfig.locales;
140
- if (!locales || locales.length === 0) {
141
- return {
142
- nav: themeConfig.nav,
143
- sidebar: themeConfig.sidebar,
144
- prevPageText: themeConfig.prevPageText,
145
- nextPageText: themeConfig.nextPageText
146
- };
147
- }
148
- const localeInfo = locales.find((locale) => locale.lang === lang);
149
- return __spreadProps(__spreadValues({}, localeInfo), {
150
- langRoutePrefix: lang === defaultLang ? "/" : lang
151
- });
152
- }
153
-
154
- // src/theme-default/logic/useSidebarData.ts
155
- import { useLocation, withBase, isEqualPath } from "@/runtime";
156
- var getSidebarGroupData = (sidebar, currentPathname) => {
157
- for (const name of Object.keys(sidebar)) {
158
- if (isEqualPath(withBase(name), currentPathname)) {
159
- return {
160
- group: "Documentation",
161
- items: sidebar[name]
162
- };
163
- }
164
- const result = sidebar[name].find((group) => {
165
- const match = (item) => {
166
- const equalFunc = () => isEqualPath(withBase(item.link), currentPathname);
167
- if ("items" in item) {
168
- if (equalFunc()) {
169
- return true;
170
- }
171
- return item.items.some((i) => match(i));
172
- } else {
173
- return equalFunc();
174
- }
175
- };
176
- return match(group);
177
- });
178
- if (result) {
179
- const sidebarGroup = sidebar[name];
180
- return {
181
- group: result.text || "",
182
- items: sidebarGroup
183
- };
184
- }
185
- }
186
- return {
187
- group: "Documentation",
188
- items: []
189
- };
190
- };
191
- function useSidebarData() {
192
- var _a;
193
- const localeData = useLocaleSiteData();
194
- const sidebar = (_a = localeData.sidebar) != null ? _a : {};
195
- const { pathname: rawPathname } = useLocation();
196
- const pathname = decodeURIComponent(rawPathname);
197
- const [sidebarData, setSidebarData] = useState(
198
- getSidebarGroupData(sidebar, pathname)
199
- );
200
- useEffect(() => {
201
- const newSidebarData = getSidebarGroupData(sidebar, pathname);
202
- setSidebarData(newSidebarData);
203
- }, [pathname, localeData.lang]);
204
- return sidebarData;
205
- }
206
-
207
- // src/theme-default/logic/usePrevNextPage.ts
208
- import { withBase as withBase2, isEqualPath as isEqualPath2 } from "@/runtime";
209
- function usePrevNextPage() {
210
- const { pathname } = useLocation2();
211
- const { items } = useSidebarData();
212
- const flattenTitles = [];
213
- const walk = (sidebarItem) => {
214
- if ("items" in sidebarItem) {
215
- if (sidebarItem.link) {
216
- flattenTitles.push({
217
- text: sidebarItem.text,
218
- link: sidebarItem.link
219
- });
220
- }
221
- sidebarItem.items.forEach((item) => {
222
- walk(item);
223
- });
224
- } else {
225
- flattenTitles.push(sidebarItem);
226
- }
227
- };
228
- items.forEach((item) => walk(item));
229
- const pageIndex = flattenTitles.findIndex(
230
- (item) => isEqualPath2(withBase2(item.link), pathname)
231
- );
232
- const prevPage = flattenTitles[pageIndex - 1] || null;
233
- const nextPage = flattenTitles[pageIndex + 1] || null;
234
- return {
235
- prevPage,
236
- nextPage
237
- };
238
- }
239
-
240
- // src/theme-default/logic/useEditLink.ts
241
- import { usePageData as usePageData3 } from "@/runtime";
242
- function useEditLink() {
243
- var _a, _b, _c;
244
- const { siteData: siteData2, page } = usePageData3();
245
- const locales = useLocaleSiteData();
246
- const editLink = (_c = (_b = locales.editLink) != null ? _b : (_a = siteData2.themeConfig) == null ? void 0 : _a.editLink) != null ? _c : {};
247
- if (!editLink.docRepoBaseUrl || !editLink.text) {
248
- return null;
249
- }
250
- let { docRepoBaseUrl } = editLink;
251
- if (!docRepoBaseUrl.endsWith("/")) {
252
- docRepoBaseUrl += "/";
253
- }
254
- const relativePagePath = page._relativePath.replace(/\\/g, "/");
255
- const link = `${docRepoBaseUrl}${relativePagePath}`;
256
- return {
257
- text: editLink.text,
258
- link
259
- };
260
- }
261
-
262
- // src/theme-default/logic/useHiddenNav.ts
263
- import { throttle } from "lodash-es";
264
- import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
265
- import { useLocation as useLocation3, usePageData as usePageData4 } from "@/runtime";
266
- function useDisableNav() {
267
- var _a;
268
- const {
269
- siteData: { themeConfig },
270
- page: { frontmatter = {} }
271
- } = usePageData4();
272
- const initialState = !((_a = frontmatter == null ? void 0 : frontmatter.navbar) != null ? _a : true) || (themeConfig == null ? void 0 : themeConfig.hideNavbar) === "always";
273
- const [disableNav, setDisableNav] = useState2(initialState);
274
- return [disableNav, setDisableNav];
275
- }
276
- function useHiddenNav() {
277
- var _a;
278
- const {
279
- siteData: { themeConfig }
280
- } = usePageData4();
281
- const hiddenBehaivor = (_a = themeConfig.hideNavbar) != null ? _a : "never";
282
- const [hiddenNav, setHiddenNav] = useState2(false);
283
- const { pathname } = useLocation3();
284
- const lastScrollTop = useRef(0);
285
- if (hiddenBehaivor === "never") {
286
- return false;
287
- } else if (hiddenBehaivor === "always") {
288
- return true;
289
- } else {
290
- useEffect2(() => {
291
- setHiddenNav(false);
292
- const onScrollListen = throttle(() => {
293
- const { scrollTop } = document.documentElement;
294
- if (scrollTop === lastScrollTop.current) {
295
- return;
296
- }
297
- const shouldHidden = lastScrollTop.current > 0 && scrollTop - lastScrollTop.current > 0;
298
- setHiddenNav(shouldHidden);
299
- lastScrollTop.current = scrollTop <= 0 ? 0 : scrollTop;
300
- }, 200);
301
- window.addEventListener("mousewheel", onScrollListen);
302
- return () => {
303
- window.removeEventListener("mousewheel", onScrollListen);
304
- };
305
- }, [pathname]);
306
- return hiddenNav;
307
- }
308
- }
309
-
310
- // src/theme-default/logic/sideEffects.ts
311
- import { throttle as throttle2 } from "lodash-es";
312
- import { inBrowser } from "@rspress/shared";
313
- var DEFAULT_NAV_HEIGHT = 72;
314
- function scrollToTarget(target, isSmooth, fallbackHeight = DEFAULT_NAV_HEIGHT) {
315
- const targetPadding = parseInt(
316
- window.getComputedStyle(target).paddingTop,
317
- 10
318
- );
319
- const targetTop = window.scrollY + target.getBoundingClientRect().top - fallbackHeight - targetPadding;
320
- window.scrollTo(__spreadValues({
321
- left: 0,
322
- top: targetTop
323
- }, isSmooth ? { behavior: "smooth" } : {}));
324
- }
325
- function bindingWindowScroll() {
326
- function scrollTo(el, hash, isSmooth = false) {
327
- let target = null;
328
- try {
329
- target = el.classList.contains("header-anchor") ? el : document.getElementById(decodeURIComponent(hash.slice(1)));
330
- } catch (e) {
331
- console.warn(e);
332
- }
333
- if (target) {
334
- scrollToTarget(target, isSmooth);
335
- }
336
- }
337
- window.addEventListener(
338
- "click",
339
- (e) => {
340
- const link = e.target.closest("a");
341
- if (link) {
342
- const { origin, hash, target, pathname, search } = link;
343
- const currentUrl = window.location;
344
- if (hash && target !== "_blank" && origin === currentUrl.origin) {
345
- if (pathname === currentUrl.pathname && search === currentUrl.search && hash && link.classList.contains("header-anchor")) {
346
- e.preventDefault();
347
- history.pushState(null, "", hash);
348
- scrollTo(link, hash, true);
349
- window.dispatchEvent(new Event("hashchange"));
350
- } else {
351
- window.addEventListener("RspressReloadContent", () => {
352
- if (location.hash.length > 1) {
353
- const ele = document.getElementById(location.hash.slice(1));
354
- scrollToTarget(ele, false);
355
- }
356
- });
357
- }
358
- }
359
- }
360
- },
361
- { capture: true }
362
- );
363
- window.addEventListener("hashchange", (e) => {
364
- e.preventDefault();
365
- });
366
- }
367
- function bindingAsideScroll() {
368
- function isBottom() {
369
- return document.documentElement.scrollTop + window.innerHeight >= document.documentElement.scrollHeight;
370
- }
371
- const aside = document.getElementById("aside-container");
372
- const links = Array.from(
373
- document.querySelectorAll(".rspress-doc .header-anchor")
374
- ).filter((item) => {
375
- var _a;
376
- return ((_a = item.parentElement) == null ? void 0 : _a.tagName) !== "H1";
377
- });
378
- if (!aside || !links.length) {
379
- return;
380
- }
381
- let prevActiveLink = null;
382
- const headers = Array.from((aside == null ? void 0 : aside.getElementsByTagName("a")) || []).map(
383
- (item) => decodeURIComponent(item.hash)
384
- );
385
- if (!headers.length) {
386
- return;
387
- }
388
- const activate = (links2, index) => {
389
- if (links2[index]) {
390
- const id = links2[index].getAttribute("href");
391
- const currentLink = aside == null ? void 0 : aside.querySelector(
392
- `a[href="#${id == null ? void 0 : id.slice(1)}"] > span`
393
- );
394
- if (currentLink) {
395
- if (prevActiveLink) {
396
- prevActiveLink.classList.remove("aside-active");
397
- }
398
- prevActiveLink = currentLink;
399
- prevActiveLink.classList.add("aside-active");
400
- }
401
- }
402
- };
403
- const setActiveLink = () => {
404
- if (isBottom()) {
405
- activate(links, links.length - 1);
406
- } else {
407
- for (let i = 0; i < links.length; i++) {
408
- const currentAnchor = links[i];
409
- const nextAnchor = links[i + 1];
410
- const scrollTop = Math.ceil(window.scrollY);
411
- const currentAnchorTop = currentAnchor.parentElement.offsetTop - DEFAULT_NAV_HEIGHT;
412
- if (i === 0 && scrollTop < currentAnchorTop || scrollTop === 0) {
413
- activate(links, 0);
414
- break;
415
- }
416
- if (!nextAnchor) {
417
- activate(links, i);
418
- break;
419
- }
420
- const nextAnchorTop = nextAnchor.parentElement.offsetTop - DEFAULT_NAV_HEIGHT;
421
- if (scrollTop >= currentAnchorTop && scrollTop < nextAnchorTop) {
422
- activate(links, i);
423
- break;
424
- }
425
- }
426
- }
427
- };
428
- const throttledSetLink = throttle2(setActiveLink, 200);
429
- window.addEventListener("scroll", throttledSetLink);
430
- return () => {
431
- window.removeEventListener("scroll", throttledSetLink);
432
- };
433
- }
434
- function setup() {
435
- if (!inBrowser()) {
436
- return;
437
- }
438
- bindingWindowScroll();
439
- }
440
-
441
- // src/theme-default/logic/usePathUtils.ts
442
- import { isExternalUrl } from "@rspress/shared";
443
- import {
444
- removeBase,
445
- useLang,
446
- usePageData as usePageData5,
447
- normalizeHrefInRuntime as normalizeHref,
448
- useVersion,
449
- withBase as withBase3
450
- } from "@/runtime";
451
- function usePathUtils() {
452
- const currentLang = useLang();
453
- const currentVersion = useVersion();
454
- const pageData = usePageData5();
455
- const defaultLang = pageData.siteData.lang;
456
- const defaultVersion = pageData.siteData.multiVersion.default;
457
- const normalizeLinkHref = (rawHref) => {
458
- let href = rawHref;
459
- if ((defaultLang || defaultVersion) && !isExternalUrl(href) && !href.startsWith("#")) {
460
- href = removeBase(href);
461
- const linkParts = href.split("/").filter(Boolean);
462
- let versionPart = "";
463
- let langPart = "";
464
- let purePathPart = "";
465
- if (defaultVersion) {
466
- if (currentVersion !== defaultVersion) {
467
- versionPart = currentVersion;
468
- if (linkParts[0] === currentVersion) {
469
- linkParts.shift();
470
- }
471
- } else if (linkParts[0] === defaultVersion) {
472
- linkParts.shift();
473
- }
474
- }
475
- if (defaultLang) {
476
- if (currentLang !== defaultLang) {
477
- langPart = currentLang;
478
- if (linkParts[0] === currentLang) {
479
- linkParts.shift();
480
- }
481
- } else if (linkParts[0] === defaultLang) {
482
- linkParts.shift();
483
- }
484
- }
485
- purePathPart = linkParts.join("/");
486
- return normalizeHref(
487
- withBase3(
488
- [versionPart, langPart, purePathPart].filter(Boolean).join("/")
489
- )
490
- );
491
- } else {
492
- return href;
493
- }
494
- };
495
- return {
496
- normalizeLinkHref
497
- };
498
- }
499
-
500
- // src/theme-default/logic/utils.ts
501
- import { isEqualPath as isEqualPath3 } from "@/runtime";
502
- function isActive(currentPath, targetLink, strict = false) {
503
- if (!targetLink) {
504
- return false;
505
- }
506
- if (strict) {
507
- return isEqualPath3(currentPath, targetLink);
508
- } else {
509
- return isEqualPath3(currentPath, targetLink) || currentPath.startsWith(targetLink);
510
- }
511
- }
512
- function isExternalHref(href) {
513
- return /^https?:\/\//.test(href);
514
- }
515
- function getLogoUrl(rawLogo, theme) {
516
- if (typeof rawLogo === "string") {
517
- return rawLogo;
518
- }
519
- return theme === "dark" ? rawLogo.dark : rawLogo.light;
520
- }
521
- function isMobileDevice() {
522
- return window.innerWidth < 768;
523
- }
524
-
525
- // src/theme-default/components/Aside/index.tsx
526
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
527
- function Aside(props) {
528
- var _a;
529
- const { headers } = props;
530
- const hasOutline = headers.length > 0;
531
- const baseHeaderLevel = ((_a = headers[0]) == null ? void 0 : _a.depth) || 2;
532
- const hiddenNav = useHiddenNav();
533
- useEffect3(() => {
534
- let unbinding;
535
- setTimeout(() => {
536
- unbinding = bindingAsideScroll();
537
- }, 100);
538
- const hash = decodeURIComponent(window.location.hash);
539
- if (!hash) {
540
- window.scrollTo(0, 0);
541
- } else {
542
- const target = document.getElementById(hash.slice(1));
543
- if (target) {
544
- scrollToTarget(target, false, hiddenNav ? 0 : DEFAULT_NAV_HEIGHT);
545
- }
546
- }
547
- return () => {
548
- if (unbinding) {
549
- unbinding();
550
- }
551
- };
552
- }, [headers]);
553
- const renderHeader = (header) => {
554
- return /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsx2(
555
- "a",
556
- {
557
- href: `#${header.id}`,
558
- className: "aside-link transition-all duration-300 hover:text-text-1 text-text-2 block",
559
- style: {
560
- paddingLeft: (header.depth - baseHeaderLevel) * 12,
561
- fontWeight: "semibold"
562
- },
563
- onClick: (e) => {
564
- e.preventDefault();
565
- window.location.hash = header.id;
566
- const target = document.getElementById(header.id);
567
- if (target) {
568
- scrollToTarget(target, false, hiddenNav ? 0 : DEFAULT_NAV_HEIGHT);
569
- }
570
- },
571
- children: /* @__PURE__ */ jsx2("span", { className: "aside-link-text block", children: header.text })
572
- }
573
- ) }, header.id);
574
- };
575
- return /* @__PURE__ */ jsx2("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx2("div", { className: hasOutline ? `<lg:hidden` : "hidden", children: /* @__PURE__ */ jsxs2("div", { id: "aside-container", className: "relative text-sm font-medium", children: [
576
- /* @__PURE__ */ jsx2("div", { className: "leading-7 block text-sm font-semibold pl-3", children: props.outlineTitle }),
577
- /* @__PURE__ */ jsx2("nav", { className: "mt-1", children: /* @__PURE__ */ jsx2("ul", { className: "relative", children: headers.map(renderHeader) }) })
578
- ] }) }) });
579
- }
580
-
581
- // src/theme-default/components/EditLink/index.module.scss
582
- var index_module_default = { "editLink": "editLink_d8024" };
583
-
584
- // src/theme-default/components/EditLink/index.tsx
585
- import { jsx as jsx3 } from "react/jsx-runtime";
586
- function EditLink() {
587
- const editLinkObj = useEditLink();
588
- if (!editLinkObj) {
589
- return null;
590
- }
591
- const { text, link } = editLinkObj;
592
- return /* @__PURE__ */ jsx3("a", { href: link, target: "_blank", className: index_module_default.editLink, children: text });
593
- }
594
-
595
- // src/theme-default/components/Link/index.tsx
596
- import { matchRoutes, useLocation as useLocation4, useNavigate } from "react-router-dom";
597
- import nprogress from "nprogress";
598
- import { routes } from "virtual-routes";
599
-
600
- // src/theme-default/components/Link/index.module.scss
601
- var index_module_default2 = { "link": "link_2625c" };
602
-
603
- // src/theme-default/components/Link/index.tsx
604
- import {
605
- normalizeHrefInRuntime as normalizeHref2,
606
- normalizeRoutePath,
607
- withBase as withBase4
608
- } from "@/runtime";
609
- import { jsx as jsx4 } from "react/jsx-runtime";
610
- nprogress.configure({ showSpinner: false });
611
- var EXTERNAL_URL_RE = /^(https?:)?\/\//;
612
- function Link(props) {
613
- const { href = "/", children, className = "", onNavigate } = props;
614
- const isExternal = EXTERNAL_URL_RE.test(href);
615
- const target = isExternal ? "_blank" : "";
616
- const rel = isExternal ? "noopener noreferrer" : void 0;
617
- const withBaseUrl = isExternal ? href : withBase4(normalizeHref2(href));
618
- const navigate = useNavigate();
619
- const { pathname } = useLocation4();
620
- const inCurrentPage = withBaseUrl.startsWith(pathname);
621
- const handleNavigate = (e) => __async(this, null, function* () {
622
- e.preventDefault();
623
- const hash = withBaseUrl.split("#")[1];
624
- if (!isExternal && inCurrentPage && hash) {
625
- const el = document.getElementById(hash);
626
- if (el) {
627
- scrollToTarget(el, true);
628
- }
629
- return;
630
- }
631
- if (!process.env.__SSR__) {
632
- const matchedRoutes = matchRoutes(
633
- routes,
634
- normalizeRoutePath(withBaseUrl)
635
- );
636
- if (matchedRoutes == null ? void 0 : matchedRoutes.length) {
637
- const timer = setTimeout(() => {
638
- nprogress.start();
639
- }, 200);
640
- yield matchedRoutes[0].route.preload();
641
- clearTimeout(timer);
642
- nprogress.done();
643
- }
644
- onNavigate == null ? void 0 : onNavigate();
645
- navigate(withBaseUrl, { replace: false });
646
- }
647
- });
648
- if (!isExternal) {
649
- return /* @__PURE__ */ jsx4(
650
- "a",
651
- {
652
- className: `${index_module_default2.link} ${className} cursor-pointer`,
653
- rel,
654
- target,
655
- onClick: handleNavigate,
656
- href: withBaseUrl,
657
- children
658
- }
659
- );
660
- } else {
661
- return /* @__PURE__ */ jsx4(
662
- "a",
663
- {
664
- href: withBaseUrl,
665
- target,
666
- rel,
667
- className: `${index_module_default2.link} ${className}`,
668
- children
669
- }
670
- );
671
- }
672
- }
673
-
674
- // src/theme-default/components/DocFooter/index.module.scss
675
- var index_module_default3 = { "pager": "pager_cd2c7", "has-next": "has-next_cd2c7", "hasNext": "has-next_cd2c7", "prev": "prev_cd2c7", "next": "next_cd2c7", "pager-link": "pager-link_cd2c7", "pagerLink": "pager-link_cd2c7", "title": "title_cd2c7", "desc": "desc_cd2c7" };
676
-
677
- // src/theme-default/components/DocFooter/index.tsx
678
- import {
679
- normalizeHrefInRuntime as normalizeHref3,
680
- usePageData as usePageData6
681
- } from "@/runtime";
682
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
683
- function DocFooter() {
684
- const { prevPage, nextPage } = usePrevNextPage();
685
- const {
686
- prevPageText = "Previous Page",
687
- nextPageText = "Next page",
688
- lastUpdatedText: localesLastUpdatedText = "Last Updated",
689
- lastUpdated: localesLastUpdated = false
690
- } = useLocaleSiteData();
691
- const {
692
- page: { lastUpdatedTime },
693
- siteData: siteData2
694
- } = usePageData6();
695
- const { themeConfig } = siteData2;
696
- const lastUpdatedText = (themeConfig == null ? void 0 : themeConfig.lastUpdatedText) || localesLastUpdatedText;
697
- const showLastUpdated = themeConfig.lastUpdated || localesLastUpdated;
698
- return /* @__PURE__ */ jsxs3("footer", { className: "mt-8", children: [
699
- /* @__PURE__ */ jsx5("div", { className: "xs:flex pb-5 px-2 justify-end items-center", children: showLastUpdated && /* @__PURE__ */ jsxs3("div", { className: "flex text-sm text-text-2 leading-6 sm:leading-8 font-medium", children: [
700
- /* @__PURE__ */ jsxs3("p", { children: [
701
- lastUpdatedText,
702
- ": "
703
- ] }),
704
- /* @__PURE__ */ jsx5("span", { children: lastUpdatedTime })
705
- ] }) }),
706
- /* @__PURE__ */ jsx5("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx5(EditLink, {}) }),
707
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row sm:justify-around gap-4 pt-6", children: [
708
- /* @__PURE__ */ jsx5("div", { className: `${index_module_default3.prev} flex flex-col`, children: prevPage ? /* @__PURE__ */ jsxs3(
709
- Link,
710
- {
711
- href: normalizeHref3(prevPage.link),
712
- className: index_module_default3.pagerLink,
713
- children: [
714
- /* @__PURE__ */ jsx5("span", { className: index_module_default3.desc, children: prevPageText }),
715
- /* @__PURE__ */ jsx5("span", { className: index_module_default3.title, children: prevPage.text })
716
- ]
717
- }
718
- ) : null }),
719
- /* @__PURE__ */ jsx5("div", { className: `${index_module_default3.next} flex flex-col`, children: nextPage ? /* @__PURE__ */ jsxs3(
720
- Link,
721
- {
722
- href: normalizeHref3(nextPage.link),
723
- className: `${index_module_default3.pagerLink} ${index_module_default3.next}`,
724
- children: [
725
- /* @__PURE__ */ jsx5("span", { className: index_module_default3.desc, children: nextPageText }),
726
- /* @__PURE__ */ jsx5("span", { className: index_module_default3.title, children: nextPage.text })
727
- ]
728
- }
729
- ) : null })
730
- ] })
731
- ] });
732
- }
733
-
734
- // src/theme-default/components/LocalSideBar/index.tsx
735
- import { Fragment as Fragment2, useEffect as useEffect8, useState as useState5 } from "react";
736
-
737
- // src/theme-default/components/Sidebar/index.tsx
738
- import { useEffect as useEffect7, useState as useState4 } from "react";
739
- import {
740
- normalizeSlash
741
- } from "@rspress/shared";
742
- import { routes as routes2 } from "virtual-routes";
743
-
744
- // src/theme-default/components/Nav/NavBarTitle.tsx
745
- import { useContext, useEffect as useEffect4, useState as useState3 } from "react";
746
-
747
- // src/theme-default/components/Nav/index.module.scss
748
- var index_module_default4 = { "hidden": "hidden_1719c", "container": "container_1719c", "navContainer": "navContainer_1719c", "leftNav": "leftNav_1719c", "rightNav": "rightNav_1719c", "activeItem": "activeItem_1719c", "singleItem": "singleItem_1719c", "social-links-icon": "social-links-icon_1719c", "socialLinksIcon": "social-links-icon_1719c", "menu-item": "menu-item_1719c", "menuItem": "menu-item_1719c", "mobileNavMenu": "mobileNavMenu_1719c", "mask": "mask_1719c", "docPage": "docPage_1719c" };
749
-
750
- // src/theme-default/components/Nav/NavBarTitle.tsx
751
- import {
752
- ThemeContext,
753
- normalizeImagePath,
754
- usePageData as usePageData7,
755
- withBase as withBase5
756
- } from "@/runtime";
757
- import { jsx as jsx6 } from "react/jsx-runtime";
758
- var NavBarTitle = () => {
759
- var _a;
760
- const { siteData: siteData2 } = usePageData7();
761
- const localeData = useLocaleSiteData();
762
- const { logo: rawLogo } = siteData2;
763
- const title = (_a = localeData.title) != null ? _a : siteData2.title;
764
- const { theme } = useContext(ThemeContext);
765
- const [logo, setLogo] = useState3(getLogoUrl(rawLogo, theme));
766
- useEffect4(() => {
767
- setLogo(getLogoUrl(rawLogo, theme));
768
- }, [theme]);
769
- return /* @__PURE__ */ jsx6("div", { className: `${index_module_default4.navBarTitle}`, children: /* @__PURE__ */ jsx6(
770
- "a",
771
- {
772
- href: withBase5(localeData.langRoutePrefix || "/"),
773
- className: "flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",
774
- children: logo ? /* @__PURE__ */ jsx6(
775
- "img",
776
- {
777
- src: normalizeImagePath(logo),
778
- alt: "logo",
779
- id: "logo",
780
- className: "mr-4 rspress-logo",
781
- style: { height: "1.6rem" }
782
- }
783
- ) : /* @__PURE__ */ jsx6("span", { children: title })
784
- }
785
- ) });
786
- };
787
-
788
- // src/theme-default/components/Sidebar/index.module.scss
789
- var index_module_default5 = { "navTitleMask": "navTitleMask_82695", "sidebar": "sidebar_82695", "sidebarContent": "sidebarContent_82695", "open": "open_82695", "menuLink": "menuLink_82695", "menuItem": "menuItem_82695", "collapseContainer": "collapseContainer_82695", "menuItemStatic": "menuItemStatic_82695", "menuItemActive": "menuItemActive_82695", "menuGroupActive": "menuGroupActive_82695" };
790
-
791
- // src/theme-default/components/Sidebar/SidebarItem.tsx
792
- import { useEffect as useEffect6, useRef as useRef3 } from "react";
793
-
794
- // src/theme-default/components/Tag/index.tsx
795
- import { jsx as jsx7 } from "react/jsx-runtime";
796
- var Tag = ({ tag }) => {
797
- if (!tag) {
798
- return null;
799
- }
800
- const isSvgTagString = tag.trim().startsWith("<svg");
801
- if (isSvgTagString) {
802
- return /* @__PURE__ */ jsx7(
803
- "div",
804
- {
805
- dangerouslySetInnerHTML: { __html: tag },
806
- style: { width: 20, marginRight: 4 }
807
- }
808
- );
809
- } else {
810
- return /* @__PURE__ */ jsx7("img", { src: tag });
811
- }
812
- };
813
-
814
- // src/theme-default/components/Sidebar/SidebarGroup.tsx
815
- import { useEffect as useEffect5, useRef as useRef2 } from "react";
816
- import { useNavigate as useNavigate2 } from "react-router-dom";
817
-
818
- // src/theme-default/assets/arrow-right.svg
819
- import * as React from "react";
820
- import { jsx as jsx8 } from "react/jsx-runtime";
821
- var SvgArrowRight = (props) => /* @__PURE__ */ jsx8("svg", __spreadProps(__spreadValues({ width: "1em", height: "1em", viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx8("path", { fill: "currentColor", d: "M22 16 12 26l-1.4-1.4 8.6-8.6-8.6-8.6L12 6z" }) }));
822
- var arrow_right_default = SvgArrowRight;
823
-
824
- // src/theme-default/components/Sidebar/SidebarGroup.tsx
825
- import { normalizeHrefInRuntime as normalizeHref4, withBase as withBase6 } from "@/runtime";
826
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
827
- function SidebarGroup(props) {
828
- var _a;
829
- const { item, depth = 0, activeMatcher, id, setSidebarData } = props;
830
- const navigate = useNavigate2();
831
- const isGroupMatched = matchCache.get(item);
832
- const containerRef = useRef2(null);
833
- const transitionRef = useRef2(null);
834
- const innerRef = useRef2(null);
835
- const initialRender = useRef2(true);
836
- const initialState = useRef2(item.collapsed);
837
- const active = item.link && activeMatcher(item.link);
838
- const { collapsed, collapsible = true } = item;
839
- const collapsibleIcon = /* @__PURE__ */ jsx9(
840
- "div",
841
- {
842
- style: {
843
- cursor: "pointer",
844
- transition: "transform 0.2s ease-out",
845
- transform: collapsed ? "rotate(0deg)" : "rotate(90deg)"
846
- },
847
- children: /* @__PURE__ */ jsx9(arrow_right_default, {})
848
- }
849
- );
850
- useEffect5(() => {
851
- if (initialRender.current) {
852
- return;
853
- }
854
- if (!containerRef.current || !innerRef.current) {
855
- return;
856
- }
857
- if (transitionRef.current) {
858
- clearTimeout(transitionRef.current);
859
- }
860
- const container = containerRef.current;
861
- const inner = innerRef.current;
862
- const contentHeight = inner.clientHeight + 4;
863
- if (collapsed) {
864
- container.style.maxHeight = `${contentHeight}px`;
865
- container.style.transitionDuration = "0.5s";
866
- inner.style.opacity = "0";
867
- transitionRef.current = setTimeout(() => {
868
- if (containerRef.current) {
869
- containerRef.current.style.maxHeight = "0px";
870
- }
871
- }, 0);
872
- } else {
873
- container.style.maxHeight = `${contentHeight}px`;
874
- container.style.transitionDuration = "0.3s";
875
- inner.style.opacity = "1";
876
- transitionRef.current = setTimeout(() => {
877
- if (containerRef.current) {
878
- containerRef.current.style.removeProperty("max-height");
879
- }
880
- }, 300);
881
- }
882
- }, [collapsed]);
883
- useEffect5(() => {
884
- initialRender.current = false;
885
- }, []);
886
- const toggleCollapse = (e) => {
887
- e.stopPropagation();
888
- setSidebarData((sidebarData) => {
889
- const newSidebarData = [...sidebarData];
890
- const indexes = id.split("-").map(Number);
891
- const initialIndex = indexes.shift();
892
- const root = newSidebarData[initialIndex];
893
- let current = root;
894
- for (const index of indexes) {
895
- current = current.items[index];
896
- }
897
- if ("items" in current) {
898
- current.collapsed = !current.collapsed;
899
- }
900
- return newSidebarData;
901
- });
902
- };
903
- return /* @__PURE__ */ jsxs4(
904
- "section",
905
- {
906
- className: "mt-0.5 block",
907
- style: {
908
- marginLeft: depth === 0 ? 0 : "18px"
909
- },
910
- children: [
911
- /* @__PURE__ */ jsxs4(
912
- "div",
913
- {
914
- className: `flex justify-between items-center ${isGroupMatched && !active ? index_module_default5.menuGroupActive : ""} ${// eslint-disable-next-line no-nested-ternary
915
- active ? index_module_default5.menuItemActive : collapsible || item.link ? index_module_default5.menuItem : index_module_default5.menuItemStatic}`,
916
- onMouseEnter: () => item.link && props.preloadLink(item.link),
917
- onClick: (e) => {
918
- if (item.link) {
919
- navigate(withBase6(normalizeHref4(item.link)));
920
- collapsed && toggleCollapse(e);
921
- } else {
922
- collapsible && toggleCollapse(e);
923
- }
924
- },
925
- style: {
926
- borderRadius: depth === 0 ? "0 1rem 1rem 0" : void 0,
927
- cursor: collapsible || item.link ? "pointer" : "normal"
928
- },
929
- children: [
930
- /* @__PURE__ */ jsxs4(
931
- "h2",
932
- {
933
- className: "py-2 px-3 text-sm font-medium flex",
934
- style: __spreadValues({}, depth === 0 ? highlightTitleStyle : {}),
935
- children: [
936
- /* @__PURE__ */ jsx9(Tag, { tag: item.tag }),
937
- item.text
938
- ]
939
- }
940
- ),
941
- collapsible && /* @__PURE__ */ jsx9(
942
- "div",
943
- {
944
- className: `${index_module_default5.collapseContainer} p-2 rounded-xl`,
945
- onClick: toggleCollapse,
946
- children: collapsibleIcon
947
- }
948
- )
949
- ]
950
- }
951
- ),
952
- /* @__PURE__ */ jsx9(
953
- "div",
954
- {
955
- ref: containerRef,
956
- className: "transition-all duration-300 ease-in-out",
957
- style: {
958
- overflow: "hidden",
959
- maxHeight: initialState.current ? 0 : void 0
960
- },
961
- children: /* @__PURE__ */ jsx9(
962
- "div",
963
- {
964
- ref: innerRef,
965
- className: "rspress-sidebar-group transition-opacity duration-500 ease-in-out",
966
- style: {
967
- opacity: initialState.current ? 0 : 1,
968
- marginLeft: depth === 0 ? "12px" : 0
969
- },
970
- children: (_a = item == null ? void 0 : item.items) == null ? void 0 : _a.map((item2, index) => (
971
- // eslint-disable-next-line react/no-array-index-key
972
- /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(
973
- SidebarItem,
974
- __spreadProps(__spreadValues({}, props), {
975
- item: item2,
976
- depth: depth + 1,
977
- id: `${id}-${index}`,
978
- preloadLink: props.preloadLink
979
- })
980
- ) }, index)
981
- ))
982
- }
983
- )
984
- }
985
- )
986
- ]
987
- },
988
- id
989
- );
990
- }
991
-
992
- // src/theme-default/components/Sidebar/SidebarItem.tsx
993
- import { normalizeHrefInRuntime as normalizeHref5 } from "@/runtime";
994
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
995
- function SidebarItem(props) {
996
- const { item, depth = 0, activeMatcher, id, setSidebarData } = props;
997
- const active = item.link && activeMatcher(item.link);
998
- const ref = useRef3(null);
999
- useEffect6(() => {
1000
- var _a;
1001
- if (active) {
1002
- (_a = ref.current) == null ? void 0 : _a.scrollIntoView({
1003
- block: "center"
1004
- });
1005
- }
1006
- }, []);
1007
- const { text } = item;
1008
- if ("items" in item) {
1009
- return /* @__PURE__ */ jsx10(
1010
- SidebarGroup,
1011
- {
1012
- id,
1013
- item,
1014
- depth,
1015
- activeMatcher,
1016
- collapsed: item.collapsed,
1017
- setSidebarData,
1018
- preloadLink: props.preloadLink
1019
- },
1020
- `${item.text}-${id}`
1021
- );
1022
- } else {
1023
- return /* @__PURE__ */ jsx10(Link, { href: normalizeHref5(item.link), className: index_module_default5.menuLink, children: /* @__PURE__ */ jsxs5(
1024
- "div",
1025
- {
1026
- ref,
1027
- onMouseEnter: () => props.preloadLink(item.link),
1028
- className: `${active ? index_module_default5.menuItemActive : index_module_default5.menuItem} mt-0.5 py-2 px-3 font-medium flex`,
1029
- style: __spreadValues(__spreadValues({
1030
- // The first level menu item will have the same font size as the sidebar group
1031
- fontSize: depth === 0 ? "14px" : "13px",
1032
- marginLeft: depth === 0 ? 0 : "18px",
1033
- borderRadius: "0 1rem 1rem 0"
1034
- }, depth === 0 ? highlightTitleStyle : {}), active ? { color: "var(--rp-c-brand)" } : {}),
1035
- children: [
1036
- /* @__PURE__ */ jsx10(Tag, { tag: item.tag }),
1037
- text
1038
- ]
1039
- }
1040
- ) });
1041
- }
1042
- }
1043
-
1044
- // src/theme-default/components/Sidebar/index.tsx
1045
- import { matchRoutes as matchRoutes2, useLocation as useLocation5, removeBase as removeBase2 } from "@/runtime";
1046
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1047
- var highlightTitleStyle = {
1048
- color: "var(--rp-c-text-1)",
1049
- fontSize: "14px",
1050
- paddingLeft: "24px",
1051
- fontWeight: "bold"
1052
- };
1053
- var matchCache = /* @__PURE__ */ new WeakMap();
1054
- function SideBar(props) {
1055
- const { isSidebarOpen } = props;
1056
- const { items: rawSidebarData } = useSidebarData();
1057
- const localesData = useLocaleSiteData();
1058
- const { pathname: rawPathname } = useLocation5();
1059
- const langRoutePrefix = normalizeSlash(localesData.langRoutePrefix || "");
1060
- const [hideNavbar] = useDisableNav();
1061
- const [sidebarData, setSidebarData] = useState4(rawSidebarData.filter(Boolean).flat());
1062
- const pathname = decodeURIComponent(rawPathname);
1063
- useEffect7(() => {
1064
- if (rawSidebarData === sidebarData) {
1065
- return;
1066
- }
1067
- matchCache = /* @__PURE__ */ new WeakMap();
1068
- const match = (item) => {
1069
- if (matchCache.has(item)) {
1070
- return matchCache.get(item);
1071
- }
1072
- if (item.link && activeMatcher(item.link)) {
1073
- matchCache.set(item, true);
1074
- return true;
1075
- }
1076
- if ("items" in item) {
1077
- const result = item.items.some((child) => match(child));
1078
- if (result) {
1079
- matchCache.set(item, true);
1080
- return true;
1081
- }
1082
- }
1083
- matchCache.set(item, false);
1084
- return false;
1085
- };
1086
- const traverse = (item) => {
1087
- if ("items" in item) {
1088
- item.items.forEach(traverse);
1089
- if (match(item)) {
1090
- item.collapsed = false;
1091
- }
1092
- }
1093
- };
1094
- const newSidebarData = rawSidebarData.filter(Boolean).flat();
1095
- newSidebarData.forEach(traverse);
1096
- setSidebarData(newSidebarData);
1097
- }, [rawSidebarData, pathname]);
1098
- const removeLangPrefix = (path) => {
1099
- return path.replace(langRoutePrefix, "");
1100
- };
1101
- const activeMatcher = (path) => isActive(
1102
- removeBase2(removeLangPrefix(pathname)),
1103
- removeLangPrefix(path),
1104
- true
1105
- );
1106
- const preloadLink = (link) => {
1107
- const match = matchRoutes2(routes2, link);
1108
- if (match == null ? void 0 : match.length) {
1109
- const { route } = match[0];
1110
- route.preload();
1111
- }
1112
- };
1113
- return /* @__PURE__ */ jsxs6(
1114
- "aside",
1115
- {
1116
- className: `${index_module_default5.sidebar} rspress-sidebar ${isSidebarOpen ? index_module_default5.open : ""}`,
1117
- children: [
1118
- hideNavbar ? null : /* @__PURE__ */ jsx11("div", { className: index_module_default5.navTitleMask, children: /* @__PURE__ */ jsx11(NavBarTitle, {}) }),
1119
- /* @__PURE__ */ jsx11("div", { className: `mt-1 ${index_module_default5.sidebarContent}`, children: /* @__PURE__ */ jsx11(
1120
- "div",
1121
- {
1122
- className: "rspress-scrollbar",
1123
- style: {
1124
- maxHeight: "calc(100vh - var(--rp-nav-height) - 8px)",
1125
- overflow: "scroll"
1126
- },
1127
- children: /* @__PURE__ */ jsx11("nav", { className: "pb-2", children: sidebarData.map(
1128
- (item, index) => {
1129
- var _a;
1130
- return /* @__PURE__ */ jsx11(
1131
- SidebarItem,
1132
- {
1133
- id: String(index),
1134
- item,
1135
- depth: 0,
1136
- activeMatcher,
1137
- collapsed: (_a = item.collapsed) != null ? _a : true,
1138
- setSidebarData,
1139
- preloadLink
1140
- },
1141
- index
1142
- );
1143
- }
1144
- ) })
1145
- }
1146
- ) })
1147
- ]
1148
- }
1149
- );
1150
- }
1151
-
1152
- // src/theme-default/assets/menu.svg
1153
- import * as React4 from "react";
1154
- import { jsx as jsx12 } from "react/jsx-runtime";
1155
- var SvgMenu = (props) => /* @__PURE__ */ jsx12("svg", __spreadProps(__spreadValues({ width: "1em", height: "1em", viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx12("path", { fill: "currentColor", d: "M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z" }) }));
1156
- var menu_default = SvgMenu;
1157
-
1158
- // src/theme-default/components/LocalSideBar/index.tsx
1159
- import { useLocation as useLocation6 } from "@/runtime";
1160
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1161
- function SideMenu() {
1162
- const [isSidebarOpen, setIsOpen] = useState5(false);
1163
- const { pathname } = useLocation6();
1164
- function openSidebar() {
1165
- setIsOpen(true);
1166
- }
1167
- function closeSidebar() {
1168
- setIsOpen(false);
1169
- }
1170
- useEffect8(() => {
1171
- setIsOpen(false);
1172
- }, [pathname]);
1173
- return /* @__PURE__ */ jsxs7(Fragment2, { children: [
1174
- /* @__PURE__ */ jsx13("div", { className: "rspress-sidebar-menu", children: /* @__PURE__ */ jsxs7("button", { onClick: openSidebar, className: "flex-center", children: [
1175
- /* @__PURE__ */ jsx13("div", { className: "text-md mr-2", children: /* @__PURE__ */ jsx13(menu_default, {}) }),
1176
- /* @__PURE__ */ jsx13("span", { className: "text-sm", children: "Menu" })
1177
- ] }) }),
1178
- /* @__PURE__ */ jsx13(SideBar, { isSidebarOpen }),
1179
- isSidebarOpen ? /* @__PURE__ */ jsx13("div", { onClick: closeSidebar, className: "rspress-sidebar-back-drop" }) : null
1180
- ] });
1181
- }
1182
-
1183
- // src/theme-default/components/Overview/index.tsx
1184
- import { useMemo } from "react";
1185
-
1186
- // src/theme-default/components/Overview/index.module.scss
1187
- var index_module_default6 = { "header-anchor": "header-anchor_aab16", "headerAnchor": "header-anchor_aab16", "overview-groups": "overview-groups_aab16", "overviewGroups": "overview-groups_aab16", "overview-group-li": "overview-group-li_aab16", "overviewGroupLi": "overview-group-li_aab16", "level-2": "level-2_aab16", "level2": "level-2_aab16", "overview-group": "overview-group_aab16", "overviewGroup": "overview-group_aab16", "header": "header_aab16" };
1188
-
1189
- // src/theme-default/components/Overview/index.tsx
1190
- import {
1191
- usePageData as usePageData8,
1192
- normalizeHrefInRuntime as normalizeHref6,
1193
- withBase as withBase7,
1194
- isEqualPath as isEqualPath4
1195
- } from "@/runtime";
1196
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1197
- var DEFAULT_GROUP = "Others";
1198
- function Overview(props) {
1199
- const {
1200
- siteData: siteData2,
1201
- page: { routePath, title }
1202
- } = usePageData8();
1203
- const { pages } = siteData2;
1204
- const overviewModules = pages.filter(
1205
- (page) => page.routePath.startsWith(routePath.replace(/overview$/, "")) && page.routePath !== routePath
1206
- );
1207
- const { items: overviewSidebarGroups } = useSidebarData();
1208
- function normalizeSidebarItem(item) {
1209
- var _a;
1210
- const pageModule = overviewModules.find(
1211
- (m) => isEqualPath4(m.routePath, withBase7(item.link || ""))
1212
- );
1213
- const getChildLink = (traverseItem) => {
1214
- if (traverseItem.link) {
1215
- return traverseItem.link;
1216
- }
1217
- if ("items" in traverseItem) {
1218
- return getChildLink(traverseItem.items[0]);
1219
- }
1220
- return "";
1221
- };
1222
- const link = getChildLink(item);
1223
- return __spreadProps(__spreadValues({}, item), {
1224
- link,
1225
- headers: ((_a = pageModule == null ? void 0 : pageModule.toc) == null ? void 0 : _a.filter((header) => header.depth === 2)) || []
1226
- });
1227
- }
1228
- const groups = useMemo(() => {
1229
- const group = overviewSidebarGroups.filter((item) => "items" in item).map((sidebarGroup) => ({
1230
- name: sidebarGroup.text || "",
1231
- items: sidebarGroup.items.map(normalizeSidebarItem).filter(Boolean)
1232
- }));
1233
- const singleLinks = overviewSidebarGroups.filter(
1234
- (item) => !("items" in item) && !isEqualPath4(item.link || "", routePath)
1235
- );
1236
- return [
1237
- ...group,
1238
- ...singleLinks.length > 0 ? [
1239
- {
1240
- name: DEFAULT_GROUP,
1241
- items: singleLinks.map(normalizeSidebarItem)
1242
- }
1243
- ] : []
1244
- ];
1245
- }, [overviewSidebarGroups]);
1246
- return /* @__PURE__ */ jsxs8("div", { className: "overview-index mx-auto px-8", children: [
1247
- /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-between", children: !title && /* @__PURE__ */ jsx14("h1", { className: "text-3xl leading-10 tracking-tight", children: "Overview" }) }),
1248
- props.content,
1249
- groups.map((group) => /* @__PURE__ */ jsxs8("div", { className: "mb-16", children: [
1250
- group.name === DEFAULT_GROUP && groups.length === 1 ? /* @__PURE__ */ jsx14("h2", { style: { paddingTop: 0 } }) : /* @__PURE__ */ jsx14("h2", { children: group.name }),
1251
- /* @__PURE__ */ jsx14("div", { className: index_module_default6.overviewGroups, children: group.items.map((item) => {
1252
- var _a;
1253
- return /* @__PURE__ */ jsxs8("div", { className: index_module_default6.overviewGroup, children: [
1254
- /* @__PURE__ */ jsx14("div", { className: "flex", children: /* @__PURE__ */ jsx14("h3", { style: { marginBottom: 8 }, children: /* @__PURE__ */ jsx14(Link, { href: normalizeHref6(item.link), children: item.text }) }) }),
1255
- /* @__PURE__ */ jsx14("ul", { className: "list-none", children: (_a = item.headers) == null ? void 0 : _a.map((header) => /* @__PURE__ */ jsx14(
1256
- "li",
1257
- {
1258
- className: `${index_module_default6.overviewGroupLi} ${index_module_default6[`level${header.depth}`]} first:mt-2`,
1259
- children: /* @__PURE__ */ jsx14(Link, { href: `${normalizeHref6(item.link)}#${header.id}`, children: header.text })
1260
- },
1261
- header.id
1262
- )) })
1263
- ] }, item.link);
1264
- }) })
1265
- ] }, group.name))
1266
- ] });
1267
- }
1268
-
1269
- // src/theme-default/logic/TabDataContext.ts
1270
- import { createContext } from "react";
1271
- var TabDataContext = createContext(
1272
- {}
1273
- );
1274
-
1275
- // src/theme-default/layout/DocLayout/index.module.scss
1276
- var index_module_default7 = { "aside-container": "aside-container_c7b5e", "asideContainer": "aside-container_c7b5e", "fade-out": "fade-out_c7b5e", "fadeOut": "fade-out_c7b5e", "fade-in": "fade-in_c7b5e", "fadeIn": "fade-in_c7b5e", "docLayout": "docLayout_c7b5e", "content": "content_c7b5e" };
1277
-
1278
- // src/theme-default/layout/DocLayout/index.tsx
1279
- import { Content, useLocation as useLocation7, usePageData as usePageData9 } from "@/runtime";
1280
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1281
- function DocLayout(props) {
1282
- var _a, _b;
1283
- const { beforeDocFooter, beforeDoc, afterDoc, beforeOutline, afterOutline } = props;
1284
- const { siteData: siteData2, page } = usePageData9();
1285
- const { toc = [], frontmatter } = page;
1286
- const [tabData, setTabData] = useState6({});
1287
- const headers = toc;
1288
- const { themeConfig } = siteData2;
1289
- const localesData = useLocaleSiteData();
1290
- const sidebar = localesData.sidebar || {};
1291
- const [disableNavbar] = useDisableNav();
1292
- const hasSidebar = (frontmatter == null ? void 0 : frontmatter.sidebar) !== false && Object.keys(sidebar).length > 0;
1293
- const outlineTitle = (localesData == null ? void 0 : localesData.outlineTitle) || (themeConfig == null ? void 0 : themeConfig.outlineTitle) || "ON THIS PAGE";
1294
- const isOverviewPage = (_a = frontmatter == null ? void 0 : frontmatter.overview) != null ? _a : false;
1295
- const [hasFooter, setHasFooter] = useState6((_b = frontmatter == null ? void 0 : frontmatter.footer) != null ? _b : true);
1296
- const location2 = useLocation7();
1297
- const getHasAside = () => {
1298
- var _a2, _b2;
1299
- const defaultHasAside = typeof window === "undefined" ? true : window.top === window.self;
1300
- return (_b2 = (_a2 = frontmatter == null ? void 0 : frontmatter.outline) != null ? _a2 : themeConfig == null ? void 0 : themeConfig.outline) != null ? _b2 : defaultHasAside;
1301
- };
1302
- const [hasAside, setHasAside] = useState6(getHasAside());
1303
- useEffect9(() => {
1304
- setHasAside(getHasAside());
1305
- }, [page, siteData2]);
1306
- useEffect9(() => {
1307
- const query2 = new URLSearchParams(location2.search);
1308
- const footer = query2.get("footer");
1309
- if (footer === "0" /* Hide */) {
1310
- setHasFooter(false);
1311
- }
1312
- }, []);
1313
- const docContent = /* @__PURE__ */ jsx15(TabDataContext.Provider, { value: { tabData, setTabData }, children: /* @__PURE__ */ jsx15(MDXProvider, { components: getCustomMDXComponent(), children: /* @__PURE__ */ jsx15(Content, {}) }) });
1314
- return /* @__PURE__ */ jsxs9(
1315
- "div",
1316
- {
1317
- className: `${index_module_default7.docLayout} pt-0`,
1318
- style: __spreadValues({}, disableNavbar ? { marginTop: 0 } : {}),
1319
- children: [
1320
- beforeDoc,
1321
- hasSidebar ? /* @__PURE__ */ jsx15(SideMenu, {}) : null,
1322
- /* @__PURE__ */ jsxs9(
1323
- "div",
1324
- {
1325
- className: `${index_module_default7.content} rspress-doc-container flex flex-shrink-0 m-auto`,
1326
- children: [
1327
- /* @__PURE__ */ jsx15("div", { className: "w-full", children: isOverviewPage ? /* @__PURE__ */ jsx15("div", { className: "rspress-doc", children: /* @__PURE__ */ jsx15(Overview, { content: docContent }) }) : /* @__PURE__ */ jsxs9("div", { children: [
1328
- /* @__PURE__ */ jsx15("div", { className: "rspress-doc", children: docContent }),
1329
- /* @__PURE__ */ jsxs9("div", { className: "rspress-doc-footer", children: [
1330
- beforeDocFooter,
1331
- hasFooter && /* @__PURE__ */ jsx15(DocFooter, {})
1332
- ] })
1333
- ] }) }),
1334
- hasAside ? /* @__PURE__ */ jsx15(
1335
- "div",
1336
- {
1337
- className: index_module_default7.asideContainer,
1338
- style: __spreadValues({}, disableNavbar ? {
1339
- marginTop: 0,
1340
- paddingTop: "32px"
1341
- } : {}),
1342
- children: /* @__PURE__ */ jsxs9("div", { children: [
1343
- beforeOutline,
1344
- /* @__PURE__ */ jsx15(Aside, { headers, outlineTitle }),
1345
- afterOutline
1346
- ] })
1347
- }
1348
- ) : null
1349
- ]
1350
- }
1351
- ),
1352
- afterDoc
1353
- ]
1354
- }
1355
- );
1356
- }
1357
-
1358
- // src/theme-default/layout/Layout/index.tsx
1359
- import { usePageData as usePageData10, Content as Content2, removeBase as removeBase3, withBase as withBase8 } from "@/runtime";
1360
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1361
- var Layout = (props) => {
1362
- var _a;
1363
- const {
1364
- top,
1365
- bottom,
1366
- beforeDocFooter,
1367
- beforeDoc,
1368
- afterDoc,
1369
- beforeOutline,
1370
- afterOutline,
1371
- beforeNavTitle,
1372
- afterNavTitle,
1373
- beforeNav,
1374
- beforeHero,
1375
- afterHero,
1376
- beforeFeatures,
1377
- afterFeatures
1378
- } = props;
1379
- const docProps = {
1380
- beforeDocFooter,
1381
- beforeDoc,
1382
- afterDoc,
1383
- beforeOutline,
1384
- afterOutline
1385
- };
1386
- const homeProps = {
1387
- beforeHero,
1388
- afterHero,
1389
- beforeFeatures,
1390
- afterFeatures
1391
- };
1392
- const { siteData: siteData2, page } = usePageData10();
1393
- const {
1394
- pageType,
1395
- lang: currentLang,
1396
- // Inject by remark-plugin-toc
1397
- title: articleTitle,
1398
- frontmatter
1399
- } = page;
1400
- const localesData = useLocaleSiteData();
1401
- const defaultLang = siteData2.lang || "";
1402
- const [hideNavbar, setHideNavbar] = useDisableNav();
1403
- let title = (_a = frontmatter == null ? void 0 : frontmatter.title) != null ? _a : articleTitle;
1404
- const mainTitle = siteData2.title || localesData.title;
1405
- const localeLanguages = Object.values(siteData2.themeConfig.locales || {});
1406
- const langs = localeLanguages.map((item) => item.lang) || [];
1407
- if (title && pageType === "doc") {
1408
- title = `${title} - ${mainTitle}`;
1409
- } else {
1410
- title = mainTitle;
1411
- }
1412
- const description = (frontmatter == null ? void 0 : frontmatter.description) || siteData2.description || localesData.description;
1413
- const getContentLayout = () => {
1414
- switch (pageType) {
1415
- case "home":
1416
- return /* @__PURE__ */ jsx16(Theme.HomeLayout, __spreadValues({}, homeProps));
1417
- case "doc":
1418
- return /* @__PURE__ */ jsx16(DocLayout, __spreadValues({}, docProps));
1419
- case "404":
1420
- return /* @__PURE__ */ jsx16(Theme.NotFoundLayout, {});
1421
- case "custom":
1422
- case "blank":
1423
- return /* @__PURE__ */ jsx16(Content2, {});
1424
- default:
1425
- return /* @__PURE__ */ jsx16(DocLayout, __spreadValues({}, docProps));
1426
- }
1427
- };
1428
- useEffect10(() => {
1429
- if (!defaultLang || process.env.TEST === "1") {
1430
- return;
1431
- }
1432
- const { pathname } = window.location;
1433
- const cleanPathname = removeBase3(pathname);
1434
- const FIRST_VISIT_KEY = "rspress-visited";
1435
- const visited = localStorage.getItem(FIRST_VISIT_KEY);
1436
- if (visited) {
1437
- return;
1438
- } else {
1439
- localStorage.setItem(FIRST_VISIT_KEY, "1");
1440
- }
1441
- const targetLang = window.navigator.language.split("-")[0];
1442
- if (!langs.includes(targetLang)) {
1443
- return;
1444
- }
1445
- if (targetLang !== currentLang) {
1446
- if (targetLang === defaultLang) {
1447
- window.location.replace(pathname.replace(`/${currentLang}`, ""));
1448
- } else if (currentLang === defaultLang) {
1449
- window.location.replace(withBase8(`/${targetLang}${cleanPathname}`));
1450
- } else {
1451
- window.location.replace(
1452
- pathname.replace(`/${currentLang}`, `/${targetLang}`)
1453
- );
1454
- }
1455
- }
1456
- }, []);
1457
- useEffect10(() => {
1458
- const query2 = new URLSearchParams(location.search);
1459
- const navbar = query2.get("navbar");
1460
- const sidebar = query2.get("sidebar");
1461
- const aside = query2.get("outline");
1462
- if (navbar === "0" /* Hide */) {
1463
- setHideNavbar(true);
1464
- }
1465
- if (sidebar === "0" /* Hide */) {
1466
- document.documentElement.style.setProperty("--rp-sidebar-width", "0");
1467
- }
1468
- if (aside === "0" /* Hide */) {
1469
- document.documentElement.style.setProperty("--rp-aside-width", "0");
1470
- }
1471
- }, []);
1472
- return /* @__PURE__ */ jsxs10("div", { children: [
1473
- /* @__PURE__ */ jsxs10(Helmet, { children: [
1474
- title ? /* @__PURE__ */ jsx16("title", { children: title }) : null,
1475
- description ? /* @__PURE__ */ jsx16("meta", { name: "description", content: description }) : null
1476
- ] }),
1477
- top,
1478
- pageType !== "blank" && !hideNavbar && /* @__PURE__ */ jsx16(
1479
- Nav,
1480
- {
1481
- beforeNavTitle,
1482
- afterNavTitle,
1483
- beforeNav
1484
- }
1485
- ),
1486
- /* @__PURE__ */ jsx16("section", { children: getContentLayout() }),
1487
- bottom
1488
- ] });
1489
- };
1490
-
1491
- // src/theme-default/layout/HomeLayout/index.tsx
1492
- import { HomeFooter } from "@theme";
1493
-
1494
- // src/theme-default/components/Button/index.tsx
1495
- import React6 from "react";
1496
-
1497
- // src/theme-default/components/Button/index.module.scss
1498
- var index_module_default8 = { "button": "button_f51d9", "medium": "medium_f51d9", "big": "big_f51d9", "brand": "brand_f51d9", "alt": "alt_f51d9" };
1499
-
1500
- // src/theme-default/components/Button/index.tsx
1501
- function Button(props) {
1502
- const {
1503
- theme = "brand",
1504
- size = "big",
1505
- href = "/",
1506
- external = false,
1507
- className = ""
1508
- } = props;
1509
- let type = null;
1510
- if (props.type === "button") {
1511
- type = "button";
1512
- } else if (props.type === "a") {
1513
- type = external ? "a" : Link;
1514
- }
1515
- return React6.createElement(
1516
- type != null ? type : "a",
1517
- {
1518
- className: `${index_module_default8.button} ${index_module_default8[theme]} ${index_module_default8[size]} ${className}`,
1519
- href
1520
- },
1521
- props.text
1522
- );
1523
- }
1524
-
1525
- // src/theme-default/components/HomeHero/index.module.scss
1526
- var index_module_default9 = { "clip": "clip_0666a", "mask": "mask_0666a" };
1527
-
1528
- // src/theme-default/components/HomeHero/index.tsx
1529
- import {
1530
- normalizeHrefInRuntime as normalizeHref7,
1531
- normalizeImagePath as normalizeImagePath2
1532
- } from "@/runtime";
1533
- import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1534
- var DEFAULT_HERO = {
1535
- name: "modern",
1536
- text: "modern ssg",
1537
- tagline: "modern ssg",
1538
- actions: [],
1539
- image: void 0
1540
- };
1541
- function HomeHero({ frontmatter }) {
1542
- var _a, _b, _c;
1543
- const hero = (frontmatter == null ? void 0 : frontmatter.hero) || DEFAULT_HERO;
1544
- const hasImage = hero.image !== void 0;
1545
- const textMaxWidth = hasImage ? "sm:max-w-xl" : "sm:max-w-4xl";
1546
- return /* @__PURE__ */ jsxs11("div", { className: "m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16", children: [
1547
- /* @__PURE__ */ jsx17(
1548
- "div",
1549
- {
1550
- className: index_module_default9.mask,
1551
- style: {
1552
- left: hasImage ? "75%" : "50%"
1553
- }
1554
- }
1555
- ),
1556
- /* @__PURE__ */ jsxs11("div", { className: "m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh]", children: [
1557
- /* @__PURE__ */ jsxs11("div", { className: "flex flex-col justify-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1", children: [
1558
- /* @__PURE__ */ jsx17("h1", { className: "font-bold text-3xl sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-2 leading-tight z-10", children: /* @__PURE__ */ jsx17("span", { className: index_module_default9.clip, style: { lineHeight: "1.3" }, children: hero.name }) }),
1559
- ((_a = hero.text) == null ? void 0 : _a.length) && /* @__PURE__ */ jsx17(
1560
- "p",
1561
- {
1562
- className: `mx-auto md:m-0 text-3xl sm:text-5xl md:text-6xl pb-2 font-bold z-10 ${textMaxWidth}`,
1563
- style: { lineHeight: "1.2" },
1564
- children: hero.text
1565
- }
1566
- ),
1567
- /* @__PURE__ */ jsx17(
1568
- "p",
1569
- {
1570
- className: `whitespace-pre-wrap pt-4 m-auto md:m-0 text-sm sm:tex-xl md:text-2xl text-text-2 font-medium z-10 ${textMaxWidth}`,
1571
- children: hero.tagline
1572
- }
1573
- ),
1574
- /* @__PURE__ */ jsx17("div", { className: "flex flex-wrap justify-center gap-3 m--1.5 pt-8 z-10", children: hero.actions.map((action) => /* @__PURE__ */ jsx17("div", { className: "flex flex-shrink-0 p-1", children: /* @__PURE__ */ jsx17(
1575
- Button,
1576
- {
1577
- type: "a",
1578
- text: action.text,
1579
- href: normalizeHref7(action.link),
1580
- theme: action.theme
1581
- }
1582
- ) }, action.link)) })
1583
- ] }),
1584
- hasImage ? /* @__PURE__ */ jsx17("div", { className: "rspress-home-hero-image md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex", children: /* @__PURE__ */ jsx17(
1585
- "img",
1586
- {
1587
- src: normalizeImagePath2((_b = hero.image) == null ? void 0 : _b.src),
1588
- alt: (_c = hero.image) == null ? void 0 : _c.alt
1589
- }
1590
- ) }) : null
1591
- ] })
1592
- ] });
1593
- }
1594
-
1595
- // src/theme-default/components/HomeFeatures/index.module.scss
1596
- var index_module_default10 = { "grid-2": "grid-2_9c01c", "grid2": "grid-2_9c01c", "grid-4": "grid-4_9c01c", "grid4": "grid-4_9c01c", "grid-6": "grid-6_9c01c", "grid6": "grid-6_9c01c", "grid-3": "grid-3_9c01c", "grid3": "grid-3_9c01c", "featureCard": "featureCard_9c01c" };
1597
-
1598
- // src/theme-default/components/HomeFeatures/index.tsx
1599
- import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1600
- var PRESET_COUNT = [2, 3, 4];
1601
- var getGridClass = (count) => {
1602
- if (!count) {
1603
- return "";
1604
- } else if (PRESET_COUNT.includes(count)) {
1605
- return `grid-${12 / count}`;
1606
- } else if (count % 3 === 0) {
1607
- return "grid-4";
1608
- } else if (count % 2 === 0) {
1609
- return "grid-6";
1610
- }
1611
- return "";
1612
- };
1613
- function HomeFeature({ frontmatter }) {
1614
- const features = frontmatter == null ? void 0 : frontmatter.features;
1615
- const gridClass = getGridClass(features == null ? void 0 : features.length);
1616
- return /* @__PURE__ */ jsx18("div", { className: "overflow-hidden m-auto flex flex-wrap justify-between max-w-6xl", children: features == null ? void 0 : features.map((feature) => {
1617
- const { icon, title, details, link } = feature;
1618
- return /* @__PURE__ */ jsx18(
1619
- "div",
1620
- {
1621
- className: `${gridClass ? index_module_default10[gridClass] : "w-full"} rounded hover:var(--rp-c-brand)`,
1622
- children: /* @__PURE__ */ jsx18("div", { className: "h-full p-2", children: /* @__PURE__ */ jsxs12(
1623
- "article",
1624
- {
1625
- className: `${index_module_default10.featureCard} h-full p-8 rounded-4xl border-transparent`,
1626
- style: {
1627
- cursor: link ? "pointer" : "auto"
1628
- },
1629
- onClick: () => {
1630
- if (link) {
1631
- window.location.href = link;
1632
- }
1633
- },
1634
- children: [
1635
- /* @__PURE__ */ jsx18("div", { className: "flex-center", children: /* @__PURE__ */ jsx18("div", { className: "rspress-home-feature-icon w-12 h-12 text-3xl text-center", children: icon }) }),
1636
- /* @__PURE__ */ jsx18("h2", { className: "rspress-home-feature-title font-bold text-center", children: title }),
1637
- /* @__PURE__ */ jsx18("p", { className: "rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium", children: details })
1638
- ]
1639
- },
1640
- title
1641
- ) })
1642
- },
1643
- title
1644
- );
1645
- }) });
1646
- }
1647
-
1648
- // src/theme-default/layout/HomeLayout/index.tsx
1649
- import { usePageData as usePageData11 } from "@/runtime";
1650
- import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
1651
- function HomeLayout(props) {
1652
- const { beforeHero, afterHero, beforeFeatures, afterFeatures } = props;
1653
- const {
1654
- page: { frontmatter }
1655
- } = usePageData11();
1656
- return /* @__PURE__ */ jsxs13(
1657
- "div",
1658
- {
1659
- className: "relative",
1660
- style: {
1661
- minHeight: "calc(100vh - var(--rp-nav-height))",
1662
- paddingBottom: "80px"
1663
- },
1664
- children: [
1665
- /* @__PURE__ */ jsxs13("div", { className: "pb-12", children: [
1666
- beforeHero,
1667
- /* @__PURE__ */ jsx19(HomeHero, { frontmatter }),
1668
- afterHero,
1669
- beforeFeatures,
1670
- /* @__PURE__ */ jsx19(HomeFeature, { frontmatter }),
1671
- afterFeatures
1672
- ] }),
1673
- /* @__PURE__ */ jsx19(HomeFooter, {})
1674
- ]
1675
- }
1676
- );
1677
- }
1678
-
1679
- // src/theme-default/components/Nav/index.tsx
1680
- import { useLocation as useLocation9 } from "react-router-dom";
1681
- import { Search } from "@theme";
1682
- import { useEffect as useEffect13, useState as useState12 } from "react";
1683
-
1684
- // src/theme-default/components/NavHambmger/index.tsx
1685
- import { Fragment as Fragment4 } from "react";
1686
-
1687
- // src/theme-default/components/NavScreen/index.tsx
1688
- import { useEffect as useEffect12, useRef as useRef4 } from "react";
1689
- import { disableBodyScroll, clearAllBodyScrollLocks } from "body-scroll-lock";
1690
-
1691
- // src/theme-default/components/Nav/NavMenuSingleItem.tsx
1692
- import {
1693
- withoutBase
1694
- } from "@rspress/shared";
1695
- import { normalizeHrefInRuntime as normalizeHref8 } from "@/runtime";
1696
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
1697
- function NavMenuSingleItem(item) {
1698
- const { pathname, base } = item;
1699
- const isActive2 = new RegExp(item.activeMatch || item.link).test(
1700
- withoutBase(pathname, base)
1701
- );
1702
- return /* @__PURE__ */ jsx20(Link, { href: normalizeHref8(item.link), children: /* @__PURE__ */ jsxs14(
1703
- "div",
1704
- {
1705
- className: `${index_module_default4.singleItem} ${isActive2 ? index_module_default4.activeItem : ""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,
1706
- children: [
1707
- /* @__PURE__ */ jsx20(Tag, { tag: item.tag }),
1708
- item.text,
1709
- item.rightIcon
1710
- ]
1711
- },
1712
- item.text
1713
- ) });
1714
- }
1715
-
1716
- // src/theme-default/components/SwitchAppearance/index.tsx
1717
- import { useContext as useContext2, useEffect as useEffect11 } from "react";
1718
-
1719
- // src/theme-default/assets/sun.svg
1720
- import * as React7 from "react";
1721
- import { jsx as jsx21 } from "react/jsx-runtime";
1722
- var SvgSun = (props) => /* @__PURE__ */ jsx21("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", viewBox: "0 0 24 24" }, props), { children: /* @__PURE__ */ jsx21("path", { d: "M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z" }) }));
1723
- var sun_default = SvgSun;
1724
-
1725
- // src/theme-default/assets/moon.svg
1726
- import * as React8 from "react";
1727
- import { jsx as jsx22 } from "react/jsx-runtime";
1728
- var SvgMoon = (props) => /* @__PURE__ */ jsx22("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", viewBox: "0 0 24 24" }, props), { children: /* @__PURE__ */ jsx22("path", { d: "M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z" }) }));
1729
- var moon_default = SvgMoon;
1730
-
1731
- // src/theme-default/logic/useAppearance.ts
1732
- import siteData from "virtual-site-data";
1733
- import { APPEARANCE_KEY } from "@rspress/shared";
1734
- var classList;
1735
- var userPreference;
1736
- var query;
1737
- var setClass = (dark) => {
1738
- classList == null ? void 0 : classList[dark ? "add" : "remove"]("dark");
1739
- };
1740
- var updateAppearance = () => {
1741
- const disableDarkMode = siteData.themeConfig.darkMode === false;
1742
- if (disableDarkMode) {
1743
- return;
1744
- }
1745
- if (window.MODERN_THEME) {
1746
- setClass(window.MODERN_THEME === "dark");
1747
- return;
1748
- }
1749
- const userPreference2 = localStorage.getItem(APPEARANCE_KEY) || "auto";
1750
- query = window.matchMedia("(prefers-color-scheme: dark)");
1751
- setClass(
1752
- userPreference2 === "auto" ? query.matches : userPreference2 === "dark"
1753
- );
1754
- };
1755
- if (typeof window !== "undefined" && typeof localStorage !== "undefined") {
1756
- classList = document.documentElement.classList;
1757
- updateAppearance();
1758
- }
1759
- var isDarkMode = () => classList == null ? void 0 : classList.contains("dark");
1760
- var getToggle = () => {
1761
- if (typeof window !== "undefined") {
1762
- window.addEventListener("storage", updateAppearance);
1763
- }
1764
- return () => {
1765
- const isDark = isDarkMode();
1766
- if (typeof window !== "undefined" && typeof localStorage !== "undefined") {
1767
- setClass(!isDark);
1768
- userPreference = isDark ? "light" : "dark";
1769
- localStorage.setItem(APPEARANCE_KEY, userPreference);
1770
- }
1771
- };
1772
- };
1773
-
1774
- // src/theme-default/components/SwitchAppearance/index.tsx
1775
- import { ThemeContext as ThemeContext2 } from "@/runtime";
1776
- import { jsx as jsx23 } from "react/jsx-runtime";
1777
- function SwitchAppearance({ onClick }) {
1778
- const { theme, setTheme } = useContext2(ThemeContext2);
1779
- const toggleAppearance = getToggle();
1780
- useEffect11(() => {
1781
- if (isDarkMode()) {
1782
- setTheme("dark");
1783
- }
1784
- }, []);
1785
- return /* @__PURE__ */ jsx23(
1786
- "div",
1787
- {
1788
- onClick: () => {
1789
- setTheme(theme === "dark" ? "light" : "dark");
1790
- toggleAppearance();
1791
- onClick == null ? void 0 : onClick();
1792
- },
1793
- className: "md:mr-2 rspress-nav-appearance",
1794
- children: /* @__PURE__ */ jsx23("div", { className: "p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300", children: theme === "light" ? /* @__PURE__ */ jsx23(sun_default, { width: "18", height: "18", fill: "currentColor" }) : /* @__PURE__ */ jsx23(moon_default, { width: "18", height: "18", fill: "currentColor" }) })
1795
- }
1796
- );
1797
- }
1798
-
1799
- // src/theme-default/components/SocialLinks/index.tsx
1800
- import { useState as useState8 } from "react";
1801
-
1802
- // src/theme-default/assets/arrow-down.svg
1803
- import * as React9 from "react";
1804
- import { jsx as jsx24 } from "react/jsx-runtime";
1805
- var SvgArrowDown = (props) => /* @__PURE__ */ jsx24("svg", __spreadProps(__spreadValues({ width: "1em", height: "1em", viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx24("path", { fill: "currentColor", d: "M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z" }) }));
1806
- var arrow_down_default = SvgArrowDown;
1807
-
1808
- // src/theme-default/components/SocialLinks/LinkContent.tsx
1809
- import { useState as useState7 } from "react";
1810
-
1811
- // src/theme-default/components/SocialLinks/index.module.scss
1812
- var index_module_default11 = { "social-links-icon": "social-links-icon_c942e", "socialLinksIcon": "social-links-icon_c942e", "menu-item": "menu-item_c942e", "menuItem": "menu-item_c942e" };
1813
-
1814
- // src/theme-default/components/SocialLinks/presetIcons.tsx
1815
- import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
1816
- var presetIcons_default = {
1817
- discord: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1818
- /* @__PURE__ */ jsx25("title", { children: "Discord" }),
1819
- /* @__PURE__ */ jsx25("path", { d: "M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" })
1820
- ] }),
1821
- facebook: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1822
- /* @__PURE__ */ jsx25("title", { children: "Facebook" }),
1823
- /* @__PURE__ */ jsx25("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" })
1824
- ] }),
1825
- github: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1826
- /* @__PURE__ */ jsx25("title", { children: "GitHub" }),
1827
- /* @__PURE__ */ jsx25("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
1828
- ] }),
1829
- gitlab: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1830
- /* @__PURE__ */ jsx25("title", { children: "GitLab" }),
1831
- /* @__PURE__ */ jsx25(
1832
- "path",
1833
- {
1834
- fill: "currentColor",
1835
- d: "m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"
1836
- }
1837
- )
1838
- ] }),
1839
- instagram: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1840
- /* @__PURE__ */ jsx25("title", { children: "Instagram" }),
1841
- /* @__PURE__ */ jsx25("path", { d: "M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z" })
1842
- ] }),
1843
- linkedin: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1844
- /* @__PURE__ */ jsx25("title", { children: "LinkedIn" }),
1845
- /* @__PURE__ */ jsx25("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" })
1846
- ] }),
1847
- slack: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1848
- /* @__PURE__ */ jsx25("title", { children: "Slack" }),
1849
- /* @__PURE__ */ jsx25("path", { d: "M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z" })
1850
- ] }),
1851
- twitter: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1852
- /* @__PURE__ */ jsx25("title", { children: "Twitter" }),
1853
- /* @__PURE__ */ jsx25("path", { d: "M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z" })
1854
- ] }),
1855
- youtube: /* @__PURE__ */ jsxs15("svg", { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
1856
- /* @__PURE__ */ jsx25("title", { children: "YouTube" }),
1857
- /* @__PURE__ */ jsx25("path", { d: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" })
1858
- ] }),
1859
- juejin: /* @__PURE__ */ jsxs15(
1860
- "svg",
1861
- {
1862
- className: "icon",
1863
- viewBox: "0 0 1024 1024",
1864
- version: "1.1",
1865
- xmlns: "http://www.w3.org/2000/svg",
1866
- "data-spm-anchor-id": "a313x.7781069.0.i5",
1867
- children: [
1868
- /* @__PURE__ */ jsx25(
1869
- "path",
1870
- {
1871
- d: "M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z",
1872
- "data-spm-anchor-id": "a313x.7781069.0.i2"
1873
- }
1874
- ),
1875
- /* @__PURE__ */ jsx25(
1876
- "path",
1877
- {
1878
- d: "M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z",
1879
- "data-spm-anchor-id": "a313x.7781069.0.i3"
1880
- }
1881
- )
1882
- ]
1883
- }
1884
- ),
1885
- qq: /* @__PURE__ */ jsx25(
1886
- "svg",
1887
- {
1888
- xmlns: "http://www.w3.org/2000/svg",
1889
- "aria-hidden": "true",
1890
- role: "img",
1891
- className: "iconify iconify--ri",
1892
- preserveAspectRatio: "xMidYMid meet",
1893
- viewBox: "0 0 24 24",
1894
- children: /* @__PURE__ */ jsx25(
1895
- "path",
1896
- {
1897
- fill: "currentColor",
1898
- d: "M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"
1899
- }
1900
- )
1901
- }
1902
- ),
1903
- wechat: /* @__PURE__ */ jsx25(
1904
- "svg",
1905
- {
1906
- xmlns: "http://www.w3.org/2000/svg",
1907
- "aria-hidden": "true",
1908
- role: "img",
1909
- className: "iconify iconify--ri",
1910
- preserveAspectRatio: "xMidYMid meet",
1911
- viewBox: "0 0 24 24",
1912
- children: /* @__PURE__ */ jsx25(
1913
- "path",
1914
- {
1915
- fill: "currentColor",
1916
- d: "M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"
1917
- }
1918
- )
1919
- }
1920
- ),
1921
- weibo: /* @__PURE__ */ jsx25(
1922
- "svg",
1923
- {
1924
- xmlns: "http://www.w3.org/2000/svg",
1925
- "aria-hidden": "true",
1926
- role: "img",
1927
- className: "iconify iconify--ri",
1928
- preserveAspectRatio: "xMidYMid meet",
1929
- viewBox: "0 0 24 24",
1930
- children: /* @__PURE__ */ jsx25(
1931
- "path",
1932
- {
1933
- fill: "currentColor",
1934
- d: "M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"
1935
- }
1936
- )
1937
- }
1938
- ),
1939
- zhihu: /* @__PURE__ */ jsx25(
1940
- "svg",
1941
- {
1942
- xmlns: "http://www.w3.org/2000/svg",
1943
- "aria-hidden": "true",
1944
- role: "img",
1945
- className: "iconify iconify--ri",
1946
- preserveAspectRatio: "xMidYMid meet",
1947
- viewBox: "0 0 24 24",
1948
- children: /* @__PURE__ */ jsx25(
1949
- "path",
1950
- {
1951
- fill: "currentColor",
1952
- d: "m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"
1953
- }
1954
- )
1955
- }
1956
- ),
1957
- bilibili: /* @__PURE__ */ jsx25(
1958
- "svg",
1959
- {
1960
- xmlns: "http://www.w3.org/2000/svg",
1961
- "aria-hidden": "true",
1962
- role: "img",
1963
- className: "iconify iconify--ri",
1964
- preserveAspectRatio: "xMidYMid meet",
1965
- viewBox: "0 0 24 24",
1966
- children: /* @__PURE__ */ jsx25(
1967
- "path",
1968
- {
1969
- fill: "currentColor",
1970
- d: "M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"
1971
- }
1972
- )
1973
- }
1974
- ),
1975
- lark: /* @__PURE__ */ jsx25(
1976
- "svg",
1977
- {
1978
- xmlns: "http://www.w3.org/2000/svg",
1979
- width: "48",
1980
- height: "48",
1981
- viewBox: "0 0 48 48",
1982
- children: /* @__PURE__ */ jsxs15("g", { fillRule: "evenodd", clipRule: "evenodd", children: [
1983
- /* @__PURE__ */ jsx25("path", { d: "M41.0716 5.99409L3.31071 16.5187L12.3856 25.8126L20.7998 25.9594L30.4827 16.5187C30.2266 15.9943 30.0985 15.5552 30.0985 15.2013C30.0985 14.4074 30.4104 13.7786 30.8947 13.333C31.7241 12.57 32.7222 12.4558 33.8889 12.9905L41.0716 5.99409Z" }),
1984
- /* @__PURE__ */ jsx25("path", { d: "M42.1021 6.72842L31.5775 44.4893L22.2836 35.4144L22.1367 27.0002L31.5115 17.4816C32.0195 17.8454 32.5743 18.0105 33.1759 17.9769C34.0784 17.9264 34.6614 17.3813 34.9349 17.0602C35.2083 16.7392 35.5293 16.2051 35.5025 15.4113C35.4847 14.8821 35.3109 14.3941 34.9812 13.9472L42.1021 6.72842Z" })
1985
- ] })
1986
- }
1987
- )
1988
- };
1989
-
1990
- // src/theme-default/components/SocialLinks/LinkContent.tsx
1991
- import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
1992
- var LinkContent = (props) => {
1993
- const { link, popperStyle = {} } = props;
1994
- const { icon, mode = "link", content } = link;
1995
- const IconComp = typeof icon === "object" ? (
1996
- // eslint-disable-next-line react/no-danger
1997
- /* @__PURE__ */ jsx26("div", { dangerouslySetInnerHTML: { __html: icon.svg } })
1998
- ) : presetIcons_default[icon];
1999
- const [contentVisible, setContentVisible] = useState7(false);
2000
- const mouseEnterIcon = () => {
2001
- setContentVisible(true);
2002
- };
2003
- const mouseLeavePopper = () => {
2004
- setContentVisible(false);
2005
- };
2006
- if (mode === "link") {
2007
- return /* @__PURE__ */ jsx26(
2008
- "a",
2009
- {
2010
- href: content,
2011
- target: "_blank",
2012
- rel: "noopener noreferrer",
2013
- className: "social-links",
2014
- children: /* @__PURE__ */ jsx26("div", { className: `${index_module_default11.socialLinksIcon}`, children: IconComp })
2015
- },
2016
- content
2017
- );
2018
- }
2019
- if (mode === "text") {
2020
- return /* @__PURE__ */ jsxs16(
2021
- "div",
2022
- {
2023
- className: `${index_module_default11.socialLinksIcon} cursor-pointer relative mx-3`,
2024
- onMouseEnter: mouseEnterIcon,
2025
- onMouseLeave: mouseLeavePopper,
2026
- children: [
2027
- IconComp,
2028
- contentVisible ? /* @__PURE__ */ jsx26(
2029
- "div",
2030
- {
2031
- style: __spreadValues({
2032
- boxShadow: "var(--rp-shadow-3)",
2033
- border: "1px solid var(--rp-c-divider-light)"
2034
- }, popperStyle),
2035
- className: "z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",
2036
- children: /* @__PURE__ */ jsx26("div", { className: "text-md", children: content })
2037
- }
2038
- ) : null
2039
- ]
2040
- }
2041
- );
2042
- }
2043
- if (mode === "img") {
2044
- return /* @__PURE__ */ jsxs16(
2045
- "div",
2046
- {
2047
- className: `${index_module_default11.socialLinksIcon} cursor-pointer relative`,
2048
- onMouseEnter: mouseEnterIcon,
2049
- onMouseLeave: mouseLeavePopper,
2050
- children: [
2051
- IconComp,
2052
- contentVisible ? /* @__PURE__ */ jsx26(
2053
- "div",
2054
- {
2055
- className: "break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",
2056
- style: __spreadValues({
2057
- boxShadow: "var(--rp-shadow-3)"
2058
- }, popperStyle),
2059
- children: /* @__PURE__ */ jsx26("img", { src: content, alt: "img" })
2060
- }
2061
- ) : null
2062
- ]
2063
- }
2064
- );
2065
- }
2066
- return /* @__PURE__ */ jsx26("div", {});
2067
- };
2068
-
2069
- // src/theme-default/components/SocialLinks/ShownLinks.tsx
2070
- import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
2071
- var ShownLinks = (props) => {
2072
- const { links, moreIconVisible = false, mouseEnter } = props;
2073
- return /* @__PURE__ */ jsxs17(Fragment3, { children: [
2074
- /* @__PURE__ */ jsx27("div", { className: "flex-center h-full gap-x-4 transition-colors duration-300 md:mr-2", children: links.map((item, index) => /* @__PURE__ */ jsx27(
2075
- LinkContent,
2076
- {
2077
- link: item,
2078
- popperStyle: { top: "2.5rem" }
2079
- },
2080
- index
2081
- )) }),
2082
- moreIconVisible ? /* @__PURE__ */ jsx27("div", { className: "md:ml-1 p-2", onMouseEnter: mouseEnter, children: /* @__PURE__ */ jsx27(arrow_down_default, {}) }) : null
2083
- ] });
2084
- };
2085
-
2086
- // src/theme-default/components/SocialLinks/HiddenLinks.tsx
2087
- import { jsx as jsx28 } from "react/jsx-runtime";
2088
- var HiddenLinks = (props) => {
2089
- const { links } = props;
2090
- return /* @__PURE__ */ jsx28(
2091
- "div",
2092
- {
2093
- style: {
2094
- boxShadow: "var(--rp-shadow-3)",
2095
- marginRight: "-2px",
2096
- border: "1px solid var(--rp-c-divider-light)",
2097
- background: "var(--rp-c-bg)"
2098
- },
2099
- className: "absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",
2100
- children: links.map((item) => /* @__PURE__ */ jsx28(
2101
- LinkContent,
2102
- {
2103
- link: item,
2104
- popperStyle: { top: "1.25rem" }
2105
- },
2106
- item.content
2107
- ))
2108
- }
2109
- );
2110
- };
2111
-
2112
- // src/theme-default/components/SocialLinks/index.tsx
2113
- import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
2114
- var SocialLinks = ({ socialLinks }) => {
2115
- const moreThanThree = socialLinks.length > 3;
2116
- const shownLinks = [];
2117
- const hiddenLinks = [];
2118
- socialLinks.forEach((item, index) => {
2119
- if (index < 3) {
2120
- shownLinks.push(item);
2121
- } else {
2122
- hiddenLinks.push(item);
2123
- }
2124
- });
2125
- const [moreLinksVisible, setMoreLinksVisible] = useState8(false);
2126
- return /* @__PURE__ */ jsxs18(
2127
- "div",
2128
- {
2129
- className: `social-links ${index_module_default11.menuItem} flex-center relative`,
2130
- onMouseLeave: () => setMoreLinksVisible(false),
2131
- children: [
2132
- /* @__PURE__ */ jsx29(
2133
- ShownLinks,
2134
- {
2135
- links: shownLinks,
2136
- moreIconVisible: moreThanThree,
2137
- mouseEnter: () => setMoreLinksVisible(true)
2138
- }
2139
- ),
2140
- moreLinksVisible ? /* @__PURE__ */ jsx29(HiddenLinks, { links: hiddenLinks }) : null
2141
- ]
2142
- }
2143
- );
2144
- };
2145
-
2146
- // src/theme-default/components/Nav/menuDataHooks.tsx
2147
- import { replaceLang, replaceVersion } from "@rspress/shared";
2148
-
2149
- // src/theme-default/assets/translator.svg
2150
- import * as React10 from "react";
2151
- import { jsx as jsx30 } from "react/jsx-runtime";
2152
- var SvgTranslator = (props) => /* @__PURE__ */ jsx30("svg", __spreadProps(__spreadValues({ width: 18, height: 18, viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx30("path", { fill: "currentColor", d: "M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6 2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z" }) }));
2153
- var translator_default = SvgTranslator;
2154
-
2155
- // src/theme-default/components/Nav/menuDataHooks.tsx
2156
- import { useLocation as useLocation8, usePageData as usePageData12, useVersion as useVersion2 } from "@/runtime";
2157
- import { jsx as jsx31 } from "react/jsx-runtime";
2158
- function useTranslationMenuData() {
2159
- var _a;
2160
- const { siteData: siteData2, page } = usePageData12();
2161
- const currentVersion = useVersion2();
2162
- const { pathname } = useLocation8();
2163
- const defaultLang = siteData2.lang || "";
2164
- const defaultVersion = siteData2.multiVersion.default || "";
2165
- const localeLanguages = Object.values(
2166
- siteData2.locales || siteData2.themeConfig.locales || {}
2167
- );
2168
- const hasMultiLanguage = localeLanguages.length > 1;
2169
- const { lang: currentLang } = page;
2170
- const { base } = siteData2;
2171
- const translationMenuData = hasMultiLanguage ? {
2172
- text: /* @__PURE__ */ jsx31(
2173
- translator_default,
2174
- {
2175
- style: {
2176
- width: "18px",
2177
- height: "18px"
2178
- }
2179
- }
2180
- ),
2181
- items: localeLanguages.map((item) => ({
2182
- text: item == null ? void 0 : item.label,
2183
- link: replaceLang(
2184
- pathname,
2185
- {
2186
- current: currentLang,
2187
- target: item.lang,
2188
- default: defaultLang
2189
- },
2190
- {
2191
- current: currentVersion,
2192
- default: defaultVersion
2193
- },
2194
- base
2195
- )
2196
- })),
2197
- activeValue: (_a = localeLanguages.find((item) => currentLang === item.lang)) == null ? void 0 : _a.label
2198
- } : null;
2199
- return translationMenuData;
2200
- }
2201
- function useVersionMenuData() {
2202
- const { siteData: siteData2 } = usePageData12();
2203
- const currentVersion = useVersion2();
2204
- const { pathname } = useLocation8();
2205
- const defaultVersion = siteData2.multiVersion.default || "";
2206
- const versions = siteData2.multiVersion.versions || [];
2207
- const { base } = siteData2;
2208
- const versionsMenuData = {
2209
- items: versions.map((version) => ({
2210
- text: version,
2211
- link: replaceVersion(
2212
- pathname,
2213
- {
2214
- current: currentVersion,
2215
- target: version,
2216
- default: defaultVersion
2217
- },
2218
- base
2219
- )
2220
- })),
2221
- text: currentVersion,
2222
- activeValue: currentVersion
2223
- };
2224
- return versionsMenuData;
2225
- }
2226
-
2227
- // src/theme-default/components/NavScreen/NavScreenMenuGroup.tsx
2228
- import { useState as useState9 } from "react";
2229
-
2230
- // src/theme-default/assets/down.svg
2231
- import * as React11 from "react";
2232
- import { jsx as jsx32 } from "react/jsx-runtime";
2233
- var SvgDown = (props) => /* @__PURE__ */ jsx32("svg", __spreadProps(__spreadValues({ width: "1em", height: "1em", viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx32("path", { fill: "currentColor", d: "M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z" }) }));
2234
- var down_default = SvgDown;
2235
-
2236
- // src/theme-default/components/NavScreen/index.module.scss
2237
- var index_module_default12 = { "navScreen": "navScreen_798af", "active": "active_798af", "container": "container_798af", "navMenu": "navMenu_798af", "navMenuItem": "navMenuItem_798af", "navAppearance": "navAppearance_798af", "socialAndAppearance": "socialAndAppearance_798af", "navScreenMenuGroup": "navScreenMenuGroup_798af", "open": "open_798af", "button": "button_798af", "buttonSpan": "buttonSpan_798af", "items": "items_798af", "down": "down_798af" };
2238
-
2239
- // src/theme-default/components/NavScreen/NavScreenMenuGroup.tsx
2240
- import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
2241
- function NavScreenMenuGroup(item) {
2242
- const { activeValue } = item;
2243
- const [isOpen, setIsOpen] = useState9(false);
2244
- function ActiveGroupItem2({ item: item2 }) {
2245
- return /* @__PURE__ */ jsx33("div", { className: "p-1 text-center", children: /* @__PURE__ */ jsx33("span", { className: "text-brand", children: item2.text }) });
2246
- }
2247
- function NormalGroupItem2({ item: item2 }) {
2248
- return /* @__PURE__ */ jsx33("div", { className: "py-1 font-medium", children: /* @__PURE__ */ jsx33(Link, { href: item2.link, children: /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx33("span", { children: item2.text }) }) }) }) });
2249
- }
2250
- const renderLinkItem = (item2) => {
2251
- if (activeValue === item2.text) {
2252
- return /* @__PURE__ */ jsx33(ActiveGroupItem2, { item: item2 }, item2.link);
2253
- }
2254
- return /* @__PURE__ */ jsx33(NormalGroupItem2, { item: item2 }, item2.link);
2255
- };
2256
- const renderGroup = (item2) => {
2257
- return /* @__PURE__ */ jsxs19("div", { children: [
2258
- "link" in item2 ? renderLinkItem(item2) : /* @__PURE__ */ jsx33("p", { className: "font-bold text-gray-400 my-1 not:first:border", children: item2.text }),
2259
- item2.items.map(renderLinkItem)
2260
- ] });
2261
- };
2262
- return /* @__PURE__ */ jsxs19(
2263
- "div",
2264
- {
2265
- className: `${isOpen ? index_module_default12.open : ""} ${index_module_default12.navScreenMenuGroup} relative`,
2266
- children: [
2267
- /* @__PURE__ */ jsxs19(
2268
- "button",
2269
- {
2270
- className: index_module_default12.button,
2271
- onClick: () => {
2272
- setIsOpen(!isOpen);
2273
- },
2274
- children: [
2275
- /* @__PURE__ */ jsx33("span", { className: index_module_default12.buttonSpan, children: item.text }),
2276
- /* @__PURE__ */ jsx33(down_default, { className: `${isOpen ? index_module_default12.open : ""} ${index_module_default12.down} ` })
2277
- ]
2278
- }
2279
- ),
2280
- /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsx33("div", { className: index_module_default12.items, children: item.items.map((item2) => {
2281
- return /* @__PURE__ */ jsx33("div", { children: "items" in item2 ? renderGroup(item2) : renderLinkItem(item2) }, item2.text);
2282
- }) }) })
2283
- ]
2284
- }
2285
- );
2286
- }
2287
-
2288
- // src/theme-default/components/NavScreen/index.tsx
2289
- import { NoSSR } from "@/runtime";
2290
- import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
2291
- var NavScreenTranslations = () => {
2292
- const translationMenuData = useTranslationMenuData();
2293
- return /* @__PURE__ */ jsx34(
2294
- "div",
2295
- {
2296
- className: `${index_module_default12.navTranslations} flex text-sm font-bold justify-center`,
2297
- children: /* @__PURE__ */ jsx34("div", { className: "mx-1.5 my-1", children: /* @__PURE__ */ jsx34(NavScreenMenuGroup, __spreadValues({}, translationMenuData)) })
2298
- }
2299
- );
2300
- };
2301
- var NavScreenVersions = () => {
2302
- const versionMenuData = useVersionMenuData();
2303
- return /* @__PURE__ */ jsx34(
2304
- "div",
2305
- {
2306
- className: `${index_module_default12.navTranslations} flex text-sm font-bold justify-center`,
2307
- children: /* @__PURE__ */ jsx34("div", { className: "mx-1.5 my-1", children: /* @__PURE__ */ jsx34(NavScreenMenuGroup, __spreadValues({}, versionMenuData)) })
2308
- }
2309
- );
2310
- };
2311
- function NavScreen(props) {
2312
- var _a;
2313
- const { isScreenOpen, localeData, siteData: siteData2, pathname } = props;
2314
- const screen = useRef4(null);
2315
- const localesData = siteData2.themeConfig.locales || [];
2316
- const hasMultiLanguage = localesData.length > 1;
2317
- const hasMultiVersion = siteData2.multiVersion.versions.length > 1;
2318
- const menuItems = localeData.nav || [];
2319
- const hasAppearanceSwitch = siteData2.themeConfig.darkMode !== false;
2320
- const socialLinks = ((_a = siteData2 == null ? void 0 : siteData2.themeConfig) == null ? void 0 : _a.socialLinks) || [];
2321
- const hasSocialLinks = socialLinks.length > 0;
2322
- const langs = localesData.map((item) => item.lang || "zh") || [];
2323
- const { base } = siteData2;
2324
- const NavScreenAppearance = () => {
2325
- return /* @__PURE__ */ jsx34("div", { className: `mt-2 ${index_module_default12.navAppearance} flex justify-center`, children: /* @__PURE__ */ jsx34(NoSSR, { children: /* @__PURE__ */ jsx34(SwitchAppearance, {}) }) });
2326
- };
2327
- const NavScreenMenu = ({ menuItems: menuItems2 }) => {
2328
- return /* @__PURE__ */ jsx34("div", { className: index_module_default12.navMenu, children: menuItems2.map((item) => {
2329
- return /* @__PURE__ */ jsx34("div", { className: `${index_module_default12.navMenuItem} w-full`, children: "link" in item ? /* @__PURE__ */ jsx34(
2330
- NavMenuSingleItem,
2331
- __spreadValues({
2332
- pathname,
2333
- base,
2334
- langs
2335
- }, item),
2336
- item.text
2337
- ) : /* @__PURE__ */ jsx34("div", { className: "mx-3 last:mr-0", children: /* @__PURE__ */ jsx34(
2338
- NavScreenMenuGroup,
2339
- __spreadProps(__spreadValues({}, item), {
2340
- items: "items" in item ? item.items : item
2341
- })
2342
- ) }, item.text) }, item.text);
2343
- }) });
2344
- };
2345
- useEffect12(() => {
2346
- screen.current && isScreenOpen && disableBodyScroll(screen.current, { reserveScrollBarGap: true });
2347
- return () => {
2348
- clearAllBodyScrollLocks();
2349
- };
2350
- }, [isScreenOpen]);
2351
- return /* @__PURE__ */ jsx34(
2352
- "div",
2353
- {
2354
- className: `${index_module_default12.navScreen} ${isScreenOpen ? index_module_default12.active : ""}`,
2355
- ref: screen,
2356
- id: "navScreen",
2357
- children: /* @__PURE__ */ jsxs20("div", { className: index_module_default12.container, children: [
2358
- /* @__PURE__ */ jsx34(NavScreenMenu, { menuItems }),
2359
- /* @__PURE__ */ jsxs20("div", { className: "flex-center flex-col gap-2", children: [
2360
- hasAppearanceSwitch && /* @__PURE__ */ jsx34(NavScreenAppearance, {}),
2361
- hasMultiLanguage && /* @__PURE__ */ jsx34(NavScreenTranslations, {}),
2362
- hasMultiVersion && /* @__PURE__ */ jsx34(NavScreenVersions, {}),
2363
- hasSocialLinks && /* @__PURE__ */ jsx34(SocialLinks, { socialLinks })
2364
- ] })
2365
- ] })
2366
- }
2367
- );
2368
- }
2369
-
2370
- // src/theme-default/logic/useNav.ts
2371
- import { useState as useState10 } from "react";
2372
- function useNav() {
2373
- const [isScreenOpen, setIsScreenOpen] = useState10(false);
2374
- function openScreen() {
2375
- setIsScreenOpen(true);
2376
- window.addEventListener("resize", closeScreenOnTabletWindow);
2377
- }
2378
- function closeScreen() {
2379
- setIsScreenOpen(false);
2380
- window.removeEventListener("resize", closeScreenOnTabletWindow);
2381
- }
2382
- function toggleScreen() {
2383
- if (isScreenOpen) {
2384
- closeScreen();
2385
- } else {
2386
- openScreen();
2387
- }
2388
- }
2389
- function closeScreenOnTabletWindow() {
2390
- window.outerWidth >= 768 && closeScreen();
2391
- }
2392
- return {
2393
- isScreenOpen,
2394
- openScreen,
2395
- closeScreen,
2396
- toggleScreen
2397
- };
2398
- }
2399
-
2400
- // src/theme-default/assets/small-menu.svg
2401
- import * as React12 from "react";
2402
- import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
2403
- var SvgSmallMenu = (props) => /* @__PURE__ */ jsxs21("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 32, height: 32 }, props), { children: [
2404
- /* @__PURE__ */ jsx35("circle", { cx: 8, cy: 16, r: 2, fill: "currentColor" }),
2405
- /* @__PURE__ */ jsx35("circle", { cx: 16, cy: 16, r: 2, fill: "currentColor" }),
2406
- /* @__PURE__ */ jsx35("circle", { cx: 24, cy: 16, r: 2, fill: "currentColor" })
2407
- ] }));
2408
- var small_menu_default = SvgSmallMenu;
2409
-
2410
- // src/theme-default/components/NavHambmger/index.module.scss
2411
- var index_module_default13 = { "navHamburger": "navHamburger_19e92", "container": "container_19e92", "top": "top_19e92", "middle": "middle_19e92", "bottom": "bottom_19e92", "active": "active_19e92" };
2412
-
2413
- // src/theme-default/components/NavHambmger/index.tsx
2414
- import { jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
2415
- function NavHamburger(props) {
2416
- const { localeData, siteData: siteData2, pathname } = props;
2417
- const { isScreenOpen, toggleScreen } = useNav();
2418
- return /* @__PURE__ */ jsxs22(Fragment4, { children: [
2419
- /* @__PURE__ */ jsx36(
2420
- NavScreen,
2421
- {
2422
- isScreenOpen,
2423
- localeData,
2424
- siteData: siteData2,
2425
- pathname
2426
- }
2427
- ),
2428
- /* @__PURE__ */ jsx36(
2429
- "button",
2430
- {
2431
- onClick: toggleScreen,
2432
- className: `${isScreenOpen ? index_module_default13.active : ""} ${index_module_default13.navHamburger} text-gray-500`,
2433
- children: /* @__PURE__ */ jsx36(small_menu_default, { fill: "currentColor" })
2434
- }
2435
- )
2436
- ] });
2437
- }
2438
-
2439
- // src/theme-default/components/Nav/NavMenuGroup.tsx
2440
- import { useState as useState11 } from "react";
2441
- import {
2442
- withoutBase as withoutBase2
2443
- } from "@rspress/shared";
2444
- import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
2445
- function ActiveGroupItem({ item }) {
2446
- return /* @__PURE__ */ jsxs23(
2447
- "div",
2448
- {
2449
- className: "rounded-2xl my-1 flex",
2450
- style: {
2451
- padding: "0.4rem 1.5rem 0.4rem 0.75rem"
2452
- },
2453
- children: [
2454
- item.tag && /* @__PURE__ */ jsx37(Tag, { tag: item.tag }),
2455
- /* @__PURE__ */ jsx37("span", { className: "text-brand", children: item.text })
2456
- ]
2457
- },
2458
- item.link
2459
- );
2460
- }
2461
- function NormalGroupItem({ item }) {
2462
- return /* @__PURE__ */ jsx37("div", { className: "font-medium my-1", children: /* @__PURE__ */ jsx37(Link, { href: item.link, children: /* @__PURE__ */ jsx37(
2463
- "div",
2464
- {
2465
- className: "rounded-2xl hover:bg-mute",
2466
- style: {
2467
- padding: "0.4rem 1.5rem 0.4rem 0.75rem"
2468
- },
2469
- children: /* @__PURE__ */ jsxs23("div", { className: "flex", children: [
2470
- item.tag && /* @__PURE__ */ jsx37(Tag, { tag: item.tag }),
2471
- /* @__PURE__ */ jsx37("span", { children: item.text })
2472
- ] })
2473
- }
2474
- ) }) }, item.link);
2475
- }
2476
- function NavMenuGroup(item) {
2477
- const {
2478
- activeValue,
2479
- items: groupItems,
2480
- base = "",
2481
- link = "",
2482
- pathname = ""
2483
- } = item;
2484
- const [isOpen, setIsOpen] = useState11(false);
2485
- const renderLinkItem = (item2) => {
2486
- const isLinkActive = new RegExp(item2.activeMatch || item2.link).test(
2487
- withoutBase2(pathname, base)
2488
- );
2489
- if (activeValue === item2.text || !activeValue && isLinkActive) {
2490
- return /* @__PURE__ */ jsx37(ActiveGroupItem, { item: item2 }, item2.link);
2491
- }
2492
- return /* @__PURE__ */ jsx37(NormalGroupItem, { item: item2 }, item2.link);
2493
- };
2494
- const renderGroup = (item2) => {
2495
- return /* @__PURE__ */ jsxs23("div", { children: [
2496
- "link" in item2 ? renderLinkItem(item2) : /* @__PURE__ */ jsx37("p", { className: "font-bold text-gray-400 my-1 not:first:border", children: item2.text }),
2497
- item2.items.map(renderLinkItem)
2498
- ] });
2499
- };
2500
- return /* @__PURE__ */ jsxs23(
2501
- "div",
2502
- {
2503
- className: "relative flex-center h-14",
2504
- onMouseLeave: () => setIsOpen(false),
2505
- children: [
2506
- /* @__PURE__ */ jsx37(
2507
- "button",
2508
- {
2509
- onMouseEnter: () => setIsOpen(true),
2510
- className: "nav-menu-group-button flex-center items-center font-medium text-sm text-text-1 hover:text-text-2 transition-colors duration-200",
2511
- children: link ? (
2512
- // @ts-expect-error item.text may be ReactElement
2513
- /* @__PURE__ */ jsx37(NavMenuSingleItem, __spreadProps(__spreadValues({}, item), { rightIcon: /* @__PURE__ */ jsx37(down_default, {}) }))
2514
- ) : /* @__PURE__ */ jsxs23(Fragment5, { children: [
2515
- /* @__PURE__ */ jsxs23(
2516
- "span",
2517
- {
2518
- className: "text-sm font-medium flex",
2519
- style: {
2520
- marginRight: "2px"
2521
- },
2522
- children: [
2523
- /* @__PURE__ */ jsx37(Tag, { tag: item.tag }),
2524
- item.text
2525
- ]
2526
- }
2527
- ),
2528
- /* @__PURE__ */ jsx37(down_default, {})
2529
- ] })
2530
- }
2531
- ),
2532
- /* @__PURE__ */ jsx37(
2533
- "div",
2534
- {
2535
- className: "nav-menu-group-content absolute mx-0.8 transition-opacity duration-300",
2536
- style: {
2537
- opacity: isOpen ? 1 : 0,
2538
- visibility: isOpen ? "visible" : "hidden",
2539
- right: 0,
2540
- top: "52px"
2541
- },
2542
- children: /* @__PURE__ */ jsx37(
2543
- "div",
2544
- {
2545
- className: "p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",
2546
- style: {
2547
- boxShadow: "var(--rp-shadow-3)",
2548
- zIndex: 100,
2549
- border: "1px solid var(--rp-c-divider-light)",
2550
- borderRadius: "2rem",
2551
- background: "var(--rp-c-bg)"
2552
- },
2553
- children: groupItems.map((item2) => {
2554
- return /* @__PURE__ */ jsx37("div", { children: "items" in item2 ? renderGroup(item2) : renderLinkItem(item2) }, item2.text);
2555
- })
2556
- }
2557
- )
2558
- }
2559
- )
2560
- ]
2561
- }
2562
- );
2563
- }
2564
-
2565
- // src/theme-default/components/Nav/NavTranslations.tsx
2566
- import { jsx as jsx38 } from "react/jsx-runtime";
2567
- function NavTranslations() {
2568
- const translationMenuData = useTranslationMenuData();
2569
- return /* @__PURE__ */ jsx38(
2570
- "div",
2571
- {
2572
- className: `translation ${index_module_default4.menuItem} flex text-sm font-bold items-center px-3 py-2`,
2573
- children: /* @__PURE__ */ jsx38("div", { children: /* @__PURE__ */ jsx38(NavMenuGroup, __spreadValues({}, translationMenuData)) })
2574
- }
2575
- );
2576
- }
2577
-
2578
- // src/theme-default/components/Nav/NavVersions.tsx
2579
- import { jsx as jsx39 } from "react/jsx-runtime";
2580
- function NavVersions() {
2581
- const versionsMenuData = useVersionMenuData();
2582
- return /* @__PURE__ */ jsx39(
2583
- "div",
2584
- {
2585
- className: `translation ${index_module_default4.menuItem} flex text-sm font-bold items-center px-3 py-2`,
2586
- children: /* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(NavMenuGroup, __spreadValues({}, versionsMenuData)) })
2587
- }
2588
- );
2589
- }
2590
-
2591
- // src/theme-default/components/Nav/index.tsx
2592
- import { usePageData as usePageData13 } from "@/runtime";
2593
- import { Fragment as Fragment6, jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
2594
- var DEFAULT_NAV_POSTION = "right";
2595
- function Nav2(props) {
2596
- var _a;
2597
- const { beforeNavTitle, afterNavTitle, beforeNav } = props;
2598
- const { siteData: siteData2 } = usePageData13();
2599
- const { base } = siteData2;
2600
- const { pathname } = useLocation9();
2601
- const localeData = useLocaleSiteData();
2602
- const [isMobile, setIsMobile] = useState12(false);
2603
- const hiddenNav = useHiddenNav();
2604
- const localeLanguages = Object.values(
2605
- siteData2.locales || siteData2.themeConfig.locales || {}
2606
- );
2607
- const hasMultiLanguage = localeLanguages.length > 1;
2608
- const hasMutilVersion = siteData2.multiVersion.versions.length > 1;
2609
- const socialLinks = siteData2.themeConfig.socialLinks || [];
2610
- const hasSocialLinks = socialLinks.length > 0;
2611
- const langs = localeLanguages.map((item) => item.lang || "") || [];
2612
- useEffect13(() => {
2613
- setIsMobile(isMobileDevice());
2614
- }, []);
2615
- const NavMenu = ({ menuItems: menuItems2 }) => {
2616
- return /* @__PURE__ */ jsx40("div", { className: "rspress-nav-menu menu h-14", children: menuItems2.map((item) => {
2617
- return "items" in item || Array.isArray(item) ? /* @__PURE__ */ jsx40("div", { className: "mx-3 last:mr-0", children: /* @__PURE__ */ jsx40(
2618
- NavMenuGroup,
2619
- __spreadProps(__spreadValues({}, item), {
2620
- base,
2621
- pathname,
2622
- langs,
2623
- items: "items" in item ? item.items : item
2624
- })
2625
- ) }, item.text) : /* @__PURE__ */ jsx40(
2626
- NavMenuSingleItem,
2627
- __spreadValues({
2628
- pathname,
2629
- langs,
2630
- base
2631
- }, item),
2632
- item.link
2633
- );
2634
- }) });
2635
- };
2636
- const menuItems = localeData.nav || [];
2637
- const getPosition = (menuItem) => {
2638
- var _a2;
2639
- return (_a2 = menuItem.position) != null ? _a2 : DEFAULT_NAV_POSTION;
2640
- };
2641
- const leftMenuItems = menuItems.filter((item) => getPosition(item) === "left");
2642
- const rightMenuItems = menuItems.filter(
2643
- (item) => getPosition(item) === "right"
2644
- );
2645
- const hasSearch = ((_a = siteData2 == null ? void 0 : siteData2.themeConfig) == null ? void 0 : _a.search) !== false;
2646
- const hasAppearanceSwitch = siteData2.themeConfig.darkMode !== false;
2647
- const leftNav = () => {
2648
- return leftMenuItems.length > 0 ? /* @__PURE__ */ jsx40("div", { className: index_module_default4.leftNav, children: /* @__PURE__ */ jsx40(NavMenu, { menuItems: leftMenuItems }) }) : null;
2649
- };
2650
- const rightNav = () => {
2651
- return /* @__PURE__ */ jsxs24("div", { className: index_module_default4.rightNav, children: [
2652
- hasSearch && /* @__PURE__ */ jsx40("div", { className: "flex sm:flex-1 items-center sm:pl-4 sm:pr-2", children: /* @__PURE__ */ jsx40(Search, {}) }),
2653
- /* @__PURE__ */ jsx40(NavMenu, { menuItems: rightMenuItems }),
2654
- /* @__PURE__ */ jsxs24("div", { className: "flex-center flex-row", children: [
2655
- hasMultiLanguage && /* @__PURE__ */ jsx40(NavTranslations, {}),
2656
- hasMutilVersion && /* @__PURE__ */ jsx40(NavVersions, {}),
2657
- hasAppearanceSwitch && /* @__PURE__ */ jsx40("div", { className: "mx-2", children: /* @__PURE__ */ jsx40(SwitchAppearance, {}) }),
2658
- hasSocialLinks && /* @__PURE__ */ jsx40(SocialLinks, { socialLinks })
2659
- ] })
2660
- ] });
2661
- };
2662
- return /* @__PURE__ */ jsxs24(Fragment6, { children: [
2663
- beforeNav,
2664
- /* @__PURE__ */ jsx40(
2665
- "div",
2666
- {
2667
- className: `${index_module_default4.navContainer} sticky rspress-nav px-6 ${hiddenNav ? index_module_default4.hidden : ""}`,
2668
- children: /* @__PURE__ */ jsxs24(
2669
- "div",
2670
- {
2671
- className: `${index_module_default4.container} flex justify-between items-center h-full`,
2672
- children: [
2673
- beforeNavTitle,
2674
- /* @__PURE__ */ jsx40(NavBarTitle, {}),
2675
- afterNavTitle,
2676
- /* @__PURE__ */ jsxs24(
2677
- "div",
2678
- {
2679
- className: `${index_module_default4.content} flex flex-1 justify-end items-center`,
2680
- children: [
2681
- leftNav(),
2682
- rightNav(),
2683
- /* @__PURE__ */ jsxs24("div", { className: index_module_default4.mobileNavMenu, children: [
2684
- isMobile && /* @__PURE__ */ jsx40(Search, {}),
2685
- /* @__PURE__ */ jsx40(
2686
- NavHamburger,
2687
- {
2688
- localeData,
2689
- siteData: siteData2,
2690
- pathname
2691
- }
2692
- )
2693
- ] })
2694
- ]
2695
- }
2696
- )
2697
- ]
2698
- }
2699
- )
2700
- }
2701
- )
2702
- ] });
2703
- }
2704
-
2705
- // src/theme-default/components/Search/index.tsx
2706
- import { useEffect as useEffect15, useState as useState15 } from "react";
2707
-
2708
- // src/theme-default/components/Search/assets/search.svg
2709
- import * as React13 from "react";
2710
- import { jsx as jsx41 } from "react/jsx-runtime";
2711
- var SvgSearch = (props) => /* @__PURE__ */ jsx41("svg", __spreadProps(__spreadValues({ width: 24, height: 24, viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx41("path", { fill: "var(--rp-c-gray)", d: "m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z" }) }));
2712
- var search_default = SvgSearch;
2713
-
2714
- // src/theme-default/components/Search/index.module.scss
2715
- var index_module_default14 = { "mask": "mask_b68d7", "modal": "modal_b68d7", "inputForm": "inputForm_b68d7", "input": "input_b68d7", "close": "close_b68d7", "searchHits": "searchHits_b68d7", "groupTitle": "groupTitle_b68d7", "navSearchButton": "navSearchButton_b68d7", "searchWord": "searchWord_b68d7", "suggestItem": "suggestItem_b68d7", "suggestItemContainer": "suggestItemContainer_b68d7", "contentWrapper": "contentWrapper_b68d7", "mark": "mark_b68d7", "titleForContent": "titleForContent_b68d7", "actionIcon": "actionIcon_b68d7", "current": "current_b68d7", "tabClassName": "tabClassName_b68d7", "mobileNavSearchButton": "mobileNavSearchButton_b68d7" };
2716
-
2717
- // src/theme-default/components/Search/SearchPanel.tsx
2718
- import { createPortal } from "react-dom";
2719
- import { useEffect as useEffect14, useRef as useRef5, useState as useState14 } from "react";
2720
- import { groupBy, debounce } from "lodash-es";
2721
- import { onSearch } from "virtual-search-hooks";
2722
-
2723
- // src/theme-default/components/Tabs/index.tsx
2724
- import {
2725
- useContext as useContext3,
2726
- useState as useState13
2727
- } from "react";
2728
-
2729
- // src/theme-default/components/Tabs/index.module.scss
2730
- var index_module_default15 = { "container": "container_196a2", "tab-list": "tab-list_196a2", "tabList": "tab-list_196a2", "tab": "tab_196a2", "not-selected": "not-selected_196a2", "notSelected": "not-selected_196a2", "selected": "selected_196a2" };
2731
-
2732
- // src/theme-default/components/Tabs/index.tsx
2733
- import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
2734
- function isTabItem(item) {
2735
- if (item && typeof item === "object" && "label" in item) {
2736
- return true;
2737
- }
2738
- return false;
2739
- }
2740
- var renderTab = (item) => {
2741
- if (isTabItem(item)) {
2742
- return item.label || item.value;
2743
- }
2744
- return item;
2745
- };
2746
- function Tabs(props) {
2747
- const {
2748
- values,
2749
- defaultValue,
2750
- onChange,
2751
- children,
2752
- groupId,
2753
- tabPosition = "left",
2754
- tabContainerClassName
2755
- } = props;
2756
- let tabValues = values || [];
2757
- if (tabValues.length === 0) {
2758
- tabValues = children.map((child) => {
2759
- var _a, _b, _c;
2760
- return {
2761
- label: (_a = child.props) == null ? void 0 : _a.label,
2762
- value: ((_b = child.props) == null ? void 0 : _b.value) || ((_c = child.props) == null ? void 0 : _c.label)
2763
- };
2764
- });
2765
- }
2766
- const { tabData, setTabData } = useContext3(TabDataContext);
2767
- let defaultIndex = 0;
2768
- const needSync = groupId && tabData[groupId] !== void 0;
2769
- if (needSync) {
2770
- defaultIndex = tabData[groupId];
2771
- } else if (defaultValue) {
2772
- defaultIndex = tabValues.findIndex((item) => {
2773
- if (typeof item === "string") {
2774
- return item === defaultValue;
2775
- } else if (item && typeof item === "object" && "value" in item) {
2776
- return item.value === defaultValue;
2777
- }
2778
- return false;
2779
- });
2780
- }
2781
- const [activeIndex, setActiveIndex] = useState13(defaultIndex);
2782
- return /* @__PURE__ */ jsxs25("div", { className: index_module_default15.container, children: [
2783
- /* @__PURE__ */ jsx42("div", { className: tabContainerClassName, children: tabValues.length ? /* @__PURE__ */ jsx42(
2784
- "div",
2785
- {
2786
- className: index_module_default15.tabList,
2787
- style: {
2788
- justifyContent: tabPosition === "center" ? "center" : "flex-start"
2789
- },
2790
- children: tabValues.map((item, index) => {
2791
- return /* @__PURE__ */ jsx42(
2792
- "div",
2793
- {
2794
- className: `${index_module_default15.tab} ${activeIndex === index ? index_module_default15.selected : index_module_default15.notSelected}`,
2795
- onClick: () => {
2796
- onChange == null ? void 0 : onChange(index);
2797
- setActiveIndex(index);
2798
- if (groupId) {
2799
- setTabData(__spreadProps(__spreadValues({}, tabData), { [groupId]: index }));
2800
- }
2801
- },
2802
- children: renderTab(item)
2803
- },
2804
- index
2805
- );
2806
- })
2807
- }
2808
- ) : null }),
2809
- /* @__PURE__ */ jsx42("div", { children: children[activeIndex] })
2810
- ] });
2811
- }
2812
- function Tab(_a) {
2813
- var _b = _a, {
2814
- children
2815
- } = _b, props = __objRest(_b, [
2816
- "children"
2817
- ]);
2818
- return /* @__PURE__ */ jsx42("div", __spreadProps(__spreadValues({}, props), { className: "rounded px-2", children }));
2819
- }
2820
-
2821
- // src/theme-default/components/Search/assets/loading.svg
2822
- import * as React14 from "react";
2823
- import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
2824
- var SvgLoading = (props) => /* @__PURE__ */ jsx43("svg", __spreadProps(__spreadValues({ width: 32, height: 32, viewBox: "0 0 24 24" }, props), { children: /* @__PURE__ */ jsxs26("g", { fill: "none", stroke: "var(--rp-c-brand)", strokeLinecap: "round", strokeWidth: 2, children: [
2825
- /* @__PURE__ */ jsx43("path", { strokeDasharray: 60, strokeDashoffset: 60, strokeOpacity: 0.3, d: "M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z", children: /* @__PURE__ */ jsx43("animate", { fill: "freeze", attributeName: "stroke-dashoffset", dur: "1.3s", values: "60;0" }) }),
2826
- /* @__PURE__ */ jsxs26("path", { strokeDasharray: 15, strokeDashoffset: 15, d: "M12 3a9 9 0 0 1 9 9", children: [
2827
- /* @__PURE__ */ jsx43("animate", { fill: "freeze", attributeName: "stroke-dashoffset", dur: "0.3s", values: "15;0" }),
2828
- /* @__PURE__ */ jsx43("animateTransform", { attributeName: "transform", dur: "1.5s", repeatCount: "indefinite", type: "rotate", values: "0 12 12;360 12 12" })
2829
- ] })
2830
- ] }) }));
2831
- var loading_default = SvgLoading;
2832
-
2833
- // src/theme-default/components/Search/assets/close.svg
2834
- import * as React15 from "react";
2835
- import { jsx as jsx44 } from "react/jsx-runtime";
2836
- var SvgClose = (props) => /* @__PURE__ */ jsx44("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx44("path", { fill: "currentColor", d: "M24 9.4 22.6 8 16 14.6 9.4 8 8 9.4l6.6 6.6L8 22.6 9.4 24l6.6-6.6 6.6 6.6 1.4-1.4-6.6-6.6L24 9.4z" }) }));
2837
- var close_default = SvgClose;
2838
-
2839
- // src/theme-default/components/Search/logic/Provider.ts
2840
- var LOCAL_INDEX = "LOCAL_INDEX";
2841
-
2842
- // src/theme-default/components/Search/logic/util.ts
2843
- function backTrackHeaders(rawHeaders, index) {
2844
- let current = rawHeaders[index];
2845
- let currentIndex = index;
2846
- const res = [current];
2847
- while (current && current.depth > 2) {
2848
- let matchedParent = false;
2849
- for (let i = currentIndex - 1; i >= 0; i--) {
2850
- const header = rawHeaders[i];
2851
- if (header.depth > 1 && header.depth === current.depth - 1) {
2852
- current = header;
2853
- currentIndex = i;
2854
- res.unshift(current);
2855
- matchedParent = true;
2856
- break;
2857
- }
2858
- }
2859
- if (!matchedParent) {
2860
- break;
2861
- }
2862
- }
2863
- return res;
2864
- }
2865
- function normalizeTextCase(text) {
2866
- return text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
2867
- }
2868
- function removeDomain(url) {
2869
- return url.replace(/https?:\/\/[^/]+/, "");
2870
- }
2871
- function getCharByteCount(char) {
2872
- const charCode = char.charCodeAt(0);
2873
- if (charCode > 255) {
2874
- return 3;
2875
- } else {
2876
- return 1;
2877
- }
2878
- }
2879
- var normalizeSearchIndexes = (items) => {
2880
- return items.map(
2881
- (item) => typeof item === "string" ? {
2882
- value: item,
2883
- label: item
2884
- } : item
2885
- );
2886
- };
2887
- function substrByBytes(str, start, len) {
2888
- let resultStr = "";
2889
- let bytesCount = 0;
2890
- const strLength = str.length;
2891
- for (let i = 0; i < strLength; i++) {
2892
- bytesCount += getCharByteCount(str.charAt(i));
2893
- if (bytesCount > start + len) {
2894
- break;
2895
- } else if (bytesCount > start) {
2896
- resultStr += str.charAt(i);
2897
- }
2898
- }
2899
- return resultStr;
2900
- }
2901
- function byteToCharIndex(str, byteIndex) {
2902
- let charIndex = 0;
2903
- let byteCount = 0;
2904
- for (let i = 0; i < str.length; i++) {
2905
- if (byteCount >= byteIndex) {
2906
- break;
2907
- }
2908
- byteCount += getCharByteCount(str.charAt(i));
2909
- charIndex++;
2910
- }
2911
- return charIndex;
2912
- }
2913
- function getSlicedStrByByteLength(str, start, length) {
2914
- const slicedStr = str.slice(start);
2915
- return substrByBytes(slicedStr, 0, length);
2916
- }
2917
- function getStrByteLength(str) {
2918
- let byteLength = 0;
2919
- for (let i = 0; i < str.length; i++) {
2920
- byteLength += getCharByteCount(str.charAt(i));
2921
- }
2922
- return byteLength;
2923
- }
2924
-
2925
- // src/theme-default/components/Search/logic/providers/LocalProvider.ts
2926
- import FlexSearch from "flexsearch";
2927
- import searchIndexHash from "virtual-search-index-hash";
2928
- import { SEARCH_INDEX_NAME } from "@rspress/shared";
2929
- var cjkRegex = /[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]|[\u4E00-\u9FCC\u3400-\u4DB5\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\ud840-\ud868][\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|[\ud86a-\ud86c][\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d]|[\u3041-\u3096]|[\u30A1-\u30FA]/giu;
2930
- var _index, _cjkIndex, _getPages, getPages_fn;
2931
- var LocalProvider = class {
2932
- constructor() {
2933
- __privateAdd(this, _getPages);
2934
- __privateAdd(this, _index, void 0);
2935
- __privateAdd(this, _cjkIndex, void 0);
2936
- }
2937
- init(options) {
2938
- return __async(this, null, function* () {
2939
- const { currentLang } = options;
2940
- const pagesForSearch = (yield __privateMethod(this, _getPages, getPages_fn).call(this, currentLang)).filter((page) => page.lang === currentLang).map((page) => __spreadProps(__spreadValues({}, page), {
2941
- normalizedContent: normalizeTextCase(page.content),
2942
- headers: page.toc.map((header) => normalizeTextCase(header.text)).join(" "),
2943
- normalizedTitle: normalizeTextCase(page.title)
2944
- }));
2945
- const createOptions = {
2946
- tokenize: "full",
2947
- async: true,
2948
- doc: {
2949
- id: "routePath",
2950
- field: ["normalizedTitle", "headers", "normalizedContent"]
2951
- },
2952
- cache: 100,
2953
- split: /\W+/
2954
- };
2955
- __privateSet(this, _index, FlexSearch.create(createOptions));
2956
- __privateSet(this, _cjkIndex, FlexSearch.create(__spreadProps(__spreadValues({}, createOptions), {
2957
- tokenize(str) {
2958
- const cjkWords = [];
2959
- let m = null;
2960
- do {
2961
- m = cjkRegex.exec(str);
2962
- if (m) {
2963
- cjkWords.push(m[0]);
2964
- }
2965
- } while (m);
2966
- return cjkWords;
2967
- }
2968
- })));
2969
- __privateGet(this, _index).add(pagesForSearch);
2970
- __privateGet(this, _cjkIndex).add(pagesForSearch);
2971
- });
2972
- }
2973
- search(query2) {
2974
- return __async(this, null, function* () {
2975
- var _a, _b;
2976
- const { keyword, limit } = query2;
2977
- const searchParams = {
2978
- query: keyword,
2979
- limit,
2980
- field: ["normalizedTitle", "headers", "normalizedContent"]
2981
- };
2982
- const searchResult = yield Promise.all([
2983
- (_a = __privateGet(this, _index)) == null ? void 0 : _a.search(searchParams),
2984
- (_b = __privateGet(this, _cjkIndex)) == null ? void 0 : _b.search(searchParams)
2985
- ]);
2986
- const flattenSearchResult = searchResult.flat(2).filter(Boolean);
2987
- return [
2988
- {
2989
- index: LOCAL_INDEX,
2990
- hits: flattenSearchResult
2991
- }
2992
- ];
2993
- });
2994
- }
2995
- };
2996
- _index = new WeakMap();
2997
- _cjkIndex = new WeakMap();
2998
- _getPages = new WeakSet();
2999
- getPages_fn = function(lang) {
3000
- return __async(this, null, function* () {
3001
- const result = yield fetch(
3002
- `${process.env.__ASSET_PREFIX__}/static/${SEARCH_INDEX_NAME}.${lang}.${searchIndexHash[lang]}.json`
3003
- );
3004
- return result.json();
3005
- });
3006
- };
3007
-
3008
- // src/theme-default/components/Search/logic/providers/RemoteProvider.ts
3009
- function buildQueryString(params) {
3010
- return Object.entries(params).map((pair) => pair.map(encodeURIComponent).join("=")).join("&");
3011
- }
3012
- var _options;
3013
- var RemoteProvider = class {
3014
- constructor() {
3015
- __privateAdd(this, _options, void 0);
3016
- }
3017
- init(options) {
3018
- return __async(this, null, function* () {
3019
- __privateSet(this, _options, options);
3020
- });
3021
- }
3022
- search(query2) {
3023
- return __async(this, null, function* () {
3024
- const { apiUrl, searchIndexes } = __privateGet(this, _options);
3025
- const { keyword, limit } = query2;
3026
- const urlParams = buildQueryString({
3027
- keyword,
3028
- limit: limit.toString(),
3029
- searchIndexes: (searchIndexes == null ? void 0 : searchIndexes.map(
3030
- (indexInfo) => typeof indexInfo === "string" ? indexInfo : indexInfo.value
3031
- ).join(",")) || "",
3032
- lang: __privateGet(this, _options).currentLang
3033
- });
3034
- try {
3035
- const result = yield fetch(`${apiUrl}?${urlParams}`);
3036
- return result.json();
3037
- } catch (e) {
3038
- console.error(e);
3039
- return [];
3040
- }
3041
- });
3042
- }
3043
- };
3044
- _options = new WeakMap();
3045
-
3046
- // src/theme-default/components/Search/logic/search.ts
3047
- import { normalizeHrefInRuntime as normalizeHref9 } from "@/runtime";
3048
- var THRESHOLD_CONTENT_LENGTH = 100;
3049
- var _options2, _indexName, _provider, _matchResultItem, matchResultItem_fn, _matchTitle, matchTitle_fn, _matchHeader, matchHeader_fn, _matchContent, matchContent_fn, _normalizeStatement, normalizeStatement_fn, _isCurrentIndex, isCurrentIndex_fn;
3050
- var PageSearcher = class {
3051
- constructor(options) {
3052
- __privateAdd(this, _matchResultItem);
3053
- __privateAdd(this, _matchTitle);
3054
- __privateAdd(this, _matchHeader);
3055
- __privateAdd(this, _matchContent);
3056
- __privateAdd(this, _normalizeStatement);
3057
- __privateAdd(this, _isCurrentIndex);
3058
- __privateAdd(this, _options2, void 0);
3059
- __privateAdd(this, _indexName, LOCAL_INDEX);
3060
- __privateAdd(this, _provider, void 0);
3061
- __privateSet(this, _options2, options);
3062
- switch (options.mode) {
3063
- case "remote":
3064
- __privateSet(this, _provider, new RemoteProvider());
3065
- __privateSet(this, _indexName, options.indexName);
3066
- break;
3067
- default:
3068
- __privateSet(this, _provider, new LocalProvider());
3069
- break;
3070
- }
3071
- }
3072
- init() {
3073
- return __async(this, null, function* () {
3074
- var _a;
3075
- yield (_a = __privateGet(this, _provider)) == null ? void 0 : _a.init(__privateGet(this, _options2));
3076
- });
3077
- }
3078
- match(keyword, limit = 7) {
3079
- return __async(this, null, function* () {
3080
- var _a;
3081
- const searchResult = yield (_a = __privateGet(this, _provider)) == null ? void 0 : _a.search({ keyword, limit });
3082
- const normaizedKeyWord = normalizeTextCase(keyword);
3083
- const currentIndexInfo = (searchResult == null ? void 0 : searchResult.find(
3084
- (res) => __privateMethod(this, _isCurrentIndex, isCurrentIndex_fn).call(this, res.index)
3085
- )) || {
3086
- index: LOCAL_INDEX,
3087
- hits: []
3088
- };
3089
- const matchResult = {
3090
- current: __privateMethod(this, _matchResultItem, matchResultItem_fn).call(this, normaizedKeyWord, currentIndexInfo),
3091
- others: ((searchResult == null ? void 0 : searchResult.filter((res) => !__privateMethod(this, _isCurrentIndex, isCurrentIndex_fn).call(this, res.index))) || []).map((res) => ({
3092
- index: res.index,
3093
- items: __privateMethod(this, _matchResultItem, matchResultItem_fn).call(this, normaizedKeyWord, res)
3094
- }))
3095
- };
3096
- return matchResult;
3097
- });
3098
- }
3099
- };
3100
- _options2 = new WeakMap();
3101
- _indexName = new WeakMap();
3102
- _provider = new WeakMap();
3103
- _matchResultItem = new WeakSet();
3104
- matchResultItem_fn = function(normaizedKeyWord, resultItem) {
3105
- const matchedResult = [];
3106
- resultItem == null ? void 0 : resultItem.hits.forEach((item) => {
3107
- __privateMethod(this, _matchTitle, matchTitle_fn).call(this, item, normaizedKeyWord, matchedResult);
3108
- const matchedHeader = __privateMethod(this, _matchHeader, matchHeader_fn).call(this, item, normaizedKeyWord, matchedResult);
3109
- if (matchedHeader) {
3110
- return;
3111
- }
3112
- __privateMethod(this, _matchContent, matchContent_fn).call(this, item, normaizedKeyWord, matchedResult);
3113
- });
3114
- return matchedResult;
3115
- };
3116
- _matchTitle = new WeakSet();
3117
- matchTitle_fn = function(item, query2, matchedResult) {
3118
- const { title = "" } = item;
3119
- const normalizedTitle = normalizeTextCase(title);
3120
- if (normalizedTitle.includes(query2)) {
3121
- matchedResult.push({
3122
- type: "title",
3123
- title,
3124
- header: title,
3125
- link: `${item.domain}${normalizeHref9(item.routePath)}`,
3126
- query: query2,
3127
- highlightInfoList: [
3128
- {
3129
- start: normalizedTitle.indexOf(query2),
3130
- length: getStrByteLength(query2)
3131
- }
3132
- ],
3133
- group: __privateGet(this, _options2).extractGroupName(item.routePath)
3134
- });
3135
- return true;
3136
- }
3137
- return false;
3138
- };
3139
- _matchHeader = new WeakSet();
3140
- matchHeader_fn = function(item, query2, matchedResult) {
3141
- const { toc = [], domain = "", title = "" } = item;
3142
- for (const [index, header] of toc.entries()) {
3143
- const normalizedHeader = normalizeTextCase(header.text);
3144
- if (normalizedHeader.includes(query2)) {
3145
- const headerGroup = backTrackHeaders(toc, index);
3146
- const headerStr = headerGroup.map((item2) => item2.text).join(" > ");
3147
- const headerMatchIndex = normalizeTextCase(headerStr).indexOf(query2);
3148
- const titlePrefix = `${title} > `;
3149
- matchedResult.push({
3150
- type: "header",
3151
- title: item.title,
3152
- header: `${titlePrefix}${headerStr}`,
3153
- highlightInfoList: [
3154
- {
3155
- start: headerMatchIndex + titlePrefix.length,
3156
- length: getStrByteLength(query2)
3157
- }
3158
- ],
3159
- link: `${domain}${normalizeHref9(item.routePath)}#${header.id}`,
3160
- query: query2,
3161
- group: __privateGet(this, _options2).extractGroupName(item.routePath)
3162
- });
3163
- return true;
3164
- }
3165
- }
3166
- return false;
3167
- };
3168
- _matchContent = new WeakSet();
3169
- matchContent_fn = function(item, query2, matchedResult) {
3170
- var _a, _b, _c;
3171
- const { content, toc, domain } = item;
3172
- if (!content.length) {
3173
- return;
3174
- }
3175
- const normalizedContent = normalizeTextCase(content);
3176
- let queryIndex = normalizedContent.indexOf(query2);
3177
- const headersIndex = toc.map((h) => h.charIndex);
3178
- const getCurrentHeader = (currentIndex) => {
3179
- const currentHeaderIndex = headersIndex.findIndex((hIndex, position) => {
3180
- if (position < toc.length - 1) {
3181
- const next = headersIndex[position + 1];
3182
- if (hIndex <= currentIndex && next >= currentIndex) {
3183
- return true;
3184
- }
3185
- } else {
3186
- return hIndex < currentIndex;
3187
- }
3188
- return false;
3189
- });
3190
- return toc[currentHeaderIndex];
3191
- };
3192
- if (queryIndex === -1) {
3193
- const hightlightItems = (_a = item._matchesPosition) == null ? void 0 : _a.content;
3194
- if (!(hightlightItems == null ? void 0 : hightlightItems.length)) {
3195
- return;
3196
- }
3197
- const highlightStartIndex = item._matchesPosition.content[0].start;
3198
- const currentHeader = getCurrentHeader(highlightStartIndex);
3199
- const statementStartIndex = byteToCharIndex(content, highlightStartIndex);
3200
- const statementEndIndex = byteToCharIndex(
3201
- content,
3202
- highlightStartIndex + THRESHOLD_CONTENT_LENGTH
3203
- );
3204
- const statement = content.slice(statementStartIndex, statementEndIndex);
3205
- const highlightInfoList = item._matchesPosition.content.filter(
3206
- (match) => match.start >= highlightStartIndex && match.start + match.length <= highlightStartIndex + THRESHOLD_CONTENT_LENGTH
3207
- ).map((match) => {
3208
- const startCharIndex = byteToCharIndex(content, match.start) - statementStartIndex + 3;
3209
- return {
3210
- // prefix `...` length is 3
3211
- start: startCharIndex,
3212
- length: match.length
3213
- };
3214
- });
3215
- matchedResult.push({
3216
- type: "content",
3217
- title: item.title,
3218
- header: (_b = currentHeader == null ? void 0 : currentHeader.text) != null ? _b : item.title,
3219
- link: `${domain}${normalizeHref9(item.routePath)}${currentHeader ? `#${currentHeader.id}` : ""}`,
3220
- query: query2,
3221
- highlightInfoList,
3222
- group: __privateGet(this, _options2).extractGroupName(item.routePath),
3223
- statement: `...${statement}...`
3224
- });
3225
- return;
3226
- }
3227
- while (queryIndex !== -1) {
3228
- const currentHeader = getCurrentHeader(queryIndex);
3229
- let statementStartIndex = content.slice(0, queryIndex).lastIndexOf("\n");
3230
- statementStartIndex = statementStartIndex === -1 ? 0 : statementStartIndex;
3231
- const statementEndIndex = content.indexOf(
3232
- "\n\n",
3233
- queryIndex + query2.length
3234
- );
3235
- let statement = content.slice(statementStartIndex, statementEndIndex);
3236
- if (statement.length > THRESHOLD_CONTENT_LENGTH) {
3237
- statement = __privateMethod(this, _normalizeStatement, normalizeStatement_fn).call(this, statement, query2);
3238
- }
3239
- const highlightIndex = normalizeTextCase(statement).indexOf(query2);
3240
- const highlightInfoList = [
3241
- {
3242
- start: highlightIndex,
3243
- length: getStrByteLength(query2)
3244
- }
3245
- ];
3246
- matchedResult.push({
3247
- type: "content",
3248
- title: item.title,
3249
- header: (_c = currentHeader == null ? void 0 : currentHeader.text) != null ? _c : item.title,
3250
- statement,
3251
- highlightInfoList,
3252
- link: `${domain}${normalizeHref9(item.routePath)}${currentHeader ? `#${currentHeader.id}` : ""}`,
3253
- query: query2,
3254
- group: __privateGet(this, _options2).extractGroupName(item.routePath)
3255
- });
3256
- queryIndex = normalizedContent.indexOf(
3257
- query2,
3258
- queryIndex + statement.length - highlightIndex
3259
- );
3260
- }
3261
- };
3262
- _normalizeStatement = new WeakSet();
3263
- normalizeStatement_fn = function(statement, query2) {
3264
- const queryIndex = normalizeTextCase(statement).indexOf(
3265
- normalizeTextCase(query2)
3266
- );
3267
- const maxPrefixOrSuffix = Math.floor(
3268
- (THRESHOLD_CONTENT_LENGTH - query2.length) / 2
3269
- );
3270
- let prefix = statement.slice(0, queryIndex);
3271
- if (prefix.length > maxPrefixOrSuffix) {
3272
- prefix = `...${statement.slice(
3273
- queryIndex - maxPrefixOrSuffix + 3,
3274
- queryIndex
3275
- )}`;
3276
- }
3277
- let suffix = statement.slice(queryIndex + query2.length);
3278
- if (suffix.length > maxPrefixOrSuffix) {
3279
- suffix = `${statement.slice(
3280
- queryIndex + query2.length,
3281
- queryIndex + maxPrefixOrSuffix - 3
3282
- )}...`;
3283
- }
3284
- return prefix + query2 + suffix;
3285
- };
3286
- _isCurrentIndex = new WeakSet();
3287
- isCurrentIndex_fn = function(index) {
3288
- return index === __privateGet(this, _indexName) || index === LOCAL_INDEX;
3289
- };
3290
-
3291
- // src/theme-default/components/Search/assets/file.svg
3292
- import * as React16 from "react";
3293
- import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
3294
- var SvgFile = (props) => /* @__PURE__ */ jsxs27("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 32 32" }, props), { children: [
3295
- /* @__PURE__ */ jsx45("circle", { cx: 22, cy: 24, r: 2, fill: "currentColor" }),
3296
- /* @__PURE__ */ jsx45("path", { fill: "none", d: "M22 28a4 4 0 1 1 4-4 4.004 4.004 0 0 1-4 4Zm0-6a2 2 0 1 0 2 2 2.003 2.003 0 0 0-2-2Z" }),
3297
- /* @__PURE__ */ jsx45("path", { fill: "currentColor", d: "M29.777 23.479A8.64 8.64 0 0 0 22 18a8.64 8.64 0 0 0-7.777 5.479L14 24l.223.521A8.64 8.64 0 0 0 22 30a8.64 8.64 0 0 0 7.777-5.479L30 24ZM22 28a4 4 0 1 1 4-4 4.005 4.005 0 0 1-4 4Z" }),
3298
- /* @__PURE__ */ jsx45("path", { fill: "currentColor", d: "M12 28H8V4h8v6a2.006 2.006 0 0 0 2 2h6v4h2v-6a.91.91 0 0 0-.3-.7l-7-7A.909.909 0 0 0 18 2H8a2.006 2.006 0 0 0-2 2v24a2.006 2.006 0 0 0 2 2h4Zm6-23.6 5.6 5.6H18Z" })
3299
- ] }));
3300
- var file_default = SvgFile;
3301
-
3302
- // src/theme-default/components/Search/assets/jump.svg
3303
- import * as React17 from "react";
3304
- import { jsx as jsx46 } from "react/jsx-runtime";
3305
- var SvgJump = (props) => /* @__PURE__ */ jsx46("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx46("path", { fill: "currentColor", d: "M13.414 17.586 18 22.172V8H8V6h10a2.002 2.002 0 0 1 2 2v14.172l4.586-4.586L26 19l-7 7-7-7Z" }) }));
3306
- var jump_default = SvgJump;
3307
-
3308
- // src/theme-default/components/Search/assets/header.svg
3309
- import * as React18 from "react";
3310
- import { jsx as jsx47 } from "react/jsx-runtime";
3311
- var SvgHeader = (props) => /* @__PURE__ */ jsx47("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 32 32" }, props), { children: /* @__PURE__ */ jsx47("path", { fill: "currentColor", d: "M28 12v-2h-6V4h-2v6h-8V4h-2v6H4v2h6v8H4v2h6v6h2v-6h8v6h2v-6h6v-2h-6v-8Zm-8 8h-8v-8h8Z" }) }));
3312
- var header_default = SvgHeader;
3313
-
3314
- // src/theme-default/components/Search/assets/title.svg
3315
- import * as React19 from "react";
3316
- import { jsx as jsx48 } from "react/jsx-runtime";
3317
- var SvgTitle = (props) => /* @__PURE__ */ jsx48("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24 }, props), { children: /* @__PURE__ */ jsx48("path", { fill: "currentColor", d: "M4 4a2 2 0 0 1 2-2h8a1 1 0 0 1 .707.293l5 5A1 1 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4zm13.586 4L14 4.414V8h3.586zM12 4H6v16h12V10h-5a1 1 0 0 1-1-1V4z" }) }));
3318
- var title_default = SvgTitle;
3319
-
3320
- // src/theme-default/components/Search/SuggestItem.tsx
3321
- import { isProduction } from "@/runtime";
3322
- import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
3323
- var ICON_MAP = {
3324
- title: title_default,
3325
- header: header_default,
3326
- content: file_default
3327
- };
3328
- function SuggestItem({
3329
- suggestion,
3330
- closeSearch,
3331
- isCurrent,
3332
- setCurrentSuggestionIndex,
3333
- inCurrentDocIndex
3334
- }) {
3335
- const HitIcon = ICON_MAP[suggestion.type];
3336
- const link = inCurrentDocIndex && !isProduction() ? removeDomain(suggestion.link) : suggestion.link;
3337
- const getHighlightedFragments = (rawText, highlights) => {
3338
- const framegmentList = [];
3339
- let lastIndex = 0;
3340
- for (const highlightInfo of highlights) {
3341
- const { start, length } = highlightInfo;
3342
- const prefix = rawText.slice(lastIndex, start);
3343
- const queryStr = getSlicedStrByByteLength(rawText, start, length);
3344
- framegmentList.push(prefix);
3345
- framegmentList.push(
3346
- /* @__PURE__ */ jsx49("span", { className: index_module_default14.mark, children: queryStr }, start)
3347
- );
3348
- lastIndex = start + queryStr.length;
3349
- }
3350
- if (lastIndex < rawText.length) {
3351
- framegmentList.push(rawText.slice(lastIndex));
3352
- }
3353
- return framegmentList;
3354
- };
3355
- const renderHeaderMatch = () => {
3356
- if (suggestion.type === "header" || suggestion.type === "title") {
3357
- const { header, highlightInfoList } = suggestion;
3358
- return /* @__PURE__ */ jsx49("div", { className: "font-medium", children: getHighlightedFragments(header, highlightInfoList) });
3359
- } else {
3360
- return /* @__PURE__ */ jsx49("div", { className: "font-medium", children: suggestion.header });
3361
- }
3362
- };
3363
- const renderStatementMatch = () => {
3364
- if (suggestion.type !== "content") {
3365
- return /* @__PURE__ */ jsx49("div", {});
3366
- }
3367
- const { statement, highlightInfoList } = suggestion;
3368
- return /* @__PURE__ */ jsx49("div", { className: "text-sm text-gray-light w-full", children: getHighlightedFragments(statement, highlightInfoList) });
3369
- };
3370
- let hitContent = null;
3371
- switch (suggestion.type) {
3372
- case "title":
3373
- case "header":
3374
- hitContent = renderHeaderMatch();
3375
- break;
3376
- case "content":
3377
- hitContent = /* @__PURE__ */ jsxs28(Fragment7, { children: [
3378
- renderStatementMatch(),
3379
- /* @__PURE__ */ jsx49("p", { className: index_module_default14.titleForContent, children: suggestion.title })
3380
- ] });
3381
- break;
3382
- default:
3383
- break;
3384
- }
3385
- return /* @__PURE__ */ jsx49(
3386
- "li",
3387
- {
3388
- className: `${index_module_default14.suggestItem} ${isCurrent ? index_module_default14.current : ""}`,
3389
- onMouseEnter: setCurrentSuggestionIndex,
3390
- children: /* @__PURE__ */ jsx49(
3391
- "a",
3392
- {
3393
- href: link,
3394
- onClick: (e) => {
3395
- closeSearch();
3396
- e.stopPropagation();
3397
- },
3398
- target: inCurrentDocIndex ? "_self" : "_blank",
3399
- children: /* @__PURE__ */ jsxs28("div", { className: index_module_default14.suggestItemContainer, children: [
3400
- /* @__PURE__ */ jsx49("div", { className: index_module_default14.hitIcon, children: /* @__PURE__ */ jsx49(HitIcon, {}) }),
3401
- /* @__PURE__ */ jsx49("div", { className: index_module_default14.contentWrapper, children: /* @__PURE__ */ jsx49("span", { children: hitContent }) }),
3402
- /* @__PURE__ */ jsx49("div", { className: index_module_default14.actionIcon, children: /* @__PURE__ */ jsx49(jump_default, {}) })
3403
- ] })
3404
- }
3405
- )
3406
- },
3407
- suggestion.link
3408
- );
3409
- }
3410
-
3411
- // src/theme-default/components/Search/empty.svg
3412
- import * as React20 from "react";
3413
- import { jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
3414
- var SvgEmpty = (props) => /* @__PURE__ */ jsxs29("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: 48, height: 48, fill: "none" }, props), { children: [
3415
- /* @__PURE__ */ jsx50("path", { stroke: "currentColor", strokeWidth: 4, d: "M24 5v6m7 1 4-4m-18 4-4-4m27 33H8a2 2 0 0 1-2-2v-8.46a2 2 0 0 1 .272-1.007l6.15-10.54A2 2 0 0 1 14.148 18H33.85a2 2 0 0 1 1.728.992l6.149 10.541A2 2 0 0 1 42 30.541V39a2 2 0 0 1-2 2Z" }),
3416
- /* @__PURE__ */ jsx50("path", { stroke: "currentColor", strokeWidth: 4, d: "M41.5 30H28s-1 3-4 3-4-3-4-3H6.5" })
3417
- ] }));
3418
- var empty_default = SvgEmpty;
3419
-
3420
- // src/theme-default/components/Search/NoSearchResult.tsx
3421
- import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
3422
- function NoSearchResult({ query: query2 }) {
3423
- return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col items-center pt-8 pb-2", children: [
3424
- /* @__PURE__ */ jsx51(empty_default, { className: "mb-4 opacity-80" }),
3425
- /* @__PURE__ */ jsxs30("p", { className: "mb-2", children: [
3426
- "No results for ",
3427
- /* @__PURE__ */ jsxs30("b", { children: [
3428
- '"',
3429
- query2,
3430
- '"'
3431
- ] }),
3432
- "."
3433
- ] }),
3434
- /* @__PURE__ */ jsx51("p", { children: "Please try again with a different keyword." })
3435
- ] });
3436
- }
3437
-
3438
- // src/theme-default/components/Search/SearchPanel.tsx
3439
- import { isProduction as isProduction2, usePageData as usePageData14 } from "@/runtime";
3440
- import { Fragment as Fragment8, jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
3441
- var KEY_CODE = {
3442
- ARROW_UP: "ArrowUp",
3443
- ARROW_DOWN: "ArrowDown",
3444
- ENTER: "Enter",
3445
- SEARCH: "KeyK",
3446
- ESC: "Escape"
3447
- };
3448
- var RECOMMEND_WORD = {
3449
- zh: "其它站点推荐结果",
3450
- en: "Other Site Search Results"
3451
- };
3452
- function SearchPanel({ focused, setFocused }) {
3453
- const [query2, setQuery] = useState14("");
3454
- const [searchResult, setSearchResult] = useState14({
3455
- current: [],
3456
- others: []
3457
- });
3458
- const searchInputRef = useRef5(null);
3459
- const [initing, setIniting] = useState14(true);
3460
- const [currentSuggestionIndex, setCurrentSuggestionIndex] = useState14(0);
3461
- const pageSearcherRef = useRef5(null);
3462
- const {
3463
- siteData: siteData2,
3464
- page: { lang }
3465
- } = usePageData14();
3466
- const { sidebar } = useLocaleSiteData();
3467
- const { search } = siteData2;
3468
- const suggestions = [
3469
- ...searchResult.current,
3470
- ...searchResult.others.map((item) => item.items)
3471
- ].flat();
3472
- const extractGroupName = (link) => getSidebarGroupData(sidebar, link).group;
3473
- function initPageSearcher() {
3474
- return __async(this, null, function* () {
3475
- var _a, _b;
3476
- if (search === false) {
3477
- return;
3478
- }
3479
- const pageSearcher = new PageSearcher(__spreadProps(__spreadValues({}, search), {
3480
- currentLang: lang,
3481
- extractGroupName
3482
- }));
3483
- pageSearcherRef.current = pageSearcher;
3484
- yield pageSearcherRef.current.init();
3485
- setIniting(false);
3486
- const query3 = (_a = searchInputRef.current) == null ? void 0 : _a.value;
3487
- if (query3) {
3488
- const matched = yield (_b = pageSearcherRef.current) == null ? void 0 : _b.match(query3);
3489
- setSearchResult(matched || { current: [], others: [] });
3490
- }
3491
- });
3492
- }
3493
- useEffect14(() => {
3494
- const onKeyDown = (e) => {
3495
- switch (e.code) {
3496
- case KEY_CODE.SEARCH:
3497
- if (e.ctrlKey || e.metaKey) {
3498
- e.preventDefault();
3499
- setFocused(!focused);
3500
- }
3501
- break;
3502
- case KEY_CODE.ARROW_DOWN:
3503
- if (focused) {
3504
- e.preventDefault();
3505
- setCurrentSuggestionIndex(
3506
- (currentSuggestionIndex + 1) % suggestions.length
3507
- );
3508
- }
3509
- break;
3510
- case KEY_CODE.ARROW_UP:
3511
- if (focused) {
3512
- e.preventDefault();
3513
- setCurrentSuggestionIndex(
3514
- (currentSuggestionIndex - 1 + suggestions.length) % suggestions.length
3515
- );
3516
- }
3517
- break;
3518
- case KEY_CODE.ENTER:
3519
- if (currentSuggestionIndex >= 0) {
3520
- const suggestion = suggestions[currentSuggestionIndex];
3521
- const isCurrent = currentSuggestionIndex < searchResult.current.length;
3522
- if (isCurrent) {
3523
- window.location.href = isProduction2() ? suggestion.link : removeDomain(suggestion.link);
3524
- setFocused(false);
3525
- } else {
3526
- window.open(suggestion.link);
3527
- }
3528
- }
3529
- break;
3530
- case KEY_CODE.ESC:
3531
- setFocused(false);
3532
- break;
3533
- default:
3534
- break;
3535
- }
3536
- };
3537
- document.addEventListener("keydown", onKeyDown);
3538
- return () => {
3539
- document.removeEventListener("keydown", onKeyDown);
3540
- };
3541
- }, [
3542
- setCurrentSuggestionIndex,
3543
- setFocused,
3544
- suggestions,
3545
- currentSuggestionIndex
3546
- ]);
3547
- useEffect14(() => {
3548
- if (focused) {
3549
- setSearchResult({ current: [], others: [] });
3550
- if (!pageSearcherRef.current) {
3551
- initPageSearcher();
3552
- }
3553
- }
3554
- }, [focused]);
3555
- useEffect14(() => {
3556
- !initing && initPageSearcher();
3557
- }, [lang]);
3558
- const onQueryChanged = (e) => __async(this, null, function* () {
3559
- var _a;
3560
- const newQuery = e.target.value;
3561
- setQuery(newQuery);
3562
- if (newQuery) {
3563
- yield onSearch(newQuery);
3564
- const matched = yield (_a = pageSearcherRef.current) == null ? void 0 : _a.match(newQuery);
3565
- setSearchResult(matched || { current: [], others: [] });
3566
- }
3567
- });
3568
- const normalizeSuggestions = (suggestions2) => groupBy(suggestions2, "group");
3569
- let accumulateIndex = -1;
3570
- const renderSearchResult = (result, searchOptions) => {
3571
- if (!suggestions.length && !initing) {
3572
- return /* @__PURE__ */ jsx52(NoSearchResult, { query: query2 });
3573
- }
3574
- const hasOtherResult = searchResult.others.map((item) => item.items).flat().length > 0;
3575
- const tabValues = result.others.map((item) => {
3576
- if (!searchOptions || searchOptions.mode !== "remote") {
3577
- return item;
3578
- }
3579
- const indexItem = normalizeSearchIndexes(
3580
- searchOptions.searchIndexes || []
3581
- ).find((indexInfo) => indexInfo.value === item.index);
3582
- return indexItem.label;
3583
- });
3584
- return /* @__PURE__ */ jsxs31("div", { children: [
3585
- renderSearchResultItem(result.current),
3586
- hasOtherResult && /* @__PURE__ */ jsx52("h2", { className: index_module_default14.groupTitle, children: RECOMMEND_WORD[lang] }),
3587
- /* @__PURE__ */ jsx52("div", { style: { marginTop: "-12px" }, children: /* @__PURE__ */ jsx52(Tabs, { values: tabValues, tabContainerClassName: index_module_default14.tabClassName, children: result.others.map((item) => /* @__PURE__ */ jsx52(Tab, { children: renderSearchResultItem(item.items, false) }, item.index)) }) })
3588
- ] });
3589
- };
3590
- const renderSearchResultItem = (suggestionList, isCurrent = true) => {
3591
- if (suggestionList.length === 0 && !initing) {
3592
- return /* @__PURE__ */ jsx52("div", { className: "mt-4 flex-center", children: /* @__PURE__ */ jsx52(
3593
- "div",
3594
- {
3595
- className: "p-2 font-bold text-md",
3596
- style: {
3597
- color: "#2c3e50"
3598
- },
3599
- children: "No results found"
3600
- }
3601
- ) });
3602
- }
3603
- const normalizedSuggestions = normalizeSuggestions(suggestionList);
3604
- return /* @__PURE__ */ jsx52("ul", { className: index_module_default14.suggestList, children: Object.keys(normalizedSuggestions).map((group) => {
3605
- const groupSuggestions = normalizedSuggestions[group] || [];
3606
- return /* @__PURE__ */ jsxs31("li", { children: [
3607
- isCurrent && /* @__PURE__ */ jsx52("h2", { className: index_module_default14.groupTitle, children: group }),
3608
- /* @__PURE__ */ jsx52("ul", { className: "pb-2", children: groupSuggestions.map((suggestion) => {
3609
- accumulateIndex++;
3610
- const suggestionIndex = accumulateIndex;
3611
- return /* @__PURE__ */ jsx52(
3612
- SuggestItem,
3613
- {
3614
- suggestion,
3615
- isCurrent: suggestionIndex === currentSuggestionIndex,
3616
- setCurrentSuggestionIndex: () => {
3617
- setCurrentSuggestionIndex(suggestionIndex);
3618
- },
3619
- closeSearch: () => setFocused(false),
3620
- inCurrentDocIndex: suggestionIndex < searchResult.current.length
3621
- },
3622
- `${suggestion.title}-${suggestionIndex}`
3623
- );
3624
- }) })
3625
- ] }, group);
3626
- }) });
3627
- };
3628
- return /* @__PURE__ */ jsx52(Fragment8, { children: focused && createPortal(
3629
- /* @__PURE__ */ jsx52("div", { className: index_module_default14.mask, onClick: () => setFocused(false), children: /* @__PURE__ */ jsxs31(
3630
- "div",
3631
- {
3632
- className: `${index_module_default14.modal}`,
3633
- onClick: (e) => {
3634
- setFocused(true);
3635
- e.stopPropagation();
3636
- },
3637
- children: [
3638
- /* @__PURE__ */ jsxs31("div", { className: "flex items-center", children: [
3639
- /* @__PURE__ */ jsxs31("div", { className: index_module_default14.inputForm, children: [
3640
- /* @__PURE__ */ jsx52("label", { children: /* @__PURE__ */ jsx52(search_default, {}) }),
3641
- /* @__PURE__ */ jsx52(
3642
- "input",
3643
- {
3644
- className: index_module_default14.input,
3645
- ref: searchInputRef,
3646
- placeholder: "Search Docs",
3647
- "aria-label": "Search",
3648
- autoComplete: "off",
3649
- autoFocus: true,
3650
- onChange: debounce(onQueryChanged, 150)
3651
- }
3652
- ),
3653
- /* @__PURE__ */ jsx52("label", { children: /* @__PURE__ */ jsx52(
3654
- close_default,
3655
- {
3656
- className: index_module_default14.close,
3657
- onClick: (e) => {
3658
- if (searchInputRef.current) {
3659
- e.stopPropagation();
3660
- if (!query2) {
3661
- setFocused(false);
3662
- } else {
3663
- searchInputRef.current.value = "";
3664
- setQuery("");
3665
- }
3666
- }
3667
- }
3668
- }
3669
- ) })
3670
- ] }),
3671
- /* @__PURE__ */ jsx52(
3672
- "h2",
3673
- {
3674
- className: "text-brand ml-2 sm:hidden cursor-pointer",
3675
- onClick: (e) => {
3676
- e.stopPropagation();
3677
- setFocused(false);
3678
- },
3679
- children: "Cancel"
3680
- }
3681
- )
3682
- ] }),
3683
- query2 ? /* @__PURE__ */ jsx52("div", { className: `${index_module_default14.searchHits} rspress-scrollbar`, children: renderSearchResult(searchResult, search) }) : null,
3684
- initing && /* @__PURE__ */ jsx52("div", { className: "flex-center", children: /* @__PURE__ */ jsx52("div", { className: "p-2 text-sm", children: /* @__PURE__ */ jsx52(loading_default, {}) }) })
3685
- ]
3686
- }
3687
- ) }),
3688
- document.getElementById("search-container")
3689
- ) });
3690
- }
3691
-
3692
- // src/theme-default/components/Search/index.tsx
3693
- import { Fragment as Fragment9, jsx as jsx53, jsxs as jsxs32 } from "react/jsx-runtime";
3694
- function Search2() {
3695
- const [focused, setFocused] = useState15(false);
3696
- const [metaKey, setMetaKey] = useState15(null);
3697
- useEffect15(() => {
3698
- setMetaKey(
3699
- /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘" : "Ctrl"
3700
- );
3701
- }, []);
3702
- return /* @__PURE__ */ jsxs32(Fragment9, { children: [
3703
- /* @__PURE__ */ jsx53("div", { className: index_module_default14.navSearchButton, onClick: () => setFocused(true), children: /* @__PURE__ */ jsxs32("button", { children: [
3704
- /* @__PURE__ */ jsx53(search_default, { width: "18", hight: "18" }),
3705
- /* @__PURE__ */ jsx53("p", { className: index_module_default14.searchWord, children: "Search Docs" }),
3706
- /* @__PURE__ */ jsxs32("div", { style: { opacity: metaKey ? 1 : 0 }, children: [
3707
- /* @__PURE__ */ jsx53("span", { children: metaKey }),
3708
- /* @__PURE__ */ jsx53("span", { children: "K" })
3709
- ] })
3710
- ] }) }),
3711
- /* @__PURE__ */ jsx53(
3712
- "div",
3713
- {
3714
- className: index_module_default14.mobileNavSearchButton,
3715
- onClick: () => setFocused(true),
3716
- children: /* @__PURE__ */ jsx53(search_default, {})
3717
- }
3718
- ),
3719
- /* @__PURE__ */ jsx53(SearchPanel, { focused, setFocused })
3720
- ] });
3721
- }
3722
-
3723
- // src/theme-default/components/HomeFooter/index.tsx
3724
- import { usePageData as usePageData15 } from "@/runtime";
3725
- import { jsx as jsx54 } from "react/jsx-runtime";
3726
- function HomeFooter2() {
3727
- const { siteData: siteData2 } = usePageData15();
3728
- const { message } = siteData2.themeConfig.footer || {};
3729
- return /* @__PURE__ */ jsx54("footer", { className: "absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light", children: /* @__PURE__ */ jsx54("div", { className: "m-auto w-full text-center", children: message && /* @__PURE__ */ jsx54("div", { className: "font-meduim text-sm text-text-2", children: message }) }) });
3730
- }
3731
-
3732
- // src/theme-default/components/Toc/index.tsx
3733
- import { usePageData as usePageData16 } from "@/runtime";
3734
- import { jsx as jsx55 } from "react/jsx-runtime";
3735
- var TocItem = (header) => {
3736
- return /* @__PURE__ */ jsx55("li", { className: "py-1", children: /* @__PURE__ */ jsx55(
3737
- "a",
3738
- {
3739
- href: `#${header.id}`,
3740
- className: "toc-link transition-all duration-300 hover:text-text-1 text-text-2 block underline underline-offset-2",
3741
- style: {
3742
- marginLeft: header.depth * 12
3743
- },
3744
- onClick: (e) => {
3745
- e.preventDefault();
3746
- window.location.hash = header.id;
3747
- const target = document.getElementById(header.id);
3748
- if (target) {
3749
- scrollToTarget(target, false);
3750
- }
3751
- },
3752
- children: /* @__PURE__ */ jsx55("span", { className: "toc-link-text block", children: header.text })
3753
- }
3754
- ) }, header.id);
3755
- };
3756
- function Toc() {
3757
- const { page } = usePageData16();
3758
- return /* @__PURE__ */ jsx55("ul", { children: page.toc.map((item) => /* @__PURE__ */ jsx55(TocItem, __spreadValues({}, item), item.id)) });
3759
- }
3760
-
3761
- // src/theme-default/layout/DocLayout/docComponents/pre.tsx
3762
- import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
3763
- var DEFAULT_LANGUAGE_CLASS = "language-bash";
3764
- function parseTitleFromMeta(meta) {
3765
- var _a, _b;
3766
- if (!meta) {
3767
- return "";
3768
- }
3769
- let result = meta;
3770
- const highlightReg = /{[\d,-]*}/i;
3771
- const highlightMeta = (_a = highlightReg.exec(meta)) == null ? void 0 : _a[0];
3772
- if (highlightMeta) {
3773
- result = meta.replace(highlightReg, "").trim();
3774
- }
3775
- result = (_b = result.split("=")[1]) != null ? _b : "";
3776
- return result == null ? void 0 : result.replace(/["'`]/g, "");
3777
- }
3778
- function Pre({
3779
- children
3780
- }) {
3781
- if (Array.isArray(children)) {
3782
- return /* @__PURE__ */ jsx56("pre", { children });
3783
- }
3784
- const { className, meta } = children.props;
3785
- const codeTitle = parseTitleFromMeta(meta);
3786
- return /* @__PURE__ */ jsxs33("div", { className: className || DEFAULT_LANGUAGE_CLASS, children: [
3787
- codeTitle && /* @__PURE__ */ jsx56("div", { className: "rspress-code-title", children: codeTitle }),
3788
- /* @__PURE__ */ jsx56("div", { className: "rspress-code-content rspress-scrollbar", children })
3789
- ] });
3790
- }
3791
-
3792
- // src/theme-default/layout/DocLayout/docComponents/code.tsx
3793
- import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
3794
- import languagesInfo from "virtual-prism-languages";
3795
- import copy from "copy-to-clipboard";
3796
- import { useRef as useRef6 } from "react";
3797
-
3798
- // src/theme-default/layout/DocLayout/docComponents/prisim-theme.ts
3799
- var prisim_theme_default = {
3800
- doctype: {
3801
- color: "var(--code-token-text)",
3802
- fontStyle: "italic"
3803
- },
3804
- token: {
3805
- color: "var(--code-token-text)"
3806
- },
3807
- comment: {
3808
- color: "var(--code-token-comment)"
3809
- },
3810
- punctuation: {
3811
- color: "var(--code-token-punctuation)"
3812
- },
3813
- property: {
3814
- color: "var(--code-token-parameter)"
3815
- },
3816
- constant: {
3817
- color: "var(--code-token-constant)"
3818
- },
3819
- string: {
3820
- color: "var(--code-token-string)"
3821
- },
3822
- symbol: {
3823
- color: "var(--code-token-symbol)"
3824
- },
3825
- variable: {
3826
- color: "var(--code-token-variable)"
3827
- },
3828
- "attr-name": {
3829
- color: "var(--code-token-symbol)"
3830
- },
3831
- "attr-value": {
3832
- color: "var(--code-token-string-expression)"
3833
- },
3834
- builtin: {
3835
- color: "var(--code-token-symbol)"
3836
- },
3837
- function: {
3838
- color: "var(--code-token-function)"
3839
- },
3840
- keyword: {
3841
- color: "var(--code-token-keyword)"
3842
- },
3843
- tag: {
3844
- color: "var(--code-token-function)"
3845
- },
3846
- inserted: {
3847
- color: "#22863a"
3848
- },
3849
- deleted: {
3850
- color: "#b31d28"
3851
- },
3852
- regex: {
3853
- color: "var(--code-token-keyword)"
3854
- },
3855
- key: {
3856
- color: "var(--code-token-variable)"
3857
- },
3858
- title: {
3859
- color: "var(--code-token-keyword)"
3860
- },
3861
- important: {
3862
- color: "#EBCB8B",
3863
- fontWeight: "bold"
3864
- },
3865
- bold: {
3866
- fontWeight: "bold"
3867
- },
3868
- italic: {
3869
- fontStyle: "italic"
3870
- }
3871
- };
3872
-
3873
- // src/theme-default/layout/DocLayout/docComponents/code.tsx
3874
- import { usePageData as usePageData17 } from "@/runtime";
3875
- import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
3876
- var registered = false;
3877
- var timeoutIdMap = /* @__PURE__ */ new Map();
3878
- function registerLanguages() {
3879
- Object.keys(languagesInfo).forEach((key) => {
3880
- SyntaxHighlighter.registerLanguage(key, languagesInfo[key]);
3881
- });
3882
- registered = true;
3883
- }
3884
- function Code(props) {
3885
- var _a;
3886
- const copyButtonRef = useRef6(null);
3887
- const { siteData: siteData2 } = usePageData17();
3888
- const { showLineNumbers } = siteData2.markdown;
3889
- if (!registered) {
3890
- registerLanguages();
3891
- }
3892
- const { className, meta } = props;
3893
- const language = className == null ? void 0 : className.replace(/language-/, "");
3894
- if (!language) {
3895
- return /* @__PURE__ */ jsx57("code", __spreadValues({}, props));
3896
- }
3897
- let children;
3898
- if (typeof props.children === "string") {
3899
- children = props.children.trim();
3900
- } else if (Array.isArray(props.children)) {
3901
- children = props.children[0].trim();
3902
- } else {
3903
- children = "";
3904
- }
3905
- let highlightMeta = "";
3906
- let highlightLines = [];
3907
- if (meta) {
3908
- const highlightReg = /{[\d,-]*}/i;
3909
- highlightMeta = ((_a = highlightReg.exec(meta)) == null ? void 0 : _a[0]) || "";
3910
- if (highlightMeta) {
3911
- highlightLines = highlightMeta.replace(/[{}]/g, "").split(",").map((item) => {
3912
- const [start, end] = item.split("-");
3913
- if (end) {
3914
- return Array.from(
3915
- { length: Number(end) - Number(start) + 1 },
3916
- (_, i) => i + Number(start)
3917
- );
3918
- }
3919
- return Number(start);
3920
- }).flat();
3921
- }
3922
- }
3923
- const copyCode = () => {
3924
- const isCopied = copy(children);
3925
- const el = copyButtonRef.current;
3926
- if (isCopied && el) {
3927
- el.classList.add("copied");
3928
- clearTimeout(timeoutIdMap.get(el));
3929
- const timeoutId = setTimeout(() => {
3930
- el.classList.remove("copied");
3931
- el.blur();
3932
- timeoutIdMap.delete(el);
3933
- }, 2e3);
3934
- timeoutIdMap.set(el, timeoutId);
3935
- }
3936
- };
3937
- return /* @__PURE__ */ jsxs34(Fragment10, { children: [
3938
- /* @__PURE__ */ jsx57(
3939
- SyntaxHighlighter,
3940
- {
3941
- language,
3942
- style: prisim_theme_default,
3943
- wrapLines: true,
3944
- className: "code",
3945
- customStyle: { backgroundColor: "inherit" },
3946
- showLineNumbers: showLineNumbers || highlightLines.length > 0,
3947
- lineProps: (lineNumber) => {
3948
- const isHighlighted = highlightLines.includes(lineNumber);
3949
- return {
3950
- className: isHighlighted ? "line highlighted" : "",
3951
- style: {
3952
- backgroundColor: isHighlighted ? "var(--rp-code-line-highlight-color)" : "",
3953
- display: "block",
3954
- padding: "0 1.25rem"
3955
- }
3956
- };
3957
- },
3958
- children
3959
- }
3960
- ),
3961
- /* @__PURE__ */ jsx57("button", { className: "copy", onClick: copyCode, ref: copyButtonRef })
3962
- ] });
3963
- }
3964
-
3965
- // src/theme-default/components/PackageManagerTabs/icons/Npm.tsx
3966
- import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
3967
- function Npm(props) {
3968
- return /* @__PURE__ */ jsxs35(
3969
- "svg",
3970
- __spreadProps(__spreadValues({
3971
- xmlns: "http://www.w3.org/2000/svg",
3972
- width: "1em",
3973
- height: "1em",
3974
- viewBox: "0 0 256 256"
3975
- }, props), {
3976
- children: [
3977
- /* @__PURE__ */ jsx58("path", { fill: "#C12127", d: "M0 256V0h256v256z" }),
3978
- /* @__PURE__ */ jsx58("path", { fill: "#FFF", d: "M48 48h160v160h-32V80h-48v128H48z" })
3979
- ]
3980
- })
3981
- );
3982
- }
3983
-
3984
- // src/theme-default/components/PackageManagerTabs/icons/Yarn.tsx
3985
- import { jsx as jsx59, jsxs as jsxs36 } from "react/jsx-runtime";
3986
- function Yarn(props) {
3987
- return /* @__PURE__ */ jsx59(
3988
- "svg",
3989
- __spreadProps(__spreadValues({
3990
- xmlns: "http://www.w3.org/2000/svg",
3991
- width: "1em",
3992
- height: "1em",
3993
- viewBox: "0 0 128 128"
3994
- }, props), {
3995
- children: /* @__PURE__ */ jsxs36("g", { fill: "#2c8ebb", children: [
3996
- /* @__PURE__ */ jsx59("path", { d: "M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z" }),
3997
- /* @__PURE__ */ jsx59("path", { d: "M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z" })
3998
- ] })
3999
- })
4000
- );
4001
- }
4002
-
4003
- // src/theme-default/components/PackageManagerTabs/icons/Pnpm.tsx
4004
- import { jsx as jsx60, jsxs as jsxs37 } from "react/jsx-runtime";
4005
- function Pnpm(props) {
4006
- return /* @__PURE__ */ jsxs37(
4007
- "svg",
4008
- __spreadProps(__spreadValues({
4009
- xmlns: "http://www.w3.org/2000/svg",
4010
- width: "1em",
4011
- height: "1em",
4012
- viewBox: "0 0 128 128"
4013
- }, props), {
4014
- children: [
4015
- /* @__PURE__ */ jsx60(
4016
- "path",
4017
- {
4018
- fill: "#f8ab00",
4019
- d: "M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"
4020
- }
4021
- ),
4022
- /* @__PURE__ */ jsx60(
4023
- "path",
4024
- {
4025
- fill: "#4c4c4c",
4026
- d: "M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"
4027
- }
4028
- )
4029
- ]
4030
- })
4031
- );
4032
- }
4033
-
4034
- // src/theme-default/components/PackageManagerTabs/icons/Bun.tsx
4035
- import { jsx as jsx61, jsxs as jsxs38 } from "react/jsx-runtime";
4036
- function Bun(props) {
4037
- return /* @__PURE__ */ jsxs38("svg", __spreadProps(__spreadValues({ id: "Bun", width: "1.2em", height: "1.2em", viewBox: "0 0 80 70" }, props), { children: [
4038
- /* @__PURE__ */ jsx61(
4039
- "path",
4040
- {
4041
- id: "Shadow",
4042
- d: "M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"
4043
- }
4044
- ),
4045
- /* @__PURE__ */ jsxs38("g", { id: "Body", children: [
4046
- /* @__PURE__ */ jsx61(
4047
- "path",
4048
- {
4049
- id: "Background",
4050
- d: "M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z",
4051
- style: { fill: "#fbf0df" }
4052
- }
4053
- ),
4054
- /* @__PURE__ */ jsx61(
4055
- "path",
4056
- {
4057
- id: "Bottom_Shadow",
4058
- "data-name": "Bottom Shadow",
4059
- d: "M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z",
4060
- style: { fill: "#f6dece" }
4061
- }
4062
- ),
4063
- /* @__PURE__ */ jsx61(
4064
- "path",
4065
- {
4066
- id: "Light_Shine",
4067
- "data-name": "Light Shine",
4068
- d: "M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z",
4069
- style: { fill: "#fffefc" }
4070
- }
4071
- ),
4072
- /* @__PURE__ */ jsx61(
4073
- "path",
4074
- {
4075
- id: "Top",
4076
- d: "M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z",
4077
- style: { fill: "#ccbea7", fillRule: "evenodd" }
4078
- }
4079
- ),
4080
- /* @__PURE__ */ jsx61(
4081
- "path",
4082
- {
4083
- id: "Outline",
4084
- d: "M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"
4085
- }
4086
- )
4087
- ] }),
4088
- /* @__PURE__ */ jsxs38("g", { id: "Mouth", children: [
4089
- /* @__PURE__ */ jsx61("g", { id: "Background-2", "data-name": "Background", children: /* @__PURE__ */ jsx61(
4090
- "path",
4091
- {
4092
- d: "M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z",
4093
- style: { fill: "#b71422" }
4094
- }
4095
- ) }),
4096
- /* @__PURE__ */ jsxs38("g", { id: "Tongue", children: [
4097
- /* @__PURE__ */ jsx61(
4098
- "path",
4099
- {
4100
- id: "Background-3",
4101
- "data-name": "Background",
4102
- d: "M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z",
4103
- style: { fill: "#ff6164" }
4104
- }
4105
- ),
4106
- /* @__PURE__ */ jsx61(
4107
- "path",
4108
- {
4109
- id: "Outline-2",
4110
- "data-name": "Outline",
4111
- d: "M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"
4112
- }
4113
- )
4114
- ] }),
4115
- /* @__PURE__ */ jsx61(
4116
- "path",
4117
- {
4118
- id: "Outline-3",
4119
- "data-name": "Outline",
4120
- d: "M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"
4121
- }
4122
- )
4123
- ] }),
4124
- /* @__PURE__ */ jsxs38("g", { id: "Face", children: [
4125
- /* @__PURE__ */ jsx61(
4126
- "ellipse",
4127
- {
4128
- id: "Right_Blush",
4129
- "data-name": "Right Blush",
4130
- cx: "53.22",
4131
- cy: "40.18",
4132
- rx: "5.85",
4133
- ry: "3.44",
4134
- style: {
4135
- fill: "#febbd0"
4136
- }
4137
- }
4138
- ),
4139
- /* @__PURE__ */ jsx61(
4140
- "ellipse",
4141
- {
4142
- id: "Left_Bluch",
4143
- "data-name": "Left Bluch",
4144
- cx: "22.95",
4145
- cy: "40.18",
4146
- rx: "5.85",
4147
- ry: "3.44",
4148
- style: { fill: "#febbd0" }
4149
- }
4150
- ),
4151
- /* @__PURE__ */ jsx61(
4152
- "path",
4153
- {
4154
- id: "Eyes",
4155
- d: "M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z",
4156
- style: { fillRule: "evenodd" }
4157
- }
4158
- ),
4159
- /* @__PURE__ */ jsx61(
4160
- "path",
4161
- {
4162
- id: "Iris",
4163
- d: "M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z",
4164
- style: {
4165
- fill: "#fff",
4166
- fillRule: "evenodd"
4167
- }
4168
- }
4169
- )
4170
- ] })
4171
- ] }));
4172
- }
4173
-
4174
- // src/theme-default/components/PackageManagerTabs/index.tsx
4175
- import { Tab as Tab2 } from "@theme";
4176
- import { jsx as jsx62, jsxs as jsxs39 } from "react/jsx-runtime";
4177
- function normalizeCommand(command) {
4178
- if (!command.includes("install")) {
4179
- return command;
4180
- }
4181
- const pureCommand = command.split(" ").filter((item) => !item.startsWith("-") && !item.startsWith("--")).join(" ");
4182
- if (pureCommand === "yarn install" || pureCommand === "bun install") {
4183
- return command;
4184
- } else {
4185
- return command.replace("install", "add");
4186
- }
4187
- }
4188
- function PackageManagerTabs({
4189
- command,
4190
- additionalTabs = []
4191
- }) {
4192
- let commandInfo;
4193
- const packageMangerToIcon = {
4194
- npm: /* @__PURE__ */ jsx62(Npm, {}),
4195
- yarn: /* @__PURE__ */ jsx62(Yarn, {}),
4196
- pnpm: /* @__PURE__ */ jsx62(Pnpm, {}),
4197
- bun: /* @__PURE__ */ jsx62(Bun, {})
4198
- };
4199
- additionalTabs.forEach((tab) => {
4200
- packageMangerToIcon[tab.tool] = tab.icon;
4201
- });
4202
- if (typeof command === "string") {
4203
- commandInfo = {
4204
- npm: `npm ${command}`,
4205
- yarn: `yarn ${command}`,
4206
- pnpm: `pnpm ${command}`,
4207
- bun: `bun ${command}`
4208
- };
4209
- additionalTabs.forEach((tab) => {
4210
- commandInfo[tab.tool] = `${tab.tool} ${command}`;
4211
- });
4212
- } else {
4213
- commandInfo = command;
4214
- }
4215
- commandInfo.yarn = normalizeCommand(commandInfo.yarn);
4216
- commandInfo.bun = normalizeCommand(commandInfo.bun);
4217
- return /* @__PURE__ */ jsx62(
4218
- Tabs,
4219
- {
4220
- values: Object.entries(commandInfo).map(([key]) => /* @__PURE__ */ jsxs39(
4221
- "div",
4222
- {
4223
- style: {
4224
- display: "flex",
4225
- alignItems: "center",
4226
- fontSize: 15
4227
- },
4228
- children: [
4229
- packageMangerToIcon[key],
4230
- /* @__PURE__ */ jsx62("span", { style: { marginLeft: 6, marginBottom: 2 }, children: key })
4231
- ]
4232
- },
4233
- key
4234
- )),
4235
- children: Object.entries(commandInfo).map(([key, value]) => /* @__PURE__ */ jsx62(Tab, { children: /* @__PURE__ */ jsx62(Pre, { children: /* @__PURE__ */ jsx62(Code, { className: "language-js", children: value }) }) }, key))
4236
- }
4237
- );
4238
- }
4239
-
4240
- // src/theme-default/layout/DocLayout/docComponents/index.module.scss
4241
- var index_module_default16 = { "title": "title_e0087", "blockquote": "blockquote_e0087", "link": "link_e0087", "inline-link": "inline-link_e0087", "inlineLink": "inline-link_e0087" };
4242
-
4243
- // src/theme-default/layout/DocLayout/docComponents/title.tsx
4244
- import { jsx as jsx63 } from "react/jsx-runtime";
4245
- var H1 = (props) => {
4246
- return /* @__PURE__ */ jsx63(
4247
- "h1",
4248
- __spreadProps(__spreadValues({}, props), {
4249
- className: `text-3xl mb-10 leading-10 tracking-tight ${index_module_default16.title}`
4250
- })
4251
- );
4252
- };
4253
- var H2 = (props) => {
4254
- return /* @__PURE__ */ jsx63(
4255
- "h2",
4256
- __spreadProps(__spreadValues({}, props), {
4257
- className: `mt-14 mb-6 text-2xl tracking-tight ${index_module_default16.title}`
4258
- })
4259
- );
4260
- };
4261
- var H3 = (props) => {
4262
- return /* @__PURE__ */ jsx63("h3", __spreadProps(__spreadValues({}, props), { className: `mt-10 mb-2 leading-7 text-xl ${index_module_default16.title}` }));
4263
- };
4264
- var H4 = (props) => {
4265
- return /* @__PURE__ */ jsx63("h4", __spreadProps(__spreadValues({}, props), { className: `mt-8 leading-6 text-base ${index_module_default16.title}` }));
4266
- };
4267
- var H5 = (props) => {
4268
- return /* @__PURE__ */ jsx63("h5", __spreadProps(__spreadValues({}, props), { className: index_module_default16.title }));
4269
- };
4270
- var H6 = (props) => {
4271
- return /* @__PURE__ */ jsx63("h6", __spreadProps(__spreadValues({}, props), { className: index_module_default16.title }));
4272
- };
4273
-
4274
- // src/theme-default/layout/DocLayout/docComponents/list.tsx
4275
- import { jsx as jsx64 } from "react/jsx-runtime";
4276
- var Ol = (props) => {
4277
- return /* @__PURE__ */ jsx64("ol", __spreadProps(__spreadValues({}, props), { className: "list-decimal pl-5 my-4 leading-7" }));
4278
- };
4279
- var Ul = (props) => {
4280
- return /* @__PURE__ */ jsx64("ul", __spreadProps(__spreadValues({}, props), { className: "list-disc pl-5 my-4 leading-7" }));
4281
- };
4282
- var Li = (props) => {
4283
- return /* @__PURE__ */ jsx64("li", __spreadProps(__spreadValues({}, props), { className: "[&:not(:first-child)]:mt-2" }));
4284
- };
4285
-
4286
- // src/theme-default/layout/DocLayout/docComponents/table.tsx
4287
- import { jsx as jsx65 } from "react/jsx-runtime";
4288
- var Table = (props) => {
4289
- return /* @__PURE__ */ jsx65(
4290
- "table",
4291
- __spreadProps(__spreadValues({}, props), {
4292
- className: "table border-collapse text-base my-5 overflow-x-auto leading-7 border-gray-light-2"
4293
- })
4294
- );
4295
- };
4296
- var Tr = (props) => {
4297
- return /* @__PURE__ */ jsx65(
4298
- "tr",
4299
- __spreadProps(__spreadValues({}, props), {
4300
- className: "border border-solid transition-colors duration-500 even:bg-soft border-gray-light-2"
4301
- })
4302
- );
4303
- };
4304
- var Td = (props) => {
4305
- return /* @__PURE__ */ jsx65(
4306
- "td",
4307
- __spreadProps(__spreadValues({}, props), {
4308
- className: "border border-solid px-4 py-2 border-gray-light-2"
4309
- })
4310
- );
4311
- };
4312
- var Th = (props) => {
4313
- return /* @__PURE__ */ jsx65(
4314
- "th",
4315
- __spreadProps(__spreadValues({}, props), {
4316
- className: "border border-solid px-4 py-2 text-text-1 text-base font-semibold border-gray-light-2"
4317
- })
4318
- );
4319
- };
4320
-
4321
- // src/theme-default/layout/DocLayout/docComponents/hr.tsx
4322
- import { jsx as jsx66 } from "react/jsx-runtime";
4323
- var Hr = (props) => {
4324
- return /* @__PURE__ */ jsx66(
4325
- "hr",
4326
- __spreadProps(__spreadValues({}, props), {
4327
- className: "my-12 border-t bordder-solid border-divider-light"
4328
- })
4329
- );
4330
- };
4331
-
4332
- // src/theme-default/layout/DocLayout/docComponents/link.tsx
4333
- import { jsx as jsx67 } from "react/jsx-runtime";
4334
- var A = (props) => {
4335
- const { href = "", className = "" } = props;
4336
- const { normalizeLinkHref } = usePathUtils();
4337
- const hasHeaderAnchor = className.includes("header-anchor");
4338
- if (hasHeaderAnchor || href.startsWith("#")) {
4339
- return /* @__PURE__ */ jsx67("a", __spreadProps(__spreadValues({}, props), { className: `${index_module_default16.link} ${className}` }));
4340
- } else {
4341
- return /* @__PURE__ */ jsx67(
4342
- Link,
4343
- __spreadProps(__spreadValues({}, props), {
4344
- className: `${className} ${index_module_default16.link} ${index_module_default16["inline-link"]}`,
4345
- href: normalizeLinkHref(href)
4346
- })
4347
- );
4348
- }
4349
- };
4350
-
4351
- // src/theme-default/layout/DocLayout/docComponents/paragraph.tsx
4352
- import { jsx as jsx68 } from "react/jsx-runtime";
4353
- var P = (props) => {
4354
- return /* @__PURE__ */ jsx68("p", __spreadProps(__spreadValues({}, props), { className: "my-4 leading-7" }));
4355
- };
4356
- var Blockquote = (props) => {
4357
- return /* @__PURE__ */ jsx68(
4358
- "blockquote",
4359
- __spreadProps(__spreadValues({}, props), {
4360
- className: `border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${index_module_default16.blockquote}`
4361
- })
4362
- );
4363
- };
4364
- var Strong = (props) => {
4365
- return /* @__PURE__ */ jsx68("strong", __spreadProps(__spreadValues({}, props), { className: "font-semibold" }));
4366
- };
4367
-
4368
- // src/theme-default/layout/DocLayout/docComponents/index.tsx
4369
- function getCustomMDXComponent2() {
4370
- return {
4371
- h1: H1,
4372
- h2: H2,
4373
- h3: H3,
4374
- h4: H4,
4375
- h5: H5,
4376
- h6: H6,
4377
- ul: Ul,
4378
- ol: Ol,
4379
- li: Li,
4380
- table: Table,
4381
- td: Td,
4382
- th: Th,
4383
- tr: Tr,
4384
- hr: Hr,
4385
- p: P,
4386
- blockquote: Blockquote,
4387
- strong: Strong,
4388
- a: A,
4389
- code: Code,
4390
- pre: Pre
4391
- };
4392
- }
4393
-
4394
- // src/theme-default/index.ts
4395
- var theme_default_default = {
4396
- Layout,
4397
- NotFoundLayout,
4398
- HomeLayout,
4399
- setup
4400
- };
4401
- export {
4402
- Button,
4403
- HomeFooter2 as HomeFooter,
4404
- HomeLayout,
4405
- Layout,
4406
- Link,
4407
- Nav2 as Nav,
4408
- NotFoundLayout,
4409
- PackageManagerTabs,
4410
- Search2 as Search,
4411
- SearchPanel,
4412
- Tab,
4413
- Tabs,
4414
- Toc,
4415
- bindingAsideScroll,
4416
- theme_default_default as default,
4417
- getCustomMDXComponent2 as getCustomMDXComponent,
4418
- getLogoUrl,
4419
- isActive,
4420
- isExternalHref,
4421
- isMobileDevice,
4422
- scrollToTarget,
4423
- setup,
4424
- useDisableNav,
4425
- useEditLink,
4426
- useHiddenNav,
4427
- useLocaleSiteData,
4428
- usePathUtils,
4429
- usePrevNextPage,
4430
- useSidebarData
4431
- };
4432
-
4433
- //# sourceMappingURL=bundle.js.map