@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92

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 (284) hide show
  1. package/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
  2. package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
  3. package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
  4. package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
  5. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
  6. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  7. package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
  8. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
  9. package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
  10. package/compiler-assets/nextjs/shims/document.tsx +46 -0
  11. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
  12. package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
  13. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  14. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  15. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  16. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  17. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  18. package/compiler-assets/nextjs/shims/proxy.ts +254 -86
  19. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
  20. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
  21. package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
  22. package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
  23. package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
  24. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  25. package/dist/chunk-22RSSUNV.js +13 -0
  26. package/dist/chunk-3T4HVDSC.js +426 -0
  27. package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
  28. package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
  29. package/dist/chunk-5KAD7W53.js +248 -0
  30. package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
  31. package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
  32. package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
  33. package/dist/chunk-DX7PXFCM.js +2519 -0
  34. package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
  35. package/dist/chunk-EFO6AWXN.js +19 -0
  36. package/dist/chunk-IL4RJOKI.js +186 -0
  37. package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
  38. package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
  39. package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
  40. package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
  41. package/dist/compiler.d.ts +15 -2
  42. package/dist/compiler.js +111 -23
  43. package/dist/components/blocks/agent-actions.d.ts +81 -0
  44. package/dist/components/blocks/agent-actions.js +563 -0
  45. package/dist/components/blocks/toc.d.ts +43 -0
  46. package/dist/components/blocks/toc.js +136 -0
  47. package/dist/components/ui/button.d.ts +4 -0
  48. package/dist/components/ui/button.js +94 -0
  49. package/dist/compose-44GJSMXD.js +16 -0
  50. package/dist/config/createNextConfig.js +19 -3
  51. package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
  52. package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
  53. package/dist/ide-support-TG74L4FF.js +16 -0
  54. package/dist/index.d.ts +151 -95
  55. package/dist/index.js +25 -0
  56. package/dist/jsx-dev-runtime.d.ts +6 -0
  57. package/dist/jsx-dev-runtime.js +100 -0
  58. package/dist/jsx-runtime.d.ts +7 -0
  59. package/dist/jsx-runtime.js +97 -0
  60. package/dist/kernel/components/blocks/AgentActions.d.ts +37 -8
  61. package/dist/kernel/components/blocks/AgentActions.js +384 -174
  62. package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
  63. package/dist/kernel/components/blocks/agent-actions.js +563 -0
  64. package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
  65. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  66. package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
  67. package/dist/kernel/components/blocks/color-palette.js +4 -4
  68. package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
  69. package/dist/kernel/components/blocks/logo-block.js +1 -1
  70. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
  71. package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
  72. package/dist/kernel/components/blocks/navbar.d.ts +5 -4
  73. package/dist/kernel/components/blocks/navbar.js +79 -59
  74. package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
  75. package/dist/kernel/components/blocks/navigation-progress.js +2 -2
  76. package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
  77. package/dist/kernel/components/blocks/next-prev.js +30 -7
  78. package/dist/kernel/components/blocks/page-list.d.ts +4 -4
  79. package/dist/kernel/components/blocks/page-list.js +32 -9
  80. package/dist/kernel/components/blocks/search.d.ts +9 -15
  81. package/dist/kernel/components/blocks/search.js +16 -17
  82. package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
  83. package/dist/kernel/components/blocks/sidebar-node.js +13 -3
  84. package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
  85. package/dist/kernel/components/blocks/sidebar.js +137 -28
  86. package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
  87. package/dist/kernel/components/blocks/theme-toggle.js +5 -5
  88. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  89. package/dist/kernel/components/blocks/toc-client.js +495 -0
  90. package/dist/kernel/components/blocks/toc.d.ts +20 -2
  91. package/dist/kernel/components/blocks/toc.js +121 -179
  92. package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
  93. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  94. package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
  95. package/dist/kernel/components/mdx/components/callout.js +1 -1
  96. package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
  97. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  98. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
  99. package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
  100. package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
  101. package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
  102. package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
  103. package/dist/kernel/components/mdx/components/figure.js +23 -13
  104. package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
  105. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  106. package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
  107. package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
  108. package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
  109. package/dist/kernel/components/mdx/components/heading.js +6 -3
  110. package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
  111. package/dist/kernel/components/mdx/components/hr.js +2 -2
  112. package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
  113. package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
  114. package/dist/kernel/components/mdx/components/image.d.ts +2 -2
  115. package/dist/kernel/components/mdx/components/image.js +22 -17
  116. package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
  117. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  118. package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
  119. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  120. package/dist/kernel/components/mdx/components/link.d.ts +6 -6
  121. package/dist/kernel/components/mdx/components/link.js +2 -2
  122. package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
  123. package/dist/kernel/components/mdx/components/paragraph.js +1 -1
  124. package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
  125. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  126. package/dist/kernel/components/mdx/components/table.d.ts +7 -7
  127. package/dist/kernel/components/mdx/components/table.js +2 -2
  128. package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
  129. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  130. package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
  131. package/dist/kernel/components/mdx/components/video-player.js +6 -2
  132. package/dist/kernel/components/mdx/components/video.d.ts +5 -4
  133. package/dist/kernel/components/mdx/components/video.js +7 -5
  134. package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
  137. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  138. package/dist/kernel/components/mdx/mdx.d.ts +57 -16
  139. package/dist/kernel/components/mdx/mdx.js +232 -35
  140. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  141. package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
  142. package/dist/kernel/components/mdx/types.d.ts +1 -1
  143. package/dist/kernel/components/next-image.d.ts +12 -0
  144. package/dist/kernel/components/next-image.js +61 -0
  145. package/dist/kernel/components/ui/accordion.d.ts +7 -7
  146. package/dist/kernel/components/ui/accordion.js +1 -1
  147. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
  148. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  149. package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
  150. package/dist/kernel/components/ui/breadcrumb.js +4 -4
  151. package/dist/kernel/components/ui/button-group.d.ts +6 -6
  152. package/dist/kernel/components/ui/button-group.js +3 -3
  153. package/dist/kernel/components/ui/button.d.ts +59 -7
  154. package/dist/kernel/components/ui/button.js +43 -39
  155. package/dist/kernel/components/ui/card.d.ts +7 -7
  156. package/dist/kernel/components/ui/card.js +1 -1
  157. package/dist/kernel/components/ui/dialog.d.ts +10 -10
  158. package/dist/kernel/components/ui/dialog.js +1 -1
  159. package/dist/kernel/components/ui/drawer.d.ts +12 -12
  160. package/dist/kernel/components/ui/drawer.js +1 -1
  161. package/dist/kernel/components/ui/input.d.ts +2 -2
  162. package/dist/kernel/components/ui/input.js +1 -1
  163. package/dist/kernel/components/ui/kbd.d.ts +4 -4
  164. package/dist/kernel/components/ui/kbd.js +1 -1
  165. package/dist/kernel/components/ui/link.d.ts +11 -5
  166. package/dist/kernel/components/ui/link.js +2 -2
  167. package/dist/kernel/components/ui/menu.d.ts +22 -22
  168. package/dist/kernel/components/ui/menu.js +1 -1
  169. package/dist/kernel/components/ui/mod-key.d.ts +2 -3
  170. package/dist/kernel/components/ui/mod-key.js +2 -2
  171. package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
  172. package/dist/kernel/components/ui/navigation-menu.js +1 -1
  173. package/dist/kernel/components/ui/popover.d.ts +11 -11
  174. package/dist/kernel/components/ui/popover.js +1 -1
  175. package/dist/kernel/components/ui/progress.d.ts +7 -7
  176. package/dist/kernel/components/ui/progress.js +1 -1
  177. package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
  178. package/dist/kernel/components/ui/scroll-area.js +1 -1
  179. package/dist/kernel/components/ui/select.d.ts +16 -16
  180. package/dist/kernel/components/ui/select.js +1 -1
  181. package/dist/kernel/components/ui/separator.d.ts +3 -3
  182. package/dist/kernel/components/ui/separator.js +1 -1
  183. package/dist/kernel/components/ui/table.d.ts +7 -7
  184. package/dist/kernel/components/ui/table.js +1 -1
  185. package/dist/kernel/components/ui/tabs.d.ts +12 -12
  186. package/dist/kernel/components/ui/tabs.js +1 -1
  187. package/dist/kernel/components/ui/tag.d.ts +3 -3
  188. package/dist/kernel/components/ui/tag.js +1 -1
  189. package/dist/kernel/components/ui/text.d.ts +4 -4
  190. package/dist/kernel/components/ui/text.js +1 -1
  191. package/dist/kernel/components/ui/toast.d.ts +11 -11
  192. package/dist/kernel/components/ui/toast.js +1 -1
  193. package/dist/kernel/components/ui/tooltip.d.ts +9 -9
  194. package/dist/kernel/components/ui/tooltip.js +1 -1
  195. package/dist/kernel/defaults.registry.d.ts +4 -17
  196. package/dist/kernel/defaults.registry.js +4 -19
  197. package/dist/kernel/routes/agent/markdown.d.ts +7 -0
  198. package/dist/kernel/routes/agent/markdown.js +229 -54
  199. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  200. package/dist/kernel/routes/layouts/group.js +5 -7
  201. package/dist/kernel/routes/metadata/feed.d.ts +1 -2
  202. package/dist/kernel/routes/metadata/feed.js +119 -88
  203. package/dist/kernel/routes/metadata/llms.d.ts +3 -23
  204. package/dist/kernel/routes/metadata/llms.js +2 -103
  205. package/dist/kernel/routes/metadata/og-image.js +1 -1
  206. package/dist/kernel/routes/metadata/robots.d.ts +5 -3
  207. package/dist/kernel/routes/metadata/robots.js +4 -25
  208. package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
  209. package/dist/kernel/routes/metadata/sitemap.js +277 -49
  210. package/dist/kernel/routes/not-found.d.ts +34 -0
  211. package/dist/kernel/routes/not-found.js +213 -0
  212. package/dist/kernel/routes/pages/group.d.ts +5 -5
  213. package/dist/kernel/routes/pages/group.js +11 -5
  214. package/dist/kernel/routes/pages/leaf.d.ts +38 -6
  215. package/dist/kernel/routes/pages/leaf.js +21 -12
  216. package/dist/kernel/routes/pages/root.d.ts +5 -5
  217. package/dist/kernel/routes/pages/root.js +21 -6
  218. package/dist/keyboard-shortcuts.d.ts +2 -2
  219. package/dist/keyboard-shortcuts.js +1 -1
  220. package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
  221. package/dist/resolvers/manifest-resolver.d.ts +2 -2
  222. package/dist/resolvers/manifest-resolver.js +65 -35
  223. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  224. package/dist/search.d.ts +2 -9
  225. package/dist/search.js +9 -16
  226. package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
  227. package/dist/theme-scope.d.ts +2 -2
  228. package/dist/theme-scope.js +1 -1
  229. package/dist/types-BbqmOzLC.d.ts +168 -0
  230. package/dist/types-TjH1ek0X.d.ts +22 -0
  231. package/dist/types-sM2g9nW0.d.ts +12 -0
  232. package/dist/types.d.ts +117 -91
  233. package/dist/utils/heading-ids.js +30 -11
  234. package/dist/utils/toc-selection.d.ts +7 -0
  235. package/dist/utils/toc-selection.js +14 -0
  236. package/dist/validate-local-source-EN2GW4FR.js +16 -0
  237. package/dist/validate-publish-os-source-OEWQDB7B.js +14 -0
  238. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  239. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  240. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  241. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  242. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  243. package/init/seed/minimal/publish.os/blog/index.tsx +85 -0
  244. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  245. package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
  246. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  247. package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
  248. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
  249. package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
  250. package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
  251. package/init/seed/minimal/publish.os/theme.css +3 -3
  252. package/init/seed/minimal/seed.json +12 -4
  253. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
  254. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  255. package/package.json +48 -23
  256. package/release/app/phosphor/package.json +4 -4
  257. package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
  258. package/release/compiler/package.json +5 -3
  259. package/release/compiler/pnpm-lock.yaml.template +153 -183
  260. package/release/release.json +6 -6
  261. package/dist/button-CtzUJB8u.d.ts +0 -11
  262. package/dist/chunk-535TM4A5.js +0 -1455
  263. package/dist/chunk-B2V22WRT.js +0 -297
  264. package/dist/chunk-NECL5IBJ.js +0 -318
  265. package/dist/chunk-SVYGXXYR.js +0 -36
  266. package/dist/chunk-UF6ATARM.js +0 -1100
  267. package/dist/compose-NN23UJGC.js +0 -13
  268. package/dist/ide-support-ZNW7ODFY.js +0 -15
  269. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  270. package/dist/kernel/components/blocks/design-system-preview.js +0 -667
  271. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  272. package/dist/kernel/components/blocks/link-playground.js +0 -744
  273. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  274. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  275. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  276. package/dist/kernel/components/ui/theme-toggle.js +0 -53
  277. package/dist/sidebar-types-DKpR27II.d.ts +0 -25
  278. package/dist/types-BzkZty3r.d.ts +0 -147
  279. package/dist/types-CJWRG05y.d.ts +0 -76
  280. package/dist/types-CUtrppxt.d.ts +0 -69
  281. package/dist/validate-local-source-XRL2Y7XE.js +0 -14
  282. package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
  283. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  284. package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
 
