@yuhuanowo/yunui 0.2.18 → 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 (558) hide show
  1. package/README.md +55 -6
  2. package/README.zh-CN.md +19 -5
  3. package/README.zh-TW.md +19 -5
  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 +429 -320
  16. package/dist/ai.js +1228 -1966
  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 +202 -23
  22. package/dist/chat.js +879 -129
  23. package/dist/chat.js.map +1 -1
  24. package/dist/{chunk-GAXVET76.js → chunk-ASPPAL7E.js} +16 -14
  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-YKWRCA2S.js → chunk-I2DAKAD5.js} +356 -138
  35. package/dist/chunk-I2DAKAD5.js.map +1 -0
  36. package/dist/{chunk-ST6TSBVQ.js → chunk-OM7B4O6K.js} +9 -24
  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 +17 -39
  62. package/dist/content.js +373 -401
  63. package/dist/content.js.map +1 -1
  64. package/dist/footer-BCd-S806.d.ts +122 -0
  65. package/dist/index.d.ts +565 -89
  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 +443 -8
  80. package/dist/patterns.js +1223 -147
  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/gmicloud.webp +0 -0
  307. package/icons/providers/google.webp +0 -0
  308. package/icons/providers/googlecloud.webp +0 -0
  309. package/icons/providers/goose.webp +0 -0
  310. package/icons/providers/gradio.webp +0 -0
  311. package/icons/providers/greenpt.webp +0 -0
  312. package/icons/providers/greptile.webp +0 -0
  313. package/icons/providers/grok.webp +0 -0
  314. package/icons/providers/grokbot.webp +0 -0
  315. package/icons/providers/groq.webp +0 -0
  316. package/icons/providers/hailuo.webp +0 -0
  317. package/icons/providers/haiper.webp +0 -0
  318. package/icons/providers/happyhorse.webp +0 -0
  319. package/icons/providers/hedra.webp +0 -0
  320. package/icons/providers/hermesagent.webp +0 -0
  321. package/icons/providers/higress.webp +0 -0
  322. package/icons/providers/huawei.webp +0 -0
  323. package/icons/providers/huaweicloud.webp +0 -0
  324. package/icons/providers/huggingface.webp +0 -0
  325. package/icons/providers/hunyuan.webp +0 -0
  326. package/icons/providers/hyperbolic.webp +0 -0
  327. package/icons/providers/ibm.webp +0 -0
  328. package/icons/providers/ideogram.webp +0 -0
  329. package/icons/providers/iflytekcloud.webp +0 -0
  330. package/icons/providers/inception.webp +0 -0
  331. package/icons/providers/inceptron.webp +0 -0
  332. package/icons/providers/inference.webp +0 -0
  333. package/icons/providers/infermatic.webp +0 -0
  334. package/icons/providers/infini.webp +0 -0
  335. package/icons/providers/infinigence.webp +0 -0
  336. package/icons/providers/inflection.webp +0 -0
  337. package/icons/providers/internlm.webp +0 -0
  338. package/icons/providers/ionet.webp +0 -0
  339. package/icons/providers/jimeng.webp +0 -0
  340. package/icons/providers/jina.webp +0 -0
  341. package/icons/providers/junie.webp +0 -0
  342. package/icons/providers/kagi.webp +0 -0
  343. package/icons/providers/kilocode.webp +0 -0
  344. package/icons/providers/kimi.webp +0 -0
  345. package/icons/providers/kiro.webp +0 -0
  346. package/icons/providers/kling.webp +0 -0
  347. package/icons/providers/kluster.webp +0 -0
  348. package/icons/providers/kolors.webp +0 -0
  349. package/icons/providers/krea.webp +0 -0
  350. package/icons/providers/kwaikat.webp +0 -0
  351. package/icons/providers/kwaipilot.webp +0 -0
  352. package/icons/providers/lambda.webp +0 -0
  353. package/icons/providers/langchain.webp +0 -0
  354. package/icons/providers/langfuse.webp +0 -0
  355. package/icons/providers/langgraph.webp +0 -0
  356. package/icons/providers/langsmith.webp +0 -0
  357. package/icons/providers/leptonai.webp +0 -0
  358. package/icons/providers/lg.webp +0 -0
  359. package/icons/providers/lightricks.webp +0 -0
  360. package/icons/providers/ling.webp +0 -0
  361. package/icons/providers/liquid.webp +0 -0
  362. package/icons/providers/livekit.webp +0 -0
  363. package/icons/providers/llamaindex.webp +0 -0
  364. package/icons/providers/llava.webp +0 -0
  365. package/icons/providers/llmapi.webp +0 -0
  366. package/icons/providers/llmgateway.webp +0 -0
  367. package/icons/providers/lmstudio.webp +0 -0
  368. package/icons/providers/lobehub.webp +0 -0
  369. package/icons/providers/lobot.webp +0 -0
  370. package/icons/providers/longcat.webp +0 -0
  371. package/icons/providers/lovable.webp +0 -0
  372. package/icons/providers/lovart.webp +0 -0
  373. package/icons/providers/luma.webp +0 -0
  374. package/icons/providers/magic.webp +0 -0
  375. package/icons/providers/magpie.webp +0 -0
  376. package/icons/providers/make.webp +0 -0
  377. package/icons/providers/manus.webp +0 -0
  378. package/icons/providers/mastra.webp +0 -0
  379. package/icons/providers/mcp.webp +0 -0
  380. package/icons/providers/mcpso.webp +0 -0
  381. package/icons/providers/menlo.webp +0 -0
  382. package/icons/providers/meshy.webp +0 -0
  383. package/icons/providers/meta.webp +0 -0
  384. package/icons/providers/metaai.webp +0 -0
  385. package/icons/providers/metagpt.webp +0 -0
  386. package/icons/providers/microsoft.webp +0 -0
  387. package/icons/providers/midjourney.webp +0 -0
  388. package/icons/providers/minimax.webp +0 -0
  389. package/icons/providers/mistral.webp +0 -0
  390. package/icons/providers/modelscope.webp +0 -0
  391. package/icons/providers/monica.webp +0 -0
  392. package/icons/providers/moonshot.webp +0 -0
  393. package/icons/providers/morph.webp +0 -0
  394. package/icons/providers/moxt.webp +0 -0
  395. package/icons/providers/muse.webp +0 -0
  396. package/icons/providers/myshell.webp +0 -0
  397. package/icons/providers/n8n.webp +0 -0
  398. package/icons/providers/nanobanana.webp +0 -0
  399. package/icons/providers/nebius.webp +0 -0
  400. package/icons/providers/newapi.webp +0 -0
  401. package/icons/providers/nextbit.webp +0 -0
  402. package/icons/providers/notebooklm.webp +0 -0
  403. package/icons/providers/notion.webp +0 -0
  404. package/icons/providers/nousresearch.webp +0 -0
  405. package/icons/providers/nova.webp +0 -0
  406. package/icons/providers/novelai.webp +0 -0
  407. package/icons/providers/novita.webp +0 -0
  408. package/icons/providers/nplcloud.webp +0 -0
  409. package/icons/providers/nvidia.webp +0 -0
  410. package/icons/providers/o3.webp +0 -0
  411. package/icons/providers/obsidian.webp +0 -0
  412. package/icons/providers/ollama.webp +0 -0
  413. package/icons/providers/omlx.webp +0 -0
  414. package/icons/providers/openai.webp +0 -0
  415. package/icons/providers/openchat.webp +0 -0
  416. package/icons/providers/openclaw.webp +0 -0
  417. package/icons/providers/opencode.webp +0 -0
  418. package/icons/providers/openhands.webp +0 -0
  419. package/icons/providers/openhuman.webp +0 -0
  420. package/icons/providers/openrouter.webp +0 -0
  421. package/icons/providers/openwebui.webp +0 -0
  422. package/icons/providers/paddleocr.webp +0 -0
  423. package/icons/providers/palm.webp +0 -0
  424. package/icons/providers/parasail.webp +0 -0
  425. package/icons/providers/perceptron.webp +0 -0
  426. package/icons/providers/perplexity.webp +0 -0
  427. package/icons/providers/phala.webp +0 -0
  428. package/icons/providers/phidata.webp +0 -0
  429. package/icons/providers/phind.webp +0 -0
  430. package/icons/providers/pi.webp +0 -0
  431. package/icons/providers/pika.webp +0 -0
  432. package/icons/providers/pixverse.webp +0 -0
  433. package/icons/providers/player2.webp +0 -0
  434. package/icons/providers/poe.webp +0 -0
  435. package/icons/providers/pollinations.webp +0 -0
  436. package/icons/providers/poolside.webp +0 -0
  437. package/icons/providers/ppio.webp +0 -0
  438. package/icons/providers/prunaai.webp +0 -0
  439. package/icons/providers/pydanticai.webp +0 -0
  440. package/icons/providers/qingyan.webp +0 -0
  441. package/icons/providers/qiniu.webp +0 -0
  442. package/icons/providers/qoder.webp +0 -0
  443. package/icons/providers/qwen.webp +0 -0
  444. package/icons/providers/railway.webp +0 -0
  445. package/icons/providers/recraft.webp +0 -0
  446. package/icons/providers/reflection.webp +0 -0
  447. package/icons/providers/reka.webp +0 -0
  448. package/icons/providers/relace.webp +0 -0
  449. package/icons/providers/replicate.webp +0 -0
  450. package/icons/providers/replit.webp +0 -0
  451. package/icons/providers/reve.webp +0 -0
  452. package/icons/providers/roocode.webp +0 -0
  453. package/icons/providers/rsshub.webp +0 -0
  454. package/icons/providers/runway.webp +0 -0
  455. package/icons/providers/rwkv.webp +0 -0
  456. package/icons/providers/sakana.webp +0 -0
  457. package/icons/providers/sambanova.webp +0 -0
  458. package/icons/providers/search1api.webp +0 -0
  459. package/icons/providers/searchapi.webp +0 -0
  460. package/icons/providers/searxng.webp +0 -0
  461. package/icons/providers/sensenova.webp +0 -0
  462. package/icons/providers/silicon.webp +0 -0
  463. package/icons/providers/siliconcloud.webp +0 -0
  464. package/icons/providers/sillytavern.webp +0 -0
  465. package/icons/providers/skywork.webp +0 -0
  466. package/icons/providers/slock.webp +0 -0
  467. package/icons/providers/smithery.webp +0 -0
  468. package/icons/providers/snowflake.webp +0 -0
  469. package/icons/providers/sophnet.webp +0 -0
  470. package/icons/providers/sora.webp +0 -0
  471. package/icons/providers/spark.webp +0 -0
  472. package/icons/providers/speedai.webp +0 -0
  473. package/icons/providers/stability.webp +0 -0
  474. package/icons/providers/statecloud.webp +0 -0
  475. package/icons/providers/step.webp +0 -0
  476. package/icons/providers/stepfun.webp +0 -0
  477. package/icons/providers/straico.webp +0 -0
  478. package/icons/providers/streamlake.webp +0 -0
  479. package/icons/providers/sub2api.webp +0 -0
  480. package/icons/providers/submodel.webp +0 -0
  481. package/icons/providers/suno.webp +0 -0
  482. package/icons/providers/sync.webp +0 -0
  483. package/icons/providers/tabbit.webp +0 -0
  484. package/icons/providers/targon.webp +0 -0
  485. package/icons/providers/tavily.webp +0 -0
  486. package/icons/providers/tencent-cloud-ti.webp +0 -0
  487. package/icons/providers/tencent.webp +0 -0
  488. package/icons/providers/tencentcloud.webp +0 -0
  489. package/icons/providers/tiangong.webp +0 -0
  490. package/icons/providers/tii.webp +0 -0
  491. package/icons/providers/together.webp +0 -0
  492. package/icons/providers/topazlabs.webp +0 -0
  493. package/icons/providers/trae.webp +0 -0
  494. package/icons/providers/tripo.webp +0 -0
  495. package/icons/providers/turix.webp +0 -0
  496. package/icons/providers/typesafeai.webp +0 -0
  497. package/icons/providers/udio.webp +0 -0
  498. package/icons/providers/unionalpha.webp +0 -0
  499. package/icons/providers/unsloth.webp +0 -0
  500. package/icons/providers/unstructured.webp +0 -0
  501. package/icons/providers/upstage.webp +0 -0
  502. package/icons/providers/v0.webp +0 -0
  503. package/icons/providers/vectorizerai.webp +0 -0
  504. package/icons/providers/venice.webp +0 -0
  505. package/icons/providers/vercel.webp +0 -0
  506. package/icons/providers/vertexai.webp +0 -0
  507. package/icons/providers/vidu.webp +0 -0
  508. package/icons/providers/viggle.webp +0 -0
  509. package/icons/providers/vllm.webp +0 -0
  510. package/icons/providers/volcengine.webp +0 -0
  511. package/icons/providers/voyage.webp +0 -0
  512. package/icons/providers/voyageai.webp +0 -0
  513. package/icons/providers/wafer.webp +0 -0
  514. package/icons/providers/wandb.webp +0 -0
  515. package/icons/providers/wavespeed.webp +0 -0
  516. package/icons/providers/wenxin.webp +0 -0
  517. package/icons/providers/windsurf.webp +0 -0
  518. package/icons/providers/workbuddy.webp +0 -0
  519. package/icons/providers/workersai.webp +0 -0
  520. package/icons/providers/worldrouter.webp +0 -0
  521. package/icons/providers/xai.webp +0 -0
  522. package/icons/providers/xiaomimimo.webp +0 -0
  523. package/icons/providers/xinference.webp +0 -0
  524. package/icons/providers/xpay.webp +0 -0
  525. package/icons/providers/xuanyuan.webp +0 -0
  526. package/icons/providers/yandex.webp +0 -0
  527. package/icons/providers/yi.webp +0 -0
  528. package/icons/providers/youmind.webp +0 -0
  529. package/icons/providers/yuanbao.webp +0 -0
  530. package/icons/providers/zai.webp +0 -0
  531. package/icons/providers/zapier.webp +0 -0
  532. package/icons/providers/zeabur.webp +0 -0
  533. package/icons/providers/zencoder.webp +0 -0
  534. package/icons/providers/zenmux.webp +0 -0
  535. package/icons/providers/zero-one.webp +0 -0
  536. package/icons/providers/zeroone.webp +0 -0
  537. package/icons/providers/zhipu.webp +0 -0
  538. package/licenses/beautiful-ui-MIT.txt +21 -0
  539. package/package.json +51 -7
  540. package/scripts/yunui-audit.mjs +664 -0
  541. package/scripts/yunui-cli.mjs +868 -0
  542. package/scripts/yunui-init.mjs +138 -0
  543. package/styles/content.css +34 -2
  544. package/styles/tokens.css +41 -0
  545. package/styles/yunui.css +1389 -57
  546. package/dist/chunk-AFVENY4D.js +0 -1466
  547. package/dist/chunk-AFVENY4D.js.map +0 -1
  548. package/dist/chunk-GAXVET76.js.map +0 -1
  549. package/dist/chunk-LEBQPP4B.js +0 -152
  550. package/dist/chunk-LEBQPP4B.js.map +0 -1
  551. package/dist/chunk-ST6TSBVQ.js.map +0 -1
  552. package/dist/chunk-V7VJKZ5Q.js +0 -254
  553. package/dist/chunk-V7VJKZ5Q.js.map +0 -1
  554. package/dist/chunk-YKWRCA2S.js.map +0 -1
  555. package/dist/footer-BoFu7Wqq.d.ts +0 -46
  556. package/icons/apps/ling.png +0 -0
  557. package/icons/models/ling.png +0 -0
  558. package/icons/providers/Kwaipilot.png +0 -0
