@yuhuanowo/yunui 0.2.17 → 0.2.19

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 (560) hide show
  1. package/README.md +56 -5
  2. package/README.zh-CN.md +21 -3
  3. package/README.zh-TW.md +21 -3
  4. package/THIRD_PARTY_NOTICES.md +13 -0
  5. package/agent/catalog.generated.json +29368 -0
  6. package/agent/recipes/analytics.tsx +121 -0
  7. package/agent/recipes/chat.tsx +154 -0
  8. package/agent/recipes/conversation-units.tsx +28 -0
  9. package/agent/recipes/dashboard.tsx +38 -0
  10. package/agent/recipes/landing.tsx +26 -0
  11. package/agent/recipes/setup.md +44 -0
  12. package/agent/skills/yunui/SKILL.md +82 -0
  13. package/dist/adapters.d.ts +5 -0
  14. package/dist/adapters.js +1 -1
  15. package/dist/ai.d.ts +478 -273
  16. package/dist/ai.js +1334 -1964
  17. package/dist/ai.js.map +1 -1
  18. package/dist/charts.d.ts +149 -0
  19. package/dist/charts.js +849 -0
  20. package/dist/charts.js.map +1 -0
  21. package/dist/chat.d.ts +204 -18
  22. package/dist/chat.js +887 -132
  23. package/dist/chat.js.map +1 -1
  24. package/dist/{chunk-F2HG4TOQ.js → chunk-ASPPAL7E.js} +25 -29
  25. package/dist/chunk-ASPPAL7E.js.map +1 -0
  26. package/dist/chunk-AVXIR7ZQ.js +197 -0
  27. package/dist/chunk-AVXIR7ZQ.js.map +1 -0
  28. package/dist/chunk-FJ52MVRF.js +82 -0
  29. package/dist/chunk-FJ52MVRF.js.map +1 -0
  30. package/dist/chunk-GRUB2GXF.js +15 -0
  31. package/dist/chunk-GRUB2GXF.js.map +1 -0
  32. package/dist/{chunk-3RT24MSH.js → chunk-GWD5W5F5.js} +2 -2
  33. package/dist/{chunk-3RT24MSH.js.map → chunk-GWD5W5F5.js.map} +1 -1
  34. package/dist/{chunk-BCOKFWXC.js → chunk-I2DAKAD5.js} +423 -281
  35. package/dist/chunk-I2DAKAD5.js.map +1 -0
  36. package/dist/chunk-OM7B4O6K.js +193 -0
  37. package/dist/chunk-OM7B4O6K.js.map +1 -0
  38. package/dist/chunk-OZIDZFMF.js +70 -0
  39. package/dist/chunk-OZIDZFMF.js.map +1 -0
  40. package/dist/chunk-P6LU2FWV.js +35 -0
  41. package/dist/chunk-P6LU2FWV.js.map +1 -0
  42. package/dist/chunk-SXWMKFKM.js +41 -0
  43. package/dist/chunk-SXWMKFKM.js.map +1 -0
  44. package/dist/chunk-TMTXJFNN.js +2715 -0
  45. package/dist/chunk-TMTXJFNN.js.map +1 -0
  46. package/dist/chunk-VNKAEQKU.js +501 -0
  47. package/dist/chunk-VNKAEQKU.js.map +1 -0
  48. package/dist/chunk-VSS7ASN2.js +12 -0
  49. package/dist/chunk-VSS7ASN2.js.map +1 -0
  50. package/dist/chunk-VYVFMNM7.js +112 -0
  51. package/dist/chunk-VYVFMNM7.js.map +1 -0
  52. package/dist/chunk-YKUQ7GCJ.js +230 -0
  53. package/dist/chunk-YKUQ7GCJ.js.map +1 -0
  54. package/dist/chunk-Z6WXDNBJ.js +366 -0
  55. package/dist/chunk-Z6WXDNBJ.js.map +1 -0
  56. package/dist/chunk-ZBRV6NHL.js +1115 -0
  57. package/dist/chunk-ZBRV6NHL.js.map +1 -0
  58. package/dist/code.d.ts +42 -0
  59. package/dist/code.js +8 -0
  60. package/dist/code.js.map +1 -0
  61. package/dist/content.d.ts +26 -40
  62. package/dist/content.js +400 -418
  63. package/dist/content.js.map +1 -1
  64. package/dist/footer-BCd-S806.d.ts +122 -0
  65. package/dist/index.d.ts +814 -88
  66. package/dist/index.js +7 -5
  67. package/dist/language.d.ts +30 -0
  68. package/dist/language.js +5 -0
  69. package/dist/language.js.map +1 -0
  70. package/dist/model-card.d.ts +43 -0
  71. package/dist/model-card.js +116 -0
  72. package/dist/model-card.js.map +1 -0
  73. package/dist/model.d.ts +51 -0
  74. package/dist/model.js +91 -0
  75. package/dist/model.js.map +1 -0
  76. package/dist/motion.d.ts +11 -0
  77. package/dist/motion.js +9 -0
  78. package/dist/motion.js.map +1 -0
  79. package/dist/patterns.d.ts +913 -29
  80. package/dist/patterns.js +1987 -259
  81. package/dist/patterns.js.map +1 -1
  82. package/dist/pickers.d.ts +134 -0
  83. package/dist/pickers.js +751 -0
  84. package/dist/pickers.js.map +1 -0
  85. package/dist/provider-icons-bgBTnami.d.ts +88 -0
  86. package/dist/segmented-bar-Bsr0PZIL.d.ts +58 -0
  87. package/dist/sparkline-vy5ec5C6.d.ts +67 -0
  88. package/icons/apps/aistudio.webp +0 -0
  89. package/icons/apps/coze.webp +0 -0
  90. package/icons/apps/dify.webp +0 -0
  91. package/icons/apps/doubao.webp +0 -0
  92. package/icons/apps/flowith.webp +0 -0
  93. package/icons/apps/gemini.webp +0 -0
  94. package/icons/apps/github-copilot.webp +0 -0
  95. package/icons/apps/google.webp +0 -0
  96. package/icons/apps/grok.webp +0 -0
  97. package/icons/apps/kimi.webp +0 -0
  98. package/icons/apps/ling.webp +0 -0
  99. package/icons/apps/longcat.webp +0 -0
  100. package/icons/apps/monica.webp +0 -0
  101. package/icons/apps/n8n.webp +0 -0
  102. package/icons/apps/notebooklm.webp +0 -0
  103. package/icons/apps/perplexity.webp +0 -0
  104. package/icons/apps/poe.webp +0 -0
  105. package/icons/apps/qingyan.webp +0 -0
  106. package/icons/apps/stepfun.webp +0 -0
  107. package/icons/apps/tiangong.webp +0 -0
  108. package/icons/apps/yuanbao.webp +0 -0
  109. package/icons/apps/zai.webp +0 -0
  110. package/icons/models/ai21.webp +0 -0
  111. package/icons/models/aimass.webp +0 -0
  112. package/icons/models/anthropic.webp +0 -0
  113. package/icons/models/baichuan.webp +0 -0
  114. package/icons/models/byte_dance.webp +0 -0
  115. package/icons/models/chatglm.webp +0 -0
  116. package/icons/models/claude.webp +0 -0
  117. package/icons/models/codegeex.webp +0 -0
  118. package/icons/models/cogview3flash.webp +0 -0
  119. package/icons/models/cohere.webp +0 -0
  120. package/icons/models/copilot.webp +0 -0
  121. package/icons/models/dalle.webp +0 -0
  122. package/icons/models/dbrx.webp +0 -0
  123. package/icons/models/deepseek.webp +0 -0
  124. package/icons/models/doubao.webp +0 -0
  125. package/icons/models/flux.webp +0 -0
  126. package/icons/models/gemini.webp +0 -0
  127. package/icons/models/gemma.webp +0 -0
  128. package/icons/models/google.webp +0 -0
  129. package/icons/models/grok.webp +0 -0
  130. package/icons/models/hailuo.webp +0 -0
  131. package/icons/models/huggingface.webp +0 -0
  132. package/icons/models/hunyuan.webp +0 -0
  133. package/icons/models/ibm.webp +0 -0
  134. package/icons/models/ideogram.webp +0 -0
  135. package/icons/models/internlm.webp +0 -0
  136. package/icons/models/jina.webp +0 -0
  137. package/icons/models/ling.webp +0 -0
  138. package/icons/models/llava.webp +0 -0
  139. package/icons/models/luma.webp +0 -0
  140. package/icons/models/magic.webp +0 -0
  141. package/icons/models/microsoft.webp +0 -0
  142. package/icons/models/midjourney.webp +0 -0
  143. package/icons/models/minimax.webp +0 -0
  144. package/icons/models/mistral.webp +0 -0
  145. package/icons/models/moonshot.webp +0 -0
  146. package/icons/models/nousresearch.webp +0 -0
  147. package/icons/models/nvidia.webp +0 -0
  148. package/icons/models/o3.webp +0 -0
  149. package/icons/models/openai.webp +0 -0
  150. package/icons/models/palm.webp +0 -0
  151. package/icons/models/perplexity.webp +0 -0
  152. package/icons/models/qwen.webp +0 -0
  153. package/icons/models/stability.webp +0 -0
  154. package/icons/models/step.webp +0 -0
  155. package/icons/models/suno.webp +0 -0
  156. package/icons/models/upstage.webp +0 -0
  157. package/icons/models/vidu.webp +0 -0
  158. package/icons/models/volcengine.webp +0 -0
  159. package/icons/models/voyageai.webp +0 -0
  160. package/icons/models/wenxin.webp +0 -0
  161. package/icons/models/yi.webp +0 -0
  162. package/icons/models/zai.webp +0 -0
  163. package/icons/models/zero-one.webp +0 -0
  164. package/icons/models/zhipu.webp +0 -0
  165. package/icons/providers/302ai.webp +0 -0
  166. package/icons/providers/ace.webp +0 -0
  167. package/icons/providers/adobe.webp +0 -0
  168. package/icons/providers/adobefirefly.webp +0 -0
  169. package/icons/providers/agentvoice.webp +0 -0
  170. package/icons/providers/agnesai.webp +0 -0
  171. package/icons/providers/agui.webp +0 -0
  172. package/icons/providers/ai2.webp +0 -0
  173. package/icons/providers/ai21.webp +0 -0
  174. package/icons/providers/ai302.webp +0 -0
  175. package/icons/providers/ai360.webp +0 -0
  176. package/icons/providers/aihubmix.webp +0 -0
  177. package/icons/providers/aimass.webp +0 -0
  178. package/icons/providers/aimlapi.webp +0 -0
  179. package/icons/providers/aionlabs.webp +0 -0
  180. package/icons/providers/airjelly.webp +0 -0
  181. package/icons/providers/aistudio.webp +0 -0
  182. package/icons/providers/akashchat.webp +0 -0
  183. package/icons/providers/alephalpha.webp +0 -0
  184. package/icons/providers/alibaba.webp +0 -0
  185. package/icons/providers/alibabacloud.webp +0 -0
  186. package/icons/providers/amdradeoncloud.webp +0 -0
  187. package/icons/providers/amp.webp +0 -0
  188. package/icons/providers/anspire.webp +0 -0
  189. package/icons/providers/antgroup.webp +0 -0
  190. package/icons/providers/anthropic.webp +0 -0
  191. package/icons/providers/antigravity.webp +0 -0
  192. package/icons/providers/anyscale.webp +0 -0
  193. package/icons/providers/apertis.webp +0 -0
  194. package/icons/providers/apple.webp +0 -0
  195. package/icons/providers/appwrite.webp +0 -0
  196. package/icons/providers/arcee.webp +0 -0
  197. package/icons/providers/askverdict.webp +0 -0
  198. package/icons/providers/assemblyai.webp +0 -0
  199. package/icons/providers/atlascloud.webp +0 -0
  200. package/icons/providers/automatic.webp +0 -0
  201. package/icons/providers/aws-bedrock.webp +0 -0
  202. package/icons/providers/aws.webp +0 -0
  203. package/icons/providers/aya.webp +0 -0
  204. package/icons/providers/azure.webp +0 -0
  205. package/icons/providers/azureai.webp +0 -0
  206. package/icons/providers/baai.webp +0 -0
  207. package/icons/providers/baichuan.webp +0 -0
  208. package/icons/providers/baidu-cloud.webp +0 -0
  209. package/icons/providers/baidu.webp +0 -0
  210. package/icons/providers/baiducloud.webp +0 -0
  211. package/icons/providers/bailian.webp +0 -0
  212. package/icons/providers/baseten.webp +0 -0
  213. package/icons/providers/bedrock.webp +0 -0
  214. package/icons/providers/bfl.webp +0 -0
  215. package/icons/providers/bigModel.webp +0 -0
  216. package/icons/providers/bilibili.webp +0 -0
  217. package/icons/providers/bilibiliindex.webp +0 -0
  218. package/icons/providers/bing.webp +0 -0
  219. package/icons/providers/bocha.webp +0 -0
  220. package/icons/providers/brave.webp +0 -0
  221. package/icons/providers/briaai.webp +0 -0
  222. package/icons/providers/browserless.webp +0 -0
  223. package/icons/providers/burncloud.webp +0 -0
  224. package/icons/providers/bytedance.webp +0 -0
  225. package/icons/providers/capcut.webp +0 -0
  226. package/icons/providers/celestoai.webp +0 -0
  227. package/icons/providers/centml.webp +0 -0
  228. package/icons/providers/cerebras.webp +0 -0
  229. package/icons/providers/chatglm.webp +0 -0
  230. package/icons/providers/cheaperinference.webp +0 -0
  231. package/icons/providers/cherrystudio.webp +0 -0
  232. package/icons/providers/chutes.webp +0 -0
  233. package/icons/providers/civitai.webp +0 -0
  234. package/icons/providers/claude.webp +0 -0
  235. package/icons/providers/claudecode.webp +0 -0
  236. package/icons/providers/cline.webp +0 -0
  237. package/icons/providers/clipdrop.webp +0 -0
  238. package/icons/providers/cloudflare.webp +0 -0
  239. package/icons/providers/codebuddy.webp +0 -0
  240. package/icons/providers/codeflicker.webp +0 -0
  241. package/icons/providers/codegeex.webp +0 -0
  242. package/icons/providers/codex.webp +0 -0
  243. package/icons/providers/cogvideo.webp +0 -0
  244. package/icons/providers/cogview.webp +0 -0
  245. package/icons/providers/cogview3flash.webp +0 -0
  246. package/icons/providers/cohere.webp +0 -0
  247. package/icons/providers/colab.webp +0 -0
  248. package/icons/providers/cometapi.webp +0 -0
  249. package/icons/providers/comfyui.webp +0 -0
  250. package/icons/providers/commanda.webp +0 -0
  251. package/icons/providers/commandcode.webp +0 -0
  252. package/icons/providers/copilot.webp +0 -0
  253. package/icons/providers/copilotkit.webp +0 -0
  254. package/icons/providers/coqui.webp +0 -0
  255. package/icons/providers/coze.webp +0 -0
  256. package/icons/providers/crewai.webp +0 -0
  257. package/icons/providers/crusoe.webp +0 -0
  258. package/icons/providers/cursor.webp +0 -0
  259. package/icons/providers/cybercut.webp +0 -0
  260. package/icons/providers/dalle.webp +0 -0
  261. package/icons/providers/dbrx.webp +0 -0
  262. package/icons/providers/decart.webp +0 -0
  263. package/icons/providers/deepai.webp +0 -0
  264. package/icons/providers/deepcogito.webp +0 -0
  265. package/icons/providers/deepinfra.webp +0 -0
  266. package/icons/providers/deepl.webp +0 -0
  267. package/icons/providers/deepmind.webp +0 -0
  268. package/icons/providers/deepseek.webp +0 -0
  269. package/icons/providers/devin.webp +0 -0
  270. package/icons/providers/dify.webp +0 -0
  271. package/icons/providers/digitalocean.webp +0 -0
  272. package/icons/providers/doc2x.webp +0 -0
  273. package/icons/providers/docsearch.webp +0 -0
  274. package/icons/providers/dolphin.webp +0 -0
  275. package/icons/providers/dothoosh.webp +0 -0
  276. package/icons/providers/dotsstudio.webp +0 -0
  277. package/icons/providers/doubao.webp +0 -0
  278. package/icons/providers/dreammachine.webp +0 -0
  279. package/icons/providers/elevenlabs.webp +0 -0
  280. package/icons/providers/elevenx.webp +0 -0
  281. package/icons/providers/empiriolabs.webp +0 -0
  282. package/icons/providers/essentialai.webp +0 -0
  283. package/icons/providers/exa.webp +0 -0
  284. package/icons/providers/fal.webp +0 -0
  285. package/icons/providers/fastgpt.webp +0 -0
  286. package/icons/providers/featherless.webp +0 -0
  287. package/icons/providers/figma.webp +0 -0
  288. package/icons/providers/firecrawl.webp +0 -0
  289. package/icons/providers/fireworks.webp +0 -0
  290. package/icons/providers/fishaudio.webp +0 -0
  291. package/icons/providers/flexai.webp +0 -0
  292. package/icons/providers/flora.webp +0 -0
  293. package/icons/providers/flowith.webp +0 -0
  294. package/icons/providers/flux.webp +0 -0
  295. package/icons/providers/friendli.webp +0 -0
  296. package/icons/providers/gemini.webp +0 -0
  297. package/icons/providers/geminicli.webp +0 -0
  298. package/icons/providers/gemma.webp +0 -0
  299. package/icons/providers/gitee-ai.webp +0 -0
  300. package/icons/providers/giteeai.webp +0 -0
  301. package/icons/providers/github.webp +0 -0
  302. package/icons/providers/githubcopilot.webp +0 -0
  303. package/icons/providers/glama.webp +0 -0
  304. package/icons/providers/glif.webp +0 -0
  305. package/icons/providers/glmv.webp +0 -0
  306. package/icons/providers/gmi.svg +5 -0
  307. package/icons/providers/gmicloud.webp +0 -0
  308. package/icons/providers/google.webp +0 -0
  309. package/icons/providers/googlecloud.webp +0 -0
  310. package/icons/providers/goose.webp +0 -0
  311. package/icons/providers/gradio.webp +0 -0
  312. package/icons/providers/greenpt.webp +0 -0
  313. package/icons/providers/greptile.webp +0 -0
  314. package/icons/providers/grok.webp +0 -0
  315. package/icons/providers/grokbot.webp +0 -0
  316. package/icons/providers/groq.webp +0 -0
  317. package/icons/providers/hailuo.webp +0 -0
  318. package/icons/providers/haiper.webp +0 -0
  319. package/icons/providers/happyhorse.webp +0 -0
  320. package/icons/providers/hedra.webp +0 -0
  321. package/icons/providers/hermesagent.webp +0 -0
  322. package/icons/providers/higress.webp +0 -0
  323. package/icons/providers/huawei.webp +0 -0
  324. package/icons/providers/huaweicloud.webp +0 -0
  325. package/icons/providers/huggingface.webp +0 -0
  326. package/icons/providers/hunyuan.webp +0 -0
  327. package/icons/providers/hyperbolic.webp +0 -0
  328. package/icons/providers/ibm.webp +0 -0
  329. package/icons/providers/ideogram.webp +0 -0
  330. package/icons/providers/iflytekcloud.webp +0 -0
  331. package/icons/providers/inception.webp +0 -0
  332. package/icons/providers/inceptron.webp +0 -0
  333. package/icons/providers/inference.webp +0 -0
  334. package/icons/providers/infermatic.webp +0 -0
  335. package/icons/providers/infini.webp +0 -0
  336. package/icons/providers/infinigence.webp +0 -0
  337. package/icons/providers/inflection.webp +0 -0
  338. package/icons/providers/internlm.webp +0 -0
  339. package/icons/providers/ionet.webp +0 -0
  340. package/icons/providers/jimeng.webp +0 -0
  341. package/icons/providers/jina.webp +0 -0
  342. package/icons/providers/junie.webp +0 -0
  343. package/icons/providers/kagi.webp +0 -0
  344. package/icons/providers/kilocode.webp +0 -0
  345. package/icons/providers/kimi.webp +0 -0
  346. package/icons/providers/kiro.webp +0 -0
  347. package/icons/providers/kling.webp +0 -0
  348. package/icons/providers/kluster.webp +0 -0
  349. package/icons/providers/kolors.webp +0 -0
  350. package/icons/providers/krea.webp +0 -0
  351. package/icons/providers/kwaikat.webp +0 -0
  352. package/icons/providers/kwaipilot.webp +0 -0
  353. package/icons/providers/lambda.webp +0 -0
  354. package/icons/providers/langchain.webp +0 -0
  355. package/icons/providers/langfuse.webp +0 -0
  356. package/icons/providers/langgraph.webp +0 -0
  357. package/icons/providers/langsmith.webp +0 -0
  358. package/icons/providers/leptonai.webp +0 -0
  359. package/icons/providers/lg.webp +0 -0
  360. package/icons/providers/lightricks.webp +0 -0
  361. package/icons/providers/ling.webp +0 -0
  362. package/icons/providers/liquid.webp +0 -0
  363. package/icons/providers/livekit.webp +0 -0
  364. package/icons/providers/llamaindex.webp +0 -0
  365. package/icons/providers/llava.webp +0 -0
  366. package/icons/providers/llmapi.webp +0 -0
  367. package/icons/providers/llmgateway.webp +0 -0
  368. package/icons/providers/lmstudio.webp +0 -0
  369. package/icons/providers/lobehub.webp +0 -0
  370. package/icons/providers/lobot.webp +0 -0
  371. package/icons/providers/longcat.webp +0 -0
  372. package/icons/providers/lovable.webp +0 -0
  373. package/icons/providers/lovart.webp +0 -0
  374. package/icons/providers/luma.webp +0 -0
  375. package/icons/providers/magic.webp +0 -0
  376. package/icons/providers/magpie.webp +0 -0
  377. package/icons/providers/make.webp +0 -0
  378. package/icons/providers/manus.webp +0 -0
  379. package/icons/providers/mastra.webp +0 -0
  380. package/icons/providers/mcp.webp +0 -0
  381. package/icons/providers/mcpso.webp +0 -0
  382. package/icons/providers/menlo.webp +0 -0
  383. package/icons/providers/meshy.webp +0 -0
  384. package/icons/providers/meta.webp +0 -0
  385. package/icons/providers/metaai.webp +0 -0
  386. package/icons/providers/metagpt.webp +0 -0
  387. package/icons/providers/microsoft.webp +0 -0
  388. package/icons/providers/midjourney.webp +0 -0
  389. package/icons/providers/minimax.webp +0 -0
  390. package/icons/providers/mistral.webp +0 -0
  391. package/icons/providers/modelscope.webp +0 -0
  392. package/icons/providers/monica.webp +0 -0
  393. package/icons/providers/moonshot.webp +0 -0
  394. package/icons/providers/morph.webp +0 -0
  395. package/icons/providers/moxt.webp +0 -0
  396. package/icons/providers/muse.webp +0 -0
  397. package/icons/providers/myshell.webp +0 -0
  398. package/icons/providers/n8n.webp +0 -0
  399. package/icons/providers/nanobanana.webp +0 -0
  400. package/icons/providers/nebius.webp +0 -0
  401. package/icons/providers/newapi.webp +0 -0
  402. package/icons/providers/nextbit.webp +0 -0
  403. package/icons/providers/notebooklm.webp +0 -0
  404. package/icons/providers/notion.webp +0 -0
  405. package/icons/providers/nousresearch.webp +0 -0
  406. package/icons/providers/nova.webp +0 -0
  407. package/icons/providers/novelai.webp +0 -0
  408. package/icons/providers/novita.webp +0 -0
  409. package/icons/providers/nplcloud.webp +0 -0
  410. package/icons/providers/nvidia.webp +0 -0
  411. package/icons/providers/o3.webp +0 -0
  412. package/icons/providers/obsidian.webp +0 -0
  413. package/icons/providers/ollama.webp +0 -0
  414. package/icons/providers/omlx.webp +0 -0
  415. package/icons/providers/openai.webp +0 -0
  416. package/icons/providers/openchat.webp +0 -0
  417. package/icons/providers/openclaw.webp +0 -0
  418. package/icons/providers/opencode.webp +0 -0
  419. package/icons/providers/openhands.webp +0 -0
  420. package/icons/providers/openhuman.webp +0 -0
  421. package/icons/providers/openrouter.webp +0 -0
  422. package/icons/providers/openwebui.webp +0 -0
  423. package/icons/providers/paddleocr.webp +0 -0
  424. package/icons/providers/palm.webp +0 -0
  425. package/icons/providers/parasail.webp +0 -0
  426. package/icons/providers/perceptron.webp +0 -0
  427. package/icons/providers/perplexity.webp +0 -0
  428. package/icons/providers/phala.webp +0 -0
  429. package/icons/providers/phidata.webp +0 -0
  430. package/icons/providers/phind.webp +0 -0
  431. package/icons/providers/pi.webp +0 -0
  432. package/icons/providers/pika.webp +0 -0
  433. package/icons/providers/pixverse.webp +0 -0
  434. package/icons/providers/player2.webp +0 -0
  435. package/icons/providers/poe.webp +0 -0
  436. package/icons/providers/pollinations.webp +0 -0
  437. package/icons/providers/poolside.webp +0 -0
  438. package/icons/providers/ppio.webp +0 -0
  439. package/icons/providers/prunaai.webp +0 -0
  440. package/icons/providers/pydanticai.webp +0 -0
  441. package/icons/providers/qingyan.webp +0 -0
  442. package/icons/providers/qiniu.webp +0 -0
  443. package/icons/providers/qoder.webp +0 -0
  444. package/icons/providers/qwen.webp +0 -0
  445. package/icons/providers/railway.webp +0 -0
  446. package/icons/providers/recraft.webp +0 -0
  447. package/icons/providers/reflection.webp +0 -0
  448. package/icons/providers/reka.webp +0 -0
  449. package/icons/providers/relace.webp +0 -0
  450. package/icons/providers/replicate.webp +0 -0
  451. package/icons/providers/replit.webp +0 -0
  452. package/icons/providers/reve.webp +0 -0
  453. package/icons/providers/roocode.webp +0 -0
  454. package/icons/providers/rsshub.webp +0 -0
  455. package/icons/providers/runway.webp +0 -0
  456. package/icons/providers/rwkv.webp +0 -0
  457. package/icons/providers/sakana.webp +0 -0
  458. package/icons/providers/sambanova.webp +0 -0
  459. package/icons/providers/search1api.webp +0 -0
  460. package/icons/providers/searchapi.webp +0 -0
  461. package/icons/providers/searxng.webp +0 -0
  462. package/icons/providers/sensenova.webp +0 -0
  463. package/icons/providers/silicon.webp +0 -0
  464. package/icons/providers/siliconcloud.webp +0 -0
  465. package/icons/providers/sillytavern.webp +0 -0
  466. package/icons/providers/skywork.webp +0 -0
  467. package/icons/providers/slock.webp +0 -0
  468. package/icons/providers/smithery.webp +0 -0
  469. package/icons/providers/snowflake.webp +0 -0
  470. package/icons/providers/sophnet.webp +0 -0
  471. package/icons/providers/sora.webp +0 -0
  472. package/icons/providers/spark.webp +0 -0
  473. package/icons/providers/speedai.webp +0 -0
  474. package/icons/providers/stability.webp +0 -0
  475. package/icons/providers/statecloud.webp +0 -0
  476. package/icons/providers/step.webp +0 -0
  477. package/icons/providers/stepfun.webp +0 -0
  478. package/icons/providers/straico.webp +0 -0
  479. package/icons/providers/streamlake.webp +0 -0
  480. package/icons/providers/sub2api.webp +0 -0
  481. package/icons/providers/submodel.webp +0 -0
  482. package/icons/providers/suno.webp +0 -0
  483. package/icons/providers/sync.webp +0 -0
  484. package/icons/providers/tabbit.webp +0 -0
  485. package/icons/providers/targon.webp +0 -0
  486. package/icons/providers/tavily.webp +0 -0
  487. package/icons/providers/tencent-cloud-ti.webp +0 -0
  488. package/icons/providers/tencent.webp +0 -0
  489. package/icons/providers/tencentcloud.webp +0 -0
  490. package/icons/providers/tiangong.webp +0 -0
  491. package/icons/providers/tii.webp +0 -0
  492. package/icons/providers/together.webp +0 -0
  493. package/icons/providers/topazlabs.webp +0 -0
  494. package/icons/providers/trae.webp +0 -0
  495. package/icons/providers/tripo.webp +0 -0
  496. package/icons/providers/turix.webp +0 -0
  497. package/icons/providers/typesafeai.webp +0 -0
  498. package/icons/providers/udio.webp +0 -0
  499. package/icons/providers/unionalpha.webp +0 -0
  500. package/icons/providers/unsloth.webp +0 -0
  501. package/icons/providers/unstructured.webp +0 -0
  502. package/icons/providers/upstage.webp +0 -0
  503. package/icons/providers/v0.webp +0 -0
  504. package/icons/providers/vectorizerai.webp +0 -0
  505. package/icons/providers/venice.webp +0 -0
  506. package/icons/providers/vercel.webp +0 -0
  507. package/icons/providers/vertexai.webp +0 -0
  508. package/icons/providers/vidu.webp +0 -0
  509. package/icons/providers/viggle.webp +0 -0
  510. package/icons/providers/vllm.webp +0 -0
  511. package/icons/providers/volcengine.webp +0 -0
  512. package/icons/providers/voyage.webp +0 -0
  513. package/icons/providers/voyageai.webp +0 -0
  514. package/icons/providers/wafer.webp +0 -0
  515. package/icons/providers/wandb.webp +0 -0
  516. package/icons/providers/wavespeed.webp +0 -0
  517. package/icons/providers/wenxin.webp +0 -0
  518. package/icons/providers/windsurf.webp +0 -0
  519. package/icons/providers/workbuddy.webp +0 -0
  520. package/icons/providers/workersai.webp +0 -0
  521. package/icons/providers/worldrouter.webp +0 -0
  522. package/icons/providers/xai.webp +0 -0
  523. package/icons/providers/xiaomimimo.webp +0 -0
  524. package/icons/providers/xinference.webp +0 -0
  525. package/icons/providers/xpay.webp +0 -0
  526. package/icons/providers/xuanyuan.webp +0 -0
  527. package/icons/providers/yandex.webp +0 -0
  528. package/icons/providers/yi.webp +0 -0
  529. package/icons/providers/youmind.webp +0 -0
  530. package/icons/providers/yuanbao.webp +0 -0
  531. package/icons/providers/zai.webp +0 -0
  532. package/icons/providers/zapier.webp +0 -0
  533. package/icons/providers/zeabur.webp +0 -0
  534. package/icons/providers/zencoder.webp +0 -0
  535. package/icons/providers/zenmux.webp +0 -0
  536. package/icons/providers/zero-one.webp +0 -0
  537. package/icons/providers/zeroone.webp +0 -0
  538. package/icons/providers/zhipu.webp +0 -0
  539. package/licenses/beautiful-ui-MIT.txt +21 -0
  540. package/package.json +53 -10
  541. package/scripts/yunui-audit.mjs +664 -0
  542. package/scripts/yunui-cli.mjs +868 -0
  543. package/scripts/yunui-init.mjs +138 -0
  544. package/styles/content.css +37 -3
  545. package/styles/tokens.css +41 -0
  546. package/styles/yunui.css +1586 -141
  547. package/dist/chunk-BCOKFWXC.js.map +0 -1
  548. package/dist/chunk-DDUP7GAX.js +0 -86
  549. package/dist/chunk-DDUP7GAX.js.map +0 -1
  550. package/dist/chunk-F2HG4TOQ.js.map +0 -1
  551. package/dist/chunk-HH3JBHRP.js +0 -1211
  552. package/dist/chunk-HH3JBHRP.js.map +0 -1
  553. package/dist/chunk-N4QO7RN5.js +0 -98
  554. package/dist/chunk-N4QO7RN5.js.map +0 -1
  555. package/dist/chunk-QEIBYOG2.js +0 -188
  556. package/dist/chunk-QEIBYOG2.js.map +0 -1
  557. package/dist/footer-BoFu7Wqq.d.ts +0 -46
  558. package/icons/apps/ling.png +0 -0
  559. package/icons/models/ling.png +0 -0
  560. package/icons/providers/Kwaipilot.png +0 -0
