@kitn.ai/ui 0.25.1 → 0.26.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 (409) hide show
  1. package/README.md +5 -7
  2. package/dist/components/attachment-types.d.ts +46 -1
  3. package/dist/components/attachments.d.ts +31 -0
  4. package/dist/components/audio-visualizer/fit-scale.d.ts +50 -0
  5. package/dist/components/audio-visualizer/index.d.ts +15 -1
  6. package/dist/components/audio-visualizer/variant-bar.d.ts +24 -1
  7. package/dist/components/chat-thread.d.ts +3 -41
  8. package/dist/components/code-block.d.ts +22 -0
  9. package/dist/components/conversation-item.d.ts +54 -1
  10. package/dist/components/conversation-list.d.ts +65 -0
  11. package/dist/components/form.d.ts +42 -0
  12. package/dist/components/message.d.ts +7 -0
  13. package/dist/components/toast.d.ts +2 -1
  14. package/dist/components/voice-input.d.ts +8 -0
  15. package/dist/components/voice-output.d.ts +12 -1
  16. package/dist/components/workspace-shell.d.ts +87 -0
  17. package/dist/{create-tween-B5Y4Im8G.js → create-tween-BFT6c-Y8.js} +1 -1
  18. package/dist/{create-tween-4z1XYLkR.js → create-tween-CJNlzoaO.js} +1 -1
  19. package/dist/{create-tween-CUzOlaMS.js → create-tween-CQED4T0g.js} +1 -1
  20. package/dist/custom-elements.json +2931 -2572
  21. package/dist/diagnostics/hook.d.ts +81 -0
  22. package/dist/diagnostics/index.d.ts +7 -0
  23. package/dist/diagnostics/report-request.d.ts +61 -0
  24. package/dist/diagnostics.d.ts +5 -0
  25. package/dist/diagnostics.js +209 -0
  26. package/dist/elements/agent-card.js +1 -1
  27. package/dist/elements/artifact.js +1 -1
  28. package/dist/elements/attachments.js +1 -1
  29. package/dist/elements/audio-visualizer.js +1 -1
  30. package/dist/elements/autoloader.js +1 -1
  31. package/dist/elements/avatar.js +1 -1
  32. package/dist/elements/badge.js +1 -1
  33. package/dist/elements/button.js +1 -1
  34. package/dist/elements/card.js +1 -1
  35. package/dist/elements/cards.js +1 -1
  36. package/dist/elements/chain-of-thought.js +1 -1
  37. package/dist/elements/chat-scope-picker.js +1 -1
  38. package/dist/elements/chat-workspace.js +1 -1
  39. package/dist/elements/chat.js +1 -1
  40. package/dist/elements/checkpoint.js +1 -1
  41. package/dist/elements/choice.js +1 -1
  42. package/dist/elements/chunks/{Icon-b5A8hlHs.js → Icon--Y8vsFal.js} +1 -1
  43. package/dist/elements/chunks/action-icons-D9u3OzYW.js +1 -0
  44. package/dist/elements/chunks/arrow-left-CVh1TeN7.js +1 -0
  45. package/dist/elements/chunks/{artifact-BSuPYFHY.js → artifact-BkYcfIlZ.js} +1 -1
  46. package/dist/elements/chunks/attachments-DwfNlubq.js +1 -0
  47. package/dist/elements/chunks/audio-visualizer-D7lB6mvR.js +1 -0
  48. package/dist/elements/chunks/{badge-TIMiJFKc.js → badge-Q0-Cmwzz.js} +1 -1
  49. package/dist/elements/chunks/{button-B9okqG73.js → button-flUbeufF.js} +1 -1
  50. package/dist/elements/chunks/{card-renderer-CSoTL_e1.js → card-renderer-3Dyl-FpN.js} +1 -1
  51. package/dist/elements/chunks/check-B5kBPKeo.js +1 -0
  52. package/dist/elements/chunks/chevron-down-DZ1GS39h.js +1 -0
  53. package/dist/elements/chunks/chevron-right-CvP7OUd2.js +1 -0
  54. package/dist/elements/chunks/{choice-card-CGMc3kek.js → choice-card-D4QUIOWZ.js} +1 -1
  55. package/dist/elements/chunks/circle-CDf9g6MQ.js +1 -0
  56. package/dist/elements/chunks/circle-check-CA47Nqbz.js +1 -0
  57. package/dist/elements/chunks/{circle-x-mhH7pOK2.js → circle-x-CJ_HVbC8.js} +1 -1
  58. package/dist/elements/chunks/code-block-BdLiTitd.js +1 -0
  59. package/dist/elements/chunks/collapsible-BzbXpPzr.js +1 -0
  60. package/dist/elements/chunks/{composer-CZZmtYOT.js → composer-Byve-n8K.js} +2 -2
  61. package/dist/elements/chunks/{confirm-card-BWjf2-xo.js → confirm-card-B0flE3MN.js} +1 -1
  62. package/dist/elements/chunks/context-VLIL3sJ-.js +1 -0
  63. package/dist/elements/chunks/controllable-DTwTIlwp.js +1 -0
  64. package/dist/elements/chunks/conversation-item-BDztezOG.js +1 -0
  65. package/dist/elements/chunks/copy-Nf-kqxXH.js +1 -0
  66. package/dist/elements/chunks/{create-tween-CUrM6D_o.js → create-tween-c4Z8TDYz.js} +2 -2
  67. package/dist/elements/chunks/default-input-C2iLFq0b.js +1 -0
  68. package/dist/elements/chunks/define-wjHR1MkU.js +1 -0
  69. package/dist/elements/chunks/disclosure-CcNbyLy0.js +1 -0
  70. package/dist/elements/chunks/{download-DnCyWFJE.js → download-C4V7tBdb.js} +1 -1
  71. package/dist/elements/chunks/dropdown-BgWTthUx.js +1 -0
  72. package/dist/elements/chunks/{ellipsis-CVxqfsDZ.js → ellipsis-7gU33mL2.js} +1 -1
  73. package/dist/elements/chunks/embed-D3KewsIJ.js +1 -0
  74. package/dist/elements/chunks/{external-link-DG2sRdQL.js → external-link-CSOEsNlx.js} +1 -1
  75. package/dist/elements/chunks/{file-text-D0J9F6M7.js → file-text-D1G8khle.js} +1 -1
  76. package/dist/elements/chunks/{file-tree-yGWNK0Js.js → file-tree-zvB2i7P9.js} +1 -1
  77. package/dist/elements/chunks/{folder-NV1pi_ud.js → folder-WW2LGLid.js} +1 -1
  78. package/dist/elements/chunks/form-CQirdC4W.js +1 -0
  79. package/dist/elements/chunks/hover-card-CJJkfHTK.js +1 -0
  80. package/dist/elements/chunks/icon-Cfgmf4fa.js +1 -0
  81. package/dist/elements/chunks/{info-C8r5Q6cc.js → info-DX3YMOt6.js} +1 -1
  82. package/dist/elements/chunks/input-BtW9U6Sq.js +1 -0
  83. package/dist/elements/chunks/{kbd-OGJDUT-O.js → kbd-LGXwuT_V.js} +1 -1
  84. package/dist/elements/chunks/{link-BdsfLB7b.js → link-2My69BqT.js} +1 -1
  85. package/dist/elements/chunks/{link-preview-Cf5KOP-i.js → link-preview-OQ9IEq0f.js} +1 -1
  86. package/dist/elements/chunks/{loader-B5QzK_8_.js → loader-iOxc_Tu-.js} +1 -1
  87. package/dist/elements/chunks/{markdown-DbozyYqa.js → markdown-DgBFaGAz.js} +1 -1
  88. package/dist/elements/chunks/{message-DtXKPqiR.js → message-VMZohrXx.js} +1 -1
  89. package/dist/elements/chunks/message-circle-CpXMM-_n.js +1 -0
  90. package/dist/elements/chunks/message-square-DxcWtETQ.js +1 -0
  91. package/dist/elements/chunks/message-tZmV2A3p.js +1 -0
  92. package/dist/elements/chunks/{minimize-2-SegJ_oku.js → minimize-2-DPIUKTrT.js} +1 -1
  93. package/dist/elements/chunks/{model-switcher-D7JrFFHp.js → model-switcher-DsT8tFB0.js} +1 -1
  94. package/dist/elements/chunks/{overlay-CV7z2YuX.js → overlay-DuiwdXjm.js} +1 -1
  95. package/dist/elements/chunks/{paperclip-Bg0ITU3b.js → paperclip-CRZVp4z_.js} +1 -1
  96. package/dist/elements/chunks/{progress-bar-D1_rzt6N.js → progress-bar-DNy66e_E.js} +1 -1
  97. package/dist/elements/chunks/{prompt-suggestion-D5Sm8xF1.js → prompt-suggestion-Bn64Nl7L.js} +1 -1
  98. package/dist/elements/chunks/reasoning-Emn9N4-T.js +1 -0
  99. package/dist/elements/chunks/{resizable-Dpzjlvp4.js → resizable-D181b4fM.js} +1 -1
  100. package/dist/elements/chunks/{rotate-cw-DzVDJOA1.js → rotate-cw-CPWe37D9.js} +1 -1
  101. package/dist/elements/chunks/{scroll-area-93A1bbeG.js → scroll-area-ClZkZxIk.js} +1 -1
  102. package/dist/elements/chunks/scroll-button-DPE-t3x_.js +1 -0
  103. package/dist/elements/chunks/{separator-DH2r_ZSZ.js → separator-CeJHQqLW.js} +1 -1
  104. package/dist/elements/chunks/{settings-BFMOd6yB.js → settings-CqaHgJF9.js} +1 -1
  105. package/dist/elements/chunks/{settings-group-B3VZKIcz.js → settings-group-CjqjLCOn.js} +1 -1
  106. package/dist/elements/chunks/share-CyfnNEqp.js +1 -0
  107. package/dist/elements/chunks/{skeleton-N8BuWYmf.js → skeleton-D8akBnKS.js} +1 -1
  108. package/dist/elements/chunks/slots-DaNjX0rc.js +1 -0
  109. package/dist/elements/chunks/{source-w9V0NnBn.js → source-UWCvmVak.js} +1 -1
  110. package/dist/elements/chunks/{star-DHvACxtm.js → star-DoHFAikQ.js} +1 -1
  111. package/dist/elements/chunks/store-Cjq0qwYN.js +1 -0
  112. package/dist/elements/chunks/{tasks-card-lPxoodlA.js → tasks-card-CmZ5xh6v.js} +1 -1
  113. package/dist/elements/chunks/{text-shimmer-BY_rI3s5.js → text-shimmer-DYn09zrz.js} +1 -1
  114. package/dist/elements/chunks/textarea-skiGHURM.js +1 -0
  115. package/dist/elements/chunks/{thumbs-up-DQe0hvkZ.js → thumbs-up-DX2Ijk3H.js} +1 -1
  116. package/dist/elements/chunks/{toast-store-VUZZBhzH.js → toast-store-CFnQpThX.js} +1 -1
  117. package/dist/elements/chunks/{tool-C1YtxwPu.js → tool-DKQ2D1DP.js} +1 -1
  118. package/dist/elements/chunks/{tooltip-BqwnFWhn.js → tooltip-B0G99y8w.js} +1 -1
  119. package/dist/elements/chunks/{triangle-alert-B6or7F5u.js → triangle-alert-F9cyUEyy.js} +1 -1
  120. package/dist/elements/chunks/{use-card-resolution-DJg32jGH.js → use-card-resolution-DoA2f_EU.js} +1 -1
  121. package/dist/elements/chunks/{variant-aurora-QXTZPyST.js → variant-aurora-qt6Zct8M.js} +2 -2
  122. package/dist/elements/chunks/variant-custom-tJp22_BQ.js +1 -0
  123. package/dist/{variant-wave-BwzrHD1s.js → elements/chunks/variant-wave-CaQ5ti39.js} +2 -2
  124. package/dist/elements/chunks/x-B6UnOiLw.js +1 -0
  125. package/dist/elements/coachmark.js +1 -1
  126. package/dist/elements/code-block.js +1 -1
  127. package/dist/elements/command.js +1 -1
  128. package/dist/elements/compare.js +1 -1
  129. package/dist/elements/composer.js +1 -1
  130. package/dist/elements/confirm-card.js +1 -1
  131. package/dist/elements/context-meter.js +1 -1
  132. package/dist/elements/conversation-item.d.ts +1 -0
  133. package/dist/elements/conversation-item.js +1 -0
  134. package/dist/elements/conversation-list.js +1 -1
  135. package/dist/elements/default-input.d.ts +3 -3
  136. package/dist/elements/define.d.ts +27 -0
  137. package/dist/elements/diagnostic-events.d.ts +74 -0
  138. package/dist/elements/dialog.js +1 -1
  139. package/dist/elements/dock.d.ts +1 -0
  140. package/dist/elements/dock.js +149 -0
  141. package/dist/elements/dropdown.d.ts +1 -0
  142. package/dist/elements/dropdown.js +1 -0
  143. package/dist/elements/editable-label.js +1 -1
  144. package/dist/elements/element-diagnostics.d.ts +81 -0
  145. package/dist/elements/embed.js +1 -1
  146. package/dist/elements/empty.js +1 -1
  147. package/dist/elements/feedback-bar.js +1 -1
  148. package/dist/elements/file-tree.js +1 -1
  149. package/dist/elements/file-upload.js +1 -1
  150. package/dist/elements/form.js +1 -1
  151. package/dist/elements/hover-card.js +1 -1
  152. package/dist/elements/icon.js +1 -1
  153. package/dist/elements/image.js +1 -1
  154. package/dist/elements/input.js +1 -1
  155. package/dist/elements/kbd.js +1 -1
  156. package/dist/elements/link-preview.js +1 -1
  157. package/dist/elements/loader.js +1 -1
  158. package/dist/elements/markdown.js +1 -1
  159. package/dist/elements/menu.js +1 -1
  160. package/dist/elements/message-skills.js +1 -1
  161. package/dist/elements/message.js +1 -1
  162. package/dist/elements/model-switcher.js +1 -1
  163. package/dist/elements/nav.js +1 -1
  164. package/dist/elements/notice.js +1 -1
  165. package/dist/elements/pane-group.js +1 -1
  166. package/dist/elements/pane.js +1 -1
  167. package/dist/elements/popover.js +1 -1
  168. package/dist/elements/progress-bar.js +1 -1
  169. package/dist/elements/prompt-dock.js +1 -1
  170. package/dist/elements/prompt-input.js +1 -1
  171. package/dist/elements/prompt-suggestions.js +1 -1
  172. package/dist/elements/reasoning.js +1 -1
  173. package/dist/elements/register.d.ts +2 -0
  174. package/dist/elements/remote.js +1 -1
  175. package/dist/elements/resizable.js +1 -1
  176. package/dist/elements/response-stream.js +3 -3
  177. package/dist/elements/screen.js +1 -1
  178. package/dist/elements/scroll-area.js +1 -1
  179. package/dist/elements/scroll-button.js +1 -1
  180. package/dist/elements/search.js +1 -1
  181. package/dist/elements/segmented.js +1 -1
  182. package/dist/elements/separator.js +1 -1
  183. package/dist/elements/setting-item.js +1 -1
  184. package/dist/elements/settings-group.js +1 -1
  185. package/dist/elements/skeleton.js +1 -1
  186. package/dist/elements/slots.d.ts +35 -3
  187. package/dist/elements/source.js +1 -1
  188. package/dist/elements/status.js +1 -1
  189. package/dist/elements/switch.js +1 -1
  190. package/dist/elements/tabs.js +1 -1
  191. package/dist/elements/tasks.js +1 -1
  192. package/dist/elements/text-shimmer.js +1 -1
  193. package/dist/elements/thinking-bar.js +1 -1
  194. package/dist/elements/thread.js +1 -1
  195. package/dist/elements/toast.js +1 -1
  196. package/dist/elements/tool.js +1 -1
  197. package/dist/elements/tooltip.js +1 -1
  198. package/dist/elements/voice-input.js +1 -1
  199. package/dist/elements/voice-output.js +1 -1
  200. package/dist/elements.d.ts +232 -148
  201. package/dist/index.d.ts +2 -0
  202. package/dist/index.js +5456 -4931
  203. package/dist/index.server.js +4142 -3669
  204. package/dist/kai-provider.es.js +40 -40
  205. package/dist/kai.es.js +1 -1
  206. package/dist/llms/llms-full.txt +184 -69
  207. package/dist/llms/llms.txt +3 -3
  208. package/dist/mcp.es.js +2669 -546
  209. package/dist/primitives/use-resize-observer.d.ts +23 -0
  210. package/dist/primitives/use-speech-recognition.d.ts +8 -0
  211. package/dist/primitives/use-text-stream.d.ts +5 -0
  212. package/dist/react/index.d.ts +115 -266
  213. package/dist/react.js +247 -221
  214. package/dist/register-impl-DpE7icIb.js +293 -0
  215. package/dist/schemas/index.d.ts +1 -1
  216. package/dist/schemas/tool-defs.d.ts +35 -0
  217. package/dist/schemas.js +403 -310
  218. package/dist/{solid-BMuDmFo_.js → solid-BtdqNZI7.js} +8435 -7394
  219. package/dist/{solid-CGYNdLRR.js → solid-CnavwBye.js} +5987 -5035
  220. package/dist/solid.d.ts +5 -0
  221. package/dist/solid.js +210 -203
  222. package/dist/solid.server.js +210 -203
  223. package/dist/state/index.d.ts +4 -0
  224. package/dist/state/persistence.d.ts +51 -0
  225. package/dist/state/stream.d.ts +50 -0
  226. package/dist/state/threads.d.ts +71 -0
  227. package/dist/state.js +269 -169
  228. package/dist/types.d.ts +4 -2
  229. package/dist/ui/dock.d.ts +109 -0
  230. package/dist/ui/hover-card.d.ts +44 -0
  231. package/dist/{variant-aurora-DwSOfraQ.js → variant-aurora-B8II3-I1.js} +27 -27
  232. package/dist/{variant-aurora-wKvAQ5wp.js → variant-aurora-CMNWOSJR.js} +28 -28
  233. package/dist/{variant-aurora-XEkPT0_z.js → variant-aurora-CcuDMWwQ.js} +2 -2
  234. package/dist/{variant-custom-eFIg2XWQ.js → variant-custom-BdvYC7af.js} +40 -40
  235. package/dist/{variant-custom-BhS9wIpU.js → variant-custom-C714mqKl.js} +65 -65
  236. package/dist/variant-custom-L16JLLZy.js +1 -0
  237. package/dist/{elements/chunks/variant-wave-DDCwhLas.js → variant-wave-2S4La2Ka.js} +2 -2
  238. package/dist/{variant-wave-CbVsmgwT.js → variant-wave-D7ruiA1W.js} +25 -25
  239. package/dist/{variant-wave-CUWGx9Bn.js → variant-wave-ecwykeyL.js} +21 -21
  240. package/dist/wire/chunk.d.ts +47 -0
  241. package/dist/wire/diagnostics.d.ts +575 -0
  242. package/dist/wire/encode-probe.d.ts +70 -0
  243. package/dist/wire/encode.d.ts +24 -0
  244. package/dist/wire/index.d.ts +2 -0
  245. package/dist/wire/sse.d.ts +10 -2
  246. package/dist/wire.js +917 -480
  247. package/frameworks/react/index.tsx +132 -93
  248. package/llms-full.txt +184 -69
  249. package/llms.txt +3 -3
  250. package/package.json +27 -7
  251. package/src/agent-tooling/archetypes.ts +41 -9
  252. package/src/agent-tooling/catalog/README.md +676 -0
  253. package/src/agent-tooling/catalog/catalog-types.ts +231 -0
  254. package/src/agent-tooling/catalog/fabrications.ts +96 -0
  255. package/src/agent-tooling/catalog/invariants.ts +284 -0
  256. package/src/agent-tooling/catalog/labs-titles.ts +114 -0
  257. package/src/agent-tooling/catalog/scenarios.ts +87 -0
  258. package/src/agent-tooling/catalog/surfaces.ts +275 -0
  259. package/src/agent-tooling/integrations/anthropic.ts +7 -1
  260. package/src/agent-tooling/integrations/cloudflare.ts +43 -2
  261. package/src/agent-tooling/integrations/langgraph.ts +7 -1
  262. package/src/agent-tooling/integrations/mastra.ts +7 -1
  263. package/src/agent-tooling/integrations/mock.ts +92 -17
  264. package/src/agent-tooling/integrations/ollama.ts +7 -1
  265. package/src/agent-tooling/integrations/openai.ts +7 -1
  266. package/src/agent-tooling/integrations/openrouter.ts +7 -1
  267. package/src/agent-tooling/integrations/pi.ts +56 -1
  268. package/src/agent-tooling/integrations/vercel-ai-sdk.ts +7 -1
  269. package/src/agent-tooling/mcp/css-raw.d.ts +12 -0
  270. package/src/agent-tooling/mcp/manifest.ts +100 -1
  271. package/src/agent-tooling/mcp/server.ts +61 -5
  272. package/src/agent-tooling/mcp/tools/reference.ts +440 -4
  273. package/src/agent-tooling/mcp/tools/scaffold.ts +1834 -307
  274. package/src/agent-tooling/mcp/tools/theme.ts +146 -30
  275. package/src/agent-tooling/mcp/validate-args.ts +141 -0
  276. package/src/agent-tooling/registry.ts +19 -7
  277. package/src/agent-tooling/route-emit.ts +26 -2
  278. package/src/components/attachment-types.ts +47 -1
  279. package/src/components/attachments.tsx +169 -22
  280. package/src/components/audio-visualizer/fit-scale.ts +112 -0
  281. package/src/components/audio-visualizer/index.tsx +80 -3
  282. package/src/components/audio-visualizer/variant-aurora.tsx +10 -4
  283. package/src/components/audio-visualizer/variant-bar.tsx +38 -6
  284. package/src/components/audio-visualizer/variant-custom.tsx +8 -2
  285. package/src/components/audio-visualizer/variant-grid.tsx +16 -11
  286. package/src/components/audio-visualizer/variant-radial.tsx +15 -10
  287. package/src/components/audio-visualizer/variant-wave.tsx +7 -2
  288. package/src/components/chat-container.tsx +4 -1
  289. package/src/components/chat-thread.tsx +36 -7
  290. package/src/components/code-block.tsx +79 -3
  291. package/src/components/composer.tsx +8 -1
  292. package/src/components/conversation-item.tsx +114 -4
  293. package/src/components/conversation-list.tsx +212 -12
  294. package/src/components/embed.tsx +4 -0
  295. package/src/components/form.tsx +41 -14
  296. package/src/components/message.tsx +75 -5
  297. package/src/components/response-stream.tsx +13 -7
  298. package/src/components/screen.tsx +5 -0
  299. package/src/components/scroll-button.tsx +7 -0
  300. package/src/components/toast.tsx +11 -5
  301. package/src/components/voice-input.tsx +35 -3
  302. package/src/components/voice-output.tsx +46 -6
  303. package/src/components/workspace-shell.tsx +285 -0
  304. package/src/diagnostics/hook.ts +352 -0
  305. package/src/diagnostics/index.ts +82 -0
  306. package/src/diagnostics/report-request.ts +296 -0
  307. package/src/elements/attachments.tsx +6 -7
  308. package/src/elements/audio-visualizer.tsx +48 -4
  309. package/src/elements/chat-workspace.tsx +159 -287
  310. package/src/elements/chat.tsx +12 -9
  311. package/src/elements/code-block.tsx +19 -1
  312. package/src/elements/command.tsx +4 -1
  313. package/src/elements/compiled.css +1 -1
  314. package/src/elements/conversation-item.tsx +80 -0
  315. package/src/elements/conversation-list.tsx +60 -11
  316. package/src/elements/default-input.tsx +5 -5
  317. package/src/elements/define.tsx +168 -8
  318. package/src/elements/diagnostic-events.ts +114 -0
  319. package/src/elements/dialog.tsx +47 -0
  320. package/src/elements/disclosure.ts +34 -12
  321. package/src/elements/dock.tsx +204 -0
  322. package/src/elements/dropdown.tsx +123 -0
  323. package/src/elements/element-diagnostics.ts +392 -0
  324. package/src/elements/element-manifest.json +12 -0
  325. package/src/elements/element-meta.json +672 -439
  326. package/src/elements/element-nonscalar.json +170 -0
  327. package/src/elements/element-types.d.ts +232 -148
  328. package/src/elements/menu.tsx +13 -0
  329. package/src/elements/prompt-dock.tsx +2 -1
  330. package/src/elements/prompt-input.tsx +8 -8
  331. package/src/elements/register-impl.ts +46 -0
  332. package/src/elements/register.ts +28 -0
  333. package/src/elements/resizable.tsx +52 -25
  334. package/src/elements/scroll-button.tsx +5 -0
  335. package/src/elements/slots.ts +107 -12
  336. package/src/elements/styles.css +30 -6
  337. package/src/elements/thinking-bar.tsx +16 -7
  338. package/src/elements/toast.tsx +3 -0
  339. package/src/elements/tool.tsx +26 -5
  340. package/src/elements/voice-input.tsx +11 -2
  341. package/src/elements/voice-output.tsx +16 -3
  342. package/src/index.ts +2 -0
  343. package/src/primitives/use-resize-observer.ts +33 -0
  344. package/src/primitives/use-speech-recognition.ts +12 -1
  345. package/src/primitives/use-stick-to-bottom.ts +34 -2
  346. package/src/primitives/use-text-stream.ts +33 -2
  347. package/src/remote/provider-runtime.ts +6 -3
  348. package/src/schemas/index.ts +1 -0
  349. package/src/schemas/tool-defs.ts +297 -6
  350. package/src/solid.ts +5 -0
  351. package/src/state/index.ts +12 -0
  352. package/src/state/persistence.ts +180 -0
  353. package/src/state/stream.ts +71 -4
  354. package/src/state/threads.ts +142 -0
  355. package/src/types.ts +4 -2
  356. package/src/ui/dialog.tsx +6 -0
  357. package/src/ui/dock.tsx +445 -0
  358. package/src/ui/dropdown.tsx +67 -23
  359. package/src/ui/hover-card.tsx +156 -6
  360. package/src/ui/input.tsx +29 -10
  361. package/src/ui/resizable.tsx +11 -0
  362. package/src/wire/chunk.ts +47 -0
  363. package/src/wire/consume.ts +185 -26
  364. package/src/wire/diagnostics.ts +727 -0
  365. package/src/wire/encode-probe.ts +214 -0
  366. package/src/wire/encode.ts +267 -14
  367. package/src/wire/formats/anthropic.ts +8 -1
  368. package/src/wire/formats/openai.ts +5 -0
  369. package/src/wire/index.ts +22 -0
  370. package/src/wire/read.ts +250 -6
  371. package/src/wire/sse.ts +16 -3
  372. package/dist/elements/chunks/action-icons-DW9muWrY.js +0 -1
  373. package/dist/elements/chunks/arrow-left-iJVnQmxA.js +0 -1
  374. package/dist/elements/chunks/attachments-CL6TaqIb.js +0 -1
  375. package/dist/elements/chunks/audio-visualizer-BuUqQmaO.js +0 -1
  376. package/dist/elements/chunks/chat-thread-DxoKaStk.js +0 -1
  377. package/dist/elements/chunks/check-MdLzbxrm.js +0 -1
  378. package/dist/elements/chunks/chevron-down-MK7IzDqe.js +0 -1
  379. package/dist/elements/chunks/chevron-right-C5jXhmtV.js +0 -1
  380. package/dist/elements/chunks/circle-BG7VkPep.js +0 -1
  381. package/dist/elements/chunks/circle-check-GqvO2UBs.js +0 -1
  382. package/dist/elements/chunks/code-block-ClhQO9RW.js +0 -1
  383. package/dist/elements/chunks/collapsible-DBcBkFPh.js +0 -1
  384. package/dist/elements/chunks/context-hKjNqiyQ.js +0 -1
  385. package/dist/elements/chunks/conversation-list-CsGJjSKG.js +0 -1
  386. package/dist/elements/chunks/default-input-B1Mem5wu.js +0 -1
  387. package/dist/elements/chunks/define-B_tXMYRm.js +0 -1
  388. package/dist/elements/chunks/disclosure-DAoYOKew.js +0 -1
  389. package/dist/elements/chunks/dropdown-CmNna5lT.js +0 -1
  390. package/dist/elements/chunks/embed-CjAD2jSi.js +0 -1
  391. package/dist/elements/chunks/form-Cp8Y00Wn.js +0 -1
  392. package/dist/elements/chunks/hover-card-6KtXpLwT.js +0 -1
  393. package/dist/elements/chunks/icon-97R8SR2p.js +0 -1
  394. package/dist/elements/chunks/input-DrseEjhp.js +0 -1
  395. package/dist/elements/chunks/message-CE4k-qaj.js +0 -1
  396. package/dist/elements/chunks/message-square-C9ovmtOo.js +0 -1
  397. package/dist/elements/chunks/reasoning-BrxQfpfI.js +0 -1
  398. package/dist/elements/chunks/scroll-button-CrTo7wm4.js +0 -1
  399. package/dist/elements/chunks/share-DgNbkJKY.js +0 -1
  400. package/dist/elements/chunks/slots-CIw9RlAe.js +0 -1
  401. package/dist/elements/chunks/store-HIPGhNz9.js +0 -1
  402. package/dist/elements/chunks/textarea-DPfuhswM.js +0 -1
  403. package/dist/elements/chunks/variant-custom-D5ZlmziF.js +0 -1
  404. package/dist/elements/chunks/video-Bb86fVYI.js +0 -1
  405. package/dist/elements/chunks/x-BOhjBeOd.js +0 -1
  406. package/dist/primitives/card-validate-generator.testlib.d.ts +0 -20
  407. package/dist/register-impl-DGmGzrEM.js +0 -145
  408. package/dist/variant-custom-MkTNTycd.js +0 -1
  409. package/src/primitives/card-validate-generator.testlib.ts +0 -38