package/dist/patterns.js CHANGED
@@ -1,15 +1,20 @@
1
1
  "use client";
2
- import './chunk-AFVENY4D.js';
3
- import { capabilityBadgeColor, capabilityIconColor, copyToClipboard } from './chunk-LEBQPP4B.js';
4
- export { Footer } from './chunk-LEBQPP4B.js';
5
- import './chunk-GAXVET76.js';
6
- import { ImageLightbox } from './chunk-ST6TSBVQ.js';
7
- import { Button, Card, Badge, Avatar, AvatarImage, AvatarFallback, IconButton, Spinner, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-YKWRCA2S.js';
8
- import { cn } from './chunk-V7VJKZ5Q.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';
15
+ import React, { createContext, useState, useRef, useId, useMemo, useEffect, useCallback, isValidElement, cloneElement, useLayoutEffect, useContext } from 'react';
12
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,86 +139,228 @@ 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-tertiary) text-xs opacity-0 group-hover:opacity-100 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-tertiary) text-xs opacity-0 group-hover:opacity-100 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 } })
213
350
  }
214
- ) : code }) }) })
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
362
+ }
363
+ )
215
364
  ] });
216
365
  }
217
366
  function snippets(baseUrl, model, apiKey, prompt) {
@@ -276,7 +425,7 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
276
425
  "div",
277
426
  {
278
427
  className: cn(
279
- "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)",
280
429
  openIndex === i ? "bg-card/60 ring-1 ring-(--accent-muted)" : "hover:bg-card/50"
281
430
  ),
282
431
  children: [
@@ -288,20 +437,11 @@ function FAQ({ items, defaultOpenIndex = 0 }) {
288
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]",
289
438
  children: [
290
439
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground flex-1 min-w-0", children: faq.question }),
291
- /* @__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" }) })
292
441
  ]
293
442
  }
294
443
  ),
295
- /* @__PURE__ */ jsx(
296
- "div",
297
- {
298
- className: cn(
299
- "px-6 text-muted-foreground text-sm leading-relaxed overflow-hidden transition-all duration-300",
300
- openIndex === i ? "max-h-60 pb-6 opacity-100" : "max-h-0 opacity-0"
301
- ),
302
- children: faq.answer
303
- }
304
- )
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 }) }) })
305
445
  ]
