@kitn.ai/ui 0.20.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/README.md +44 -45
  2. package/dist/components/artifact-card.d.ts +51 -0
  3. package/dist/components/artifact.d.ts +1 -1
  4. package/dist/components/attachments.d.ts +2 -2
  5. package/dist/components/audio-visualizer/index.d.ts +3 -3
  6. package/dist/components/audio-visualizer/labs/lab-choreography.d.ts +59 -0
  7. package/dist/components/audio-visualizer/labs/lab-shaders.d.ts +22 -0
  8. package/dist/components/audio-visualizer/labs/lab-visualizer.d.ts +18 -0
  9. package/dist/components/audio-visualizer/variant-aurora.d.ts +2 -2
  10. package/dist/components/audio-visualizer/variant-bar.d.ts +2 -2
  11. package/dist/components/audio-visualizer/variant-custom.d.ts +2 -2
  12. package/dist/components/audio-visualizer/variant-grid.d.ts +1 -1
  13. package/dist/components/audio-visualizer/variant-radial.d.ts +1 -1
  14. package/dist/components/audio-visualizer/variant-wave.d.ts +1 -1
  15. package/dist/components/card-fallback.d.ts +12 -2
  16. package/dist/components/card-renderer.d.ts +63 -2
  17. package/dist/components/chat-container.d.ts +3 -0
  18. package/dist/components/chat-scope-picker.d.ts +2 -2
  19. package/dist/components/chat-thread.d.ts +77 -18
  20. package/dist/components/choice-card.d.ts +3 -28
  21. package/dist/components/composer-dom.d.ts +1 -1
  22. package/dist/components/composer-highlight.d.ts +1 -1
  23. package/dist/components/composer-history.d.ts +1 -1
  24. package/dist/components/composer.d.ts +1 -1
  25. package/dist/components/confirm-card.d.ts +3 -18
  26. package/dist/components/context.d.ts +8 -4
  27. package/dist/components/conversation-item.d.ts +1 -1
  28. package/dist/components/conversation-list.d.ts +4 -3
  29. package/dist/components/embed.d.ts +3 -3
  30. package/dist/components/file-tree.d.ts +11 -22
  31. package/dist/components/form-widgets.d.ts +1 -1
  32. package/dist/components/form.d.ts +3 -44
  33. package/dist/components/link-preview.d.ts +3 -3
  34. package/dist/components/loader.d.ts +30 -48
  35. package/dist/components/message-skills.d.ts +4 -0
  36. package/dist/components/message.d.ts +84 -21
  37. package/dist/components/model-switcher.d.ts +2 -2
  38. package/dist/components/prompt-input.d.ts +2 -2
  39. package/dist/components/response-compare-types.d.ts +11 -2
  40. package/dist/components/response-compare.d.ts +3 -3
  41. package/dist/components/source.d.ts +12 -3
  42. package/dist/components/tasks-card.d.ts +3 -31
  43. package/dist/components/thread.d.ts +17 -5
  44. package/dist/components/toast.d.ts +2 -2
  45. package/dist/components/tool-classify.d.ts +8 -0
  46. package/dist/components/tool-types.d.ts +29 -1
  47. package/dist/components/tool.d.ts +3 -3
  48. package/dist/components/use-card-resolution.d.ts +1 -1
  49. package/dist/create-tween-COnPwAQN.js +338 -0
  50. package/dist/create-tween-DmTUaXWE.js +341 -0
  51. package/dist/create-tween-qs-jjvNA.js +7 -0
  52. package/dist/custom-elements.json +1726 -463
  53. package/dist/elements/agent-card.js +1 -1
  54. package/dist/elements/artifact.js +1 -1
  55. package/dist/elements/attachments.js +1 -1
  56. package/dist/elements/audio-visualizer.js +1 -1
  57. package/dist/elements/avatar.js +1 -1
  58. package/dist/elements/badge.js +1 -1
  59. package/dist/elements/button.js +1 -1
  60. package/dist/elements/card.js +1 -1
  61. package/dist/elements/cards.js +1 -1
  62. package/dist/elements/chain-of-thought.js +1 -1
  63. package/dist/elements/chat-scope-picker.js +1 -1
  64. package/dist/elements/chat-types.d.ts +70 -10
  65. package/dist/elements/chat-workspace.js +1 -1
  66. package/dist/elements/chat.js +1 -1
  67. package/dist/elements/checkpoint.js +1 -1
  68. package/dist/elements/choice.js +1 -1
  69. package/dist/elements/chunks/{Icon-Tj58ES_d.js → Icon-CHG5z5L7.js} +1 -1
  70. package/dist/elements/chunks/{action-icons-ns1Fnedj.js → action-icons-BAtCEEgg.js} +1 -1
  71. package/dist/elements/chunks/arrow-left-CFPTeL1Y.js +1 -0
  72. package/dist/elements/chunks/artifact-fBZOE4SO.js +1 -0
  73. package/dist/elements/chunks/{attachments-mCB5F1Fq.js → attachments-DpYMe5VQ.js} +1 -1
  74. package/dist/elements/chunks/audio-visualizer-DFwzAcuL.js +1 -0
  75. package/dist/elements/chunks/{badge-B4Zuajl2.js → badge-D6zodm6E.js} +1 -1
  76. package/dist/elements/chunks/{button-ZWNif3--.js → button-C42vrGvO.js} +1 -1
  77. package/dist/elements/chunks/card-renderer-DMZsSuvU.js +1 -0
  78. package/dist/elements/chunks/card-tags-D8lZ-C_U.js +1 -0
  79. package/dist/elements/chunks/chat-thread-CNNEhol-.js +1 -0
  80. package/dist/elements/chunks/check-7Q3K-iXE.js +1 -0
  81. package/dist/elements/chunks/chevron-down-CpNYLn7E.js +1 -0
  82. package/dist/elements/chunks/chevron-right-DrH85Fha.js +1 -0
  83. package/dist/elements/chunks/choice-card-YoWjpsFV.js +1 -0
  84. package/dist/elements/chunks/circle-C9KRjKYv.js +1 -0
  85. package/dist/elements/chunks/circle-check-Dmi7Y4zw.js +1 -0
  86. package/dist/elements/chunks/{circle-x-B7faJFlY.js → circle-x-QIxXda6k.js} +1 -1
  87. package/dist/elements/chunks/code-block-CqeugReY.js +1 -0
  88. package/dist/elements/chunks/{collapsible-DM1Ckd4e.js → collapsible-sTv-_5lF.js} +1 -1
  89. package/dist/elements/chunks/{composer-BguS0QL_.js → composer-ldQyeVEB.js} +2 -2
  90. package/dist/elements/chunks/confirm-card-C0RNOwfn.js +1 -0
  91. package/dist/elements/chunks/context-5qgypNHC.js +1 -0
  92. package/dist/elements/chunks/conversation-list-DLzOacXz.js +1 -0
  93. package/dist/elements/chunks/create-tween-V4TXZ93X.js +7 -0
  94. package/dist/elements/chunks/default-input-DeeRSDHc.js +1 -0
  95. package/dist/elements/chunks/define-lE-QvQFn.js +1 -0
  96. package/dist/elements/chunks/{disclosure-CIZ5c8nO.js → disclosure-DZSa9jog.js} +1 -1
  97. package/dist/elements/chunks/{download-Dsbg3ste.js → download-B2ZmnGqW.js} +1 -1
  98. package/dist/elements/chunks/{dropdown-BDd1-Zgi.js → dropdown-R3B7cSRE.js} +1 -1
  99. package/dist/elements/chunks/{ellipsis-Dw6qrss-.js → ellipsis-BmxceY4l.js} +1 -1
  100. package/dist/elements/chunks/embed-BVrtTZPo.js +1 -0
  101. package/dist/elements/chunks/{external-link-Vt74zAoL.js → external-link-BbdR7YO7.js} +1 -1
  102. package/dist/elements/chunks/{file-text-CZrZF6_v.js → file-text-D7dijo1A.js} +1 -1
  103. package/dist/elements/chunks/{file-tree-DF4okKyo.js → file-tree-0upJ5jeb.js} +1 -1
  104. package/dist/elements/chunks/{folder-glP5rha4.js → folder-D8z58t7B.js} +1 -1
  105. package/dist/elements/chunks/form-p5BKJNw5.js +1 -0
  106. package/dist/elements/chunks/hover-card-CN9s2md5.js +1 -0
  107. package/dist/elements/chunks/{icon-BLb8beoi.js → icon-CNiKP37E.js} +1 -1
  108. package/dist/elements/chunks/{info-CIsv92JK.js → info-BSnuJiHI.js} +1 -1
  109. package/dist/elements/chunks/{input-Dds1kFyt.js → input-BauDmzxX.js} +1 -1
  110. package/dist/elements/chunks/{kbd-De_xbgi9.js → kbd-BlHJaP9b.js} +1 -1
  111. package/dist/elements/chunks/{link-i4r_k7z4.js → link-DEi5iUWC.js} +1 -1
  112. package/dist/elements/chunks/link-preview-BaHyM6W4.js +1 -0
  113. package/dist/elements/chunks/{loader-BmQH4s3V.js → loader-CmJG_Fkq.js} +1 -1
  114. package/dist/elements/chunks/{markdown-Zi21WhUz.js → markdown-D2jaMpCN.js} +1 -1
  115. package/dist/elements/chunks/message-C5UfXZ2Z.js +1 -0
  116. package/dist/elements/chunks/message-CXWLmmLn.js +1 -0
  117. package/dist/elements/chunks/message-square-hXylwsy0.js +1 -0
  118. package/dist/elements/chunks/{minimize-2--ifeCGrl.js → minimize-2-C9ytZFMU.js} +1 -1
  119. package/dist/elements/chunks/model-switcher-CivGfD7-.js +1 -0
  120. package/dist/elements/chunks/{overlay-kD8dwRv_.js → overlay-DJL_sbOm.js} +1 -1
  121. package/dist/elements/chunks/{paperclip-q21dYOSK.js → paperclip-CFaB8naM.js} +1 -1
  122. package/dist/elements/chunks/{progress-bar-BrAIIaaJ.js → progress-bar-Br5SksfR.js} +1 -1
  123. package/dist/elements/chunks/{prompt-suggestion-Bjn2K-fR.js → prompt-suggestion-CMIvtAhU.js} +1 -1
  124. package/dist/elements/chunks/reasoning-DpZcNzLq.js +1 -0
  125. package/dist/elements/chunks/{resizable-Dp4JExql.js → resizable-Q8i3T9a_.js} +1 -1
  126. package/dist/elements/chunks/{rotate-cw-CFWWkpj2.js → rotate-cw-B5IHCBFV.js} +1 -1
  127. package/dist/elements/chunks/{scroll-area-Bb0kHH1j.js → scroll-area-eLeydBje.js} +1 -1
  128. package/dist/elements/chunks/scroll-button-DWbz0yA1.js +1 -0
  129. package/dist/elements/chunks/{separator-9kRgr1X9.js → separator-Xic78AD_.js} +1 -1
  130. package/dist/elements/chunks/{settings-B8lmec4D.js → settings-B8H51pAx.js} +1 -1
  131. package/dist/elements/chunks/{settings-group-I0hEuXiN.js → settings-group-CsG9eYLe.js} +1 -1
  132. package/dist/elements/chunks/{share-C3lTiYGt.js → share-CNTx0z__.js} +1 -1
  133. package/dist/elements/chunks/skeleton-CLlHTcMI.js +1 -0
  134. package/dist/elements/chunks/slots-CIw9RlAe.js +1 -0
  135. package/dist/elements/chunks/source-BoVcU5ok.js +1 -0
  136. package/dist/elements/chunks/{star-CSJtGxgv.js → star-CxQVTVhI.js} +1 -1
  137. package/dist/elements/chunks/{store-CHyW95TP.js → store-CLtS5CUG.js} +1 -1
  138. package/dist/elements/chunks/tasks-card-CzlkLmUt.js +1 -0
  139. package/dist/elements/chunks/{text-shimmer-Cn9TmNpI.js → text-shimmer-D5NhpIQ1.js} +1 -1
  140. package/dist/elements/chunks/textarea-x5Uxsmtm.js +1 -0
  141. package/dist/elements/chunks/{thumbs-up-PNVVThEF.js → thumbs-up-UobcJnx9.js} +1 -1
  142. package/dist/elements/chunks/{toast-store-DKbQn3Wn.js → toast-store-BOfs9eXq.js} +1 -1
  143. package/dist/elements/chunks/{tool-DjTRpIpl.js → tool-Be6Dh_dt.js} +1 -1
  144. package/dist/elements/chunks/tooltip-RxMxyCLF.js +1 -0
  145. package/dist/elements/chunks/{triangle-alert-DsHTHCPm.js → triangle-alert-C4yxH2XN.js} +1 -1
  146. package/dist/elements/chunks/use-card-resolution-jva9ehH6.js +1 -0
  147. package/dist/elements/chunks/{variant-aurora-Dc4nQUia.js → variant-aurora-Dx4VRcjS.js} +2 -2
  148. package/dist/elements/chunks/{variant-custom-y_3kVQhS.js → variant-custom-Y1ZTWgEa.js} +1 -1
  149. package/dist/elements/chunks/{variant-wave-D5OR1-9Z.js → variant-wave-B9gml9Cg.js} +2 -2
  150. package/dist/elements/chunks/{video-B7vmenoC.js → video-CrPHsytT.js} +1 -1
  151. package/dist/elements/chunks/x-_-OPHept.js +1 -0
  152. package/dist/elements/coachmark.js +1 -1
  153. package/dist/elements/code-block.js +1 -1
  154. package/dist/elements/command.js +1 -1
  155. package/dist/elements/compare.js +1 -1
  156. package/dist/elements/composer.js +1 -1
  157. package/dist/elements/confirm-card.js +1 -1
  158. package/dist/elements/context-meter.js +1 -1
  159. package/dist/elements/conversation-list.js +1 -1
  160. package/dist/elements/default-input.d.ts +34 -7
  161. package/dist/elements/define.d.ts +1 -0
  162. package/dist/elements/dialog.js +1 -1
  163. package/dist/elements/disclosure.d.ts +1 -1
  164. package/dist/elements/editable-label.js +1 -1
  165. package/dist/elements/element-data-types.d.ts +107 -0
  166. package/dist/elements/embed.js +1 -1
  167. package/dist/elements/empty.js +1 -1
  168. package/dist/elements/feedback-bar.js +1 -1
  169. package/dist/elements/file-tree.js +1 -1
  170. package/dist/elements/file-upload.js +1 -1
  171. package/dist/elements/form.js +1 -1
  172. package/dist/elements/hover-card.js +1 -1
  173. package/dist/elements/icon.js +1 -1
  174. package/dist/elements/image.js +1 -1
  175. package/dist/elements/input.js +1 -1
  176. package/dist/elements/kbd.js +1 -1
  177. package/dist/elements/link-preview.js +1 -1
  178. package/dist/elements/loader.js +1 -1
  179. package/dist/elements/markdown.js +1 -1
  180. package/dist/elements/menu.js +1 -1
  181. package/dist/elements/message-skills.js +1 -1
  182. package/dist/elements/message.js +1 -1
  183. package/dist/elements/model-switcher.js +1 -1
  184. package/dist/elements/nav.js +1 -1
  185. package/dist/elements/notice.js +1 -1
  186. package/dist/elements/pane-group.js +1 -1
  187. package/dist/elements/pane.js +1 -1
  188. package/dist/elements/popover.js +1 -1
  189. package/dist/elements/progress-bar.js +1 -1
  190. package/dist/elements/prompt-dock.js +1 -1
  191. package/dist/elements/prompt-input.js +1 -1
  192. package/dist/elements/prompt-suggestions.js +1 -1
  193. package/dist/elements/reasoning.js +1 -1
  194. package/dist/elements/register.d.ts +8 -6
  195. package/dist/elements/remote.js +1 -1
  196. package/dist/elements/resizable.js +1 -1
  197. package/dist/elements/response-stream.js +1 -1
  198. package/dist/elements/screen.js +1 -1
  199. package/dist/elements/scroll-area.js +1 -1
  200. package/dist/elements/scroll-button.js +1 -1
  201. package/dist/elements/search.js +1 -1
  202. package/dist/elements/segmented.js +1 -1
  203. package/dist/elements/separator.js +1 -1
  204. package/dist/elements/setting-item.js +1 -1
  205. package/dist/elements/settings-group.js +1 -1
  206. package/dist/elements/skeleton.js +1 -1
  207. package/dist/elements/slot-text.d.ts +51 -0
  208. package/dist/elements/slots.d.ts +21 -0
  209. package/dist/elements/source.js +1 -1
  210. package/dist/elements/status.js +1 -1
  211. package/dist/elements/switch.js +1 -1
  212. package/dist/elements/tabs.js +1 -1
  213. package/dist/elements/tasks.js +1 -1
  214. package/dist/elements/text-shimmer.js +1 -1
  215. package/dist/elements/thinking-bar.js +1 -1
  216. package/dist/elements/thread.js +1 -1
  217. package/dist/elements/toast.js +1 -1
  218. package/dist/elements/tool.js +1 -1
  219. package/dist/elements/tooltip.js +1 -1
  220. package/dist/elements/validate-messages.d.ts +25 -0
  221. package/dist/elements/voice-input.js +1 -1
  222. package/dist/elements/voice-output.js +1 -1
  223. package/dist/elements.d.ts +2734 -217
  224. package/dist/index.d.ts +163 -125
  225. package/dist/index.js +6572 -5990
  226. package/dist/index.server.d.ts +5 -0
  227. package/dist/index.server.js +5403 -4860
  228. package/dist/kai-provider.es.d.ts +5 -0
  229. package/dist/kai-provider.es.js +79 -77
  230. package/dist/kai.es.d.ts +5 -0
  231. package/dist/kai.es.js +1 -1
  232. package/dist/llms/llms-full.txt +774 -151
  233. package/dist/llms/llms.txt +57 -5
  234. package/dist/mcp.es.js +4756 -782
  235. package/dist/primitives/card-component-types.d.ts +11 -0
  236. package/dist/primitives/card-data-types.d.ts +196 -0
  237. package/dist/primitives/card-host.d.ts +1 -1
  238. package/dist/primitives/card-recovery.d.ts +3 -3
  239. package/dist/primitives/card-registry.d.ts +4 -14
  240. package/dist/primitives/card-resolution.d.ts +1 -1
  241. package/dist/primitives/card-routing.d.ts +1 -1
  242. package/dist/primitives/card-tags.d.ts +11 -0
  243. package/dist/primitives/card-validate-cards.d.ts +57 -0
  244. package/dist/primitives/card-validate-generator.testlib.d.ts +20 -0
  245. package/dist/primitives/card-validate-schemas.d.ts +17 -0
  246. package/dist/primitives/card-validate.d.ts +24 -0
  247. package/dist/primitives/create-kai-chat.d.ts +3 -3
  248. package/dist/primitives/embed-providers.d.ts +1 -1
  249. package/dist/primitives/link-preview.d.ts +1 -1
  250. package/dist/primitives/message-feedback.d.ts +2 -2
  251. package/dist/primitives/toast-store.d.ts +1 -1
  252. package/dist/react/index.d.ts +730 -302
  253. package/dist/react/use-kai-chat.d.ts +8 -4
  254. package/dist/react.d.ts +5 -0
  255. package/dist/react.js +418 -317
  256. package/dist/register-impl-AxIlqjo7.js +145 -0
  257. package/dist/remote/host-embed.d.ts +1 -1
  258. package/dist/remote/index.d.ts +2 -2
  259. package/dist/remote/provider-runtime.d.ts +2 -2
  260. package/dist/remote/provider.d.ts +2 -2
  261. package/dist/remote/validate.d.ts +1 -1
  262. package/dist/remote/wire.d.ts +1 -1
  263. package/dist/schemas/artifact.schema.json +92 -0
  264. package/dist/schemas/embed.schema.json +0 -2
  265. package/dist/schemas/from-tool-call.d.ts +48 -0
  266. package/dist/schemas/index.d.ts +48 -0
  267. package/dist/schemas/link.schema.json +0 -2
  268. package/dist/schemas/provider-subsets.d.ts +136 -0
  269. package/dist/schemas/registry.d.ts +140 -0
  270. package/dist/schemas/tool-defs.d.ts +121 -0
  271. package/dist/schemas.d.ts +5 -0
  272. package/dist/schemas.js +717 -0
  273. package/dist/solid-BGYSJyHG.js +22960 -0
  274. package/dist/solid-Dt2nEwfl.js +20194 -0
  275. package/dist/solid.d.ts +66 -0
  276. package/dist/solid.js +261 -0
  277. package/dist/solid.server.d.ts +5 -0
  278. package/dist/solid.server.js +261 -0
  279. package/dist/state/index.d.ts +14 -4
  280. package/dist/state/messages.d.ts +8 -3
  281. package/dist/state/mock.d.ts +46 -0
  282. package/dist/state/parts.d.ts +85 -0
  283. package/dist/state/stream.d.ts +15 -9
  284. package/dist/state.d.ts +5 -0
  285. package/dist/state.js +253 -84
  286. package/dist/ui/action-icons.d.ts +1 -1
  287. package/dist/ui/collapsible.d.ts +11 -6
  288. package/dist/ui/dropdown.d.ts +47 -42
  289. package/dist/ui/pane-group.d.ts +1 -1
  290. package/dist/{variant-aurora-DVtGqVH6.js → variant-aurora-B44X69AG.js} +1 -1
  291. package/dist/variant-aurora-BRhV8Flk.js +391 -0
  292. package/dist/variant-aurora-Ds5ou9BH.js +381 -0
  293. package/dist/variant-custom-B20FhtYj.js +170 -0
  294. package/dist/{variant-custom-Dif-IV4u.js → variant-custom-BvA1Schl.js} +1 -1
  295. package/dist/variant-custom-D6Rtvneb.js +200 -0
  296. package/dist/{variant-wave-DbfNdvSi.js → variant-wave-BUQtkryq.js} +1 -1
  297. package/dist/variant-wave-BVYnqy9L.js +218 -0
  298. package/dist/variant-wave-DXC6_LcH.js +208 -0
  299. package/dist/wire/chunk.d.ts +171 -0
  300. package/dist/wire/consume.d.ts +26 -0
  301. package/dist/wire/encode.d.ts +221 -0
  302. package/dist/wire/files.d.ts +116 -0
  303. package/dist/wire/formats/anthropic.d.ts +2 -0
  304. package/dist/wire/formats/openai.d.ts +5 -0
  305. package/dist/wire/index.d.ts +16 -0
  306. package/dist/wire/media-types.d.ts +106 -0
  307. package/dist/wire/read.d.ts +26 -0
  308. package/dist/wire/sink-helpers.d.ts +21 -0
  309. package/dist/wire/sse.d.ts +33 -0
  310. package/dist/wire.d.ts +5 -53
  311. package/dist/wire.js +1126 -0
  312. package/frameworks/react/index.tsx +191 -158
  313. package/frameworks/react/runtime.tsx +21 -1
  314. package/frameworks/react/use-kai-chat.tsx +11 -1
  315. package/llms-full.txt +774 -151
  316. package/llms.txt +57 -5
  317. package/package.json +62 -8
  318. package/src/agent-tooling/archetypes.ts +127 -0
  319. package/src/agent-tooling/integrations/anthropic.ts +436 -0
  320. package/src/agent-tooling/integrations/cloudflare.ts +141 -52
  321. package/src/agent-tooling/integrations/langgraph.ts +80 -13
  322. package/src/agent-tooling/integrations/mastra.ts +161 -12
  323. package/src/agent-tooling/integrations/mock.ts +47 -8
  324. package/src/agent-tooling/integrations/ollama.ts +68 -24
  325. package/src/agent-tooling/integrations/openai.ts +89 -0
  326. package/src/agent-tooling/integrations/openrouter.ts +58 -8
  327. package/src/agent-tooling/integrations/pi.ts +104 -23
  328. package/src/agent-tooling/integrations/pydantic-ai.ts +61 -5
  329. package/src/agent-tooling/integrations/vercel-ai-sdk.ts +120 -13
  330. package/src/agent-tooling/mcp/manifest.ts +206 -25
  331. package/src/agent-tooling/mcp/tools/debug.ts +13 -7
  332. package/src/agent-tooling/mcp/tools/reference.ts +285 -6
  333. package/src/agent-tooling/mcp/tools/scaffold.ts +4152 -661
  334. package/src/agent-tooling/registry.ts +74 -0
  335. package/src/agent-tooling/types.ts +361 -1
  336. package/src/components/artifact-card.tsx +120 -0
  337. package/src/components/audio-visualizer/index.tsx +9 -0
  338. package/src/components/audio-visualizer/labs/lab-choreography.ts +187 -0
  339. package/src/components/audio-visualizer/labs/lab-shaders.ts +363 -0
  340. package/src/components/audio-visualizer/labs/lab-visualizer.tsx +102 -0
  341. package/src/components/audio-visualizer/shader-canvas.tsx +31 -1
  342. package/src/components/card-fallback.tsx +42 -10
  343. package/src/components/card-renderer.tsx +146 -9
  344. package/src/components/chat-container.tsx +4 -0
  345. package/src/components/chat-thread.tsx +128 -52
  346. package/src/components/choice-card.tsx +17 -29
  347. package/src/components/composer.tsx +12 -2
  348. package/src/components/confirm-card.tsx +24 -20
  349. package/src/components/context.tsx +30 -16
  350. package/src/components/conversation-item.tsx +6 -0
  351. package/src/components/conversation-list.tsx +18 -2
  352. package/src/components/file-tree.tsx +11 -22
  353. package/src/components/file-upload.tsx +14 -8
  354. package/src/components/form.tsx +14 -47
  355. package/src/components/loader.tsx +39 -12
  356. package/src/components/message-skills.tsx +4 -0
  357. package/src/components/message.tsx +294 -46
  358. package/src/components/model-switcher.tsx +38 -8
  359. package/src/components/reasoning.tsx +92 -5
  360. package/src/components/response-compare-types.ts +25 -0
  361. package/src/components/response-compare.tsx +4 -9
  362. package/src/components/source.tsx +50 -24
  363. package/src/components/tasks-card.tsx +10 -33
  364. package/src/components/thread.tsx +84 -42
  365. package/src/components/toast.tsx +17 -6
  366. package/src/components/tool-classify.ts +26 -0
  367. package/src/components/tool-types.ts +31 -1
  368. package/src/elements/agent-card.tsx +11 -11
  369. package/src/elements/artifact.tsx +15 -7
  370. package/src/elements/attachments.tsx +6 -4
  371. package/src/elements/avatar.tsx +1 -1
  372. package/src/elements/button.tsx +29 -6
  373. package/src/elements/card.tsx +2 -2
  374. package/src/elements/cards.tsx +109 -14
  375. package/src/elements/chain-of-thought.tsx +14 -10
  376. package/src/elements/chat-scope-picker.tsx +9 -7
  377. package/src/elements/chat-types.ts +59 -6
  378. package/src/elements/chat-workspace.tsx +50 -9
  379. package/src/elements/chat.tsx +90 -3
  380. package/src/elements/choice.tsx +8 -8
  381. package/src/elements/coachmark.tsx +1 -1
  382. package/src/elements/command.tsx +8 -23
  383. package/src/elements/compare.tsx +7 -6
  384. package/src/elements/compiled.css +1 -1
  385. package/src/elements/composer.tsx +8 -8
  386. package/src/elements/confirm-card.tsx +9 -9
  387. package/src/elements/context-meter.tsx +4 -18
  388. package/src/elements/conversation-list.tsx +14 -9
  389. package/src/elements/default-input.tsx +131 -8
  390. package/src/elements/define.tsx +178 -43
  391. package/src/elements/editable-label.tsx +17 -2
  392. package/src/elements/element-data-types.ts +112 -0
  393. package/src/elements/element-meta.json +1624 -306
  394. package/src/elements/element-types.d.ts +2645 -214
  395. package/src/elements/feedback-bar.tsx +1 -1
  396. package/src/elements/file-tree.tsx +1 -1
  397. package/src/elements/file-upload.tsx +1 -1
  398. package/src/elements/form.tsx +14 -6
  399. package/src/elements/input.tsx +1 -1
  400. package/src/elements/kbd.tsx +1 -1
  401. package/src/elements/menu.tsx +40 -32
  402. package/src/elements/message-skills.tsx +7 -9
  403. package/src/elements/message.tsx +200 -32
  404. package/src/elements/model-switcher.tsx +5 -3
  405. package/src/elements/pane.tsx +1 -1
  406. package/src/elements/prompt-dock.tsx +8 -8
  407. package/src/elements/prompt-input.tsx +10 -10
  408. package/src/elements/prompt-suggestions.tsx +7 -4
  409. package/src/elements/reasoning.tsx +1 -1
  410. package/src/elements/register.ts +9 -0
  411. package/src/elements/resizable.globals.d.ts +36 -0
  412. package/src/elements/resizable.tsx +24 -13
  413. package/src/elements/response-stream.tsx +1 -1
  414. package/src/elements/scroll-button.tsx +1 -1
  415. package/src/elements/search.tsx +6 -1
  416. package/src/elements/segmented.tsx +5 -11
  417. package/src/elements/separator.tsx +1 -1
  418. package/src/elements/slot-text.ts +73 -0
  419. package/src/elements/slots.ts +67 -24
  420. package/src/elements/source.tsx +21 -22
  421. package/src/elements/switch.tsx +3 -3
  422. package/src/elements/tasks.tsx +5 -4
  423. package/src/elements/thread.tsx +36 -4
  424. package/src/elements/toast.tsx +3 -2
  425. package/src/elements/tool.tsx +1 -1
  426. package/src/elements/validate-messages.ts +76 -0
  427. package/src/elements/voice-input.tsx +7 -7
  428. package/src/elements/voice-output.tsx +4 -4
  429. package/src/index.ts +145 -6
  430. package/src/primitives/card-component-types.ts +63 -0
  431. package/src/primitives/card-data-types.ts +312 -0
  432. package/src/primitives/card-recovery.ts +13 -2
  433. package/src/primitives/card-registry.tsx +34 -23
  434. package/src/primitives/card-schemas/artifact.schema.json +92 -0
  435. package/src/primitives/card-schemas/embed.schema.json +0 -2
  436. package/src/primitives/card-schemas/link.schema.json +0 -2
  437. package/src/primitives/card-tags.ts +61 -0
  438. package/src/primitives/card-validate-cards.ts +255 -0
  439. package/src/primitives/card-validate-generator.testlib.ts +38 -0
  440. package/src/primitives/card-validate-schemas.ts +58 -0
  441. package/src/primitives/card-validate.ts +48 -20
  442. package/src/primitives/create-tween.ts +54 -2
  443. package/src/primitives/message-feedback.ts +3 -2
  444. package/src/primitives/use-audio-analysis.ts +20 -1
  445. package/src/primitives/use-sequencer.ts +20 -1
  446. package/src/schemas/from-tool-call.ts +151 -0
  447. package/src/schemas/index.ts +340 -0
  448. package/src/schemas/provider-subsets.ts +538 -0
  449. package/src/schemas/registry.ts +355 -0
  450. package/src/schemas/tool-defs.ts +492 -0
  451. package/src/solid.ts +150 -0
  452. package/src/state/index.ts +27 -1
  453. package/src/state/messages.ts +21 -4
  454. package/src/state/mock.ts +211 -0
  455. package/src/state/parts.ts +295 -0
  456. package/src/state/stream.ts +56 -58
  457. package/src/ui/collapsible.tsx +17 -5
  458. package/src/ui/dropdown.tsx +46 -12
  459. package/src/ui/overlay.tsx +10 -4
  460. package/src/wire/chunk.ts +201 -0
  461. package/src/wire/consume.ts +440 -0
  462. package/src/wire/encode.ts +689 -0
  463. package/src/wire/files.ts +342 -0
  464. package/src/wire/formats/anthropic.ts +267 -0
  465. package/src/wire/formats/openai.ts +187 -0
  466. package/src/wire/index.ts +73 -0
  467. package/src/wire/media-types.ts +344 -0
  468. package/src/wire/read.ts +152 -0
  469. package/src/wire/sink-helpers.ts +50 -0
  470. package/src/wire/sse.ts +140 -0
  471. package/dist/create-tween-hvpmSuwW.js +0 -7
  472. package/dist/elements/chunks/arrow-left-DQocUFvy.js +0 -1
  473. package/dist/elements/chunks/audio-visualizer-BqNy7dfm.js +0 -1
  474. package/dist/elements/chunks/card-BkHbp4BA.js +0 -1
  475. package/dist/elements/chunks/chat-thread-CkRN6pZ7.js +0 -1
  476. package/dist/elements/chunks/check-B9-gn6SS.js +0 -1
  477. package/dist/elements/chunks/chevron-down-BNsxc2hk.js +0 -1
  478. package/dist/elements/chunks/chevron-right-Hv00StBO.js +0 -1
  479. package/dist/elements/chunks/circle-0e3KJTDr.js +0 -1
  480. package/dist/elements/chunks/circle-check-BNAS0JEy.js +0 -1
  481. package/dist/elements/chunks/code-block-BFUHn6Va.js +0 -1
  482. package/dist/elements/chunks/context-Cb7k4F-v.js +0 -1
  483. package/dist/elements/chunks/conversation-list-CvoAkWhN.js +0 -1
  484. package/dist/elements/chunks/create-tween-oVvAIG8r.js +0 -7
  485. package/dist/elements/chunks/default-input-Cqqilg9t.js +0 -1
  486. package/dist/elements/chunks/define-D1din7Ld.js +0 -1
  487. package/dist/elements/chunks/hover-card-Cmm6Q53m.js +0 -1
  488. package/dist/elements/chunks/message-BqyXDN3-.js +0 -1
  489. package/dist/elements/chunks/message-feedback-Djr3z6Yb.js +0 -1
  490. package/dist/elements/chunks/message-square-vFAgbDaX.js +0 -1
  491. package/dist/elements/chunks/model-switcher-B94YAKsM.js +0 -1
  492. package/dist/elements/chunks/reasoning-DTpCGtnY.js +0 -1
  493. package/dist/elements/chunks/scroll-button-B0cH5fXf.js +0 -1
  494. package/dist/elements/chunks/skeleton-DSXW5Yya.js +0 -1
  495. package/dist/elements/chunks/slots--V19HwUb.js +0 -1
  496. package/dist/elements/chunks/textarea-CUwqAX0G.js +0 -1
  497. package/dist/elements/chunks/tooltip-CgBZCVKp.js +0 -1
  498. package/dist/elements/chunks/use-card-resolution-BSu_XHjH.js +0 -1
  499. package/dist/elements/chunks/x-GRUeeQFT.js +0 -1
  500. package/dist/host-embed.d.ts +0 -33
  501. package/dist/kai-provider.d.ts +0 -2
  502. package/dist/origin.d.ts +0 -5
  503. package/dist/provider-runtime.d.ts +0 -27
  504. package/dist/register-impl-DQyejdfb.js +0 -145
  505. package/dist/validate.d.ts +0 -4
  506. package/dist/version.d.ts +0 -4
  507. package/src/components/component-meta.json +0 -4550
  508. package/src/elements/card-media.jpg +0 -0
  509. package/src/elements/resizable.d.ts +0 -27
  510. package/src/elements/video-poster.jpg +0 -0