package/dist/patterns.js CHANGED
@@ -1,15 +1,20 @@
1
1
  "use client";
2
- import './chunk-HH3JBHRP.js';
3
- import { copyToClipboard } from './chunk-DDUP7GAX.js';
4
- export { Footer } from './chunk-DDUP7GAX.js';
5
- import './chunk-F2HG4TOQ.js';
6
- import { ImageLightbox } from './chunk-QEIBYOG2.js';
7
- import { Button, Card, Badge, Avatar, AvatarImage, AvatarFallback, IconButton, Spinner, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-BCOKFWXC.js';
8
- import { cn } from './chunk-N4QO7RN5.js';
9
- import { useYunUI } from './chunk-3RT24MSH.js';
2
+ import { ImageLightbox } from './chunk-OM7B4O6K.js';
3
+ import { codeLineCount, previewCode, translateCodeBlockLabel, codeLineCountLabel, restoreCodeBlockScroll, scheduleCodeBlockScrollRestore, CODE_BLOCK_FOLD_THRESHOLD, captureCodeBlockScroll } from './chunk-FJ52MVRF.js';
4
+ import { useSlidingPill, Collapsible, CollapsibleTrigger, CollapsibleContent, MotionNumber } from './chunk-TMTXJFNN.js';
5
+ import './chunk-AVXIR7ZQ.js';
6
+ export { Footer, Navbar } from './chunk-YKUQ7GCJ.js';
7
+ import './chunk-ASPPAL7E.js';
8
+ import { Button, Card, Badge, Avatar, AvatarImage, AvatarFallback, IconButton, Spinner, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ScrollFade, Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from './chunk-I2DAKAD5.js';
9
+ import { useEscapeKey, useBodyScrollLock, useFocusTrap } from './chunk-Z6WXDNBJ.js';
10
+ import { cn } from './chunk-VSS7ASN2.js';
11
+ import { capabilityBadgeColor, capabilityIconColor } from './chunk-OZIDZFMF.js';
12
+ import { copyToClipboard } from './chunk-P6LU2FWV.js';
13
+ import { useYunUI } from './chunk-GWD5W5F5.js';
10
14
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
- import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
12
- import { AlertCircle, RefreshCw, Check, Copy, Plus, FileText, ExternalLink, Calendar, Clock, User, ChevronLeft, ChevronRight, ArrowUp, PanelLeftClose, X, ArrowUpRight, ArrowDownRight, GraduationCap, ArrowRight, Award, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, Image, Brain, Eye, Code, MessageSquare, XCircle, Zap, CheckCircle, FileCode, EyeOff, Sparkles, Globe, Loader2, LogOut, Pause, Play, Download, Grid, List, Bell, Trash2, Camera, Info, CheckCircle2, AlertTriangle } from 'lucide-react';
15
+ import React, { createContext, useState, useRef, useId, useMemo, useEffect, useCallback, isValidElement, cloneElement, useLayoutEffect, useContext } from 'react';
16
+ import { AlertCircle, RefreshCw, Check, Copy, Plus, FileText, ExternalLink, Calendar, Clock, User, ChevronLeft, ChevronRight, ArrowUp, PanelLeftClose, X, ArrowUpRight, ArrowDownRight, GraduationCap, ArrowRight, Award, Waves, SlidersHorizontal, Layers, Fingerprint, Ban, DatabaseZap, Image, Brain, Eye, Code, MessageSquare, XCircle, Zap, CheckCircle, FileCode, EyeOff, Sparkles, Globe, Loader2, LogOut, Pause, Play, Download, Grid, List, Bell, Trash2, Camera, Quote, ChevronDown, Info, CheckCircle2, AlertTriangle } from 'lucide-react';
17
+ import { createPortal } from 'react-dom';
13
18
 
14
19
  function BackgroundEffects() {
15
20
  return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 -z-10 h-full w-full pointer-events-none select-none overflow-hidden bg-(--bg-base)", children: /* @__PURE__ */ jsx(
@@ -26,6 +31,7 @@ function BackgroundEffects() {
26
31
  }
27
32
  ) });
28
33
  }
34
+ var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
29
35
  function tokenizeLine(line) {
30
36
  const tokens = [];
31
37
  let remaining = line;
@@ -92,6 +98,7 @@ function tokenizeLine(line) {
92
98
  continue;
93
99
  }
94
100
  }
101
+ tokens.push({ type: "text", value: line[pos] });
95
102
  pos++;
96
103
  remaining = line.slice(pos);
97
104
  }
@@ -132,136 +139,284 @@ function renderLine(line) {
132
139
  }
133
140
  }).join("");
134
141
  }
135
- function highlightCode(code) {
142
+ function highlightCode(code, showLineNumbers) {
136
143
  const lines = code.split("\n");
137
144
  return lines.map((line, i) => {
138
- const rendered = renderLine(line) || " ";
139
- return `<div class="table-row group"><span class="table-cell select-none text-right pr-4 w-8 text-(--text-muted) text-xs opacity-0 group-hover:opacity-50 transition-opacity">${i + 1}</span><span class="table-cell">${rendered}</span></div>`;
145
+ const rendered = renderLine(line) || "<br />";
146
+ const lineNumber = showLineNumbers ? `<span class="table-cell select-none text-right pr-4 w-8 text-(--text-tertiary) text-xs opacity-0 group-hover:opacity-100 transition-opacity">${i + 1}</span>` : "";
147
+ return `<div class="table-row group">${lineNumber}<span class="table-cell">${rendered}</span></div>`;
140
148
  }).join("");
141
149
  }
142
150
  function CodeBlock({
143
151
  code,
144
152
  language = "text",
145
153
  filename,
146
- showLineNumbers = true,
154
+ showLineNumbers = false,
147
155
  copyable = true,
148
156
  className,
149
157
  tabs
150
158
  }) {
151
- const t = useYunUI().useT("common");
159
+ const translate = useYunUI().useT("common");
152
160
  const [copied, setCopied] = useState(false);
153
- const [highlightedHtml, setHighlightedHtml] = useState("");
154
- const [activeTab, setActiveTab] = useState(0);
155
- const currentCode = tabs?.[activeTab]?.code || code;
156
- const currentLanguage = tabs?.[activeTab]?.language || language;
157
- useEffect(() => {
158
- setHighlightedHtml(highlightCode(currentCode));
161
+ const [copyError, setCopyError] = useState(false);
162
+ const [expanded, setExpanded] = useState(false);
163
+ const [activeTabId, setActiveTabId] = useState(null);
164
+ const codeRegionRef = useRef(null);
165
+ const headerRef = useRef(null);
166
+ const copyButtonRef = useRef(null);
167
+ const disclosureRef = useRef(null);
168
+ const disclosureScroll = useRef(null);
169
+ const restoreExpandedFocus = useRef(false);
170
+ const restoreDisclosureFocus = useRef(false);
171
+ const codeBlockId = useId();
172
+ const copyRequestRef = useRef(0);
173
+ const copyTimeoutRef = useRef(null);
174
+ const hasTabs = Boolean(tabs?.length);
175
+ const activeTabData = hasTabs ? tabs?.find((tab) => tab.id === activeTabId) ?? tabs?.[0] : void 0;
176
+ const resolvedActiveTabId = activeTabData?.id ?? null;
177
+ const currentCode = activeTabData ? activeTabData.code : code;
178
+ const currentLanguage = activeTabData?.language || language;
179
+ const previousCopyPayloadRef = useRef(currentCode);
180
+ const lineCount = codeLineCount(currentCode);
181
+ const foldable = lineCount > CODE_BLOCK_FOLD_THRESHOLD;
182
+ const shownCode = foldable && !expanded ? previewCode(currentCode) : currentCode;
183
+ const highlightedHtml = useMemo(
184
+ () => highlightCode(shownCode, showLineNumbers),
185
+ [shownCode, showLineNumbers]
186
+ );
187
+ const codeRegionLabel = translateCodeBlockLabel(
188
+ translate,
189
+ "scrollRegion",
190
+ `${currentLanguage} code, ${codeLineCountLabel(lineCount)}`,
191
+ { language: currentLanguage, count: lineCount }
192
+ );
193
+ const copyFullLabel = translateCodeBlockLabel(translate, "copyFull", "Copy full code");
194
+ const copyErrorLabel = translateCodeBlockLabel(
195
+ translate,
196
+ "copyError",
197
+ "Clipboard access was denied. Select the code and copy it manually."
198
+ );
199
+ const scrollCueLabel = translateCodeBlockLabel(translate, "scrollHorizontally", "Scroll horizontally");
200
+ const showAllLabel = translateCodeBlockLabel(
201
+ translate,
202
+ "showAll",
203
+ `Show all ${lineCount} lines`,
204
+ { count: lineCount }
205
+ );
206
+ const showLessLabel = translateCodeBlockLabel(translate, "showLess", "Show less");
207
+ const tabGroupLabel = translateCodeBlockLabel(translate, "tabGroup", "Code sample formats");
208
+ useIsomorphicLayoutEffect(() => {
209
+ if (activeTabId !== resolvedActiveTabId) setActiveTabId(resolvedActiveTabId);
210
+ }, [activeTabId, resolvedActiveTabId]);
211
+ useIsomorphicLayoutEffect(() => {
212
+ if (previousCopyPayloadRef.current === currentCode) return;
213
+ previousCopyPayloadRef.current = currentCode;
214
+ copyRequestRef.current += 1;
215
+ setCopied(false);
216
+ setCopyError(false);
217
+ if (copyTimeoutRef.current !== null) clearTimeout(copyTimeoutRef.current);
218
+ copyTimeoutRef.current = null;
159
219
  }, [currentCode]);
220
+ useEffect(() => () => {
221
+ copyRequestRef.current += 1;
222
+ if (copyTimeoutRef.current !== null) clearTimeout(copyTimeoutRef.current);
223
+ }, []);
224
+ useIsomorphicLayoutEffect(() => {
225
+ if (!disclosureScroll.current) return;
226
+ const snapshot = disclosureScroll.current;
227
+ if (expanded && restoreExpandedFocus.current) {
228
+ restoreExpandedFocus.current = false;
229
+ codeRegionRef.current?.focus({ preventScroll: true });
230
+ }
231
+ if (!expanded && restoreDisclosureFocus.current) {
232
+ restoreDisclosureFocus.current = false;
233
+ disclosureRef.current?.focus({ preventScroll: true });
234
+ }
235
+ restoreCodeBlockScroll(snapshot);
236
+ return scheduleCodeBlockScrollRestore(snapshot, () => {
237
+ if (disclosureScroll.current === snapshot) disclosureScroll.current = null;
238
+ });
239
+ }, [expanded]);
160
240
  const handleCopy = async () => {
161
- if (!await copyToClipboard(currentCode)) return;
241
+ const requestId = ++copyRequestRef.current;
242
+ const payload = currentCode;
243
+ if (copyTimeoutRef.current !== null) clearTimeout(copyTimeoutRef.current);
244
+ copyTimeoutRef.current = null;
245
+ setCopied(false);
246
+ setCopyError(false);
247
+ if (!await copyToClipboard(payload)) {
248
+ if (requestId !== copyRequestRef.current) return;
249
+ setCopied(false);
250
+ setCopyError(true);
251
+ return;
252
+ }
253
+ if (requestId !== copyRequestRef.current) return;
162
254
  setCopied(true);
163
- setTimeout(() => setCopied(false), 2e3);
255
+ copyTimeoutRef.current = setTimeout(() => {
256
+ if (requestId !== copyRequestRef.current) return;
257
+ setCopied(false);
258
+ copyTimeoutRef.current = null;
259
+ }, 2e3);
164
260
  };
165
- const handleTabChange = (index) => {
166
- setActiveTab(index);
261
+ const handleTabChange = (id) => {
262
+ setActiveTabId(id);
263
+ setCopied(false);
264
+ setCopyError(false);
167
265
  };
168
- return /* @__PURE__ */ jsxs("div", { className: cn("card overflow-hidden max-w-full min-w-0", className), children: [
169
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 border-b border-(--border-hairline) bg-(--bg-elevated)", children: [
170
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
171
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
172
- /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--error) opacity-80" }),
173
- /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--warning) opacity-80" }),
174
- /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--success) opacity-80" })
175
- ] }),
176
- tabs && tabs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
266
+ const toggleExpanded = () => {
267
+ const nextExpanded = !expanded;
268
+ disclosureScroll.current = captureCodeBlockScroll(disclosureRef.current);
269
+ restoreExpandedFocus.current = nextExpanded;
270
+ restoreDisclosureFocus.current = !nextExpanded;
271
+ setExpanded(nextExpanded);
272
+ };
273
+ const handleCodeKeyDown = (event) => {
274
+ const region = event.currentTarget;
275
+ if (foldable && expanded && event.key === "Tab") {
276
+ const headerButtons = headerRef.current?.querySelectorAll("button");
277
+ const previousControl = copyButtonRef.current ?? headerButtons?.[headerButtons.length - 1] ?? null;
278
+ const nextControl = event.shiftKey ? previousControl : disclosureRef.current;
279
+ if (nextControl) {
280
+ event.preventDefault();
281
+ nextControl.focus();
282
+ return;
283
+ }
284
+ }
285
+ const before = region.scrollLeft;
286
+ if (event.key === "ArrowRight" && region.scrollWidth > region.clientWidth) {
287
+ region.scrollLeft += 48;
288
+ } else if (event.key === "ArrowLeft" && region.scrollWidth > region.clientWidth) {
289
+ region.scrollLeft -= 48;
290
+ } else {
291
+ return;
292
+ }
293
+ if (region.scrollLeft !== before) event.preventDefault();
294
+ };
295
+ const legacyCopy = translate("copy");
296
+ const legacyCopied = translate("copied");
297
+ const copyText = !legacyCopy || legacyCopy === "copy" || legacyCopy.endsWith(".copy") ? "Copy" : legacyCopy;
298
+ const copiedText = !legacyCopied || legacyCopied === "copied" || legacyCopied.endsWith(".copied") ? "Copied" : legacyCopied;
299
+ return /* @__PURE__ */ jsxs("div", { className: cn("my-3 w-full min-w-0 overflow-hidden rounded-lg border border-(--border-hairline) bg-(--bg-base)", className), children: [
300
+ /* @__PURE__ */ jsxs("div", { ref: headerRef, className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-(--border-hairline) bg-(--bg-elevated) px-2 py-1.5", children: [
301
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1", children: [
302
+ hasTabs ? /* @__PURE__ */ jsx("div", { role: "group", "aria-label": tabGroupLabel, className: "flex min-w-0 flex-1 flex-wrap items-center gap-1", children: tabs.map((tab) => /* @__PURE__ */ jsx(
177
303
  "button",
178
304
  {
179
- onClick: () => handleTabChange(index),
305
+ type: "button",
306
+ "aria-pressed": activeTabData?.id === tab.id,
307
+ onClick: () => handleTabChange(tab.id),
180
308
  className: cn(
181
- "px-3 py-1 rounded-md text-xs font-medium transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring",
182
- activeTab === index ? "bg-(--accent-subtle) text-(--text-primary)" : "text-(--text-tertiary) hover:text-(--text-secondary) hover:bg-(--accent-subtle)/50"
309
+ "min-h-6 min-w-0 max-w-full break-words rounded-md px-2 py-1 text-left text-xs font-medium leading-tight transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",
310
+ activeTabData?.id === tab.id ? "bg-(--accent-subtle) text-(--text-primary)" : "text-(--text-secondary) hover:bg-(--accent-subtle)/50"
183
311
  ),
184
312
  children: tab.label
185
313
  },
186
314
  tab.id
187
- )) }) : filename ? /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-(--text-secondary) font-mono", children: filename }) : /* @__PURE__ */ jsx("span", { className: "badge text-xs", children: currentLanguage })
315
+ )) }) : /* @__PURE__ */ jsx("span", { className: cn("min-w-0 flex-1 truncate font-mono text-xs font-medium text-(--text-secondary)", !filename && "font-sans"), title: filename || currentLanguage, children: filename || currentLanguage }),
316
+ filename && !hasTabs && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded bg-(--bg-base) px-1.5 py-0.5 text-[10px] text-(--text-secondary)", children: currentLanguage }),
317
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-(--text-secondary)", children: translateCodeBlockLabel(translate, "lineCount", codeLineCountLabel(lineCount), { count: lineCount }) }),
318
+ currentCode.split("\n").some((line) => line.length > 72) && /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[10px] text-(--text-secondary)", children: [
319
+ scrollCueLabel,
320
+ " ",
321
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2192" })
322
+ ] })
188
323
  ] }),