306
446
  },
307
447
  i
@@ -406,7 +546,7 @@ function BlogCard({
406
546
  {
407
547
  src: coverImage,
408
548
  alt: title,
409
- 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"
410
550
  }
411
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" }) }) }) }),
412
552
  /* @__PURE__ */ jsxs("div", { className: "p-5 flex flex-col flex-grow", children: [
@@ -583,7 +723,7 @@ function ReadingProgress({
583
723
  const backToTopLabel = labels?.backToTop ?? "Back to top";
584
724
  useEffect(() => {
585
725
  let frame = 0;
586
- const measure = () => {
726
+ const measure2 = () => {
587
727
  frame = 0;
588
728
  const scrolled = window.scrollY;
589
729
  const reach = document.documentElement.scrollHeight - window.innerHeight;
@@ -591,9 +731,9 @@ function ReadingProgress({
591
731
  setShow(scrolled > threshold);
592
732
  };
593
733
  const onScroll = () => {
594
- if (!frame) frame = window.requestAnimationFrame(measure);
734
+ if (!frame) frame = window.requestAnimationFrame(measure2);
595
735
  };
596
- measure();
736
+ measure2();
597
737
  window.addEventListener("scroll", onScroll, { passive: true });
598
738
  window.addEventListener("resize", onScroll, { passive: true });
599
739
  return () => {
@@ -618,7 +758,7 @@ function ReadingProgress({
618
758
  // dropdowns): translucent popover + backdrop blur, hairline border, the
619
759
  // house shadow and focus ring. House colour classes bridge to the token
620
760
  // system through @theme.
621
- "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
622
762
  ),
623
763
  children: [
624
764
  bar && /* @__PURE__ */ jsxs(
@@ -648,7 +788,7 @@ function ReadingProgress({
648
788
  fill: "none",
649
789
  strokeWidth: "2.5",
650
790
  strokeLinecap: "round",
651
- className: "transition-[stroke-dashoffset] duration-150 ease-out",
791
+ className: "transition-[stroke-dashoffset] duration-(--dur-fast) ease-out",
652
792
  style: { stroke: "var(--accent)" },
653
793
  strokeDasharray: RING_CIRCUMFERENCE,
654
794
  strokeDashoffset: RING_CIRCUMFERENCE * (1 - progress / 100)
@@ -657,7 +797,7 @@ function ReadingProgress({
657
797
  ]
658
798
  }
659
799
  ),
660
- 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" })
661
801
  ]
662
802
  }
663
803
  );
@@ -760,6 +900,7 @@ function Sidebar({
760
900
  onToggleCollapse,
761
901
  onNavigate,
762
902
  footer,
903
+ footerItems,
763
904
  closeLabel = "Close",
764
905
  loading = false,
765
906
  scrollStorageKey = "yunui-sidebar-scroll",
@@ -772,12 +913,40 @@ function Sidebar({
772
913
  }) {
773
914
  const { Link, Image } = useYunUI();
774
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
+ };
775
944
  const strongestMatch = useMemo(
776
945
  () => sections.reduce(
777
946
  (best, section) => section.items.reduce((inner, item) => Math.max(inner, matchStrength(item, currentPath, homeHref)), best),
778
- -1
947
+ (footerItems ?? []).reduce((best, item) => Math.max(best, matchStrength(item, currentPath, homeHref)), -1)
779
948
  ),
780
- [sections, currentPath, homeHref]
949
+ [sections, footerItems, currentPath, homeHref]
781
950
  );
782
951
  useEffect(() => {
783
952
  const nav = navRef.current;
@@ -802,25 +971,25 @@ function Sidebar({
802
971
  layout === "fixed" && isOpen && /* @__PURE__ */ jsx(
803
972
  "div",
804
973
  {
805
- 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",
806
975
  onClick: onClose,
807
976
  "aria-hidden": "true"
808
977
  }
809
978
  ),
810
979
  /* @__PURE__ */ jsxs(
811
- "aside",
980
+ Outer,
812
981
  {
813
- role,
982
+ role: role === "navigation" ? void 0 : role,
814
983
  "aria-label": ariaLabel,
815
984
  className: cn(
816
- "min-w-64 w-64 bg-(--bg-base) border-r border-(--border-hairline) flex flex-col",
817
- 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",
818
987
  layout === "fixed" && (isOpen ? "translate-x-0" : collapsed ? "-translate-x-full" : "-translate-x-full lg:translate-x-0"),
819
988
  className
820
989
  ),
821
990
  children: [
822
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: [
823
- /* @__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: [
824
993
  /* @__PURE__ */ jsx(Image, { src: logoSrc, alt: appName, width: 36, height: 36, className: "shrink-0" }),
825
994
  /* @__PURE__ */ jsx("span", { className: "font-semibold text-[18px] truncate", children: appName })
826
995
  ] }),
@@ -838,33 +1007,27 @@ function Sidebar({
838
1007
  ] }),
839
1008
  onClose && /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(X, { size: 20 }), label: closeLabel, onClick: onClose, className: "lg:hidden" })
840
1009
  ] }) }),
841
- 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: [
842
- section.title && /* @__PURE__ */ jsx("div", { className: "nav-section", children: section.title }),
843
- section.items.map((item) => {
844
- const active = strongestMatch >= 0 && matchStrength(item, currentPath, homeHref) === strongestMatch;
845
- const Icon = item.icon;
846
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
847
- /* @__PURE__ */ jsx(NavStateIndicator, { active }),
848
- Icon && /* @__PURE__ */ jsx(Icon, { size: 18, strokeWidth: 1.75, className: "shrink-0" }),
849
- /* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 truncate", children: item.label })
850
- ] });
851
- const className2 = `nav-item ${active ? "active" : ""}`;
852
- return onNavigate ? /* @__PURE__ */ jsx(
853
- "a",
854
- {
855
- href: item.href,
856
- onClick: (e) => {
857
- e.preventDefault();
858
- onNavigate(item.href);
859
- onClose?.();
860
- },
861
- className: className2,
862
- children: content
863
- },
864
- item.href
865
- ) : /* @__PURE__ */ jsx(Link, { href: item.href, onClick: () => onClose?.(), className: className2, children: content }, item.href);
866
- })
867
- ] }, 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
+ ] }),
868
1031
  footer && /* @__PURE__ */ jsx("div", { className: "p-3 shrink-0", children: footer })
869
1032
  ]
870
1033
  }
@@ -952,26 +1115,35 @@ var TONES = {
952
1115
  red: SEMANTIC_TONES.error,
953
1116
  purple: SEMANTIC_TONES.accent
954
1117
  };
955
- 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 }) {
956
1119
  const toneCfg = tone ? TONES[tone] : void 0;
957
1120
  const showTopRow = Boolean(Icon || trend);
958
1121
  const surface = compact ? "card p-4" : "stat-card p-5";
959
- const topRow = showTopRow ? /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-4", children: [
960
- 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", {}),
961
- trend && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-xs font-medium", trend.positive ? "text-success" : "text-error"), children: [
962
- trend.positive ? /* @__PURE__ */ jsx(ArrowUpRight, { size: 14 }) : /* @__PURE__ */ jsx(ArrowDownRight, { size: 14 }),
963
- Math.abs(trend.value).toFixed(1),
964
- "%"
965
- ] })
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
+ )
966
1137
  ] }) : null;
