@docusaurus/theme-common 3.3.2 → 3.5.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 (103) hide show
  1. package/lib/contexts/announcementBar.d.ts +0 -1
  2. package/lib/contexts/announcementBar.d.ts.map +1 -1
  3. package/lib/contexts/announcementBar.js +4 -4
  4. package/lib/contexts/announcementBar.js.map +1 -1
  5. package/lib/index.d.ts +5 -6
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.js +18 -6
  8. package/lib/index.js.map +1 -1
  9. package/lib/internal.d.ts +2 -9
  10. package/lib/internal.d.ts.map +1 -1
  11. package/lib/internal.js +2 -9
  12. package/lib/internal.js.map +1 -1
  13. package/lib/translations/blogTranslations.d.ts +19 -0
  14. package/lib/translations/blogTranslations.d.ts.map +1 -0
  15. package/lib/translations/blogTranslations.js +48 -0
  16. package/lib/translations/blogTranslations.js.map +1 -0
  17. package/lib/{utils/unlistedUtils.d.ts → translations/contentVisibilityTranslations.d.ts} +3 -2
  18. package/lib/translations/contentVisibilityTranslations.d.ts.map +1 -0
  19. package/lib/translations/contentVisibilityTranslations.js +39 -0
  20. package/lib/translations/contentVisibilityTranslations.js.map +1 -0
  21. package/lib/utils/ThemeClassNames.d.ts +3 -0
  22. package/lib/utils/ThemeClassNames.d.ts.map +1 -1
  23. package/lib/utils/ThemeClassNames.js +3 -0
  24. package/lib/utils/ThemeClassNames.js.map +1 -1
  25. package/lib/utils/errorBoundaryUtils.d.ts +0 -1
  26. package/lib/utils/errorBoundaryUtils.d.ts.map +1 -1
  27. package/lib/utils/jsUtils.d.ts +1 -0
  28. package/lib/utils/jsUtils.d.ts.map +1 -1
  29. package/lib/utils/jsUtils.js +14 -0
  30. package/lib/utils/jsUtils.js.map +1 -1
  31. package/lib/utils/searchUtils.d.ts +0 -13
  32. package/lib/utils/searchUtils.d.ts.map +1 -1
  33. package/lib/utils/searchUtils.js +0 -39
  34. package/lib/utils/searchUtils.js.map +1 -1
  35. package/lib/utils/storageUtils.d.ts +3 -4
  36. package/lib/utils/storageUtils.d.ts.map +1 -1
  37. package/lib/utils/storageUtils.js +7 -3
  38. package/lib/utils/storageUtils.js.map +1 -1
  39. package/lib/utils/tabsUtils.d.ts +2 -2
  40. package/lib/utils/tabsUtils.d.ts.map +1 -1
  41. package/lib/utils/useThemeConfig.d.ts +5 -0
  42. package/lib/utils/useThemeConfig.d.ts.map +1 -1
  43. package/lib/utils/useThemeConfig.js.map +1 -1
  44. package/package.json +9 -11
  45. package/src/contexts/announcementBar.tsx +4 -6
  46. package/src/index.ts +27 -16
  47. package/src/internal.ts +8 -36
  48. package/src/translations/blogTranslations.tsx +79 -0
  49. package/src/{utils/unlistedUtils.tsx → translations/contentVisibilityTranslations.tsx} +25 -2
  50. package/src/types.d.ts +0 -3
  51. package/src/utils/ThemeClassNames.ts +3 -0
  52. package/src/utils/jsUtils.ts +18 -0
  53. package/src/utils/searchUtils.ts +0 -58
  54. package/src/utils/storageUtils.ts +8 -4
  55. package/src/utils/useThemeConfig.ts +6 -0
  56. package/lib/contexts/blogPost.d.ts +0 -33
  57. package/lib/contexts/blogPost.d.ts.map +0 -1
  58. package/lib/contexts/blogPost.js +0 -46
  59. package/lib/contexts/blogPost.js.map +0 -1
  60. package/lib/contexts/doc.d.ts +0 -30
  61. package/lib/contexts/doc.d.ts.map +0 -1
  62. package/lib/contexts/doc.js +0 -48
  63. package/lib/contexts/doc.js.map +0 -1
  64. package/lib/contexts/docSidebarItemsExpandedState.d.ts +0 -31
  65. package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +0 -1
  66. package/lib/contexts/docSidebarItemsExpandedState.js +0 -28
  67. package/lib/contexts/docSidebarItemsExpandedState.js.map +0 -1
  68. package/lib/contexts/docsPreferredVersion.d.ts +0 -30
  69. package/lib/contexts/docsPreferredVersion.d.ts.map +0 -1
  70. package/lib/contexts/docsPreferredVersion.js +0 -130
  71. package/lib/contexts/docsPreferredVersion.js.map +0 -1
  72. package/lib/contexts/docsSidebar.d.ts +0 -26
  73. package/lib/contexts/docsSidebar.d.ts.map +0 -1
  74. package/lib/contexts/docsSidebar.js +0 -30
  75. package/lib/contexts/docsSidebar.js.map +0 -1
  76. package/lib/contexts/docsVersion.d.ts +0 -20
  77. package/lib/contexts/docsVersion.d.ts.map +0 -1
  78. package/lib/contexts/docsVersion.js +0 -26
  79. package/lib/contexts/docsVersion.js.map +0 -1
  80. package/lib/utils/blogUtils.d.ts +0 -13
  81. package/lib/utils/blogUtils.d.ts.map +0 -1
  82. package/lib/utils/blogUtils.js +0 -24
  83. package/lib/utils/blogUtils.js.map +0 -1
  84. package/lib/utils/docsUtils.d.ts +0 -109
  85. package/lib/utils/docsUtils.d.ts.map +0 -1
  86. package/lib/utils/docsUtils.js +0 -276
  87. package/lib/utils/docsUtils.js.map +0 -1
  88. package/lib/utils/structuredDataUtils.d.ts +0 -12
  89. package/lib/utils/structuredDataUtils.d.ts.map +0 -1
  90. package/lib/utils/structuredDataUtils.js +0 -123
  91. package/lib/utils/structuredDataUtils.js.map +0 -1
  92. package/lib/utils/unlistedUtils.d.ts.map +0 -1
  93. package/lib/utils/unlistedUtils.js +0 -26
  94. package/lib/utils/unlistedUtils.js.map +0 -1
  95. package/src/contexts/blogPost.tsx +0 -80
  96. package/src/contexts/doc.tsx +0 -71
  97. package/src/contexts/docSidebarItemsExpandedState.tsx +0 -55
  98. package/src/contexts/docsPreferredVersion.tsx +0 -251
  99. package/src/contexts/docsSidebar.tsx +0 -50
  100. package/src/contexts/docsVersion.tsx +0 -36
  101. package/src/utils/blogUtils.ts +0 -32
  102. package/src/utils/docsUtils.tsx +0 -418
  103. package/src/utils/structuredDataUtils.ts +0 -177