189
- copyable && /* @__PURE__ */ jsx(
324
+ copyable && /* @__PURE__ */ jsxs(
190
325
  "button",
191
326
  {
327
+ ref: copyButtonRef,
328
+ type: "button",
329
+ "aria-label": copied ? copiedText : copyFullLabel,
192
330
  onClick: handleCopy,
193
- className: "flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-all hover:bg-(--accent-subtle) outline-none focus-visible:ring-2 focus-visible:ring-ring",
194
- children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
195
- /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-(--success)" }),
196
- /* @__PURE__ */ jsx("span", { className: "text-(--success)", children: t("copied") })
197
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
198
- /* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5 text-(--text-tertiary)" }),
199
- /* @__PURE__ */ jsx("span", { className: "text-(--text-tertiary)", children: t("copy") })
200
- ] })
331
+ className: "ml-auto inline-flex min-h-6 shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-(--text-secondary) transition-colors hover:bg-(--accent-subtle) outline-none focus-visible:ring-2 focus-visible:ring-ring",
332
+ children: [
333
+ copied ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-(--success)" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" }),
334
+ /* @__PURE__ */ jsx("span", { className: copied ? "text-(--success)" : "text-(--text-secondary)", children: copied ? copiedText : copyText })
335
+ ]
201
336
  }
202
337
  )
203
338
  ] }),
204
- /* @__PURE__ */ jsx("div", { className: "p-4 bg-(--bg-base)", children: /* @__PURE__ */ jsx("pre", { className: "text-sm overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx("code", { className: "font-mono", style: { color: "var(--text-primary)" }, children: showLineNumbers ? /* @__PURE__ */ jsx(
205
- "div",
339
+ copyError && /* @__PURE__ */ jsx("p", { role: "alert", className: "border-b border-(--border-hairline) px-2 py-1 text-xs text-(--text-secondary)", children: copyErrorLabel }),
340
+ /* @__PURE__ */ jsx(
341
+ "pre",
206
342
  {
207
- className: "table",
208
- dangerouslySetInnerHTML: {
209
- __html: highlightedHtml || code.split("\n").map(
210
- (line, i) => `<div class="table-row group"><span class="table-cell select-none text-right pr-4 w-8 text-(--text-muted) text-xs opacity-0 group-hover:opacity-50 transition-opacity">${i + 1}</span><span class="table-cell">${escapeHtml(line) || "&nbsp;"}</span></div>`
211
- ).join("")
212
- }
343
+ ref: codeRegionRef,
344
+ id: `${codeBlockId}-code`,
345
+ tabIndex: 0,
346
+ "aria-label": codeRegionLabel,
347
+ onKeyDown: handleCodeKeyDown,
348
+ className: cn("m-0 max-w-full overflow-x-auto overflow-y-hidden whitespace-pre bg-(--bg-base) px-2 py-2 font-mono text-sm leading-[1.5] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", showLineNumbers && "code-with-line-numbers"),
349
+ children: /* @__PURE__ */ jsx("code", { className: "block font-mono text-(--text-primary)", dangerouslySetInnerHTML: { __html: highlightedHtml } })
350
+ }
351
+ ),
352
+ foldable && /* @__PURE__ */ jsx(
353
+ "button",
354
+ {
355
+ ref: disclosureRef,
356
+ type: "button",
357
+ "aria-expanded": expanded,
358
+ "aria-controls": `${codeBlockId}-code`,
359
+ onClick: toggleExpanded,
360
+ className: "flex min-h-7 w-full items-center border-t border-(--border-hairline) px-2 py-1 text-left text-xs text-(--text-secondary) transition-colors hover:bg-(--accent-subtle) outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
361
+ children: expanded ? showLessLabel : showAllLabel
213
362
  }
214
- ) : code }) }) })
363
+ )
215
364
  ] });
216
365
  }
217
- var codeSnippets = {
218
- python: `import openai
366
+ function snippets(baseUrl, model, apiKey, prompt) {
367
+ const j = (s) => JSON.stringify(s);
368
+ const sq = (s) => `'${s.replace(/'/g, "\\'")}'`;
369
+ return {
370
+ python: `import openai
219
371
 
220
372
  client = openai.OpenAI(
221
- base_url="https://api.example.com/v1",
222
- api_key="your_api_key"
373
+ base_url=${j(baseUrl)},
374
+ api_key=${j(apiKey)}
223
375
  )
224
376
 
225
377
  response = client.chat.completions.create(
226
- model="deepseek-r1",
227
- messages=[{"role": "user", "content": "Hello!"}]
378
+ model=${j(model)},
379
+ messages=[{"role": "user", "content": ${j(prompt)}}]
228
380
  )
229
381
 
230
382
  print(response.choices[0].message.content)`,
231
- javascript: `import OpenAI from 'openai';
383
+ javascript: `import OpenAI from 'openai';
232
384
 
233
385
  const client = new OpenAI({
234
- baseURL: 'https://api.example.com/v1',
235
- apiKey: 'your_api_key'
386
+ baseURL: ${sq(baseUrl)},
387
+ apiKey: ${sq(apiKey)}
236
388
  });
237
389
 
238
390
  const response = await client.chat.completions.create({
239
- model: 'deepseek-r1',
240
- messages: [{ role: 'user', content: 'Hello!' }]
391
+ model: ${sq(model)},
392
+ messages: [{ role: 'user', content: ${sq(prompt)} }]
241
393
  });
242
394
 
243
395
  console.log(response.choices[0].message.content);`,
244
- curl: `curl https://api.example.com/v1/chat/completions \\
245
- -H "Authorization: Bearer your_api_key" \\
396
+ curl: `curl ${baseUrl}/chat/completions \\
397
+ -H "Authorization: Bearer ${apiKey}" \\
246
398
  -H "Content-Type: application/json" \\
247
399
  -d '{
248
- "model": "deepseek-r1",
249
- "messages": [{"role": "user", "content": "Hello!"}]
400
+ "model": ${j(model)},
401
+ "messages": [{"role": "user", "content": ${j(prompt)}}]
250
402
  }'`
251
- };
252
- function CodeDemo() {
403
+ };
404
+ }
405
+ function CodeDemo({
406
+ baseUrl = "https://api.example.com/v1",
407
+ model = "deepseek-r1",
408
+ apiKeyPlaceholder = "your_api_key",
409
+ prompt = "Hello!",
410
+ labels,
411
+ className
412
+ } = {}) {
413
+ const code = snippets(baseUrl, model, apiKeyPlaceholder, prompt);
253
414
  const tabs = [
254
- { id: "python", label: "Python", code: codeSnippets.python, language: "python" },
255
- { id: "javascript", label: "Node.js", code: codeSnippets.javascript, language: "javascript" },
256
- { id: "curl", label: "cURL", code: codeSnippets.curl, language: "bash" }
415
+ { id: "python", label: labels?.python ?? "Python", code: code.python, language: "python" },
416
+ { id: "javascript", label: labels?.javascript ?? "Node.js", code: code.javascript, language: "javascript" },
417
+ { id: "curl", label: labels?.curl ?? "cURL", code: code.curl, language: "bash" }
257
418
  ];
258
- return /* @__PURE__ */ jsx("div", { className: "w-full max-w-2xl mx-auto", children: /* @__PURE__ */ jsx(
259
- CodeBlock,
260
- {
261
- code: codeSnippets.python,
262
- tabs
263
- }
264
- ) });
419
+ return /* @__PURE__ */ jsx("div", { className: className ?? "w-full max-w-2xl mx-auto", children: /* @__PURE__ */ jsx(CodeBlock, { code: code.python, tabs }) });
265
420
  }
266
421
  function FAQ({ items, defaultOpenIndex = 0 }) {
267
422
  const [openIndex, setOpenIndex] = useState(defaultOpenIndex);
@@ -270,7 +425,7 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
270
425
  "div",
271
426
  {
272
427
  className: cn(
273
- "glass-card overflow-hidden transition-all duration-300",
428
+ "glass-card overflow-hidden transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard)",
274
429
  openIndex === i ? "bg-card/60 ring-1 ring-(--accent-muted)" : "hover:bg-card/50"
275
430
  ),
276
431
  children: [
@@ -282,20 +437,11 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
282
437
  className: "w-full flex items-center justify-between p-6 text-left gap-4 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset rounded-[inherit]",
283
438
  children: [
284
439
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground flex-1 min-w-0", children: faq.question }),
285
- /* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground transition-transform duration-300 shrink-0", openIndex === i ? "rotate-45" : ""), children: /* @__PURE__ */ jsx(Plus, { className: "w-5 h-5" }) })
440
+ /* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground transition-transform duration-(--dur-base) ease-(--ease-standard) shrink-0", openIndex === i ? "rotate-45" : ""), children: /* @__PURE__ */ jsx(Plus, { className: "w-5 h-5" }) })
286
441
  ]
287
442
  }
288
443
  ),
289
- /* @__PURE__ */ jsx(
290
- "div",
291
- {
292
- className: cn(
293
- "px-6 text-muted-foreground text-sm leading-relaxed overflow-hidden transition-all duration-300",
294
- openIndex === i ? "max-h-60 pb-6 opacity-100" : "max-h-0 opacity-0"
295
- ),
296
- children: faq.answer
297
- }
298
- )
444
+ /* @__PURE__ */ jsx("div", { className: "motion-collapse", "data-open": openIndex === i, inert: openIndex !== i, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: "px-6 pb-6 text-muted-foreground text-sm leading-relaxed", children: faq.answer }) }) })
299
445
  ]
300
446
  },
301
447
  i
@@ -303,9 +449,9 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
303
449
  }
304
450
  var actionClass = cn(
305
451
  "inline-flex items-center gap-1.5 px-2 py-1 text-xs",
306
- "text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors rounded-md hover:bg-fd-accent"
452
+ "text-muted-foreground hover:text-accent-foreground transition-colors rounded-md hover:bg-accent"
307
453
  );