967
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;
968
1140
  if (inline) {
969
1141
  return /* @__PURE__ */ jsxs("div", { className: cn("card p-4", toneCfg?.card, className), children: [
970
1142
  /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 text-sm", mutedInk), children: [
971
1143
  Icon && /* @__PURE__ */ jsx(Icon, { size: 18 }),
972
1144
  /* @__PURE__ */ jsx("span", { children: label })
973
1145
  ] }),
974
- /* @__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 })
975
1147
  ] });
976
1148
  }
977
1149
  if (valueFirst) {
@@ -982,9 +1154,9 @@ function StatCard({ icon: Icon, label, value, subtext, trend, tone, delay = 0, i
982
1154
  style: delay ? { animationDelay: `${delay}ms` } : void 0,
983
1155
  children: [
984
1156
  topRow,
985
- /* @__PURE__ */ jsx("div", { className: cn("text-2xl font-semibold mb-1", toneCfg?.value), children: value }),
1157
+ /* @__PURE__ */ jsx("div", { className: cn("yunui-stat-value text-2xl font-semibold mb-1", toneCfg?.value), children: value }),
986
1158
  /* @__PURE__ */ jsx("div", { className: cn("text-sm", mutedInk), children: label }),
987
- subtext && /* @__PURE__ */ jsx("div", { className: cn("text-xs mt-1", toneCfg ? "text-foreground/75" : "text-muted-foreground"), children: subtext })
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 })
988
1160
  ]