@@ -1 +1 @@
1
- import{f as d,g as u,c as s}from"./chunks/define-B_tXMYRm.js";import{C as c}from"./chunks/composer-CZZmtYOT.js";function v(e,r,n){var o;return{id:e.getAttribute("item-id")??"",label:((o=e.textContent)==null?void 0:o.trim())||e.getAttribute("label")||e.getAttribute("item-id")||"",icon:e.getAttribute("icon")??void 0,promptText:e.getAttribute("prompt-text")??void 0,data:void 0}}d("kai-composer",{value:void 0,placeholder:void 0,disabled:!1,loading:!1,maxHeight:240,submitOnEnter:!0,triggers:void 0,highlights:void 0,kindIcons:void 0},(e,{dispatch:r,flag:n,expose:o})=>{const[l,g]=u(e.value),a=()=>e.value??l();let i;return o({focus:t=>i?.focus(t),blur:()=>i?.blur(),clear:()=>i?.clear(),send:()=>i?.send(),insertEntity:t=>i?.insertEntity(t)}),s(c,{get value(){return a()},get placeholder(){return e.placeholder},get disabled(){return n("disabled")},get loading(){return n("loading")},get maxHeight(){return e.maxHeight},get submitOnEnter(){return n("submitOnEnter")},get triggers(){return e.triggers},get highlights(){return e.highlights},get kindIcons(){return e.kindIcons},onChange:t=>{g(t.doc),r("kai-value-change",{doc:t.doc,text:t.text,entities:t.entities})},onSubmit:t=>{r("kai-submit",{doc:t.doc,text:t.text,entities:t.entities})},onEntityAdd:t=>r("kai-entity-add",{entity:t}),onEntityRemove:t=>r("kai-entity-remove",{entity:t}),onTrigger:t=>r("kai-trigger",t),onTriggerClose:()=>r("kai-trigger-close",{}),onFocus:t=>r("kai-focus",{originalEvent:t}),onBlur:t=>r("kai-blur",{originalEvent:t}),controllerRef:t=>i=t})});export{v as parseKaiTriggerItemElement};
1
+ import{f as d,g as u,c as s}from"./chunks/define-wjHR1MkU.js";import{C as c}from"./chunks/composer-Byve-n8K.js";function v(e,r,n){var o;return{id:e.getAttribute("item-id")??"",label:((o=e.textContent)==null?void 0:o.trim())||e.getAttribute("label")||e.getAttribute("item-id")||"",icon:e.getAttribute("icon")??void 0,promptText:e.getAttribute("prompt-text")??void 0,data:void 0}}d("kai-composer",{value:void 0,placeholder:void 0,disabled:!1,loading:!1,maxHeight:240,submitOnEnter:!0,triggers:void 0,highlights:void 0,kindIcons:void 0},(e,{dispatch:r,flag:n,expose:o})=>{const[l,g]=u(e.value),a=()=>e.value??l();let i;return o({focus:t=>i?.focus(t),blur:()=>i?.blur(),clear:()=>i?.clear(),send:()=>i?.send(),insertEntity:t=>i?.insertEntity(t)}),s(c,{get value(){return a()},get placeholder(){return e.placeholder},get disabled(){return n("disabled")},get loading(){return n("loading")},get maxHeight(){return e.maxHeight},get submitOnEnter(){return n("submitOnEnter")},get triggers(){return e.triggers},get highlights(){return e.highlights},get kindIcons(){return e.kindIcons},onChange:t=>{g(t.doc),r("kai-value-change",{doc:t.doc,text:t.text,entities:t.entities})},onSubmit:t=>{r("kai-submit",{doc:t.doc,text:t.text,entities:t.entities})},onEntityAdd:t=>r("kai-entity-add",{entity:t}),onEntityRemove:t=>r("kai-entity-remove",{entity:t}),onTrigger:t=>r("kai-trigger",t),onTriggerClose:()=>r("kai-trigger-close",{}),onFocus:t=>r("kai-focus",{originalEvent:t}),onBlur:t=>r("kai-blur",{originalEvent:t}),controllerRef:t=>i=t})});export{v as parseKaiTriggerItemElement};
@@ -1 +1 @@
1
- import{f as d,c as u}from"./chunks/define-B_tXMYRm.js";import{C as s}from"./chunks/confirm-card-BWjf2-xo.js";d("kai-confirm",{data:void 0,cardId:void 0,heading:void 0,autofocus:!1,resolution:void 0},(r,{element:i,flag:t,expose:n})=>{let o;return n({focus:e=>o?.focus(e),confirm:e=>o?.confirm(e),dismiss:()=>o?.dismiss(),reopen:()=>o?.reopen()}),u(s,{get data(){return r.data},get cardId(){return r.cardId??(i.id||"kai-confirm")},get heading(){return r.heading},get autofocus(){return t("autofocus")},get resolution(){return r.resolution},controllerRef:e=>o=e,hostElement:i})});
1
+ import{f as d,c as u}from"./chunks/define-wjHR1MkU.js";import{C as s}from"./chunks/confirm-card-B0flE3MN.js";d("kai-confirm",{data:void 0,cardId:void 0,heading:void 0,autofocus:!1,resolution:void 0},(r,{element:i,flag:t,expose:n})=>{let o;return n({focus:e=>o?.focus(e),confirm:e=>o?.confirm(e),dismiss:()=>o?.dismiss(),reopen:()=>o?.reopen()}),u(s,{get data(){return r.data},get cardId(){return r.cardId??(i.id||"kai-confirm")},get heading(){return r.heading},get autofocus(){return t("autofocus")},get resolution(){return r.resolution},controllerRef:e=>o=e,hostElement:i})});
@@ -1 +1 @@
1
- import{f as d,l as g,k as i,x as l,c as t,i as r,S as s,t as T}from"./chunks/define-B_tXMYRm.js";import{h as k,C as x,a as m,b as v,c as p,d as w,e as f,f as C,i as D,j as S,g as b,D as j,k as y}from"./chunks/context-hKjNqiyQ.js";var E=T("<div class=space-y-1.5>");d("kai-context",{context:void 0,warnThreshold:void 0,dangerThreshold:void 0},(e,{dispatch:c})=>{const o=()=>e.warnThreshold??j,a=()=>e.dangerThreshold??y,h=g(()=>{const n=e.context;return n?k(n.usedTokens/n.maxTokens,o(),a()):"ok"});return i(l(h,(n,u)=>{u!==void 0&&n!==u&&c("kai-threshold-change",{level:n})})),t(s,{get when(){return e.context},get children(){return t(x,{get usedTokens(){return e.context.usedTokens},get maxTokens(){return e.context.maxTokens},get inputTokens(){return e.context.inputTokens},get outputTokens(){return e.context.outputTokens},get reasoningTokens(){return e.context.reasoningTokens},get cacheTokens(){return e.context.cacheTokens},get estimatedCost(){return e.context.estimatedCost},get warnThreshold(){return o()},get dangerThreshold(){return a()},get children(){return[t(m,{}),t(v,{get children(){return[t(p,{}),t(w,{get children(){var n=E();return r(n,t(f,{}),null),r(n,t(C,{}),null),r(n,t(s,{get when(){return e.context.reasoningTokens},get children(){return t(D,{})}}),null),r(n,t(s,{get when(){return e.context.cacheTokens},get children(){return t(S,{})}}),null),n}}),t(b,{})]}})]}})}})});
1
+ import{f as d,l as g,k as i,x as l,c as t,i as r,S as s,t as T}from"./chunks/define-wjHR1MkU.js";import{h as k,C as x,a as m,b as v,c as p,d as w,e as f,f as C,i as D,j as S,g as b,D as j,k as y}from"./chunks/context-VLIL3sJ-.js";var E=T("<div class=space-y-1.5>");d("kai-context",{context:void 0,warnThreshold:void 0,dangerThreshold:void 0},(e,{dispatch:c})=>{const o=()=>e.warnThreshold??j,a=()=>e.dangerThreshold??y,h=g(()=>{const n=e.context;return n?k(n.usedTokens/n.maxTokens,o(),a()):"ok"});return i(l(h,(n,u)=>{u!==void 0&&n!==u&&c("kai-threshold-change",{level:n})})),t(s,{get when(){return e.context},get children(){return t(x,{get usedTokens(){return e.context.usedTokens},get maxTokens(){return e.context.maxTokens},get inputTokens(){return e.context.inputTokens},get outputTokens(){return e.context.outputTokens},get reasoningTokens(){return e.context.reasoningTokens},get cacheTokens(){return e.context.cacheTokens},get estimatedCost(){return e.context.estimatedCost},get warnThreshold(){return o()},get dangerThreshold(){return a()},get children(){return[t(m,{}),t(v,{get children(){return[t(p,{}),t(w,{get children(){var n=E();return r(n,t(f,{}),null),r(n,t(C,{}),null),r(n,t(s,{get when(){return e.context.reasoningTokens},get children(){return t(D,{})}}),null),r(n,t(s,{get when(){return e.context.cacheTokens},get children(){return t(S,{})}}),null),n}}),t(b,{})]}})]}})}})});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import{f as u,g as l,o as d,h as g,c as b,v as r,j as o,t as a}from"./chunks/define-wjHR1MkU.js";import{r as f,a as p}from"./chunks/slots-DaNjX0rc.js";import{S as w}from"./chunks/conversation-item-BDztezOG.js";var h=a("<slot>"),_=a("<slot name=leading>"),$=a("<slot name=meta>"),I=a("<slot name=menu>");u("kai-conversation-item",{conversationId:void 0,active:void 0,compact:void 0},(c,{element:e,flag:i,reflectFlag:v})=>{const[n,m]=l({});return d(()=>{const t=()=>m(f(e,p));t();const s=new MutationObserver(t);s.observe(e,{childList:!0,attributes:!0,subtree:!0}),g(()=>s.disconnect()),e.hasAttribute("role")||e.setAttribute("role","listitem")}),v("active"),b(w,{get conversationId(){return c.conversationId},get active(){return i("active")},get compact(){return i("compact")},hostSemantics:!0,get leading(){return o(()=>!!n().leading)()?(()=>{var t=_();return t._$owner=r(),t})():void 0},get meta(){return o(()=>!!n().meta)()?(()=>{var t=$();return t._$owner=r(),t})():void 0},get menu(){return o(()=>!!n().menu)()?(()=>{var t=I();return t._$owner=r(),t})():void 0},get children(){var t=h();return t._$owner=r(),t}})});
@@ -1 +1 @@
1
- import{f as y,g as v,o as I,h as x,c,j as u,u as d,S as A,t as g}from"./chunks/define-B_tXMYRm.js";import{c as O,C as _,a as $}from"./chunks/conversation-list-CsGJjSKG.js";import{r as q,a as E}from"./chunks/slots-CIw9RlAe.js";var M=g("<slot name=header>"),R=g("<slot name=footer>"),D=g("<slot name=empty>");function f(r){var t;return{id:r.getAttribute("id")??"",title:((t=r.textContent)==null?void 0:t.trim())??"",groupId:r.getAttribute("group-id")??void 0,scope:{type:"collection"},messageCount:0,lastMessageAt:new Date(0).toISOString(),updatedAt:new Date(0).toISOString()}}y("kai-conversations",{groups:[],conversations:[],activeId:void 0,collapsed:void 0,defaultCollapsed:void 0},(r,{dispatch:t,element:s,expose:m,flag:h})=>{const[w,S]=v([]),[l,b]=v({});I(()=>{const e=()=>{const i=[...s.querySelectorAll("kai-conversation")];S(i.map(f)),b(q(s,E))};e();const n=new MutationObserver(e);n.observe(s,{childList:!0,attributes:!0,subtree:!0}),x(()=>n.disconnect())});const k=()=>[...r.conversations??[],...w()],[p,C]=O(()=>r.collapsed,h("defaultCollapsed")),o=e=>{C(e),t("kai-collapse-toggle",{collapsed:e})};let a;return m({focus:e=>{var n,i;a?a.focus(e):(i=(n=s.shadowRoot)==null?void 0:n.querySelector("input"))==null||i.focus(e)},clear:()=>a?.clearSearch(),select:e=>t("kai-conversation-select",{id:e}),collapse:()=>o(!0),expand:()=>o(!1),toggle:()=>o(!p())}),c(A,{get when(){return!p()},get fallback(){return c($,{onExpand:()=>o(!1)})},get children(){return c(_,{get groups(){return r.groups??[]},get conversations(){return k()},get activeId(){return r.activeId},onSelect:e=>t("kai-conversation-select",{id:e}),onNewChat:()=>t("kai-new-chat"),onToggleSidebar:()=>{t("kai-toggle-sidebar"),o(!0)},onSearchChange:e=>t("kai-search",{query:e}),controllerRef:e=>a=e,get header(){return u(()=>!!l().header)()?(()=>{var e=M();return e._$owner=d(),e})():void 0},get footer(){return u(()=>!!l().footer)()?(()=>{var e=R();return e._$owner=d(),e})():void 0},get empty(){return u(()=>!!l().empty)()?(()=>{var e=D();return e._$owner=d(),e})():void 0}})}})});export{f as parseKaiConversationElement};
1
+ import{c as l,m as U,s as F,g as I,l as C,o as T,i as m,S as f,u as H,a as E,F as K,j as A,b as G,t as d,d as J,e as Q,f as V,h as W,k as X,v as N}from"./chunks/define-wjHR1MkU.js";import{c as Y}from"./chunks/controllable-DTwTIlwp.js";import{r as Z,b as ee}from"./chunks/slots-DaNjX0rc.js";import{c as M}from"./chunks/cn-CU7UAWzk.js";import{a as te,b as re,C as ne}from"./chunks/collapsible-BzbXpPzr.js";import{B as q}from"./chunks/button-flUbeufF.js";import{B as oe}from"./chunks/badge-Q0-Cmwzz.js";import{S as _}from"./chunks/scroll-area-ClZkZxIk.js";import{C as z}from"./chunks/conversation-item-BDztezOG.js";import{I as ae}from"./chunks/Icon--Y8vsFal.js";var le=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ie=o=>l(ae,U(o,{name:"PanelLeftOpen",iconNode:le})),ce=ie,se=d('<div class="px-3 pb-2"><div class="flex items-center gap-2 rounded-md bg-surface-strong px-2.5 py-1.5"><svg width=13 height=13 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class=text-muted-foreground><circle cx=11 cy=11 r=8></circle><line x1=21 y1=21 x2=16.65 y2=16.65></line></svg><input type=text placeholder="Search chats..."aria-label="Search chats"class="bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring w-full">'),ue=d('<div role=list aria-label=Conversations part=items class="space-y-0.5 py-1">'),de=d('<div class="flex flex-1 flex-col items-center justify-center gap-1 p-6 text-center text-sm text-muted-foreground">No conversations match your search'),ge=d('<div class="space-y-0.5 py-1">'),he=d('<div class="shrink-0 border-t border-border">'),ve=d("<div>"),pe=d('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=3 y1=12 x2=21 y2=12></line><line x1=3 y1=6 x2=21 y2=6></line><line x1=3 y1=18 x2=21 y2=18>'),fe=d('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=12 y1=5 x2=12 y2=19></line><line x1=5 y1=12 x2=19 y2=12>'),me=d('<div class="flex items-center justify-between p-3 pb-2"><div class="flex items-center gap-2"><span class="text-sm font-semibold text-foreground">Chats'),xe=d('<div class="flex flex-1 flex-col items-center justify-center gap-1 p-6 text-center text-sm text-muted-foreground">No conversations yet'),ye=d('<svg width=10 height=10 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="6 9 12 15 18 9">'),we=d("<span>"),be=d('<div class="pl-2 mt-0.5 space-y-0.5">');function ke(o){return l(q,{variant:"ghost",size:"icon-sm","aria-label":"Open sidebar",get class(){return M("rounded-full bg-card/80 shadow-sm backdrop-blur",o.class)},get onClick(){return o.onExpand},get children(){return l(ce,{class:"size-4"})}})}function R(o){const e=o.conversationId;return typeof e=="string"&&e?e:o.getAttribute("conversation-id")??o.id}function Ce(o){const e=n=>{const r=o.getItems();return n.composedPath().find(s=>r.includes(s))},v=n=>{var r;return((r=n.shadowRoot)==null?void 0:r.querySelector("[data-kai-item-body]"))??n},g=n=>n.composedPath().some(r=>r instanceof Element&&(r.hasAttribute("data-kai-item-menu")||r.getAttribute("slot")==="menu")),p=(n,r,s)=>{n.getAttribute(r)!==s&&n.setAttribute(r,s)},w=n=>{const r=new Map;for(const s of n){const u=v(s);u===s&&s.localName.includes("-")||r.set(s,u)}return r},x=(n,r)=>{for(const[s,u]of w(n))p(u,"tabindex",s===r?"0":"-1")};return{sync:()=>{const n=o.getItems(),r=o.getActiveId(),s=w(n);let u;for(const[a,t]of s){const c=r!==void 0&&R(a)===r;t.hasAttribute("role")||t.setAttribute("role","button"),p(t,"aria-current",c?"true":"false");const h=a;h.active!==c&&(h.active=c),c&&(u=a)}x(n,u??s.keys().next().value)},handleClick(n){const r=e(n);!r||g(n)||o.onSelect(R(r))},handleKeyDown(n){const r=o.getItems();if(r.length===0)return;const s=e(n);if(n.key==="Enter"||n.key===" "){if(!s||g(n))return;n.preventDefault(),o.onSelect(R(s));return}let u;const a=s?r.indexOf(s):r.findIndex(t=>v(t).getAttribute("tabindex")==="0");n.key==="ArrowDown"?u=r[Math.min(a+1,r.length-1)]:n.key==="ArrowUp"?u=r[Math.max(a-1,0)]:n.key==="Home"?u=r[0]:n.key==="End"&&(u=r[r.length-1]),u&&(n.preventDefault(),x(r,u),v(u).focus())}}}function Se(o){const[e]=F(o,["groups","conversations","activeId","onSelect","onNewChat","onToggleSidebar","header","footer","empty","compact","onSearchChange","controllerRef","items","itemsKeyDown","itemsClick","class"]),[v,g]=I(""),p=C(()=>e.items!=null),w=C(()=>e.conversations.length===0);let x;const n=a=>{var t;g(a),(t=e.onSearchChange)==null||t.call(e,a)};T(()=>{var a;(a=e.controllerRef)==null||a.call(e,{focus:t=>x?.focus(t),clearSearch:()=>n("")})});const r=C(()=>{const a=v().toLowerCase();return a?e.conversations.filter(t=>t.title.toLowerCase().includes(a)):e.conversations}),s=C(()=>{const a=new Map;for(const t of r()){const c=t.groupId;a.has(c)||a.set(c,[]),a.get(c).push(t)}return a}),u=C(()=>{const a=new Set((e.groups??[]).map(t=>t.id));return r().filter(t=>t.groupId==null||!a.has(t.groupId))});return(()=>{var a=ve();return m(a,l(f,{get when(){return e.header},get fallback(){return(()=>{var t=me(),c=t.firstChild,h=c.firstChild;return m(c,l(q,{variant:"ghost",size:"icon-sm","aria-label":"Toggle sidebar",get onClick(){return e.onToggleSidebar},get children(){return pe()}}),h),m(t,l(q,{variant:"ghost",size:"icon-sm","aria-label":"New chat",get onClick(){return e.onNewChat},get children(){return fe()}}),null),t})()},get children(){return e.header}}),null),m(a,l(f,{get when(){return p()||!w()},get children(){var t=se(),c=t.firstChild,h=c.firstChild,k=h.nextSibling;k.$$input=b=>n(b.currentTarget.value);var y=x;return typeof y=="function"?H(y,k):x=k,E(()=>k.value=v()),t}}),null),m(a,l(f,{get when(){return p()},get children(){return l(_,{class:"flex-1 px-2",get children(){var t=ue();return t.$$click=c=>{var h;return(h=e.itemsClick)==null?void 0:h.call(e,c)},t.$$keydown=c=>{var h;return(h=e.itemsKeyDown)==null?void 0:h.call(e,c)},m(t,()=>e.items),t}})}}),null),m(a,l(f,{get when(){return A(()=>!p())()&&!w()},get fallback(){return l(f,{get when(){return!p()},get children(){return l(f,{get when(){return e.empty},get fallback(){return xe()},get children(){return e.empty}})}})},get children(){return[l(f,{get when(){return r().length===0},get children(){return de()}}),l(f,{get when(){return r().length>0},get children(){return l(_,{class:"flex-1 px-2",get children(){return[l(K,{get each(){return e.groups},children:t=>{const c=C(()=>s().get(t.id)??[]);return l(f,{get when(){return c().length>0},get children(){return l(L,{get name(){return t.name},get count(){return c().length},get conversations(){return c()},get activeId(){return e.activeId},get onSelect(){return e.onSelect},get compact(){return e.compact}})}})}}),l(f,{get when(){return u().length>0},get children(){return l(f,{get when(){return e.compact},get fallback(){return l(L,{name:"Ungrouped",get count(){return u().length},get conversations(){return u()},get activeId(){return e.activeId},get onSelect(){return e.onSelect}})},get children(){var t=ge();return m(t,l(K,{get each(){return u()},children:c=>l(z,{conversation:c,get isActive(){return c.id===e.activeId},get onSelect(){return e.onSelect},compact:!0})})),t}})}})]}})}})]}}),null),m(a,l(f,{get when(){return e.footer},get children(){var t=he();return m(t,()=>e.footer),t}}),null),E(()=>G(a,M("flex flex-col h-full bg-sidebar",e.class))),a})()}function L(o){const[e,v]=I(!0);return l(ne,{get open(){return e()},onOpenChange:v,get children(){return[l(te,{class:"flex items-center gap-1.5 w-full px-1.5 py-1 rounded-md text-[13px] text-muted-foreground font-medium hover:bg-muted/30 transition-colors cursor-pointer mt-1.5",get children(){return[(()=>{var g=ye();return E(()=>J(g,"class",M("transition-transform",!e()&&"-rotate-90"))),g})(),(()=>{var g=we();return m(g,()=>o.name),g})(),l(oe,{variant:"count",class:"ml-auto text-[11px]",get children(){return o.count}})]}}),l(re,{get children(){var g=be();return m(g,l(K,{get each(){return o.conversations},children:p=>l(z,{conversation:p,get isActive(){return p.id===o.activeId},get onSelect(){return o.onSelect},get compact(){return o.compact}})})),g}})]}})}Q(["input","keydown","click"]);var Ie=d("<slot>"),Ae=d("<slot name=header>"),$e=d("<slot name=footer>"),De=d("<slot name=empty>");function j(o){var e;return{id:o.getAttribute("id")??"",title:((e=o.textContent)==null?void 0:e.trim())??"",groupId:o.getAttribute("group-id")??void 0,messageCount:0,updatedAt:""}}V("kai-conversations",{groups:[],conversations:[],activeId:void 0,collapsed:void 0,defaultCollapsed:void 0,compact:void 0},(o,{dispatch:e,element:v,expose:g,flag:p})=>{const[w,x]=I([]),[n,r]=I([]),[s,u]=I({});T(()=>{const i=()=>{const $=[...v.querySelectorAll("kai-conversation")];x($.map(j));const D=[...v.querySelectorAll(":scope > kai-conversation-item")];r(B=>B.length===D.length&&D.every((P,O)=>P===B[O])?B:D),u(Z(v,ee)),D.length&&c.sync()};i();const S=new MutationObserver(i);S.observe(v,{childList:!0,attributes:!0,subtree:!0}),W(()=>S.disconnect())});const a=()=>n().length>0,t=()=>[...o.conversations??[],...w()],c=Ce({getItems:n,getActiveId:()=>o.activeId,onSelect:i=>e("kai-conversation-select",{id:i})});X(()=>{a()&&c.sync()});const[h,k]=Y(()=>o.collapsed,p("defaultCollapsed")),y=i=>{k(i),e("kai-collapse-toggle",{collapsed:i})};let b;return g({focus:i=>{var S,$;b?b.focus(i):($=(S=v.shadowRoot)==null?void 0:S.querySelector("input"))==null||$.focus(i)},clear:()=>b?.clearSearch(),select:i=>e("kai-conversation-select",{id:i}),collapse:()=>y(!0),expand:()=>y(!1),toggle:()=>y(!h())}),l(f,{get when(){return!h()},get fallback(){return l(ke,{onExpand:()=>y(!1)})},get children(){return l(Se,{get groups(){return o.groups??[]},get conversations(){return t()},get activeId(){return o.activeId},onSelect:i=>e("kai-conversation-select",{id:i}),onNewChat:()=>e("kai-new-chat"),onToggleSidebar:()=>{e("kai-toggle-sidebar"),y(!0)},get compact(){return p("compact")},onSearchChange:i=>e("kai-search",{query:i}),controllerRef:i=>b=i,get items(){return A(()=>!!a())()?(()=>{var i=Ie();return i._$owner=N(),i})():void 0},get itemsKeyDown(){return c.handleKeyDown},get itemsClick(){return c.handleClick},get header(){return A(()=>!!s().header)()?(()=>{var i=Ae();return i._$owner=N(),i})():void 0},get footer(){return A(()=>!!s().footer)()?(()=>{var i=$e();return i._$owner=N(),i})():void 0},get empty(){return A(()=>!!s().empty)()?(()=>{var i=De();return i._$owner=N(),i})():void 0}})}})});export{j as parseKaiConversationElement};
@@ -43,8 +43,8 @@ export interface DefaultPromptInputProps {
43
43
  * (name, media type, reason) and renders nothing itself: what the user should
44
44
  * see is the application's call, not the kit's. */
45
45
  onAttachmentsRejected?: (rejected: RejectedAttachment[]) => void;
46
- /** Show a Search (Globe) button in the left toolbar; calls `onSearch`. */
47
- search?: boolean;
46
+ /** Show a web-search (Globe) button in the left toolbar; calls `onWebSearch`. */
47
+ webSearch?: boolean;
48
48
  /** Show a Voice (Mic) button in the left toolbar; calls `onVoice`. */
49
49
  voice?: boolean;
50
50
  /** Send-button visibility. `'always'` (default) always shows it; `'auto'` shows
@@ -57,7 +57,7 @@ export interface DefaultPromptInputProps {
57
57
  onSubmit: () => void;
58
58
  onSuggestionClick: (v: string) => void;
59
59
  onAttachmentsChange?: (attachments: AttachmentData[]) => void;
60
- onSearch?: () => void;
60
+ onWebSearch?: () => void;
61
61
  onVoice?: () => void;
62
62
  /** When `true` and `loading` is also `true`, the send button is replaced by
63
63
  * a Stop button that calls `onStop`. */
@@ -35,6 +35,33 @@ export interface WebComponentContext<E = Record<string, unknown>> {
35
35
  * convention). Methods are attached when the facade renders (on element upgrade).
36
36
  */
37
37
  expose: (methods: Record<string, (...args: never[]) => unknown>) => void;
38
+ /**
39
+ * Reflect a boolean prop to its host attribute AND make that prop read back what
40
+ * was set. Use this instead of hand-rolling
41
+ * `createEffect(() => element.toggleAttribute('x', flag('x')))`.
42
+ *
43
+ * WHY IT IS ONE CALL AND NOT TWO. The reflection is what BREAKS the read-back, so
44
+ * the fix has to be attached to it or it gets forgotten — and it was, three times.
45
+ * `toggleAttribute(name, true)` sets the attribute to the EMPTY STRING;
46
+ * component-register's `attributeChangedCallback` then writes the prop back as
47
+ * `this[name] = parseAttributeValue("")`, and `parseAttributeValue` returns
48
+ * `undefined` for the empty string. So a reflected flag became write-only:
49
+ * `el.loading = true` left `el.loading === undefined` while `[loading]` was on the
50
+ * host. The element kept BEHAVING correctly, because `flag()` reads the attribute —
51
+ * which is precisely why nobody noticed until a consumer tried to read the property
52
+ * back (findings G-05).
53
+ *
54
+ * What this installs is an instance-level wrapper around the accessor
55
+ * component-register already created, coercing every incoming value through the
56
+ * same `flag()` policy (`resolveFlag`) — so the `undefined` write-back resolves to
57
+ * the attribute that caused it, and the property and the attribute can no longer
58
+ * disagree. It delegates to the underlying setter, so reactivity is untouched.
59
+ *
60
+ * `source` overrides where the ON/OFF value comes from, for an element whose truth
61
+ * is an internal controller rather than the prop (see `wireDisclosure`). Returning
62
+ * `undefined` from it means "not ready, leave the attribute alone".
63
+ */
64
+ reflectFlag: (name: string, source?: () => boolean | undefined) => void;
38
65
  /**
39
66
  * Whether the element should currently render its dark-mode look --
40
67
  * exactly the SAME resolved value that already drives the `.dark` class
@@ -0,0 +1,74 @@
1
+ /** The envelope, structurally identical to `WireDiagnosticBase`. Restated here
2
+ * rather than imported so this file keeps its zero-import property; the two are
3
+ * kept in step by `element-diagnostics.test.ts`, which asserts every emitted
4
+ * element event carries a `type` and a numeric `t`. */
5
+ export interface ElementDiagnosticBase {
6
+ type: string;
7
+ /** `Date.now()` at emission. */
8
+ t: number;
9
+ }
10
+ /** Which contract was broken. A closed vocabulary, so a panel keys its own
11
+ * explanation off the kind and never needs prose from the kit. */
12
+ export type ElementViolationKind =
13
+ /** A non-scalar prop received a value through the ATTRIBUTE channel. The
14
+ * attribute cannot carry an array or an object, so the property now holds a
15
+ * string and the element renders nothing. */
16
+ 'array-prop-as-attribute'
17
+ /** A list prop was set to the array reference it already held. Solid compares
18
+ * with `===`, so this notified nothing — a no-op write. */
19
+ | 'same-array-reference'
20
+ /** A list prop received a NEW array of the SAME length whose every item is
21
+ * reference-identical to the previous array's. The array notified, but every
22
+ * row's identity is unchanged, so a reference-keyed `<For>` re-invokes none
23
+ * of them. The classic "I mutated the item and copied the array" case.
24
+ *
25
+ * NOTE what this deliberately does NOT claim: the kit cannot know an item
26
+ * "changed" without comparing its CONTENT, and content is payload. So this
27
+ * reports the structurally knowable fact — an update that cannot render —
28
+ * and leaves the question of whether the consumer meant anything by it to
29
+ * the consumer, who is the only one who can answer it. */
30
+ | 'mutated-in-place';
31
+ /** A consumer broke one of the three `kai-` contract rules on a live element. */
32
+ export interface ElementViolationEvent extends ElementDiagnosticBase {
33
+ type: 'element.violation';
34
+ kind: ElementViolationKind;
35
+ /** The custom-element tag, e.g. `kai-chat`. */
36
+ tag: string;
37
+ /** The camelCase prop name, e.g. `messages`. */
38
+ prop: string;
39
+ /**
40
+ * SHAPE of the offending value, never its content. `array-prop-as-attribute`
41
+ * only. A closed vocabulary:
42
+ *
43
+ * `[object Object]` one object stringified into the attribute
44
+ * `[object Object] x N` an array of N objects stringified — the common case
45
+ * `json:number` the attribute held valid JSON, but a scalar
46
+ * `json:boolean` "
47
+ * `json:null` "
48
+ * `string(len=N)` anything else: the LENGTH of the text, never the text
49
+ * `empty-attribute` a bare attribute on a prop that needs a value
50
+ */
51
+ valuePreview?: string;
52
+ /** Element count of the array involved. `same-array-reference` and
53
+ * `mutated-in-place` only. A length is shape, not content. */
54
+ length?: number;
55
+ }
56
+ /** Which `kai-*` elements are DEFINED in this realm right now.
57
+ *
58
+ * The question behind it is hydration: an SSR page whose markup contains
59
+ * `<kai-chat>` but whose element bundle never loaded shows empty boxes and no
60
+ * error, because an undefined custom element is a valid, inert HTMLElement.
61
+ * The SSR starters already answer this by hand for a hard-coded handful
62
+ * (`HydrationBadge.tsx`); this is the same answer over the whole manifest. */
63
+ export interface ElementRegistryEvent extends ElementDiagnosticBase {
64
+ type: 'element.registry';
65
+ /** Tags `customElements.get()` resolved. */
66
+ defined: string[];
67
+ /** Tags in the manifest that are NOT defined in this realm. Named for what it
68
+ * is rather than `undefined`, which is a miserable key to read in a panel. */
69
+ notDefined: string[];
70
+ /** `defined.length + notDefined.length`. Present so a panel can show "62 of
71
+ * 79" without trusting itself to add up two arrays it may have truncated. */
72
+ total: number;
73
+ }
74
+ export type ElementDiagnosticEvent = ElementViolationEvent | ElementRegistryEvent;
@@ -1 +1 @@
1
- import{y as W,g as $,w as B,k as F,c as x,P as G,v as L,i as w,S as O,d as p,a as I,b as j,t as h,e as J,f as N,o as Q,h as U,u as E,j as z}from"./chunks/define-B_tXMYRm.js";import{c as D}from"./chunks/cn-CU7UAWzk.js";import{c as V}from"./chunks/overlay-CV7z2YuX.js";import{w as X}from"./chunks/disclosure-DAoYOKew.js";var Y=h('<header part=header class="shrink-0 border-b border-border px-5 py-4 text-base font-semibold text-foreground">'),Z=h('<footer part=footer class="flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-3">'),ee=h('<div part=backdrop><div part=panel role=dialog aria-modal=true tabindex=-1><div part=body class="min-h-0 flex-1 overflow-auto px-5 py-4 text-sm text-foreground">');const _=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function te(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&getComputedStyle(t).visibility!=="hidden"}function oe(t){const a=[],u=f=>{for(const i of Array.from(f.children))if(i instanceof HTMLSlotElement)for(const d of i.assignedElements())d instanceof HTMLElement&&(d.matches(_)&&a.push(d),u(d));else i instanceof HTMLElement&&(i.matches(_)&&a.push(i),u(i))};return u(t),a.filter(te)}function P(){var t;let a=document.activeElement;for(;(t=a?.shadowRoot)!=null&&t.activeElement;)a=a.shadowRoot.activeElement;return a}function ne(t){var a;const u=W(),[f,i]=$(t.defaultOpen??!1),d=`kai-dialog-title-${B()}`,v=()=>t.open!==void 0,m=()=>v()?!!t.open:f(),b=o=>{var n;v()||i(o),(n=t.onOpenChange)==null||n.call(t,o)};(a=t.controllerRef)==null||a.call(t,{open:m,setOpen:b});const c=V(m);let y,l,r=null,k=!1;F(o=>{const n=m();if(n&&!o)r=P(),queueMicrotask(()=>l?.focus());else if(!n&&o){const s=r;r=null,s&&s.isConnected&&queueMicrotask(()=>s.focus())}return n},!1);const A=o=>{if(o.key==="Escape"){o.stopPropagation(),b(!1);return}if(o.key!=="Tab"||!l)return;const n=oe(l);if(!n.length){o.preventDefault(),l.focus();return}const s=P(),e=s?n.indexOf(s):-1;o.shiftKey?e<=0&&(o.preventDefault(),n[n.length-1].focus()):(e===-1||e===n.length-1)&&(o.preventDefault(),n[0].focus())},K=o=>{k&&o.target===y&&b(!1),k=!1};return x(O,{get when(){return c.present()},get children(){return x(G,{get mount(){return u.portalMount()},get children(){var o=ee(),n=o.firstChild,s=n.firstChild;return o.$$keydown=A,o.$$click=K,o.$$pointerdown=e=>{k=e.target===e.currentTarget},L(e=>{y=e,c.setRef(e)},o),L(e=>{var g;l=e,(g=t.panelRef)==null||g.call(t,e)},n),w(n,x(O,{get when(){return t.header},get children(){var e=Y();return p(e,"id",d),w(e,()=>t.header),e}}),s),w(s,()=>t.children),w(n,x(O,{get when(){return t.footer},get children(){var e=Z();return w(e,()=>t.footer),e}}),null),I(e=>{var g=c.state()==="open"?"":void 0,M=c.state()==="closed"?"":void 0,R=D("fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4","animate-in fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0 motion-reduce:animate-none"),C=t.header?d:void 0,S=t.header?void 0:t["aria-label"],T=c.state()==="open"?"":void 0,q=c.state()==="closed"?"":void 0,H=D("flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-border bg-background text-foreground shadow-xl outline-none","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 motion-reduce:animate-none",t.class);return g!==e.e&&p(o,"data-expanded",e.e=g),M!==e.t&&p(o,"data-closed",e.t=M),R!==e.a&&j(o,e.a=R),C!==e.o&&p(n,"aria-labelledby",e.o=C),S!==e.i&&p(n,"aria-label",e.i=S),T!==e.n&&p(n,"data-expanded",e.n=T),q!==e.s&&p(n,"data-closed",e.s=q),H!==e.h&&j(n,e.h=H),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),o}})}})}J(["pointerdown","click","keydown"]);var re=h("<slot>"),ae=h("<slot name=header>"),ie=h("<slot name=footer>");N("kai-dialog",{open:void 0,defaultOpen:void 0},(t,a)=>{const{flag:u,element:f,expose:i}=a;let d,v;X(a,()=>d,()=>t.open);const[m,b]=$(!1),[c,y]=$(!1),l=()=>{b(!!f.querySelector(':scope > [slot="header"]')),y(!!f.querySelector(':scope > [slot="footer"]'))};return Q(()=>{if(l(),typeof MutationObserver=="function"){const r=new MutationObserver(l);r.observe(f,{childList:!0}),U(()=>r.disconnect())}}),i({focus:r=>v?.focus(r)}),x(ne,{get defaultOpen(){return u("defaultOpen")},get header(){return z(()=>!!m())()?(()=>{var r=ae();return r._$owner=E(),r})():void 0},get footer(){return z(()=>!!c())()?(()=>{var r=ie();return r._$owner=E(),r})():void 0},controllerRef:r=>d=r,panelRef:r=>v=r,get children(){var r=re();return r._$owner=E(),r}})});
1
+ import{A as B,g as $,w as F,k as G,c as x,P as I,u as D,i as w,S as O,d as p,a as J,b as H,t as h,e as N,f as Q,o as U,h as V,v as E,j as L}from"./chunks/define-wjHR1MkU.js";import{c as z}from"./chunks/cn-CU7UAWzk.js";import{c as X}from"./chunks/overlay-DuiwdXjm.js";import{w as Y}from"./chunks/disclosure-CcNbyLy0.js";var Z=h('<header part=header class="shrink-0 border-b border-border px-5 py-4 text-base font-semibold text-foreground">'),ee=h('<footer part=footer class="flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-3">'),te=h('<div part=backdrop><div part=panel role=dialog aria-modal=true tabindex=-1><div part=body class="min-h-0 flex-1 overflow-auto px-5 py-4 text-sm text-foreground">');const _=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function oe(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&getComputedStyle(t).visibility!=="hidden"}function ne(t){const a=[],u=f=>{for(const l of Array.from(f.children))if(l instanceof HTMLSlotElement)for(const i of l.assignedElements())i instanceof HTMLElement&&(i.matches(_)&&a.push(i),u(i));else l instanceof HTMLElement&&(l.matches(_)&&a.push(l),u(l))};return u(t),a.filter(oe)}function A(){var t;let a=document.activeElement;for(;(t=a?.shadowRoot)!=null&&t.activeElement;)a=a.shadowRoot.activeElement;return a}function re(t){var a;const u=B(),[f,l]=$(t.defaultOpen??!1),i=`kai-dialog-title-${F()}`,v=()=>t.open!==void 0,m=()=>v()?!!t.open:f(),b=o=>{var n;v()||l(o),(n=t.onOpenChange)==null||n.call(t,o)};(a=t.controllerRef)==null||a.call(t,{open:m,setOpen:b});const c=X(m);let y,d,r=null,k=!1;G(o=>{const n=m();if(n&&!o)r=A(),queueMicrotask(()=>d?.focus());else if(!n&&o){const s=r;r=null,s&&s.isConnected&&queueMicrotask(()=>s.focus())}return n},!1);const K=o=>{if(o.key==="Escape"){o.stopPropagation(),b(!1);return}if(o.key!=="Tab"||!d)return;const n=ne(d);if(!n.length){o.preventDefault(),d.focus();return}const s=A(),e=s?n.indexOf(s):-1;o.shiftKey?e<=0&&(o.preventDefault(),n[n.length-1].focus()):(e===-1||e===n.length-1)&&(o.preventDefault(),n[0].focus())},W=o=>{k&&o.target===y&&b(!1),k=!1};return x(O,{get when(){return c.present()},get children(){return x(I,{get mount(){return u.portalMount()},get children(){var o=te(),n=o.firstChild,s=n.firstChild;return o.$$keydown=K,o.$$click=W,o.$$pointerdown=e=>{k=e.target===e.currentTarget},D(e=>{y=e,c.setRef(e)},o),D(e=>{var g;d=e,(g=t.panelRef)==null||g.call(t,e)},n),w(n,x(O,{get when(){return t.header},get children(){var e=Z();return p(e,"id",i),w(e,()=>t.header),e}}),s),w(s,()=>t.children),w(n,x(O,{get when(){return t.footer},get children(){var e=ee();return w(e,()=>t.footer),e}}),null),J(e=>{var g=c.state()==="open"?"":void 0,M=c.state()==="closed"?"":void 0,R=z("fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4","animate-in fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0 motion-reduce:animate-none"),C=t.header?i:void 0,S=t.header?void 0:t["aria-label"],T=c.state()==="open"?"":void 0,j=c.state()==="closed"?"":void 0,q=z("flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-border bg-background text-foreground shadow-xl outline-none","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 motion-reduce:animate-none",t.class);return g!==e.e&&p(o,"data-expanded",e.e=g),M!==e.t&&p(o,"data-closed",e.t=M),R!==e.a&&H(o,e.a=R),C!==e.o&&p(n,"aria-labelledby",e.o=C),S!==e.i&&p(n,"aria-label",e.i=S),T!==e.n&&p(n,"data-expanded",e.n=T),j!==e.s&&p(n,"data-closed",e.s=j),q!==e.h&&H(n,e.h=q),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),o}})}})}N(["pointerdown","click","keydown"]);var ae=h("<slot>"),le=h("<slot name=header>"),ie=h("<slot name=footer>");const P="Dialog";function de(t){return typeof t=="string"&&t.trim()!==""?t:P}Q("kai-dialog",{open:void 0,defaultOpen:void 0,label:P},(t,a)=>{const{flag:u,element:f,expose:l}=a;let i,v;Y(a,()=>i,()=>t.open);const[m,b]=$(!1),[c,y]=$(!1),d=()=>{b(!!f.querySelector(':scope > [slot="header"]')),y(!!f.querySelector(':scope > [slot="footer"]'))};return U(()=>{if(d(),typeof MutationObserver=="function"){const r=new MutationObserver(d);r.observe(f,{childList:!0}),V(()=>r.disconnect())}}),l({focus:r=>v?.focus(r)}),x(re,{get defaultOpen(){return u("defaultOpen")},get"aria-label"(){return de(t.label)},get header(){return L(()=>!!m())()?(()=>{var r=le();return r._$owner=E(),r})():void 0},get footer(){return L(()=>!!c())()?(()=>{var r=ie();return r._$owner=E(),r})():void 0},controllerRef:r=>i=r,panelRef:r=>v=r,get children(){var r=ae();return r._$owner=E(),r}})});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,149 @@
1
+ import{c,w as F,g as U,k as V,z as N,u as D,d as h,i as x,j as Y,S as H,a as q,H as j,n as z,t as k,e as W,f as G,v as w}from"./chunks/define-wjHR1MkU.js";import{x as K}from"./chunks/x-B6UnOiLw.js";import{m as X}from"./chunks/message-circle-CpXMM-_n.js";import{w as J}from"./chunks/disclosure-CcNbyLy0.js";var Q=k(`<style>
2
+ :host { display: contents; }
3
+
4
+ [data-kai-dock] {
5
+ position: fixed;
6
+ z-index: var(--kai-dock-z, 1000);
7
+ display: flex;
8
+ gap: var(--kai-dock-gap, 0.85rem);
9
+ /* Only a positioning frame: it must not swallow clicks on the page it floats
10
+ over. The launcher and the open panel opt back in. */
11
+ pointer-events: none;
12
+ }
13
+
14
+ /* Logical insets throughout, so an RTL page docks on the other side for free.
15
+ column-reverse for the bottom corners keeps the LAUNCHER FIRST IN DOM ORDER --
16
+ Tab reaches the control before the panel content -- while painting it below. */
17
+ [data-kai-dock][data-position^="bottom"] {
18
+ flex-direction: column-reverse;
19
+ inset-block-end: var(--kai-dock-inset, 1.5rem);
20
+ }
21
+ [data-kai-dock][data-position^="top"] {
22
+ flex-direction: column;
23
+ inset-block-start: var(--kai-dock-inset, 1.5rem);
24
+ }
25
+ [data-kai-dock][data-position$="end"] {
26
+ inset-inline-end: var(--kai-dock-inset, 1.5rem);
27
+ align-items: flex-end;
28
+ }
29
+ [data-kai-dock][data-position$="start"] {
30
+ inset-inline-start: var(--kai-dock-inset, 1.5rem);
31
+ align-items: flex-start;
32
+ }
33
+
34
+ [data-kai-dock] [part="launcher"] {
35
+ pointer-events: auto;
36
+ position: relative;
37
+ /* ABOVE the panel, always. At &lt;=480px the panel goes fixed/inset:0 and it comes
38
+ after the launcher in DOM order, so at z-index:auto it painted OVER the launcher
39
+ and a touch user lost every pointer route to closing. Both reference
40
+ implementations stacked the launcher over the panel for the same reason. */
41
+ z-index: 1;
42
+ flex: none;
43
+ display: inline-flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ gap: 0.5rem;
47
+ /* The size token is the BLOCK size and the inline MINIMUM, not a fixed square. An
48
+ icon-only launcher is still a perfect disc (the icon plus padding is narrower
49
+ than the minimum), but a slotted TEXT label \u2014 the reference app's "Support"
50
+ pill \u2014 widens the button instead of overflowing it. */
51
+ inline-size: auto;
52
+ min-inline-size: var(--kai-dock-launcher-size, 56px);
53
+ block-size: var(--kai-dock-launcher-size, 56px);
54
+ padding-block: 0;
55
+ padding-inline: 0.9rem;
56
+ white-space: nowrap;
57
+ border: 0;
58
+ border-radius: 9999px;
59
+ background: var(--color-primary);
60
+ color: var(--color-primary-foreground);
61
+ box-shadow: 0 10px 25px -6px rgb(0 0 0 / 0.35);
62
+ cursor: pointer;
63
+ transition: transform 150ms ease, box-shadow 150ms ease;
64
+ }
65
+ [data-kai-dock] [part="launcher"]:hover:not(:disabled) { transform: translateY(-1px); }
66
+ [data-kai-dock] [part="launcher"]:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
67
+ [data-kai-dock] [part="launcher"]:disabled { opacity: 0.55; cursor: not-allowed; }
68
+
69
+ [data-kai-dock] [part="badge"] {
70
+ position: absolute;
71
+ inset-block-start: 3px;
72
+ inset-inline-end: 3px;
73
+ inline-size: 0.75rem;
74
+ block-size: 0.75rem;
75
+ border-radius: 9999px;
76
+ background: var(--color-destructive);
77
+ box-shadow: 0 0 0 2px var(--color-primary);
78
+ }
79
+
80
+ [data-kai-dock] [part="panel"] {
81
+ pointer-events: auto;
82
+ display: flex;
83
+ flex-direction: column;
84
+ overflow: hidden;
85
+ inline-size: var(--kai-dock-width, 380px);
86
+ block-size: var(--kai-dock-height, 600px);
87
+ max-inline-size: calc(100vw - 2 * var(--kai-dock-inset, 1.5rem));
88
+ max-block-size: calc(
89
+ 100dvh - 2 * var(--kai-dock-inset, 1.5rem)
90
+ - var(--kai-dock-launcher-size, 56px) - var(--kai-dock-gap, 0.85rem)
91
+ );
92
+ border: 1px solid var(--color-border);
93
+ border-radius: var(--kai-dock-radius, 16px);
94
+ background: var(--color-background);
95
+ color: var(--color-foreground);
96
+ box-shadow: 0 20px 45px -12px rgb(0 0 0 / 0.35);
97
+ /* VISIBILITY IS SWITCHED, NEVER ANIMATED, and the zero duration is the whole point.
98
+ visibility 180ms here meant the COMPUTED value stayed hidden for about two
99
+ frames after opening while the inline style already said visible \u2014 and a
100
+ focus() into a hidden subtree is dropped silently, so focusOnOpen never landed
101
+ in a real browser (it worked under reduced motion, which is what made it look like
102
+ a focus bug rather than a paint one).
103
+ This rule is the CLOSING direction: hold visibility for the length of the fade so
104
+ the panel does not vanish mid-transition, then switch. The opening direction sets
105
+ the delay to 0s below, so opening is synchronous and focus has somewhere to go. */
106
+ transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
107
+ }
108
+ [data-kai-dock] [part="panel"][data-expanded] {
109
+ transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 0s;
110
+ }
111
+ /* The panel is a flex column and the slotted surface fills it -- the one layout
112
+ fact both reference implementations wrote by hand (flex:1; min-height:0). Both
113
+ spellings are here on purpose: ::slotted covers the shadow-DOM facade, > *
114
+ covers a plain Solid caller, and each is inert in the other's world (a &lt;slot>
115
+ is display:contents, so flex properties do nothing to it). */
116
+ [data-kai-dock] [part="panel"] ::slotted(*) { flex: 1 1 auto; min-block-size: 0; }
117
+ [data-kai-dock] [part="panel"] > * { flex: 1 1 auto; min-block-size: 0; }
118
+ [data-kai-dock] [part="panel"]:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
119
+ [data-kai-dock][data-position^="bottom"] [part="panel"][data-closed] { transform: translateY(0.5rem); }
120
+ [data-kai-dock][data-position^="top"] [part="panel"][data-closed] { transform: translateY(-0.5rem); }
121
+
122
+ /* Narrow viewports take the panel full-bleed. A SHIPPED DEFAULT, not a prop: both
123
+ references wrote this rule independently, which makes it a HOW. The launcher stays
124
+ in its corner and ON TOP of the full-bleed panel \u2014 that is the z-index: 1 in the
125
+ launcher rule above, not anything in this block, and without it a phone user has no
126
+ pointer route to closing at all (Escape alone strands exactly the touch user). */
127
+ @media (max-width: 480px) {
128
+ [data-kai-dock] [part="panel"] {
129
+ position: fixed;
130
+ inset: 0;
131
+ inline-size: auto;
132
+ block-size: auto;
133
+ max-inline-size: none;
134
+ max-block-size: none;
135
+ border: 0;
136
+ border-radius: 0;
137
+ }
138
+ }
139
+
140
+ @media (prefers-reduced-motion: reduce) {
141
+ /* [data-expanded] is listed explicitly because the open-direction rule above is
142
+ MORE SPECIFIC than a bare [part="panel"], so without it an opening panel kept
143
+ animating opacity and transform for exactly the users who asked it not to. */
144
+ [data-kai-dock] [part="launcher"],
145
+ [data-kai-dock] [part="panel"],
146
+ [data-kai-dock] [part="panel"][data-expanded] { transition: none; }
147
+ [data-kai-dock] [part="panel"][data-closed] { transform: none; }
148
+ }
149
+ `),Z=k("<span part=badge aria-hidden=true>"),ee=k("<div data-kai-dock><button part=launcher type=button><span aria-hidden=true style=display:inline-flex></span></button><div part=panel role=dialog aria-modal=false tabindex=-1>");function B(){return c(X,{size:24})}function P(){return c(K,{size:24})}function ae(){var e;let l=document.activeElement;for(;(e=l?.shadowRoot)!=null&&e.activeElement;)l=l.shadowRoot.activeElement;return l}function ne(e,l){let o=l;for(;o;){if(o===e)return!0;const b=o instanceof Element?o.assignedSlot:null;if(b){o=b;continue}if(o.parentNode){o=o.parentNode;continue}o=o instanceof ShadowRoot?o.host:null}return!1}function oe(e){var l;const o=`kai-dock-panel-${F()}`,[b,O]=U(e.defaultOpen??!1),v=()=>e.open!==void 0,t=()=>v()?!!e.open:b(),p=r=>{var i;v()||O(r),(i=e.onOpenChange)==null||i.call(e,r)};(l=e.controllerRef)==null||l.call(e,{open:t,setOpen:p});let f,g;const n=()=>e.label??"Chat",d=()=>t()?e.closeLabel??`Close ${n()}`:e.openLabel??`Open ${n()}`,y=()=>{var r;const i=e.focusOnOpen??"content";if(i!=="none"){if(i==="content"){const m=(r=e.contentTarget)==null?void 0:r.call(e);if(m?.focus(),m&&ne(f,ae()))return}f?.focus()}};V(r=>{const i=t();return i!==r&&queueMicrotask(i?y:()=>g?.focus()),i},N(()=>e.open??e.defaultOpen??!1));const _=r=>{r.key!=="Escape"||!t()||p(!1)};return[Q(),(()=>{var r=ee(),i=r.firstChild,m=i.firstChild,s=i.nextSibling;return r.$$keydown=_,i.$$click=()=>p(!t()),D(a=>{var u;g=a,(u=e.launcherRef)==null||u.call(e,a)},i),h(i,"aria-controls",o),x(i,c(H,{get when(){return Y(()=>!!e.unread)()&&!t()},get children(){return Z()}}),m),x(m,c(H,{get when(){return t()},get fallback(){return e.launcher??c(B,{})},get children(){return e.launcherOpen??e.launcher??c(P,{})}})),D(a=>{var u;f=a,(u=e.panelRef)==null||u.call(e,a)},s),h(s,"id",o),x(s,()=>e.children),q(a=>{var u=e.position??"bottom-end",E=t()?"true":"false",T=d(),R=e.disabled||void 0,L=n(),I=t()?"":void 0,C=t()?void 0:"",S=!t(),$=t()?"visible":"hidden",M=t()?"1":"0",A=t()?"auto":"none";return u!==a.e&&h(r,"data-position",a.e=u),E!==a.t&&h(i,"aria-expanded",a.t=E),T!==a.a&&h(i,"aria-label",a.a=T),R!==a.o&&(i.disabled=a.o=R),L!==a.i&&h(s,"aria-label",a.i=L),I!==a.n&&h(s,"data-expanded",a.n=I),C!==a.s&&h(s,"data-closed",a.s=C),S!==a.h&&j(s,"inert",a.h=S),$!==a.r&&z(s,"visibility",a.r=$),M!==a.d&&z(s,"opacity",a.d=M),A!==a.l&&z(s,"pointer-events",a.l=A),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),r})()]}W(["keydown","click"]);var te=k("<slot name=panel>"),ie=k("<slot>"),re=k("<slot name=launcher>"),le=k("<slot name=launcher-open><slot name=launcher>");G("kai-dock",{open:void 0,defaultOpen:void 0,position:"bottom-end",label:"Chat",openLabel:void 0,closeLabel:void 0,unread:void 0,disabled:void 0,focusOnOpen:"content"},(e,l)=>{const{flag:o,element:b,expose:O,reflectFlag:v}=l;let t,p,f;J(l,()=>t,()=>e.open),v("unread"),v("disabled"),v("defaultOpen");const g=N(()=>o("open")||o("defaultOpen"));return O({focus:n=>{var d;return(d=t!=null&&t.open()?p:f)==null?void 0:d.focus(n)}}),c(oe,{defaultOpen:g,get position(){return e.position},get label(){return e.label},get openLabel(){return e.openLabel},get closeLabel(){return e.closeLabel},get unread(){return o("unread")},get disabled(){return o("disabled")},get focusOnOpen(){return e.focusOnOpen},contentTarget:()=>{const n=p?.querySelectorAll("slot");for(const d of Array.from(n??[])){const y=d.assignedElements()[0];if(y instanceof HTMLElement)return y}},controllerRef:n=>t=n,panelRef:n=>p=n,launcherRef:n=>f=n,get launcher(){return(()=>{var n=re();return n._$owner=w(),x(n,c(B,{})),n})()},get launcherOpen(){return(()=>{var n=le(),d=n.firstChild;return n._$owner=w(),d._$owner=w(),x(d,c(P,{})),n})()},get children(){return[(()=>{var n=te();return n._$owner=w(),n})(),(()=>{var n=ie();return n._$owner=w(),n})()]}})});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import{f as c,c as t,v as s,i as n,S as i,j as u,t as o}from"./chunks/define-wjHR1MkU.js";import{D as f,a as m,c as p}from"./chunks/dropdown-BgWTthUx.js";import{r as d}from"./chunks/icon-Cfgmf4fa.js";import{c as b}from"./chunks/cn-CU7UAWzk.js";import{w as v}from"./chunks/disclosure-CcNbyLy0.js";import{e as h}from"./chunks/ellipsis-7gU33mL2.js";var w=o("<style>:host([full]){display:block}"),I=o("<slot name=trigger>"),x=o("<slot>");c("kai-dropdown",{triggerIcon:void 0,triggerLabel:void 0,triggerIconTrailing:void 0,label:void 0,full:!1,open:void 0,defaultOpen:void 0,disabled:void 0},(r,g)=>{const{flag:l}=g;let a;return v(g,()=>a,()=>r.open),[w(),t(p,{get defaultOpen(){return l("defaultOpen")},get disabled(){return l("disabled")},controllerRef:e=>a=e,get children(){return[t(f,{get class(){return b("inline-flex items-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",r.triggerLabel?"gap-1.5 px-2 py-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground":"justify-center p-1.5 text-foreground hover:bg-muted",l("full")&&"w-full")},get"aria-label"(){return u(()=>!!r.triggerLabel)()?void 0:r.label??"Open menu"},get children(){var e=I();return e._$owner=s(),n(e,t(i,{get when(){return r.triggerIcon},get children(){return d(r.triggerIcon,{class:"size-4 shrink-0"})}}),null),n(e,t(i,{get when(){return r.triggerLabel},get children(){return r.triggerLabel}}),null),n(e,t(i,{get when(){return r.triggerIconTrailing},get children(){return d(r.triggerIconTrailing,{class:"size-3.5 shrink-0 opacity-60"})}}),null),n(e,t(i,{get when(){return u(()=>!r.triggerIcon)()&&!r.triggerLabel},get children(){return t(h,{class:"size-4"})}}),null),e}}),t(m,{class:"min-w-[10rem]",get children(){var e=x();return e._$owner=s(),e}})]}})]});
@@ -1 +1 @@
1
- import{g as y,k as g,i as E,c as k,a as D,d as q,b as S,S as C,t as x,B as p,v as R,e as K,f as j}from"./chunks/define-B_tXMYRm.js";import{c as $}from"./chunks/cn-CU7UAWzk.js";import{I as B}from"./chunks/input-DrseEjhp.js";var F=x("<span>"),T=x("<span part=text>");function V(a){const[s,r]=y(!!a.editing);g(()=>r(!!a.editing));const[n,u]=y(a.value);g(()=>u(a.value));let c,l=!1;const f=()=>{const e=c?.querySelector("input");e&&(e.focus(),e.select())};g(()=>{s()&&queueMicrotask(f)});const m=()=>{a.disabled||r(!0)},v=e=>{var d;p(s)&&(r(!1),e!==p(n)&&(u(e),(d=a.onRename)==null||d.call(a,e)))},o=()=>{var e;p(s)&&(r(!1),(e=a.onCancel)==null||e.call(a))},h=e=>{const d=e.currentTarget;e.key==="Enter"?(e.preventDefault(),l=!0,v(d.value)):e.key==="Escape"&&(e.preventDefault(),l=!0,o())},t=e=>{if(l){l=!1;return}v(e)};return(()=>{var e=F(),d=c;return typeof d=="function"?R(d,e):c=e,E(e,k(C,{get when(){return s()},get fallback(){return(()=>{var b=T();return b.$$keydown=i=>{!a.disabled&&(i.key==="Enter"||i.key==="F2")&&(i.preventDefault(),m())},b.$$dblclick=m,E(b,()=>n()||a.placeholder||""),D(i=>{var A=a.disabled?void 0:0,w=$("inline-block max-w-full truncate rounded px-1 py-0.5 text-sm text-foreground",a.disabled?"cursor-default opacity-60":"cursor-text hover:bg-muted",!n()&&"text-muted-foreground");return A!==i.e&&q(b,"tabindex",i.e=A),w!==i.t&&S(b,i.t=w),i},{e:void 0,t:void 0}),b})()},get children(){return k(B,{get value(){return n()},get placeholder(){return a.placeholder},get disabled(){return a.disabled},size:"sm",class:"h-7 py-0",get"aria-label"(){return a.placeholder??"Edit label"},onKeyDown:h,onValueChange:t})}})),D(()=>S(e,$("inline-flex max-w-full items-center",a.class))),e})()}K(["dblclick","keydown"]);var z=x("<style>:host{display:inline-flex}");j("kai-editable-label",{value:void 0,editing:!1,placeholder:void 0,disabled:!1},(a,s)=>{const{element:r,dispatch:n,flag:u,expose:c}=s,[l,f]=y(a.value??r.getAttribute("value")??""),m=t=>t==null?r.getAttribute("value")??"":String(t);Object.defineProperty(r,"value",{get:()=>l(),set:t=>{const e=m(t);p(l)!==e&&f(e)},configurable:!0,enumerable:!0}),g(()=>{const t=l();t?r.getAttribute("value")!==t&&r.setAttribute("value",t):r.hasAttribute("value")&&r.removeAttribute("value")});const[v,o]=y(u("editing"));g(()=>o(u("editing"))),g(()=>{v()?r.hasAttribute("editing")||r.setAttribute("editing",""):r.hasAttribute("editing")&&r.removeAttribute("editing")});const h=()=>{var t;return((t=r.shadowRoot)==null?void 0:t.querySelector("input"))??null};return c({edit:()=>{u("disabled")||o(!0)},commit:()=>{var t;(t=h())==null||t.blur()},cancel:()=>{const t=h();t?t.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,composed:!0})):p(v)&&(o(!1),n("kai-cancel",{}))}}),[z(),k(V,{get value(){return l()},get editing(){return v()},get placeholder(){return a.placeholder},get disabled(){return u("disabled")},onRename:t=>{o(!1),t!==p(l)&&(f(t),n("kai-rename",{value:t}))},onCancel:()=>{o(!1),n("kai-cancel",{})}})]});
1
+ import{g as y,k as g,i as E,c as k,a as D,d as q,b as S,S as C,t as x,z as p,u as R,e as z,f as K}from"./chunks/define-wjHR1MkU.js";import{c as $}from"./chunks/cn-CU7UAWzk.js";import{I as F}from"./chunks/input-BtW9U6Sq.js";var I=x("<span>"),T=x("<span part=text>");function V(a){const[s,r]=y(!!a.editing);g(()=>r(!!a.editing));const[n,u]=y(a.value);g(()=>u(a.value));let c,l=!1;const f=()=>{const e=c?.querySelector("input");e&&(e.focus(),e.select())};g(()=>{s()&&queueMicrotask(f)});const m=()=>{a.disabled||r(!0)},v=e=>{var d;p(s)&&(r(!1),e!==p(n)&&(u(e),(d=a.onRename)==null||d.call(a,e)))},o=()=>{var e;p(s)&&(r(!1),(e=a.onCancel)==null||e.call(a))},h=e=>{const d=e.currentTarget;e.key==="Enter"?(e.preventDefault(),l=!0,v(d.value)):e.key==="Escape"&&(e.preventDefault(),l=!0,o())},t=e=>{if(l){l=!1;return}v(e)};return(()=>{var e=I(),d=c;return typeof d=="function"?R(d,e):c=e,E(e,k(C,{get when(){return s()},get fallback(){return(()=>{var b=T();return b.$$keydown=i=>{!a.disabled&&(i.key==="Enter"||i.key==="F2")&&(i.preventDefault(),m())},b.$$dblclick=m,E(b,()=>n()||a.placeholder||""),D(i=>{var A=a.disabled?void 0:0,w=$("inline-block max-w-full truncate rounded px-1 py-0.5 text-sm text-foreground",a.disabled?"cursor-default opacity-60":"cursor-text hover:bg-muted",!n()&&"text-muted-foreground");return A!==i.e&&q(b,"tabindex",i.e=A),w!==i.t&&S(b,i.t=w),i},{e:void 0,t:void 0}),b})()},get children(){return k(F,{get value(){return n()},get placeholder(){return a.placeholder},get disabled(){return a.disabled},size:"sm",class:"h-7 py-0",get"aria-label"(){return a.placeholder??"Edit label"},onKeyDown:h,onValueChange:t})}})),D(()=>S(e,$("inline-flex max-w-full items-center",a.class))),e})()}z(["dblclick","keydown"]);var j=x("<style>:host{display:inline-flex}");K("kai-editable-label",{value:void 0,editing:!1,placeholder:void 0,disabled:!1},(a,s)=>{const{element:r,dispatch:n,flag:u,expose:c}=s,[l,f]=y(a.value??r.getAttribute("value")??""),m=t=>t==null?r.getAttribute("value")??"":String(t);Object.defineProperty(r,"value",{get:()=>l(),set:t=>{const e=m(t);p(l)!==e&&f(e)},configurable:!0,enumerable:!0}),g(()=>{const t=l();t?r.getAttribute("value")!==t&&r.setAttribute("value",t):r.hasAttribute("value")&&r.removeAttribute("value")});const[v,o]=y(u("editing"));g(()=>o(u("editing"))),g(()=>{v()?r.hasAttribute("editing")||r.setAttribute("editing",""):r.hasAttribute("editing")&&r.removeAttribute("editing")});const h=()=>{var t;return((t=r.shadowRoot)==null?void 0:t.querySelector("input"))??null};return c({edit:()=>{u("disabled")||o(!0)},commit:()=>{var t;(t=h())==null||t.blur()},cancel:()=>{const t=h();t?t.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,composed:!0})):p(v)&&(o(!1),n("kai-cancel",{}))}}),[j(),k(V,{get value(){return l()},get editing(){return v()},get placeholder(){return a.placeholder},get disabled(){return u("disabled")},onRename:t=>{o(!1),t!==p(l)&&(f(t),n("kai-rename",{value:t}))},onCancel:()=>{o(!1),n("kai-cancel",{})}})]});
@@ -0,0 +1,81 @@
1
+ import { ElementRegistryEvent } from './diagnostic-events.js';
2
+ /**
3
+ * What SHAPE arrived in the attribute -- or `undefined` when the attribute is
4
+ * fine and nothing should be reported.
5
+ *
6
+ * An attribute is NOT automatically a violation on a non-scalar prop. A literal
7
+ * `conversations='[{"id":"a"}]'` is valid JSON, `JSON.parse` succeeds, and the
8
+ * property really does receive an array: that works, and reporting it would be
9
+ * reporting correct code. The violation is precisely the case where the value
10
+ * that reaches the property is not an object -- either because `JSON.parse`
11
+ * threw and component-register's `catch` handed back the raw string, or because
12
+ * the JSON was valid but scalar.
13
+ *
14
+ * EVERY RETURN IS A SHAPE, NEVER CONTENT. The vocabulary is closed and small:
15
+ * two fixed markers, a type name, and a LENGTH. The raw text is never returned,
16
+ * never interpolated, and never measured for anything but its length -- which
17
+ * is what lets this run with no payload gate at all. Pinned with sentinels by
18
+ * `element-diagnostics-payload.test.ts`.
19
+ */
20
+ export declare function classifyAttributeValue(raw: string): string | undefined;
21
+ /** Whether this tag has anything to watch at all. `defineWebComponent` asks
22
+ * BEFORE it decides whether it needs to intercept the registry, so a tag with
23
+ * no non-scalar prop pays not even the interception. */
24
+ export declare function elementDiagnosticsWanted(tag: string): boolean;
25
+ /**
26
+ * Install the contract checks onto one element class's PROTOTYPE.
27
+ *
28
+ * MUST BE CALLED BEFORE `customElements.define()` SEES THE CLASS.
29
+ *
30
+ * This is not a preference, it is the platform: `define()` snapshots the
31
+ * lifecycle callbacks -- `connectedCallback`, `attributeChangedCallback` and
32
+ * the rest -- off the prototype into the custom-element definition at
33
+ * definition time, and the browser invokes THOSE. Replacing a prototype method
34
+ * afterwards changes an object nothing reads: the wrapper installs perfectly,
35
+ * `hasOwnProperty` confirms it is there, and it is never called once. (Measured
36
+ * exactly that way in jsdom before this comment existed.) It is the same trap,
37
+ * for the same reason, that `defineWithNonReflectingProps` in `define.tsx` was
38
+ * built to get around -- so this rides through that same seam.
39
+ *
40
+ * Returns without touching anything when the tag has no non-scalar prop, which
41
+ * is 37 of the 80 elements: for those this capability has no runtime presence
42
+ * whatsoever.
43
+ */
44
+ export declare function installElementDiagnostics(tag: string, proto: object): void;
45
+ /**
46
+ * Snapshot which `kai-*` elements are defined in THIS realm, and emit it.
47
+ *
48
+ * The question is hydration. An undefined custom element is a perfectly valid,
49
+ * perfectly inert `HTMLElement`: an SSR page whose markup contains `<kai-chat>`
50
+ * but whose element bundle never loaded renders empty boxes, throws nothing and
51
+ * logs nothing. The SSR starters already answer this by hand for a hard-coded
52
+ * handful (`HydrationBadge.tsx` in the nextjs and tanstack-start starters); this
53
+ * is the same answer, derived, over every tag.
54
+ *
55
+ * WHY THE MANIFEST AND NOT `element-meta.json`. The two generated artifacts
56
+ * disagree -- 79 tags against 80 entries -- and the manifest is the one that
57
+ * answers THIS question. `kai-remote` is in the meta file because
58
+ * `gen-element-api.mjs` scans the `src/elements` directory listing, and absent
59
+ * from the manifest because `gen-elements-manifest.mjs` reads the import list in
60
+ * `register-impl.ts`, which does not import `remote.tsx`.
61
+ *
62
+ * AND THAT IS DELIBERATE, not a generator bug -- `vite.config.elements.ts:44-50`
63
+ * says so at the site: `<kai-remote>` mounts a sandboxed cross-origin iframe and
64
+ * is opt-in, reachable only through `@kitn.ai/ui/elements/remote` or the React
65
+ * `Remote` wrapper, and intentionally kept out of the register-all bundle. So
66
+ * the honest universe for "did the element bundle load" is the 79 that bundle
67
+ * registers. Listing `kai-remote` beside them would report a permanent "not
68
+ * defined" against an element almost no app is missing, and adding it to the
69
+ * manifest -- the obvious "fix" -- would hand an opt-in cross-origin iframe
70
+ * element to the autoloader's lazy-load set, which is a behaviour change wearing
71
+ * the costume of a data fix.
72
+ *
73
+ * The cost is stated rather than hidden: a consumer who HAS opted into
74
+ * `kai-remote` sees it in neither list. `element-artifact-divergence.test.ts`
75
+ * pins the divergence at exactly this one tag, so it stays a known exception and
76
+ * a NEW one fails.
77
+ *
78
+ * Returns the event it emitted, or `undefined` where there is no custom-element
79
+ * registry (SSR) or nobody is listening.
80
+ */
81
+ export declare function emitElementRegistry(): ElementRegistryEvent | undefined;
@@ -1 +1 @@
1
- import{f as t,c as e}from"./chunks/define-B_tXMYRm.js";import{E as o}from"./chunks/embed-CjAD2jSi.js";import{e as m}from"./chunks/card-routing-BK09BdmL.js";t("kai-embed",{cardId:void 0,data:void 0},(r,{element:a})=>e(o,{get cardId(){return r.cardId??""},get data(){return r.data??{provider:"generic"}},onEmit:d=>m(a,d)}));
1
+ import{f as t,c as e}from"./chunks/define-wjHR1MkU.js";import{E as o}from"./chunks/embed-D3KewsIJ.js";import{e as m}from"./chunks/card-routing-BK09BdmL.js";t("kai-embed",{cardId:void 0,data:void 0},(r,{element:a})=>e(o,{get cardId(){return r.cardId??""},get data(){return r.data??{provider:"generic"}},onEmit:d=>m(a,d)}));
@@ -1 +1 @@
1
- import{s as i,q as c,m as l,i as d,t as a,f,c as s,u as o,S as m}from"./chunks/define-B_tXMYRm.js";import{c as g}from"./chunks/index-BCRhi84a.js";import{c as u}from"./chunks/cn-CU7UAWzk.js";var h=a("<div data-slot=empty>"),v=a("<div data-slot=empty-header>"),p=a("<div data-slot=empty-media>"),x=a("<div data-slot=empty-title>"),y=a("<p data-slot=empty-description>"),w=a("<div data-slot=empty-content>");function b(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=h();return c(t,l({get class(){return u("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg p-6 text-center text-balance",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function k(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=v();return c(t,l({get class(){return u("flex max-w-sm flex-col items-center gap-2 text-center",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}const T=g("flex shrink-0 items-center justify-center mb-2 [&_svg]:size-6",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground size-10 rounded-lg"}},defaultVariants:{variant:"default"}});function _(r){const[e,n]=i(r,["class","variant","children"]);return(()=>{var t=p();return c(t,l({get"data-variant"(){return e.variant??"default"},get class(){return u(T({variant:e.variant}),e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function j(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=x();return c(t,l({get class(){return u("text-lg font-medium tracking-tight",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function z(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=y();return c(t,l({get class(){return u("text-muted-foreground text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function $(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=w();return c(t,l({get class(){return u("flex w-full max-w-sm min-w-0 flex-col items-center gap-2 text-sm text-balance",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}var q=a("<slot name=media>"),C=a("<slot>");f("kai-empty",{emptyTitle:"",description:""},r=>s(b,{get children(){return[s(k,{get children(){return[s(_,{variant:"icon",get children(){var e=q();return e._$owner=o(),e}}),s(m,{get when(){return r.emptyTitle},get children(){return s(j,{get children(){return r.emptyTitle}})}}),s(m,{get when(){return r.description},get children(){return s(z,{get children(){return r.description}})}})]}}),s($,{get children(){var e=C();return e._$owner=o(),e}})]}}));
1
+ import{s as i,q as c,m as l,i as d,t as a,f,c as s,v as o,S as m}from"./chunks/define-wjHR1MkU.js";import{c as g}from"./chunks/index-BCRhi84a.js";import{c as u}from"./chunks/cn-CU7UAWzk.js";var v=a("<div data-slot=empty>"),h=a("<div data-slot=empty-header>"),p=a("<div data-slot=empty-media>"),x=a("<div data-slot=empty-title>"),y=a("<p data-slot=empty-description>"),w=a("<div data-slot=empty-content>");function b(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=v();return c(t,l({get class(){return u("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg p-6 text-center text-balance",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function k(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=h();return c(t,l({get class(){return u("flex max-w-sm flex-col items-center gap-2 text-center",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}const T=g("flex shrink-0 items-center justify-center mb-2 [&_svg]:size-6",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground size-10 rounded-lg"}},defaultVariants:{variant:"default"}});function _(r){const[e,n]=i(r,["class","variant","children"]);return(()=>{var t=p();return c(t,l({get"data-variant"(){return e.variant??"default"},get class(){return u(T({variant:e.variant}),e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function j(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=x();return c(t,l({get class(){return u("text-lg font-medium tracking-tight",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function z(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=y();return c(t,l({get class(){return u("text-muted-foreground text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}function $(r){const[e,n]=i(r,["class","children"]);return(()=>{var t=w();return c(t,l({get class(){return u("flex w-full max-w-sm min-w-0 flex-col items-center gap-2 text-sm text-balance",e.class)}},n),!1,!0),d(t,()=>e.children),t})()}var q=a("<slot name=media>"),C=a("<slot>");f("kai-empty",{emptyTitle:"",description:""},r=>s(b,{get children(){return[s(k,{get children(){return[s(_,{variant:"icon",get children(){var e=q();return e._$owner=o(),e}}),s(m,{get when(){return r.emptyTitle},get children(){return s(j,{get children(){return r.emptyTitle}})}}),s(m,{get when(){return r.description},get children(){return s(z,{get children(){return r.description}})}})]}}),s($,{get children(){var e=C();return e._$owner=o(),e}})]}}));
@@ -1 +1 @@
1
- import{g as v,i as t,c as r,M as x,S,F as W,a as T,d as B,b as $,r as H,t as g,e as I,f as N}from"./chunks/define-B_tXMYRm.js";import{c as j}from"./chunks/cn-CU7UAWzk.js";import{B as z}from"./chunks/button-B9okqG73.js";import{T as q}from"./chunks/textarea-DPfuhswM.js";import{t as A,a as E}from"./chunks/thumbs-up-DQe0hvkZ.js";import{c as G}from"./chunks/check-MdLzbxrm.js";import{x as D}from"./chunks/x-BOhjBeOd.js";var J=g('<div class="flex w-full items-center justify-between"><div class="flex flex-1 items-center justify-start gap-4 py-3 pl-4"><span class="text-foreground font-medium"></span></div><div class="flex items-center justify-center gap-0.5 px-3 py-0"><button type=button class="text-muted-foreground hover:text-foreground flex size-8 items-center justify-center rounded-md transition-colors"aria-label=Helpful></button><button type=button class="text-muted-foreground hover:text-foreground flex size-8 items-center justify-center rounded-md transition-colors"aria-label="Not helpful"></button></div><div class="border-border flex items-center justify-center border-l"><button type=button class="text-muted-foreground hover:text-foreground flex items-center justify-center rounded-md p-3"aria-label=Close>'),K=g('<div class="flex flex-wrap gap-1.5">'),O=g('<div class="flex w-[min(22rem,80vw)] flex-col gap-2.5 p-3"><div class="flex items-center justify-between"><span class="text-foreground font-medium"></span><button type=button aria-label=Skip class="text-muted-foreground hover:text-foreground"></button></div><div class="flex justify-end gap-2">'),Q=g('<div class="flex items-center gap-2 px-4 py-3"role=status><span class="text-foreground font-medium">'),R=g("<div>"),U=g("<button type=button>");function V(e){const[u,f]=v("ask"),[b,M]=v(),[p,L]=v(),[k,P]=v(""),y=i=>{var l;M(i),(l=e.onFeedback)==null||l.call(e,i),f(i==="not-helpful"&&e.collectDetail?"detail":"thanks")},F=()=>{var i;(i=e.onSubmitDetail)==null||i.call(e,{value:b(),category:p(),comment:k()||void 0}),f("thanks")};return(()=>{var i=R();return t(i,r(H,{get children(){return[r(x,{get when(){return u()==="ask"},get children(){var l=J(),n=l.firstChild,m=n.firstChild,h=n.nextSibling,s=h.firstChild,a=s.nextSibling,c=h.nextSibling,o=c.firstChild;return t(n,r(S,{get when(){return e.icon},get children(){return e.icon}}),m),t(m,()=>e.title),s.$$click=()=>y("helpful"),t(s,r(A,{class:"size-4"})),a.$$click=()=>y("not-helpful"),t(a,r(E,{class:"size-4"})),o.$$click=()=>{var d;return(d=e.onClose)==null?void 0:d.call(e)},t(o,r(D,{class:"size-5"})),l}}),r(x,{get when(){return u()==="detail"},get children(){var l=O(),n=l.firstChild,m=n.firstChild,h=m.nextSibling,s=n.nextSibling;return t(m,()=>e.detailTitle??"What went wrong?"),h.$$click=()=>f("thanks"),t(h,r(D,{class:"size-4"})),t(l,r(S,{get when(){var a;return(a=e.categories)==null?void 0:a.length},get children(){var a=K();return t(a,r(W,{get each(){return e.categories},children:c=>(()=>{var o=U();return o.$$click=()=>L(p()===c?void 0:c),t(o,c),T(d=>{var w=p()===c,C=j("rounded-full border px-2.5 py-1 text-xs transition-colors",p()===c?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:text-foreground");return w!==d.e&&B(o,"aria-pressed",d.e=w),C!==d.t&&$(o,d.t=C),d},{e:void 0,t:void 0}),o})()})),a}}),s),t(l,r(q,{get value(){return k()},onInput:a=>P(a.currentTarget.value),get placeholder(){return e.detailPlaceholder??"Tell us more (optional)"},class:"border-border min-h-[3rem] rounded-md border px-2 py-1.5"}),s),t(s,r(z,{variant:"ghost",size:"sm",onClick:()=>f("thanks"),children:"Skip"}),null),t(s,r(z,{variant:"default",size:"sm",onClick:F,get children(){return e.submitLabel??"Submit"}}),null),l}}),r(x,{get when(){return u()==="thanks"},get children(){var l=Q(),n=l.firstChild;return t(l,r(G,{class:"size-4 text-emerald-500"}),n),t(n,()=>e.thanksMessage??"Thanks for your feedback"),l}})]}})),T(()=>$(i,j("bg-background border-border inline-flex rounded-[12px] border text-sm",e.class))),i})()}I(["click"]),N("kai-feedback-bar",{barTitle:"Was this helpful?",collectDetail:void 0,categories:void 0,detailTitle:void 0,detailPlaceholder:void 0,submitLabel:void 0,thanksMessage:void 0},(e,{dispatch:u,flag:f})=>r(V,{get title(){return e.barTitle},get collectDetail(){return f("collectDetail")},get categories(){return e.categories},get detailTitle(){return e.detailTitle},get detailPlaceholder(){return e.detailPlaceholder},get submitLabel(){return e.submitLabel},get thanksMessage(){return e.thanksMessage},onFeedback:b=>u("kai-feedback",{value:b}),onSubmitDetail:b=>u("kai-feedback-detail",b),onClose:()=>u("kai-close")}));
1
+ import{g as v,i as t,c as r,M as x,S,F as W,a as T,d as B,b as $,r as H,t as g,e as I,f as N}from"./chunks/define-wjHR1MkU.js";import{c as j}from"./chunks/cn-CU7UAWzk.js";import{B as z}from"./chunks/button-flUbeufF.js";import{T as q}from"./chunks/textarea-skiGHURM.js";import{t as A,a as E}from"./chunks/thumbs-up-DX2Ijk3H.js";import{c as G}from"./chunks/check-B5kBPKeo.js";import{x as D}from"./chunks/x-B6UnOiLw.js";var J=g('<div class="flex w-full items-center justify-between"><div class="flex flex-1 items-center justify-start gap-4 py-3 pl-4"><span class="text-foreground font-medium"></span></div><div class="flex items-center justify-center gap-0.5 px-3 py-0"><button type=button class="text-muted-foreground hover:text-foreground flex size-8 items-center justify-center rounded-md transition-colors"aria-label=Helpful></button><button type=button class="text-muted-foreground hover:text-foreground flex size-8 items-center justify-center rounded-md transition-colors"aria-label="Not helpful"></button></div><div class="border-border flex items-center justify-center border-l"><button type=button class="text-muted-foreground hover:text-foreground flex items-center justify-center rounded-md p-3"aria-label=Close>'),K=g('<div class="flex flex-wrap gap-1.5">'),O=g('<div class="flex w-[min(22rem,80vw)] flex-col gap-2.5 p-3"><div class="flex items-center justify-between"><span class="text-foreground font-medium"></span><button type=button aria-label=Skip class="text-muted-foreground hover:text-foreground"></button></div><div class="flex justify-end gap-2">'),Q=g('<div class="flex items-center gap-2 px-4 py-3"role=status><span class="text-foreground font-medium">'),R=g("<div>"),U=g("<button type=button>");function V(e){const[u,f]=v("ask"),[b,M]=v(),[p,L]=v(),[k,P]=v(""),y=i=>{var l;M(i),(l=e.onFeedback)==null||l.call(e,i),f(i==="not-helpful"&&e.collectDetail?"detail":"thanks")},F=()=>{var i;(i=e.onSubmitDetail)==null||i.call(e,{value:b(),category:p(),comment:k()||void 0}),f("thanks")};return(()=>{var i=R();return t(i,r(H,{get children(){return[r(x,{get when(){return u()==="ask"},get children(){var l=J(),n=l.firstChild,m=n.firstChild,h=n.nextSibling,s=h.firstChild,a=s.nextSibling,c=h.nextSibling,o=c.firstChild;return t(n,r(S,{get when(){return e.icon},get children(){return e.icon}}),m),t(m,()=>e.title),s.$$click=()=>y("helpful"),t(s,r(A,{class:"size-4"})),a.$$click=()=>y("not-helpful"),t(a,r(E,{class:"size-4"})),o.$$click=()=>{var d;return(d=e.onClose)==null?void 0:d.call(e)},t(o,r(D,{class:"size-5"})),l}}),r(x,{get when(){return u()==="detail"},get children(){var l=O(),n=l.firstChild,m=n.firstChild,h=m.nextSibling,s=n.nextSibling;return t(m,()=>e.detailTitle??"What went wrong?"),h.$$click=()=>f("thanks"),t(h,r(D,{class:"size-4"})),t(l,r(S,{get when(){var a;return(a=e.categories)==null?void 0:a.length},get children(){var a=K();return t(a,r(W,{get each(){return e.categories},children:c=>(()=>{var o=U();return o.$$click=()=>L(p()===c?void 0:c),t(o,c),T(d=>{var w=p()===c,C=j("rounded-full border px-2.5 py-1 text-xs transition-colors",p()===c?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:text-foreground");return w!==d.e&&B(o,"aria-pressed",d.e=w),C!==d.t&&$(o,d.t=C),d},{e:void 0,t:void 0}),o})()})),a}}),s),t(l,r(q,{get value(){return k()},onInput:a=>P(a.currentTarget.value),get placeholder(){return e.detailPlaceholder??"Tell us more (optional)"},class:"border-border min-h-[3rem] rounded-md border px-2 py-1.5"}),s),t(s,r(z,{variant:"ghost",size:"sm",onClick:()=>f("thanks"),children:"Skip"}),null),t(s,r(z,{variant:"default",size:"sm",onClick:F,get children(){return e.submitLabel??"Submit"}}),null),l}}),r(x,{get when(){return u()==="thanks"},get children(){var l=Q(),n=l.firstChild;return t(l,r(G,{class:"size-4 text-emerald-500"}),n),t(n,()=>e.thanksMessage??"Thanks for your feedback"),l}})]}})),T(()=>$(i,j("bg-background border-border inline-flex rounded-[12px] border text-sm",e.class))),i})()}I(["click"]),N("kai-feedback-bar",{barTitle:"Was this helpful?",collectDetail:void 0,categories:void 0,detailTitle:void 0,detailPlaceholder:void 0,submitLabel:void 0,thanksMessage:void 0},(e,{dispatch:u,flag:f})=>r(V,{get title(){return e.barTitle},get collectDetail(){return f("collectDetail")},get categories(){return e.categories},get detailTitle(){return e.detailTitle},get detailPlaceholder(){return e.detailPlaceholder},get submitLabel(){return e.submitLabel},get thanksMessage(){return e.thanksMessage},onFeedback:b=>u("kai-feedback",{value:b}),onSubmitDetail:b=>u("kai-feedback-detail",b),onClose:()=>u("kai-close")}));
@@ -1 +1 @@
1
- import{f as d,i as m,c as n,t as i}from"./chunks/define-B_tXMYRm.js";import{F as f}from"./chunks/file-tree-yGWNK0Js.js";var h=i("<style>:host{display:block;height:100%;min-height:0}"),o=i('<div style="display:grid;grid-template-rows:minmax(0, 1fr);grid-template-columns:minmax(0, 1fr);height:100%;min-height:0"><div class="overflow-auto scrollbar-thin py-1.5"style=min-height:0>');d("kai-file-tree",{files:[],activeFile:void 0,defaultExpanded:void 0,summary:!1},(e,{dispatch:a,flag:r})=>[h(),(()=>{var t=o(),l=t.firstChild;return m(l,n(f,{get files(){return e.files},get activeFile(){return e.activeFile},get defaultExpanded(){return e.defaultExpanded},get summary(){return r("summary")},onSelect:s=>a("kai-select",{path:s})})),t})()]);
1
+ import{f as d,i as m,c as n,t as i}from"./chunks/define-wjHR1MkU.js";import{F as f}from"./chunks/file-tree-zvB2i7P9.js";var h=i("<style>:host{display:block;height:100%;min-height:0}"),o=i('<div style="display:grid;grid-template-rows:minmax(0, 1fr);grid-template-columns:minmax(0, 1fr);height:100%;min-height:0"><div class="overflow-auto scrollbar-thin py-1.5"style=min-height:0>');d("kai-file-tree",{files:[],activeFile:void 0,defaultExpanded:void 0,summary:!1},(e,{dispatch:a,flag:r})=>[h(),(()=>{var t=o(),l=t.firstChild;return m(l,n(f,{get files(){return e.files},get activeFile(){return e.activeFile},get defaultExpanded(){return e.defaultExpanded},get summary(){return r("summary")},onSelect:s=>a("kai-select",{path:s})})),t})()]);
@@ -1 +1 @@
1
- import{c as v,m as b,s as h,A as L,q as A,i as y,g as w,k as $,h as F,v as R,a as T,d as j,j as z,z as D,t as f,e as I,f as P,u as q}from"./chunks/define-B_tXMYRm.js";import{I as C}from"./chunks/Icon-b5A8hlHs.js";var H=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],M=s=>v(C,b(s,{name:"Upload",iconNode:H})),N=M,U=f("<input type=file class=hidden aria-hidden=true>"),_=f("<button type=button>");const k=D();function O(s){const[r]=h(s,["onFilesAdded","children","multiple","accept","disabled"]);let o;const[d,c]=w(!1);let a=0;const g=()=>r.multiple??!0,m=e=>{const t=Array.from(e);g()?r.onFilesAdded(t):r.onFilesAdded(t.slice(0,1))};$(()=>{const e=l=>{l.preventDefault(),l.stopPropagation()},t=l=>{var p;e(l),a++,(p=l.dataTransfer)!=null&&p.items.length&&c(!0)},i=l=>{e(l),a--,a===0&&c(!1)},u=l=>{var p;e(l),c(!1),a=0,(p=l.dataTransfer)!=null&&p.files.length&&m(l.dataTransfer.files)},n=window;n.addEventListener("dragenter",t),n.addEventListener("dragleave",i),n.addEventListener("dragover",e),n.addEventListener("drop",u),F(()=>{n.removeEventListener("dragenter",t),n.removeEventListener("dragleave",i),n.removeEventListener("dragover",e),n.removeEventListener("drop",u)})});const x=e=>{var t;const i=e.target;(t=i.files)!=null&&t.length&&(m(i.files),i.value="")},E={isDragging:d,get inputRef(){return o},setInputRef:e=>{o=e},multiple:r.multiple,disabled:r.disabled};return v(k.Provider,{value:E,get children(){return[(()=>{var e=U();return e.$$input=x,R(t=>{o=t},e),T(t=>{var i=g(),u=r.accept,n=r.disabled;return i!==t.e&&(e.multiple=t.e=i),u!==t.t&&j(e,"accept",t.t=u),n!==t.a&&(e.disabled=t.a=n),t},{e:void 0,t:void 0,a:void 0}),e})(),z(()=>r.children)]}})}function S(s){const[r,o]=h(s,["class","children"]),d=L(k),c=()=>{var a;return(a=d?.inputRef)==null?void 0:a.click()};return(()=>{var a=_();return a.$$click=c,A(a,b({get class(){return r.class}},o),!1,!0),y(a,()=>r.children),a})()}I(["input","click"]);var V=f("<slot>");P("kai-file-upload",{multiple:!0,accept:void 0,disabled:!1,label:"Click or drop files to upload"},(s,{dispatch:r,flag:o})=>v(O,{get multiple(){return o("multiple")},get accept(){return s.accept},get disabled(){return o("disabled")},onFilesAdded:d=>r("kai-files-added",{files:d}),get children(){return v(S,{class:"border-border bg-surface hover:bg-muted/60 text-muted-foreground flex w-full cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-6 py-8 text-sm transition-colors",get children(){return[v(N,{class:"size-5"}),(()=>{var d=V();return d._$owner=q(),y(d,()=>s.label),d})()]}})}}));
1
+ import{c as v,m as b,s as h,G as L,q as w,i as y,g as A,k as $,h as F,u as R,a as T,d as j,j as D,B as I,t as f,e as P,f as q,v as z}from"./chunks/define-wjHR1MkU.js";import{I as B}from"./chunks/Icon--Y8vsFal.js";var C=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],G=s=>v(B,b(s,{name:"Upload",iconNode:C})),H=G,M=f("<input type=file class=hidden aria-hidden=true>"),U=f("<button type=button>");const k=I();function _(s){const[r]=h(s,["onFilesAdded","children","multiple","accept","disabled"]);let o;const[d,c]=A(!1);let a=0;const g=()=>r.multiple??!0,m=e=>{const t=Array.from(e);g()?r.onFilesAdded(t):r.onFilesAdded(t.slice(0,1))};$(()=>{const e=l=>{l.preventDefault(),l.stopPropagation()},t=l=>{var p;e(l),a++,(p=l.dataTransfer)!=null&&p.items.length&&c(!0)},i=l=>{e(l),a--,a===0&&c(!1)},u=l=>{var p;e(l),c(!1),a=0,(p=l.dataTransfer)!=null&&p.files.length&&m(l.dataTransfer.files)},n=window;n.addEventListener("dragenter",t),n.addEventListener("dragleave",i),n.addEventListener("dragover",e),n.addEventListener("drop",u),F(()=>{n.removeEventListener("dragenter",t),n.removeEventListener("dragleave",i),n.removeEventListener("dragover",e),n.removeEventListener("drop",u)})});const x=e=>{var t;const i=e.target;(t=i.files)!=null&&t.length&&(m(i.files),i.value="")},E={isDragging:d,get inputRef(){return o},setInputRef:e=>{o=e},multiple:r.multiple,disabled:r.disabled};return v(k.Provider,{value:E,get children(){return[(()=>{var e=M();return e.$$input=x,R(t=>{o=t},e),T(t=>{var i=g(),u=r.accept,n=r.disabled;return i!==t.e&&(e.multiple=t.e=i),u!==t.t&&j(e,"accept",t.t=u),n!==t.a&&(e.disabled=t.a=n),t},{e:void 0,t:void 0,a:void 0}),e})(),D(()=>r.children)]}})}function N(s){const[r,o]=h(s,["class","children"]),d=L(k),c=()=>{var a;return(a=d?.inputRef)==null?void 0:a.click()};return(()=>{var a=U();return a.$$click=c,w(a,b({get class(){return r.class}},o),!1,!0),y(a,()=>r.children),a})()}P(["input","click"]);var O=f("<slot>");q("kai-file-upload",{multiple:!0,accept:void 0,disabled:!1,label:"Click or drop files to upload"},(s,{dispatch:r,flag:o})=>v(_,{get multiple(){return o("multiple")},get accept(){return s.accept},get disabled(){return o("disabled")},onFilesAdded:d=>r("kai-files-added",{files:d}),get children(){return v(N,{class:"border-border bg-surface hover:bg-muted/60 text-muted-foreground flex w-full cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-6 py-8 text-sm transition-colors",get children(){return[v(H,{class:"size-5"}),(()=>{var d=O();return d._$owner=z(),y(d,()=>s.label),d})()]}})}}));
@@ -1 +1 @@
1
- import{f as o,c as s}from"./chunks/define-B_tXMYRm.js";import{F as n}from"./chunks/form-Cp8Y00Wn.js";o("kai-form",{data:void 0,cardId:void 0,heading:void 0,resolution:void 0,values:void 0,defaultValues:void 0,disabled:!1},(d,{element:a,dispatch:t,flag:i,expose:r})=>{let e;return r({focus:l=>e?.focus(l),send:()=>e?.send(),validate:()=>e?.validate()??{valid:!1},reset:()=>e?.reset(),dismiss:()=>e?.dismiss(),reopen:()=>e?.reopen()}),s(n,{get data(){return d.data},get cardId(){return d.cardId??(a.id||"kai-form")},get heading(){return d.heading},get resolution(){return d.resolution},get values(){return d.values},get defaultValues(){return d.defaultValues},get disabled(){return i("disabled")},onValuesChange:l=>t("kai-values-change",l),controllerRef:l=>e=l,hostElement:a})});
1
+ import{f as o,c as s}from"./chunks/define-wjHR1MkU.js";import{F as n}from"./chunks/form-CQirdC4W.js";o("kai-form",{data:void 0,cardId:void 0,heading:void 0,resolution:void 0,values:void 0,defaultValues:void 0,disabled:!1},(d,{element:a,dispatch:t,flag:i,expose:r})=>{let e;return r({focus:l=>e?.focus(l),send:()=>e?.send(),validate:()=>e?.validate()??{valid:!1},reset:()=>e?.reset(),dismiss:()=>e?.dismiss(),reopen:()=>e?.reopen()}),s(n,{get data(){return d.data},get cardId(){return d.cardId??(a.id||"kai-form")},get heading(){return d.heading},get resolution(){return d.resolution},get values(){return d.values},get defaultValues(){return d.defaultValues},get disabled(){return i("disabled")},onValuesChange:l=>t("kai-values-change",l),controllerRef:l=>e=l,hostElement:a})});
@@ -1 +1 @@
1
- import{f as s,c as o,u as d,j as i,t as a}from"./chunks/define-B_tXMYRm.js";import{a as u,b as c,H as p}from"./chunks/hover-card-6KtXpLwT.js";import{w as v}from"./chunks/disclosure-DAoYOKew.js";var m=a("<style>:host{display:inline-block}"),f=a("<slot>"),g=a("<slot name=card>");s("kai-hover-card",{openDelay:void 0,closeDelay:void 0,placement:void 0,open:void 0,defaultOpen:void 0,disabled:void 0},(l,n)=>{const{flag:r}=n;let t;return v(n,()=>t,()=>l.open),[m(),o(p,{get openDelay(){return i(()=>l.openDelay!=null)()?Number(l.openDelay):void 0},get closeDelay(){return i(()=>l.closeDelay!=null)()?Number(l.closeDelay):void 0},get defaultOpen(){return r("defaultOpen")},get disabled(){return r("disabled")},controllerRef:e=>t=e,get children(){return[o(u,{get children(){var e=f();return e._$owner=d(),e}}),o(c,{get placement(){return l.placement??void 0},get children(){var e=g();return e._$owner=d(),e}})]}})]});
1
+ import{f as s,c as o,v as d,j as i,t as a}from"./chunks/define-wjHR1MkU.js";import{a as c,b as p,H as u}from"./chunks/hover-card-CJJkfHTK.js";import{w as v}from"./chunks/disclosure-CcNbyLy0.js";var m=a("<style>:host{display:inline-block}"),f=a("<slot>"),g=a("<slot name=card>");s("kai-hover-card",{openDelay:void 0,closeDelay:void 0,placement:void 0,open:void 0,defaultOpen:void 0,disabled:void 0},(l,n)=>{const{flag:r}=n;let t;return v(n,()=>t,()=>l.open),[m(),o(u,{get openDelay(){return i(()=>l.openDelay!=null)()?Number(l.openDelay):void 0},get closeDelay(){return i(()=>l.closeDelay!=null)()?Number(l.closeDelay):void 0},get defaultOpen(){return r("defaultOpen")},get disabled(){return r("disabled")},controllerRef:e=>t=e,get children(){return[o(c,{get children(){var e=f();return e._$owner=d(),e}}),o(p,{get placement(){return l.placement??void 0},get children(){var e=g();return e._$owner=d(),e}})]}})]});
@@ -1 +1 @@
1
- import{f as l,i as m,a as n,b as r,t as a}from"./chunks/define-B_tXMYRm.js";import{r as o}from"./chunks/icon-97R8SR2p.js";import{c as f}from"./chunks/cn-CU7UAWzk.js";var t=a("<style>:host{display:inline-flex}"),z=a("<span part=icon>");const e={sm:"size-3.5",md:"size-4",lg:"size-5"};l("kai-icon",{name:"",size:"md"},i=>[t(),(()=>{var s=z();return m(s,()=>o(i.name,{class:"size-full",imgClass:"size-full",spanClass:"size-full"})),n(()=>r(s,f("inline-flex shrink-0",e[i.size??"md"]??e.md))),s})()]);
1
+ import{f as l,i as m,a as n,b as r,t as a}from"./chunks/define-wjHR1MkU.js";import{r as o}from"./chunks/icon-Cfgmf4fa.js";import{c as f}from"./chunks/cn-CU7UAWzk.js";var t=a("<style>:host{display:inline-flex}"),z=a("<span part=icon>");const e={sm:"size-3.5",md:"size-4",lg:"size-5"};l("kai-icon",{name:"",size:"md"},i=>[t(),(()=>{var s=z();return m(s,()=>o(i.name,{class:"size-full",imgClass:"size-full",spanClass:"size-full"})),n(()=>r(s,f("inline-flex shrink-0",e[i.size??"md"]??e.md))),s})()]);