308
- function LLMCopyButton({ markdownUrl }) {
454
+ function LLMCopyButton({ markdownUrl, labels }) {
309
455
  const [copied, setCopied] = useState(false);
310
456
  const handleCopy = useCallback(async () => {
311
457
  try {
@@ -320,15 +466,12 @@ function LLMCopyButton({ markdownUrl }) {
320
466
  setTimeout(() => setCopied(false), 2e3);
321
467
  }
322
468
  }, [markdownUrl]);
323
- return /* @__PURE__ */ jsxs("button", { type: "button", onClick: handleCopy, title: "Copy as Markdown for LLM", className: actionClass, children: [
469
+ return /* @__PURE__ */ jsxs("button", { type: "button", onClick: handleCopy, title: labels?.title ?? "Copy as Markdown for LLM", className: actionClass, children: [
324
470
  copied ? /* @__PURE__ */ jsx(Check, { className: "size-3" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3" }),
325
- copied ? "Copied" : "Copy"
471
+ copied ? labels?.copied ?? "Copied" : labels?.copy ?? "Copy"
326
472
  ] });
327
473
  }
328
- function ViewOptions({
329
- markdownUrl,
330
- githubUrl
331
- }) {
474
+ function ViewOptions({ markdownUrl, githubUrl, labels }) {
332
475
  return /* @__PURE__ */ jsxs(Fragment, { children: [
333
476
  /* @__PURE__ */ jsxs(
334
477
  "a",
@@ -337,10 +480,10 @@ function ViewOptions({
337
480
  target: "_blank",
338
481
  rel: "noreferrer noopener",
339
482
  className: cn(actionClass, "no-underline"),
340
- title: "View as Markdown",
483
+ title: labels?.markdownTitle ?? "View as Markdown",
341
484
  children: [
342
485
  /* @__PURE__ */ jsx(FileText, { className: "size-3" }),
343
- "Markdown"
486
+ labels?.markdown ?? "Markdown"
344
487
  ]
345
488
  }
346
489
  ),
@@ -351,10 +494,10 @@ function ViewOptions({
351
494
  target: "_blank",
352
495
  rel: "noreferrer noopener",
353
496
  className: cn(actionClass, "no-underline"),
354
- title: "Edit on GitHub",
497
+ title: labels?.githubTitle ?? "Edit on GitHub",
355
498
  children: [
356
499
  /* @__PURE__ */ jsx(ExternalLink, { className: "size-3" }),
357
- "GitHub"
500
+ labels?.github ?? "GitHub"
358
501
  ]
359
502
  }
360
503
  )
@@ -403,7 +546,7 @@ function BlogCard({
403
546
  {
404
547
  src: coverImage,
405
548
  alt: title,
406
- className: "w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"
549
+ className: "w-full h-full object-cover transition-transform duration-(--dur-slow) group-hover:scale-105"
407
550
  }
408
551
  ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-muted-foreground/30", children: /* @__PURE__ */ jsx("svg", { className: "w-12 h-12", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" }) }) }) }),
409
552
  /* @__PURE__ */ jsxs("div", { className: "p-5 flex flex-col flex-grow", children: [
@@ -511,8 +654,9 @@ function BlogPagination({
511
654
  size: "sm",
512
655
  onClick: () => handlePageChange(currentPage - 1),
513
656
  disabled: currentPage === 1,
657
+ "aria-label": previousLabel,
514
658
  children: [
515
- /* @__PURE__ */ jsx(ChevronLeft, { size: 16 }),
659
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16, "aria-hidden": true }),
516
660
  /* @__PURE__ */ jsx("span", { className: "ml-1 hidden sm:inline", children: previousLabel })
517
661
  ]
518
662
  }
@@ -556,9 +700,10 @@ function BlogPagination({
556
700
  size: "sm",
557
701
  onClick: () => handlePageChange(currentPage + 1),
558
702
  disabled: currentPage === totalPages,
703
+ "aria-label": nextLabel,
559
704
  children: [
560
705
  /* @__PURE__ */ jsx("span", { className: "mr-1 hidden sm:inline", children: nextLabel }),
561
- /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
706
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, "aria-hidden": true })
562
707
  ]
563
708
  }
564
709
  )
@@ -578,7 +723,7 @@ function ReadingProgress({
578
723
  const backToTopLabel = labels?.backToTop ?? "Back to top";
579
724
  useEffect(() => {
580
725
  let frame = 0;
581
- const measure = () => {
726
+ const measure2 = () => {
582
727
  frame = 0;
583
728
  const scrolled = window.scrollY;
584
729
  const reach = document.documentElement.scrollHeight - window.innerHeight;
@@ -586,9 +731,9 @@ function ReadingProgress({
586
731
  setShow(scrolled > threshold);
587
732
  };
588
733
  const onScroll = () => {
589
- if (!frame) frame = window.requestAnimationFrame(measure);
734
+ if (!frame) frame = window.requestAnimationFrame(measure2);
590
735
  };
591
- measure();
736
+ measure2();
592
737
  window.addEventListener("scroll", onScroll, { passive: true });
593
738
  window.addEventListener("resize", onScroll, { passive: true });
594
739
  return () => {
@@ -613,7 +758,7 @@ function ReadingProgress({
613
758
  // dropdowns): translucent popover + backdrop blur, hairline border, the
614
759
  // house shadow and focus ring. House colour classes bridge to the token
615
760
  // system through @theme.
616
- "group fixed bottom-6 right-6 z-50 grid h-12 w-12 place-items-center rounded-full border border-border bg-popover/85 backdrop-blur-2xl text-muted-foreground shadow-lg shadow-black/5 transition-all duration-300 ease-out " + (interactive ? "hover:-translate-y-0.5 hover:bg-popover hover:text-foreground hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background " : "pointer-events-none ") + (show ? "translate-y-0 scale-100 opacity-100 " : "pointer-events-none translate-y-3 scale-90 opacity-0 ") + className
761
+ "group fixed bottom-6 right-6 z-50 grid h-12 w-12 place-items-center rounded-full border border-border bg-popover text-muted-foreground shadow-lg shadow-black/5 transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard) " + (interactive ? "hover:-translate-y-0.5 hover:bg-popover hover:text-foreground hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background " : "pointer-events-none ") + (show ? "translate-y-0 scale-100 opacity-100 " : "pointer-events-none translate-y-3 scale-90 opacity-0 ") + className
617
762
  ),
618
763
  children: [
619
764
  bar && /* @__PURE__ */ jsxs(
@@ -643,7 +788,7 @@ function ReadingProgress({
643
788
  fill: "none",
644
789
  strokeWidth: "2.5",
645
790
  strokeLinecap: "round",
646
- className: "transition-[stroke-dashoffset] duration-150 ease-out",
791
+ className: "transition-[stroke-dashoffset] duration-(--dur-fast) ease-out",
647
792
  style: { stroke: "var(--accent)" },
648
793
  strokeDasharray: RING_CIRCUMFERENCE,
649
794
  strokeDashoffset: RING_CIRCUMFERENCE * (1 - progress / 100)
@@ -652,7 +797,7 @@ function ReadingProgress({
652
797
  ]
653
798
  }
654
799
  ),
655
- backToTop && /* @__PURE__ */ jsx(ArrowUp, { size: 17, strokeWidth: 2, className: "relative transition-transform duration-200 group-hover:-translate-y-0.5" })
800
+ backToTop && /* @__PURE__ */ jsx(ArrowUp, { size: 17, strokeWidth: 2, className: "relative transition-transform duration-(--dur-base) group-hover:-translate-y-0.5" })
656
801
  ]
657
802
  }
658
803
  );
@@ -670,14 +815,14 @@ function SimplePagination({
670
815
  const nextLabel = labels?.next ?? "Next";
671
816
  const pageNode = labels?.page ? labels.page(currentPage) : `Page ${currentPage}`;
672
817
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-1.5 sm:gap-2", children: [
673
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onPrevious, disabled: !canPrev, children: [
674
- /* @__PURE__ */ jsx(ChevronLeft, { size: 16 }),
818
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onPrevious, disabled: !canPrev, "aria-label": previousLabel, children: [
819
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16, "aria-hidden": true }),
675
820
  /* @__PURE__ */ jsx("span", { className: "ml-1 hidden sm:inline", children: previousLabel })
676
821
  ] }),
677
822
  /* @__PURE__ */ jsx("span", { className: "px-3 text-sm font-medium tabular-nums whitespace-nowrap", children: pageNode }),
678
- /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onNext, disabled: !hasNext, children: [
823
+ /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onNext, disabled: !hasNext, "aria-label": nextLabel, children: [
679
824
  /* @__PURE__ */ jsx("span", { className: "mr-1 hidden sm:inline", children: nextLabel }),
680
- /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
825
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, "aria-hidden": true })
681
826
  ] })
682
827
  ] });
683
828
  }
@@ -733,10 +878,15 @@ function NavStateIndicator({
733
878
  }
734
879
  );
735
880
  }
736
- function isItemActive(item, currentPath, homeHref) {
737
- if (currentPath === item.href) return true;
738
- if (item.href !== homeHref && currentPath.startsWith(item.href)) return true;
739
- return item.match?.some((m) => currentPath.startsWith(m)) ?? false;
881
+ function matchStrength(item, currentPath, homeHref) {
882
+ let best = -1;
883
+ for (const prefix of [item.href, ...item.match ?? []]) {
884
+ if (currentPath === prefix) best = Math.max(best, prefix.length);
885
+ else if (prefix !== homeHref && currentPath.startsWith(prefix.replace(/\/$/, "") + "/")) {
886
+ best = Math.max(best, prefix.length);
887
+ }
888
+ }
889
+ return best;
740
890
  }
741
891
  function Sidebar({
742
892
  appName,
@@ -750,6 +900,7 @@ function Sidebar({
750
900
  onToggleCollapse,
751
901
  onNavigate,
752
902
  footer,
903
+ footerItems,
753
904
  closeLabel = "Close",
754
905
  loading = false,
755
906
  scrollStorageKey = "yunui-sidebar-scroll",
@@ -762,38 +913,83 @@ function Sidebar({
762
913
  }) {
763
914
  const { Link, Image } = useYunUI();
764
915
  const navRef = useRef(null);
916
+ const navPill = useSlidingPill(".nav-item.active", [currentPath, loading]);
917
+ const footerPill = useSlidingPill(".nav-item.active", [currentPath, loading]);
918
+ const Outer = role === "navigation" ? "nav" : "aside";
919
+ const Inner = role === "navigation" ? "div" : "nav";
920
+ const renderItem = (item) => {
921
+ const active = strongestMatch >= 0 && matchStrength(item, currentPath, homeHref) === strongestMatch;
922
+ const Icon = item.icon;
923
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
924
+ /* @__PURE__ */ jsx(NavStateIndicator, { active }),
925
+ Icon && /* @__PURE__ */ jsx(Icon, { size: 18, strokeWidth: 1.75, className: "shrink-0" }),
926
+ /* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 truncate", children: item.label })
927
+ ] });
928
+ const className2 = `nav-item ${active ? "active" : ""}`;
929
+ return onNavigate ? /* @__PURE__ */ jsx(
930
+ "a",
931
+ {
932
+ href: item.href,
933
+ onClick: (e) => {
934
+ e.preventDefault();
935
+ onNavigate(item.href);
936
+ onClose?.();
937
+ },
938
+ className: className2,
939
+ children: content
940
+ },
941
+ item.href
942
+ ) : /* @__PURE__ */ jsx(Link, { href: item.href, onClick: () => onClose?.(), className: className2, children: content }, item.href);
943
+ };
944
+ const strongestMatch = useMemo(
945
+ () => sections.reduce(
946
+ (best, section) => section.items.reduce((inner, item) => Math.max(inner, matchStrength(item, currentPath, homeHref)), best),
947
+ (footerItems ?? []).reduce((best, item) => Math.max(best, matchStrength(item, currentPath, homeHref)), -1)
948
+ ),
949
+ [sections, footerItems, currentPath, homeHref]
950
+ );
765
951
  useEffect(() => {
766
952
  const nav = navRef.current;
767
953
  if (!nav) return;
768
954
  const saved = sessionStorage.getItem(scrollStorageKey);
769
955
  if (saved) nav.scrollTop = parseInt(saved, 10);
770
- const onScroll = () => sessionStorage.setItem(scrollStorageKey, String(nav.scrollTop));
771
- nav.addEventListener("scroll", onScroll);
772
- return () => nav.removeEventListener("scroll", onScroll);
956
+ let frame = 0;
957
+ const onScroll = () => {
958
+ if (frame) return;
959
+ frame = requestAnimationFrame(() => {
960
+ frame = 0;
961
+ sessionStorage.setItem(scrollStorageKey, String(nav.scrollTop));
962
+ });
963
+ };
964
+ nav.addEventListener("scroll", onScroll, { passive: true });
965
+ return () => {
966
+ if (frame) cancelAnimationFrame(frame);
967
+ nav.removeEventListener("scroll", onScroll);
968
+ };
773
969
  }, [scrollStorageKey]);
774
970
  return /* @__PURE__ */ jsxs(Fragment, { children: [
775
971
  layout === "fixed" && isOpen && /* @__PURE__ */ jsx(
776
972
  "div",
777
973
  {
778
- className: "fixed inset-0 bg-black/20 backdrop-blur-sm z-40 lg:hidden",
974
+ className: "fixed inset-0 bg-black/20 z-40 lg:hidden",
779
975
  onClick: onClose,
780
976
  "aria-hidden": "true"
781
977
  }
782
978
  ),
783
979
  /* @__PURE__ */ jsxs(
784
- "aside",
980
+ Outer,
785
981
  {
786
- role,
982
+ role: role === "navigation" ? void 0 : role,
787
983
  "aria-label": ariaLabel,
788
984
  className: cn(
789
- "min-w-64 w-64 bg-(--bg-base) border-r border-(--border-hairline) flex flex-col",
790
- layout === "fixed" ? "fixed inset-y-0 left-0 z-50 h-dvh transition-transform duration-200 ease-in-out" : "relative z-0 h-full min-w-0 w-full",
985
+ "min-w-64 w-64 bg-(--bg-window) border-r border-(--border-hairline) flex flex-col",
986
+ layout === "fixed" ? "fixed inset-y-0 left-0 z-50 h-dvh transition-transform duration-(--dur-base) ease-(--ease-standard)" : "relative z-0 h-full min-w-0 w-full",
791
987
  layout === "fixed" && (isOpen ? "translate-x-0" : collapsed ? "-translate-x-full" : "-translate-x-full lg:translate-x-0"),
792
988
  className
793
989
  ),
794
990
  children: [
795
991
  header !== void 0 ? header : /* @__PURE__ */ jsx("div", { className: "py-3 px-3 shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center py-2 pl-0 pr-1 gap-2", children: [
796
- /* @__PURE__ */ jsxs(Link, { href: homeHref, className: "flex-1 min-w-0 flex items-center gap-2.5 rounded-lg pl-3 pr-3 py-1.5 hover:bg-foreground/5 transition-colors duration-200", children: [
992
+ /* @__PURE__ */ jsxs(Link, { href: homeHref, className: "flex-1 min-w-0 flex items-center gap-2.5 rounded-lg pl-3 pr-3 py-1.5 hover:bg-foreground/5 transition-colors duration-(--dur-base)", children: [
797
993
  /* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 36, height: 36, className: "shrink-0" }),
798
994
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-[18px] truncate", children: appName })
799
995
  ] }),
@@ -811,33 +1007,27 @@ function Sidebar({
811
1007
  ] }),
812
1008
  onClose && /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(X, { size: 20 }), label: closeLabel, onClick: onClose, className: "lg:hidden" })
813
1009
  ] }) }),
814
- children != null ? /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col", children }) : /* @__PURE__ */ jsx("nav", { ref: navRef, className: "flex-1 overflow-y-auto py-3 px-3", children: loading ? /* @__PURE__ */ jsx("div", { className: "space-y-2 animate-pulse", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "h-9 rounded-lg bg-foreground/5" }, i)) }) : sections.map((section, i) => /* @__PURE__ */ jsxs("div", { className: i > 0 ? "mt-4" : "", children: [
815
- section.title && /* @__PURE__ */ jsx("div", { className: "nav-section", children: section.title }),
816
- section.items.map((item) => {
817
- const active = isItemActive(item, currentPath, homeHref);
818
- const Icon = item.icon;
819
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
820
- /* @__PURE__ */ jsx(NavStateIndicator, { active }),
821
- Icon && /* @__PURE__ */ jsx(Icon, { size: 18, strokeWidth: 1.75, className: "shrink-0" }),
822
- /* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 truncate", children: item.label })
823
- ] });
824
- const className2 = `nav-item ${active ? "active" : ""}`;
825
- return onNavigate ? /* @__PURE__ */ jsx(
826
- "a",
827
- {
828
- href: item.href,
829
- onClick: (e) => {
830
- e.preventDefault();
831
- onNavigate(item.href);
832
- onClose?.();
833
- },
834
- className: className2,
835
- children: content
836
- },
837
- item.href
838
- ) : /* @__PURE__ */ jsx(Link, { href: item.href, onClick: () => onClose?.(), className: className2, children: content }, item.href);
839
- })
840
- ] }, i)) }),
1010
+ children != null ? /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col", children }) : /* @__PURE__ */ jsxs(
1011
+ Inner,
1012
+ {
1013
+ ref: (node) => {
1014
+ navRef.current = node;
1015
+ navPill.containerRef.current = node;
1016
+ },
1017
+ className: "relative flex-1 overflow-y-auto py-3 px-3",
1018
+ children: [
1019
+ /* @__PURE__ */ jsx("span", { ref: navPill.pillRef, "aria-hidden": "true", className: "yunui-slider-pill is-nav-bg", "data-ready": "false" }),
1020
+ loading ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "skeleton h-9 rounded-lg" }, i)) }) : sections.map((section, i) => /* @__PURE__ */ jsxs("div", { className: i > 0 ? "mt-4" : "", children: [
1021
+ section.title && /* @__PURE__ */ jsx("div", { className: "nav-section", children: section.title }),
1022
+ section.items.map(renderItem)
1023
+ ] }, i))
1024
+ ]
1025
+ }
1026
+ ),
1027
+ footerItems && footerItems.length > 0 && !loading && children == null && /* @__PURE__ */ jsxs("div", { ref: footerPill.containerRef, className: "relative shrink-0 px-3 pb-1", children: [
1028
+ /* @__PURE__ */ jsx("span", { ref: footerPill.pillRef, "aria-hidden": "true", className: "yunui-slider-pill is-nav-bg", "data-ready": "false" }),
1029
+ footerItems.map(renderItem)
1030
+ ] }),
841
1031
  footer && /* @__PURE__ */ jsx("div", { className: "p-3 shrink-0", children: footer })
842
1032
  ]
843
1033
  }
@@ -860,11 +1050,12 @@ function PageLayout({
860
1050
  hideFooter = false,
861
1051
  transparentBg = false,
862
1052
  mainClassName,
1053
+ mainId = "main-content",
863
1054
  className
864
1055
  }) {
865
1056
  return /* @__PURE__ */ jsxs("div", { className: cn("min-h-dvh flex flex-col relative", !transparentBg && "bg-background", className), children: [
866
1057
  navbar,
867
- /* @__PURE__ */ jsx("main", { className: cn("flex-1 pt-28", mainClassName), children }),
1058
+ /* @__PURE__ */ jsx("main", { id: mainId, className: cn("flex-1 pt-28", mainClassName), children }),
868
1059
  !hideFooter && footer
869
1060
  ] });
870
1061
  }
@@ -906,32 +1097,53 @@ function PageEmptyState({ icon: Icon, title, description, action }) {
906
1097
  action && /* @__PURE__ */ jsx("div", { className: "mt-4", children: action })
907
1098
  ] });
908
1099
  }
1100
+ var SEMANTIC_TONES = {
1101
+ warning: { card: "border-warning-soft bg-warning-soft", value: "text-warning" },
1102
+ success: { card: "border-success-soft bg-success-soft", value: "text-success" },
1103
+ info: { card: "border-info-soft bg-info-soft", value: "text-info" },
1104
+ error: { card: "border-error-soft bg-error-soft", value: "text-error" },
1105
+ // No `.text-accent` helper exists (unlike the four status tones), so the
1106
+ // value colour reads the token directly rather than a dead utility class.
1107
+ accent: { card: "border-accent-soft bg-accent-soft", value: "text-(--accent)" }
1108
+ };
909
1109
  var TONES = {
910
- amber: { card: "border-amber-500/20 bg-amber-500/5", value: "text-amber-600 dark:text-amber-400" },
911
- emerald: { card: "border-emerald-500/20 bg-emerald-500/5", value: "text-emerald-600 dark:text-emerald-400" },
912
- blue: { card: "border-blue-500/20 bg-blue-500/5", value: "text-blue-600 dark:text-blue-400" },
913
- red: { card: "border-red-500/20 bg-red-500/5", value: "text-red-600 dark:text-red-400" },
914
- purple: { card: "border-purple-500/20 bg-purple-500/5", value: "text-purple-600 dark:text-purple-400" }
1110
+ ...SEMANTIC_TONES,
1111
+ // Legacy colour-named aliases.
1112
+ amber: SEMANTIC_TONES.warning,
1113
+ emerald: SEMANTIC_TONES.success,
1114
+ blue: SEMANTIC_TONES.info,
1115
+ red: SEMANTIC_TONES.error,
1116
+ purple: SEMANTIC_TONES.accent
915
1117
  };
916
- function StatCard({ icon: Icon, label, value, subtext, trend, tone, delay = 0, inline = false, valueFirst = false, compact = false, className }) {
1118
+ function StatCard({ icon: Icon, label, value: rawValue, subtext, trend, tone, delay = 0, inline = false, valueFirst = false, compact = false, className }) {
917
1119
  const toneCfg = tone ? TONES[tone] : void 0;
918
1120
  const showTopRow = Boolean(Icon || trend);
919
1121
  const surface = compact ? "card p-4" : "stat-card p-5";
920
- const topRow = showTopRow ? /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-4", children: [
921
- Icon ? /* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-xl bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx(Icon, { size: 20, strokeWidth: 1.5, className: "text-muted-foreground" }) }) : /* @__PURE__ */ jsx("span", {}),
922
- trend && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-xs font-medium", trend.positive ? "text-success" : "text-error"), children: [
923
- trend.positive ? /* @__PURE__ */ jsx(ArrowUpRight, { size: 14 }) : /* @__PURE__ */ jsx(ArrowDownRight, { size: 14 }),
924
- Math.abs(trend.value).toFixed(1),
925
- "%"
926
- ] })
1122
+ const topRow = showTopRow ? /* @__PURE__ */ jsxs("div", { className: "yunui-stat-toprow flex items-start justify-between mb-4", children: [
1123
+ Icon ? /* @__PURE__ */ jsx("div", { className: "yunui-stat-icon w-10 h-10 rounded-xl bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx(Icon, { size: 20, strokeWidth: 1.5, className: "text-muted-foreground" }) }) : /* @__PURE__ */ jsx("span", {}),
1124
+ trend && /* @__PURE__ */ jsxs(
1125
+ "div",
1126
+ {
1127
+ className: cn(
1128
+ "flex items-center gap-1 text-xs font-medium",
1129
+ trend.neutral ? "text-muted-foreground" : trend.positive ? "text-success" : "text-error"
1130
+ ),
1131
+ children: [
1132
+ (trend.direction ?? (trend.positive ? "up" : "down")) === "up" ? /* @__PURE__ */ jsx(ArrowUpRight, { size: 14 }) : /* @__PURE__ */ jsx(ArrowDownRight, { size: 14 }),
1133
+ trend.label ?? `${Math.abs(trend.value).toFixed(1)}%`
1134
+ ]
1135
+ }
1136
+ )
927
1137
  ] }) : null;
1138
+ const mutedInk = toneCfg ? "text-foreground/75" : "text-muted-foreground";
1139
+ const value = typeof rawValue === "string" || typeof rawValue === "number" ? /* @__PURE__ */ jsx(MotionNumber, { value: rawValue }) : rawValue;
928
1140
  if (inline) {
929
1141
  return /* @__PURE__ */ jsxs("div", { className: cn("card p-4", toneCfg?.card, className), children: [
930
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
1142
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 text-sm", mutedInk), children: [
931
1143
  Icon && /* @__PURE__ */ jsx(Icon, { size: 18 }),
932
1144
  /* @__PURE__ */ jsx("span", { children: label })
933
1145
  ] }),
934
- /* @__PURE__ */ jsx("div", { className: cn("text-2xl font-semibold mt-2", toneCfg?.value ?? "text-foreground"), children: value })
1146
+ /* @__PURE__ */ jsx("div", { className: cn("yunui-stat-value text-2xl font-semibold mt-2", toneCfg?.value ?? "text-foreground"), children: value })
935
1147
  ] });
936
1148
  }
937
1149
  if (valueFirst) {
@@ -942,9 +1154,9 @@ function StatCard({ icon: Icon, label, value, subtext, trend, tone, delay = 0, i
942
1154
  style: delay ? { animationDelay: `${delay}ms` } : void 0,
943
1155
  children: [
944
1156
  topRow,
945
- /* @__PURE__ */ jsx("div", { className: cn("text-2xl font-semibold mb-1", toneCfg?.value), children: value }),
946
- /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: label }),
947
- subtext && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground/60 mt-1", children: subtext })
1157
+ /* @__PURE__ */ jsx("div", { className: cn("yunui-stat-value text-2xl font-semibold mb-1", toneCfg?.value), children: value }),
1158
+ /* @__PURE__ */ jsx("div", { className: cn("text-sm", mutedInk), children: label }),
1159
+ subtext && /* @__PURE__ */ jsx("div", { title: typeof subtext === "string" ? subtext : void 0, className: cn("yunui-stat-sub text-xs mt-1", toneCfg ? "text-foreground/75" : "text-muted-foreground"), children: subtext })
948
1160
  ]
949
1161
  }
950
1162
  );
@@ -957,8 +1169,8 @@ function StatCard({ icon: Icon, label, value, subtext, trend, tone, delay = 0, i
957
1169
  children: [
958
1170
  topRow,
959
1171
  /* @__PURE__ */ jsx("div", { className: "text-label mb-1", children: label }),
960
- /* @__PURE__ */ jsx("div", { className: cn("text-2xl font-semibold tracking-tight", toneCfg?.value), children: value }),
961
- subtext && /* @__PURE__ */ jsx("div", { className: "text-caption mt-1", children: subtext })
1172
+ /* @__PURE__ */ jsx("div", { className: cn("yunui-stat-value text-2xl font-semibold tracking-tight", toneCfg?.value), children: value }),
1173
+ subtext && /* @__PURE__ */ jsx("div", { title: typeof subtext === "string" ? subtext : void 0, className: "yunui-stat-sub text-caption mt-1", children: subtext })
962
1174
  ]
963
1175
  }
964
1176
  );
@@ -976,14 +1188,14 @@ function FellowsBanner({
976
1188
  Link,
977
1189
  {
978
1190
  href,
979
- className: `card p-5 flex flex-col gap-4 sm:flex-row sm:items-center border-2 border-primary/20 bg-linear-to-r from-primary/5 to-transparent hover:border-primary/40 transition-all group outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ${className}`,
1191
+ className: `card p-5 flex flex-col gap-4 sm:flex-row sm:items-center border-2 border-primary/20 bg-linear-to-r from-primary/5 to-transparent hover:border-primary/40 transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard) group outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ${className}`,
980
1192
  children: [
981
1193
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
982
1194
  /* @__PURE__ */ jsx("div", { className: "p-3 bg-primary/10 rounded-xl shrink-0", children: /* @__PURE__ */ jsx(GraduationCap, { className: "w-6 h-6 text-primary" }) }),
983
1195
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
984
1196
  /* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm", children: title }),
985
1197
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }),
986
- features.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/70 mt-1", children: features.join(" \xB7 ") })
1198
+ features.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: features.join(" \xB7 ") })
987
1199
  ] })
988
1200
  ] }),
989
1201
  /* @__PURE__ */ jsxs("span", { className: "shrink-0 w-full sm:w-auto inline-flex items-center justify-center gap-1.5 px-4 py-2.5 rounded-xl bg-primary/10 text-primary text-sm font-medium group-hover:bg-primary/15 transition-colors", children: [
@@ -1127,31 +1339,35 @@ function MediaErrorState({ message, onRetry }) {
1127
1339
  function FellowBadge({ variant = "inline", className = "" }) {
1128
1340
  const t = useYunUI().useT("components.badges");
1129
1341
  if (variant === "pill") {
1130
- return /* @__PURE__ */ jsxs("span", { className: `badge inline-flex items-center gap-1 text-xs bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20 ${className}`, children: [
1131
- /* @__PURE__ */ jsx(Award, { size: 11, className: "text-amber-500" }),
1342
+ return /* @__PURE__ */ jsxs("span", { className: `badge inline-flex items-center gap-1 text-xs bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/20 ${className}`, children: [
1343
+ /* @__PURE__ */ jsx(Award, { size: 11, className: "text-amber-600" }),
1132
1344
  t("fellow")
1133
1345
  ] });
1134
1346
  }
1135
- return /* @__PURE__ */ jsxs("span", { className: `inline-flex items-center gap-1 text-xs font-medium text-amber-600 dark:text-amber-400 ${className}`, children: [
1136
- /* @__PURE__ */ jsx(Award, { size: 10, className: "text-amber-500" }),
1347
+ return /* @__PURE__ */ jsxs("span", { className: `inline-flex items-center gap-1 text-xs font-medium text-amber-700 dark:text-amber-400 ${className}`, children: [
1348
+ /* @__PURE__ */ jsx(Award, { size: 10, className: "text-amber-600" }),
1137
1349
  t("fellow")
1138
1350
  ] });
1139
1351
  }
1140
1352
  function CapabilityBadge({ capability, short = false }) {
1141
1353
  const t = useYunUI().useT("components.badges");
1142
1354
  const configs = {
1143
- chat: { icon: MessageSquare, iconColor: "text-blue-500", color: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20", labelKey: "chat" },
1144
- streaming: { icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/20", labelKey: "streaming" },
1145
- function_calling: { icon: Code, iconColor: "text-purple-500", color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20", labelKey: "functionCalling" },
1146
- vision: { icon: Eye, iconColor: "text-amber-500", color: "bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20", labelKey: "vision" },
1147
- thinking: { icon: Brain, iconColor: "text-pink-500", color: "bg-pink-500/10 text-pink-600 dark:text-pink-400 border-pink-500/20", labelKey: "thinking" },
1148
- image_edit: { icon: Image, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20", labelKey: "imageEdit" },
1149
- negative_prompt: { icon: Ban, iconColor: "text-red-500", color: "bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20", labelKey: "negativePrompt" },
1150
- seed_control: { icon: Fingerprint, iconColor: "text-indigo-500", color: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20", labelKey: "seedControl" },
1151
- lora: { icon: Layers, iconColor: "text-teal-500", color: "bg-teal-500/10 text-teal-600 dark:text-teal-400 border-teal-500/20", labelKey: "loraSupport" },
1152
- guidance_scale: { icon: SlidersHorizontal, iconColor: "text-yellow-500", color: "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 border-yellow-500/20", labelKey: "guidanceScale" },
1153
- strength: { icon: SlidersHorizontal, iconColor: "text-orange-500", color: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20", labelKey: "strength" },
1154
- batch: { icon: Waves, iconColor: "text-cyan-500", color: "bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border-cyan-500/20", labelKey: "batchGeneration" }
1355
+ chat: { icon: MessageSquare, iconColor: capabilityIconColor("chat"), color: capabilityBadgeColor("chat"), labelKey: "chat" },
1356
+ streaming: { icon: Waves, iconColor: capabilityIconColor("streaming"), color: capabilityBadgeColor("streaming"), labelKey: "streaming" },
1357
+ function_calling: { icon: Code, iconColor: capabilityIconColor("function_calling"), color: capabilityBadgeColor("function_calling"), labelKey: "functionCalling" },
1358
+ vision: { icon: Eye, iconColor: capabilityIconColor("vision"), color: capabilityBadgeColor("vision"), labelKey: "vision" },
1359
+ thinking: { icon: Brain, iconColor: capabilityIconColor("thinking"), color: capabilityBadgeColor("thinking"), labelKey: "thinking" },
1360
+ image_edit: { icon: Image, iconColor: capabilityIconColor("image_edit"), color: capabilityBadgeColor("image_edit"), labelKey: "imageEdit" },
1361
+ // Whether the model CAN reuse a cached prompt — a separate question from what caching
1362
+ // costs. An unquoted or zero cache price says nothing about the capability.
1363
+ prompt_caching: { icon: DatabaseZap, iconColor: capabilityIconColor("prompt_caching"), color: capabilityBadgeColor("prompt_caching"), labelKey: "promptCaching" },
1364
+ context_caching: { icon: DatabaseZap, iconColor: capabilityIconColor("context_caching"), color: capabilityBadgeColor("context_caching"), labelKey: "contextCaching" },
1365
+ negative_prompt: { icon: Ban, iconColor: capabilityIconColor("negative_prompt"), color: capabilityBadgeColor("negative_prompt"), labelKey: "negativePrompt" },
1366
+ seed_control: { icon: Fingerprint, iconColor: capabilityIconColor("seed_control"), color: capabilityBadgeColor("seed_control"), labelKey: "seedControl" },
1367
+ lora: { icon: Layers, iconColor: capabilityIconColor("lora"), color: capabilityBadgeColor("lora"), labelKey: "loraSupport" },
1368
+ guidance_scale: { icon: SlidersHorizontal, iconColor: capabilityIconColor("guidance_scale"), color: capabilityBadgeColor("guidance_scale"), labelKey: "guidanceScale" },
1369
+ strength: { icon: SlidersHorizontal, iconColor: capabilityIconColor("strength"), color: capabilityBadgeColor("strength"), labelKey: "strength" },
1370
+ batch: { icon: Waves, iconColor: capabilityIconColor("batch"), color: capabilityBadgeColor("batch"), labelKey: "batchGeneration" }
1155
1371
  };
1156
1372
  const config = configs[capability];
1157
1373
  if (!config) return null;
@@ -1180,8 +1396,8 @@ function StatusBadge({ status, size = "sm" }) {
1180
1396
  function SourceBadge({ source, showIcon = true }) {
1181
1397
  const t = useYunUI().useT("common.badge");
1182
1398
  const configs = {
1183
- yaml: { icon: FileCode, color: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20", label: t("yaml") },
1184
- api: { icon: FileText, color: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20", label: t("api") }
1399
+ yaml: { icon: FileCode, color: "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20", label: t("yaml") },
1400
+ api: { icon: FileText, color: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20", label: t("api") }
1185
1401
  };
1186
1402
  const config = configs[source.toLowerCase()];
1187
1403
  if (!config) return null;
@@ -1208,7 +1424,7 @@ function FeatureLockedState({ icon, title, description, noteTitle, noteText, cla
1208
1424
  /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-4", children: icon ?? /* @__PURE__ */ jsx(Sparkles, { className: "w-8 h-8 text-muted-foreground" }) }),
1209
1425
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2", children: title }),
1210
1426
  description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-6", children: description }),
1211
- (noteTitle || noteText) && /* @__PURE__ */ jsx("div", { className: "card p-4 bg-muted/30 border border-dashed", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 text-sm text-muted-foreground", children: [
1427
+ (noteTitle || noteText) && /* @__PURE__ */ jsx("div", { className: "card p-4 bg-muted/30 border border-dashed border-border", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 text-sm text-muted-foreground", children: [
1212
1428
  /* @__PURE__ */ jsx(AlertCircle, { className: "w-5 h-5 shrink-0 mt-0.5" }),
1213
1429
  /* @__PURE__ */ jsxs("div", { className: "text-left", children: [
1214
1430
  noteTitle && /* @__PURE__ */ jsx("p", { className: "font-medium mb-1", children: noteTitle }),
@@ -1224,14 +1440,15 @@ function SessionItem({
1224
1440
  ip,
1225
1441
  time,
1226
1442
  current,
1227
- currentLabel,
1228
1443
  inactive,
1229
- inactiveLabel,
1230
1444
  selected,
1231
1445
  running,
1232
- runningLabel,
1233
1446
  onRevoke,
1234
1447
  revoking,
1448
+ labels,
1449
+ currentLabel,
1450
+ inactiveLabel,
1451
+ runningLabel,
1235
1452
  revokeLabel,
1236
1453
  className
1237
1454
  }) {
@@ -1256,13 +1473,13 @@ function SessionItem({
1256
1473
  "data-session-activity-rail": true
1257
1474
  }
1258
1475
  ),
1259
- running && runningLabel != null && /* @__PURE__ */ jsx("span", { className: "sr-only", children: runningLabel }),
1476
+ running && (labels?.running ?? runningLabel) != null && /* @__PURE__ */ jsx("span", { className: "sr-only", children: labels?.running ?? runningLabel }),
1260
1477
  icon != null && /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg bg-muted flex items-center justify-center shrink-0", children: icon }),
1261
1478
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1262
1479
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1263
1480
  /* @__PURE__ */ jsx("span", { className: "block min-w-0 flex-1 truncate text-xs font-medium", children: name }),
1264
- current && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-success shrink-0", children: currentLabel }),
1265
- inactive && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-neutral shrink-0", children: inactiveLabel })
1481
+ current && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-success shrink-0", children: labels?.current ?? currentLabel }),
1482
+ inactive && /* @__PURE__ */ jsx("span", { className: "text-[10px] px-1.5 py-0.5 rounded-full badge-neutral shrink-0", children: labels?.inactive ?? inactiveLabel })
1266
1483
  ] }),
1267
1484
  detail && /* @__PURE__ */ jsx("div", { className: "text-[10px] text-(--text-tertiary) mt-0.5 truncate", children: detail }),
1268
1485
  (ip != null || time != null) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2 mt-1 text-[10px] text-(--text-tertiary)", children: [
@@ -1282,8 +1499,8 @@ function SessionItem({
1282
1499
  type: "button",
1283
1500
  onClick: onRevoke,
1284
1501
  disabled: revoking,
1285
- "aria-label": revokeLabel,
1286
- title: revokeLabel,
1502
+ "aria-label": labels?.revoke ?? revokeLabel,
1503
+ title: labels?.revoke ?? revokeLabel,
1287
1504
  className: "p-1.5 hover:bg-error-soft rounded text-(--text-tertiary) hover:text-error transition-colors shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring",
1288
1505
  children: revoking ? /* @__PURE__ */ jsx(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx(LogOut, { size: 12 })
1289
1506
  }
@@ -1304,10 +1521,11 @@ function MetricBar({ icon, label, value, percentage, color, className }) {
1304
1521
  "div",
1305
1522
  {
1306
1523
  role: "progressbar",
1524
+ "aria-label": typeof label === "string" ? label : void 0,
1307
1525
  "aria-valuenow": Math.max(0, Math.min(100, percentage)),
1308
1526
  "aria-valuemin": 0,
1309
1527
  "aria-valuemax": 100,
1310
- className: "h-full rounded-full transition-all duration-300",
1528
+ className: "yunui-bar-fill h-full rounded-full transition-[width] duration-(--dur-slow) ease-(--ease-standard)",
1311
1529
  style: { width: `${Math.max(0, Math.min(100, percentage))}%`, backgroundColor: color }
1312
1530
  }
1313
1531
  ) })
@@ -1451,7 +1669,7 @@ function MediaBody({
1451
1669
  item.progress !== void 0 && item.progress > 0 && /* @__PURE__ */ jsx("div", { className: "mt-1 h-1.5 w-24 overflow-hidden rounded-full bg-muted-foreground/20", children: /* @__PURE__ */ jsx(
1452
1670
  "div",
1453
1671
  {
1454
- className: "h-full bg-primary transition-all duration-300",
1672
+ className: "h-full bg-primary transition-[width] duration-(--dur-slow) ease-(--ease-standard)",
1455
1673
  style: { width: `${Math.min(item.progress, 95)}%` }
1456
1674
  }
1457
1675
  ) })
@@ -1461,7 +1679,7 @@ function MediaBody({
1461
1679
  return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center gap-1 bg-muted px-3 text-center", children: [
1462
1680
  /* @__PURE__ */ jsx(AlertCircle, { size: 22, className: "text-error" }),
1463
1681
  /* @__PURE__ */ jsx("span", { className: "text-xs text-error", children: status === "failed" ? labels.failed : labels.expired }),
1464
- item.error && /* @__PURE__ */ jsx("span", { className: "mt-0.5 max-w-[85%] truncate text-xs text-error/70", children: item.error })
1682
+ item.error && /* @__PURE__ */ jsx("span", { className: "mt-0.5 max-w-[85%] truncate text-xs text-error", children: item.error })
1465
1683
  ] });
1466
1684
  }
1467
1685
  if (kind === "audio") {
@@ -1526,7 +1744,7 @@ function MediaCard({
1526
1744
  ] })
1527
1745
  ] });
1528
1746
  const overlayBtn = "flex h-9 w-9 items-center justify-center rounded-full bg-card text-foreground shadow-md ring-1 ring-border backdrop-blur transition hover:scale-105 disabled:pointer-events-none disabled:opacity-40";
1529
- const actions = (onDownload || onDelete) && (view === "grid" ? /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center gap-2.5 bg-foreground/0 opacity-0 transition-all group-hover:bg-foreground/30 group-hover:opacity-100", children: [
1747
+ const actions = (onDownload || onDelete) && (view === "grid" ? /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center gap-2.5 bg-foreground/0 opacity-0 transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard) group-hover:bg-foreground/30 group-hover:opacity-100", children: [
1530
1748
  onDownload && /* @__PURE__ */ jsx(
1531
1749
  "button",
1532
1750
  {
@@ -1750,36 +1968,40 @@ function MediaGallery({
1750
1968
  ] });
1751
1969
  }
1752
1970
  var TONES2 = {
1971
+ // Token-driven, matching Alert/Badge: the raw `blue/amber/red/green-500`
1972
+ // palette these used to carry is not the same colour as `--info`/`--warning`/
1973
+ // `--error`/`--success`, so a Banner and an Alert reading the same severity
1974
+ // rendered as two different hues and neither followed a brand theme.
1753
1975
  info: {
1754
- bg: "bg-linear-to-r from-blue-500/10 via-blue-500/5 to-blue-500/10",
1755
- border: "border-blue-500/25",
1756
- text: "text-blue-700 dark:text-blue-300",
1757
- icon: "text-blue-500",
1758
- dismissHover: "hover:bg-blue-500/10",
1976
+ bg: "bg-info-soft",
1977
+ border: "border-info-soft",
1978
+ text: "text-info",
1979
+ icon: "text-info",
1980
+ dismissHover: "hover:bg-info-soft",
1759
1981
  defaultIcon: /* @__PURE__ */ jsx(Info, { size: 16 })
1760
1982
  },
1761
1983
  warning: {
1762
- bg: "bg-linear-to-r from-amber-500/10 via-amber-500/5 to-amber-500/10",
1763
- border: "border-amber-500/25",
1764
- text: "text-amber-700 dark:text-amber-300",
1765
- icon: "text-amber-500",
1766
- dismissHover: "hover:bg-amber-500/10",
1984
+ bg: "bg-warning-soft",
1985
+ border: "border-warning-soft",
1986
+ text: "text-warning",
1987
+ icon: "text-warning",
1988
+ dismissHover: "hover:bg-warning-soft",
1767
1989
  defaultIcon: /* @__PURE__ */ jsx(AlertTriangle, { size: 16 })
1768
1990
  },
1769
1991
  critical: {
1770
- bg: "bg-linear-to-r from-red-500/10 via-red-500/5 to-red-500/10",
1771
- border: "border-red-500/25",
1772
- text: "text-red-700 dark:text-red-300",
1773
- icon: "text-red-500",
1774
- dismissHover: "hover:bg-red-500/10",
1992
+ bg: "bg-error-soft",
1993
+ border: "border-error-soft",
1994
+ text: "text-error",
1995
+ icon: "text-error",
1996
+ dismissHover: "hover:bg-error-soft",
1775
1997
  defaultIcon: /* @__PURE__ */ jsx(AlertCircle, { size: 16 })
1776
1998
  },
1777
1999
  success: {
1778
- bg: "bg-linear-to-r from-green-500/10 via-green-500/5 to-green-500/10",
1779
- border: "border-green-500/25",
1780
- text: "text-green-700 dark:text-green-300",
1781
- icon: "text-green-500",
1782
- dismissHover: "hover:bg-green-500/10",
2000
+ bg: "bg-success-soft",
2001
+ border: "border-success-soft",
2002
+ text: "text-success",
2003
+ icon: "text-success",
2004
+ dismissHover: "hover:bg-success-soft",
1783
2005
  defaultIcon: /* @__PURE__ */ jsx(CheckCircle2, { size: 16 })
1784
2006
  },
1785
2007
  neutral: {
@@ -1805,14 +2027,14 @@ function Banner({
1805
2027
  }) {
1806
2028
  const t = TONES2[tone];
1807
2029
  const resolvedIcon = icon === void 0 ? t.defaultIcon : icon;
1808
- return /* @__PURE__ */ jsx("div", { className: cn("card", t.bg, t.border, className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-2.5", children: [
2030
+ return /* @__PURE__ */ jsx("div", { className: cn("card", t.bg, t.border, className), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2.5", children: [
1809
2031
  resolvedIcon != null && /* @__PURE__ */ jsx("span", { className: cn("shrink-0", t.icon), "aria-hidden": "true", children: resolvedIcon }),
1810
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
2032
+ /* @__PURE__ */ jsxs("div", { className: "min-w-[10rem] flex-1", children: [
1811
2033
  /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", t.text), children: title }),
1812
2034
  description && /* @__PURE__ */ jsx("span", { className: cn("text-sm ml-2 hidden sm:inline opacity-70", t.text), children: description })
1813
2035
  ] }),
1814
- meta != null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/70 shrink-0", children: meta }),
1815
- actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: actions }),
2036
+ meta != null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground shrink-0", children: meta }),
2037
+ actions && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 max-sm:w-full sm:shrink-0", children: actions }),
1816
2038
  dismissible && /* @__PURE__ */ jsx(
1817
2039
  "button",
1818
2040
  {
@@ -1862,9 +2084,9 @@ function NotificationItem({
1862
2084
  icon != null && /* @__PURE__ */ jsx("div", { className: cn("shrink-0 rounded-lg p-1.5", iconClassName ?? "bg-muted"), children: icon }),
1863
2085
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1864
2086
  /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-snug truncate", unread ? "font-medium" : "text-muted-foreground"), children: title }),
1865
- body && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60 mt-0.5 line-clamp-1", children: body })
2087
+ body && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-1", children: body })
1866
2088
  ] }),
1867
- time != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 self-center text-[10px] text-muted-foreground/50", children: time })
2089
+ time != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 self-center text-[10px] text-muted-foreground", children: time })
1868
2090
  ] });
1869
2091
  const rowClass = cn("flex items-center gap-2.5 px-3 py-2.5", dismissible ? "pr-9" : "pr-3");
1870
2092
  return /* @__PURE__ */ jsxs("div", { className: cn("group/notif relative rounded-xl hover:bg-foreground/5 transition-colors", className), children: [
@@ -1879,7 +2101,7 @@ function NotificationItem({
1879
2101
  e.preventDefault();
1880
2102
  onDismiss?.();
1881
2103
  },
1882
- className: "absolute right-1.5 top-1/2 -translate-y-1/2 p-1 rounded-lg opacity-0 group-hover/notif:opacity-100 group-focus-within/notif:opacity-100 hover:bg-muted transition-all outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring",
2104
+ className: "absolute right-1.5 top-1/2 -translate-y-1/2 p-1 rounded-lg opacity-0 group-hover/notif:opacity-100 group-focus-within/notif:opacity-100 hover:bg-muted transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard) outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring",
1883
2105
  children: /* @__PURE__ */ jsx(Trash2, { size: 12, className: "text-muted-foreground/40 hover:text-error" })
1884
2106
  }
1885
2107
  )
@@ -1888,10 +2110,11 @@ function NotificationItem({
1888
2110
  function NotificationPanel({
1889
2111
  title,
1890
2112
  unreadCount = 0,
1891
- unreadLabel,
1892
2113
  loading,
1893
- loadingLabel,
1894
2114
  empty,
2115
+ labels,
2116
+ unreadLabel,
2117
+ loadingLabel,
1895
2118
  emptyLabel,
1896
2119
  footer,
1897
2120
  children,
@@ -1901,7 +2124,7 @@ function NotificationPanel({
1901
2124
  "div",
1902
2125
  {
1903
2126
  className: cn(
1904
- "w-80 sm:w-[400px] rounded-2xl border border-border bg-popover/85 backdrop-blur-2xl shadow-lg shadow-black/5",
2127
+ "w-80 sm:w-[400px] rounded-2xl border border-border bg-popover shadow-lg shadow-black/5",
1905
2128
  className
1906
2129
  ),
1907
2130
  children: [
@@ -1909,29 +2132,41 @@ function NotificationPanel({
1909
2132
  /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
1910
2133
  unreadCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-medium text-primary", children: [
1911
2134
  unreadCount,
1912
- unreadLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
2135
+ labels?.unread ?? unreadLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
1913
2136
  " ",
1914
- unreadLabel
2137
+ labels?.unread ?? unreadLabel
1915
2138
  ] }) : null
1916
2139
  ] })
1917
2140
  ] }),
1918
- /* @__PURE__ */ jsx("div", { className: "max-h-[400px] overflow-y-auto px-2 pb-2 flex flex-col gap-1", children: loading ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: loadingLabel }) : empty ? /* @__PURE__ */ jsxs("div", { className: "p-6 text-center", children: [
2141
+ /* @__PURE__ */ jsx("div", { className: "max-h-[400px] overflow-y-auto px-2 pb-2 flex flex-col gap-1", children: loading ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: labels?.loading ?? loadingLabel }) : empty ? /* @__PURE__ */ jsxs("div", { className: "p-6 text-center", children: [
1919
2142
  /* @__PURE__ */ jsx(Bell, { size: 24, className: "mx-auto mb-2 text-muted-foreground/40" }),
1920
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: emptyLabel })
2143
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: labels?.empty ?? emptyLabel })
1921
2144
  ] }) : children }),
1922
2145
  footer && /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-muted-foreground hover:text-foreground transition-colors [&>a]:block [&>a]:py-2.5", children: footer })
1923
2146
  ]
1924
2147
  }
1925
2148
  );
1926
2149
  }
1927
- function SettingRow({ title, description, control, className }) {
1928
- return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4 py-3 border-b border-border last:border-0", className), children: [
1929
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1930
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
1931
- description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) mt-0.5 leading-relaxed whitespace-normal wrap-break-word", children: description })
1932
- ] }),
1933
- control != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: control })
1934
- ] });
2150
+ function SettingRow({ title, description, control, stack = true, divider = true, className }) {
2151
+ return /* @__PURE__ */ jsxs(
2152
+ "div",
2153
+ {
2154
+ "data-stack": stack ? "sm" : "never",
2155
+ className: cn(
2156
+ "flex gap-4",
2157
+ divider ? "py-3 border-b border-border last:border-0" : "py-3.5",
2158
+ stack ? "flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4" : "items-center justify-between",
2159
+ className
2160
+ ),
2161
+ children: [
2162
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2163
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
2164
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) mt-0.5 leading-relaxed whitespace-normal wrap-break-word", children: description })
2165
+ ] }),
2166
+ control != null && /* @__PURE__ */ jsx("div", { className: cn(stack ? "min-w-0 sm:shrink-0" : "shrink-0"), children: control })
2167
+ ]
2168
+ }
2169
+ );
1935
2170
  }
1936
2171
  function SettingsShell({
1937
2172
  header,
@@ -2121,14 +2356,1507 @@ function AvatarUploader({
2121
2356
  ),
2122
2357
  src ? (
2123
2358
  // eslint-disable-next-line @next/next/no-img-element
2124
- /* @__PURE__ */ jsx("img", { src, alt: "", className: "w-full h-full rounded-full object-cover ring-2 ring-border group-hover:ring-primary transition-all" })
2125
- ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full bg-linear-to-br from-primary to-primary/60 flex items-center justify-center text-primary-foreground font-semibold ring-2 ring-border group-hover:ring-primary transition-all", style: { fontSize: size * 0.36 }, children: fallback }),
2359
+ /* @__PURE__ */ jsx("img", { src, alt: "", className: "w-full h-full rounded-full object-cover ring-2 ring-border group-hover:ring-primary transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard)" })
2360
+ ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full bg-linear-to-br from-primary to-primary/60 flex items-center justify-center text-primary-foreground font-semibold ring-2 ring-border group-hover:ring-primary transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard)", style: { fontSize: size * 0.36 }, children: fallback }),
2126
2361
  /* @__PURE__ */ jsx("div", { className: "absolute inset-0 rounded-full bg-black/50 sm:opacity-0 sm:group-hover:opacity-100 group-focus-visible:opacity-100 transition-opacity flex items-center justify-center", children: uploading ? /* @__PURE__ */ jsx(Loader2, { size: Math.round(size / 3), className: "text-pure-white animate-spin" }) : /* @__PURE__ */ jsx(Camera, { size: Math.round(size / 3), className: "text-pure-white" }) })
2127
2362
  ]
2128
2363
  }
2129
2364
  );
2130
2365
  }
2366
+ function Eyebrow({ icon, children, className, ...props }) {
2367
+ return /* @__PURE__ */ jsxs(
2368
+ "div",
2369
+ {
2370
+ className: cn(
2371
+ "inline-flex items-center gap-2 rounded-full border border-(--accent-muted) bg-(--accent-subtle) px-3 py-1",
2372
+ className
2373
+ ),
2374
+ ...props,
2375
+ children: [
2376
+ icon,
2377
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children })
2378
+ ]
2379
+ }
2380
+ );
2381
+ }
2382
+ function SectionHeading({
2383
+ badge,
2384
+ icon,
2385
+ title,
2386
+ subtitle,
2387
+ align = "center",
2388
+ animate = true,
2389
+ className,
2390
+ ...props
2391
+ }) {
2392
+ const enter = animate ? "animate-enter" : void 0;
2393
+ return /* @__PURE__ */ jsxs(
2394
+ "div",
2395
+ {
2396
+ className: cn("mb-16", align === "center" ? "text-center" : "text-left", className),
2397
+ ...props,
2398
+ children: [
2399
+ badge != null && /* @__PURE__ */ jsx(Eyebrow, { icon, className: cn("mb-4", enter), children: badge }),
2400
+ /* @__PURE__ */ jsx(
2401
+ "h2",
2402
+ {
2403
+ className: cn("heading-xl mb-4 text-balance", enter),
2404
+ style: animate ? { animationDelay: "100ms" } : void 0,
2405
+ children: title
2406
+ }
2407
+ ),
2408
+ subtitle != null && /* @__PURE__ */ jsx(
2409
+ "p",
2410
+ {
2411
+ className: cn(
2412
+ "text-body text-lg text-pretty",
2413
+ align === "center" && "mx-auto max-w-2xl",
2414
+ enter
2415
+ ),
2416
+ style: animate ? { animationDelay: "200ms" } : void 0,
2417
+ children: subtitle
2418
+ }
2419
+ )
2420
+ ]
2421
+ }
2422
+ );
2423
+ }
2424
+ function FeatureCard({
2425
+ icon,
2426
+ title,
2427
+ description,
2428
+ delay,
2429
+ children,
2430
+ className,
2431
+ style,
2432
+ ...props
2433
+ }) {
2434
+ return /* @__PURE__ */ jsxs(
2435
+ "div",
2436
+ {
2437
+ className: cn(
2438
+ "group relative h-full overflow-hidden rounded-2xl border border-border bg-card/50 p-8 shadow-sm backdrop-blur-xl",
2439
+ "transition-[color,background-color,border-color,box-shadow,opacity,transform] duration-(--dur-fast) ease-(--ease-standard) hover:-translate-y-1 hover:shadow-xl",
2440
+ delay != null && "animate-enter",
2441
+ className
2442
+ ),
2443
+ style: delay != null ? { animationDelay: `${delay}ms`, ...style } : style,
2444
+ ...props,
2445
+ children: [
2446
+ /* @__PURE__ */ jsx(
2447
+ "div",
2448
+ {
2449
+ "aria-hidden": true,
2450
+ className: "pointer-events-none absolute inset-x-0 top-0 h-px bg-linear-to-r from-transparent via-foreground/15 to-transparent"
2451
+ }
2452
+ ),
2453
+ /* @__PURE__ */ jsx(
2454
+ "div",
2455
+ {
2456
+ "aria-hidden": true,
2457
+ className: "pointer-events-none absolute -top-16 -right-16 h-40 w-40 rounded-full bg-foreground/5 blur-3xl opacity-0 transition-opacity duration-(--dur-slow) group-hover:opacity-100"
2458
+ }
2459
+ ),
2460
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2461
+ icon && /* @__PURE__ */ jsx("div", { className: "feature-icon mb-5 transition-transform duration-(--dur-base) group-hover:scale-105", children: icon }),
2462
+ /* @__PURE__ */ jsx("h3", { className: "heading-md mb-3", children: title }),
2463
+ description != null && /* @__PURE__ */ jsx("p", { className: "text-body leading-relaxed", children: description }),
2464
+ children
2465
+ ] })
2466
+ ]
2467
+ }
2468
+ );
2469
+ }
2470
+ function MembershipCard({
2471
+ brand,
2472
+ badge,
2473
+ watermark,
2474
+ label,
2475
+ status,
2476
+ stats = [],
2477
+ chip = true,
2478
+ className,
2479
+ ...props
2480
+ }) {
2481
+ return /* @__PURE__ */ jsxs(
2482
+ "div",
2483
+ {
2484
+ className: cn(
2485
+ "group relative w-full max-w-md mx-auto lg:mx-0 aspect-[1.586/1] min-h-56 rounded-[20px]",
2486
+ "bg-foreground/80 backdrop-blur-2xl border border-background/15 text-background",
2487
+ "shadow-2xl overflow-hidden select-none animate-enter",
2488
+ "transition-transform duration-(--dur-slow) hover:-translate-y-1",
2489
+ className
2490
+ ),
2491
+ ...props,
2492
+ children: [
2493
+ /* @__PURE__ */ jsx("div", { className: "absolute -top-1/3 -left-1/4 w-2/3 h-2/3 rounded-full bg-background/15 blur-3xl" }),
2494
+ /* @__PURE__ */ jsx("div", { className: "absolute -bottom-1/3 -right-1/4 w-1/2 h-2/3 rounded-full bg-background/8 blur-3xl" }),
2495
+ watermark != null && /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "absolute -right-8 -bottom-9 opacity-[0.06]", children: watermark }),
2496
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute top-0 -left-1/3 h-full w-1/3 -skew-x-12 bg-background/15 blur-xl translate-x-[-200%] group-hover:translate-x-[450%] transition-transform duration-[900ms] ease-out" }),
2497
+ /* @__PURE__ */ jsxs("div", { className: "relative h-full flex flex-col justify-between p-6 sm:p-7", children: [
2498
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2499
+ brand != null && /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold tracking-tight", children: brand }),
2500
+ badge != null && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-background/15 text-[11px] font-medium", children: [
2501
+ badge.icon,
2502
+ badge.label
2503
+ ] })
2504
+ ] }),
2505
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end justify-between gap-4", children: [
2506
+ /* @__PURE__ */ jsxs("div", { children: [
2507
+ label != null && /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-[0.22em] opacity-50 mb-1.5", children: label }),
2508
+ status != null && /* @__PURE__ */ jsx("div", { className: "text-lg font-medium leading-tight", children: status })
2509
+ ] }),
2510
+ chip && /* @__PURE__ */ jsx("div", { className: "hidden sm:block w-9 h-7 rounded-md bg-background/15 border border-background/10 shrink-0" })
2511
+ ] }),
2512
+ stats.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-end gap-6", children: stats.map((stat, i) => /* @__PURE__ */ jsxs("div", { children: [
2513
+ /* @__PURE__ */ jsx("div", { className: "text-base font-semibold tabular-nums leading-none", children: stat.value }),
2514
+ /* @__PURE__ */ jsx("div", { className: "text-[11px] opacity-50 mt-1", children: stat.label })
2515
+ ] }, i)) })
2516
+ ] })
2517
+ ]
2518
+ }
2519
+ );
2520
+ }
2521
+ function CTASection({
2522
+ title,
2523
+ body,
2524
+ actions,
2525
+ eyebrow,
2526
+ animate = true,
2527
+ className,
2528
+ ...props
2529
+ }) {
2530
+ const enter = animate ? "animate-enter" : void 0;
2531
+ return /* @__PURE__ */ jsxs(
2532
+ "div",
2533
+ {
2534
+ className: cn(
2535
+ // `isolate` is load-bearing: the radial wash below is `-z-10`, and `relative`
2536
+ // alone is NOT a stacking context — without this the wash escapes to the
2537
+ // root and disappears the moment a consumer nests this in an opaque box.
2538
+ "relative isolate overflow-hidden rounded-3xl border border-border p-12 text-center md:p-16",
2539
+ className
2540
+ ),
2541
+ ...props,
2542
+ children: [
2543
+ /* @__PURE__ */ jsx(
2544
+ "div",
2545
+ {
2546
+ "aria-hidden": true,
2547
+ className: "absolute inset-0 -z-10",
2548
+ style: {
2549
+ background: "radial-gradient(70% 120% at 50% 0%, var(--accent-subtle), transparent 70%)"
2550
+ }
2551
+ }
2552
+ ),
2553
+ eyebrow != null && /* @__PURE__ */ jsx("div", { className: cn("mb-4", enter), children: eyebrow }),
2554
+ /* @__PURE__ */ jsx("h2", { className: cn("heading-xl mb-4 text-balance", enter), children: title }),
2555
+ body != null && /* @__PURE__ */ jsx(
2556
+ "p",
2557
+ {
2558
+ className: cn("text-body mx-auto mb-8 max-w-xl text-lg text-pretty", enter),
2559
+ style: animate ? { animationDelay: "100ms" } : void 0,
2560
+ children: body
2561
+ }
2562
+ ),
2563
+ actions != null && /* @__PURE__ */ jsx(
2564
+ "div",
2565
+ {
2566
+ className: cn("flex flex-wrap items-center justify-center gap-3", enter),
2567
+ style: animate ? { animationDelay: "200ms" } : void 0,
2568
+ children: actions
2569
+ }
2570
+ )
2571
+ ]
2572
+ }
2573
+ );
2574
+ }
2575
+ function PullQuote({
2576
+ children,
2577
+ cite,
2578
+ showIcon = true,
2579
+ className,
2580
+ ...props
2581
+ }) {
2582
+ return /* @__PURE__ */ jsxs("figure", { className: cn("mx-auto max-w-4xl text-center", className), ...props, children: [
2583
+ showIcon && /* @__PURE__ */ jsx(Quote, { "aria-hidden": true, className: "mx-auto mb-6 h-8 w-8 text-muted-foreground/30" }),
2584
+ /* @__PURE__ */ jsx("blockquote", { className: "bg-linear-to-r from-foreground to-muted-foreground/70 bg-clip-text text-2xl leading-snug font-semibold tracking-tight text-balance text-transparent md:text-3xl", children }),
2585
+ cite != null && /* @__PURE__ */ jsx("figcaption", { className: "text-caption mt-6", children: cite })
2586
+ ] });
2587
+ }
2588
+ function MarketingHero({
2589
+ badge,
2590
+ title,
2591
+ subtitle,
2592
+ actions,
2593
+ facts,
2594
+ scrollToId,
2595
+ scrollLabel = "Scroll down",
2596
+ fullHeight = true,
2597
+ className,
2598
+ ...props
2599
+ }) {
2600
+ return /* @__PURE__ */ jsxs(
2601
+ "section",
2602
+ {
2603
+ className: cn(
2604
+ // `isolate` is load-bearing: the radial wash below is `-z-10`, and `relative`
2605
+ // alone is NOT a stacking context, so the wash would escape to the root
2606
+ // and vanish behind any opaque ancestor a consumer wraps this in.
2607
+ "relative isolate flex flex-col items-center justify-center px-6 pt-32 pb-28",
2608
+ fullHeight && "min-h-dvh",
2609
+ className
2610
+ ),
2611
+ ...props,
2612
+ children: [
2613
+ /* @__PURE__ */ jsx(
2614
+ "div",
2615
+ {
2616
+ "aria-hidden": true,
2617
+ className: "absolute inset-0 -z-10",
2618
+ style: {
2619
+ background: "radial-gradient(60% 50% at 50% 30%, var(--accent-subtle), transparent 70%)"
2620
+ }
2621
+ }
2622
+ ),
2623
+ /* @__PURE__ */ jsxs("div", { className: "relative z-10 mx-auto w-full max-w-6xl text-center", children: [
2624
+ badge != null && /* @__PURE__ */ jsx("div", { className: "mb-8 animate-enter", children: badge }),
2625
+ /* @__PURE__ */ jsx(
2626
+ "h1",
2627
+ {
2628
+ className: "mb-6 animate-enter text-4xl font-bold tracking-tight text-balance sm:text-5xl md:text-6xl lg:text-7xl",
2629
+ style: { animationDelay: "100ms" },
2630
+ children: title
2631
+ }
2632
+ ),
2633
+ subtitle != null && /* @__PURE__ */ jsx(
2634
+ "p",
2635
+ {
2636
+ className: "mx-auto mb-10 max-w-2xl animate-enter text-lg leading-relaxed text-pretty text-muted-foreground md:text-xl",
2637
+ style: { animationDelay: "300ms" },
2638
+ children: subtitle
2639
+ }
2640
+ ),
2641
+ actions != null && /* @__PURE__ */ jsx(
2642
+ "div",
2643
+ {
2644
+ className: "flex animate-enter flex-col items-center justify-center gap-4 sm:flex-row",
2645
+ style: { animationDelay: "400ms" },
2646
+ children: actions
2647
+ }
2648
+ ),
2649
+ facts && facts.length > 0 && /* @__PURE__ */ jsx(
2650
+ "div",
2651
+ {
2652
+ className: "mt-8 flex animate-enter flex-wrap items-center justify-center gap-2",
2653
+ style: { animationDelay: "500ms" },
2654
+ children: facts.map((fact, i) => /* @__PURE__ */ jsx(
2655
+ "span",
2656
+ {
2657
+ className: "rounded-full border border-border bg-card/60 px-3 py-1 text-xs text-muted-foreground backdrop-blur-sm",
2658
+ children: fact
2659
+ },
2660
+ i
2661
+ ))
2662
+ }
2663
+ )
2664
+ ] }),
2665
+ scrollToId && /* @__PURE__ */ jsx(
2666
+ "a",
2667
+ {
2668
+ href: `#${scrollToId}`,
2669
+ "aria-label": scrollLabel,
2670
+ className: "absolute bottom-8 left-1/2 z-10 -translate-x-1/2 animate-bounce text-muted-foreground/60 transition-colors hover:text-foreground",
2671
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-5 w-5" })
2672
+ }
2673
+ )
2674
+ ]
2675
+ }
2676
+ );
2677
+ }
2678
+ function HeroAccent({ children }) {
2679
+ return /* @__PURE__ */ jsx("span", { className: "bg-linear-to-r from-foreground via-foreground to-muted-foreground/70 bg-clip-text text-transparent", children });
2680
+ }
2681
+ function ProseArticle({ children, prose = true, className, ...props }) {
2682
+ return /* @__PURE__ */ jsx("article", { className: cn("mx-auto max-w-3xl px-6 py-16", className), ...props, children: prose ? /* @__PURE__ */ jsx("div", { className: "prose prose-neutral dark:prose-invert max-w-none", children }) : children });
2683
+ }
2684
+ function BackLink({ href, children, className }) {
2685
+ const { Link } = useYunUI();
2686
+ return /* @__PURE__ */ jsxs(
2687
+ Link,
2688
+ {
2689
+ href,
2690
+ className: cn(
2691
+ "mb-8 inline-flex items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground",
2692
+ className
2693
+ ),
2694
+ children: [
2695
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16, "aria-hidden": true }),
2696
+ children
2697
+ ]
2698
+ }
2699
+ );
2700
+ }
2701
+ function AuthShell({
2702
+ brand,
2703
+ homeHref,
2704
+ title,
2705
+ subtitle,
2706
+ error,
2707
+ icon,
2708
+ children,
2709
+ footer,
2710
+ centered = false,
2711
+ width = "sm",
2712
+ className,
2713
+ cardClassName,
2714
+ ...props
2715
+ }) {
2716
+ const { Link } = useYunUI();
2717
+ const brandRowClass = "flex items-center justify-center gap-2.5 mb-8";
2718
+ return /* @__PURE__ */ jsx(
2719
+ "div",
2720
+ {
2721
+ className: cn(
2722
+ "min-h-dvh bg-background flex items-center justify-center px-6",
2723
+ className
2724
+ ),
2725
+ ...props,
2726
+ children: /* @__PURE__ */ jsxs("div", { className: cn("w-full", width === "sm" ? "max-w-sm" : "max-w-md"), children: [
2727
+ brand != null && (homeHref ? /* @__PURE__ */ jsx(Link, { href: homeHref, className: brandRowClass, children: brand }) : /* @__PURE__ */ jsx("div", { className: brandRowClass, children: brand })),
2728
+ /* @__PURE__ */ jsxs(
2729
+ "div",
2730
+ {
2731
+ className: cn(
2732
+ "p-6 bg-card border border-border rounded-xl",
2733
+ centered && "text-center",
2734
+ cardClassName
2735
+ ),
2736
+ children: [
2737
+ icon != null && /* @__PURE__ */ jsx("div", { className: "flex justify-center mb-4", children: icon }),
2738
+ title != null && /* @__PURE__ */ jsx(
2739
+ "h1",
2740
+ {
2741
+ className: cn(
2742
+ "text-xl font-semibold text-center",
2743
+ subtitle != null ? "mb-2" : "mb-6"
2744
+ ),
2745
+ children: title
2746
+ }
2747
+ ),
2748
+ subtitle != null && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm text-center mb-6", children: subtitle }),
2749
+ error ? /* @__PURE__ */ jsx("div", { className: "mb-4 p-3 bg-error-soft text-error text-sm rounded-lg border border-error-soft", children: error }) : null,
2750
+ children
2751
+ ]
2752
+ }
2753
+ ),
2754
+ footer != null && /* @__PURE__ */ jsx("div", { className: "mt-6 text-center text-sm text-muted-foreground", children: footer })
2755
+ ] })
2756
+ }
2757
+ );
2758
+ }
2759
+ function TableState({
2760
+ children,
2761
+ loading = false,
2762
+ surface = "plain",
2763
+ className,
2764
+ ...props
2765
+ }) {
2766
+ return /* @__PURE__ */ jsxs(
2767
+ "div",
2768
+ {
2769
+ className: cn(
2770
+ "flex items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground",
2771
+ surface === "card" && "card",
2772
+ className
2773
+ ),
2774
+ ...props,
2775
+ children: [
2776
+ loading && /* @__PURE__ */ jsx(Loader2, { "aria-hidden": true, className: "h-4 w-4 animate-spin" }),
2777
+ children
2778
+ ]
2779
+ }
2780
+ );
2781
+ }
2782
+ function StatGrid({ children, columns = 4, className, ...props }) {
2783
+ return /* @__PURE__ */ jsx(
2784
+ "div",
2785
+ {
2786
+ className: cn(
2787
+ "grid grid-cols-2 gap-4",
2788
+ columns === 2 && "sm:grid-cols-2",
2789
+ columns === 3 && "sm:grid-cols-3",
2790
+ columns === 4 && "sm:grid-cols-4",
2791
+ className
2792
+ ),
2793
+ ...props,
2794
+ children
2795
+ }
2796
+ );
2797
+ }
2798
+ function DashboardPage({
2799
+ children,
2800
+ width = "7xl",
2801
+ className,
2802
+ ...props
2803
+ }) {
2804
+ return /* @__PURE__ */ jsx(
2805
+ "div",
2806
+ {
2807
+ className: cn(
2808
+ "mx-auto space-y-6",
2809
+ width === "5xl" && "max-w-5xl",
2810
+ width === "6xl" && "max-w-6xl",
2811
+ width === "7xl" && "max-w-7xl",
2812
+ className
2813
+ ),
2814
+ ...props,
2815
+ children
2816
+ }
2817
+ );
2818
+ }
2819
+ function SectionRow({ title, action, className, ...props }) {
2820
+ return /* @__PURE__ */ jsxs("div", { className: cn("mb-4 flex items-center justify-between gap-3", className), ...props, children: [
2821
+ /* @__PURE__ */ jsx("h2", { className: "yunui-section-title text-sm font-semibold text-foreground", children: title }),
2822
+ action
2823
+ ] });
2824
+ }
2825
+ function SectionNav({ items, offset = 112, label = "Sections", className }) {
2826
+ const [active, setActive] = useState(items[0]?.id ?? null);
2827
+ useEffect(() => {
2828
+ if (items.length === 0) return;
2829
+ const observer = new IntersectionObserver(
2830
+ (entries) => {
2831
+ const visible = entries.filter((e) => e.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
2832
+ if (visible[0]) setActive(visible[0].target.id);
2833
+ },
2834
+ {
2835
+ // Shrink the viewport to a band just under the header: without it a
2836
+ // section counts as visible while it is still behind the navbar.
2837
+ rootMargin: `-${offset}px 0px -55% 0px`,
2838
+ threshold: 0
2839
+ }
2840
+ );
2841
+ for (const item of items) {
2842
+ const el = document.getElementById(item.id);
2843
+ if (el) observer.observe(el);
2844
+ }
2845
+ return () => observer.disconnect();
2846
+ }, [items, offset]);
2847
+ if (items.length === 0) return null;
2848
+ return /* @__PURE__ */ jsx("nav", { "aria-label": label, className, children: /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: items.map((item) => {
2849
+ const isActive = item.id === active;
2850
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
2851
+ "a",
2852
+ {
2853
+ href: `#${item.id}`,
2854
+ "aria-current": isActive ? "true" : void 0,
2855
+ className: cn(
2856
+ "group flex items-center justify-between gap-2 rounded-lg px-3 py-1.5 text-sm transition-colors",
2857
+ isActive ? "bg-foreground/5 font-medium text-foreground" : "text-muted-foreground hover:bg-foreground/5 hover:text-foreground"
2858
+ ),
2859
+ children: [
2860
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.label }),
2861
+ item.count !== void 0 && /* @__PURE__ */ jsx(
2862
+ "span",
2863
+ {
2864
+ className: cn(
2865
+ "shrink-0 text-xs tabular-nums",
2866
+ isActive ? "text-foreground" : "text-muted-foreground"
2867
+ ),
2868
+ children: item.count
2869
+ }
2870
+ )
2871
+ ]
2872
+ }
2873
+ ) }, item.id);
2874
+ }) }) });
2875
+ }
2876
+ var DEFAULT_WEEKDAYS = ["S", "M", "T", "W", "T", "F", "S"];
2877
+ function parts(date) {
2878
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(date);
2879
+ return m ? { y: +m[1], m: +m[2], d: +m[3] } : null;
2880
+ }
2881
+ function pad(n) {
2882
+ return String(n).padStart(2, "0");
2883
+ }
2884
+ function monthShape(year, month) {
2885
+ return {
2886
+ days: new Date(Date.UTC(year, month, 0)).getUTCDate(),
2887
+ firstDay: new Date(Date.UTC(year, month - 1, 1)).getUTCDay()
2888
+ };
2889
+ }
2890
+ function ArchiveCalendar({
2891
+ dates,
2892
+ href,
2893
+ maxMonths = 24,
2894
+ weekdays = DEFAULT_WEEKDAYS,
2895
+ formatMonth = (year, month) => `${year}-${String(month).padStart(2, "0")}`,
2896
+ formatCount,
2897
+ formatDayLabel = (date) => date,
2898
+ className = ""
2899
+ }) {
2900
+ const { Link } = useYunUI();
2901
+ const have = new Set(dates);
2902
+ const sorted = [...dates].sort();
2903
+ const newest = parts(sorted.at(-1) ?? "");
2904
+ const oldest = parts(sorted[0] ?? "");
2905
+ if (!newest || !oldest) return null;
2906
+ const span = (newest.y - oldest.y) * 12 + (newest.m - oldest.m) + 1;
2907
+ const grid = [];
2908
+ for (let back = 0; back < Math.min(span, maxMonths); back++) {
2909
+ const month = newest.m - back;
2910
+ grid.push({
2911
+ year: newest.y + Math.floor((month - 1) / 12),
2912
+ month: ((month - 1) % 12 + 12) % 12 + 1
2913
+ });
2914
+ }
2915
+ return /* @__PURE__ */ jsx("div", { className: `grid gap-6 sm:grid-cols-2 lg:grid-cols-3 ${className}`, children: grid.map(({ year, month }) => {
2916
+ const { days, firstDay } = monthShape(year, month);
2917
+ const cells = [
2918
+ ...Array.from({ length: firstDay }, () => null),
2919
+ ...Array.from({ length: days }, (_, i) => i + 1)
2920
+ ];
2921
+ const filled = cells.filter(
2922
+ (day) => day && have.has(`${year}-${pad(month)}-${pad(day)}`)
2923
+ ).length;
2924
+ return /* @__PURE__ */ jsxs("div", { children: [
2925
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-baseline justify-between", children: [
2926
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold tracking-tight tabular-nums", children: formatMonth(year, month) }),
2927
+ formatCount && /* @__PURE__ */ jsx("span", { className: "text-caption tabular-nums", children: formatCount(filled) })
2928
+ ] }),
2929
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-7 gap-1", role: "presentation", children: [
2930
+ weekdays.map((label, i) => /* @__PURE__ */ jsx(
2931
+ "div",
2932
+ {
2933
+ "aria-hidden": true,
2934
+ className: "text-caption grid h-6 place-items-center text-[0.6875rem]",
2935
+ children: label
2936
+ },
2937
+ `${label}-${i}`
2938
+ )),
2939
+ cells.map((day, i) => {
2940
+ if (!day) return /* @__PURE__ */ jsx("div", { "aria-hidden": true }, `pad-${i}`);
2941
+ const date = `${year}-${pad(month)}-${pad(day)}`;
2942
+ if (!have.has(date)) {
2943
+ return /* @__PURE__ */ jsx(
2944
+ "div",
2945
+ {
2946
+ className: "text-muted-foreground grid h-8 place-items-center text-xs tabular-nums",
2947
+ children: day
2948
+ },
2949
+ date
2950
+ );
2951
+ }
2952
+ return /* @__PURE__ */ jsx(
2953
+ Link,
2954
+ {
2955
+ href: href(date),
2956
+ className: "border-border hover:border-(--accent) hover:text-(--accent) grid h-8 place-items-center rounded-md border text-xs font-medium tabular-nums transition-colors",
2957
+ "aria-label": formatDayLabel(date),
2958
+ children: day
2959
+ },
2960
+ date
2961
+ );
2962
+ })
2963
+ ] })
2964
+ ] }, `${year}-${month}`);
2965
+ }) });
2966
+ }
2967
+ var toneColor = {
2968
+ neutral: "var(--text-secondary)",
2969
+ success: "var(--success)",
2970
+ warning: "var(--warning)",
2971
+ danger: "var(--error)",
2972
+ info: "var(--info)"
2973
+ };
2974
+ function StatusPill({
2975
+ label,
2976
+ value,
2977
+ valueMinCh,
2978
+ tone = "neutral",
2979
+ dot = true,
2980
+ icon,
2981
+ help,
2982
+ flat = false,
2983
+ asChild = false,
2984
+ className,
2985
+ children,
2986
+ ...rest
2987
+ }) {
2988
+ const color = toneColor[tone];
2989
+ const rootClass = cn(
2990
+ "inline-flex items-center gap-1.5 whitespace-nowrap leading-none",
2991
+ flat ? "text-xs" : "rounded-full border border-border bg-(--bg-elevated) px-2.5 py-1 text-[11px] yunui-fine-print",
2992
+ className
2993
+ );
2994
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
2995
+ icon != null ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "inline-flex shrink-0 items-center [&>svg]:size-[11px]", style: { color }, children: icon }) : dot ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-1.5 shrink-0 rounded-full", style: { backgroundColor: color } }) : null,
2996
+ /* @__PURE__ */ jsx("span", { style: { color: tone === "neutral" ? "var(--text-secondary)" : color }, children: label }),
2997
+ value != null && /* @__PURE__ */ jsx(
2998
+ "span",
2999
+ {
3000
+ className: cn(flat ? "tabular-nums" : "font-mono font-medium tabular-nums", valueMinCh != null && "inline-block text-left"),
3001
+ style: { color: tone === "neutral" ? flat ? "var(--text-secondary)" : "var(--text-primary)" : color, minWidth: valueMinCh != null ? `${valueMinCh}ch` : void 0 },
3002
+ children: value
3003
+ }
3004
+ ),
3005
+ help != null && /* @__PURE__ */ jsx("span", { className: "sr-only", children: help })
3006
+ ] });
3007
+ const child = asChild && isValidElement(children) ? children : null;
3008
+ const pill = child ? cloneElement(child, {
3009
+ ...rest,
3010
+ "data-tone": tone,
3011
+ "data-flat": flat ? "" : void 0,
3012
+ className: cn(rootClass, child.props.className),
3013
+ children: content
3014
+ }) : /* @__PURE__ */ jsx("li", { ...rest, "data-tone": tone, "data-flat": flat ? "" : void 0, className: rootClass, children: content });
3015
+ if (help == null) return pill;
3016
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
3017
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: pill }),
3018
+ /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs whitespace-normal", children: help })
3019
+ ] });
3020
+ }
3021
+ function StatusPillBar({ ariaLabel, live = false, children, className }) {
3022
+ const items = Array.isArray(children) ? children.flat(Infinity).filter(Boolean) : children;
3023
+ if (items == null || items === false || Array.isArray(items) && items.length === 0) return null;
3024
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsx(
3025
+ "ul",
3026
+ {
3027
+ "aria-label": ariaLabel,
3028
+ role: live ? "status" : void 0,
3029
+ className: cn("m-0 flex list-none flex-wrap items-center gap-2 px-6 pb-3 pt-1", className),
3030
+ children
3031
+ }
3032
+ ) });
3033
+ }
3034
+ var PHONE_MAX = 639;
3035
+ var GAP = 8;
3036
+ var MARGIN = 12;
3037
+ var DISMISS_PX = 64;
3038
+ function measure(anchor, width) {
3039
+ if (!anchor || typeof window === "undefined") return null;
3040
+ const rect = anchor.getBoundingClientRect();
3041
+ const vw = window.innerWidth;
3042
+ const vh = window.innerHeight;
3043
+ const phone = vw <= PHONE_MAX;
3044
+ const cardWidth = phone ? vw - MARGIN * 2 : Math.min(width, vw - MARGIN * 2);
3045
+ const left = phone ? MARGIN : Math.min(Math.max(MARGIN, rect.left), vw - cardWidth - MARGIN);
3046
+ const bottom = Math.max(MARGIN, vh - rect.top + GAP);
3047
+ const maxHeight = Math.max(160, Math.min(vh * 0.7, vh - bottom - MARGIN));
3048
+ const originX = Math.min(Math.max(rect.left + rect.width / 2 - left, 0), cardWidth);
3049
+ return { phone, left, width: phone ? null : cardWidth, bottom, maxHeight, originX };
3050
+ }
3051
+ function StatusIsland({ open, onClose, anchorRef, label, width = 360, children, className }) {
3052
+ const [mounted, setMounted] = useState(false);
3053
+ const [present, setPresent] = useState(open);
3054
+ const [shown, setShown] = useState(false);
3055
+ const [place, setPlace] = useState(null);
3056
+ const [drag, setDrag] = useState(0);
3057
+ const panelRef = useRef(null);
3058
+ const dragRef = useRef(null);
3059
+ const wasOpen = useRef(false);
3060
+ useEffect(() => {
3061
+ setMounted(true);
3062
+ return () => setMounted(false);
3063
+ }, []);
3064
+ useLayoutEffect(() => {
3065
+ if (!open) return;
3066
+ const update = () => setPlace(measure(anchorRef.current, width));
3067
+ update();
3068
+ window.addEventListener("resize", update);
3069
+ window.addEventListener("scroll", update, true);
3070
+ return () => {
3071
+ window.removeEventListener("resize", update);
3072
+ window.removeEventListener("scroll", update, true);
3073
+ };
3074
+ }, [open, anchorRef, width]);
3075
+ useEffect(() => {
3076
+ if (open) {
3077
+ setPresent(true);
3078
+ const id2 = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
3079
+ return () => cancelAnimationFrame(id2);
3080
+ }
3081
+ setShown(false);
3082
+ setDrag(0);
3083
+ const id = window.setTimeout(() => setPresent(false), 150);
3084
+ return () => window.clearTimeout(id);
3085
+ }, [open]);
3086
+ useEffect(() => {
3087
+ if (wasOpen.current && !open) anchorRef.current?.focus?.();
3088
+ wasOpen.current = open;
3089
+ }, [open, anchorRef]);
3090
+ useEscapeKey(onClose, open);
3091
+ useBodyScrollLock(open && !!place?.phone, { pin: true });
3092
+ useEffect(() => {
3093
+ if (!open || !place?.phone) return;
3094
+ const onMove = (event) => {
3095
+ if (!event.cancelable) return;
3096
+ const target = event.target;
3097
+ const inScroller = !!target && !!panelRef.current?.querySelector("[data-yunui=scroll-fade]")?.contains(target);
3098
+ if (dragRef.current || !inScroller) event.preventDefault();
3099
+ };
3100
+ document.addEventListener("touchmove", onMove, { passive: false, capture: true });
3101
+ return () => document.removeEventListener("touchmove", onMove, true);
3102
+ }, [open, place?.phone]);
3103
+ useFocusTrap(panelRef, open && mounted && present && place !== null);
3104
+ useEffect(() => {
3105
+ if (!open) return;
3106
+ const onDown = (event) => {
3107
+ const target = event.target;
3108
+ if (!target) return;
3109
+ if (panelRef.current?.contains(target)) return;
3110
+ if (anchorRef.current?.contains(target)) return;
3111
+ onClose();
3112
+ };
3113
+ document.addEventListener("pointerdown", onDown, true);
3114
+ return () => document.removeEventListener("pointerdown", onDown, true);
3115
+ }, [open, onClose, anchorRef]);
3116
+ const down = useCallback((event) => {
3117
+ if (!event.target.closest("[data-island-drag]")) return;
3118
+ dragRef.current = { id: event.pointerId, y: event.clientY };
3119
+ event.currentTarget.setPointerCapture?.(event.pointerId);
3120
+ }, []);
3121
+ const move = useCallback((event) => {
3122
+ const d = dragRef.current;
3123
+ if (!d || d.id !== event.pointerId) return;
3124
+ setDrag(Math.max(0, event.clientY - d.y));
3125
+ }, []);
3126
+ const up = useCallback(
3127
+ (event) => {
3128
+ const d = dragRef.current;
3129
+ if (!d || d.id !== event.pointerId) return;
3130
+ dragRef.current = null;
3131
+ const dy = event.clientY - d.y;
3132
+ if (dy > DISMISS_PX) onClose();
3133
+ else setDrag(0);
3134
+ },
3135
+ [onClose]
3136
+ );
3137
+ if (!mounted || !present || !place) return null;
3138
+ const style = {
3139
+ left: place.left,
3140
+ bottom: place.bottom,
3141
+ width: place.width ?? void 0,
3142
+ right: place.phone ? MARGIN : void 0,
3143
+ maxHeight: place.maxHeight,
3144
+ transformOrigin: `${place.originX}px 100%`,
3145
+ zIndex: 60
3146
+ };
3147
+ const visible = shown && open;
3148
+ const inner = drag > 0 ? { transform: `translateY(${drag}px)`, transition: "none", opacity: Math.max(0.4, 1 - drag / 240) } : {};
3149
+ return createPortal(
3150
+ /* @__PURE__ */ jsxs(Fragment, { children: [
3151
+ place.phone && /* @__PURE__ */ jsx(
3152
+ "div",
3153
+ {
3154
+ "aria-hidden": true,
3155
+ "data-yunui": "status-island-scrim",
3156
+ className: cn(
3157
+ "fixed inset-0 touch-none bg-black/25 transition-opacity duration-(--dur-fast) ease-out motion-reduce:transition-none",
3158
+ visible ? "opacity-100" : "opacity-0"
3159
+ ),
3160
+ style: { zIndex: 59, opacity: visible ? Math.max(0.2, 1 - drag / 240) : 0 }
3161
+ }
3162
+ ),
3163
+ /* @__PURE__ */ jsx(
3164
+ "div",
3165
+ {
3166
+ ref: panelRef,
3167
+ role: "dialog",
3168
+ "aria-modal": "false",
3169
+ "aria-label": label,
3170
+ tabIndex: -1,
3171
+ "data-yunui": "status-island",
3172
+ "data-state": visible ? "open" : "closed",
3173
+ "data-placement": place.phone ? "phone" : "desktop",
3174
+ onPointerDown: down,
3175
+ onPointerMove: move,
3176
+ onPointerUp: up,
3177
+ onPointerCancel: up,
3178
+ className: "fixed touch-pan-y overscroll-contain outline-none",
3179
+ style,
3180
+ children: /* @__PURE__ */ jsxs(
3181
+ "div",
3182
+ {
3183
+ className: cn(
3184
+ "flex flex-col overflow-hidden rounded-[22px] border border-border bg-background text-foreground shadow-xl shadow-black/15 transition-[opacity,scale,transform] duration-(--dur-base) ease-(--ease-out) motion-reduce:transition-none",
3185
+ visible ? "scale-100 opacity-100" : "scale-95 opacity-0",
3186
+ className
3187
+ ),
3188
+ style: { ...inner, maxHeight: place.maxHeight },
3189
+ children: [
3190
+ place.phone && /* @__PURE__ */ jsx("div", { "data-island-drag": true, className: "flex shrink-0 touch-none justify-center pb-0.5 pt-2", "aria-hidden": true, children: /* @__PURE__ */ jsx("span", { className: "h-1 w-9 rounded-full bg-border" }) }),
3191
+ /* @__PURE__ */ jsx(ScrollFade, { className: "flex min-h-0 flex-1 flex-col gap-2 overscroll-contain p-2.5", children })
3192
+ ]
3193
+ }
3194
+ )
3195
+ }
3196
+ )
3197
+ ] }),
3198
+ document.body
3199
+ );
3200
+ }
3201
+ function StatusIslandHeader({ indicator, title, tag, subtitle, action, className }) {
3202
+ return /* @__PURE__ */ jsxs("div", { "data-island-drag": true, className: cn("flex touch-none items-center gap-3 px-2 pb-0.5 pt-1.5", className), children: [
3203
+ indicator != null && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center", children: indicator }),
3204
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
3205
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-baseline gap-2", children: [
3206
+ /* @__PURE__ */ jsx("span", { className: "truncate text-base font-semibold text-foreground", children: title }),
3207
+ tag != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: tag })
3208
+ ] }),
3209
+ subtitle != null && /* @__PURE__ */ jsx("div", { className: "truncate text-xs tabular-nums text-muted-foreground", children: subtitle })
3210
+ ] }),
3211
+ action != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action })
3212
+ ] });
3213
+ }
3214
+ function StatusIslandCard({ title, note, children, className, ...rest }) {
3215
+ return /* @__PURE__ */ jsxs("section", { className: cn("rounded-2xl bg-(--bg-elevated) px-3.5 py-3", className), "data-island-card": "", ...rest, children: [
3216
+ (title != null || note != null) && /* @__PURE__ */ jsxs("header", { className: "mb-2 flex items-baseline justify-between gap-3", children: [
3217
+ /* @__PURE__ */ jsx("h3", { className: "m-0 text-xs font-medium text-muted-foreground", children: title }),
3218
+ note != null && /* @__PURE__ */ jsx("span", { className: "truncate text-xs tabular-nums text-muted-foreground", children: note })
3219
+ ] }),
3220
+ children
3221
+ ] });
3222
+ }
3223
+ function StatusIslandMetric({ label, value, unit, title, className }) {
3224
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-baseline justify-between gap-3 py-0.5 text-[13px]", className), title, children: [
3225
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
3226
+ /* @__PURE__ */ jsxs("span", { className: "tabular-nums text-foreground", children: [
3227
+ value,
3228
+ unit != null && /* @__PURE__ */ jsx("span", { "data-slot": "unit", className: "text-xs text-muted-foreground", children: unit })
3229
+ ] })
3230
+ ] });
3231
+ }
3232
+ var GroupContext = createContext(false);
3233
+ function StatusIslandNavGroup({ children, className }) {
3234
+ return /* @__PURE__ */ jsx(GroupContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
3235
+ "div",
3236
+ {
3237
+ "data-island-group": "",
3238
+ className: cn("overflow-hidden rounded-2xl bg-(--bg-elevated) [&>*+*]:border-t [&>*+*]:border-(--border-hairline)", className),
3239
+ children
3240
+ }
3241
+ ) });
3242
+ }
3243
+ function StatusIslandNavRow({ label, detail, href, onClick, className }) {
3244
+ const grouped = useContext(GroupContext);
3245
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
3246
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[13px] font-semibold text-foreground", children: label }),
3247
+ detail != null && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-xs tabular-nums text-muted-foreground", children: detail }),
3248
+ /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, size: 14, className: "ml-auto shrink-0 text-muted-foreground" })
3249
+ ] });
3250
+ const cls = cn(
3251
+ "flex min-h-10 w-full items-center gap-2.5 px-3.5 py-2 text-left no-underline transition-colors duration-(--dur-fast) ease-out focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--color-accent)",
3252
+ grouped ? "hover:bg-foreground/[0.04] active:bg-foreground/[0.06]" : "rounded-2xl bg-(--bg-elevated) hover:bg-foreground/[0.04] active:bg-foreground/[0.06]",
3253
+ className
3254
+ );
3255
+ if (href != null)
3256
+ return /* @__PURE__ */ jsx("a", { href, className: cls, onClick, children: body });
3257
+ return /* @__PURE__ */ jsx("button", { type: "button", className: cls, onClick, children: body });
3258
+ }
3259
+ function DisclosureCard({
3260
+ title,
3261
+ summary,
3262
+ defaultOpen = false,
3263
+ open,
3264
+ onOpenChange,
3265
+ className,
3266
+ children
3267
+ }) {
3268
+ const [internal, setInternal] = useState(defaultOpen);
3269
+ const isOpen = open ?? internal;
3270
+ const setOpen = (next) => {
3271
+ if (open === void 0) setInternal(next);
3272
+ onOpenChange?.(next);
3273
+ };
3274
+ return /* @__PURE__ */ jsxs(
3275
+ Collapsible,
3276
+ {
3277
+ open: isOpen,
3278
+ onOpenChange: setOpen,
3279
+ "data-yunui": "disclosure-card",
3280
+ "data-state": isOpen ? "open" : "closed",
3281
+ className: cn("rounded-[20px] border border-(--border-hairline) bg-(--bg-card) p-3", className),
3282
+ children: [
3283
+ /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
3284
+ "button",
3285
+ {
3286
+ type: "button",
3287
+ className: "flex w-full cursor-pointer items-center gap-2 rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
3288
+ children: [
3289
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs font-medium text-(--text-primary)", children: title }),
3290
+ !isOpen && summary != null ? /* @__PURE__ */ jsx("span", { "data-slot": "summary", className: "min-w-0 flex-1 truncate text-[0.8125rem] leading-snug text-(--text-tertiary)", children: summary }) : /* @__PURE__ */ jsx("span", { className: "flex-1" }),
3291
+ /* @__PURE__ */ jsx(
3292
+ ChevronDown,
3293
+ {
3294
+ "aria-hidden": "true",
3295
+ size: 10,
3296
+ strokeWidth: 2.5,
3297
+ className: cn(
3298
+ "shrink-0 text-(--text-muted) transition-transform duration-(--dur-base) ease-out motion-reduce:transition-none",
3299
+ !isOpen && "-rotate-90"
3300
+ )
3301
+ }
3302
+ )
3303
+ ]
3304
+ }
3305
+ ) }),
3306
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "pt-3", children }) })
3307
+ ]
3308
+ }
3309
+ );
3310
+ }
3311
+ var TONE_COLOR = {
3312
+ neutral: "var(--text-primary)",
3313
+ success: "var(--success)",
3314
+ warning: "var(--warning)",
3315
+ error: "var(--error)"
3316
+ };
3317
+ var clampStyle = (lines) => ({
3318
+ display: "-webkit-box",
3319
+ WebkitBoxOrient: "vertical",
3320
+ WebkitLineClamp: Math.max(1, Math.floor(lines)),
3321
+ overflow: "hidden"
3322
+ });
3323
+ function DetailRow({ label, value, tone = "neutral", mono = true, maxLines = 3, title, className }) {
3324
+ const fullText = title ?? (typeof value === "string" || typeof value === "number" ? String(value) : void 0);
3325
+ return /* @__PURE__ */ jsxs("div", { "data-yunui": "detail-row", "data-tone": tone, className: cn("flex items-baseline gap-3", className), children: [
3326
+ /* @__PURE__ */ jsx("dt", { className: "shrink-0 whitespace-nowrap text-[0.8125rem] leading-snug text-(--text-tertiary)", children: label }),
3327
+ /* @__PURE__ */ jsx(
3328
+ "dd",
3329
+ {
3330
+ title: fullText,
3331
+ className: cn(
3332
+ "yunui-fine-print m-0 min-w-0 flex-1 break-words text-right text-[11px] leading-snug",
3333
+ mono && "font-mono font-medium tabular-nums"
3334
+ ),
3335
+ style: { ...clampStyle(maxLines), color: TONE_COLOR[tone] },
3336
+ children: value
3337
+ }
3338
+ )
3339
+ ] });
3340
+ }
3341
+ function DetailList({ children, ariaLabel, className }) {
3342
+ return /* @__PURE__ */ jsx("dl", { "data-yunui": "detail-list", "aria-label": ariaLabel, className: cn("m-0 flex flex-col gap-2", className), children });
3343
+ }
3344
+ function Figure({ label, value, unit, className }) {
3345
+ return /* @__PURE__ */ jsxs("div", { "data-yunui": "figure", className: cn("flex min-w-0 flex-col gap-0.5", className), children: [
3346
+ /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] leading-snug text-(--text-tertiary)", children: label }),
3347
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline gap-1", children: [
3348
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-medium leading-tight tabular-nums text-(--text-primary)", children: value }),
3349
+ unit != null ? /* @__PURE__ */ jsx("span", { className: "yunui-fine-print text-[11px] text-(--text-tertiary)", children: unit }) : null
3350
+ ] })
3351
+ ] });
3352
+ }
3353
+ function WorkspaceLayout({
3354
+ list,
3355
+ detail,
3356
+ detailWidth = 360,
3357
+ stackDetail = false,
3358
+ scroll = false,
3359
+ detailLabel,
3360
+ className
3361
+ }) {
3362
+ return /* @__PURE__ */ jsxs(
3363
+ "div",
3364
+ {
3365
+ "data-yunui": "workspace-layout",
3366
+ className: cn("flex min-w-0 flex-col gap-4 xl:min-h-0 xl:flex-row", scroll && "xl:h-full", className),
3367
+ style: { "--workspace-detail-width": `${detailWidth}px` },
3368
+ children: [
3369
+ /* @__PURE__ */ jsx("div", { "data-slot": "list", className: cn("min-w-0 xl:flex-1", scroll && "xl:min-h-0 xl:overflow-y-auto"), children: list }),
3370
+ /* @__PURE__ */ jsx(
3371
+ "aside",
3372
+ {
3373
+ "data-slot": "detail",
3374
+ "aria-label": detailLabel,
3375
+ className: cn(
3376
+ "min-w-0 xl:block xl:w-(--workspace-detail-width) xl:shrink-0",
3377
+ stackDetail ? "block" : "hidden",
3378
+ scroll && "xl:min-h-0 xl:overflow-y-auto"
3379
+ ),
3380
+ children: detail
3381
+ }
3382
+ )
3383
+ ]
3384
+ }
3385
+ );
3386
+ }
3387
+ function GroupLabel({ title, description, action, as: Title = "h3", className }) {
3388
+ return /* @__PURE__ */ jsxs("div", { "data-yunui": "group-label", className: cn("flex items-end justify-between gap-3 px-1 pb-2", className), children: [
3389
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3390
+ /* @__PURE__ */ jsx(Title, { className: "text-label m-0", children: title }),
3391
+ description != null ? /* @__PURE__ */ jsx("p", { className: "m-0 mt-0.5 text-[0.8125rem] leading-snug text-(--text-tertiary)", children: description }) : null
3392
+ ] }),
3393
+ action != null ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
3394
+ ] });
3395
+ }
3396
+ var TERMINATORS = /* @__PURE__ */ new Set([".", "!", "?", "\u3002", "\uFF01", "\uFF1F"]);
3397
+ function collapseRepeatedMessage(fullText) {
3398
+ const trimmed = fullText.trim();
3399
+ const words = trimmed.split(/\s+/).filter(Boolean);
3400
+ if (words.length <= 1) return trimmed;
3401
+ const prefix = new Array(words.length).fill(0);
3402
+ let matched = 0;
3403
+ for (let index = 1; index < words.length; index += 1) {
3404
+ while (matched > 0 && words[index] !== words[matched]) matched = prefix[matched - 1];
3405
+ if (words[index] === words[matched]) matched += 1;
3406
+ prefix[index] = matched;
3407
+ }
3408
+ const period = words.length - prefix[words.length - 1];
3409
+ if (period >= words.length || words.length % period !== 0) return trimmed;
3410
+ const last = words[period - 1];
3411
+ if (!TERMINATORS.has(last[last.length - 1])) return trimmed;
3412
+ return words.slice(0, period).join(" ");
3413
+ }
3414
+ function boundedMessage(fullText, maximumLines = 3) {
3415
+ return {
3416
+ text: collapseRepeatedMessage(fullText),
3417
+ title: fullText,
3418
+ style: {
3419
+ display: "-webkit-box",
3420
+ WebkitBoxOrient: "vertical",
3421
+ WebkitLineClamp: Math.max(1, Math.floor(maximumLines)),
3422
+ overflow: "hidden",
3423
+ overflowWrap: "anywhere"
3424
+ }
3425
+ };
3426
+ }
3427
+ function BoundedText({ text, maxLines = 3, as: Tag = "p", className }) {
3428
+ const bounded = boundedMessage(text, maxLines);
3429
+ return /* @__PURE__ */ jsx(Tag, { "data-yunui": "bounded-text", title: bounded.title, style: bounded.style, className: cn("m-0 min-w-0", className), children: bounded.text });
3430
+ }
3431
+ var BASE = "block w-full rounded-md px-1.5 py-1 text-left transition-colors duration-(--dur-fast) ease-out motion-reduce:transition-none hover:bg-accent-subtle";
3432
+ var FOCUS = "outline-none focus-visible:ring-2 focus-visible:ring-(--border-strong) focus-visible:ring-offset-0";
3433
+ function HoverRow(props) {
3434
+ if (typeof props.onClick === "function") {
3435
+ const { className: className2, type = "button", ...rest2 } = props;
3436
+ return /* @__PURE__ */ jsx("button", { type, "data-yunui": "hover-row", className: cn(BASE, FOCUS, "cursor-pointer", className2), ...rest2 });
3437
+ }
3438
+ const { className, ...rest } = props;
3439
+ return /* @__PURE__ */ jsx("div", { "data-yunui": "hover-row", className: cn(BASE, className), ...rest });
3440
+ }
3441
+ var TONE_VAR = {
3442
+ accent: "var(--color-accent)",
3443
+ success: "var(--success)",
3444
+ warning: "var(--warning)",
3445
+ error: "var(--error)",
3446
+ info: "var(--info)",
3447
+ neutral: "var(--color-muted-foreground)"
3448
+ };
3449
+ var defaultFormat = (t) => `${Math.round(t * 10) / 10} ms`;
3450
+ var spanColor = (s) => s.color ?? TONE_VAR[s.tone ?? "accent"];
3451
+ var markerColor = (m) => m.color ?? (m.tone ? TONE_VAR[m.tone] : "var(--color-foreground)");
3452
+ var TICKS = 4;
3453
+ function TraceTimeline({
3454
+ tracks,
3455
+ spans,
3456
+ markers = [],
3457
+ duration,
3458
+ formatTime = defaultFormat,
3459
+ label,
3460
+ labels,
3461
+ expanded: expandedProp,
3462
+ defaultExpanded,
3463
+ onExpandedChange,
3464
+ view: viewProp,
3465
+ defaultView = "timeline",
3466
+ onViewChange,
3467
+ className
3468
+ }) {
3469
+ const uid = useId();
3470
+ const [expandedState, setExpandedState] = useState(defaultExpanded ?? []);
3471
+ const expanded = expandedProp ?? expandedState;
3472
+ const [viewState, setViewState] = useState(defaultView);
3473
+ const view = viewProp ?? viewState;
3474
+ const finite = (n) => n != null && Number.isFinite(n);
3475
+ const validSpans = useMemo(
3476
+ () => spans.filter((s) => finite(s.start) && (s.end == null || finite(s.end))),
3477
+ [spans]
3478
+ );
3479
+ const axis = useMemo(() => {
3480
+ if (finite(duration) && duration > 0) return duration;
3481
+ let max = 0;
3482
+ for (const s of validSpans) max = Math.max(max, s.end ?? s.start);
3483
+ for (const m of markers) if (finite(m.at)) max = Math.max(max, m.at);
3484
+ return max || 1;
3485
+ }, [duration, validSpans, markers]);
3486
+ const byTrack = useMemo(() => {
3487
+ const map = /* @__PURE__ */ new Map();
3488
+ for (const t of tracks) map.set(t.id, []);
3489
+ for (const s of validSpans) map.get(s.track)?.push(s);
3490
+ for (const list of map.values()) list.sort((a, b) => a.start - b.start);
3491
+ return map;
3492
+ }, [tracks, validSpans]);
3493
+ const [active, setActive] = useState(null);
3494
+ const refs = useRef(/* @__PURE__ */ new Map());
3495
+ const firstId = useMemo(() => {
3496
+ for (const t of tracks) {
3497
+ const first = byTrack.get(t.id)?.[0];
3498
+ if (first) return first.id;
3499
+ }
3500
+ return null;
3501
+ }, [tracks, byTrack]);
3502
+ const tabbable = active && validSpans.some((s) => s.id === active) ? active : firstId;
3503
+ const setExpanded = useCallback(
3504
+ (next) => {
3505
+ if (expandedProp === void 0) setExpandedState(next);
3506
+ onExpandedChange?.(next);
3507
+ },
3508
+ [expandedProp, onExpandedChange]
3509
+ );
3510
+ const toggle = (span) => {
3511
+ if (span.detail == null) return;
3512
+ setExpanded(expanded.includes(span.id) ? expanded.filter((id) => id !== span.id) : [...expanded, span.id]);
3513
+ };
3514
+ const focusSpan = (id) => {
3515
+ if (!id) return;
3516
+ setActive(id);
3517
+ refs.current.get(id)?.focus();
3518
+ };
3519
+ const onKeyDown = (e, span) => {
3520
+ const row = byTrack.get(span.track) ?? [];
3521
+ const i = row.findIndex((s) => s.id === span.id);
3522
+ const trackIdx = tracks.findIndex((t) => t.id === span.track);
3523
+ const neighbour = (dir) => {
3524
+ for (let k = trackIdx + dir; k >= 0 && k < tracks.length; k += dir) {
3525
+ const list = byTrack.get(tracks[k].id) ?? [];
3526
+ if (!list.length) continue;
3527
+ return list.reduce(
3528
+ (best, s) => Math.abs(s.start - span.start) < Math.abs(best.start - span.start) ? s : best
3529
+ );
3530
+ }
3531
+ return void 0;
3532
+ };
3533
+ let target;
3534
+ if (e.key === "ArrowRight") target = row[i + 1];
3535
+ else if (e.key === "ArrowLeft") target = row[i - 1];
3536
+ else if (e.key === "Home") target = row[0];
3537
+ else if (e.key === "End") target = row[row.length - 1];
3538
+ else if (e.key === "ArrowDown") target = neighbour(1);
3539
+ else if (e.key === "ArrowUp") target = neighbour(-1);
3540
+ else return;
3541
+ e.preventDefault();
3542
+ focusSpan(target?.id);
3543
+ };
3544
+ const setView = (v) => {
3545
+ if (viewProp === void 0) setViewState(v);
3546
+ onViewChange?.(v);
3547
+ };
3548
+ const L = {
3549
+ view: labels?.view ?? "View",
3550
+ timeline: labels?.timeline ?? "Timeline",
3551
+ table: labels?.table ?? "Table",
3552
+ track: labels?.track ?? "Track",
3553
+ span: labels?.span ?? "Span",
3554
+ start: labels?.start ?? "Start",
3555
+ end: labels?.end ?? "End",
3556
+ duration: labels?.duration ?? "Duration",
3557
+ marker: labels?.marker ?? "Marker",
3558
+ running: labels?.running ?? "running",
3559
+ expand: labels?.expand ?? "Press Enter to show details"
3560
+ };
3561
+ const pct = (t) => Math.min(100, Math.max(0, t / axis * 100));
3562
+ const spanEnd = (s) => s.end ?? axis;
3563
+ const rowLabel = (id) => tracks.find((t) => t.id === id)?.label;
3564
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), role: "group", "aria-label": label, children: [
3565
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx("div", { role: "group", "aria-label": L.view, className: "inline-flex rounded-lg bg-muted p-0.5 text-xs", children: ["timeline", "table"].map((v) => /* @__PURE__ */ jsx(
3566
+ "button",
3567
+ {
3568
+ type: "button",
3569
+ "aria-pressed": view === v,
3570
+ onClick: () => setView(v),
3571
+ className: cn(
3572
+ "rounded-md px-2.5 py-1 font-medium text-muted-foreground transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",
3573
+ view === v && "bg-background text-foreground shadow-sm"
3574
+ ),
3575
+ children: L[v]
3576
+ },
3577
+ v
3578
+ )) }) }),
3579
+ view === "table" ? /* @__PURE__ */ jsxs(Table, { children: [
3580
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
3581
+ /* @__PURE__ */ jsx(TableHead, { children: L.track }),
3582
+ /* @__PURE__ */ jsx(TableHead, { children: L.span }),
3583
+ /* @__PURE__ */ jsx(TableHead, { children: L.start }),
3584
+ /* @__PURE__ */ jsx(TableHead, { children: L.end }),
3585
+ /* @__PURE__ */ jsx(TableHead, { children: L.duration })
3586
+ ] }) }),
3587
+ /* @__PURE__ */ jsxs(TableBody, { children: [
3588
+ tracks.flatMap(
3589
+ (t) => (byTrack.get(t.id) ?? []).map((s) => /* @__PURE__ */ jsxs(TableRow, { children: [
3590
+ /* @__PURE__ */ jsx(TableCell, { children: t.label }),
3591
+ /* @__PURE__ */ jsx(TableCell, { children: s.label }),
3592
+ /* @__PURE__ */ jsx(TableCell, { className: "tabular-nums", children: formatTime(s.start) }),
3593
+ /* @__PURE__ */ jsx(TableCell, { className: "tabular-nums", children: s.end == null ? L.running : formatTime(s.end) }),
3594
+ /* @__PURE__ */ jsx(TableCell, { className: "tabular-nums", children: s.end == null ? "\u2014" : formatTime(s.end - s.start) })
3595
+ ] }, s.id))
3596
+ ),
3597
+ markers.filter((m) => finite(m.at)).map((m) => /* @__PURE__ */ jsxs(TableRow, { children: [
3598
+ /* @__PURE__ */ jsx(TableCell, { children: m.track ? rowLabel(m.track) : "\u2014" }),
3599
+ /* @__PURE__ */ jsxs(TableCell, { children: [
3600
+ L.marker,
3601
+ ": ",
3602
+ m.label
3603
+ ] }),
3604
+ /* @__PURE__ */ jsx(TableCell, { className: "tabular-nums", children: formatTime(m.at) }),
3605
+ /* @__PURE__ */ jsx(TableCell, { children: "\u2014" }),
3606
+ /* @__PURE__ */ jsx(TableCell, { children: "\u2014" })
3607
+ ] }, `m-${m.id}`))
3608
+ ] })
3609
+ ] }) : /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("div", { className: "min-w-[32rem]", children: [
3610
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-3 pb-1", children: [
3611
+ /* @__PURE__ */ jsx("div", { className: "w-24 shrink-0" }),
3612
+ /* @__PURE__ */ jsx("div", { className: "yunui-fine-print relative h-4 flex-1 text-[10px] tabular-nums text-muted-foreground", "aria-hidden": true, children: Array.from({ length: TICKS + 1 }, (_, i) => /* @__PURE__ */ jsx(
3613
+ "span",
3614
+ {
3615
+ className: cn(
3616
+ "absolute top-0",
3617
+ i === 0 ? "" : i === TICKS ? "-translate-x-full" : "-translate-x-1/2"
3618
+ ),
3619
+ style: { left: `${i / TICKS * 100}%` },
3620
+ children: formatTime(axis * i / TICKS)
3621
+ },
3622
+ i
3623
+ )) })
3624
+ ] }),
3625
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: tracks.map((t) => {
3626
+ const row = byTrack.get(t.id) ?? [];
3627
+ const open = row.filter((s) => s.detail != null && expanded.includes(s.id));
3628
+ return /* @__PURE__ */ jsxs("div", { className: "border-t border-border/60 py-1.5", children: [
3629
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3630
+ /* @__PURE__ */ jsx("div", { className: "w-24 shrink-0 truncate text-xs font-medium text-muted-foreground", children: t.label }),
3631
+ /* @__PURE__ */ jsxs("div", { className: "relative h-7 flex-1 rounded-md bg-muted/40", children: [
3632
+ markers.filter((m) => finite(m.at) && (!m.track || m.track === t.id)).map((m) => /* @__PURE__ */ jsx(
3633
+ "span",
3634
+ {
3635
+ "data-trace-marker": m.id,
3636
+ title: `${m.label} \xB7 ${formatTime(m.at)}`,
3637
+ className: "pointer-events-auto absolute inset-y-0 z-10 w-px",
3638
+ style: { left: `${pct(m.at)}%`, backgroundColor: markerColor(m) },
3639
+ children: /* @__PURE__ */ jsx(
3640
+ "span",
3641
+ {
3642
+ "aria-hidden": true,
3643
+ className: "absolute -top-0.5 left-1/2 h-1.5 w-1.5 -translate-x-1/2 rotate-45",
3644
+ style: { backgroundColor: markerColor(m) }
3645
+ }
3646
+ )
3647
+ },
3648
+ m.id
3649
+ )),
3650
+ row.map((s) => {
3651
+ const left = pct(s.start);
3652
+ const width = Math.max(pct(spanEnd(s)) - left, 0.4);
3653
+ const c = spanColor(s);
3654
+ const isOpen = open.includes(s);
3655
+ const expandable = s.detail != null;
3656
+ const name = `${s.label}, ${formatTime(s.start)} \u2013 ${s.end == null ? L.running : formatTime(s.end)}${s.end == null ? "" : ` (${formatTime(s.end - s.start)})`}`;
3657
+ return /* @__PURE__ */ jsx(
3658
+ "button",
3659
+ {
3660
+ ref: (el) => {
3661
+ if (el) refs.current.set(s.id, el);
3662
+ else refs.current.delete(s.id);
3663
+ },
3664
+ type: "button",
3665
+ "data-trace-span": s.id,
3666
+ "data-open-ended": s.end == null ? "" : void 0,
3667
+ tabIndex: tabbable === s.id ? 0 : -1,
3668
+ "aria-label": name,
3669
+ "aria-description": expandable ? L.expand : void 0,
3670
+ "aria-expanded": expandable ? isOpen : void 0,
3671
+ "aria-controls": expandable && isOpen ? `${uid}-${s.id}` : void 0,
3672
+ title: name,
3673
+ onFocus: () => setActive(s.id),
3674
+ onClick: () => toggle(s),
3675
+ onKeyDown: (e) => onKeyDown(e, s),
3676
+ className: cn(
3677
+ "yunui-fine-print absolute inset-y-0.5 flex min-w-0 items-center overflow-hidden rounded-md border-l-2 px-1.5 text-left text-[11px] font-medium text-foreground transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",
3678
+ s.end == null && "border-r border-dashed",
3679
+ expandable ? "cursor-pointer" : "cursor-default"
3680
+ ),
3681
+ style: {
3682
+ left: `${left}%`,
3683
+ width: `${width}%`,
3684
+ borderColor: c,
3685
+ backgroundColor: `color-mix(in srgb, ${c} ${isOpen ? 34 : 20}%, transparent)`
3686
+ },
3687
+ children: /* @__PURE__ */ jsx("span", { className: "truncate", children: s.label })
3688
+ },
3689
+ s.id
3690
+ );
3691
+ })
3692
+ ] })
3693
+ ] }),
3694
+ open.map((s) => /* @__PURE__ */ jsxs(
3695
+ "div",
3696
+ {
3697
+ id: `${uid}-${s.id}`,
3698
+ role: "region",
3699
+ "aria-label": s.label,
3700
+ className: "mt-1.5 ml-27 rounded-lg border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",
3701
+ children: [
3702
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-2 font-medium text-foreground", children: [
3703
+ /* @__PURE__ */ jsx(
3704
+ "span",
3705
+ {
3706
+ "aria-hidden": true,
3707
+ className: "h-2 w-2 shrink-0 rounded-full",
3708
+ style: { backgroundColor: spanColor(s) }
3709
+ }
3710
+ ),
3711
+ s.label,
3712
+ /* @__PURE__ */ jsxs("span", { className: "font-normal tabular-nums text-muted-foreground", children: [
3713
+ formatTime(s.start),
3714
+ " \u2013",
3715
+ " ",
3716
+ s.end == null ? L.running : formatTime(s.end)
3717
+ ] })
3718
+ ] }),
3719
+ s.detail
3720
+ ]
3721
+ },
3722
+ s.id
3723
+ ))
3724
+ ] }, t.id);
3725
+ }) })
3726
+ ] }) }),
3727
+ view === "timeline" && markers.some((m) => finite(m.at)) && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: markers.filter((m) => finite(m.at)).map((m) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
3728
+ /* @__PURE__ */ jsx(
3729
+ "span",
3730
+ {
3731
+ "aria-hidden": true,
3732
+ className: "h-1.5 w-1.5 shrink-0 rotate-45",
3733
+ style: { backgroundColor: markerColor(m) }
3734
+ }
3735
+ ),
3736
+ /* @__PURE__ */ jsx("span", { children: m.label }),
3737
+ /* @__PURE__ */ jsx("span", { className: "font-medium tabular-nums text-foreground/80", children: formatTime(m.at) })
3738
+ ] }, m.id)) })
3739
+ ] });
3740
+ }
3741
+ var probability = (logprob) => Number.isFinite(logprob) ? Math.min(1, Math.max(0, Math.exp(logprob))) : 0;
3742
+ function confidenceBand(logprob) {
3743
+ const p = probability(logprob);
3744
+ return p >= 0.9 ? "high" : p >= 0.5 ? "medium" : p >= 0.2 ? "low" : "veryLow";
3745
+ }
3746
+ function summarizeConfidence(tokens, lowestCount = 3) {
3747
+ if (tokens.length === 0) return { count: 0, meanProbability: null, below50: 0, lowest: [] };
3748
+ let sum = 0;
3749
+ let below = 0;
3750
+ for (const t of tokens) {
3751
+ const p = probability(t.logprob);
3752
+ sum += p;
3753
+ if (p < 0.5) below += 1;
3754
+ }
3755
+ const lowest = tokens.map((t, i) => [i, t.logprob]).sort((a, b) => a[1] - b[1]).slice(0, lowestCount).map(([i]) => i);
3756
+ return { count: tokens.length, meanProbability: sum / tokens.length, below50: below, lowest };
3757
+ }
3758
+ var BAND_STYLE = {
3759
+ high: void 0,
3760
+ medium: "underline decoration-(--border-strong) decoration-dotted underline-offset-4",
3761
+ low: "bg-[color-mix(in_srgb,var(--warning)_20%,transparent)]",
3762
+ veryLow: "bg-[color-mix(in_srgb,var(--error)_26%,transparent)]"
3763
+ };
3764
+ function TokenConfidence({ tokens, labels, maxTokens = 4e3, className }) {
3765
+ const shown = tokens.slice(0, maxTokens);
3766
+ return /* @__PURE__ */ jsxs("section", { "data-yunui": "token-confidence", className: cn("rounded-2xl bg-(--bg-elevated) px-4 py-3", className), children: [
3767
+ /* @__PURE__ */ jsxs("header", { className: "mb-2 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1", children: [
3768
+ /* @__PURE__ */ jsx("h3", { className: "m-0 text-base font-semibold", children: labels.title }),
3769
+ /* @__PURE__ */ jsx("p", { className: "m-0 text-xs tabular-nums text-muted-foreground", children: labels.summary })
3770
+ ] }),
3771
+ /* @__PURE__ */ jsx("p", { className: "m-0 whitespace-pre-wrap break-words text-[13px] leading-7", "data-testid": "token-confidence-text", children: shown.map((t, i) => {
3772
+ const band = confidenceBand(t.logprob);
3773
+ const p = probability(t.logprob);
3774
+ return /* @__PURE__ */ jsx(
3775
+ "span",
3776
+ {
3777
+ "data-band": band,
3778
+ title: labels.describe(t, p),
3779
+ className: cn("rounded-sm", BAND_STYLE[band]),
3780
+ children: t.token
3781
+ },
3782
+ i
3783
+ );
3784
+ }) }),
3785
+ /* @__PURE__ */ jsx("ul", { className: "m-0 mt-2 flex list-none flex-wrap gap-x-4 gap-y-1 p-0 text-xs text-muted-foreground", children: ["high", "medium", "low", "veryLow"].map((band) => /* @__PURE__ */ jsxs("li", { className: "inline-flex items-center gap-1.5", children: [
3786
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("inline-block size-3 rounded-sm border border-border", BAND_STYLE[band]) }),
3787
+ labels.legend[band]
3788
+ ] }, band)) }),
3789
+ labels.note != null && /* @__PURE__ */ jsx("p", { className: "m-0 mt-2 text-xs text-muted-foreground", children: labels.note })
3790
+ ] });
3791
+ }
3792
+ function MediaInspector({ src, alt, result, boxes, activeId, onActiveChange, labels, caption, className }) {
3793
+ const hasBoxes = !!boxes && boxes.length > 0;
3794
+ return /* @__PURE__ */ jsxs("div", { "data-yunui": "media-inspector", className: cn("grid gap-3 sm:grid-cols-2", className), children: [
3795
+ /* @__PURE__ */ jsxs("section", { className: "min-w-0 rounded-2xl bg-(--bg-elevated) p-3", children: [
3796
+ /* @__PURE__ */ jsx("h3", { className: "m-0 mb-2 text-xs font-medium text-muted-foreground", children: labels.preview }),
3797
+ /* @__PURE__ */ jsxs("div", { className: "relative mx-auto w-fit max-w-full overflow-hidden rounded-lg", children: [
3798
+ /* @__PURE__ */ jsx("img", { src, alt, className: "block max-h-80 max-w-full object-contain" }),
3799
+ hasBoxes && boxes.map((b) => /* @__PURE__ */ jsx(
3800
+ "button",
3801
+ {
3802
+ type: "button",
3803
+ "aria-label": b.label ?? b.id,
3804
+ "data-active": activeId === b.id ? "" : void 0,
3805
+ onMouseEnter: () => onActiveChange?.(b.id),
3806
+ onMouseLeave: () => onActiveChange?.(null),
3807
+ onFocus: () => onActiveChange?.(b.id),
3808
+ onBlur: () => onActiveChange?.(null),
3809
+ className: cn(
3810
+ "absolute rounded-sm border border-(--border-strong) bg-transparent p-0 outline-none transition-colors duration-(--dur-fast) focus-visible:outline-2 focus-visible:outline-(--color-accent)",
3811
+ activeId === b.id && "bg-[color-mix(in_srgb,var(--color-accent)_25%,transparent)]"
3812
+ ),
3813
+ style: { left: `${b.x * 100}%`, top: `${b.y * 100}%`, width: `${b.w * 100}%`, height: `${b.h * 100}%` }
3814
+ },
3815
+ b.id
3816
+ ))
3817
+ ] }),
3818
+ caption != null && /* @__PURE__ */ jsx("p", { className: "m-0 mt-2 text-xs tabular-nums text-muted-foreground", children: caption })
3819
+ ] }),
3820
+ /* @__PURE__ */ jsxs("section", { className: "min-w-0 rounded-2xl bg-(--bg-elevated) p-3", children: [
3821
+ /* @__PURE__ */ jsx("h3", { className: "m-0 mb-2 text-xs font-medium text-muted-foreground", children: labels.result }),
3822
+ /* @__PURE__ */ jsx("div", { className: "max-h-80 overflow-y-auto text-[13px] leading-6", children: result }),
3823
+ !hasBoxes && labels.noBoxes != null && /* @__PURE__ */ jsx("p", { className: "m-0 mt-2 text-xs text-muted-foreground", children: labels.noBoxes })
3824
+ ] })
3825
+ ] });
3826
+ }
3827
+ var DOT = {
3828
+ idle: "var(--text-muted)",
3829
+ connecting: "var(--warning)",
3830
+ open: "var(--success)",
3831
+ closed: "var(--text-muted)",
3832
+ error: "var(--error)"
3833
+ };
3834
+ function StreamHealth({ title, state, stateLabel, rows, note, action, className }) {
3835
+ return /* @__PURE__ */ jsxs("section", { "data-yunui": "stream-health", "data-state": state, className: cn("rounded-2xl bg-(--bg-elevated) px-4 py-3", className), children: [
3836
+ /* @__PURE__ */ jsxs("header", { className: "mb-2 flex items-center justify-between gap-3", children: [
3837
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
3838
+ /* @__PURE__ */ jsx("h3", { className: "m-0 text-base font-semibold", children: title }),
3839
+ /* @__PURE__ */ jsxs("p", { className: "m-0 flex items-center gap-1.5 text-xs text-muted-foreground", children: [
3840
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-1.5 shrink-0 rounded-full", style: { backgroundColor: DOT[state] } }),
3841
+ stateLabel
3842
+ ] })
3843
+ ] }),
3844
+ action != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action })
3845
+ ] }),
3846
+ /* @__PURE__ */ jsx("dl", { className: "m-0 grid gap-y-1", children: rows.map((r, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3 text-[13px]", children: [
3847
+ /* @__PURE__ */ jsxs("dt", { className: "text-muted-foreground", children: [
3848
+ r.label,
3849
+ r.source != null && /* @__PURE__ */ jsx("span", { className: "ml-1.5 text-xs opacity-70", children: r.source })
3850
+ ] }),
3851
+ /* @__PURE__ */ jsxs("dd", { className: "m-0 tabular-nums", title: r.value == null ? r.unknownTitle : void 0, children: [
3852
+ r.value == null ? "\u2014" : r.value,
3853
+ r.value != null && r.unit != null && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: r.unit })
3854
+ ] })
3855
+ ] }, i)) }),
3856
+ note != null && /* @__PURE__ */ jsx("p", { className: "m-0 mt-2 text-xs text-muted-foreground", children: note })
3857
+ ] });
3858
+ }
2131
3859
 