@@ -1,5 +1,5 @@
1
- import { DropdownController } from '../ui/dropdown';
2
- import { ModelOption } from '../types';
1
+ import { DropdownController } from '../ui/dropdown.js';
2
+ import { ModelOption } from '../types.js';
3
3
  export interface ModelSwitcherProps {
4
4
  models: ModelOption[];
5
5
  currentModelId: string;
@@ -1,6 +1,6 @@
1
1
  import { JSX } from 'solid-js';
2
- import { TriggerDef, ComposerChange } from './composer';
3
- import { ComposerDoc } from '../primitives/composer-model';
2
+ import { TriggerDef, ComposerChange } from './composer.js';
3
+ import { ComposerDoc } from '../primitives/composer-model.js';
4
4
  interface PromptInputContextType {
5
5
  isLoading: boolean;
6
6
  value: () => string | ComposerDoc;
@@ -1,5 +1,6 @@
1
- import { ToolPart } from './tool';
2
- import { AttachmentData } from './attachments';
1
+ import { ToolPart } from './tool.js';
2
+ import { AttachmentData } from './attachments.js';
3
+ import { MessagePart } from '../elements/chat-types.js';
3
4
  /** One assistant response in a comparison. Rendered identically to an assistant
4
5
  * message (reasoning + tools + attachments + markdown content) via `MessageBody`. */
5
6
  export interface CompareCandidate {
@@ -64,3 +65,11 @@ export declare function normalizeCandidates(candidates: unknown): {
64
65
  export declare function buildSelection(pair: ComparePair, chosenId: string): CompareSelection;
65
66
  /** Whether any candidate in the pair is still streaming (pick stays disabled). */
66
67
  export declare function isAnyStreaming(pair: ComparePair | null): boolean;
68
+ /** Map a `CompareCandidate`'s flat legacy fields (content/reasoning/tools/
69
+ * attachments) into the ordered `MessagePart[]` `MessageBody` now renders.
70
+ * `CompareCandidate` stays its own independent shape (it is `<kai-compare>`'s
71
+ * public `data` JSON, not a `ChatMessage`). This is purely a render-time
72
+ * adapter, applied at each `MessageBody` call site. Order: reasoning (the
73
+ * thinking trace) → tool calls (the actions taken) → attachments (anything
74
+ * produced) → the final text answer, mirroring how an assistant turn reads. */
75
+ export declare function candidateToParts(candidate: CompareCandidate): MessagePart[];
@@ -1,7 +1,7 @@
1
1
  import { JSX, Accessor } from 'solid-js';
2
- import { CompareSelection, ResponseCompareData } from './response-compare-types';
3
- export type { CompareCandidate, ComparePair, CompareCollapse, ResponseCompareData, CompareSelection, } from './response-compare-types';
4
- export { normalizeCandidates, buildSelection, isAnyStreaming } from './response-compare-types';
2
+ import { CompareSelection, ResponseCompareData } from './response-compare-types.js';
3
+ export type { CompareCandidate, ComparePair, CompareCollapse, ResponseCompareData, CompareSelection, } from './response-compare-types.js';
4
+ export { normalizeCandidates, buildSelection, isAnyStreaming, candidateToParts } from './response-compare-types.js';
5
5
  export type CompareLayout = 'auto' | 'columns' | 'tabs';
6
6
  /** Imperative handle exposed via `controllerRef` — surfaces the compare's latent
7
7
  * capabilities (commit a pick by candidate id, focus the roving tab stop) so the
@@ -1,6 +1,11 @@
1
1
  import { JSX } from 'solid-js';
2
2
  export interface SourceProps {
3
- href: string;
3
+ /** The citation's URL. OPTIONAL: every field of a model-produced citation is,
4
+ * so a source can arrive with a title and no url. In that case the chip
5
+ * renders as a plain, inert `<a>` with NO `href` attribute — which is valid
6
+ * HTML and simply not a link — rather than `<a href="">`, which would
7
+ * navigate to the current page. */
8
+ href?: string;
4
9
  children: JSX.Element;
5
10
  }
6
11
  declare function Source(props: SourceProps): JSX.Element;
@@ -16,8 +21,12 @@ export interface SourceContentProps {
16
21
  class?: string;
17
22
  }
18
23
  declare function SourceContent(props: SourceContentProps): JSX.Element;
19
- declare function SourceList(props: {
24
+ export interface SourceListProps {
20
25
  children: JSX.Element;
21
26
  class?: string;
22
- }): JSX.Element;
27
+ /** `::part` name(s) exposed on the row. The message body passes `"citations"`
28
+ * so consumers can target the citation row from outside the shadow boundary. */
29
+ part?: string;
30
+ }
31
+ declare function SourceList(props: SourceListProps): JSX.Element;
23
32
  export { Source, SourceTrigger, SourceContent, SourceList };
@@ -1,35 +1,7 @@
1
1
  import { JSX } from 'solid-js';
2
- import { CardEnvelope, CardHost, CardResolution } from '../primitives/card-contract';
3
- export interface TasksTask {
4
- id: string;
5
- label: string;
6
- description?: string;
7
- checked?: boolean;
8
- disabled?: boolean;
9
- }
10
- export interface TasksCardData {
11
- /**
12
- * `select` (default) = checkbox rows + a confirm button that emits the contract
13
- * `submit`. `progress` = an onboarding/checklist look: a header `done / total`
14
- * count, circular indicators, per-item title + muted description, and NO confirm
15
- * button (checking a row is itself the terminal action). Both share the same
16
- * selection model (toggle by id, the `max` gate, `kai-value-change`); `progress`
17
- * is purely a presentational variant.
18
- */
19
- mode?: 'select' | 'progress';
20
- heading?: string;
21
- tasks: TasksTask[];
22
- selectAll?: boolean;
23
- confirmLabel?: string;
24
- allowEmpty?: boolean;
25
- min?: number;
26
- max?: number;
27
- dismissible?: boolean;
28
- }
29
- export interface TasksCardResult {
30
- selected: string[];
31
- }
32
- export type TasksCardEnvelope = CardEnvelope<'tasks', TasksCardData>;
2
+ import { CardHost, CardResolution } from '../primitives/card-contract.js';
3
+ import { TasksCardData, TasksTask } from '../primitives/card-data-types.js';
4
+ export type { TasksCardData, TasksCardEnvelope, TasksCardResult, TasksTask, } from '../primitives/card-data-types.js';
33
5
  export declare const TASKS_CARD_TYPE: "tasks";
34
6
  /** De-dupe tasks by id (first wins). Returns the usable list + an optional error. */
35
7
  export declare function normalizeTasks(tasks: unknown): {
@@ -1,7 +1,9 @@
1
1
  import { JSX } from 'solid-js';
2
- import { MessageActionDetail } from '../primitives/message-feedback';
3
- import { ChatMessage } from '../elements/chat-types';
4
- import { ProseSize } from '../primitives/chat-config';
2
+ import { MessageActionDetail } from '../primitives/message-feedback.js';
3
+ import { ChatMessage } from '../elements/chat-types.js';
4
+ import { ProseSize } from '../primitives/chat-config.js';
5
+ import { CardComponentMap } from '../primitives/card-registry.js';
6
+ import { CardSchemaMap } from './card-renderer.js';
5
7
  /** Imperative handle exposed via `controllerRef` — the thread's scroll control,
6
8
  * forwarded onto `<kai-thread>` as the `scrollToBottom()` instance method. */
7
9
  export interface ThreadController {
@@ -12,9 +14,19 @@ export interface ThreadProps {
12
14
  /** Extra classes for the thread root (e.g. `rounded-xl`). */
13
15
  class?: string;
14
16
  /** The full message thread to render, newest last. Each entry carries its role,
15
- * content, and optional reasoning/tools/attachments/actions/avatar. A new array
16
- * reference per streaming chunk re-renders (mutating in place does not). */
17
+ * ordered `parts`, and optional actions/avatar/feedback. A new array reference
18
+ * per streaming chunk re-renders (mutating in place does not). */
17
19
  messages: ChatMessage[];
20
+ /** Add/override card type -> component entries, forwarded to `CardRenderer`
21
+ * for `card` parts. */
22
+ cardTypes?: CardComponentMap;
23
+ /** JSON Schemas for the card types this app renders, keyed by envelope type,
24
+ * forwarded to `CardRenderer` for `card` parts. The companion of `cardTypes`:
25
+ * that says what DRAWS a card, this says what a VALID one looks like.
26
+ * `createCardRegistry(...).validationSchemas` is exactly this shape. Without it
27
+ * the kit checks its own seven built-ins and leaves your own card type
28
+ * unvalidated. A schema here WINS over a built-in of the same name. */
29
+ cardSchemas?: CardSchemaMap;
18
30
  /** Show a typing indicator on the pending assistant turn — use while awaiting
19
31
  * the assistant's reply. */
20
32
  loading?: boolean;
@@ -1,4 +1,4 @@
1
- import { ToastItem, ToastVariant, ToastAppearance } from '../primitives/toast-store';
1
+ import { ToastItem, ToastVariant, ToastAppearance } from '../primitives/toast-store.js';
2
2
  export type { ToastItem, ToastVariant, ToastAppearance };
3
3
  /** Why a toast went away — surfaced to `onDismiss` (and the facade event). */
4
4
  export type ToastDismissReason = 'timeout' | 'close' | 'action';
@@ -30,7 +30,7 @@ export interface ToastRegionProps {
30
30
  /** Fired when a toast's action button is pressed. */
31
31
  onAction?: (id: string, label: string) => void;
32
32
  }
33
- interface ToastProps {
33
+ export interface ToastProps {
34
34
  item: ToastItem;
35
35
  onDismiss: (reason: ToastDismissReason) => void;
36
36
  onAction?: (label: string) => void;
@@ -0,0 +1,8 @@
1
+ /** Semantic classification of a tool call, used to pick a rendering. Derived from
2
+ * the provider-chosen tool NAME, which is arbitrary, so this stays conservative and
3
+ * prefers 'generic' over a confident wrong answer. */
4
+ export type ToolKind = 'command' | 'file-change' | 'search' | 'fetch' | 'mcp' | 'image' | 'generic';
5
+ /** Total, deterministic, side-effect free. ALWAYS terminates in 'generic' so an
6
+ * unrecognized tool still renders a panel instead of a blank. Order matters:
7
+ * 'search' is tested before 'fetch' so `web_search` classifies as a search. */
8
+ export declare function classifyTool(name: string): ToolKind;
@@ -1,10 +1,38 @@
1
+ import { ToolKind } from './tool-classify.js';
2
+ /** The untranslated provider payload a part was normalized from.
3
+ *
4
+ * Optional in the type but REQUIRED in practice for round-trip fidelity. Anthropic
5
+ * returns a 400 invalid_request_error if `thinking` blocks are modified, reordered,
6
+ * filtered or RECONSTRUCTED, so an encoder must send `raw.payload` back verbatim
7
+ * rather than rebuilding a block from `text` + `signature`. */
8
+ export interface RawOrigin {
9
+ /** Tagged origin, e.g. 'anthropic.content_block', 'openai.delta', `custom.${string}`. */
10
+ source: string;
11
+ payload: unknown;
12
+ }
1
13
  /** A tool-call part rendered by <Tool>. Pure type — kept JSX-free so it can be
2
- * imported by the framework-neutral state core and the React typecheck pass. */
14
+ * imported by the framework-neutral state core and the React typecheck pass.
15
+ *
16
+ * Adding a field here also requires adding it to `TOOL_KEYS` (and a comparator
17
+ * in `TOOL_COMPARATORS`) in `state/parts.ts`, or `tsc` fails to compile: those
18
+ * drive `upsertToolPart`'s dedupe check, and a field missing from them would
19
+ * silently make that check ignore the new field, keeping a stale array
20
+ * reference alive when only that field changed. */
3
21
  export interface ToolPart {
22
+ /** The tool name exactly as the provider reported it. */
4
23
  type: string;
24
+ /** Semantic classification for rendering. Derive with classifyTool(type). */
25
+ kind?: ToolKind;
5
26
  state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
27
+ /** Last VALID parsed snapshot, fingerprint-deduped. The primary channel: this is
28
+ * what the kit renders. */
6
29
  input?: Record<string, unknown>;
30
+ /** Raw accumulated argument fragments, for consumers wanting character-level
31
+ * streaming. Most consumers should read `input` instead. */
32
+ rawInput?: string;
7
33
  output?: Record<string, unknown>;
8
34
  toolCallId?: string;
9
35
  errorText?: string;
36
+ /** The untranslated provider payload this was normalized from. */
37
+ raw?: RawOrigin;
10
38
  }
@@ -1,7 +1,7 @@
1
1
  import { JSX } from 'solid-js';
2
- import { CollapsibleController } from '../ui/collapsible';
3
- import { ToolPart } from './tool-types';
4
- export type { ToolPart } from './tool-types';
2
+ import { CollapsibleController } from '../ui/collapsible.js';
3
+ import { ToolPart } from './tool-types.js';
4
+ export type { ToolPart } from './tool-types.js';
5
5
  export interface ToolProps {
6
6
  toolPart: ToolPart;
7
7
  defaultOpen?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { Accessor } from 'solid-js';
2
- import { CardResolution } from '../primitives/card-contract';
2
+ import { CardResolution } from '../primitives/card-contract.js';
3
3
  export interface ResolutionController<R extends CardResolution = CardResolution> {
4
4
  resolution: Accessor<R | undefined>;
5
5
  isResolved: Accessor<boolean>;
@@ -0,0 +1,338 @@
1
+ import { ssr as Le, ssrAttribute as we, escape as ye } from "solid-js/web";
2
+ import { createMemo as U, onCleanup as G, createEffect as ue, untrack as ve, createSignal as le } from "solid-js";
3
+ import { c as Re } from "./solid-Dt2nEwfl.js";
4
+ var _e = ['<canvas part="canvas"', "></canvas>"];
5
+ const Ce = "#1FD5F9";
6
+ function Ie(e) {
7
+ const n = e.trim().match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
8
+ if (!n) return Ie(Ce);
9
+ const [, o, a, s] = n;
10
+ return [parseInt(o, 16) / 255, parseInt(a, 16) / 255, parseInt(s, 16) / 255];
11
+ }
12
+ const Te = {
13
+ "1f": "float",
14
+ "1i": "int",
15
+ "1fv": "float",
16
+ "2f": "vec2",
17
+ "3f": "vec3",
18
+ "3fv": "vec3",
19
+ "4f": "vec4",
20
+ "4fv": "vec4",
21
+ Matrix2fv: "mat2",
22
+ Matrix3fv: "mat3",
23
+ Matrix4fv: "mat4"
24
+ }, Oe = {
25
+ "1fv": 1,
26
+ "3fv": 3,
27
+ "4fv": 4,
28
+ Matrix2fv: 4,
29
+ Matrix3fv: 9,
30
+ Matrix4fv: 16
31
+ };
32
+ function Pe(e) {
33
+ const n = Oe[e.type];
34
+ if (!n || !Array.isArray(e.value)) return;
35
+ const o = e.value.length / n;
36
+ return o > 1 && Number.isInteger(o) ? o : void 0;
37
+ }
38
+ function he(e) {
39
+ return e.arraySize ?? Pe(e);
40
+ }
41
+ const ke = ["uniform float iTime;", "uniform vec2 iResolution;", "uniform vec4 iMouse;", "uniform int iFrame;", "uniform vec4 iDate;"].join(`
42
+ `), De = `
43
+ attribute vec3 aVertexPosition;
44
+ void main() { gl_Position = vec4(aVertexPosition, 1.0); }
45
+ `;
46
+ function Ne(e, n, o) {
47
+ const a = Object.entries(n).map(([s, i]) => {
48
+ const u = he(i), m = u ? `[${u}]` : "";
49
+ return `uniform ${Te[i.type]} ${s}${m};`;
50
+ }).join(`
51
+ `);
52
+ return [`precision ${o} float;`, ke, a, e, "void main() { mainImage(gl_FragColor, gl_FragCoord.xy); }"].join(`
53
+ `);
54
+ }
55
+ function Ue(e) {
56
+ return Object.keys(e).sort().map((n) => {
57
+ const o = e[n];
58
+ return `${n}:${o.type}:${he(o) ?? ""}`;
59
+ }).join("|");
60
+ }
61
+ function me(e, n, o) {
62
+ const a = e.createShader(n);
63
+ if (!a) return "Could not create a WebGL shader.";
64
+ if (e.shaderSource(a, o), e.compileShader(a), !e.getShaderParameter(a, e.COMPILE_STATUS)) {
65
+ const s = e.getShaderInfoLog(a) ?? "Unknown shader compile error.";
66
+ return e.deleteShader(a), s;
67
+ }
68
+ return a;
69
+ }
70
+ function Be(e, n, o) {
71
+ const a = o.value;
72
+ switch (o.type) {
73
+ case "1f":
74
+ e.uniform1f(n, a);
75
+ break;
76
+ case "1i":
77
+ e.uniform1i(n, a);
78
+ break;
79
+ case "1fv":
80
+ e.uniform1fv(n, a);
81
+ break;
82
+ case "2f":
83
+ e.uniform2fv(n, a);
84
+ break;
85
+ case "3f":
86
+ case "3fv":
87
+ e.uniform3fv(n, a);
88
+ break;
89
+ case "4f":
90
+ case "4fv":
91
+ e.uniform4fv(n, a);
92
+ break;
93
+ case "Matrix2fv":
94
+ e.uniformMatrix2fv(n, !1, a);
95
+ break;
96
+ case "Matrix3fv":
97
+ e.uniformMatrix3fv(n, !1, a);
98
+ break;
99
+ case "Matrix4fv":
100
+ e.uniformMatrix4fv(n, !1, a);
101
+ break;
102
+ }
103
+ }
104
+ function Ve(e) {
105
+ let n;
106
+ const o = U(() => Ue(e.uniforms ?? {})), a = U(() => e.fragment), s = U(() => e.precision ?? "highp");
107
+ let i = "none", u = null, m = null, r = null, l = null, f = 0;
108
+ const d = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : () => {
109
+ };
110
+ let v = null, b = !1, M = !1, E = !1, L = !1, S, x = !1, w = !0, _ = !1, C = 0, I = 0, W = 0;
111
+ const ge = () => {
112
+ var c;
113
+ return u || (u = n.getContext("webgl") ?? n.getContext("experimental-webgl"), u && (i = "live", m = ((c = u.getExtension) == null ? void 0 : c.call(u, "WEBGL_lose_context")) ?? null), u);
114
+ }, $ = () => {
115
+ f !== 0 || !l || L || (I = performance.now(), f = requestAnimationFrame(l));
116
+ }, V = () => {
117
+ f !== 0 && (d(f), f = 0, C += Math.max(0, performance.now() - I));
118
+ }, N = () => {
119
+ V();
120
+ const c = r;
121
+ r = null, c == null || c();
122
+ }, be = () => {
123
+ !m || i !== "live" || (i = "losing", m.loseContext());
124
+ }, j = () => {
125
+ m && (i = "restoring", m.restoreContext());
126
+ }, D = () => {
127
+ if (!(L || M || E))
128
+ if (w || _) {
129
+ if (i === "losing" || i === "restoring") return;
130
+ if (i === "lost") {
131
+ j();
132
+ return;
133
+ }
134
+ Ae();
135
+ } else m && i === "live" ? (N(), be()) : V();
136
+ }, Se = (c) => {
137
+ c === w || L || (w = c, D());
138
+ }, H = (c) => {
139
+ var y;
140
+ c.preventDefault();
141
+ const t = i === "losing";
142
+ if (i = "lost", N(), t) {
143
+ D();
144
+ return;
145
+ }
146
+ E = !0, (y = e.onError) == null || y.call(e, "WebGL context was lost.");
147
+ }, Y = () => {
148
+ i = "live", D();
149
+ }, xe = () => {
150
+ x || (x = !0, n.addEventListener("webglcontextlost", H, !1), n.addEventListener("webglcontextrestored", Y, !1), !(typeof IntersectionObserver > "u") && (w = !1, S = new IntersectionObserver((c) => {
151
+ const t = c[c.length - 1];
152
+ t && Se(t.isIntersecting);
153
+ }, {
154
+ threshold: 0
155
+ }), S.observe(n)));
156
+ }, Ae = () => {
157
+ var re, oe, ae, ie, se;
158
+ if (L || M || E || b) return;
159
+ const c = v;
160
+ if (!c) return;
161
+ if (r) {
162
+ $();
163
+ return;
164
+ }
165
+ const t = ge();
166
+ if (!t) {
167
+ M = !0, (re = e.onError) == null || re.call(e, "WebGL is not available in this browser.");
168
+ return;
169
+ }
170
+ if (t.isContextLost()) {
171
+ j();
172
+ return;
173
+ }
174
+ const {
175
+ source: y,
176
+ uniforms: Fe
177
+ } = c, R = me(t, t.VERTEX_SHADER, De);
178
+ if (typeof R == "string") {
179
+ b = !0, (oe = e.onError) == null || oe.call(e, R);
180
+ return;
181
+ }
182
+ const T = me(t, t.FRAGMENT_SHADER, y);
183
+ if (typeof T == "string") {
184
+ t.deleteShader(R), b = !0, (ae = e.onError) == null || ae.call(e, T);
185
+ return;
186
+ }
187
+ const g = t.createProgram();
188
+ if (!g) {
189
+ t.deleteShader(R), t.deleteShader(T), b = !0, (ie = e.onError) == null || ie.call(e, "Could not create a WebGL program.");
190
+ return;
191
+ }
192
+ if (t.attachShader(g, R), t.attachShader(g, T), t.linkProgram(g), !t.getProgramParameter(g, t.LINK_STATUS)) {
193
+ const h = t.getProgramInfoLog(g) ?? "Shader program failed to link.";
194
+ t.deleteProgram(g), t.deleteShader(R), t.deleteShader(T), b = !0, (se = e.onError) == null || se.call(e, h);
195
+ return;
196
+ }
197
+ t.useProgram(g);
198
+ const K = t.createBuffer();
199
+ t.bindBuffer(t.ARRAY_BUFFER, K), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0]), t.STATIC_DRAW);
200
+ const X = t.getAttribLocation(g, "aVertexPosition");
201
+ t.enableVertexAttribArray(X), t.vertexAttribPointer(X, 3, t.FLOAT, !1, 0, 0), t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA);
202
+ const O = (h) => t.getUniformLocation(g, h), Z = O("iTime"), J = O("iResolution"), Q = O("iMouse"), p = O("iFrame"), ee = O("iDate"), Ee = Object.keys(Fe).map((h) => [h, O(h)]), B = [0, 0, 0, 0], te = (h) => {
203
+ const A = n.getBoundingClientRect();
204
+ B[0] = h.clientX - A.left, B[1] = A.height - (h.clientY - A.top);
205
+ };
206
+ n.addEventListener("pointermove", te, {
207
+ passive: !0
208
+ });
209
+ const q = () => {
210
+ const h = globalThis.devicePixelRatio ?? 1, A = Math.max(1, Math.floor(n.clientWidth * h)), k = Math.max(1, Math.floor(n.clientHeight * h));
211
+ (n.width !== A || n.height !== k) && (n.width = A, n.height = k, t.viewport(0, 0, A, k));
212
+ }, P = typeof ResizeObserver < "u" ? new ResizeObserver(q) : void 0;
213
+ P == null || P.observe(n), q();
214
+ const ne = (h) => {
215
+ var k;
216
+ if (E || t.isContextLost()) return;
217
+ q();
218
+ const A = Math.max(0, (C + (h - I)) / 1e3);
219
+ if (Z && t.uniform1f(Z, A), J && t.uniform2fv(J, [n.width, n.height]), Q && t.uniform4fv(Q, B), p && t.uniform1i(p, W), ee) {
220
+ const F = /* @__PURE__ */ new Date();
221
+ t.uniform4fv(ee, [F.getFullYear(), F.getMonth(), F.getDate(), F.getHours() * 3600 + F.getMinutes() * 60 + F.getSeconds()]);
222
+ }
223
+ for (const [F, ce] of Ee) {
224
+ const fe = (k = e.uniforms) == null ? void 0 : k[F];
225
+ fe && ce && Be(t, ce, fe);
226
+ }
227
+ t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), W++, f = requestAnimationFrame(ne);
228
+ };
229
+ r = () => {
230
+ l = null, P == null || P.disconnect(), n.removeEventListener("pointermove", te), t.deleteProgram(g), t.deleteShader(R), t.deleteShader(T), t.deleteBuffer(K);
231
+ }, l = ne, $();
232
+ };
233
+ G(() => {
234
+ L = !0, S == null || S.disconnect(), x && (n.removeEventListener("webglcontextlost", H), n.removeEventListener("webglcontextrestored", Y)), N(), m && i === "live" && m.loseContext();
235
+ });
236
+ const Me = U(() => e.animateWhenNotVisible ?? !1);
237
+ return ue(() => {
238
+ _ = Me(), D();
239
+ }), ue(() => {
240
+ const c = a(), t = s();
241
+ o();
242
+ const y = ve(() => e.uniforms ?? {});
243
+ v = {
244
+ source: Ne(c, y, t),
245
+ uniforms: y
246
+ }, b = !1, xe(), D(), G(N);
247
+ }), Le(_e, we("class", ye(Re("block h-full w-full", e.class), !0), !1));
248
+ }
249
+ function z(e, n, o, a) {
250
+ const s = (r) => 3 * (1 - r) * (1 - r) * r * e + 3 * (1 - r) * r * r * o + r * r * r, i = (r) => 3 * (1 - r) * (1 - r) * r * n + 3 * (1 - r) * r * r * a + r * r * r, u = (r) => 3 * (1 - r) * (1 - r) * e + 6 * (1 - r) * r * (o - e) + 3 * r * r * (1 - o);
251
+ function m(r) {
252
+ let l = 0, f = 1;
253
+ for (let d = 0; d < 30; d++) {
254
+ const v = (l + f) / 2;
255
+ s(v) < r ? l = v : f = v;
256
+ }
257
+ return (l + f) / 2;
258
+ }
259
+ return (r) => {
260
+ if (r <= 0) return 0;
261
+ if (r >= 1) return 1;
262
+ let l = r;
263
+ for (let f = 0; f < 8; f++) {
264
+ const d = u(l);
265
+ if (Math.abs(d) < 1e-6) return i(m(r));
266
+ const v = l - (s(l) - r) / d;
267
+ if (v <= 0 || v >= 1) return i(m(r));
268
+ l = v;
269
+ }
270
+ return i(l);
271
+ };
272
+ }
273
+ const qe = {
274
+ linear: (e) => Math.min(1, Math.max(0, e)),
275
+ easeIn: z(0.42, 0, 1, 1),
276
+ easeOut: z(0, 0, 0.58, 1),
277
+ easeInOut: z(0.42, 0, 0.58, 1)
278
+ };
279
+ function ze(e, n) {
280
+ e = Math.max(0, e);
281
+ const o = Math.max(0.05, 1 - Math.min(0.95, n)), a = 10, s = a * Math.sqrt(Math.max(0, 1 - o * o));
282
+ return 1 - Math.exp(-o * a * e) * (Math.cos(s * e) + o * a / (s || 1) * Math.sin(s * e));
283
+ }
284
+ function de(e) {
285
+ return "type" in e && e.type === "spring";
286
+ }
287
+ function je(e) {
288
+ const [n, o] = le(e), [a, s] = le(!1);
289
+ let i = 0, u = !1;
290
+ const m = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : () => {
291
+ }, r = () => {
292
+ i && m(i), i = 0;
293
+ };
294
+ G(() => {
295
+ u = !0, r(), s(!1);
296
+ });
297
+ function l(f, d) {
298
+ if (r(), u) return;
299
+ const v = Array.isArray(f), [b, M] = v ? f : [ve(n), f];
300
+ if (!d || !de(d) && d.duration === 0) {
301
+ s(!1), o(v ? b : M);
302
+ return;
303
+ }
304
+ const E = d.duration * 1e3;
305
+ if (E <= 0) {
306
+ s(!1), o(M);
307
+ return;
308
+ }
309
+ if (typeof requestAnimationFrame > "u") {
310
+ s(!1), o(M);
311
+ return;
312
+ }
313
+ const L = de(d) ? (C) => ze(C, d.bounce) : qe[d.ease ?? "easeOut"];
314
+ let S = b, x = M;
315
+ v && o(b);
316
+ let w = performance.now();
317
+ const _ = (C) => {
318
+ const I = Math.min(1, (C - w) / E);
319
+ if (o(S + (x - S) * L(I)), I < 1) {
320
+ i = requestAnimationFrame(_);
321
+ return;
322
+ }
323
+ if (!v) {
324
+ o(x), i = 0, s(!1);
325
+ return;
326
+ }
327
+ o(x), [S, x] = [x, S], w = performance.now(), i = requestAnimationFrame(_);
328
+ };
329
+ s(!0), i = requestAnimationFrame(_);
330
+ }
331
+ return { value: n, animating: a, to: l };
332
+ }
333
+ export {
334
+ Ce as D,
335
+ Ve as S,
336
+ je as c,
337
+ Ie as h
338
+ };