@@ -1,46 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useMemo, useContext } from 'react';
8
- import { ReactContextError } from '../utils/reactUtils';
9
- const Context = React.createContext(null);
10
- /**
11
- * Note: we don't use `PropBlogPostContent` as context value on purpose.
12
- * Metadata is currently stored inside the MDX component, but we may want to
13
- * change that in the future.
14
- */
15
- function useContextValue({ content, isBlogPostPage, }) {
16
- return useMemo(() => ({
17
- metadata: content.metadata,
18
- frontMatter: content.frontMatter,
19
- assets: content.assets,
20
- toc: content.toc,
21
- isBlogPostPage,
22
- }), [content, isBlogPostPage]);
23
- }
24
- /**
25
- * This is a very thin layer around the `content` received from the MDX loader.
26
- * It provides metadata about the blog post to the children tree.
27
- */
28
- export function BlogPostProvider({ children, content, isBlogPostPage = false, }) {
29
- const contextValue = useContextValue({ content, isBlogPostPage });
30
- return <Context.Provider value={contextValue}>{children}</Context.Provider>;
31
- }
32
- /**
33
- * Returns the data of the currently browsed blog post. Gives access to
34
- * front matter, metadata, TOC, etc.
35
- * When swizzling a low-level component (e.g. the "Edit this page" link)
36
- * and you need some extra metadata, you don't have to drill the props
37
- * all the way through the component tree: simply use this hook instead.
38
- */
39
- export function useBlogPost() {
40
- const blogPost = useContext(Context);
41
- if (blogPost === null) {
42
- throw new ReactContextError('BlogPostProvider');
43
- }
44
- return blogPost;
45
- }
46
- //# sourceMappingURL=blogPost.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blogPost.js","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAetD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAEvE;;;;GAIG;AACH,SAAS,eAAe,CAAC,EACvB,OAAO,EACP,cAAc,GAIf;IACC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,cAAc;KACf,CAAC,EACF,CAAC,OAAO,EAAE,cAAc,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAc,GAAG,KAAK,GAKvB;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,EAAC,OAAO,EAAE,cAAc,EAAC,CAAC,CAAC;IAChE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { type ReactNode } from 'react';
8
- import type { PropDocContent } from '@docusaurus/plugin-content-docs';
9
- /**
10
- * The React context value returned by the `useDoc()` hook.
11
- * It contains useful data related to the currently browsed doc.
12
- */
13
- export type DocContextValue = Pick<PropDocContent, 'metadata' | 'frontMatter' | 'toc' | 'assets' | 'contentTitle'>;
14
- /**
15
- * This is a very thin layer around the `content` received from the MDX loader.
16
- * It provides metadata about the doc to the children tree.
17
- */
18
- export declare function DocProvider({ children, content, }: {
19
- children: ReactNode;
20
- content: PropDocContent;
21
- }): JSX.Element;
22
- /**
23
- * Returns the data of the currently browsed doc. Gives access to the doc's MDX
24
- * Component, front matter, metadata, TOC, etc. When swizzling a low-level
25
- * component (e.g. the "Edit this page" link) and you need some extra metadata,
26
- * you don't have to drill the props all the way through the component tree:
27
- * simply use this hook instead.
28
- */
29
- export declare function useDoc(): DocContextValue;
30
- //# sourceMappingURL=doc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,EACd,UAAU,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,cAAc,CAC/D,CAAC;AAwBF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;CACzB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,IAAI,eAAe,CAMxC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useMemo, useContext } from 'react';
8
- import { ReactContextError } from '../utils/reactUtils';
9
- const Context = React.createContext(null);
10
- /**
11
- * Note: we don't use `PropDoc` as context value on purpose. Metadata is
12
- * currently stored inside the MDX component, but we may want to change that in
13
- * the future. This layer is a good opportunity to decouple storage from
14
- * consuming API, potentially allowing us to provide metadata as both props and
15
- * route context without duplicating the chunks in the future.
16
- */
17
- function useContextValue(content) {
18
- return useMemo(() => ({
19
- metadata: content.metadata,
20
- frontMatter: content.frontMatter,
21
- assets: content.assets,
22
- contentTitle: content.contentTitle,
23
- toc: content.toc,
24
- }), [content]);
25
- }
26
- /**
27
- * This is a very thin layer around the `content` received from the MDX loader.
28
- * It provides metadata about the doc to the children tree.
29
- */
30
- export function DocProvider({ children, content, }) {
31
- const contextValue = useContextValue(content);
32
- return <Context.Provider value={contextValue}>{children}</Context.Provider>;
33
- }
34
- /**
35
- * Returns the data of the currently browsed doc. Gives access to the doc's MDX
36
- * Component, front matter, metadata, TOC, etc. When swizzling a low-level
37
- * component (e.g. the "Edit this page" link) and you need some extra metadata,
38
- * you don't have to drill the props all the way through the component tree:
39
- * simply use this hook instead.
40
- */
41
- export function useDoc() {
42
- const doc = useContext(Context);
43
- if (doc === null) {
44
- throw new ReactContextError('DocProvider');
45
- }
46
- return doc;
47
- }
48
- //# sourceMappingURL=doc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAYtD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAyB,IAAI,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,OAAuB;IAC9C,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GAIR;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { type ReactNode } from 'react';
8
- type ContextValue = {
9
- /**
10
- * The item that the user last opened, `null` when there's none open. On
11
- * initial render, it will always be `null`, which doesn't necessarily mean
12
- * there's no category open (can have 0, 1, or many being initially open).
13
- */
14
- expandedItem: number | null;
15
- /**
16
- * Set the currently expanded item, when the user opens one. Set the value to
17
- * `null` when the user closes an open category.
18
- */
19
- setExpandedItem: (a: number | null) => void;
20
- };
21
- /**
22
- * Should be used to wrap one sidebar category level. This provider syncs the
23
- * expanded states of all sibling categories, and categories can choose to
24
- * collapse itself if another one is expanded.
25
- */
26
- export declare function DocSidebarItemsExpandedStateProvider({ children, }: {
27
- children: ReactNode;
28
- }): JSX.Element;
29
- export declare function useDocSidebarItemsExpandedState(): ContextValue;
30
- export {};
31
- //# sourceMappingURL=docSidebarItemsExpandedState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docSidebarItemsExpandedState.d.ts","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAG3E,KAAK,YAAY,GAAG;IAClB;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAOF;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAQd;AAED,wBAAgB,+BAA+B,IAAI,YAAY,CAM9D"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useMemo, useState, useContext } from 'react';
8
- import { ReactContextError } from '../utils/reactUtils';
9
- const EmptyContext = Symbol('EmptyContext');
10
- const Context = React.createContext(EmptyContext);
11
- /**
12
- * Should be used to wrap one sidebar category level. This provider syncs the
13
- * expanded states of all sibling categories, and categories can choose to
14
- * collapse itself if another one is expanded.
15
- */
16
- export function DocSidebarItemsExpandedStateProvider({ children, }) {
17
- const [expandedItem, setExpandedItem] = useState(null);
18
- const contextValue = useMemo(() => ({ expandedItem, setExpandedItem }), [expandedItem]);
19
- return <Context.Provider value={contextValue}>{children}</Context.Provider>;
20
- }
21
- export function useDocSidebarItemsExpandedState() {
22
- const value = useContext(Context);
23
- if (value === EmptyContext) {
24
- throw new ReactContextError('DocSidebarItemsExpandedStateProvider');
25
- }
26
- return value;
27
- }
28
- //# sourceMappingURL=docSidebarItemsExpandedState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docSidebarItemsExpandedState.js","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAgBtD,MAAM,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,YAAY,CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,EACnD,QAAQ,GAGT;IACC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,EAAC,YAAY,EAAE,eAAe,EAAC,CAAC,EACvC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QAC3B,MAAM,IAAI,iBAAiB,CAAC,sCAAsC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { type ReactNode } from 'react';
8
- import { type GlobalVersion } from '@docusaurus/plugin-content-docs/client';
9
- /**
10
- * This is a maybe-layer. If the docs plugin is not enabled, this provider is a
11
- * simple pass-through.
12
- */
13
- export declare function DocsPreferredVersionContextProvider({ children, }: {
14
- children: ReactNode;
15
- }): JSX.Element;
16
- /**
17
- * Returns a read-write interface to a plugin's preferred version. The
18
- * "preferred version" is defined as the last version that the user visited.
19
- * For example, if a user is using v3, even when v4 is later published, the user
20
- * would still be browsing v3 docs when she opens the website next time. Note,
21
- * the `preferredVersion` attribute will always be `null` before mount.
22
- */
23
- export declare function useDocsPreferredVersion(pluginId?: string | undefined): {
24
- preferredVersion: GlobalVersion | null;
25
- savePreferredVersionName: (versionName: string) => void;
26
- };
27
- export declare function useDocsPreferredVersionByPluginId(): {
28
- [pluginId: string]: GlobalVersion | null;
29
- };
30
- //# sourceMappingURL=docsPreferredVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsPreferredVersion.d.ts","sourceRoot":"","sources":["../../src/contexts/docsPreferredVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,wCAAwC,CAAC;AAsJhD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,EAClD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CASd;AAUD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,MAAM,GAAG,SAA6B,GAC/C;IACD,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC,wBAAwB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD,CAmBA;AAED,wBAAgB,iCAAiC,IAAI;IACnD,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;CAC1C,CAkBA"}
@@ -1,130 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useContext, useEffect, useMemo, useState, useCallback, } from 'react';
8
- import { useAllDocsData, useDocsData, } from '@docusaurus/plugin-content-docs/client';
9
- import { DEFAULT_PLUGIN_ID } from '@docusaurus/constants';
10
- import { useThemeConfig, } from '../utils/useThemeConfig';
11
- import { isDocsPluginEnabled } from '../utils/docsUtils';
12
- import { ReactContextError } from '../utils/reactUtils';
13
- import { createStorageSlot } from '../utils/storageUtils';
14
- const storageKey = (pluginId) => `docs-preferred-version-${pluginId}`;
15
- const DocsPreferredVersionStorage = {
16
- save: (pluginId, persistence, versionName) => {
17
- createStorageSlot(storageKey(pluginId), { persistence }).set(versionName);
18
- },
19
- read: (pluginId, persistence) => createStorageSlot(storageKey(pluginId), { persistence }).get(),
20
- clear: (pluginId, persistence) => {
21
- createStorageSlot(storageKey(pluginId), { persistence }).del();
22
- },
23
- };
24
- /**
25
- * Initial state is always null as we can't read local storage from node SSR
26
- */
27
- const getInitialState = (pluginIds) => Object.fromEntries(pluginIds.map((id) => [id, { preferredVersionName: null }]));
28
- /**
29
- * Read storage for all docs plugins, assigning each doc plugin a preferred
30
- * version (if found)
31
- */
32
- function readStorageState({ pluginIds, versionPersistence, allDocsData, }) {
33
- /**
34
- * The storage value we read might be stale, and belong to a version that does
35
- * not exist in the site anymore. In such case, we remove the storage value to
36
- * avoid downstream errors.
37
- */
38
- function restorePluginState(pluginId) {
39
- const preferredVersionNameUnsafe = DocsPreferredVersionStorage.read(pluginId, versionPersistence);
40
- const pluginData = allDocsData[pluginId];
41
- const versionExists = pluginData.versions.some((version) => version.name === preferredVersionNameUnsafe);
42
- if (versionExists) {
43
- return { preferredVersionName: preferredVersionNameUnsafe };
44
- }
45
- DocsPreferredVersionStorage.clear(pluginId, versionPersistence);
46
- return { preferredVersionName: null };
47
- }
48
- return Object.fromEntries(pluginIds.map((id) => [id, restorePluginState(id)]));
49
- }
50
- function useVersionPersistence() {
51
- return useThemeConfig().docs.versionPersistence;
52
- }
53
- const Context = React.createContext(null);
54
- function useContextValue() {
55
- const allDocsData = useAllDocsData();
56
- const versionPersistence = useVersionPersistence();
57
- const pluginIds = useMemo(() => Object.keys(allDocsData), [allDocsData]);
58
- // Initial state is empty, as we can't read browser storage in node/SSR
59
- const [state, setState] = useState(() => getInitialState(pluginIds));
60
- // On mount, we set the state read from browser storage
61
- useEffect(() => {
62
- setState(readStorageState({ allDocsData, versionPersistence, pluginIds }));
63
- }, [allDocsData, versionPersistence, pluginIds]);
64
- // The API that we expose to consumer hooks (memo for constant object)
65
- const api = useMemo(() => {
66
- function savePreferredVersion(pluginId, versionName) {
67
- DocsPreferredVersionStorage.save(pluginId, versionPersistence, versionName);
68
- setState((s) => ({
69
- ...s,
70
- [pluginId]: { preferredVersionName: versionName },
71
- }));
72
- }
73
- return {
74
- savePreferredVersion,
75
- };
76
- }, [versionPersistence]);
77
- return [state, api];
78
- }
79
- function DocsPreferredVersionContextProviderUnsafe({ children, }) {
80
- const value = useContextValue();
81
- return <Context.Provider value={value}>{children}</Context.Provider>;
82
- }
83
- /**
84
- * This is a maybe-layer. If the docs plugin is not enabled, this provider is a
85
- * simple pass-through.
86
- */
87
- export function DocsPreferredVersionContextProvider({ children, }) {
88
- if (isDocsPluginEnabled) {
89
- return (<DocsPreferredVersionContextProviderUnsafe>
90
- {children}
91
- </DocsPreferredVersionContextProviderUnsafe>);
92
- }
93
- return <>{children}</>;
94
- }
95
- function useDocsPreferredVersionContext() {
96
- const value = useContext(Context);
97
- if (!value) {
98
- throw new ReactContextError('DocsPreferredVersionContextProvider');
99
- }
100
- return value;
101
- }
102
- /**
103
- * Returns a read-write interface to a plugin's preferred version. The
104
- * "preferred version" is defined as the last version that the user visited.
105
- * For example, if a user is using v3, even when v4 is later published, the user
106
- * would still be browsing v3 docs when she opens the website next time. Note,
107
- * the `preferredVersion` attribute will always be `null` before mount.
108
- */
109
- export function useDocsPreferredVersion(pluginId = DEFAULT_PLUGIN_ID) {
110
- const docsData = useDocsData(pluginId);
111
- const [state, api] = useDocsPreferredVersionContext();
112
- const { preferredVersionName } = state[pluginId];
113
- const preferredVersion = docsData.versions.find((version) => version.name === preferredVersionName) ?? null;
114
- const savePreferredVersionName = useCallback((versionName) => {
115
- api.savePreferredVersion(pluginId, versionName);
116
- }, [api, pluginId]);
117
- return { preferredVersion, savePreferredVersionName };
118
- }
119
- export function useDocsPreferredVersionByPluginId() {
120
- const allDocsData = useAllDocsData();
121
- const [state] = useDocsPreferredVersionContext();
122
- function getPluginIdPreferredVersion(pluginId) {
123
- const docsData = allDocsData[pluginId];
124
- const { preferredVersionName } = state[pluginId];
125
- return (docsData.versions.find((version) => version.name === preferredVersionName) ?? null);
126
- }
127
- const pluginIds = Object.keys(allDocsData);
128
- return Object.fromEntries(pluginIds.map((id) => [id, getPluginIdPreferredVersion(id)]));
129
- }
130
- //# sourceMappingURL=docsPreferredVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsPreferredVersion.js","sourceRoot":"","sources":["../../src/contexts/docsPreferredVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,WAAW,GAEZ,MAAM,OAAO,CAAC;AACf,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,cAAc,GAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,0BAA0B,QAAQ,EAAE,CAAC;AAE9E,MAAM,2BAA2B,GAAG;IAClC,IAAI,EAAE,CACJ,QAAgB,EAChB,WAAmC,EACnC,WAAmB,EACb,EAAE;QACR,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAC,WAAW,EA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pB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,oBAAoB,CACnD,IAAI,IAAI,CAAC;IAEZ,MAAM,wBAAwB,GAAG,WAAW,CAC1C,CAAC,WAAmB,EAAE,EAAE;QACtB,GAAG,CAAC,oBAAoB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC,EACD,CAAC,GAAG,EAAE,QAAQ,CAAC,CAChB,CAAC;IAEF,OAAO,EAAC,gBAAgB,EAAE,wBAAwB,EAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,iCAAiC;IAG/C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,GAAG,8BAA8B,EAAE,CAAC;IAEjD,SAAS,2BAA2B,CAAC,QAAgB;QACnD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAE,CAAC;QACxC,MAAM,EAAC,oBAAoB,EAAC,GAAG,KAAK,CAAC,QAAQ,CAAE,CAAC;QAEhD,OAAO,CACL,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACpB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,oBAAoB,CACnD,IAAI,IAAI,CACV,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,2BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC,CAC7D,CAAC;AACJ,CAAC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { type ReactNode } from 'react';
8
- import type { PropSidebar } from '@docusaurus/plugin-content-docs';
9
- type ContextValue = {
10
- name: string;
11
- items: PropSidebar;
12
- };
13
- /**
14
- * Provide the current sidebar to your children.
15
- */
16
- export declare function DocsSidebarProvider({ children, name, items, }: {
17
- children: ReactNode;
18
- name: string | undefined;
19
- items: PropSidebar | undefined;
20
- }): JSX.Element;
21
- /**
22
- * Gets the sidebar that's currently displayed, or `null` if there isn't one
23
- */
24
- export declare function useDocsSidebar(): ContextValue | null;
25
- export {};
26
- //# sourceMappingURL=docsSidebar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsSidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/docsSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAsB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAMjE,KAAK,YAAY,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAC,CAAC;AAMvD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;CAChC,GAAG,GAAG,CAAC,OAAO,CAMd;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,YAAY,GAAG,IAAI,CAMpD"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useMemo, useContext } from 'react';
8
- import { ReactContextError } from '../utils/reactUtils';
9
- // Using a Symbol because null is a valid context value (a doc with no sidebar)
10
- // Inspired by https://github.com/jamiebuilds/unstated-next/blob/master/src/unstated-next.tsx
11
- const EmptyContext = Symbol('EmptyContext');
12
- const Context = React.createContext(EmptyContext);
13
- /**
14
- * Provide the current sidebar to your children.
15
- */
16
- export function DocsSidebarProvider({ children, name, items, }) {
17
- const stableValue = useMemo(() => (name && items ? { name, items } : null), [name, items]);
18
- return <Context.Provider value={stableValue}>{children}</Context.Provider>;
19
- }
20
- /**
21
- * Gets the sidebar that's currently displayed, or `null` if there isn't one
22
- */
23
- export function useDocsSidebar() {
24
- const value = useContext(Context);
25
- if (value === EmptyContext) {
26
- throw new ReactContextError('DocsSidebarProvider');
27
- }
28
- return value;
29
- }
30
- //# sourceMappingURL=docsSidebar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsSidebar.js","sourceRoot":"","sources":["../../src/contexts/docsSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,+EAA+E;AAC/E,6FAA6F;AAC7F,MAAM,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAI3D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,YAAY,CACb,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,KAAK,GAKN;IACC,MAAM,WAAW,GAAwB,OAAO,CAC9C,GAAG,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAC5C,CAAC,IAAI,EAAE,KAAK,CAAC,CACd,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QAC3B,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { type ReactNode } from 'react';
8
- import type { PropVersionMetadata } from '@docusaurus/plugin-content-docs';
9
- /**
10
- * Provide the current version's metadata to your children.
11
- */
12
- export declare function DocsVersionProvider({ children, version, }: {
13
- children: ReactNode;
14
- version: PropVersionMetadata | null;
15
- }): JSX.Element;
16
- /**
17
- * Gets the version metadata of the current doc page.
18
- */
19
- export declare function useDocsVersion(): PropVersionMetadata;
20
- //# sourceMappingURL=docsVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsVersion.d.ts","sourceRoot":"","sources":["../../src/contexts/docsVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAIzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC,GAAG,GAAG,CAAC,OAAO,CAEd;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,mBAAmB,CAMpD"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React, { useContext } from 'react';
8
- import { ReactContextError } from '../utils/reactUtils';
9
- const Context = React.createContext(null);
10
- /**
11
- * Provide the current version's metadata to your children.
12
- */
13
- export function DocsVersionProvider({ children, version, }) {
14
- return <Context.Provider value={version}>{children}</Context.Provider>;
15
- }
16
- /**
17
- * Gets the version metadata of the current doc page.
18
- */
19
- export function useDocsVersion() {
20
- const version = useContext(Context);
21
- if (version === null) {
22
- throw new ReactContextError('DocsVersionProvider');
23
- }
24
- return version;
25
- }
26
- //# sourceMappingURL=docsVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsVersion.js","sourceRoot":"","sources":["../../src/contexts/docsVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAA6B,IAAI,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,OAAO,GAIR;IACC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import type { BlogSidebarItem } from '@docusaurus/plugin-content-blog';
8
- /**
9
- * Return the visible blog sidebar items to display.
10
- * Unlisted items are filtered.
11
- */
12
- export declare function useVisibleBlogSidebarItems(items: BlogSidebarItem[]): BlogSidebarItem[];
13
- //# sourceMappingURL=blogUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blogUtils.d.ts","sourceRoot":"","sources":["../../src/utils/blogUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AASrE;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EAAE,GACvB,eAAe,EAAE,CAMnB"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { useMemo } from 'react';
8
- import { useLocation } from '@docusaurus/router';
9
- import { isSamePath } from './routesUtils';
10
- function isVisible(item, pathname) {
11
- if (item.unlisted && !isSamePath(item.permalink, pathname)) {
12
- return false;
13
- }
14
- return true;
15
- }
16
- /**
17
- * Return the visible blog sidebar items to display.
18
- * Unlisted items are filtered.
19
- */
20
- export function useVisibleBlogSidebarItems(items) {
21
- const { pathname } = useLocation();
22
- return useMemo(() => items.filter((item) => isVisible(item, pathname)), [items, pathname]);
23
- }
24
- //# sourceMappingURL=blogUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blogUtils.js","sourceRoot":"","sources":["../../src/utils/blogUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAGzC,SAAS,SAAS,CAAC,IAAqB,EAAE,QAAgB;IACxD,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAwB;IAExB,MAAM,EAAC,QAAQ,EAAC,GAAG,WAAW,EAAE,CAAC;IACjC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EACvD,CAAC,KAAK,EAAE,QAAQ,CAAC,CAClB,CAAC;AACJ,CAAC"}