2132
- export { AccountLockedCard, ActiveBadge, AudioPlayer, AvatarUploader, BackgroundEffects, Banner, BlogCard, BlogPagination, BlogPostHeader, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, ConnectedAccountRow, DeprecatedBadge, ErrorBoundary, FAQ, FeatureLockedState, FellowBadge, FellowsBanner, LLMCopyButton, LinkRow, MediaEmptyState, MediaErrorState, MediaGallery, MediaLoadingState, MediaPageHeader, MetricBar, NavStateIndicator, NotificationBell, NotificationItem, NotificationPanel, PageEmptyState, PageErrorState, PageHeader, PageLayout, PageLoadingState, ReadingProgress, SessionItem, SettingRow, SettingsShell, Sidebar, SimplePagination, SourceBadge, StatCard, StatusBadge, ViewOptions };
3860
+ export { AccountLockedCard, ActiveBadge, ArchiveCalendar, AudioPlayer, AuthShell, AvatarUploader, BackLink, BackgroundEffects, Banner, BlogCard, BlogPagination, BlogPostHeader, BoundedText, CTASection, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, ConnectedAccountRow, DashboardPage, DeprecatedBadge, DetailList, DetailRow, DisclosureCard, ErrorBoundary, Eyebrow, FAQ, FeatureCard, FeatureLockedState, FellowBadge, FellowsBanner, Figure, GroupLabel, HeroAccent, HoverRow, LLMCopyButton, LinkRow, MarketingHero, MediaEmptyState, MediaErrorState, MediaGallery, MediaInspector, MediaLoadingState, MediaPageHeader, MembershipCard, MetricBar, NavStateIndicator, NotificationBell, NotificationItem, NotificationPanel, PageEmptyState, PageErrorState, PageHeader, PageLayout, PageLoadingState, ProseArticle, PullQuote, ReadingProgress, SectionHeading, SectionNav, SectionRow, SessionItem, SettingRow, SettingsShell, Sidebar, SimplePagination, SourceBadge, StatCard, StatGrid, StatusBadge, StatusIsland, StatusIslandCard, StatusIslandHeader, StatusIslandMetric, StatusIslandNavGroup, StatusIslandNavRow, StatusPill, StatusPillBar, StreamHealth, TableState, TokenConfidence, TraceTimeline, ViewOptions, WorkspaceLayout, boundedMessage, collapseRepeatedMessage, confidenceBand, probability, summarizeConfidence };
2133
3861
  //# sourceMappingURL=patterns.js.map
2134
3862
  //# sourceMappingURL=patterns.js.map