989
1161
  }
990
1162
  );
@@ -997,8 +1169,8 @@ function StatCard({ icon: Icon, label, value, subtext, trend, tone, delay = 0, i
997
1169
  children: [
998
1170
  topRow,
999
1171
  /* @__PURE__ */ jsx("div", { className: "text-label mb-1", children: label }),
1000
- /* @__PURE__ */ jsx("div", { className: cn("text-2xl font-semibold tracking-tight", toneCfg?.value), children: value }),
1001
- 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 })
1002
1174
  ]
1003
1175
  }
1004
1176
  );
@@ -1016,7 +1188,7 @@ function FellowsBanner({
1016
1188
  Link,
1017
1189
  {
1018
1190
  href,
1019
- 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}`,
1020
1192
  children: [
1021
1193
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
1022
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" }) }),
@@ -1353,7 +1525,7 @@ function MetricBar({ icon, label, value, percentage, color, className }) {
1353
1525
  "aria-valuenow": Math.max(0, Math.min(100, percentage)),
1354
1526
  "aria-valuemin": 0,
1355
1527
  "aria-valuemax": 100,
1356
- 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)",
1357
1529
  style: { width: `${Math.max(0, Math.min(100, percentage))}%`, backgroundColor: color }
1358
1530
  }
1359
1531
  ) })
@@ -1497,7 +1669,7 @@ function MediaBody({
1497
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(
1498
1670
  "div",
1499
1671
  {
1500
- className: "h-full bg-primary transition-all duration-300",
1672
+ className: "h-full bg-primary transition-[width] duration-(--dur-slow) ease-(--ease-standard)",
1501
1673
  style: { width: `${Math.min(item.progress, 95)}%` }
1502
1674
  }
1503
1675
  ) })
@@ -1572,7 +1744,7 @@ function MediaCard({
1572
1744
  ] })
1573
1745
  ] });
1574
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";
1575
- 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: [
1576
1748
  onDownload && /* @__PURE__ */ jsx(
1577
1749
  "button",
1578
1750
  {
@@ -1855,14 +2027,14 @@ function Banner({
1855
2027
  }) {
1856
2028
  const t = TONES2[tone];
1857
2029
  const resolvedIcon = icon === void 0 ? t.defaultIcon : icon;
1858
- 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: [
1859
2031
  resolvedIcon != null && /* @__PURE__ */ jsx("span", { className: cn("shrink-0", t.icon), "aria-hidden": "true", children: resolvedIcon }),
1860
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
2032
+ /* @__PURE__ */ jsxs("div", { className: "min-w-[10rem] flex-1", children: [
1861
2033
  /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", t.text), children: title }),
1862
2034
  description && /* @__PURE__ */ jsx("span", { className: cn("text-sm ml-2 hidden sm:inline opacity-70", t.text), children: description })
1863
2035
  ] }),
1864
2036
  meta != null && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground shrink-0", children: meta }),
1865
- actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0", children: actions }),
2037
+ actions && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 max-sm:w-full sm:shrink-0", children: actions }),
1866
2038
  dismissible && /* @__PURE__ */ jsx(
1867
2039
  "button",
1868
2040
  {
@@ -1929,7 +2101,7 @@ function NotificationItem({
1929
2101
  e.preventDefault();
1930
2102
  onDismiss?.();
1931
2103
  },
1932
- 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",
1933
2105
  children: /* @__PURE__ */ jsx(Trash2, { size: 12, className: "text-muted-foreground/40 hover:text-error" })
1934
2106
  }
1935
2107
  )
@@ -1952,7 +2124,7 @@ function NotificationPanel({
1952
2124
  "div",
1953
2125
  {
1954
2126
  className: cn(
1955
- "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",
1956
2128
  className
1957
2129
  ),
1958
2130
  children: [
@@ -1975,14 +2147,26 @@ function NotificationPanel({
1975
2147
  }
1976
2148
  );
1977
2149
  }
1978
- function SettingRow({ title, description, control, className }) {
1979
- return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4 py-3 border-b border-border last:border-0", className), children: [
1980
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1981
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: title }),
1982
- description && /* @__PURE__ */ jsx("div", { className: "text-xs text-(--text-tertiary) mt-0.5 leading-relaxed whitespace-normal wrap-break-word", children: description })
1983
- ] }),
1984
- control != null && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: control })
1985
- ] });
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
+ );
1986
2170
  }
1987
2171
  function SettingsShell({
1988
2172
  header,
@@ -2172,8 +2356,8 @@ function AvatarUploader({
2172
2356
  ),
2173
2357
  src ? (
2174
2358
  // eslint-disable-next-line @next/next/no-img-element
2175
- /* @__PURE__ */ jsx("img", { src, alt: "", className: "w-full h-full rounded-full object-cover ring-2 ring-border group-hover:ring-primary transition-all" })
2176
- ) : /* @__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 }),
2177
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" }) })
2178
2362
  ]
2179
2363
  }
@@ -2252,7 +2436,7 @@ function FeatureCard({
2252
2436
  {
2253
2437
  className: cn(
2254
2438
  "group relative h-full overflow-hidden rounded-2xl border border-border bg-card/50 p-8 shadow-sm backdrop-blur-xl",
2255
- "transition-all duration-300 hover:-translate-y-1 hover:shadow-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",
2256
2440
  delay != null && "animate-enter",
2257
2441
  className
2258
2442
  ),
@@ -2270,11 +2454,11 @@ function FeatureCard({
2270
2454
  "div",
2271
2455
  {
2272
2456
  "aria-hidden": true,
2273
- 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-500 group-hover:opacity-100"
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"
2274
2458
  }
2275
2459
  ),
2276
2460
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2277
- icon && /* @__PURE__ */ jsx("div", { className: "feature-icon mb-5 transition-transform duration-200 group-hover:scale-105", children: icon }),
2461
+ icon && /* @__PURE__ */ jsx("div", { className: "feature-icon mb-5 transition-transform duration-(--dur-base) group-hover:scale-105", children: icon }),
2278
2462
  /* @__PURE__ */ jsx("h3", { className: "heading-md mb-3", children: title }),
2279
2463
  description != null && /* @__PURE__ */ jsx("p", { className: "text-body leading-relaxed", children: description }),
2280
2464
  children
@@ -2301,7 +2485,7 @@ function MembershipCard({
2301
2485
  "group relative w-full max-w-md mx-auto lg:mx-0 aspect-[1.586/1] min-h-56 rounded-[20px]",
2302
2486
  "bg-foreground/80 backdrop-blur-2xl border border-background/15 text-background",
2303
2487
  "shadow-2xl overflow-hidden select-none animate-enter",
2304
- "transition-transform duration-300 hover:-translate-y-1",
2488
+ "transition-transform duration-(--dur-slow) hover:-translate-y-1",
2305
2489
  className
2306
2490
  ),
2307
2491
  ...props,
@@ -2634,7 +2818,7 @@ function DashboardPage({
2634
2818
  }
2635
2819
  function SectionRow({ title, action, className, ...props }) {
2636
2820
  return /* @__PURE__ */ jsxs("div", { className: cn("mb-4 flex items-center justify-between gap-3", className), ...props, children: [
2637
- /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold text-foreground", children: title }),
2821
+ /* @__PURE__ */ jsx("h2", { className: "yunui-section-title text-sm font-semibold text-foreground", children: title }),
2638
2822
  action
2639
2823
  ] });
2640
2824
  }
@@ -2780,7 +2964,899 @@ function ArchiveCalendar({
2780
2964
  ] }, `${year}-${month}`);
2781
2965
  }) });
2782
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
+ }
2783
3859
 
2784
- export { AccountLockedCard, ActiveBadge, ArchiveCalendar, AudioPlayer, AuthShell, AvatarUploader, BackLink, BackgroundEffects, Banner, BlogCard, BlogPagination, BlogPostHeader, CTASection, CapabilityBadge, CategoryFilter, CodeBlock, CodeDemo, ConnectedAccountRow, DashboardPage, DeprecatedBadge, ErrorBoundary, Eyebrow, FAQ, FeatureCard, FeatureLockedState, FellowBadge, FellowsBanner, HeroAccent, LLMCopyButton, LinkRow, MarketingHero, MediaEmptyState, MediaErrorState, MediaGallery, 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, TableState, 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 };
2785
3861
  //# sourceMappingURL=patterns.js.map
2786
3862
  //# sourceMappingURL=patterns.js.map