3
3
  // src/modules/agent-actions/agent-actions.tsx
4
- import { AnimatedIconSwap } from "@publish.os/nextjs/kernel/components/blocks/animated-icon-swap";
4
+ import { AnimatedIconSwap } from "@components/blocks/animated-icon-swap";
5
5
  import {
6
6
  Button,
7
7
  buttonVariants
8
- } from "@publish.os/nextjs/kernel/components/ui/button";
9
- import { ButtonGroup, ButtonGroupSeparator } from "@publish.os/nextjs/kernel/components/ui/button-group";
8
+ } from "@components/ui/button";
9
+ import { ButtonGroup, ButtonGroupSeparator } from "@components/ui/button-group";
10
10
  import {
11
11
  Menu,
12
12
  MenuGroup,
@@ -18,7 +18,7 @@ import {
18
18
  MenuPositioner,
19
19
  MenuSeparator,
20
20
  MenuTrigger
21
- } from "@publish.os/nextjs/kernel/components/ui/menu";
21
+ } from "@components/ui/menu";
22
22
  import {
23
23
  CaretDownIcon,
24
24
  CheckIcon,
@@ -27,14 +27,16 @@ import {
27
27
  } from "@phosphor-icons/react/ssr";
28
28
  import { cn } from "@publish.os/nextjs/utils/cn";
29
29
  import {
30
+ createContext,
30
31
  Fragment,
32
+ use,
31
33
  useCallback,
32
34
  useEffect,
33
35
  useRef,
34
36
  useState
35
37
  } from "react";
36
38
  import { flushSync } from "react-dom";
37
- import { jsx, jsxs } from "react/jsx-runtime";
39
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
38
40
  var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.", COPY_FEEDBACK_MS = 1600;
39
41
  function normalizePath(path) {
40
42
  let [pathname = "/"] = path.split(/[?#]/), prefixed = pathname.startsWith("/") ? pathname : `/${pathname}`;
@@ -42,7 +44,7 @@ function normalizePath(path) {
42
44
  }
43
45
  function markdownPathForPagePath(path) {
44
46
  let normalized = normalizePath(path);
45
- return normalized === "/" ? "/index.md" : normalized.endsWith(".md") ? normalized : `${normalized}.md`;
47
+ return normalized === "/" ? "/index.md" : `${normalized}.md`;
46
48
  }
47
49
  function isAbsoluteUrl(url) {
48
50
  return /^[a-z][a-z\d+\-.]*:/i.test(url);
@@ -75,42 +77,11 @@ var DEFAULT_PRIMARY_ACTION = {
75
77
  id: "open-in-ai",
76
78
  title: "Open in",
77
79
  actions: [
78
- {
79
- id: "open-claude",
80
- title: "Claude",
81
- href: ({ prompt }) => providerPromptUrl("https://claude.ai/new", prompt),
82
- openInNew: !0
83
- },
84
80
  {
85
81
  id: "open-chatgpt",
86
82
  title: "ChatGPT",
87
83
  href: ({ prompt }) => providerPromptUrl("https://chatgpt.com/?hints=search", prompt),
88
84
  openInNew: !0
89
- },
90
- {
91
- id: "open-cursor",
92
- title: "Cursor",
93
- href: ({ prompt }) => providerPromptUrl("https://cursor.com/link/prompt", prompt, "text"),
94
- openInNew: !0
95
- },
96
- {
97
- id: "open-copilot",
98
- title: "Copilot",
99
- href: ({ prompt }) => providerPromptUrl("https://copilot.microsoft.com/", prompt),
100
- openInNew: !0
101
- },
102
- {
103
- id: "open-t3-chat",
104
- title: "T3 Chat",
105
- href: ({ prompt }) => providerPromptUrl("https://t3.chat/new", prompt),
106
- openInNew: !0
107
- },
108
- {
109
- id: "open-github",
110
- title: "GitHub source",
111
- href: ({ sourceUrl }) => sourceUrl,
112
- openInNew: !0,
113
- disabled: ({ sourceUrl }) => !sourceUrl
114
85
  }
115
86
  ]
116
87
  },
@@ -120,7 +91,7 @@ var DEFAULT_PRIMARY_ACTION = {
120
91
  actions: [
121
92
  {
122
93
  id: "copy-page-markdown",
123
- title: "Copy page Markdown",
94
+ title: "Copy markdown",
124
95
  copy: "page-markdown"
125
96
  },
126
97
  {
@@ -130,7 +101,7 @@ var DEFAULT_PRIMARY_ACTION = {
130
101
  },
131
102
  {
132
103
  id: "copy-page-link",
133
- title: "Copy page link",
104
+ title: "Copy link",
134
105
  copy: "page-link"
135
106
  }
136
107
  ]
@@ -140,37 +111,67 @@ function resolveValue(value, context) {
140
111
  return typeof value == "function" ? value(context) : value;
141
112
  }
142
113
  async function copyText(text) {
143
- await navigator.clipboard?.writeText(text);
114
+ if (!navigator.clipboard?.writeText)
115
+ throw new Error("Clipboard access is not available in this browser.");
116
+ await navigator.clipboard.writeText(text);
144
117
  }
145
- function AgentActions({
118
+ function revisionRequestPath(path, revision) {
119
+ if (!revision) return path;
120
+ let separator = path.includes("?") ? "&" : "?";
121
+ return `${path}${separator}publishos_revision=${encodeURIComponent(revision)}`;
122
+ }
123
+ async function markdownHash(text) {
124
+ if (!globalThis.crypto?.subtle)
125
+ throw new Error("This browser cannot verify the current Markdown version.");
126
+ let digest = await globalThis.crypto.subtle.digest(
127
+ "SHA-256",
128
+ new TextEncoder().encode(text)
129
+ );
130
+ return `sha256-${Array.from(
131
+ new Uint8Array(digest),
132
+ (byte) => byte.toString(16).padStart(2, "0")
133
+ ).join("").slice(0, 32)}`;
134
+ }
135
+ var AgentActionsContext = createContext(
136
+ null
137
+ );
138
+ function useAgentActions() {
139
+ let context = use(AgentActionsContext);
140
+ if (!context)
141
+ throw new Error("AgentActions parts must be inside AgentActions.Root.");
142
+ return context;
143
+ }
144
+ function AgentActionsProvider({
146
145
  actionGroups,
147
146
  buttonSize = "xs",
148
147
  buttonVariant = "outline",
149
148
  className,
150
149
  markdown,
151
150
  markdownPath,
151
+ markdownRevision,
152
152
  markdownUrl,
153
153
  menuLabel = "More agent actions",
154
+ markdownLinkLabel = "View as Markdown",
154
155
  pagePath,
155
156
  pageUrl,
156
157
  primaryAction,
157
158
  prompt,
158
159
  siteUrl,
159
160
  sourceUrl,
161
+ showMarkdownLink = !0,
162
+ children,
160
163
  ...props
161
164
  }) {
162
- let [copiedActionId, setCopiedActionId] = useState(), [menuOpen, setMenuOpen] = useState(!1), menuActionsRef = useRef(null), menuOpenRef = useRef(!1), resetTimerRef = useRef(
165
+ let [copiedActionId, setCopiedActionId] = useState(), [copyFeedback, setCopyFeedback] = useState(), [menuOpen, setMenuOpen] = useState(!1), menuTriggerRef = useRef(null), menuActionsRef = useRef(null), menuOpenRef = useRef(!1), markdownPreparationRef = useRef(null), currentMarkdownKeyRef = useRef(""), resetTimerRef = useRef(
163
166
  void 0
164
- ), setMenuOpenState = useCallback((open) => {
165
- menuOpenRef.current = open, setMenuOpen(open);
166
- }, []), closeMenu = useCallback(() => {
167
+ ), closeMenu = useCallback(() => {
167
168
  flushSync(() => {
168
169
  menuOpenRef.current = !1, setMenuOpen(!1), menuActionsRef.current?.close(), menuActionsRef.current?.unmount();
169
170
  });
170
171
  }, []);
171
- useEffect(() => (window.addEventListener("pagehide", closeMenu), window.addEventListener("pageshow", closeMenu), () => {
172
- window.removeEventListener("pagehide", closeMenu), window.removeEventListener("pageshow", closeMenu), resetTimerRef.current && clearTimeout(resetTimerRef.current);
173
- }), [closeMenu]);
172
+ useEffect(() => () => {
173
+ resetTimerRef.current && clearTimeout(resetTimerRef.current);
174
+ }, []);
174
175
  let resolvedPagePath = pagePath ?? "/", resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath), resolvedMarkdownUrl = absoluteUrl(
175
176
  markdownUrl ?? resolvedMarkdownPath,
176
177
  siteUrl
@@ -182,30 +183,140 @@ function AgentActions({
182
183
  pageUrl: absoluteUrl(pageUrl ?? resolvedPagePath, siteUrl),
183
184
  prompt: prompt ?? createPrompt(resolvedMarkdownUrl),
184
185
  sourceUrl
185
- }, resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
186
+ }, markdownKey = `${context.markdownUrl}\0${markdownRevision ?? "unversioned"}`;
187
+ currentMarkdownKeyRef.current = markdownKey, useEffect(
188
+ () => () => {
189
+ markdownPreparationRef.current?.controller?.abort(), markdownPreparationRef.current = null;
190
+ },
191
+ []
192
+ ), useEffect(() => {
193
+ let preparation = markdownPreparationRef.current;
194
+ preparation && preparation.key !== markdownKey && (preparation.controller?.abort(), markdownPreparationRef.current = null, setCopyFeedback(void 0), setCopiedActionId(void 0));
195
+ }, [markdownKey]);
196
+ let resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
186
197
  resetTimerRef.current && clearTimeout(resetTimerRef.current), setCopiedActionId(actionId), resetTimerRef.current = setTimeout(() => {
187
198
  setCopiedActionId(void 0);
188
199
  }, COPY_FEEDBACK_MS);
189
- }, copyValueForAction = async (action) => {
190
- if (action.copy === "page-markdown") {
191
- if (context.markdownUrl)
192
- try {
193
- let response = await fetch(context.markdownUrl);
194
- if (response.ok) return response.text();
195
- } catch {
196
- return context.markdown ?? "";
200
+ }, markdownPreparation = () => {
201
+ let current = markdownPreparationRef.current;
202
+ if (current?.key === markdownKey) return current;
203
+ current?.controller?.abort();
204
+ let next = { key: markdownKey };
205
+ return markdownPreparationRef.current = next, next;
206
+ }, prepareMarkdown = () => {
207
+ if (context.markdown !== void 0 || !context.markdownUrl) return;
208
+ let record = markdownPreparation();
209
+ if (record.text !== void 0 || record.pending) return;
210
+ let controller = new AbortController();
211
+ record.controller = controller;
212
+ let requestPath = revisionRequestPath(
213
+ context.markdownPath,
214
+ markdownRevision
215
+ ), localPreview = process.env.NODE_ENV !== "production", request = async (cache) => {
216
+ let response;
217
+ try {
218
+ response = await fetch(requestPath, {
219
+ cache,
220
+ signal: controller.signal
221
+ });
222
+ } catch {
223
+ throw new Error("The Markdown page could not be loaded.");
224
+ }
225
+ if (!response.ok)
226
+ throw new Error(
227
+ `The Markdown page could not be loaded (${response.status}).`
228
+ );
229
+ return response.text();
230
+ }, pending = (async () => {
231
+ let firstBody = await request(localPreview ? "no-store" : "default");
232
+ if (!markdownRevision || await markdownHash(firstBody) === markdownRevision)
233
+ return firstBody;
234
+ let refreshedBody = await request(localPreview ? "no-store" : "reload");
235
+ if (await markdownHash(refreshedBody) !== markdownRevision)
236
+ throw new Error(
237
+ "The Markdown page changed while loading. Refresh the page and try again."
238
+ );
239
+ return refreshedBody;
240
+ })().then((text) => (markdownPreparationRef.current === record && currentMarkdownKeyRef.current === record.key && (record.text = text), text)).catch((error) => {
241
+ throw markdownPreparationRef.current === record && (markdownPreparationRef.current = null), error;
242
+ }).finally(() => {
243
+ record.pending = void 0, record.controller = void 0;
244
+ });
245
+ record.pending = pending, pending.catch(() => {
246
+ });
247
+ }, setMenuOpenState = (open) => {
248
+ menuOpenRef.current = open, setMenuOpen(open), open && resolvedActionGroups.some(
249
+ (group) => group.actions.some(
250
+ (action) => action.copy === "page-markdown" && !resolveValue(action.disabled, context)
251
+ )
252
+ ) && prepareMarkdown();
253
+ }, prepareAction = (action) => {
254
+ action.copy === "page-markdown" && !resolveValue(action.disabled, context) && prepareMarkdown();
255
+ }, finishAction = async (action, clipboardWrite, actionMarkdownKey) => {
256
+ try {
257
+ if (await clipboardWrite, actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
258
+ return;
259
+ markCopied(action.id), setCopyFeedback("Copied to clipboard."), await action.onSelect?.(context);
260
+ } catch (error) {
261
+ if (actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
262
+ return;
263
+ setCopyFeedback(
264
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
265
+ );
266
+ }
267
+ }, handleAction = (action) => {
268
+ if (resolveValue(action.disabled, context)) return;
269
+ if (setCopyFeedback(void 0), setCopiedActionId(void 0), !action.copy) {
270
+ Promise.resolve(action.onSelect?.(context)).catch(
271
+ (error) => {
272
+ setCopyFeedback(
273
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
274
+ );
197
275
  }
198
- return context.markdown ?? "";
276
+ );
277
+ return;
199
278
  }
200
- return action.copy === "page-link" ? context.pageUrl : action.copy === "markdown-link" ? context.markdownUrl : action.copy ?? "";
201
- }, handleAction = async (action) => {
202
- if (!resolveValue(action.disabled, context)) {
203
- if (action.copy) {
204
- let value = await copyValueForAction(action);
205
- value && (await copyText(value), markCopied(action.id));
279
+ if (action.copy === "page-markdown" && context.markdown === void 0) {
280
+ if (!context.markdownUrl) {
281
+ setCopyFeedback("The Markdown page URL is not available. Try again.");
282
+ return;
206
283
  }
207
- await action.onSelect?.(context);
284
+ let record = markdownPreparation();
285
+ if (record.text !== void 0) {
286
+ if (!record.text) {
287
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
288
+ return;
289
+ }
290
+ finishAction(action, copyText(record.text), record.key);
291
+ return;
292
+ }
293
+ setCopyFeedback("Preparing Markdown\u2026"), prepareMarkdown();
294
+ let pending = markdownPreparationRef.current?.pending;
295
+ if (!pending) return;
296
+ pending.then(
297
+ (text) => {
298
+ if (currentMarkdownKeyRef.current === record.key) {
299
+ if (!text) {
300
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
301
+ return;
302
+ }
303
+ finishAction(action, copyText(text), record.key);
304
+ }
305
+ },
306
+ (error) => {
307
+ currentMarkdownKeyRef.current === record.key && setCopyFeedback(
308
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
309
+ );
310
+ }
311
+ );
312
+ return;
313
+ }
314
+ let value = action.copy === "page-markdown" ? context.markdown : action.copy === "page-link" ? context.pageUrl : action.copy === "markdown-link" ? context.markdownUrl : action.copy;
315
+ if (!value) {
316
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
317
+ return;
208
318
  }
319
+ finishAction(action, copyText(value));
209
320
  }, iconForAction = (action) => {
210
321
  let copied = copiedActionId === action.id;
211
322
  return action.copy === "page-markdown" ? /* @__PURE__ */ jsx(
@@ -217,68 +328,132 @@ function AgentActions({
217
328
  size: 16
218
329
  }
219
330
  ) : copied ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }) : action.icon;
220
- }, renderPrimaryAction = () => {
221
- let href = resolveValue(resolvedPrimaryAction.href, context), disabled = resolveValue(resolvedPrimaryAction.disabled, context), target = resolvedPrimaryAction.target ?? (resolvedPrimaryAction.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(resolvedPrimaryAction.rel) : void 0;
222
- return href && !resolvedPrimaryAction.copy && !resolvedPrimaryAction.onSelect ? /* @__PURE__ */ jsxs(
331
+ }, contextValue = {
332
+ buttonSize,
333
+ buttonVariant,
334
+ closeMenu,
335
+ copyFeedback,
336
+ menuActionsRef,
337
+ menuLabel,
338
+ menuOpen,
339
+ menuTriggerRef,
340
+ markdownLink: showMarkdownLink ? /* @__PURE__ */ jsxs(
223
341
  "a",
224
342
  {
225
- "aria-disabled": disabled ? "true" : void 0,
226
- className: cn(
227
- buttonVariants({
228
- iconOnly: !1,
229
- size: buttonSize,
230
- variant: buttonVariant
231
- }),
232
- disabled && "pointer-events-none opacity-50"
233
- ),
234
- "data-disabled": disabled ? "" : void 0,
235
- href: disabled ? void 0 : href,
236
- rel,
237
- target,
343
+ className: "inline-flex min-h-7 items-center gap-1.5 text-xs font-medium text-foreground-2 no-underline transition-colors hover:text-foreground-1 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke motion-reduce:transition-none",
344
+ "data-slot": "agent-actions-markdown-link",
345
+ href: resolvedMarkdownPath,
238
346
  children: [
239
- iconForAction(resolvedPrimaryAction),
240
- /* @__PURE__ */ jsx("span", { children: resolvedPrimaryAction.title })
347
+ /* @__PURE__ */ jsx(
348
+ MarkdownLogoIcon,
349
+ {
350
+ "aria-hidden": "true",
351
+ className: "size-4 shrink-0",
352
+ weight: "fill"
353
+ }
354
+ ),
355
+ /* @__PURE__ */ jsx("span", { children: markdownLinkLabel })
241
356
  ]
242
357
  }
243
- ) : /* @__PURE__ */ jsx(
244
- Button,
245
- {
246
- disabled: !!disabled,
247
- leftIcon: iconForAction(resolvedPrimaryAction),
248
- onClick: () => {
249
- handleAction(resolvedPrimaryAction);
358
+ ) : null,
359
+ renderPrimaryAction: (action = resolvedPrimaryAction) => {
360
+ let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0;
361
+ return href && !action.copy && !action.onSelect ? /* @__PURE__ */ jsxs(
362
+ "a",
363
+ {
364
+ "aria-disabled": disabled ? "true" : void 0,
365
+ className: cn(
366
+ buttonVariants({
367
+ iconOnly: !1,
368
+ size: buttonSize,
369
+ variant: buttonVariant
370
+ }),
371
+ disabled && "pointer-events-none opacity-50"
372
+ ),
373
+ "data-disabled": disabled ? "" : void 0,
374
+ href: disabled ? void 0 : href,
375
+ rel,
376
+ target,
377
+ children: [
378
+ iconForAction(action),
379
+ /* @__PURE__ */ jsx("span", { children: action.title })
380
+ ]
381
+ }
382
+ ) : /* @__PURE__ */ jsx(
383
+ Button,
384
+ {
385
+ disabled: !!disabled,
386
+ leftIcon: iconForAction(action),
387
+ onFocus: () => prepareAction(action),
388
+ onClick: () => {
389
+ handleAction(action);
390
+ },
391
+ onPointerDown: () => prepareAction(action),
392
+ onPointerEnter: () => prepareAction(action),
393
+ size: buttonSize,
394
+ variant: buttonVariant,
395
+ children: action.title
396
+ }
397
+ );
398
+ },
399
+ renderMenuAction: (action) => {
400
+ let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0, label = action.title;
401
+ return href && !action.copy && !action.onSelect && !disabled ? /* @__PURE__ */ jsxs(
402
+ MenuLinkItem,
403
+ {
404
+ closeOnClick: !0,
405
+ href,
406
+ onClick: closeMenu,
407
+ rel,
408
+ target,
409
+ children: [
410
+ action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
411
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
412
+ ]
250
413
  },
251
- size: buttonSize,
252
- variant: buttonVariant,
253
- children: resolvedPrimaryAction.title
254
- }
255
- );
256
- }, renderMenuAction = (action) => {
257
- let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0, label = action.title;
258
- return href && !action.copy && !action.onSelect && !disabled ? /* @__PURE__ */ jsx(
259
- MenuLinkItem,
260
- {
261
- closeOnClick: !0,
262
- href,
263
- onClick: closeMenu,
264
- rel,
265
- target,
266
- children: /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
267
- },
268
- action.id
269
- ) : /* @__PURE__ */ jsx(
270
- MenuItem,
271
- {
272
- disabled: !!disabled,
273
- onClick: () => {
274
- handleAction(action);
414
+ action.id
415
+ ) : /* @__PURE__ */ jsxs(
416
+ MenuItem,
417
+ {
418
+ disabled: !!disabled,
419
+ onFocus: () => prepareAction(action),
420
+ onClick: () => {
421
+ handleAction(action);
422
+ },
423
+ onPointerDown: () => prepareAction(action),
424
+ onPointerEnter: () => prepareAction(action),
425
+ children: [
426
+ action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
427
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
428
+ ]
275
429
  },
276
- children: /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
277
- },
278
- action.id
279
- );
430
+ action.id
431
+ );
432
+ },
433
+ resolvedActionGroups,
434
+ setMenuOpenState
280
435
  };
281
- return /* @__PURE__ */ jsxs(
436
+ return /* @__PURE__ */ jsx(AgentActionsContext.Provider, { value: contextValue, children: children ?? /* @__PURE__ */ jsx(AgentActionsDefaultLayout, { className, ...props }) });
437
+ }
438
+ function AgentActionsDefaultLayout({
439
+ className,
440
+ ...props
441
+ }) {
442
+ return /* @__PURE__ */ jsxs(AgentActionsToolbar, { className, ...props, children: [
443
+ /* @__PURE__ */ jsx(AgentActionsMarkdownLink, {}),
444
+ /* @__PURE__ */ jsxs(ButtonGroup, { children: [
445
+ /* @__PURE__ */ jsx(AgentActionsPrimaryAction, {}),
446
+ /* @__PURE__ */ jsx(ButtonGroupSeparator, {}),
447
+ /* @__PURE__ */ jsx(AgentActionsMenu, {})
448
+ ] }),
449
+ /* @__PURE__ */ jsx(AgentActionsFeedback, {})
450
+ ] });
451
+ }
452
+ function AgentActionsToolbar({
453
+ className,
454
+ ...props
455
+ }) {
456
+ return /* @__PURE__ */ jsx(
282
457
  "div",
283
458
  {
284
459
  className: cn(
@@ -286,68 +461,103 @@ function AgentActions({
286
461
  className
287
462
  ),
288
463
  "data-slot": "agent-actions",
289
- ...props,
464
+ ...props
465
+ }
466
+ );
467
+ }
468
+ function AgentActionsMarkdownLink() {
469
+ return useAgentActions().markdownLink;
470
+ }
471
+ function AgentActionsPrimaryAction({ action }) {
472
+ return useAgentActions().renderPrimaryAction(action);
473
+ }
474
+ function AgentActionsFeedback() {
475
+ let { copyFeedback } = useAgentActions();
476
+ return /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", role: "status", children: copyFeedback });
477
+ }
478
+ function AgentActionsGroup({
479
+ title,
480
+ children
481
+ }) {
482
+ return /* @__PURE__ */ jsxs(MenuGroup, { children: [
483
+ title ? /* @__PURE__ */ jsx(MenuGroupLabel, { children: title }) : null,
484
+ children
485
+ ] });
486
+ }
487
+ function AgentActionsItem({ action }) {
488
+ return useAgentActions().renderMenuAction(action);
489
+ }
490
+ function AgentActionsMenu({ children }) {
491
+ let {
492
+ buttonSize,
493
+ buttonVariant,
494
+ closeMenu,
495
+ menuActionsRef,
496
+ menuLabel,
497
+ menuOpen,
498
+ menuTriggerRef,
499
+ resolvedActionGroups,
500
+ setMenuOpenState
501
+ } = useAgentActions();
502
+ return useEffect(() => {
503
+ let view = menuTriggerRef.current?.ownerDocument.defaultView;
504
+ if (view)
505
+ return view.addEventListener("pagehide", closeMenu), view.addEventListener("pageshow", closeMenu), () => {
506
+ view.removeEventListener("pagehide", closeMenu), view.removeEventListener("pageshow", closeMenu);
507
+ };
508
+ }, [closeMenu, menuTriggerRef]), /* @__PURE__ */ jsxs(
509
+ Menu,
510
+ {
511
+ actionsRef: menuActionsRef,
512
+ modal: !1,
513
+ onOpenChange: setMenuOpenState,
514
+ open: menuOpen,
290
515
  children: [
291
- /* @__PURE__ */ jsxs(
292
- "a",
516
+ /* @__PURE__ */ jsx(
517
+ MenuTrigger,
293
518
  {
294
- className: "inline-flex min-h-7 items-center gap-1.5 text-xs font-medium text-foreground-2 no-underline transition-colors hover:text-foreground-1 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke motion-reduce:transition-none",
295
- "data-slot": "agent-actions-markdown-link",
296
- href: resolvedMarkdownPath,
297
- children: [
298
- /* @__PURE__ */ jsx(
299
- MarkdownLogoIcon,
300
- {
301
- "aria-hidden": "true",
302
- className: "size-4 shrink-0",
303
- weight: "fill"
304
- }
305
- ),
306
- /* @__PURE__ */ jsx("span", { children: "View as Markdown" })
307
- ]
519
+ "aria-label": menuLabel,
520
+ ref: menuTriggerRef,
521
+ className: cn(
522
+ buttonVariants({
523
+ iconOnly: !0,
524
+ size: buttonSize,
525
+ variant: buttonVariant
526
+ }),
527
+ "data-popup-open:rounded-r-button!"
528
+ ),
529
+ children: /* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": "true", className: "size-4" })
308
530
  }
309
531
  ),
310
- /* @__PURE__ */ jsxs(ButtonGroup, { children: [
311
- renderPrimaryAction(),
312
- /* @__PURE__ */ jsx(ButtonGroupSeparator, {}),
313
- /* @__PURE__ */ jsxs(
314
- Menu,
315
- {
316
- actionsRef: menuActionsRef,
317
- modal: !1,
318
- onOpenChange: setMenuOpenState,
319
- open: menuOpen,
320
- children: [
321
- /* @__PURE__ */ jsx(
322
- MenuTrigger,
323
- {
324
- "aria-label": menuLabel,
325
- className: cn(
326
- buttonVariants({
327
- iconOnly: !0,
328
- size: buttonSize,
329
- variant: buttonVariant
330
- }),
331
- "data-popup-open:rounded-r-button!"
332
- ),
333
- children: /* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": "true", className: "size-4" })
334
- }
335
- ),
336
- /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { align: "end", children: /* @__PURE__ */ jsx(MenuPopup, { className: "min-w-56", children: resolvedActionGroups.map((group, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
337
- index > 0 ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
338
- /* @__PURE__ */ jsxs(MenuGroup, { children: [
339
- group.title ? /* @__PURE__ */ jsx(MenuGroupLabel, { children: group.title }) : null,
340
- group.actions.map(renderMenuAction)
341
- ] })
342
- ] }, group.id)) }) }) })
343
- ]
344
- }
345
- )
346
- ] })
532
+ /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { align: "end", children: /* @__PURE__ */ jsx(MenuPopup, { className: "min-w-56", onClick: closeMenu, children: children ?? resolvedActionGroups.map((group, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
533
+ index > 0 ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
534
+ /* @__PURE__ */ jsx(AgentActionsGroup, { title: group.title, children: group.actions.map((action) => /* @__PURE__ */ jsx(AgentActionsItem, { action }, action.id)) })
535
+ ] }, group.id)) }) }) })
347
536
  ]
348
537
  }
349
538
  );
350
539
  }
540
+ function AgentActionsRoot(props) {
541
+ return /* @__PURE__ */ jsx(AgentActionsProvider, { ...props });
542
+ }
543
+ var AgentActions = Object.assign(AgentActionsRoot, {
544
+ Feedback: AgentActionsFeedback,
545
+ Group: AgentActionsGroup,
546
+ Item: AgentActionsItem,
547
+ MarkdownLink: AgentActionsMarkdownLink,
548
+ Menu: AgentActionsMenu,
549
+ PrimaryAction: AgentActionsPrimaryAction,
550
+ Root: AgentActionsRoot,
551
+ Toolbar: AgentActionsToolbar
552
+ });
351
553
  export {
352
- AgentActions
554
+ AgentActions,
555
+ AgentActionsFeedback as Feedback,
556
+ AgentActionsGroup as Group,
557
+ AgentActionsItem as Item,
558
+ AgentActionsMarkdownLink as MarkdownLink,
559
+ AgentActionsMenu as Menu,
560
+ AgentActionsPrimaryAction as PrimaryAction,
561
+ AgentActionsRoot as Root,
562
+ AgentActionsToolbar as Toolbar
353
563
  };