thursday-agent 0.18.0 → 0.19.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 (342) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -2
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +22 -12
  6. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +1 -1
  15. package/.next/server/app/_not-found.rsc +12 -12
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
  17. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
  18. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/server/app/api/artifact/route.js +6 -6
  20. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/memory/files/route.js +1 -1
  22. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/memory/route.js +3 -3
  24. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  25. package/.next/server/app/api/bot/route.js +3 -3
  26. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  27. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  28. package/.next/server/app/api/bot/thread/file/route.js +17 -17
  29. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  30. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  31. package/.next/server/app/api/config/route.js.nft.json +1 -1
  32. package/.next/server/app/api/events/route.js +2 -2
  33. package/.next/server/app/api/events/route.js.nft.json +1 -1
  34. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/file/[...path]/route.js +2 -2
  36. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/llm-model/automatic/route.js +2 -2
  38. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  39. package/.next/server/app/api/llm-model/catalog/[provider]/route/app-paths-manifest.json +3 -0
  40. package/.next/server/app/api/llm-model/catalog/{route.js → [provider]/route.js} +7 -7
  41. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -0
  42. package/.next/server/app/api/llm-model/catalog/[provider]/route_client-reference-manifest.js +3 -0
  43. package/.next/server/app/api/llm-model/credits/[provider]/route/app-paths-manifest.json +3 -0
  44. package/.next/server/app/api/llm-model/credits/{route.js → [provider]/route.js} +7 -7
  45. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -0
  46. package/.next/server/app/api/llm-model/credits/[provider]/route_client-reference-manifest.js +3 -0
  47. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  48. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  49. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  50. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  51. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  52. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  53. package/.next/server/app/api/memory/edit/route.js +12 -12
  54. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  55. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  56. package/.next/server/app/api/reach/route.js +16 -16
  57. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  58. package/.next/server/app/api/routine/route.js +5 -5
  59. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  60. package/.next/server/app/api/running/route/app-paths-manifest.json +3 -0
  61. package/.next/server/app/api/running/route/build-manifest.json +12 -0
  62. package/.next/server/app/api/running/route/server-reference-manifest.json +4 -0
  63. package/.next/server/app/api/running/route.js +10 -0
  64. package/.next/server/app/api/running/route.js.map +5 -0
  65. package/.next/server/app/api/running/route.js.nft.json +1 -0
  66. package/.next/server/app/api/running/route_client-reference-manifest.js +3 -0
  67. package/.next/server/app/api/signins/route.js +4 -4
  68. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  69. package/.next/server/app/api/skills/[source]/[name]/route.js +6 -6
  70. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  71. package/.next/server/app/api/skills/route.js +6 -6
  72. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  73. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  74. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  75. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  76. package/.next/server/app/api/thursday/text/route.js +12 -12
  77. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  78. package/.next/server/app/api/thursday/tool-call/route.js +12 -12
  79. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  80. package/.next/server/app/api/workspace/files/route.js +6 -6
  81. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  82. package/.next/server/app/api/workspace/route.js +5 -5
  83. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  84. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  85. package/.next/server/app/artifact/[...path]/page.js +7 -6
  86. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  87. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  88. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  89. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  90. package/.next/server/app/page/server-reference-manifest.json +63 -63
  91. package/.next/server/app/page.js +10 -9
  92. package/.next/server/app/page.js.nft.json +1 -1
  93. package/.next/server/app/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app-paths-manifest.json +3 -2
  95. package/.next/server/chunks/{[externals]__178rv3v._.js → [externals]__12stas-._.js} +1 -1
  96. package/.next/server/chunks/[root-of-the-server]__02ra64t._.js +1 -1
  97. package/.next/server/chunks/{[root-of-the-server]__05dp5tr._.js → [root-of-the-server]__06ky9of._.js} +2 -2
  98. package/.next/server/chunks/[root-of-the-server]__0b565-x._.js +7 -0
  99. package/.next/server/chunks/{[root-of-the-server]__1izes4_._.js → [root-of-the-server]__0bmtib_._.js} +2 -2
  100. package/.next/server/chunks/[root-of-the-server]__0bqveex._.js +1 -1
  101. package/.next/server/chunks/[root-of-the-server]__0brmiv2._.js +2 -2
  102. package/.next/server/chunks/[root-of-the-server]__0eivkvk._.js +2 -2
  103. package/.next/server/chunks/[root-of-the-server]__0f7m79q._.js +1 -1
  104. package/.next/server/chunks/[root-of-the-server]__0g38-aj._.js +2 -2
  105. package/.next/server/chunks/[root-of-the-server]__0gvdr2h._.js +1 -1
  106. package/.next/server/chunks/[root-of-the-server]__0h656y-._.js +2 -2
  107. package/.next/server/chunks/[root-of-the-server]__0hm3tiq._.js +2 -2
  108. package/.next/server/chunks/[root-of-the-server]__0hzdqnv._.js +2 -2
  109. package/.next/server/chunks/{[root-of-the-server]__0my9geo._.js → [root-of-the-server]__0kzmxpg._.js} +1 -1
  110. package/.next/server/chunks/[root-of-the-server]__0mgyt8p._.js +2 -2
  111. package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__0o5s5-o._.js +5 -0
  113. package/.next/server/chunks/[root-of-the-server]__0p80i1n._.js +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__0qdoc_9._.js +1 -1
  115. package/.next/server/chunks/[root-of-the-server]__0qzho69._.js +1 -1
  116. package/.next/server/chunks/[root-of-the-server]__0sm5xvm._.js +1 -1
  117. package/.next/server/chunks/[root-of-the-server]__0v_kuor._.js +1 -1
  118. package/.next/server/chunks/{[root-of-the-server]__1k2qs1m._.js → [root-of-the-server]__0ypkfbu._.js} +1 -1
  119. package/.next/server/chunks/[root-of-the-server]__1-18_pz._.js +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
  121. package/.next/server/chunks/{[root-of-the-server]__01k3vi3._.js → [root-of-the-server]__14iga7p._.js} +1 -1
  122. package/.next/server/chunks/[root-of-the-server]__16gn7zn._.js +3 -0
  123. package/.next/server/chunks/[root-of-the-server]__18e65_-._.js +3 -0
  124. package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
  125. package/.next/server/chunks/{[root-of-the-server]__0lvjz0b._.js → [root-of-the-server]__1_cgawk._.js} +2 -2
  126. package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
  127. package/.next/server/chunks/[root-of-the-server]__1ckt1yj._.js +1 -1
  128. package/.next/server/chunks/[root-of-the-server]__1cu5f3z._.js +1 -1
  129. package/.next/server/chunks/[root-of-the-server]__1dth047._.js +1 -1
  130. package/.next/server/chunks/{[root-of-the-server]__061o2_x._.js → [root-of-the-server]__1fc6v12._.js} +1 -1
  131. package/.next/server/chunks/[root-of-the-server]__1hviq62._.js +2 -2
  132. package/.next/server/chunks/[root-of-the-server]__1m1q6u5._.js +3 -0
  133. package/.next/server/chunks/[root-of-the-server]__1m_dmf6._.js +1 -1
  134. package/.next/server/chunks/[root-of-the-server]__1mys2c3._.js +1 -1
  135. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  136. package/.next/server/chunks/[root-of-the-server]__1p0njle._.js +2 -2
  137. package/.next/server/chunks/[root-of-the-server]__1p47fbb._.js +1 -1
  138. package/.next/server/chunks/[root-of-the-server]__1pugoq0._.js +1 -1
  139. package/.next/server/chunks/{[root-of-the-server]__0ts7ai0._.js → [root-of-the-server]__1trns9g._.js} +1 -1
  140. package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
  141. package/.next/server/chunks/[root-of-the-server]__1zn039k._.js +1 -1
  142. package/.next/server/chunks/[root-of-the-server]__20w_g71._.js +3 -0
  143. package/.next/server/chunks/_06hnfi8._.js +2 -2
  144. package/.next/server/chunks/_06u9yo-._.js +1 -1
  145. package/.next/server/chunks/_08_-9ay._.js +2 -2
  146. package/.next/server/chunks/_0bgjf07._.js +1 -1
  147. package/.next/server/chunks/_0c49lmw._.js +1 -1
  148. package/.next/server/chunks/_0hgvg55._.js +1 -1
  149. package/.next/server/chunks/_0s8ao8z._.js +1 -1
  150. package/.next/server/chunks/_0ucx1jv._.js +1 -1
  151. package/.next/server/chunks/_0uzj57i._.js +1 -1
  152. package/.next/server/chunks/_1-sk_q4._.js +1 -1
  153. package/.next/server/chunks/_1dxq827._.js +2 -2
  154. package/.next/server/chunks/_1e54wxa._.js +1 -1
  155. package/.next/server/chunks/_1frcwj1._.js +1 -1
  156. package/.next/server/chunks/_1gn2r2q._.js +4 -2
  157. package/.next/server/chunks/_1gxankq._.js +2 -2
  158. package/.next/server/chunks/_1i3uucm._.js +1 -1
  159. package/.next/server/chunks/_1jvy78-._.js +1 -1
  160. package/.next/server/chunks/_1lg0lsu._.js +53 -0
  161. package/.next/server/chunks/_1njolhx._.js +294 -0
  162. package/.next/server/chunks/_1q6e56i._.js +4 -2
  163. package/.next/server/chunks/_1wtb-77._.js +294 -0
  164. package/.next/server/chunks/_next-internal_server_app_api_llm-model_catalog_[provider]_route_actions_1i0449q.js +3 -0
  165. package/.next/server/chunks/_next-internal_server_app_api_llm-model_credits_[provider]_route_actions_0iui9hz.js +3 -0
  166. package/.next/server/chunks/_next-internal_server_app_api_running_route_actions_0o1g-aw.js +3 -0
  167. package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
  168. package/.next/server/chunks/features_bot_0zy_q8y._.js +7 -7
  169. package/.next/server/chunks/features_bot_1dfrdsb._.js +7 -7
  170. package/.next/server/chunks/{node_modules_1rosz79._.js → node_modules_035o7ku._.js} +1 -1
  171. package/.next/server/chunks/{node_modules_1er1u8w._.js → node_modules_0tn5t13._.js} +1 -1
  172. package/.next/server/chunks/{node_modules_103lpef._.js → node_modules_12oq3hr._.js} +1 -1
  173. package/.next/server/chunks/ssr/[root-of-the-server]__04upd5v._.js +1 -1
  174. package/.next/server/chunks/ssr/[root-of-the-server]__0p0mv2u._.js +3 -0
  175. package/.next/server/chunks/ssr/{[root-of-the-server]__1r7tj27._.js → [root-of-the-server]__0sk5enu._.js} +1 -1
  176. package/.next/server/chunks/ssr/[root-of-the-server]__0xyaud4._.js +3 -0
  177. package/.next/server/chunks/ssr/{[root-of-the-server]__128hnrd._.js → [root-of-the-server]__1-gi9sm._.js} +1 -1
  178. package/.next/server/chunks/ssr/{[root-of-the-server]__0h6jo0s._.js → [root-of-the-server]__16nn3pe._.js} +2 -2
  179. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  180. package/.next/server/chunks/ssr/[root-of-the-server]__1c8-7cw._.js +3 -0
  181. package/.next/server/chunks/ssr/[root-of-the-server]__1tb5vve._.js +2 -1
  182. package/.next/server/chunks/ssr/_02cm0fr._.js +5 -0
  183. package/.next/server/chunks/ssr/_07nmtxo._.js +1 -1
  184. package/.next/server/chunks/ssr/_088vzgn._.js +1 -1
  185. package/.next/server/chunks/ssr/{_1oafxdu._.js → _0bg1u1j._.js} +2 -2
  186. package/.next/server/chunks/ssr/_0cv9tmv._.js +1 -1
  187. package/.next/server/chunks/ssr/_0f9hx5p._.js +1 -1
  188. package/.next/server/chunks/ssr/_0g9ula_._.js +3 -0
  189. package/.next/server/chunks/ssr/{_0wuvkqk._.js → _0irozu9._.js} +2 -2
  190. package/.next/server/chunks/ssr/_0iwsdp7._.js +3 -0
  191. package/.next/server/chunks/ssr/_0l7rjg5._.js +1 -1
  192. package/.next/server/chunks/ssr/{_0fo4552._.js → _0nk80t6._.js} +44 -5
  193. package/.next/server/chunks/ssr/_0pbav_w._.js +1 -1
  194. package/.next/server/chunks/ssr/{_1r4mc3i._.js → _0q-mdwv._.js} +8 -8
  195. package/.next/server/chunks/ssr/{_1w899wx._.js → _0s5_ahb._.js} +2 -2
  196. package/.next/server/chunks/ssr/{_1omom9y._.js → _0t5f2c3._.js} +2 -2
  197. package/.next/server/chunks/ssr/_0v9r8g2._.js +1 -1
  198. package/.next/server/chunks/ssr/_0x8ophf._.js +1 -1
  199. package/.next/server/chunks/ssr/_0x9f717._.js +1 -1
  200. package/.next/server/chunks/ssr/_107vtdk._.js +162 -0
  201. package/.next/server/chunks/ssr/{_0ixe3g3._.js → _12lql1x._.js} +3 -3
  202. package/.next/server/chunks/ssr/_165wnr4._.js +1 -1
  203. package/.next/server/chunks/ssr/_16_7zeo._.js +1 -1
  204. package/.next/server/chunks/ssr/_17komoi._.js +3 -0
  205. package/.next/server/chunks/ssr/{_0j9vh-8._.js → _190hjys._.js} +2 -2
  206. package/.next/server/chunks/ssr/_1bfrntd._.js +2 -2
  207. package/.next/server/chunks/ssr/{_1tx-2k7._.js → _1booff4._.js} +2 -2
  208. package/.next/server/chunks/ssr/{_12jv_41._.js → _1ew1j7l._.js} +2 -2
  209. package/.next/server/chunks/ssr/_1i2swyr._.js +1 -1
  210. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  211. package/.next/server/chunks/ssr/{_0osvxkt._.js → _1qsa25k._.js} +2 -2
  212. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  213. package/.next/server/chunks/ssr/_1vc2xmu._.js +3 -0
  214. package/.next/server/chunks/ssr/{_1_ogjze._.js → _1wq90j8._.js} +2 -2
  215. package/.next/server/chunks/ssr/{_1pgxh81._.js → _1zrhkf0._.js} +44 -5
  216. package/.next/server/chunks/ssr/{_0mpn6q0._.js → _21awrs2._.js} +2 -2
  217. package/.next/server/chunks/ssr/features_0796o8r._.js +1 -1
  218. package/.next/server/chunks/ssr/features_bot_1c56lew._.js +37 -0
  219. package/.next/server/chunks/ssr/{features_bot_18gqkr_._.js → features_bot_1fn_grf._.js} +2 -2
  220. package/.next/server/chunks/ssr/{features_config_1ond01n._.js → features_config_05zi68v._.js} +3 -3
  221. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  222. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  223. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  224. package/.next/server/chunks/ssr/{node_modules_1-4q6is._.js → node_modules_0-sux1a._.js} +1 -1
  225. package/.next/server/chunks/ssr/{node_modules_17o218r._.js → node_modules_01oezhb._.js} +1 -1
  226. package/.next/server/chunks/ssr/{node_modules_0f485jl._.js → node_modules_04m6ebg._.js} +1 -1
  227. package/.next/server/chunks/ssr/{node_modules_0upwx50._.js → node_modules_067jfov._.js} +1 -1
  228. package/.next/server/chunks/ssr/{node_modules_0i_v0-m._.js → node_modules_06ugby3._.js} +1 -1
  229. package/.next/server/chunks/ssr/{node_modules_0lxwg2v._.js → node_modules_07p51j3._.js} +1 -1
  230. package/.next/server/chunks/ssr/{node_modules_16z7p8b._.js → node_modules_0995xyq._.js} +1 -1
  231. package/.next/server/chunks/ssr/{node_modules_004qt-z._.js → node_modules_0_uecwx._.js} +1 -1
  232. package/.next/server/chunks/ssr/{node_modules_0lrn9ci._.js → node_modules_0dsyc90._.js} +1 -1
  233. package/.next/server/chunks/ssr/{node_modules_0v__o4h._.js → node_modules_0hli6s2._.js} +1 -1
  234. package/.next/server/chunks/ssr/{node_modules_1gpapfv._.js → node_modules_0m-bde_._.js} +1 -1
  235. package/.next/server/chunks/ssr/{node_modules_1tus4vi._.js → node_modules_0oqfdbr._.js} +1 -1
  236. package/.next/server/chunks/ssr/{node_modules_09dy7tk._.js → node_modules_0tgy5s5._.js} +1 -1
  237. package/.next/server/chunks/ssr/{node_modules_1hdaxu9._.js → node_modules_1-kjmls._.js} +1 -1
  238. package/.next/server/chunks/ssr/{node_modules_0gbx70b._.js → node_modules_1-l3ka5._.js} +1 -1
  239. package/.next/server/chunks/ssr/{node_modules_20448xv._.js → node_modules_1-w3ayh._.js} +1 -1
  240. package/.next/server/chunks/ssr/{node_modules_06m6e97._.js → node_modules_133exgm._.js} +1 -1
  241. package/.next/server/chunks/ssr/{node_modules_1srjf5c._.js → node_modules_17xc5_k._.js} +1 -1
  242. package/.next/server/chunks/ssr/{node_modules_1tv_7lk._.js → node_modules_1_i_w30._.js} +1 -1
  243. package/.next/server/chunks/ssr/{node_modules_1hjvwkh._.js → node_modules_1a2cjfk._.js} +1 -1
  244. package/.next/server/chunks/ssr/{node_modules_0_hy3i2._.js → node_modules_1k752fe._.js} +1 -1
  245. package/.next/server/chunks/ssr/{node_modules_0n2-p5q._.js → node_modules_1lie7z8._.js} +1 -1
  246. package/.next/server/chunks/ssr/{node_modules_0pw13ww._.js → node_modules_1mv70-y._.js} +1 -1
  247. package/.next/server/chunks/ssr/{node_modules_10mb0cv._.js → node_modules_1r611t2._.js} +1 -1
  248. package/.next/server/chunks/ssr/{node_modules_0nj36zf._.js → node_modules_1vfd8dz._.js} +2 -2
  249. package/.next/server/chunks/ssr/{node_modules_0ppirau._.js → node_modules_1yaowd7._.js} +1 -1
  250. package/.next/server/chunks/ssr/{node_modules_1j886a5._.js → node_modules_20a1wpo._.js} +1 -1
  251. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0lg9pkl._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1r8pxbe._.js} +1 -1
  252. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1xgbf5j._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1siiu4h._.js} +1 -1
  253. package/.next/server/middleware-build-manifest.js +3 -3
  254. package/.next/server/middleware.js +1 -1
  255. package/.next/server/pages/404.html +1 -1
  256. package/.next/server/pages/500.html +1 -1
  257. package/.next/server/server-reference-manifest.js +1 -1
  258. package/.next/server/server-reference-manifest.json +64 -64
  259. package/.next/static/chunks/{1dpg1u4a16ujt.js → 088d3w5qxu19g.js} +2 -2
  260. package/.next/static/chunks/0bxekp4hnuk1g.js +1 -0
  261. package/.next/static/chunks/{17dx6w478vnb0.js → 0fw4u_s974j24.js} +1 -1
  262. package/.next/static/chunks/0hy2x7qhk8wgx.css +1 -0
  263. package/.next/static/chunks/{240nfv2dtidhc.js → 0n_eshmn_7wfn.js} +2 -2
  264. package/.next/static/chunks/0ulcp_u_y1u0b.js +15 -0
  265. package/.next/static/chunks/0vj93zo0yvix9.js +35 -0
  266. package/.next/static/chunks/{05uvci-bk-vgp.js → 10f98bh4hdmhe.js} +1 -1
  267. package/.next/static/chunks/{0ruf3dqs--3ve.js → 1b8bce_z_act0.js} +1 -1
  268. package/.next/static/chunks/1c32d2azsjaj_.js +1 -0
  269. package/.next/static/chunks/1fs829mz69pxz.js +1 -0
  270. package/.next/static/chunks/{2ug8q1x9e-_j6.js → 1lwlh4mo_vv8d.js} +1 -1
  271. package/.next/static/chunks/{3r7u1y9xjoh-v.js → 1po8fkg40peu-.js} +1 -1
  272. package/.next/static/chunks/{27l8qwnk1j66z.js → 1rg6b9l5fm1hj.js} +1 -1
  273. package/.next/static/chunks/{1pe7i5yu779ta.js → 26g3iwfuad-7p.js} +1 -1
  274. package/.next/static/chunks/2bjnmtke_q43c.js +1 -0
  275. package/.next/static/chunks/2c86k0o-1p9_w.js +1 -0
  276. package/.next/static/chunks/2gf4t0d76bvyv.js +1 -0
  277. package/.next/static/chunks/2rj3q_ahctv19.js +1 -0
  278. package/.next/static/chunks/{2lhc74urf3acr.js → 2x6-fpctvucte.js} +1 -1
  279. package/.next/static/chunks/{2gxfy__ef51n9.js → 2yicf7bky866n.js} +1 -1
  280. package/.next/static/chunks/{0oqviw3f55nfp.js → 350ws7svim7ij.js} +1 -1
  281. package/.next/static/chunks/3e1w_nwfb39j-.js +1 -0
  282. package/.next/static/chunks/3v3ooretb54ag.js +1 -0
  283. package/.next/static/chunks/{2lzg4zedtmyic.js → 44bcbnmup71so.js} +1 -1
  284. package/.next/static/chunks/{1h_6rh86q3i4p.js → 458dtbsemx996.js} +1 -1
  285. package/bin/background.mjs +995 -0
  286. package/bin/lock.mjs +64 -29
  287. package/bin/thursday.mjs +111 -42
  288. package/bin/tools.mjs +58 -4
  289. package/guide/calls.md +8 -0
  290. package/guide/setup.md +27 -13
  291. package/package.json +1 -1
  292. package/seed-skills/concierge/travel/references/itinerary.md +1 -1
  293. package/seed-skills/concierge/travel/scripts/itinerary.mjs +7 -2
  294. package/skills/artifact/references/book.md +3 -3
  295. package/.next/server/app/api/llm-model/catalog/route/app-paths-manifest.json +0 -3
  296. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +0 -1
  297. package/.next/server/app/api/llm-model/catalog/route_client-reference-manifest.js +0 -3
  298. package/.next/server/app/api/llm-model/credits/route/app-paths-manifest.json +0 -3
  299. package/.next/server/app/api/llm-model/credits/route.js.nft.json +0 -1
  300. package/.next/server/app/api/llm-model/credits/route_client-reference-manifest.js +0 -3
  301. package/.next/server/chunks/[root-of-the-server]__03xamry._.js +0 -3
  302. package/.next/server/chunks/[root-of-the-server]__04hhvpu._.js +0 -7
  303. package/.next/server/chunks/[root-of-the-server]__1-rmal0._.js +0 -5
  304. package/.next/server/chunks/[root-of-the-server]__10xnb7e._.js +0 -3
  305. package/.next/server/chunks/[root-of-the-server]__1etbk64._.js +0 -3
  306. package/.next/server/chunks/[root-of-the-server]__1v7x5ym._.js +0 -3
  307. package/.next/server/chunks/_07nxi75._.js +0 -255
  308. package/.next/server/chunks/_0srlnvd._.js +0 -16
  309. package/.next/server/chunks/_0xygcxs._.js +0 -255
  310. package/.next/server/chunks/_next-internal_server_app_api_llm-model_catalog_route_actions_1eu2y41.js +0 -3
  311. package/.next/server/chunks/_next-internal_server_app_api_llm-model_credits_route_actions_0v424pb.js +0 -3
  312. package/.next/server/chunks/ssr/[root-of-the-server]__06knwl5._.js +0 -3
  313. package/.next/server/chunks/ssr/[root-of-the-server]__07ehpky._.js +0 -3
  314. package/.next/server/chunks/ssr/[root-of-the-server]__1gzje-h._.js +0 -3
  315. package/.next/server/chunks/ssr/_0jstvlg._.js +0 -39
  316. package/.next/server/chunks/ssr/_1-41lck._.js +0 -3
  317. package/.next/server/chunks/ssr/_10jtmhl._.js +0 -3
  318. package/.next/server/chunks/ssr/_19jez1a._.js +0 -3
  319. package/.next/server/chunks/ssr/_1jd8rjm._.js +0 -3
  320. package/.next/server/chunks/ssr/_1mdjoak._.js +0 -162
  321. package/.next/static/chunks/09y_43y1cy5jw.js +0 -1
  322. package/.next/static/chunks/0vggwjufw2-6r.js +0 -1
  323. package/.next/static/chunks/0x4m9nj2fazl2.js +0 -35
  324. package/.next/static/chunks/1-1yfu34-3p2p.js +0 -1
  325. package/.next/static/chunks/10oyyypxn_cpx.js +0 -1
  326. package/.next/static/chunks/184-r80rv0xay.css +0 -1
  327. package/.next/static/chunks/1_hgdoungpm0o.js +0 -1
  328. package/.next/static/chunks/2kjwmo70judc2.js +0 -15
  329. package/.next/static/chunks/2uk8rdtr-pk58.js +0 -1
  330. package/.next/static/chunks/3vg1-oc-zgw_7.js +0 -1
  331. package/.next/static/chunks/3vrmcm31ih7gb.js +0 -1
  332. package/.next/static/chunks/41ztsnjn4qrn-.js +0 -1
  333. package/bin/autostart.mjs +0 -192
  334. /package/.next/server/app/api/llm-model/catalog/{route → [provider]/route}/build-manifest.json +0 -0
  335. /package/.next/server/app/api/llm-model/catalog/{route → [provider]/route}/server-reference-manifest.json +0 -0
  336. /package/.next/server/app/api/llm-model/catalog/{route.js.map → [provider]/route.js.map} +0 -0
  337. /package/.next/server/app/api/llm-model/credits/{route → [provider]/route}/build-manifest.json +0 -0
  338. /package/.next/server/app/api/llm-model/credits/{route → [provider]/route}/server-reference-manifest.json +0 -0
  339. /package/.next/server/app/api/llm-model/credits/{route.js.map → [provider]/route.js.map} +0 -0
  340. /package/.next/static/{-IBxB5oqr6e3RuOCCmYtL → YhaRHJqObuAcXZe5VLFs0}/_buildManifest.js +0 -0
  341. /package/.next/static/{-IBxB5oqr6e3RuOCCmYtL → YhaRHJqObuAcXZe5VLFs0}/_clientMiddlewareManifest.js +0 -0
  342. /package/.next/static/{-IBxB5oqr6e3RuOCCmYtL → YhaRHJqObuAcXZe5VLFs0}/_ssgManifest.js +0 -0
@@ -0,0 +1,37 @@
1
+ module.exports=[221214,a=>a.a(async(b,c)=>{try{a.i(666680);var d=a.i(258261),e=a.i(93321),f=a.i(351674),g=a.i(203469),h=a.i(569572),i=a.i(184838),j=a.i(714428),k=a.i(725466),l=a.i(821415),m=a.i(293480),n=a.i(446957);a.i(636616);var o=b([i,k]);[i,k]=o.then?(await o)():o;let D=a=>({name:a.name,description:a.description,ownLine:a.ownLine?.line??null,systemPrompt:a.systemPrompt,icon:a.icon,provider:a.provider,model:a.model,disabled:a.disabled,compactAt:a.compactAt,effort:a.effort});async function p(){let a=await i.database.select().from(j.botTable).orderBy(j.botTable.createdAt);return a.length?a.filter(a=>!a.disabled).map(D):[n.DEFAULT_BOT]}async function q(a){let b=await t(a);if(b)return D(b);let c=a.trim().toLowerCase(),[d]=await i.database.select().from(j.botTable).where((0,e.eq)(f.sql`lower(${j.botTable.name})`,c));if(d)return D(d);if(n.DEFAULT_BOT.name.toLowerCase()!==c)return null;let[g]=await i.database.select({name:j.botTable.name}).from(j.botTable).limit(1);return g?null:n.DEFAULT_BOT}async function r(){return(0,n.isBotMemoryOn)(await (0,k.readConfig)(n.BOT_MEMORY_KEY))}async function s(a){await (0,k.writeConfig)(n.BOT_MEMORY_KEY,a?"on":"off")}async function t(a){let[b]=await i.database.select().from(j.botTable).where((0,e.eq)(j.botTable.name,a));return b??null}async function u(a){let b=await t(a);return!b||b.descriptionLocked?null:{line:b.ownLine?.line??null}}async function v(a,b,c){let d=await t(a);if(!d||d.descriptionLocked)return;let f=d.ownLine?.line??null;return f===b||(await i.database.update(j.botTable).set({ownLine:{line:b,reason:c,at:Date.now()}}).where((0,e.eq)(j.botTable.name,d.name)),g.appEvents.emit({type:"bots"})),{was:f}}async function w(a){return(await i.database.update(j.botTable).set({ownLine:null}).where((0,e.eq)(j.botTable.name,a)).returning({name:j.botTable.name})).length>0}async function x(){let[{total:a}]=await i.database.select({total:(0,d.count)()}).from(j.botTable);return a}async function y(){let a=await i.database.select({name:j.botTable.name}).from(j.botTable);return[...new Set([...a.map(a=>a.name),n.DEFAULT_BOT.name])]}async function z(a){let b=(0,l.botFolderName)(a.name).toLowerCase(),c=await i.database.select({name:j.botTable.name}).from(j.botTable);if(c.some(a=>(0,l.botFolderName)(a.name).toLowerCase()===b))return null;c.length>=h.BOT_ROSTER.max&&(0,m.publicError)(`There are already ${h.BOT_ROSTER.max} bots. Delete one to make another.`);let{toolIds:d,...e}=(0,n.pickedModel)(a),[f]=await i.database.insert(j.botTable).values(e).returning();return d?.length&&await B(f.name,d),f}async function A(a,b){let{toolIds:c,...d}="provider"in b||"model"in b?(0,n.pickedModel)(b):b;delete d.name;let[f]=Object.keys(d).length?await i.database.update(j.botTable).set(d).where((0,e.eq)(j.botTable.name,a)).returning():await i.database.select().from(j.botTable).where((0,e.eq)(j.botTable.name,a));return f?(c&&await B(a,c),f):null}async function B(a,b){if(await i.database.delete(j.botMcpToolTable).where((0,e.eq)(j.botMcpToolTable.botName,a)),0===b.length)return;let c=await i.database.select({id:j.mcpToolTable.id}).from(j.mcpToolTable).where((0,e.inArray)(j.mcpToolTable.id,b));0!==c.length&&await i.database.insert(j.botMcpToolTable).values(c.map(({id:b})=>({botName:a,toolId:b})))}async function C(a){return(await i.database.delete(j.botTable).where((0,e.eq)(j.botTable.name,a)).returning({name:j.botTable.name})).length>0}a.s(["clearOwnLine",0,w,"countBots",0,x,"createBot",0,z,"deleteBot",0,C,"findJobBot",0,q,"listBotNames",0,y,"listJobBots",0,p,"ownLineOf",0,u,"readBotMemoryOn",0,r,"updateBot",0,A,"writeBotMemoryOn",0,s,"writeOwnLine",0,v]),c()}catch(a){c(a)}},!1),636616,a=>{"use strict";var b=a.i(569572),c=a.i(762008),d=a.i(446957),e=a.i(62721);let f=[{name:d.DEFAULT_BOT.name,description:d.DEFAULT_BOT.description,hint:"Takes whatever nobody else is for",systemPrompt:"",icon:d.DEFAULT_BOT_ICON},{name:"Analyst",description:"Finds out and answers with sources — what things cost, how numbers moved, which one to pick",hint:"Finds out, cites, and lays it out",icon:{color:e.MARK_INK.violet,shape:"squircle"},systemPrompt:`Questions answered by finding out are yours — what something costs, how a figure moved and why, which to pick, whether to buy now or wait — and the answer is only as good as where it came from.
2
+
3
+ **Answer first.** Whoever asked reads your first lines and may stop there, so they hold the answer and the two or three facts behind it. A title says the finding, not the topic. A few facts are your final text and nothing more; more than that is one page in your folder under \`artifacts/\`, every figure with where it came from — or a sheet, when the figures are their own to keep and go on with.
4
+
5
+ **From the source, never from memory.** A number comes from where it is published, a claim from the text that makes it, with the moment it is said; two sources that disagree, a figure you could not confirm, a page you could not read are said beside the answer, not smoothed over. A number you derive shows its arithmetic; an estimate is a range.
6
+
7
+ **What you keep.** The currency they think in, the sources they trust, what they already own and are weighing — dated, so the next job starts from it.`},{name:"Curator",description:"Keeps them up to date — a morning news brief, a video, podcast, talk or article summed up",hint:"Brings what is worth their time",icon:{color:e.MARK_INK.emerald,shape:"blob"},systemPrompt:`Keeping up is yours — the brief on the topics they follow, and anything long they point you at, a video, a podcast, a talk, an article, a PDF, handed back short — so they spend minutes on what would take them an hour.
8
+
9
+ **Their time is the point.** Lead with what changed and what matters to them; cut what they would skip. Every point links to where it is said: a story to its publisher, a moment to its timestamp.
10
+
11
+ **Never from memory.** A headline, a quote, a figure comes from the page or the transcript you read, with when. A story you could not open, or a video with no words to read, is said, not summed up from its title.
12
+
13
+ **What you keep.** The topics they follow and the ones they skip, the sources they trust, how long a brief they read and in which language — dated, so the next brief starts from it.`},{name:"Concierge",description:"Handles trips and errands — flights, stays, bookings, orders and forms, up to the step that pays",hint:"Takes errands to the last step",icon:{color:e.MARK_INK.sky,shape:"poly"},systemPrompt:`Trips and errands out in the world are yours — a trip planned day by day, flights and stays found and compared, a booking, an order, a reservation, a form filled — each taken as far as it goes before the step that pays or signs, which is theirs. A trip has a skill of your own, \`${b.TRAVEL_SKILL}\`: load it before any step of one.
14
+
15
+ **Real prices, real dates.** A fare, a price, an opening time comes from the page you read, with when; one you could not reach is said, never guessed. Finding them is part of the errand and yours, not a question to hand on. A choice they make by looking — a room, a place, a thing to buy — comes with its picture.
16
+
17
+ **Ready to act.** The answer says what is waiting for them, where, and what it costs, so the one step left is theirs.
18
+
19
+ **What you keep.** Where they travel from and with whom, the seats and rooms they like, the programs they collect with, where things are sent — dated, so the next errand starts from it.`},{name:"Designer",description:"Makes what gets looked at — design options side by side, slide decks, posters and posts at size",hint:"Draws the options to pick from",icon:{paint:"rainbow",shape:"heart"},systemPrompt:`Anything that has to be looked at is yours — a screen or a page to choose between, a deck to present, a post at the size it will be shown, a poster, a document someone reads. You build it in \`${b.ARTIFACT_SKILL}\` (a canvas of options side by side or anything at its exact size, a document, a picture book): load it before any step. It starts from ready boards and outlines and shoots what you made itself; writing the HTML from nothing instead costs you those and the check. A deck is \`${c.TOOL_NAMES.make_deck}\`, which draws its slides and shoots them itself; a page someone uses rather than reads — a tool, a small app — is in \`${b.ARTIFACT_SKILL}\` too, with steps of its own.
20
+
21
+ **Offer a real choice.** Two to four options, each exploring an axis you can name — everything at once against one thing at a time, dense against roomy — never five shades of one. Every option gets an honest case and the thing it costs; mark the one you would carry forward. Once an option is B it stays B, whatever is dropped before it.
22
+
23
+ **Root it in what is already there.** When the job names something that exists — a product, a site, its code, a brand, a file you were given — read it first and lift its exact colours, type, spacing and control sizes rather than inventing a look; say in one line what you matched. A screen you cannot open is asked for as a picture.
24
+
25
+ **The pictures are how you check your own work.** Look at what was shot, fix what the renderer refuses or the canvas marks as cut, shoot once more: two rounds at most.
26
+
27
+ **What you keep.** The brand's colours, type and spacing, and the direction they chose, so the next thing you draw starts from it.`},{name:"Tutor",description:"Explains anything simply as a picture book — a picture and a line or two a page, read aloud if asked",hint:"Explains anything like a picture book",icon:{color:e.MARK_INK.yellow,shape:"blob"},systemPrompt:`Explaining is yours — anything someone wants to understand, told so that a person who knows nothing about it follows every step. It ends as a picture book, made with \`${b.ARTIFACT_SKILL}\`, in your folder under \`artifacts/\`: one picture and a line or two a page, as a page to swipe through. A PDF or a video that reads itself aloud is made from the same book when they ask for one; a request that does not say is a page to swipe through, not a question.
28
+
29
+ **Simple, never wrong.** Read what you explain from where it is stated before the first page. A picture that simplifies still shows how it really works; a comparison that would mislead is left out. A new word comes after the picture that shows it, never before.
30
+
31
+ **What you keep.** What the user already knows and how they liked being taught — the level, a picture style, how many pages — dated, so the next book starts where they are.`},{name:"Marketer",description:"Marketing — positioning, page copy, launch plans, social posts, emails, an SEO audit",hint:"Works out what to say, to whom, and where",icon:{color:e.MARK_INK.red,shape:"poly"},systemPrompt:`Marketing work is yours — positioning, page copy, a launch plan, social posts, emails, an SEO audit — and it ends as the thing itself in your folder under \`artifacts/\`, ready to paste, post or send. \`${b.MARKETING_SKILL}\` is your own skill and holds the method for each of them: load it before any step.
32
+
33
+ **Ground every claim.** Competitors, prices, search terms and what people say about the problem come from pages you opened, with the link beside them. What you could not check is marked as a guess.
34
+
35
+ **What you keep.** One brief per product — what it is, for whom, against what, in which voice — dated, and every later job starts from it.`}];a.s(["findBotSeed",0,a=>f.find(b=>b.name===a)??null])}];
36
+
37
+ //# sourceMappingURL=features_bot_1c56lew._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[82951,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(141146),f=a.i(875160),g=a.i(272944),h=a.i(19895),i=a.i(951675),j=a.i(474215),k=a.i(572131),l=a.i(767561),m=a.i(340695),n=a.i(965733),o=a.i(676504),p=a.i(446181),q=a.i(545097),r=a.i(950463),s=a.i(287702),t=a.i(515923),u=a.i(689115),v=a.i(337265),w=a.i(411509),x=a.i(913834),y=a.i(42380),z=a.i(8468),A=a.i(181809),B=a.i(135432),C=a.i(156819),D=a.i(619477),E=a.i(199169),F=a.i(313237),G=a.i(862966),H=a.i(759497),I=a.i(497895),J=a.i(988422),K=b([z,A,J]);[z,A,J]=K.then?(await K)():K;let R="w-36";function L({thread:a,bots:b,open:c,onOpen:g,onStop:h,onDelete:i}){let j="running"===a.status,l=(0,k.useMemo)(()=>(0,B.threadFromRow)(a,b),[a,b]),m=function(a){let b=a.room.questions[0];if(b)return{text:(0,I.plainText)(b.text),tone:I.WAITING_INK};if("waiting"===a.status&&a.ask)return{text:(0,w.isAppStop)(a.ask)?(0,I.plainText)(a.outcome??a.ask.question):a.ask.question,tone:I.WAITING_INK};let c=a.seen;if("cancelled"===a.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===a.status)return{text:(0,I.plainText)(a.outcome??"Done"),tone:c?"text-muted-foreground":"text-foreground/80"};for(let b=a.lines.length-1;b>=0;b--){let c=a.lines[b];if("tool"===c.kind)return{text:c.note??c.input,tone:"text-muted-foreground",tool:c.name,shine:!0};if("text"===c.kind)return{text:c.text,tone:"text-muted-foreground",shine:!0};if("user"===c.kind)break}return{text:`${a.bot} is taking it on…`,tone:"text-muted-foreground italic",shine:!0}}(a),n=a.tokens.input+a.tokens.output;return(0,d.jsxs)("div",{className:(0,I.cn)("group/row relative transition-colors",c?"bg-muted/80":"hover:bg-muted/50"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,d.jsxs)("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,d.jsx)(x.BotMark,{size:40,seed:a.bot,...(0,x.markOf)(a.bot,b),state:j?"thinking":"idle",notify:(0,w.needsThreadReply)(a)||(0,w.isUnread)(a),crossed:"cancelled"===a.status,className:"shrink-0"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),a.routineId&&(0,d.jsx)("span",{title:"Started by a routine",className:"shrink-0",children:(0,d.jsx)(C.RoutineMark,{className:"size-3 text-muted-foreground/80"})}),(0,d.jsx)(y.BotRoster,{bots:l.roster}),j&&(0,d.jsx)(f.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),m&&(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] leading-snug",children:[m.tool&&(0,d.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:m.tool}),m.shine?(0,d.jsx)(q.ShinyText,{text:m.text,speed:2.2,className:"min-w-0 truncate"}):(0,d.jsx)("span",{className:(0,I.cn)("min-w-0 truncate",m.tone),children:m.text})]})]}),(0,d.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",R),children:[(0,d.jsx)("span",{children:(0,E.whenOf)(a.updatedAt)}),(0,d.jsxs)("span",{className:"max-w-full truncate text-muted-foreground/70",title:n>0?`${a.id} \xb7 in ${(0,I.formatCount)(a.tokens.input)} \xb7 out ${(0,I.formatCount)(a.tokens.output)}`:a.id,children:[a.bot,n>0&&` \xb7 ${(0,I.formatCount)(n)}`]})]}),(0,d.jsx)(e.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,d.jsx)(M,{thread:a,onStop:h,onDelete:i})]}),j&&(0,d.jsx)(O,{thread:a})]})}function M({thread:a,onStop:b,onDelete:c,className:e}){let f="running"===a.status||"waiting"===a.status;return(0,d.jsxs)(o.DropdownMenu,{children:[(0,d.jsx)(o.DropdownMenuTrigger,{render:(0,d.jsx)(m.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:e}),children:(0,d.jsx)(g.MoreHorizontal,{})}),(0,d.jsxs)(o.DropdownMenuContent,{align:"end",children:[f&&(0,d.jsxs)(o.DropdownMenuItem,{onClick:b,children:[(0,d.jsx)(h.Square,{}),"Stop"]}),(0,d.jsxs)(o.DropdownMenuItem,{variant:"destructive",onClick:c,children:[(0,d.jsx)(i.Trash2,{}),"Delete"]})]})]})}function N({thread:a,whole:b,bots:c,onClose:e,onStop:f,onDelete:g}){let[h,i]=(0,k.useState)(null),l=(0,k.useCallback)(a=>{i(a?.closest("[data-slot=dialog-content]")??null)},[]),[o,p]=(0,k.useState)({}),q=(0,k.useMemo)(()=>a?(0,B.threadFromRow)(a,c):null,[a,c]),s=(0,k.useMemo)(()=>b?(0,B.threadFromRow)(b,c):q?.lines.length?q:null,[b,q,c]),t=a?o[a.id]??null:null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{ref:l,hidden:!0}),(0,d.jsx)(n.Dialog,{open:!!(a&&h),onOpenChange:a=>!a&&e(),modal:!1,disablePointerDismissal:!0,children:(0,d.jsx)(n.DialogPortal,{container:h,children:(0,d.jsx)(n.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:a&&q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[(0,d.jsx)(x.BotMark,{size:28,seed:a.bot,...(0,x.markOf)(a.bot,c),state:"running"===a.status?"thinking":"idle",notify:(0,w.needsThreadReply)(a),crossed:"cancelled"===a.status,className:"shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)(n.DialogTitle,{className:"sr-only",children:a.label}),(0,d.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:a.label}),(0,d.jsxs)("div",{className:"mt-0.5 flex min-w-0 items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,d.jsxs)("span",{title:a.id,className:"min-w-0 truncate",children:[a.bot," · ",(0,E.whenOf)(a.updatedAt)]}),(0,d.jsx)(A.ThreadFacts,{thread:q})]})]}),(0,d.jsx)(M,{thread:a,onStop:()=>f(a),onDelete:()=>g(a),className:"text-muted-foreground"}),(0,d.jsx)(n.DialogClose,{render:(0,d.jsx)(m.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the thread"}),children:(0,d.jsx)(j.X,{})})]}),s?(0,d.jsx)(A.Conversation,{thread:s,tab:t,onTab:b=>p(c=>({...c,[a.id]:b})),className:"max-h-none min-h-0 flex-1 px-5",tabsClassName:"px-5"}):(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-5 py-4",children:[(0,d.jsx)(r.Skeleton,{className:"h-3 w-4/5"}),(0,d.jsx)(r.Skeleton,{className:"h-3 w-3/5"}),(0,d.jsx)(r.Skeleton,{className:"h-3 w-2/3"})]}),(0,d.jsx)("div",{className:"shrink-0 px-5 pt-2 pb-4",children:(0,d.jsx)(J.ThreadReply,{thread:{id:a.id,label:a.label,bot:a.bot,ask:a.ask,room:a.room},status:a.status,faces:q.roster,to:t??a.bot})})]})})})})]})}function O({thread:a}){let b=[];if(a.lines.forEach((c,d)=>{if("tool"!==c.kind)return;let e=a.lines[d+1];b.push({step:c,took:e?(0,E.toDate)(e.at).getTime()-(0,E.toDate)(c.at).getTime():null})}),0===b.length)return null;let c=(0,E.toDate)(a.updatedAt).getTime()-(0,E.toDate)(a.createdAt).getTime();return(0,d.jsxs)("div",{className:"pointer-events-none absolute top-[calc(100%-0.75rem)] left-17 z-20 hidden w-96 max-w-[calc(100%-5rem)] rounded-xl bg-background p-3 pb-2 shadow-xl shadow-black/10 ring-1 ring-border/60 group-hover/row:block",children:[(0,d.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)("span",{children:a.bot}),(0,d.jsx)("span",{className:"opacity-50",children:"·"}),(0,d.jsxs)("span",{children:[b.length," ",1===b.length?"step":"steps"]}),(0,d.jsx)("span",{className:"opacity-50",children:"·"}),(0,d.jsx)("span",{children:P(c)})]}),b.slice(-6).map(({step:a,took:b})=>{let c=(0,z.toolIcon)(a.name);return(0,d.jsxs)("div",{className:"flex h-5.5 items-center gap-2 font-mono text-[11px]",children:[null===b?(0,d.jsx)(f.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}):(0,d.jsx)(c,{className:"size-3 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",children:a.name}),null===b?(0,d.jsx)(q.ShinyText,{text:a.note??a.input,speed:2.2,className:"min-w-0 flex-1 truncate"}):(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:a.note??a.input}),(0,d.jsx)("span",{className:"w-10 shrink-0 text-right text-muted-foreground/70 tabular-nums",children:null===b?"":P(b)})]},a.id)})]})}function P(a){let b=Math.max(0,a)/1e3;if(b<10)return`${b.toFixed(1)}s`;if(b<60)return`${Math.round(b)}s`;let c=Math.floor(b/60);return`${c}m ${Math.round(b-60*c)}s`}function Q(){return(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,d.jsx)(r.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 space-y-2",children:[(0,d.jsx)(r.Skeleton,{className:"h-3 w-40 max-w-full"}),(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-80 max-w-full"})]}),(0,d.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-1.5",R),children:[(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-12"}),(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-24"})]}),(0,d.jsx)("span",{className:"size-4 shrink-0"}),(0,d.jsx)("span",{className:"size-7 shrink-0"})]})}a.s(["ThreadSetting",0,function(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)(""),{data:f}=(0,H.useServerRoute)(l.queryKey.bot),{items:g,isLoading:h,isLoadingMore:i,error:j,hasMore:n,sentinelRef:o}=(0,G.useServerPages)({key:(a,b)=>{if(0===a)return l.queryKey.threadHistory(null);let c=b?.at(-1);return c?l.queryKey.threadHistory((0,E.toDate)(c.updatedAt).toISOString()):null},size:s.PAGE_SIZE}),q=g.find(b=>b.id===a),{data:r}=(0,H.useServerRoute)(a?l.queryKey.thread(a):null),x=r?.id===a?r:void 0;(0,B.useSeenOnDetail)(q);let[y]=(0,F.useServerAction)(t.cancelThreadAction,{onOk:a=>{(0,H.revalidate)(l.queryKey.threads),B.screenActs.announce({kind:"stopped",id:a.id,label:a.label})}}),[z]=(0,F.useServerAction)(v.deleteThreadAction,{onOk:()=>(0,H.revalidate)(l.queryKey.threads)}),[A]=(0,F.useServerAction)(u.clearFinishedThreadsAction,{onOk:()=>(0,H.revalidate)(l.queryKey.threads)}),C=c.trim().toLowerCase(),I=C?g.filter(a=>[a.label,a.outcome,a.bot].join(" ").toLowerCase().includes(C)):g,J=async()=>{await p.notify.confirm({title:"Clear finished jobs?",description:"Everything done or stopped goes, messages included. Running and waiting jobs stay.",okText:"Clear",destructive:!0})&&A()},K=async c=>{if(!await p.notify.confirm({title:`Delete "${c.label}"?`,description:"Its messages go with it — nothing can be picked back up.",okText:"Delete",destructive:!0}))return;let d=I.findIndex(a=>a.id===c.id),e=I[d+1]??I[d-1];try{await z(c.id)}catch{return}c.id===a&&b(e?.id??null)};if(h)return(0,d.jsx)(D.SettingSkeleton,{rows:3});if(j)return(0,d.jsx)(D.SettingError,{message:j.message});let M=g.filter(a=>"waiting"===a.status).length,O=g.filter(w.isUnread).length;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(D.SettingScreen,{footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(D.SettingRailNote,{children:[g.length," shown",M>0&&` \xb7 ${M} waiting on you`,O>0&&` \xb7 ${O} new result${1===O?"":"s"}`]}),(n||g.some(a=>"done"===a.status||"cancelled"===a.status))&&(0,d.jsx)(m.Button,{variant:"outline",size:"sm",onClick:J,children:"Clear finished"})]}),children:(0,d.jsx)(D.SettingGroup,{filter:(0,d.jsx)(D.SettingFilter,{value:c,onChange:e,placeholder:"Filter by label, bot or word"}),right:C?`${I.length} of ${g.length}`:void 0,children:(0,d.jsxs)(D.SettingItems,{children:[0===I.length?(0,d.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:C?"Nothing here matches. Keep scrolling to search further back.":"Nothing yet. When Thursday hands a job to a bot mid-call, it shows up here — while it runs, and after."}):I.map(a=>(0,d.jsx)(L,{thread:a,bots:f,open:a.id===q?.id,onOpen:()=>b(a.id),onStop:()=>y(a.id),onDelete:()=>K(a)},a.id)),(0,d.jsx)(D.SettingMore,{hasMore:n,loading:i,sentinelRef:o,ghost:(0,d.jsx)(Q,{}),className:"divide-y divide-border/60"})]})})}),(0,d.jsx)(N,{thread:q,whole:x,bots:f,onClose:()=>b(null),onStop:a=>y(a.id),onDelete:K})]})}]),c()}catch(a){c(a)}},!1),689115,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fe7edbc64a0cada3b6046e5c302f5fb4d6f82c9e5",b.callServer,void 0,b.findSourceMapURL,"clearFinishedThreadsAction");a.s(["clearFinishedThreadsAction",0,c])},337265,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fe6437d6ac5260f4c18cbdc63e9e69be7297d02bd",b.callServer,void 0,b.findSourceMapURL,"deleteThreadAction");a.s(["deleteThreadAction",0,c])}];
1
+ module.exports=[82951,a=>a.a(async(b,c)=>{try{var d=a.i(187924),e=a.i(141146),f=a.i(875160),g=a.i(272944),h=a.i(19895),i=a.i(951675),j=a.i(474215),k=a.i(572131),l=a.i(767561),m=a.i(340695),n=a.i(965733),o=a.i(676504),p=a.i(446181),q=a.i(545097),r=a.i(950463),s=a.i(287702),t=a.i(591777),u=a.i(945808),v=a.i(939767),w=a.i(411509),x=a.i(913834),y=a.i(42380),z=a.i(8468),A=a.i(181809),B=a.i(135432),C=a.i(156819),D=a.i(619477),E=a.i(199169),F=a.i(313237),G=a.i(862966),H=a.i(759497),I=a.i(497895),J=a.i(988422),K=b([z,A,J]);[z,A,J]=K.then?(await K)():K;let R="w-36";function L({thread:a,bots:b,open:c,onOpen:g,onStop:h,onDelete:i}){let j="running"===a.status,l=(0,k.useMemo)(()=>(0,B.threadFromRow)(a,b),[a,b]),m=function(a){let b=a.room.questions[0];if(b)return{text:(0,I.plainText)(b.text),tone:I.WAITING_INK};if("waiting"===a.status&&a.ask)return{text:(0,w.isAppStop)(a.ask)?(0,I.plainText)(a.outcome??a.ask.question):a.ask.question,tone:I.WAITING_INK};let c=a.seen;if("cancelled"===a.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===a.status)return{text:(0,I.plainText)(a.outcome??"Done"),tone:c?"text-muted-foreground":"text-foreground/80"};for(let b=a.lines.length-1;b>=0;b--){let c=a.lines[b];if("tool"===c.kind)return{text:c.note??c.input,tone:"text-muted-foreground",tool:c.name,shine:!0};if("text"===c.kind)return{text:c.text,tone:"text-muted-foreground",shine:!0};if("user"===c.kind)break}return{text:`${a.bot} is taking it on…`,tone:"text-muted-foreground italic",shine:!0}}(a),n=a.tokens.input+a.tokens.output;return(0,d.jsxs)("div",{className:(0,I.cn)("group/row relative transition-colors",c?"bg-muted/80":"hover:bg-muted/50"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,d.jsxs)("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,d.jsx)(x.BotMark,{size:40,seed:a.bot,...(0,x.markOf)(a.bot,b),state:j?"thinking":"idle",notify:(0,w.needsThreadReply)(a)||(0,w.isUnread)(a),crossed:"cancelled"===a.status,className:"shrink-0"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),a.routineId&&(0,d.jsx)("span",{title:"Started by a routine",className:"shrink-0",children:(0,d.jsx)(C.RoutineMark,{className:"size-3 text-muted-foreground/80"})}),(0,d.jsx)(y.BotRoster,{bots:l.roster}),j&&(0,d.jsx)(f.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),m&&(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] leading-snug",children:[m.tool&&(0,d.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:m.tool}),m.shine?(0,d.jsx)(q.ShinyText,{text:m.text,speed:2.2,className:"min-w-0 truncate"}):(0,d.jsx)("span",{className:(0,I.cn)("min-w-0 truncate",m.tone),children:m.text})]})]}),(0,d.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",R),children:[(0,d.jsx)("span",{children:(0,E.whenOf)(a.updatedAt)}),(0,d.jsxs)("span",{className:"max-w-full truncate text-muted-foreground/70",title:n>0?`${a.id} \xb7 in ${(0,I.formatCount)(a.tokens.input)} \xb7 out ${(0,I.formatCount)(a.tokens.output)}`:a.id,children:[a.bot,n>0&&` \xb7 ${(0,I.formatCount)(n)}`]})]}),(0,d.jsx)(e.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,d.jsx)(M,{thread:a,onStop:h,onDelete:i})]}),j&&(0,d.jsx)(O,{thread:a})]})}function M({thread:a,onStop:b,onDelete:c,className:e}){let f="running"===a.status||"waiting"===a.status;return(0,d.jsxs)(o.DropdownMenu,{children:[(0,d.jsx)(o.DropdownMenuTrigger,{render:(0,d.jsx)(m.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:e}),children:(0,d.jsx)(g.MoreHorizontal,{})}),(0,d.jsxs)(o.DropdownMenuContent,{align:"end",children:[f&&(0,d.jsxs)(o.DropdownMenuItem,{onClick:b,children:[(0,d.jsx)(h.Square,{}),"Stop"]}),(0,d.jsxs)(o.DropdownMenuItem,{variant:"destructive",onClick:c,children:[(0,d.jsx)(i.Trash2,{}),"Delete"]})]})]})}function N({thread:a,whole:b,bots:c,onClose:e,onStop:f,onDelete:g}){let[h,i]=(0,k.useState)(null),l=(0,k.useCallback)(a=>{i(a?.closest("[data-slot=dialog-content]")??null)},[]),[o,p]=(0,k.useState)({}),q=(0,k.useMemo)(()=>a?(0,B.threadFromRow)(a,c):null,[a,c]),s=(0,k.useMemo)(()=>b?(0,B.threadFromRow)(b,c):q?.lines.length?q:null,[b,q,c]),t=a?o[a.id]??null:null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{ref:l,hidden:!0}),(0,d.jsx)(n.Dialog,{open:!!(a&&h),onOpenChange:a=>!a&&e(),modal:!1,disablePointerDismissal:!0,children:(0,d.jsx)(n.DialogPortal,{container:h,children:(0,d.jsx)(n.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:a&&q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[(0,d.jsx)(x.BotMark,{size:28,seed:a.bot,...(0,x.markOf)(a.bot,c),state:"running"===a.status?"thinking":"idle",notify:(0,w.needsThreadReply)(a),crossed:"cancelled"===a.status,className:"shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)(n.DialogTitle,{className:"sr-only",children:a.label}),(0,d.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:a.label}),(0,d.jsxs)("div",{className:"mt-0.5 flex min-w-0 items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,d.jsxs)("span",{title:a.id,className:"min-w-0 truncate",children:[a.bot," · ",(0,E.whenOf)(a.updatedAt)]}),(0,d.jsx)(A.ThreadFacts,{thread:q})]})]}),(0,d.jsx)(M,{thread:a,onStop:()=>f(a),onDelete:()=>g(a),className:"text-muted-foreground"}),(0,d.jsx)(n.DialogClose,{render:(0,d.jsx)(m.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the thread"}),children:(0,d.jsx)(j.X,{})})]}),s?(0,d.jsx)(A.Conversation,{thread:s,tab:t,onTab:b=>p(c=>({...c,[a.id]:b})),className:"max-h-none min-h-0 flex-1 px-5",tabsClassName:"px-5"}):(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-5 py-4",children:[(0,d.jsx)(r.Skeleton,{className:"h-3 w-4/5"}),(0,d.jsx)(r.Skeleton,{className:"h-3 w-3/5"}),(0,d.jsx)(r.Skeleton,{className:"h-3 w-2/3"})]}),(0,d.jsx)("div",{className:"shrink-0 px-5 pt-2 pb-4",children:(0,d.jsx)(J.ThreadReply,{thread:{id:a.id,label:a.label,bot:a.bot,ask:a.ask,room:a.room},status:a.status,faces:q.roster,to:t??a.bot})})]})})})})]})}function O({thread:a}){let b=[];if(a.lines.forEach((c,d)=>{if("tool"!==c.kind)return;let e=a.lines[d+1];b.push({step:c,took:e?(0,E.toDate)(e.at).getTime()-(0,E.toDate)(c.at).getTime():null})}),0===b.length)return null;let c=(0,E.toDate)(a.updatedAt).getTime()-(0,E.toDate)(a.createdAt).getTime();return(0,d.jsxs)("div",{className:"pointer-events-none absolute top-[calc(100%-0.75rem)] left-17 z-20 hidden w-96 max-w-[calc(100%-5rem)] rounded-xl bg-background p-3 pb-2 shadow-xl shadow-black/10 ring-1 ring-border/60 group-hover/row:block",children:[(0,d.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[(0,d.jsx)("span",{children:a.bot}),(0,d.jsx)("span",{className:"opacity-50",children:"·"}),(0,d.jsxs)("span",{children:[b.length," ",1===b.length?"step":"steps"]}),(0,d.jsx)("span",{className:"opacity-50",children:"·"}),(0,d.jsx)("span",{children:P(c)})]}),b.slice(-6).map(({step:a,took:b})=>{let c=(0,z.toolIcon)(a.name);return(0,d.jsxs)("div",{className:"flex h-5.5 items-center gap-2 font-mono text-[11px]",children:[null===b?(0,d.jsx)(f.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}):(0,d.jsx)(c,{className:"size-3 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",children:a.name}),null===b?(0,d.jsx)(q.ShinyText,{text:a.note??a.input,speed:2.2,className:"min-w-0 flex-1 truncate"}):(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:a.note??a.input}),(0,d.jsx)("span",{className:"w-10 shrink-0 text-right text-muted-foreground/70 tabular-nums",children:null===b?"":P(b)})]},a.id)})]})}function P(a){let b=Math.max(0,a)/1e3;if(b<10)return`${b.toFixed(1)}s`;if(b<60)return`${Math.round(b)}s`;let c=Math.floor(b/60);return`${c}m ${Math.round(b-60*c)}s`}function Q(){return(0,d.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,d.jsx)(r.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 space-y-2",children:[(0,d.jsx)(r.Skeleton,{className:"h-3 w-40 max-w-full"}),(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-80 max-w-full"})]}),(0,d.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-1.5",R),children:[(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-12"}),(0,d.jsx)(r.Skeleton,{className:"h-2.5 w-24"})]}),(0,d.jsx)("span",{className:"size-4 shrink-0"}),(0,d.jsx)("span",{className:"size-7 shrink-0"})]})}a.s(["ThreadSetting",0,function(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)(""),{data:f}=(0,H.useServerRoute)(l.queryKey.bot),{items:g,isLoading:h,isLoadingMore:i,error:j,hasMore:n,sentinelRef:o}=(0,G.useServerPages)({key:(a,b)=>{if(0===a)return l.queryKey.threadHistory(null);let c=b?.at(-1);return c?l.queryKey.threadHistory((0,E.toDate)(c.updatedAt).toISOString()):null},size:s.PAGE_SIZE}),q=g.find(b=>b.id===a),{data:r}=(0,H.useServerRoute)(a?l.queryKey.thread(a):null),x=r?.id===a?r:void 0;(0,B.useSeenOnDetail)(q);let[y]=(0,F.useServerAction)(t.cancelThreadAction,{onOk:a=>{(0,H.revalidate)(l.queryKey.threads),B.screenActs.announce({kind:"stopped",id:a.id,label:a.label})}}),[z]=(0,F.useServerAction)(v.deleteThreadAction,{onOk:()=>(0,H.revalidate)(l.queryKey.threads)}),[A]=(0,F.useServerAction)(u.clearFinishedThreadsAction,{onOk:()=>(0,H.revalidate)(l.queryKey.threads)}),C=c.trim().toLowerCase(),I=C?g.filter(a=>[a.label,a.outcome,a.bot].join(" ").toLowerCase().includes(C)):g,J=async()=>{await p.notify.confirm({title:"Clear finished jobs?",description:"Everything done or stopped goes, messages included. Running and waiting jobs stay.",okText:"Clear",destructive:!0})&&A()},K=async c=>{if(!await p.notify.confirm({title:`Delete "${c.label}"?`,description:"Its messages go with it — nothing can be picked back up.",okText:"Delete",destructive:!0}))return;let d=I.findIndex(a=>a.id===c.id),e=I[d+1]??I[d-1];try{await z(c.id)}catch{return}c.id===a&&b(e?.id??null)};if(h)return(0,d.jsx)(D.SettingSkeleton,{rows:3});if(j)return(0,d.jsx)(D.SettingError,{message:j.message});let M=g.filter(a=>"waiting"===a.status).length,O=g.filter(w.isUnread).length;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(D.SettingScreen,{footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(D.SettingRailNote,{children:[g.length," shown",M>0&&` \xb7 ${M} waiting on you`,O>0&&` \xb7 ${O} new result${1===O?"":"s"}`]}),(n||g.some(a=>"done"===a.status||"cancelled"===a.status))&&(0,d.jsx)(m.Button,{variant:"outline",size:"sm",onClick:J,children:"Clear finished"})]}),children:(0,d.jsx)(D.SettingGroup,{filter:(0,d.jsx)(D.SettingFilter,{value:c,onChange:e,placeholder:"Filter by label, bot or word"}),right:C?`${I.length} of ${g.length}`:void 0,children:(0,d.jsxs)(D.SettingItems,{children:[0===I.length?(0,d.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:C?"Nothing here matches. Keep scrolling to search further back.":"Nothing yet. When Thursday hands a job to a bot mid-call, it shows up here — while it runs, and after."}):I.map(a=>(0,d.jsx)(L,{thread:a,bots:f,open:a.id===q?.id,onOpen:()=>b(a.id),onStop:()=>y(a.id),onDelete:()=>K(a)},a.id)),(0,d.jsx)(D.SettingMore,{hasMore:n,loading:i,sentinelRef:o,ghost:(0,d.jsx)(Q,{}),className:"divide-y divide-border/60"})]})})}),(0,d.jsx)(N,{thread:q,whole:x,bots:f,onClose:()=>b(null),onStop:a=>y(a.id),onDelete:K})]})}]),c()}catch(a){c(a)}},!1),945808,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7febffcb1100910f5a48f0c69005256ece858ef945",b.callServer,void 0,b.findSourceMapURL,"clearFinishedThreadsAction");a.s(["clearFinishedThreadsAction",0,c])},939767,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fce19c8ccf864c3c04cd86620c05f935dffdbd4e7",b.callServer,void 0,b.findSourceMapURL,"deleteThreadAction");a.s(["deleteThreadAction",0,c])}];
2
2
 
3
- //# sourceMappingURL=features_bot_18gqkr_._.js.map
3
+ //# sourceMappingURL=features_bot_1fn_grf._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[405593,a=>{"use strict";var b,c=a.i(187924),d=a.i(987234),e=a.i(823319),f=a.i(692867),g=a.i(626335),h=a.i(752562),i=a.i(141146),j=a.i(164831);let k={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};k.node;let l=(0,j.default)(k);var m=a.i(607396),m=m,n=a.i(71215),o=a.i(126766),p=a.i(233540),q=a.i(26268),r=a.i(572131),s=a.i(767561),t=a.i(340695),u=a.i(205522),v=a.i(446181),w=a.i(630342),x=a.i(341889),y=a.i(950463),z=a.i(287702),A=a.i(852307),B=a.i(908531),C=a.i(608902),D=a.i(379630),E=a.i(61876),F=a.i(913834),G=a.i(140232),H=a.i(409031),I=a.i(478978),J=a.i(585650),K=a.i(168370),L=((b=L||{})[b.Border=-1]="Border",b[b.Data=0]="Data",b[b.Function=1]="Function",b[b.Position=2]="Position",b[b.Timing=3]="Timing",b[b.Alignment=4]="Alignment",b);let M=[1,0],N=[2,3],O=[3,2],P={L:[0,1],M:M,Q:N,H:O},Q=/^\d*$/,R=/^[A-Z0-9 $%*+./:-]*$/,S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",T=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],U=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class V{constructor(a,b,c,d){if(this.version=a,this.ecc=b,a<1||a>40)throw RangeError("Version value out of range");if(d<-1||d>7)throw RangeError("Mask value out of range");this.size=4*a+17;const e=Array.from({length:this.size}).fill(!1);for(let a=0;a<this.size;a++)this.modules.push(e.slice()),this.types.push(e.map(()=>0));this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),-1===d){let a=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const c=this.getPenaltyScore();c<a&&(d=b,a=c),this.applyMask(b)}}this.mask=d,this.applyMask(d),this.drawFormatBits(d)}size;mask;modules=[];types=[];getModule(a,b){return a>=0&&a<this.size&&b>=0&&b<this.size&&this.modules[b][a]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0,L.Timing),this.setFunctionModule(a,6,a%2==0,L.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let a=this.getAlignmentPatternPositions(),b=a.length;for(let c=0;c<b;c++)for(let d=0;d<b;d++)(0!==c||0!==d)&&(0!==c||d!==b-1)&&(c!==b-1||0!==d)&&this.drawAlignmentPattern(a[c],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){let b=this.ecc[1]<<3|a,c=b;for(let a=0;a<10;a++)c=c<<1^(c>>>9)*1335;let d=(b<<10|c)^21522;for(let a=0;a<=5;a++)this.setFunctionModule(8,a,X(d,a));this.setFunctionModule(8,7,X(d,6)),this.setFunctionModule(8,8,X(d,7)),this.setFunctionModule(7,8,X(d,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,X(d,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,X(d,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,X(d,a));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let b=0;b<12;b++)a=a<<1^(a>>>11)*7973;let b=this.version<<12|a;for(let a=0;a<18;a++){let c=X(b,a),d=this.size-11+a%3,e=Math.floor(a/3);this.setFunctionModule(d,e,c),this.setFunctionModule(e,d,c)}}drawFinderPattern(a,b){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){let e=Math.max(Math.abs(d),Math.abs(c)),f=a+d,g=b+c;f>=0&&f<this.size&&g>=0&&g<this.size&&this.setFunctionModule(f,g,2!==e&&4!==e,L.Position)}}drawAlignmentPattern(a,b){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,b+c,1!==Math.max(Math.abs(d),Math.abs(c)),L.Alignment)}setFunctionModule(a,b,c,d=L.Function){this.modules[b][a]=c,this.types[b][a]=d}addEccAndInterleave(a){let b=this.version,c=this.ecc;if(a.length!==ad(b,c))throw RangeError("Invalid argument");let d=U[c[0]][b],e=T[c[0]][b],f=Math.floor(ac(b)/8),g=d-f%d,h=Math.floor(f/d),i=[],j=function(a){if(a<1||a>255)throw RangeError("Degree out of range");let b=[];for(let c=0;c<a-1;c++)b.push(0);b.push(1);let c=1;for(let d=0;d<a;d++){for(let a=0;a<b.length;a++)b[a]=ae(b[a],c),a+1<b.length&&(b[a]^=b[a+1]);c=ae(c,2)}return b}(e);for(let b=0,c=0;b<d;b++){let d=a.slice(c,c+h-e+(b<g?0:1));c+=d.length;let f=function(a,b){let c=b.map(a=>0);for(let d of a){let a=d^c.shift();c.push(0),b.forEach((b,d)=>c[d]^=ae(b,a))}return c}(d,j);b<g&&d.push(0),i.push(d.concat(f))}let k=[];for(let a=0;a<i[0].length;a++)i.forEach((b,c)=>{(a!==h-e||c>=g)&&k.push(b[a])});return k}drawCodewords(a){if(a.length!==Math.floor(ac(this.version)/8))throw RangeError("Invalid argument");let b=0;for(let c=this.size-1;c>=1;c-=2){6===c&&(c=5);for(let d=0;d<this.size;d++)for(let e=0;e<2;e++){let f=c-e,g=(c+1&2)==0?this.size-1-d:d;!this.types[g][f]&&b<8*a.length&&(this.modules[g][f]=X(a[b>>>3],7-(7&b)),b++)}}}applyMask(a){if(a<0||a>7)throw RangeError("Mask value out of range");for(let b=0;b<this.size;b++)for(let c=0;c<this.size;c++){let d;switch(a){case 0:d=(c+b)%2==0;break;case 1:d=b%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+b)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(b/2))%2==0;break;case 5:d=c*b%2+c*b%3==0;break;case 6:d=(c*b%2+c*b%3)%2==0;break;case 7:d=((c+b)%2+c*b%3)%2==0;break;default:throw Error("Unreachable")}!this.types[b][c]&&d&&(this.modules[b][c]=!this.modules[b][c])}}getPenaltyScore(){let a=0;for(let b=0;b<this.size;b++){let c=!1,d=0,e=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[b][f]===c?5==++d?a+=3:d>5&&a++:(this.finderPenaltyAddHistory(d,e),c||(a+=40*this.finderPenaltyCountPatterns(e)),c=this.modules[b][f],d=1);a+=40*this.finderPenaltyTerminateAndCount(c,d,e)}for(let b=0;b<this.size;b++){let c=!1,d=0,e=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][b]===c?5==++d?a+=3:d>5&&a++:(this.finderPenaltyAddHistory(d,e),c||(a+=40*this.finderPenaltyCountPatterns(e)),c=this.modules[f][b],d=1);a+=40*this.finderPenaltyTerminateAndCount(c,d,e)}for(let b=0;b<this.size-1;b++)for(let c=0;c<this.size-1;c++){let d=this.modules[b][c];d===this.modules[b][c+1]&&d===this.modules[b+1][c]&&d===this.modules[b+1][c+1]&&(a+=3)}let b=0;for(let a of this.modules)b=a.reduce((a,b)=>a+ +!!b,b);let c=this.size*this.size;return a+(Math.ceil(Math.abs(20*b-10*c)/c)-1)*10}getAlignmentPatternPositions(){if(1===this.version)return[];{let a=Math.floor(this.version/7)+2,b=32===this.version?26:2*Math.ceil((4*this.version+4)/(2*a-2)),c=[6];for(let d=this.size-7;c.length<a;d-=b)c.splice(1,0,d);return c}}finderPenaltyCountPatterns(a){let b=a[1],c=b>0&&a[2]===b&&a[3]===3*b&&a[4]===b&&a[5]===b;return(c&&a[0]>=4*b&&a[6]>=b?1:0)+(c&&a[6]>=4*b&&a[0]>=b?1:0)}finderPenaltyTerminateAndCount(a,b,c){return a&&(this.finderPenaltyAddHistory(b,c),b=0),b+=this.size,this.finderPenaltyAddHistory(b,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(a,b){0===b[0]&&(a+=this.size),b.pop(),b.unshift(a)}}function W(a,b,c){if(b<0||b>31||a>>>b!=0)throw RangeError("Value out of range");for(let d=b-1;d>=0;d--)c.push(a>>>d&1)}function X(a,b){return(a>>>b&1)!=0}class Y{constructor(a,b,c){if(this.mode=a,this.numChars=b,this.bitData=c,b<0)throw RangeError("Invalid argument");this.bitData=c.slice()}getData(){return this.bitData.slice()}}let Z=[1,10,12,14],$=[2,9,11,13],_=[4,8,16,16];function aa(a,b){return a[Math.floor((b+7)/17)+1]}function ab(a){let b=[];for(let c of a)W(c,8,b);return new Y(_,a.length,b)}function ac(a){if(a<1||a>40)throw RangeError("Version number out of range");let b=(16*a+128)*a+64;if(a>=2){let c=Math.floor(a/7)+2;b-=(25*c-10)*c-55,a>=7&&(b-=36)}return b}function ad(a,b){return Math.floor(ac(a)/8)-T[b[0]][a]*U[b[0]][a]}function ae(a,b){if(a>>>8!=0||b>>>8!=0)throw RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285^(b>>>d&1)*a;return c}var af=a.i(986368),ag=a.i(545097),ah=a.i(619477),ai=a.i(313237),aj=a.i(759497),ak=a.i(497895),al=a.i(405050);let am=(0,al.createServerReference)("7f787b69f6e9bbb92118d8190ab3b8f9f18bd05fb9",al.callServer,void 0,al.findSourceMapURL,"forgetReachAction");var an=a.i(907602);let ao={telegram:"telegram.org",discord:"discord.com",slack:"slack.com"},ap=`display_information:
1
+ module.exports=[405593,a=>{"use strict";var b,c=a.i(187924),d=a.i(987234),e=a.i(823319),f=a.i(692867),g=a.i(626335),h=a.i(752562),i=a.i(141146),j=a.i(164831);let k={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};k.node;let l=(0,j.default)(k);var m=a.i(607396),m=m,n=a.i(71215),o=a.i(126766),p=a.i(233540),q=a.i(26268),r=a.i(572131),s=a.i(767561),t=a.i(340695),u=a.i(205522),v=a.i(446181),w=a.i(630342),x=a.i(341889),y=a.i(950463),z=a.i(287702),A=a.i(852307),B=a.i(908531),C=a.i(608902),D=a.i(379630),E=a.i(61876),F=a.i(913834),G=a.i(214013),H=a.i(100285),I=a.i(478978),J=a.i(585650),K=a.i(168370),L=((b=L||{})[b.Border=-1]="Border",b[b.Data=0]="Data",b[b.Function=1]="Function",b[b.Position=2]="Position",b[b.Timing=3]="Timing",b[b.Alignment=4]="Alignment",b);let M=[1,0],N=[2,3],O=[3,2],P={L:[0,1],M:M,Q:N,H:O},Q=/^\d*$/,R=/^[A-Z0-9 $%*+./:-]*$/,S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",T=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],U=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class V{constructor(a,b,c,d){if(this.version=a,this.ecc=b,a<1||a>40)throw RangeError("Version value out of range");if(d<-1||d>7)throw RangeError("Mask value out of range");this.size=4*a+17;const e=Array.from({length:this.size}).fill(!1);for(let a=0;a<this.size;a++)this.modules.push(e.slice()),this.types.push(e.map(()=>0));this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),-1===d){let a=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const c=this.getPenaltyScore();c<a&&(d=b,a=c),this.applyMask(b)}}this.mask=d,this.applyMask(d),this.drawFormatBits(d)}size;mask;modules=[];types=[];getModule(a,b){return a>=0&&a<this.size&&b>=0&&b<this.size&&this.modules[b][a]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0,L.Timing),this.setFunctionModule(a,6,a%2==0,L.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let a=this.getAlignmentPatternPositions(),b=a.length;for(let c=0;c<b;c++)for(let d=0;d<b;d++)(0!==c||0!==d)&&(0!==c||d!==b-1)&&(c!==b-1||0!==d)&&this.drawAlignmentPattern(a[c],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){let b=this.ecc[1]<<3|a,c=b;for(let a=0;a<10;a++)c=c<<1^(c>>>9)*1335;let d=(b<<10|c)^21522;for(let a=0;a<=5;a++)this.setFunctionModule(8,a,X(d,a));this.setFunctionModule(8,7,X(d,6)),this.setFunctionModule(8,8,X(d,7)),this.setFunctionModule(7,8,X(d,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,X(d,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,X(d,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,X(d,a));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let b=0;b<12;b++)a=a<<1^(a>>>11)*7973;let b=this.version<<12|a;for(let a=0;a<18;a++){let c=X(b,a),d=this.size-11+a%3,e=Math.floor(a/3);this.setFunctionModule(d,e,c),this.setFunctionModule(e,d,c)}}drawFinderPattern(a,b){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){let e=Math.max(Math.abs(d),Math.abs(c)),f=a+d,g=b+c;f>=0&&f<this.size&&g>=0&&g<this.size&&this.setFunctionModule(f,g,2!==e&&4!==e,L.Position)}}drawAlignmentPattern(a,b){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,b+c,1!==Math.max(Math.abs(d),Math.abs(c)),L.Alignment)}setFunctionModule(a,b,c,d=L.Function){this.modules[b][a]=c,this.types[b][a]=d}addEccAndInterleave(a){let b=this.version,c=this.ecc;if(a.length!==ad(b,c))throw RangeError("Invalid argument");let d=U[c[0]][b],e=T[c[0]][b],f=Math.floor(ac(b)/8),g=d-f%d,h=Math.floor(f/d),i=[],j=function(a){if(a<1||a>255)throw RangeError("Degree out of range");let b=[];for(let c=0;c<a-1;c++)b.push(0);b.push(1);let c=1;for(let d=0;d<a;d++){for(let a=0;a<b.length;a++)b[a]=ae(b[a],c),a+1<b.length&&(b[a]^=b[a+1]);c=ae(c,2)}return b}(e);for(let b=0,c=0;b<d;b++){let d=a.slice(c,c+h-e+(b<g?0:1));c+=d.length;let f=function(a,b){let c=b.map(a=>0);for(let d of a){let a=d^c.shift();c.push(0),b.forEach((b,d)=>c[d]^=ae(b,a))}return c}(d,j);b<g&&d.push(0),i.push(d.concat(f))}let k=[];for(let a=0;a<i[0].length;a++)i.forEach((b,c)=>{(a!==h-e||c>=g)&&k.push(b[a])});return k}drawCodewords(a){if(a.length!==Math.floor(ac(this.version)/8))throw RangeError("Invalid argument");let b=0;for(let c=this.size-1;c>=1;c-=2){6===c&&(c=5);for(let d=0;d<this.size;d++)for(let e=0;e<2;e++){let f=c-e,g=(c+1&2)==0?this.size-1-d:d;!this.types[g][f]&&b<8*a.length&&(this.modules[g][f]=X(a[b>>>3],7-(7&b)),b++)}}}applyMask(a){if(a<0||a>7)throw RangeError("Mask value out of range");for(let b=0;b<this.size;b++)for(let c=0;c<this.size;c++){let d;switch(a){case 0:d=(c+b)%2==0;break;case 1:d=b%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+b)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(b/2))%2==0;break;case 5:d=c*b%2+c*b%3==0;break;case 6:d=(c*b%2+c*b%3)%2==0;break;case 7:d=((c+b)%2+c*b%3)%2==0;break;default:throw Error("Unreachable")}!this.types[b][c]&&d&&(this.modules[b][c]=!this.modules[b][c])}}getPenaltyScore(){let a=0;for(let b=0;b<this.size;b++){let c=!1,d=0,e=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[b][f]===c?5==++d?a+=3:d>5&&a++:(this.finderPenaltyAddHistory(d,e),c||(a+=40*this.finderPenaltyCountPatterns(e)),c=this.modules[b][f],d=1);a+=40*this.finderPenaltyTerminateAndCount(c,d,e)}for(let b=0;b<this.size;b++){let c=!1,d=0,e=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][b]===c?5==++d?a+=3:d>5&&a++:(this.finderPenaltyAddHistory(d,e),c||(a+=40*this.finderPenaltyCountPatterns(e)),c=this.modules[f][b],d=1);a+=40*this.finderPenaltyTerminateAndCount(c,d,e)}for(let b=0;b<this.size-1;b++)for(let c=0;c<this.size-1;c++){let d=this.modules[b][c];d===this.modules[b][c+1]&&d===this.modules[b+1][c]&&d===this.modules[b+1][c+1]&&(a+=3)}let b=0;for(let a of this.modules)b=a.reduce((a,b)=>a+ +!!b,b);let c=this.size*this.size;return a+(Math.ceil(Math.abs(20*b-10*c)/c)-1)*10}getAlignmentPatternPositions(){if(1===this.version)return[];{let a=Math.floor(this.version/7)+2,b=32===this.version?26:2*Math.ceil((4*this.version+4)/(2*a-2)),c=[6];for(let d=this.size-7;c.length<a;d-=b)c.splice(1,0,d);return c}}finderPenaltyCountPatterns(a){let b=a[1],c=b>0&&a[2]===b&&a[3]===3*b&&a[4]===b&&a[5]===b;return(c&&a[0]>=4*b&&a[6]>=b?1:0)+(c&&a[6]>=4*b&&a[0]>=b?1:0)}finderPenaltyTerminateAndCount(a,b,c){return a&&(this.finderPenaltyAddHistory(b,c),b=0),b+=this.size,this.finderPenaltyAddHistory(b,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(a,b){0===b[0]&&(a+=this.size),b.pop(),b.unshift(a)}}function W(a,b,c){if(b<0||b>31||a>>>b!=0)throw RangeError("Value out of range");for(let d=b-1;d>=0;d--)c.push(a>>>d&1)}function X(a,b){return(a>>>b&1)!=0}class Y{constructor(a,b,c){if(this.mode=a,this.numChars=b,this.bitData=c,b<0)throw RangeError("Invalid argument");this.bitData=c.slice()}getData(){return this.bitData.slice()}}let Z=[1,10,12,14],$=[2,9,11,13],_=[4,8,16,16];function aa(a,b){return a[Math.floor((b+7)/17)+1]}function ab(a){let b=[];for(let c of a)W(c,8,b);return new Y(_,a.length,b)}function ac(a){if(a<1||a>40)throw RangeError("Version number out of range");let b=(16*a+128)*a+64;if(a>=2){let c=Math.floor(a/7)+2;b-=(25*c-10)*c-55,a>=7&&(b-=36)}return b}function ad(a,b){return Math.floor(ac(a)/8)-T[b[0]][a]*U[b[0]][a]}function ae(a,b){if(a>>>8!=0||b>>>8!=0)throw RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285^(b>>>d&1)*a;return c}var af=a.i(986368),ag=a.i(545097),ah=a.i(619477),ai=a.i(313237),aj=a.i(759497),ak=a.i(497895),al=a.i(405050);let am=(0,al.createServerReference)("7f1de1f12ee8e3b472973865a1b455fbca4fbe4919",al.callServer,void 0,al.findSourceMapURL,"forgetReachAction");var an=a.i(907602);let ao={telegram:"telegram.org",discord:"discord.com",slack:"slack.com"},ap=`display_information:
2
2
  name: Thursday
3
3
  features:
4
4
  app_home:
@@ -15,6 +15,6 @@ settings:
15
15
  interactivity:
16
16
  is_enabled: true
17
17
  socket_mode_enabled: true
18
- `,aq=({children:a})=>(0,c.jsx)("span",{className:"font-medium text-foreground",children:a}),ar={telegram:[{body:(0,c.jsxs)(c.Fragment,{children:["In Telegram, write to ",(0,c.jsx)(aq,{children:"@BotFather"}),", send ",(0,c.jsx)(aq,{children:"/newbot"})," and pick a name. It answers with a ",(0,c.jsx)(aq,{children:"token"}),"."]}),slot:{open:"https://t.me/BotFather",label:"Open @BotFather"}},{body:(0,c.jsx)(c.Fragment,{children:"Paste the token here."}),slot:{key:an.TELEGRAM_TOKEN_KEY,looks:"123456789:AAE…"}},{body:(0,c.jsx)(c.Fragment,{children:"From your phone, write anything to your bot."}),slot:{says:"Point your phone's camera at it to open the chat."}},{body:(0,c.jsxs)(c.Fragment,{children:["A question with a code appears on this computer. Press ",(0,c.jsx)(aq,{children:"Allow"})," if your phone shows the same code."]})}],discord:[{body:(0,c.jsxs)(c.Fragment,{children:["At ",(0,c.jsx)(aq,{children:"discord.com/developers"}),", make a ",(0,c.jsx)(aq,{children:"New Application"}),". So nobody else can add it to a server, set ",(0,c.jsx)(aq,{children:"Install Link"})," to"," ",(0,c.jsx)(aq,{children:"None"})," on its ",(0,c.jsx)(aq,{children:"Installation"})," page and turn off"," ",(0,c.jsx)(aq,{children:"Public Bot"})," on its ",(0,c.jsx)(aq,{children:"Bot"})," page. There, press"," ",(0,c.jsx)(aq,{children:"Reset Token"})," and copy it."]}),slot:{open:"https://discord.com/developers/applications",label:"Open discord.com/developers"}},{body:(0,c.jsx)(c.Fragment,{children:"Paste the token here."}),slot:{key:an.DISCORD_TOKEN_KEY,looks:"MTE…"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Add the bot to a server of your own"})," — Discord only delivers a message to a bot you share a server with. A private server made for this is fine."]}),slot:{says:"Point your phone's camera at it, or open it here. It asks which server, and adds the bot with no permissions in it.",does:"Add the bot to a server"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Send the bot a direct message"}),", not in the server: on a phone, tap the bot in the server's member list, then ",(0,c.jsx)(aq,{children:"Message"}),". A question with a code appears here: press ",(0,c.jsx)(aq,{children:"Allow"})," if your phone shows the same code."]})}],slack:[{body:(0,c.jsxs)(c.Fragment,{children:["At ",(0,c.jsx)(({href:a,children:b})=>(0,c.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",className:"font-medium text-foreground underline underline-offset-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:b}),{href:"https://api.slack.com/apps",children:"api.slack.com/apps"}),","," ",(0,c.jsx)(aq,{children:"Create New App › From a manifest"}),", and paste the manifest."]}),slot:{manifest:!0}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Basic Information › App-Level Tokens"}),": generate one with"," ",(0,c.jsx)(aq,{children:"connections:write"}),". It starts with xapp-."]}),slot:{key:an.SLACK_APP_TOKEN_KEY,looks:"xapp-…"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Install App"})," to your workspace. The Bot User OAuth Token starts with xoxb-."]}),slot:{key:an.SLACK_BOT_TOKEN_KEY,looks:"xoxb-…"}},{body:(0,c.jsxs)(c.Fragment,{children:["In Slack, open the app under ",(0,c.jsx)(aq,{children:"Apps"})," and write in its"," ",(0,c.jsx)(aq,{children:"Messages"})," tab. A question with a code appears here: press"," ",(0,c.jsx)(aq,{children:"Allow"})," if Slack shows the same code."]})}]};function as(){let a=(0,aj.useServerRoute)(s.queryKey.config),b=(0,aj.useServerRoute)(s.queryKey.reach);(0,af.useAppEvent)({reach:()=>void(0,aj.revalidate)(s.queryKey.reach)});let d=b=>(0,I.isConfigSet)(a.data,b),e=a=>b.data?.channels.find(b=>b.name===a)??null,f=a=>!!e(a)?.allowed,g=an.REACH_CHANNELS.find(a=>e(a)?.refused),h=an.REACH_CHANNELS.find(a=>an.REACH_KEYS[a].every(d)&&!f(a)),i=!an.REACH_CHANNELS.some(f),[j,k]=(0,r.useState)(g??h??(i?an.REACH_CHANNELS[0]:null));return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(ah.SettingItems,{children:an.REACH_CHANNELS.map(a=>(0,c.jsx)(at,{name:a,status:e(a),tokensIn:an.REACH_KEYS[a].filter(d).length,isSet:d,open:j===a,onOpen:()=>k(j===a?null:a)},a))}),(0,c.jsx)(ah.SettingNote,{children:"Only the one person you allow can write, and only direct messages are read. Work started here runs whether or not a tab is open, while Thursday is running on this computer."})]})}function at({name:a,status:b,tokensIn:d,isSet:e,open:f,onOpen:g}){var h;let j,k,l,m,n=ar[a],p=b?.refused??null,q=(h={connected:!!b?.bot,allowed:!!b?.allowed,refused:p},j=n.map(a=>a.slot&&"key"in a.slot?a.slot.key:null),k=a=>!e(a)||a===h.refused,l=j.findIndex(a=>a&&k(a)),m=j.reduce((a,b,c)=>b?c:a,-1),n.map((a,b)=>{let c=j[b];return c?k(c)?b===l?"now":"later":"done":l>=0?b<l?h.refused?"done":"flat":"later":h.allowed||b<m?"done":h.connected?"now":"flat"})),r=!!b?.bot&&!b?.allowed&&!p;return(0,c.jsxs)("div",{children:[(0,c.jsxs)("button",{type:"button",onClick:g,"aria-expanded":f,className:"flex w-full items-center gap-3 px-4 py-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsx)(x.SiteIcon,{host:ao[a],className:"size-4 rounded-[4px]",fallback:(0,c.jsx)(o.KeyRound,{className:"size-4 text-muted-foreground"})}),(0,c.jsx)("span",{className:"text-sm font-medium",children:an.REACH_LABEL[a]}),(0,c.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,c.jsx)(au,{status:b,tokensIn:d,tokens:an.REACH_KEYS[a].length})}),(0,c.jsx)(i.ChevronRight,{className:(0,ak.cn)("size-4 shrink-0 text-muted-foreground transition-transform",f&&"rotate-90")})]}),f&&(0,c.jsxs)("div",{className:"px-4 pt-1 pb-4",children:[(0,c.jsx)("ol",{className:"space-y-3",children:n.map((a,d)=>(0,c.jsx)(av,{n:d+1,step:a,state:q[d],set:!!a.slot&&"key"in a.slot&&e(a.slot.key),refused:a.slot&&"key"in a.slot&&a.slot.key===p?b?.problem??"":null,link:b?.link??null,waiting:r&&d===n.length-1},d))}),b?.allowed&&(0,c.jsx)(aD,{name:a,who:b.allowed.name,stopped:!!p})]})]})}function au({status:a,tokensIn:b,tokens:d}){let e="text-xs";return b<d?(0,c.jsx)("span",{className:(0,ak.cn)(e,"text-muted-foreground"),children:b?`${b} of ${d} tokens in`:"Not set"}):a?.refused?(0,c.jsxs)("span",{className:(0,ak.cn)(e,"text-destructive"),children:["Stopped — ",an.REACH_LABEL[a.name]," turned the token away"]}):a?.problem?(0,c.jsx)(ag.ShinyText,{text:`${a.bot?"Reconnecting":"Connecting"}… ${a.problem}`,className:(0,ak.cn)(e,"align-middle")}):a?.allowed?(0,c.jsxs)("span",{className:(0,ak.cn)(e,"text-muted-foreground"),children:["Listening as ",a.bot,". ",a.allowed.name," is let in."]}):a?.bot?(0,c.jsx)(ag.ShinyText,{text:`Listening as ${a.bot} — waiting for your first message`,tone:"waiting",className:(0,ak.cn)(e,"align-middle")}):(0,c.jsx)(ag.ShinyText,{text:"Connecting…",className:(0,ak.cn)(e,"align-middle")})}function av({n:a,step:b,state:d,set:e,refused:f,link:g,waiting:h}){return(0,c.jsxs)("li",{className:"flex gap-3 text-[13px] leading-relaxed",children:[(0,c.jsx)(aw,{n:a,state:d}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-2.5",children:[(0,c.jsx)("p",{className:(0,ak.cn)("done"===d||"later"===d?"text-muted-foreground/60 **:text-inherit":"text-muted-foreground"),children:b.body}),(0,c.jsx)(ax,{slot:b.slot,state:d,set:e,refused:f,link:g,waiting:h})]})]})}function aw({n:a,state:b}){return"done"===b?(0,c.jsx)("span",{className:"mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-foreground text-background",children:(0,c.jsx)(h.Check,{className:"size-3"})}):(0,c.jsx)("span",{className:(0,ak.cn)("mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-background font-mono text-[10.5px] ring-1","now"===b?(0,ak.cn)(ak.WAITING_INK,"ring-waiting/40"):"text-muted-foreground ring-border/60","later"===b&&"opacity-60"),children:a})}function ax({slot:a,state:b,set:d,refused:e,link:f,waiting:g}){let h=g&&(0,c.jsx)(ag.ShinyText,{text:"Waiting for your first message…",tone:"waiting"});return"later"===b?null:a&&"key"in a?(0,c.jsx)(aB,{configKey:a.key,looks:a.looks,set:d,refused:e}):"done"===b?a&&"says"in a&&f?(0,c.jsx)(aA,{href:f,children:a.does??az(f)}):null:a?"open"in a?(0,c.jsx)(aA,{href:a.open,children:a.label}):"manifest"in a?(0,c.jsx)(aC,{}):f?(0,c.jsxs)("div",{className:"space-y-2.5",children:[(0,c.jsx)(ay,{link:f,says:a.says,does:a.does}),h]}):h||null:h||null}function ay({link:a,says:b,does:d}){let{size:e,data:f}=function(a){let{ecc:b="L",boostEcc:c=!1,minVersion:d=1,maxVersion:e=40,maskPattern:f=-1,border:g=1}={},h="string"==typeof a?function(a){var b,c;if(""===a)return[];if(b=a,Q.test(b))return[function(a){var b;if(b=a,!Q.test(b))throw RangeError("String contains non-numeric characters");let c=[];for(let b=0;b<a.length;){let d=Math.min(a.length-b,3);W(Number.parseInt(a.substring(b,b+d),10),3*d+1,c),b+=d}return new Y(Z,a.length,c)}(a)];return(c=a,R.test(c))?[function(a){var b;let c;if(b=a,!R.test(b))throw RangeError("String contains unencodable characters in alphanumeric mode");let d=[];for(c=0;c+2<=a.length;c+=2){let b=45*S.indexOf(a.charAt(c));W(b+=S.indexOf(a.charAt(c+1)),11,d)}return c<a.length&&W(S.indexOf(a.charAt(c)),6,d),new Y($,a.length,d)}(a)]:[ab(function(a){a=encodeURI(a);let b=[];for(let c=0;c<a.length;c++)"%"!==a.charAt(c)?b.push(a.charCodeAt(c)):(b.push(Number.parseInt(a.substring(c+1,c+3),16)),c+=2);return b}(a))]}(a):Array.isArray(a)?[ab(a)]:void 0;if(!h)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof a}`);let i=function(a,b,c=1,d=40,e=-1,f=!0){let g,h;if(!(1<=c&&c<=d&&d<=40)||e<-1||e>7)throw RangeError("Invalid value");for(g=c;;g++){let c=8*ad(g,b),e=function(a,b){let c=0;for(let d of a){let a=aa(d.mode,b);if(d.numChars>=1<<a)return 1/0;c+=4+a+d.bitData.length}return c}(a,g);if(e<=c){h=e;break}if(g>=d)throw RangeError("Data too long")}for(let a of[M,N,O])f&&h<=8*ad(g,a)&&(b=a);let i=[];for(let b of a)for(let a of(W(b.mode[0],4,i),W(b.numChars,aa(b.mode,g),i),b.getData()))i.push(a);let j=8*ad(g,b);W(0,Math.min(4,j-i.length),i),W(0,(8-i.length%8)%8,i);for(let a=236;i.length<j;a^=253)W(a,8,i);let k=Array.from({length:Math.ceil(i.length/8)},()=>0);return i.forEach((a,b)=>k[b>>>3]|=a<<7-(7&b)),new V(g,b,k,e)}(h,P[b],d,e,f,c);return function(a,b=1){if(!b)return a;let{size:c}=a,d=c+2*b;a.size=d,a.data.forEach(a=>{for(let c=0;c<b;c++)a.unshift(!1),a.push(!1)});for(let c=0;c<b;c++)a.data.unshift(Array.from({length:d},a=>!1)),a.data.push(Array.from({length:d},a=>!1));let e=L.Border;a.types.forEach(a=>{for(let c=0;c<b;c++)a.unshift(e),a.push(e)});for(let c=0;c<b;c++)a.types.unshift(Array.from({length:d},a=>e)),a.types.push(Array.from({length:d},a=>e));return a}({version:i.version,maskPattern:i.mask,size:i.size,data:i.modules,types:i.types},g)}(a),g=az(a);return(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,c.jsx)("div",{className:"rounded-lg bg-white p-2.5",children:(0,c.jsx)("svg",{viewBox:`0 0 ${e} ${e}`,className:"block size-31 text-black",role:"img","aria-label":`A picture of ${g} for a phone camera`,children:f.flatMap((a,b)=>a.map((a,d)=>a?(0,c.jsx)("rect",{x:d,y:b,width:1,height:1,fill:"currentColor"},`${d}-${b}`):null))})}),(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)("p",{className:"text-muted-foreground",children:b}),(0,c.jsx)(aA,{href:a,children:d??g})]})]})}let az=a=>a.replace(/^https:\/\//,"");function aA({href:a,children:b}){return(0,c.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:(0,ak.cn)((0,t.buttonVariants)({variant:"outline",size:"sm"})),children:[(0,c.jsx)(K.ExternalLink,{}),b]})}function aB({configKey:a,looks:b,set:d,refused:e}){let[f,g]=(0,r.useState)(""),[h,i]=(0,r.useState)(!1),j=()=>{g(""),i(!1),(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.reach)},[k,l]=(0,ai.useServerAction)(H.setConfigAction,{onOk:j}),[m,n]=(0,ai.useServerAction)(G.removeConfigAction,{onOk:j}),o=async()=>{await v.notify.confirm({title:"Remove this token?",description:"That service stops, and whoever is let in is let go.",okText:"Remove",destructive:!0})&&m(a)};return d&&!h&&null===e?(0,c.jsx)(t.Button,{size:"xs",variant:"ghost",onClick:()=>i(!0),className:"-ml-2 text-muted-foreground",children:"Change the token"}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:b=>{b.preventDefault(),k(a,f)},children:[(0,c.jsx)(u.Input,{value:f,onChange:a=>g(a.target.value),placeholder:b,"aria-label":"Token",type:"password",autoComplete:"off",spellCheck:!1,className:"w-72 font-mono"}),(0,c.jsx)(t.Button,{type:"submit",size:"sm",loading:l,disabled:f.trim().length<z.KEY_MIN,children:d?"Replace":"Save"}),d&&(0,c.jsxs)(c.Fragment,{children:[null===e&&(0,c.jsx)(t.Button,{size:"sm",variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),(0,c.jsx)(t.Button,{size:"sm",variant:"ghost",loading:n,onClick:()=>void o(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]}),e&&(0,c.jsx)("p",{className:"max-w-xl text-destructive",children:e})]})}function aC(){let[a,b]=(0,r.useState)(!1);return(0,c.jsxs)(t.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(ap).then(()=>{b(!0),setTimeout(()=>b(!1),2e3)}),children:[a?(0,c.jsx)(h.Check,{}):(0,c.jsx)(J.Copy,{}),a?"Copied":"Copy the manifest"]})}function aD({name:a,who:b,stopped:d}){let[e,f]=(0,ai.useServerAction)(am,{onOk:()=>(0,aj.revalidate)(s.queryKey.reach)});return(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-3 pl-8 text-[13px] text-muted-foreground",children:[(0,c.jsx)("span",{children:d?`${b} is let in.`:`${b} can write from a phone.`}),(0,c.jsx)(t.Button,{size:"sm",variant:"outline",loading:f,onClick:async()=>{await v.notify.confirm({title:`Let ${b} go?`,description:"Nobody can write to Thursday through this service until someone is let in again.",okText:"Let them go",destructive:!0})&&e(a)},children:"Let them go"})]})}let aE={[I.EXA_API_KEY]:p.Search},aF={image:n.Image,video:l,speech:f.AudioLines,transcription:g.Captions},aG={keys:["voice","easy","text","search"],models:["bots","studio"]};function aH({screen:a}){let{data:b,isLoading:d,error:e}=(0,aj.useServerRoute)(s.queryKey.config);if(d)return(0,c.jsx)(ah.SettingSkeleton,{rows:4});if(e)return(0,c.jsx)(ah.SettingError,{message:e.message});let f=a=>(0,I.isConfigSet)(b,a),g=a=>b?.find(b=>b.key===a)?.value,h=aG[a].flatMap(a=>I.CONFIG_GROUPS.find(b=>b.id===a)??[]),i=h.filter(a=>"keys"===a.section).flatMap(a=>a.entries);return(0,c.jsx)(ah.SettingScreen,{footer:(0,c.jsx)(ah.SettingRailNote,{children:"models"===a?"Her own voice and backend models are in Thursday. A bot can pick its own on its page.":`${i.filter(a=>f(a.key)).length} of ${i.length} set${h.some(a=>!(0,I.groupSatisfied)(a,f))?" · a call needs one voice key":" · your keys stay on this machine"}`}),children:h.map(a=>(0,c.jsx)(ah.SettingGroup,{label:a.title,hint:a.hint,right:(0,c.jsx)(aJ,{group:a,isSet:f}),children:"easy"===a.id?(0,c.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:a.entries.map(a=>(0,c.jsx)(aK,{card:!0,entry:a,set:f(a.key),needed:!1},a.key))}):"text"===a.id?(0,c.jsx)("div",{className:"flex flex-wrap gap-x-1.5 gap-y-3.5",children:a.entries.map(a=>(0,c.jsx)(aI,{entry:a,set:f(a.key)},a.key))}):(0,c.jsx)(ah.SettingItems,{children:a.entries.map(b=>b.effortOf?null:b.choices?(0,c.jsx)(aT,{entry:b,choices:b.choices,value:g(b.key),effort:aU(a,b.key),effortValue:g(I.DEFAULT_EFFORT_KEY)},b.key):(0,c.jsx)(aK,{entry:b,set:f(b.key),needed:!(0,I.groupSatisfied)(a,f)},b.key))})},a.id))})}function aI({entry:a,set:b}){return(0,c.jsxs)("button",{type:"button",onClick:()=>aW(a,b),"aria-label":`${a.label}: ${b?"set":"not set"}`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsxs)("span",{className:"relative grid size-10.5 place-items-center rounded-[13px] bg-muted/60 transition-colors group-hover:bg-muted",children:[(0,c.jsx)(aS,{entry:a}),b&&(0,c.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-primary text-primary-foreground ring-2 ring-background",children:(0,c.jsx)(h.Check,{className:"size-2.5"})})]}),(0,c.jsx)("span",{className:(0,ak.cn)("max-w-full truncate text-[11px]",b?"text-foreground":"text-muted-foreground"),children:a.label})]})}function aJ({group:a,isSet:b}){return"none"===a.require?null:(0,I.groupSatisfied)(a,b)?(0,c.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,c.jsx)(h.Check,{className:"size-3"}),"ready"]}):(0,c.jsxs)("span",{className:(0,ak.cn)("flex items-center gap-1 font-mono text-[11px]",ak.WAITING_INK),children:[(0,c.jsx)(q.TriangleAlert,{className:"size-3"}),a.note??"Required"]})}function aK({entry:a,set:b,needed:d,card:e=!1,narrow:f=!1}){let g=aN(a,b),j=aP(a,b),k=aO(a,b),l=j.data?aQ(j.data):aM(b,d,g.data,a.signIn),m=g.isLoading||j.isLoading,n=(0,c.jsxs)("span",{className:(0,ak.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",l.ink),children:[l.warn?(0,c.jsx)(q.TriangleAlert,{className:"size-3"}):b&&(0,c.jsx)(h.Check,{className:"size-3"}),l.text]});return(0,c.jsxs)("button",{type:"button",onClick:()=>{var d;return a.signIn?(d=a,v.notify.component({className:"sm:max-w-md",renderer:({close:a})=>(0,c.jsx)(aV,{entry:d,onDone:a})})):aW(a,b)},className:(0,ak.cn)("group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",e&&"rounded-xl border border-border/60"),children:[(0,c.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,c.jsx)(aS,{entry:a})}),(0,c.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,c.jsxs)("span",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[a.label,a.recommended&&(0,c.jsx)("span",{className:"rounded-full px-1.5 font-mono text-[9.5px] leading-4 font-normal text-muted-foreground ring-1 ring-border ring-inset",children:"recommended"})]}),f?m?(0,c.jsx)(y.Skeleton,{className:"h-3 w-20"}):n:(0,c.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:a.signIn?b?aR(j.data,k):"sign in with your account":a.key})]}),f?null:m?(0,c.jsx)(y.Skeleton,{className:"h-3 w-20 shrink-0"}):n,(0,c.jsx)(i.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let aL=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function aM(a,b,c,d){return a?c?"refused"in c?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${aL.format(c.balance)} left`,ink:c.low?ak.WAITING_INK:"text-muted-foreground",warn:c.low}:{text:d?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:b?{text:"Needed",ink:ak.WAITING_INK,warn:!0}:{text:d?"Signed out":"Not set",ink:"text-muted-foreground/60",warn:!1}}function aN(a,b){return(0,aj.useServerRoute)(b&&"vercel-ai-gateway"===a.provider?s.queryKey.gatewayCredits:null)}function aO(a,b){let{data:c}=(0,aj.useServerRoute)(b&&a.signIn?s.queryKey.llmModel:null);return c?.find(b=>b.id===a.provider)?.plan??null}function aP(a,b){return(0,aj.useServerRoute)(b&&a.signIn?s.queryKey.subscriptionUsage:null)}function aQ(a){return"refused"in a?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:a.spent?"Limit reached":`${a.usedPercent}% used`,ink:a.high?ak.WAITING_INK:"text-muted-foreground",warn:a.high}}function aR(a,b){let c=!a||"refused"in a?null:a,e=`${c?.plan??b??"unknown"} plan`;return c?.resetsAt?`${e} \xb7 resets in ${(0,d.formatDistanceToNowStrict)(new Date(c.resetsAt))}`:e}function aS({entry:a}){if(a.provider)return(0,c.jsx)(D.ProviderIcon,{provider:a.provider,className:"size-4"});let b=aE[a.key]??o.KeyRound,d=(0,c.jsx)(b,{className:"size-4 text-muted-foreground"});return a.site?(0,c.jsx)(x.SiteIcon,{host:a.site,className:"size-4 rounded-[4px]",fallback:d}):d}function aT({entry:a,choices:b,value:d,effort:e,effortValue:f}){let g=a.text?(0,E.parseTextModel)(d):(0,E.parseMediaModel)(d),{data:h}=(0,aj.useServerRoute)(a.text&&!d&&s.queryKey.automaticModel),i=a.kind?aF[a.kind]:F.BotsMark,[j]=(0,ai.useServerAction)(H.setConfigAction,{onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.automaticModel)}}),[k]=(0,ai.useServerAction)(G.removeConfigAction,{onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.automaticModel)}});return(0,c.jsxs)("div",{className:"flex w-full items-start gap-3 p-4",children:[(0,c.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,c.jsx)(i,{className:"size-4 text-muted-foreground"})}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,c.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 pt-1.5",children:[(0,c.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),!d&&(0,c.jsx)("span",{className:(0,ak.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",a.kind?ak.WAITING_INK:"text-muted-foreground"),children:a.kind?"off":"auto"})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsx)("div",{className:"min-w-0",children:(0,c.jsx)(C.ModelPicker,{kind:a.kind,provider:g?.provider??null,model:g?.model??"",unset:a.kind?"Not offered to bots until you pick one":function(a,b){if(!a)return"Automatic";if(!a.ref)return a.problem;let{provider:c,model:d}=a.ref,e=b.find(a=>a.value===`${c}/${d}`);return`Automatic \xb7 ${e?.label??d}`}(h,b),onChange:b=>j(a.key,`${b.provider}/${b.model.trim()}`),onUnset:d?()=>{k(a.key),e&&f&&k(e.key)}:void 0})}),e&&g&&(0,c.jsxs)("div",{className:"flex items-start gap-3 pt-0.5",children:[(0,c.jsx)("span",{className:"w-12 shrink-0 pt-1.5 font-mono text-[11px] text-muted-foreground",children:"effort"}),(0,c.jsx)(B.EffortSwitch,{provider:g.provider,model:g.model,value:E.effortSchema.safeParse(f).data??null,onChange:a=>a?j(e.key,a):k(e.key)})]})]})]})]})}let aU=(a,b)=>a.entries.find(a=>a.effortOf===b);function aV({entry:a,onDone:b}){let{data:d}=(0,aj.useServerRoute)(s.queryKey.config),e=(0,I.isConfigSet)(d,a.key),f=aO(a,e),g=aP(a,e),h=g.data?aQ(g.data):null,[i,j]=(0,ai.useServerAction)(G.removeConfigAction,{okMessage:`Signed out of ${a.label}`,onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.llmModel),b()}});return(0,c.jsx)(ah.SettingDialogContent,{title:a.label,description:e?(0,c.jsxs)(c.Fragment,{children:["Signed in ·"," ",(0,c.jsx)("span",{className:"font-mono",children:aR(g.data,f)}),h&&(0,c.jsxs)(c.Fragment,{children:[" · ",(0,c.jsx)("span",{className:(0,ak.cn)("font-mono",h.ink),children:h.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,c.jsxs)(c.Fragment,{children:[e&&(0,c.jsx)(t.Button,{variant:"ghost",loading:j,onClick:async()=>{await v.notify.confirm({title:`Sign out of ${a.label}?`,description:"Nothing runs on your plan until you sign in again.",okText:"Sign out",destructive:!0})&&i(a.key)},children:"Sign out"}),(0,c.jsx)(t.Button,{variant:"ghost",onClick:b,children:e?"Close":"Cancel"}),!e&&(0,c.jsx)(A.ChatGptSignIn,{})]}),children:(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(ah.SettingNote,{children:e?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),g.data&&"refused"in g.data&&(0,c.jsx)(ah.SettingNote,{className:"wrap-break-word text-destructive",children:g.data.refused})]})})}function aW(a,b){return v.notify.component({className:"sm:max-w-md",renderer:({close:d})=>(0,c.jsx)(aX,{entry:a,set:b,onDone:d})})}function aX({entry:a,set:b,onDone:d}){let[f,g]=(0,r.useState)(""),{data:h}=aN(a,b),i=h?aM(b,!1,h):null,j=()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.llmModel)},[k,l]=(0,ai.useServerAction)(H.setConfigAction,{okMessage:`${a.label} key saved`,onOk:()=>{j(),d()}}),[m,n]=(0,ai.useServerAction)(G.removeConfigAction,{okMessage:`${a.label} key removed`,onOk:()=>{j(),d()}}),o=async()=>{await v.notify.confirm({title:`Remove the ${a.label} key?`,description:"It is deleted from this computer, and nothing runs on it until a key is pasted again.",okText:"Remove",destructive:!0})&&m(a.key)};return(0,c.jsx)(ah.SettingDialogContent,{title:a.label,description:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"font-mono",children:a.key}),a.hint&&(0,c.jsxs)(c.Fragment,{children:[" · ",a.hint]}),i&&(0,c.jsxs)(c.Fragment,{children:[" · ",(0,c.jsx)("span",{className:(0,ak.cn)("font-mono",i.ink),children:i.text})]})]}),footer:(0,c.jsxs)(c.Fragment,{children:[b&&(0,c.jsx)(t.Button,{variant:"ghost",loading:n,onClick:()=>void o(),className:"mr-auto text-destructive hover:text-destructive",children:"Remove"}),(0,c.jsx)(t.Button,{variant:"ghost",onClick:d,children:"Cancel"}),(0,c.jsx)(t.Button,{loading:l,disabled:f.trim().length<z.KEY_MIN,onClick:()=>k(a.key,f),children:b?"Replace":"Save"})]}),children:(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(u.Input,{value:f,onChange:a=>g(a.target.value),onKeyDown:b=>{"Enter"===b.key&&f.trim().length>=z.KEY_MIN&&k(a.key,f)},placeholder:b?"New value — replaces the current key":a.keyLooks??"Paste the key",spellCheck:!1,type:"password",autoFocus:!0}),!b&&a.keysAt&&(0,c.jsxs)("a",{href:a.keysAt,target:"_blank",rel:"noreferrer",className:"flex w-fit items-center gap-1 px-0.5 text-[13px] text-foreground underline underline-offset-3 hover:text-foreground/80",children:["Get a key at ",new URL(a.keysAt).host,(0,c.jsx)(e.ArrowUpRight,{className:"size-3.5"})]}),h&&"refused"in h&&(0,c.jsx)(ah.SettingNote,{className:"wrap-break-word text-destructive",children:h.refused})]})})}a.s(["AccountsSetup",0,function({withoutVoice:a=!1}){let{data:b}=(0,aj.useServerRoute)(s.queryKey.config),d=a=>(0,I.isConfigSet)(b,a),e=a=>I.CONFIG_GROUPS.find(b=>b.id===a)?.entries??[],[f,g]=(0,r.useState)(!1),h=e("voice"),i=[...h,...e("text")],j=i.filter((b,c)=>(c<4||d(b.key))&&!(a&&h.includes(b))),k=i.filter(b=>!j.includes(b)&&!(a&&h.includes(b)));return(0,c.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,c.jsx)("div",{className:"flex flex-col gap-2",children:e("easy").map(a=>(0,c.jsx)(aK,{card:!0,narrow:!0,entry:a,set:d(a.key),needed:!1},a.key))}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-y-2.5",children:[j.map(a=>(0,c.jsx)(aI,{entry:a,set:d(a.key)},a.key)),k.length>0&&(0,c.jsxs)(w.Popover,{open:f,onOpenChange:g,children:[(0,c.jsxs)(w.PopoverTrigger,{"aria-label":`${k.length} more providers`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsx)("span",{className:"grid size-10.5 place-items-center rounded-[13px] bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,c.jsx)(m.default,{className:"size-4"})}),(0,c.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"More"})]}),(0,c.jsx)(w.PopoverContent,{align:"end",className:"w-78 flex-row flex-wrap gap-0 gap-y-2.5 rounded-2xl p-2.5",onClick:()=>g(!1),children:k.map(a=>(0,c.jsx)(aI,{entry:a,set:d(a.key)},a.key))})]})]}),e("search").map(a=>(0,c.jsx)(aK,{card:!0,narrow:!0,entry:a,set:d(a.key),needed:!1},a.key))]})},"KeysSetting",0,()=>(0,c.jsx)(aH,{screen:"keys"}),"ModelsSetting",0,()=>(0,c.jsx)(aH,{screen:"models"}),"PhoneSetting",0,()=>(0,c.jsx)(ah.SettingScreen,{footer:(0,c.jsx)(ah.SettingRailNote,{children:"Nothing on this computer is opened to the internet: the app asks the chat service what was written."}),children:(0,c.jsx)(as,{})})],405593)},140232,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7f9f5cbd4d689ed4d45ffcafb4479363132599b1c5",b.callServer,void 0,b.findSourceMapURL,"removeConfigAction");a.s(["removeConfigAction",0,c])}];
18
+ `,aq=({children:a})=>(0,c.jsx)("span",{className:"font-medium text-foreground",children:a}),ar={telegram:[{body:(0,c.jsxs)(c.Fragment,{children:["In Telegram, write to ",(0,c.jsx)(aq,{children:"@BotFather"}),", send ",(0,c.jsx)(aq,{children:"/newbot"})," and pick a name. It answers with a ",(0,c.jsx)(aq,{children:"token"}),"."]}),slot:{open:"https://t.me/BotFather",label:"Open @BotFather"}},{body:(0,c.jsx)(c.Fragment,{children:"Paste the token here."}),slot:{key:an.TELEGRAM_TOKEN_KEY,looks:"123456789:AAE…"}},{body:(0,c.jsx)(c.Fragment,{children:"From your phone, write anything to your bot."}),slot:{says:"Point your phone's camera at it to open the chat."}},{body:(0,c.jsxs)(c.Fragment,{children:["A question with a code appears on this computer. Press ",(0,c.jsx)(aq,{children:"Allow"})," if your phone shows the same code."]})}],discord:[{body:(0,c.jsxs)(c.Fragment,{children:["At ",(0,c.jsx)(aq,{children:"discord.com/developers"}),", make a ",(0,c.jsx)(aq,{children:"New Application"}),". So nobody else can add it to a server, set ",(0,c.jsx)(aq,{children:"Install Link"})," to"," ",(0,c.jsx)(aq,{children:"None"})," on its ",(0,c.jsx)(aq,{children:"Installation"})," page and turn off"," ",(0,c.jsx)(aq,{children:"Public Bot"})," on its ",(0,c.jsx)(aq,{children:"Bot"})," page. There, press"," ",(0,c.jsx)(aq,{children:"Reset Token"})," and copy it."]}),slot:{open:"https://discord.com/developers/applications",label:"Open discord.com/developers"}},{body:(0,c.jsx)(c.Fragment,{children:"Paste the token here."}),slot:{key:an.DISCORD_TOKEN_KEY,looks:"MTE…"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Add the bot to a server of your own"})," — Discord only delivers a message to a bot you share a server with. A private server made for this is fine."]}),slot:{says:"Point your phone's camera at it, or open it here. It asks which server, and adds the bot with no permissions in it.",does:"Add the bot to a server"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Send the bot a direct message"}),", not in the server: on a phone, tap the bot in the server's member list, then ",(0,c.jsx)(aq,{children:"Message"}),". A question with a code appears here: press ",(0,c.jsx)(aq,{children:"Allow"})," if your phone shows the same code."]})}],slack:[{body:(0,c.jsxs)(c.Fragment,{children:["At ",(0,c.jsx)(({href:a,children:b})=>(0,c.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",className:"font-medium text-foreground underline underline-offset-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:b}),{href:"https://api.slack.com/apps",children:"api.slack.com/apps"}),","," ",(0,c.jsx)(aq,{children:"Create New App › From a manifest"}),", and paste the manifest."]}),slot:{manifest:!0}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Basic Information › App-Level Tokens"}),": generate one with"," ",(0,c.jsx)(aq,{children:"connections:write"}),". It starts with xapp-."]}),slot:{key:an.SLACK_APP_TOKEN_KEY,looks:"xapp-…"}},{body:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(aq,{children:"Install App"})," to your workspace. The Bot User OAuth Token starts with xoxb-."]}),slot:{key:an.SLACK_BOT_TOKEN_KEY,looks:"xoxb-…"}},{body:(0,c.jsxs)(c.Fragment,{children:["In Slack, open the app under ",(0,c.jsx)(aq,{children:"Apps"})," and write in its"," ",(0,c.jsx)(aq,{children:"Messages"})," tab. A question with a code appears here: press"," ",(0,c.jsx)(aq,{children:"Allow"})," if Slack shows the same code."]})}]};function as(){let a=(0,aj.useServerRoute)(s.queryKey.config),b=(0,aj.useServerRoute)(s.queryKey.reach);(0,af.useAppEvent)({reach:()=>void(0,aj.revalidate)(s.queryKey.reach)});let d=b=>(0,I.isConfigSet)(a.data,b),e=a=>b.data?.channels.find(b=>b.name===a)??null,f=a=>!!e(a)?.allowed,g=an.REACH_CHANNELS.find(a=>e(a)?.refused),h=an.REACH_CHANNELS.find(a=>an.REACH_KEYS[a].every(d)&&!f(a)),i=!an.REACH_CHANNELS.some(f),[j,k]=(0,r.useState)(g??h??(i?an.REACH_CHANNELS[0]:null));return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(ah.SettingItems,{children:an.REACH_CHANNELS.map(a=>(0,c.jsx)(at,{name:a,status:e(a),tokensIn:an.REACH_KEYS[a].filter(d).length,isSet:d,open:j===a,onOpen:()=>k(j===a?null:a)},a))}),(0,c.jsx)(ah.SettingNote,{children:"Only the one person you allow can write, and only direct messages are read. Work started here runs whether or not a tab is open, while Thursday is running on this computer."})]})}function at({name:a,status:b,tokensIn:d,isSet:e,open:f,onOpen:g}){var h;let j,k,l,m,n=ar[a],p=b?.refused??null,q=(h={connected:!!b?.bot,allowed:!!b?.allowed,refused:p},j=n.map(a=>a.slot&&"key"in a.slot?a.slot.key:null),k=a=>!e(a)||a===h.refused,l=j.findIndex(a=>a&&k(a)),m=j.reduce((a,b,c)=>b?c:a,-1),n.map((a,b)=>{let c=j[b];return c?k(c)?b===l?"now":"later":"done":l>=0?b<l?h.refused?"done":"flat":"later":h.allowed||b<m?"done":h.connected?"now":"flat"})),r=!!b?.bot&&!b?.allowed&&!p;return(0,c.jsxs)("div",{children:[(0,c.jsxs)("button",{type:"button",onClick:g,"aria-expanded":f,className:"flex w-full items-center gap-3 px-4 py-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsx)(x.SiteIcon,{host:ao[a],className:"size-4 rounded-[4px]",fallback:(0,c.jsx)(o.KeyRound,{className:"size-4 text-muted-foreground"})}),(0,c.jsx)("span",{className:"text-sm font-medium",children:an.REACH_LABEL[a]}),(0,c.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,c.jsx)(au,{status:b,tokensIn:d,tokens:an.REACH_KEYS[a].length})}),(0,c.jsx)(i.ChevronRight,{className:(0,ak.cn)("size-4 shrink-0 text-muted-foreground transition-transform",f&&"rotate-90")})]}),f&&(0,c.jsxs)("div",{className:"px-4 pt-1 pb-4",children:[(0,c.jsx)("ol",{className:"space-y-3",children:n.map((a,d)=>(0,c.jsx)(av,{n:d+1,step:a,state:q[d],set:!!a.slot&&"key"in a.slot&&e(a.slot.key),refused:a.slot&&"key"in a.slot&&a.slot.key===p?b?.problem??"":null,link:b?.link??null,waiting:r&&d===n.length-1},d))}),b?.allowed&&(0,c.jsx)(aD,{name:a,who:b.allowed.name,stopped:!!p})]})]})}function au({status:a,tokensIn:b,tokens:d}){let e="text-xs";return b<d?(0,c.jsx)("span",{className:(0,ak.cn)(e,"text-muted-foreground"),children:b?`${b} of ${d} tokens in`:"Not set"}):a?.refused?(0,c.jsxs)("span",{className:(0,ak.cn)(e,"text-destructive"),children:["Stopped — ",an.REACH_LABEL[a.name]," turned the token away"]}):a?.problem?(0,c.jsx)(ag.ShinyText,{text:`${a.bot?"Reconnecting":"Connecting"}… ${a.problem}`,className:(0,ak.cn)(e,"align-middle")}):a?.allowed?(0,c.jsxs)("span",{className:(0,ak.cn)(e,"text-muted-foreground"),children:["Listening as ",a.bot,". ",a.allowed.name," is let in."]}):a?.bot?(0,c.jsx)(ag.ShinyText,{text:`Listening as ${a.bot} — waiting for your first message`,tone:"waiting",className:(0,ak.cn)(e,"align-middle")}):(0,c.jsx)(ag.ShinyText,{text:"Connecting…",className:(0,ak.cn)(e,"align-middle")})}function av({n:a,step:b,state:d,set:e,refused:f,link:g,waiting:h}){return(0,c.jsxs)("li",{className:"flex gap-3 text-[13px] leading-relaxed",children:[(0,c.jsx)(aw,{n:a,state:d}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-2.5",children:[(0,c.jsx)("p",{className:(0,ak.cn)("done"===d||"later"===d?"text-muted-foreground/60 **:text-inherit":"text-muted-foreground"),children:b.body}),(0,c.jsx)(ax,{slot:b.slot,state:d,set:e,refused:f,link:g,waiting:h})]})]})}function aw({n:a,state:b}){return"done"===b?(0,c.jsx)("span",{className:"mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-foreground text-background",children:(0,c.jsx)(h.Check,{className:"size-3"})}):(0,c.jsx)("span",{className:(0,ak.cn)("mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-background font-mono text-[10.5px] ring-1","now"===b?(0,ak.cn)(ak.WAITING_INK,"ring-waiting/40"):"text-muted-foreground ring-border/60","later"===b&&"opacity-60"),children:a})}function ax({slot:a,state:b,set:d,refused:e,link:f,waiting:g}){let h=g&&(0,c.jsx)(ag.ShinyText,{text:"Waiting for your first message…",tone:"waiting"});return"later"===b?null:a&&"key"in a?(0,c.jsx)(aB,{configKey:a.key,looks:a.looks,set:d,refused:e}):"done"===b?a&&"says"in a&&f?(0,c.jsx)(aA,{href:f,children:a.does??az(f)}):null:a?"open"in a?(0,c.jsx)(aA,{href:a.open,children:a.label}):"manifest"in a?(0,c.jsx)(aC,{}):f?(0,c.jsxs)("div",{className:"space-y-2.5",children:[(0,c.jsx)(ay,{link:f,says:a.says,does:a.does}),h]}):h||null:h||null}function ay({link:a,says:b,does:d}){let{size:e,data:f}=function(a){let{ecc:b="L",boostEcc:c=!1,minVersion:d=1,maxVersion:e=40,maskPattern:f=-1,border:g=1}={},h="string"==typeof a?function(a){var b,c;if(""===a)return[];if(b=a,Q.test(b))return[function(a){var b;if(b=a,!Q.test(b))throw RangeError("String contains non-numeric characters");let c=[];for(let b=0;b<a.length;){let d=Math.min(a.length-b,3);W(Number.parseInt(a.substring(b,b+d),10),3*d+1,c),b+=d}return new Y(Z,a.length,c)}(a)];return(c=a,R.test(c))?[function(a){var b;let c;if(b=a,!R.test(b))throw RangeError("String contains unencodable characters in alphanumeric mode");let d=[];for(c=0;c+2<=a.length;c+=2){let b=45*S.indexOf(a.charAt(c));W(b+=S.indexOf(a.charAt(c+1)),11,d)}return c<a.length&&W(S.indexOf(a.charAt(c)),6,d),new Y($,a.length,d)}(a)]:[ab(function(a){a=encodeURI(a);let b=[];for(let c=0;c<a.length;c++)"%"!==a.charAt(c)?b.push(a.charCodeAt(c)):(b.push(Number.parseInt(a.substring(c+1,c+3),16)),c+=2);return b}(a))]}(a):Array.isArray(a)?[ab(a)]:void 0;if(!h)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof a}`);let i=function(a,b,c=1,d=40,e=-1,f=!0){let g,h;if(!(1<=c&&c<=d&&d<=40)||e<-1||e>7)throw RangeError("Invalid value");for(g=c;;g++){let c=8*ad(g,b),e=function(a,b){let c=0;for(let d of a){let a=aa(d.mode,b);if(d.numChars>=1<<a)return 1/0;c+=4+a+d.bitData.length}return c}(a,g);if(e<=c){h=e;break}if(g>=d)throw RangeError("Data too long")}for(let a of[M,N,O])f&&h<=8*ad(g,a)&&(b=a);let i=[];for(let b of a)for(let a of(W(b.mode[0],4,i),W(b.numChars,aa(b.mode,g),i),b.getData()))i.push(a);let j=8*ad(g,b);W(0,Math.min(4,j-i.length),i),W(0,(8-i.length%8)%8,i);for(let a=236;i.length<j;a^=253)W(a,8,i);let k=Array.from({length:Math.ceil(i.length/8)},()=>0);return i.forEach((a,b)=>k[b>>>3]|=a<<7-(7&b)),new V(g,b,k,e)}(h,P[b],d,e,f,c);return function(a,b=1){if(!b)return a;let{size:c}=a,d=c+2*b;a.size=d,a.data.forEach(a=>{for(let c=0;c<b;c++)a.unshift(!1),a.push(!1)});for(let c=0;c<b;c++)a.data.unshift(Array.from({length:d},a=>!1)),a.data.push(Array.from({length:d},a=>!1));let e=L.Border;a.types.forEach(a=>{for(let c=0;c<b;c++)a.unshift(e),a.push(e)});for(let c=0;c<b;c++)a.types.unshift(Array.from({length:d},a=>e)),a.types.push(Array.from({length:d},a=>e));return a}({version:i.version,maskPattern:i.mask,size:i.size,data:i.modules,types:i.types},g)}(a),g=az(a);return(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,c.jsx)("div",{className:"rounded-lg bg-white p-2.5",children:(0,c.jsx)("svg",{viewBox:`0 0 ${e} ${e}`,className:"block size-31 text-black",role:"img","aria-label":`A picture of ${g} for a phone camera`,children:f.flatMap((a,b)=>a.map((a,d)=>a?(0,c.jsx)("rect",{x:d,y:b,width:1,height:1,fill:"currentColor"},`${d}-${b}`):null))})}),(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)("p",{className:"text-muted-foreground",children:b}),(0,c.jsx)(aA,{href:a,children:d??g})]})]})}let az=a=>a.replace(/^https:\/\//,"");function aA({href:a,children:b}){return(0,c.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:(0,ak.cn)((0,t.buttonVariants)({variant:"outline",size:"sm"})),children:[(0,c.jsx)(K.ExternalLink,{}),b]})}function aB({configKey:a,looks:b,set:d,refused:e}){let[f,g]=(0,r.useState)(""),[h,i]=(0,r.useState)(!1),j=()=>{g(""),i(!1),(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.reach)},[k,l]=(0,ai.useServerAction)(H.setConfigAction,{onOk:j}),[m,n]=(0,ai.useServerAction)(G.removeConfigAction,{onOk:j}),o=async()=>{await v.notify.confirm({title:"Remove this token?",description:"That service stops, and whoever is let in is let go.",okText:"Remove",destructive:!0})&&m(a)};return d&&!h&&null===e?(0,c.jsx)(t.Button,{size:"xs",variant:"ghost",onClick:()=>i(!0),className:"-ml-2 text-muted-foreground",children:"Change the token"}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:b=>{b.preventDefault(),k(a,f)},children:[(0,c.jsx)(u.Input,{value:f,onChange:a=>g(a.target.value),placeholder:b,"aria-label":"Token",type:"password",autoComplete:"off",spellCheck:!1,className:"w-72 font-mono"}),(0,c.jsx)(t.Button,{type:"submit",size:"sm",loading:l,disabled:f.trim().length<z.KEY_MIN,children:d?"Replace":"Save"}),d&&(0,c.jsxs)(c.Fragment,{children:[null===e&&(0,c.jsx)(t.Button,{size:"sm",variant:"ghost",onClick:()=>i(!1),children:"Cancel"}),(0,c.jsx)(t.Button,{size:"sm",variant:"ghost",loading:n,onClick:()=>void o(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]}),e&&(0,c.jsx)("p",{className:"max-w-xl text-destructive",children:e})]})}function aC(){let[a,b]=(0,r.useState)(!1);return(0,c.jsxs)(t.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(ap).then(()=>{b(!0),setTimeout(()=>b(!1),2e3)}),children:[a?(0,c.jsx)(h.Check,{}):(0,c.jsx)(J.Copy,{}),a?"Copied":"Copy the manifest"]})}function aD({name:a,who:b,stopped:d}){let[e,f]=(0,ai.useServerAction)(am,{onOk:()=>(0,aj.revalidate)(s.queryKey.reach)});return(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-3 pl-8 text-[13px] text-muted-foreground",children:[(0,c.jsx)("span",{children:d?`${b} is let in.`:`${b} can write from a phone.`}),(0,c.jsx)(t.Button,{size:"sm",variant:"outline",loading:f,onClick:async()=>{await v.notify.confirm({title:`Let ${b} go?`,description:"Nobody can write to Thursday through this service until someone is let in again.",okText:"Let them go",destructive:!0})&&e(a)},children:"Let them go"})]})}let aE={[I.EXA_API_KEY]:p.Search},aF={image:n.Image,video:l,speech:f.AudioLines,transcription:g.Captions},aG={keys:["voice","easy","text","search"],models:["bots","studio"]};function aH({screen:a}){let{data:b,isLoading:d,error:e}=(0,aj.useServerRoute)(s.queryKey.config);if(d)return(0,c.jsx)(ah.SettingSkeleton,{rows:4});if(e)return(0,c.jsx)(ah.SettingError,{message:e.message});let f=a=>(0,I.isConfigSet)(b,a),g=a=>b?.find(b=>b.key===a)?.value,h=aG[a].flatMap(a=>I.CONFIG_GROUPS.find(b=>b.id===a)??[]),i=h.filter(a=>"keys"===a.section).flatMap(a=>a.entries);return(0,c.jsx)(ah.SettingScreen,{footer:(0,c.jsx)(ah.SettingRailNote,{children:"models"===a?"Her own voice and backend models are in Thursday. A bot can pick its own on its page.":`${i.filter(a=>f(a.key)).length} of ${i.length} set${h.some(a=>!(0,I.groupSatisfied)(a,f))?" · a call needs one voice key":" · your keys stay on this machine"}`}),children:h.map(a=>(0,c.jsx)(ah.SettingGroup,{label:a.title,hint:a.hint,right:(0,c.jsx)(aJ,{group:a,isSet:f}),children:"easy"===a.id?(0,c.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:a.entries.map(a=>(0,c.jsx)(aK,{card:!0,entry:a,set:f(a.key),needed:!1},a.key))}):"text"===a.id?(0,c.jsx)("div",{className:"flex flex-wrap gap-x-1.5 gap-y-3.5",children:a.entries.map(a=>(0,c.jsx)(aI,{entry:a,set:f(a.key)},a.key))}):(0,c.jsx)(ah.SettingItems,{children:a.entries.map(b=>b.effortOf?null:b.choices?(0,c.jsx)(aT,{entry:b,choices:b.choices,value:g(b.key),effort:aU(a,b.key),effortValue:g(I.DEFAULT_EFFORT_KEY)},b.key):(0,c.jsx)(aK,{entry:b,set:f(b.key),needed:!(0,I.groupSatisfied)(a,f)},b.key))})},a.id))})}function aI({entry:a,set:b}){return(0,c.jsxs)("button",{type:"button",onClick:()=>aW(a,b),"aria-label":`${a.label}: ${b?"set":"not set"}`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsxs)("span",{className:"relative grid size-10.5 place-items-center rounded-[13px] bg-muted/60 transition-colors group-hover:bg-muted",children:[(0,c.jsx)(aS,{entry:a}),b&&(0,c.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-primary text-primary-foreground ring-2 ring-background",children:(0,c.jsx)(h.Check,{className:"size-2.5"})})]}),(0,c.jsx)("span",{className:(0,ak.cn)("max-w-full truncate text-[11px]",b?"text-foreground":"text-muted-foreground"),children:a.label})]})}function aJ({group:a,isSet:b}){return"none"===a.require?null:(0,I.groupSatisfied)(a,b)?(0,c.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,c.jsx)(h.Check,{className:"size-3"}),"ready"]}):(0,c.jsxs)("span",{className:(0,ak.cn)("flex items-center gap-1 font-mono text-[11px]",ak.WAITING_INK),children:[(0,c.jsx)(q.TriangleAlert,{className:"size-3"}),a.note??"Required"]})}function aK({entry:a,set:b,needed:d,card:e=!1,narrow:f=!1}){let g=aN(a,b),j=aP(a,b),k=aO(a,b),l=j.data?aQ(j.data):aM(b,d,g.data,a.signIn),m=g.isLoading||j.isLoading,n=(0,c.jsxs)("span",{className:(0,ak.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",l.ink),children:[l.warn?(0,c.jsx)(q.TriangleAlert,{className:"size-3"}):b&&(0,c.jsx)(h.Check,{className:"size-3"}),l.text]});return(0,c.jsxs)("button",{type:"button",onClick:()=>{var d;return a.signIn?(d=a,v.notify.component({className:"sm:max-w-md",renderer:({close:a})=>(0,c.jsx)(aV,{entry:d,onDone:a})})):aW(a,b)},className:(0,ak.cn)("group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",e&&"rounded-xl border border-border/60"),children:[(0,c.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,c.jsx)(aS,{entry:a})}),(0,c.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,c.jsxs)("span",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[a.label,a.recommended&&(0,c.jsx)("span",{className:"rounded-full px-1.5 font-mono text-[9.5px] leading-4 font-normal text-muted-foreground ring-1 ring-border ring-inset",children:"recommended"})]}),f?m?(0,c.jsx)(y.Skeleton,{className:"h-3 w-20"}):n:(0,c.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:a.signIn?b?aR(j.data,k):"sign in with your account":a.key})]}),f?null:m?(0,c.jsx)(y.Skeleton,{className:"h-3 w-20 shrink-0"}):n,(0,c.jsx)(i.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let aL=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function aM(a,b,c,d){return a?c?"refused"in c?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${aL.format(c.balance)} left`,ink:c.low?ak.WAITING_INK:"text-muted-foreground",warn:c.low}:{text:d?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:b?{text:"Needed",ink:ak.WAITING_INK,warn:!0}:{text:d?"Signed out":"Not set",ink:"text-muted-foreground/60",warn:!1}}function aN(a,b){return(0,aj.useServerRoute)(b&&(0,E.isCatalogProvider)(a.provider)?s.queryKey.keyCredits(a.provider):null)}function aO(a,b){let{data:c}=(0,aj.useServerRoute)(b&&a.signIn?s.queryKey.llmModel:null);return c?.find(b=>b.id===a.provider)?.plan??null}function aP(a,b){return(0,aj.useServerRoute)(b&&a.signIn?s.queryKey.subscriptionUsage:null)}function aQ(a){return"refused"in a?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:a.spent?"Limit reached":`${a.usedPercent}% used`,ink:a.high?ak.WAITING_INK:"text-muted-foreground",warn:a.high}}function aR(a,b){let c=!a||"refused"in a?null:a,e=`${c?.plan??b??"unknown"} plan`;return c?.resetsAt?`${e} \xb7 resets in ${(0,d.formatDistanceToNowStrict)(new Date(c.resetsAt))}`:e}function aS({entry:a}){if(a.provider)return(0,c.jsx)(D.ProviderIcon,{provider:a.provider,className:"size-4"});let b=aE[a.key]??o.KeyRound,d=(0,c.jsx)(b,{className:"size-4 text-muted-foreground"});return a.site?(0,c.jsx)(x.SiteIcon,{host:a.site,className:"size-4 rounded-[4px]",fallback:d}):d}function aT({entry:a,choices:b,value:d,effort:e,effortValue:f}){let g=a.text?(0,E.parseTextModel)(d):(0,E.parseMediaModel)(d),{data:h}=(0,aj.useServerRoute)(a.text&&!d&&s.queryKey.automaticModel),i=a.kind?aF[a.kind]:F.BotsMark,[j]=(0,ai.useServerAction)(H.setConfigAction,{onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.automaticModel)}}),[k]=(0,ai.useServerAction)(G.removeConfigAction,{onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.automaticModel)}});return(0,c.jsxs)("div",{className:"flex w-full items-start gap-3 p-4",children:[(0,c.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,c.jsx)(i,{className:"size-4 text-muted-foreground"})}),(0,c.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,c.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 pt-1.5",children:[(0,c.jsx)("span",{className:"truncate text-sm font-medium",children:a.label}),!d&&(0,c.jsx)("span",{className:(0,ak.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",a.kind?ak.WAITING_INK:"text-muted-foreground"),children:a.kind?"off":"auto"})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsx)("div",{className:"min-w-0",children:(0,c.jsx)(C.ModelPicker,{kind:a.kind,provider:g?.provider??null,model:g?.model??"",unset:a.kind?"Not offered to bots until you pick one":function(a,b){if(!a)return"Automatic";if(!a.ref)return a.problem;let{provider:c,model:d}=a.ref,e=b.find(a=>a.value===`${c}/${d}`);return`Automatic \xb7 ${e?.label??d}`}(h,b),onChange:b=>j(a.key,`${b.provider}/${b.model.trim()}`),onUnset:d?()=>{k(a.key),e&&f&&k(e.key)}:void 0})}),e&&g&&(0,c.jsxs)("div",{className:"flex items-start gap-3 pt-0.5",children:[(0,c.jsx)("span",{className:"w-12 shrink-0 pt-1.5 font-mono text-[11px] text-muted-foreground",children:"effort"}),(0,c.jsx)(B.EffortSwitch,{provider:g.provider,model:g.model,value:E.effortSchema.safeParse(f).data??null,onChange:a=>a?j(e.key,a):k(e.key)})]})]})]})]})}let aU=(a,b)=>a.entries.find(a=>a.effortOf===b);function aV({entry:a,onDone:b}){let{data:d}=(0,aj.useServerRoute)(s.queryKey.config),e=(0,I.isConfigSet)(d,a.key),f=aO(a,e),g=aP(a,e),h=g.data?aQ(g.data):null,[i,j]=(0,ai.useServerAction)(G.removeConfigAction,{okMessage:`Signed out of ${a.label}`,onOk:()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.llmModel),b()}});return(0,c.jsx)(ah.SettingDialogContent,{title:a.label,description:e?(0,c.jsxs)(c.Fragment,{children:["Signed in ·"," ",(0,c.jsx)("span",{className:"font-mono",children:aR(g.data,f)}),h&&(0,c.jsxs)(c.Fragment,{children:[" · ",(0,c.jsx)("span",{className:(0,ak.cn)("font-mono",h.ink),children:h.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,c.jsxs)(c.Fragment,{children:[e&&(0,c.jsx)(t.Button,{variant:"ghost",loading:j,onClick:async()=>{await v.notify.confirm({title:`Sign out of ${a.label}?`,description:"Nothing runs on your plan until you sign in again.",okText:"Sign out",destructive:!0})&&i(a.key)},children:"Sign out"}),(0,c.jsx)(t.Button,{variant:"ghost",onClick:b,children:e?"Close":"Cancel"}),!e&&(0,c.jsx)(A.ChatGptSignIn,{})]}),children:(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(ah.SettingNote,{children:e?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),g.data&&"refused"in g.data&&(0,c.jsx)(ah.SettingNote,{className:"wrap-break-word text-destructive",children:g.data.refused})]})})}function aW(a,b){return v.notify.component({className:"sm:max-w-md",renderer:({close:d})=>(0,c.jsx)(aX,{entry:a,set:b,onDone:d})})}function aX({entry:a,set:b,onDone:d}){let[f,g]=(0,r.useState)(""),{data:h}=aN(a,b),i=h?aM(b,!1,h):null,j=()=>{(0,aj.revalidate)(s.queryKey.config),(0,aj.revalidate)(s.queryKey.llmModel)},[k,l]=(0,ai.useServerAction)(H.setConfigAction,{okMessage:`${a.label} key saved`,onOk:()=>{j(),d()}}),[m,n]=(0,ai.useServerAction)(G.removeConfigAction,{okMessage:`${a.label} key removed`,onOk:()=>{j(),d()}}),o=async()=>{await v.notify.confirm({title:`Remove the ${a.label} key?`,description:"It is deleted from this computer, and nothing runs on it until a key is pasted again.",okText:"Remove",destructive:!0})&&m(a.key)};return(0,c.jsx)(ah.SettingDialogContent,{title:a.label,description:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"font-mono",children:a.key}),a.hint&&(0,c.jsxs)(c.Fragment,{children:[" · ",a.hint]}),i&&(0,c.jsxs)(c.Fragment,{children:[" · ",(0,c.jsx)("span",{className:(0,ak.cn)("font-mono",i.ink),children:i.text})]})]}),footer:(0,c.jsxs)(c.Fragment,{children:[b&&(0,c.jsx)(t.Button,{variant:"ghost",loading:n,onClick:()=>void o(),className:"mr-auto text-destructive hover:text-destructive",children:"Remove"}),(0,c.jsx)(t.Button,{variant:"ghost",onClick:d,children:"Cancel"}),(0,c.jsx)(t.Button,{loading:l,disabled:f.trim().length<z.KEY_MIN,onClick:()=>k(a.key,f),children:b?"Replace":"Save"})]}),children:(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(u.Input,{value:f,onChange:a=>g(a.target.value),onKeyDown:b=>{"Enter"===b.key&&f.trim().length>=z.KEY_MIN&&k(a.key,f)},placeholder:b?"New value — replaces the current key":a.keyLooks??"Paste the key",spellCheck:!1,type:"password",autoFocus:!0}),!b&&a.keysAt&&(0,c.jsxs)("a",{href:a.keysAt,target:"_blank",rel:"noreferrer",className:"flex w-fit items-center gap-1 px-0.5 text-[13px] text-foreground underline underline-offset-3 hover:text-foreground/80",children:["Get a key at ",new URL(a.keysAt).host,(0,c.jsx)(e.ArrowUpRight,{className:"size-3.5"})]}),h&&"refused"in h&&(0,c.jsx)(ah.SettingNote,{className:"wrap-break-word text-destructive",children:h.refused})]})})}a.s(["AccountsSetup",0,function({withoutVoice:a=!1}){let{data:b}=(0,aj.useServerRoute)(s.queryKey.config),d=a=>(0,I.isConfigSet)(b,a),e=a=>I.CONFIG_GROUPS.find(b=>b.id===a)?.entries??[],[f,g]=(0,r.useState)(!1),h=e("voice"),i=[...h,...e("text")],j=i.filter((b,c)=>(c<4||d(b.key))&&!(a&&h.includes(b))),k=i.filter(b=>!j.includes(b)&&!(a&&h.includes(b)));return(0,c.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,c.jsx)("div",{className:"flex flex-col gap-2",children:e("easy").map(a=>(0,c.jsx)(aK,{card:!0,narrow:!0,entry:a,set:d(a.key),needed:!1},a.key))}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-y-2.5",children:[j.map(a=>(0,c.jsx)(aI,{entry:a,set:d(a.key)},a.key)),k.length>0&&(0,c.jsxs)(w.Popover,{open:f,onOpenChange:g,children:[(0,c.jsxs)(w.PopoverTrigger,{"aria-label":`${k.length} more providers`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,c.jsx)("span",{className:"grid size-10.5 place-items-center rounded-[13px] bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,c.jsx)(m.default,{className:"size-4"})}),(0,c.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"More"})]}),(0,c.jsx)(w.PopoverContent,{align:"end",className:"w-78 flex-row flex-wrap gap-0 gap-y-2.5 rounded-2xl p-2.5",onClick:()=>g(!1),children:k.map(a=>(0,c.jsx)(aI,{entry:a,set:d(a.key)},a.key))})]})]}),e("search").map(a=>(0,c.jsx)(aK,{card:!0,narrow:!0,entry:a,set:d(a.key),needed:!1},a.key))]})},"KeysSetting",0,()=>(0,c.jsx)(aH,{screen:"keys"}),"ModelsSetting",0,()=>(0,c.jsx)(aH,{screen:"models"}),"PhoneSetting",0,()=>(0,c.jsx)(ah.SettingScreen,{footer:(0,c.jsx)(ah.SettingRailNote,{children:"Nothing on this computer is opened to the internet: the app asks the chat service what was written."}),children:(0,c.jsx)(as,{})})],405593)},214013,a=>{"use strict";var b=a.i(405050);let c=(0,b.createServerReference)("7fc5ad2ca5f880c272d3b36234f095644501ad4300",b.callServer,void 0,b.findSourceMapURL,"removeConfigAction");a.s(["removeConfigAction",0,c])}];
19
19
 
20
- //# sourceMappingURL=features_config_1ond01n._.js.map
20
+ //# sourceMappingURL=features_config_05zi68v._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[26444,a=>{"use strict";var b=a.i(187924),c=a.i(752562),d=a.i(589027),e=a.i(141146),f=a.i(738835),g=a.i(403512),h=a.i(164831);let i={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};i.node;let j=(0,h.default)(i),k={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};k.node;let l=(0,h.default)(k);var m=a.i(951675),n=a.i(474215),o=a.i(572131),p=a.i(767561),q=a.i(340695),r=a.i(316474),s=a.i(205522),t=a.i(497895);let u=(0,o.memo)(({data:a,name:c,initialExpandDepth:d=2})=>{let e=(0,o.useMemo)(()=>"string"==typeof a?function(a){let b=a.trim();if(!(b.startsWith("{")&&b.endsWith("}"))&&!(b.startsWith("[")&&b.endsWith("]")))return{success:!1,data:a};try{return{success:!0,data:JSON.parse(a)}}catch{return{success:!1,data:a}}}(a).data:a,[a]);return(0,b.jsx)("div",{className:"text-sm",children:(0,b.jsx)(x,{data:e,name:c,depth:0,initialExpandDepth:d})})});u.displayName="JsonView";let v=(a,b)=>({role:"button",tabIndex:0,"aria-expanded":a,onClick:b,onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),b())}}),w="outline-none focus-visible:ring-3 focus-visible:ring-ring/50",x=(0,o.memo)(({data:a,name:c,depth:d=0,initialExpandDepth:e})=>{var f;let g=void 0===a?"undefined":Array.isArray(a)?"array":null===a?"null":typeof a,[h,i]=(0,o.useState)("string"!==g&&d<e),j={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(g){case"object":case"array":let k,l,m;return l=(k=(f="array"===g)?a:Object.entries(a)).length,m={open:f?"[":"{",close:f?"]":"}",collapsed:f?"[ ... ]":"{ ... }",empty:f?"[]":"{}"},0===l?(0,b.jsxs)("div",{className:"flex items-center",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:m.empty})]}):(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:(0,t.cn)("flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",w),...v(h,()=>i(!h)),children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[c,":"]}),h?(0,b.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:m.open}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:m.collapsed}),(0,b.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[l," ",1===l?"item":"items"]})]})]}),h&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:f?k.map((a,c)=>(0,b.jsx)("div",{className:"my-1",children:(0,b.jsx)(x,{data:a,name:`${c}`,depth:d+1,initialExpandDepth:e})},c)):k.map(([a,c])=>(0,b.jsx)("div",{className:"my-1",children:(0,b.jsx)(x,{data:c,name:a,depth:d+1,initialExpandDepth:e})},a))}),(0,b.jsx)("div",{className:"text-muted-foreground",children:m.close})]})]});case"string":return a.length>100?(0,b.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[c,":"]}),(0,b.jsx)("pre",{className:(0,t.cn)(j.string,"cursor-pointer group-hover:text-foreground",w),...v(h,()=>i(!h)),title:h?"Click to collapse":"Click to expand",children:h?`"${a}"`:`"${a.slice(0,100)}..."`})]}):(0,b.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsxs)("pre",{className:j.string,children:['"',a,'"']})]});case"undefined":return(0,b.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:j.undefined,children:"undefined"})]});default:return(0,b.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:j[g]||j.default,children:null===a?"null":String(a)})]})}});x.displayName="JsonNode";var y=a.i(446181),z=a.i(341889),A=a.i(280281),B=a.i(621958),C=a.i(546893),D=a.i(864037),E=a.i(405050);let F=(0,E.createServerReference)("7fb52537f824151c3f09a681c12fd009cb58ccf561",E.callServer,void 0,E.findSourceMapURL,"callToolAction"),G=(0,E.createServerReference)("7f7da376e35d8d3bf47cdd19a8ff964d99fb6d9be9",E.callServer,void 0,E.findSourceMapURL,"deleteServerAction"),H=(0,E.createServerReference)("7f357f864f8433b1d36cc0d2d6ca3fd6a0544e927f",E.callServer,void 0,E.findSourceMapURL,"refreshServerAction"),I=(0,E.createServerReference)("7f83975f99a33a27bf1a46da37bd7b8edebdef5d78",E.callServer,void 0,E.findSourceMapURL,"registerServerAction");var J=a.i(156757),K=a.i(199169);let L=J.z.object({url:J.z.url(),headers:J.z.record(J.z.string(),J.z.string()).optional()}),M=J.z.object({command:J.z.string().min(1),args:J.z.array(J.z.string()).optional(),env:J.z.record(J.z.string(),J.z.string()).optional()}),N=J.z.union([L,M]),O=J.z.object({name:J.z.string(),description:J.z.string().optional(),inputSchema:J.z.looseObject({}).optional(),outputSchema:J.z.looseObject({}).optional()});function P(a){return"url"in a}J.z.object({clientInformation:J.z.looseObject({}).optional(),tokens:J.z.looseObject({}).optional(),authorizationServer:J.z.looseObject({}).optional(),codeVerifier:J.z.string().optional(),state:J.z.string().optional()});let Q=J.z.object({name:J.z.string().min(1).max(40),config:N,toolCount:J.z.number().int(),lastError:J.z.string().nullish()}),R=O.extend({id:J.z.number().int(),description:J.z.string().nullish()});Q.omit({toolCount:!0}).extend({tools:R.array().default([]),toolsSyncedAt:K.DateLikeSchema});let S=J.z.object({name:J.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:N}),T=J.z.union([J.z.object({mcpServers:J.z.record(J.z.string(),N)}),J.z.record(J.z.string(),N)]),U=[{name:"todoist",icon:"todoist.com",description:"Tasks, projects, and due dates",config:{url:"https://ai.todoist.net/mcp"}},{name:"home-assistant",icon:"home-assistant.io",description:"Lights, switches, and the rest of the house — your address and a long-lived token",config:{url:"http://homeassistant.local:8123/api/mcp",headers:{Authorization:"Bearer <your-home-assistant-token>"}}},{name:"kiwi",icon:"kiwi.com",description:"Flight search — no account",config:{url:"https://mcp.kiwi.com"}},{name:"zapier",icon:"zapier.com",description:"Gmail, Google Calendar, and thousands of apps you connect there",config:{url:"https://mcp.zapier.com/api/v1/connect"}},{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}}];var V=a.i(619477),W=a.i(30681),X=a.i(313237),Y=a.i(759497);function Z({name:a,onDone:c}){let[d,e]=(0,o.useState)(""),{data:f,isLoading:g}=(0,Y.useServerRoute)(p.queryKey.mcpServer(a)),[h,i]=(0,X.useServerAction)(H,{...aj,onOk:b=>{aj.onOk(b),(0,Y.revalidate)(p.queryKey.mcpServer(a))}}),[k,l]=(0,X.useServerAction)(G,{okMessage:"Server deleted",onOk:()=>{c(),(0,Y.revalidate)(p.queryKey.mcp)}}),n=async()=>{await y.notify.confirm({title:`Delete ${a}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&k(a)};if(g)return(0,b.jsx)(V.SettingSkeleton,{rows:4});if(!f)return null;let r=f.tools.length,s=d.trim().toLowerCase(),t=s?f.tools.filter(a=>`${a.name} ${a.description??""}`.toLowerCase().includes(s)):f.tools,u=P(f.config)?"HTTP":"STDIO";return(0,b.jsxs)(V.SettingDialogContent,{title:f.name,description:(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,b.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:u}),(0,b.jsx)("span",{className:"truncate font-mono",children:al(f.config)})]}),footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q.Button,{variant:"ghost",loading:l,onClick:n,className:"mr-auto text-destructive hover:text-destructive",children:[(0,b.jsx)(m.Trash2,{}),"Delete"]}),(0,b.jsxs)(q.Button,{variant:"outline",loading:i,onClick:()=>h(f.name),children:[(0,b.jsx)(j,{}),"Reconnect"]})]}),children:[f.lastError&&(0,b.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:f.lastError}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(V.SettingFilter,{value:d,onChange:e,placeholder:"Filter tools"}),(0,b.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:[r," ",1===r?"tool":"tools"]})]}),t.map(a=>(0,b.jsx)(aa,{tool:a,serverName:f.name},a.name)),0===t.length&&r>0&&(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No tool here goes by that."})]})}function $({server:a}){let d=a.toolCount,f=a.lastError?"error":d>0?"connected":"idle";return(0,b.jsxs)("button",{type:"button",onClick:()=>{y.notify.component({className:"sm:max-w-3xl",renderer:({close:c})=>(0,b.jsx)(Z,{name:a.name,onDone:c})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,b.jsx)(_,{server:a})}),(0,b.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,b.jsx)("span",{className:"truncate text-sm font-medium",children:a.name}),"connected"===f&&(0,b.jsx)(c.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,b.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===f?(0,b.jsx)("span",{className:"text-destructive",children:a.lastError}):(0,b.jsxs)(b.Fragment,{children:[d>0?`${d} ${1===d?"tool":"tools"}`:"No tools yet",(0,b.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",al(a.config)]})]})})]}),(0,b.jsx)(e.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function _({server:a}){let c,d=(c=U.find(b=>P(b.config)?P(a.config)&&b.config.url.replace(/\/+$/,"")===a.config.url.replace(/\/+$/,""):!P(a.config)&&b.config.command===a.config.command&&(b.config.args??[]).join(" ")===(a.config.args??[]).join(" "))??U.find(b=>b.name===a.name),c?.icon);return d?(0,b.jsx)(z.SiteIcon,{host:d,className:"size-5",fallback:(0,b.jsx)(l,{className:"size-4"})}):(0,b.jsx)(l,{className:"size-4"})}function aa({tool:a,serverName:c}){let[f,g]=(0,o.useState)(!1),[h,i]=(0,o.useState)(!1),[j,k]=(0,o.useState)(!1),l=[["inputSchema",a.inputSchema],["outputSchema",a.outputSchema]].filter(([,a])=>a);return(0,b.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",children:a.name}),l.length>0&&(0,b.jsxs)(q.Button,{size:"xs",variant:"ghost",className:"shrink-0 font-mono",onClick:()=>g(!f),children:[f?(0,b.jsx)(d.ChevronDown,{}):(0,b.jsx)(e.ChevronRight,{}),"Schema"]}),(0,b.jsxs)(q.Button,{size:"xs",variant:"ghost",className:"shrink-0 font-mono",onClick:()=>i(!h),children:[h?(0,b.jsx)(d.ChevronDown,{}):(0,b.jsx)(e.ChevronRight,{}),"Test"]})]}),a.description?(0,b.jsx)("p",{className:(0,t.cn)("mt-0.5 text-xs leading-relaxed text-muted-foreground",!j&&"line-clamp-2",a.description.length>140&&"cursor-pointer"),onClick:()=>k(!j),children:a.description}):null,f?(0,b.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:l.map(([a,c])=>(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===a?"in":"out"}),(0,b.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function a(b,c=0){if(!b||"object"!=typeof b)return"unknown";let d=" ".repeat(c+1),e=" ".repeat(c);if(Array.isArray(b.enum))return b.enum.map(a=>JSON.stringify(a)).join(" | ");let f=b.anyOf??b.oneOf;if(Array.isArray(f))return f.map(b=>a(b,c)).join(" | ");if("array"===b.type){let d=a(b.items,c);return/[|{]/.test(d)?`(${d})[]`:`${d}[]`}if("object"===b.type||b.properties){let f=b.properties;if(!f||0===Object.keys(f).length)return"{}";let g=b.required??[],h=Object.entries(f).map(([b,e])=>{let f=g.includes(b)?"":"?",h=e?.description,i="string"==typeof h&&h.length<=60?` // ${h}`:"";return`${d}${b}${f}: ${a(e,c+1)}${i}`});return`{
1
+ module.exports=[26444,a=>{"use strict";var b=a.i(187924),c=a.i(752562),d=a.i(589027),e=a.i(141146),f=a.i(738835),g=a.i(403512),h=a.i(164831);let i={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};i.node;let j=(0,h.default)(i),k={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};k.node;let l=(0,h.default)(k);var m=a.i(951675),n=a.i(474215),o=a.i(572131),p=a.i(767561),q=a.i(340695),r=a.i(316474),s=a.i(205522),t=a.i(497895);let u=(0,o.memo)(({data:a,name:c,initialExpandDepth:d=2})=>{let e=(0,o.useMemo)(()=>"string"==typeof a?function(a){let b=a.trim();if(!(b.startsWith("{")&&b.endsWith("}"))&&!(b.startsWith("[")&&b.endsWith("]")))return{success:!1,data:a};try{return{success:!0,data:JSON.parse(a)}}catch{return{success:!1,data:a}}}(a).data:a,[a]);return(0,b.jsx)("div",{className:"text-sm",children:(0,b.jsx)(x,{data:e,name:c,depth:0,initialExpandDepth:d})})});u.displayName="JsonView";let v=(a,b)=>({role:"button",tabIndex:0,"aria-expanded":a,onClick:b,onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),b())}}),w="outline-none focus-visible:ring-3 focus-visible:ring-ring/50",x=(0,o.memo)(({data:a,name:c,depth:d=0,initialExpandDepth:e})=>{var f;let g=void 0===a?"undefined":Array.isArray(a)?"array":null===a?"null":typeof a,[h,i]=(0,o.useState)("string"!==g&&d<e),j={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(g){case"object":case"array":let k,l,m;return l=(k=(f="array"===g)?a:Object.entries(a)).length,m={open:f?"[":"{",close:f?"]":"}",collapsed:f?"[ ... ]":"{ ... }",empty:f?"[]":"{}"},0===l?(0,b.jsxs)("div",{className:"flex items-center",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:m.empty})]}):(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:(0,t.cn)("flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",w),...v(h,()=>i(!h)),children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[c,":"]}),h?(0,b.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:m.open}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:m.collapsed}),(0,b.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[l," ",1===l?"item":"items"]})]})]}),h&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:f?k.map((a,c)=>(0,b.jsx)("div",{className:"my-1",children:(0,b.jsx)(x,{data:a,name:`${c}`,depth:d+1,initialExpandDepth:e})},c)):k.map(([a,c])=>(0,b.jsx)("div",{className:"my-1",children:(0,b.jsx)(x,{data:c,name:a,depth:d+1,initialExpandDepth:e})},a))}),(0,b.jsx)("div",{className:"text-muted-foreground",children:m.close})]})]});case"string":return a.length>100?(0,b.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[c,":"]}),(0,b.jsx)("pre",{className:(0,t.cn)(j.string,"cursor-pointer group-hover:text-foreground",w),...v(h,()=>i(!h)),title:h?"Click to collapse":"Click to expand",children:h?`"${a}"`:`"${a.slice(0,100)}..."`})]}):(0,b.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsxs)("pre",{className:j.string,children:['"',a,'"']})]});case"undefined":return(0,b.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:j.undefined,children:"undefined"})]});default:return(0,b.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[c&&(0,b.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[c,":"]}),(0,b.jsx)("span",{className:j[g]||j.default,children:null===a?"null":String(a)})]})}});x.displayName="JsonNode";var y=a.i(446181),z=a.i(341889),A=a.i(280281),B=a.i(621958),C=a.i(546893),D=a.i(864037),E=a.i(405050);let F=(0,E.createServerReference)("7f5bc44c6df1d9dbd20774e56cce16614b070ead00",E.callServer,void 0,E.findSourceMapURL,"callToolAction"),G=(0,E.createServerReference)("7f9af58d285f49abd4ebc86d359a2e6bab54047220",E.callServer,void 0,E.findSourceMapURL,"deleteServerAction"),H=(0,E.createServerReference)("7fb539827d92480336e8cd95c1e4427b94cc24dd16",E.callServer,void 0,E.findSourceMapURL,"refreshServerAction"),I=(0,E.createServerReference)("7f17f1d5f418c0b333e1b848659732952124a2f7b8",E.callServer,void 0,E.findSourceMapURL,"registerServerAction");var J=a.i(156757),K=a.i(199169);let L=J.z.object({url:J.z.url(),headers:J.z.record(J.z.string(),J.z.string()).optional()}),M=J.z.object({command:J.z.string().min(1),args:J.z.array(J.z.string()).optional(),env:J.z.record(J.z.string(),J.z.string()).optional()}),N=J.z.union([L,M]),O=J.z.object({name:J.z.string(),description:J.z.string().optional(),inputSchema:J.z.looseObject({}).optional(),outputSchema:J.z.looseObject({}).optional()});function P(a){return"url"in a}J.z.object({clientInformation:J.z.looseObject({}).optional(),tokens:J.z.looseObject({}).optional(),authorizationServer:J.z.looseObject({}).optional(),codeVerifier:J.z.string().optional(),state:J.z.string().optional()});let Q=J.z.object({name:J.z.string().min(1).max(40),config:N,toolCount:J.z.number().int(),lastError:J.z.string().nullish()}),R=O.extend({id:J.z.number().int(),description:J.z.string().nullish()});Q.omit({toolCount:!0}).extend({tools:R.array().default([]),toolsSyncedAt:K.DateLikeSchema});let S=J.z.object({name:J.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:N}),T=J.z.union([J.z.object({mcpServers:J.z.record(J.z.string(),N)}),J.z.record(J.z.string(),N)]),U=[{name:"todoist",icon:"todoist.com",description:"Tasks, projects, and due dates",config:{url:"https://ai.todoist.net/mcp"}},{name:"home-assistant",icon:"home-assistant.io",description:"Lights, switches, and the rest of the house — your address and a long-lived token",config:{url:"http://homeassistant.local:8123/api/mcp",headers:{Authorization:"Bearer <your-home-assistant-token>"}}},{name:"kiwi",icon:"kiwi.com",description:"Flight search — no account",config:{url:"https://mcp.kiwi.com"}},{name:"zapier",icon:"zapier.com",description:"Gmail, Google Calendar, and thousands of apps you connect there",config:{url:"https://mcp.zapier.com/api/v1/connect"}},{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}}];var V=a.i(619477),W=a.i(30681),X=a.i(313237),Y=a.i(759497);function Z({name:a,onDone:c}){let[d,e]=(0,o.useState)(""),{data:f,isLoading:g}=(0,Y.useServerRoute)(p.queryKey.mcpServer(a)),[h,i]=(0,X.useServerAction)(H,{...aj,onOk:b=>{aj.onOk(b),(0,Y.revalidate)(p.queryKey.mcpServer(a))}}),[k,l]=(0,X.useServerAction)(G,{okMessage:"Server deleted",onOk:()=>{c(),(0,Y.revalidate)(p.queryKey.mcp)}}),n=async()=>{await y.notify.confirm({title:`Delete ${a}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&k(a)};if(g)return(0,b.jsx)(V.SettingSkeleton,{rows:4});if(!f)return null;let r=f.tools.length,s=d.trim().toLowerCase(),t=s?f.tools.filter(a=>`${a.name} ${a.description??""}`.toLowerCase().includes(s)):f.tools,u=P(f.config)?"HTTP":"STDIO";return(0,b.jsxs)(V.SettingDialogContent,{title:f.name,description:(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,b.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:u}),(0,b.jsx)("span",{className:"truncate font-mono",children:al(f.config)})]}),footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q.Button,{variant:"ghost",loading:l,onClick:n,className:"mr-auto text-destructive hover:text-destructive",children:[(0,b.jsx)(m.Trash2,{}),"Delete"]}),(0,b.jsxs)(q.Button,{variant:"outline",loading:i,onClick:()=>h(f.name),children:[(0,b.jsx)(j,{}),"Reconnect"]})]}),children:[f.lastError&&(0,b.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:f.lastError}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(V.SettingFilter,{value:d,onChange:e,placeholder:"Filter tools"}),(0,b.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:[r," ",1===r?"tool":"tools"]})]}),t.map(a=>(0,b.jsx)(aa,{tool:a,serverName:f.name},a.name)),0===t.length&&r>0&&(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No tool here goes by that."})]})}function $({server:a}){let d=a.toolCount,f=a.lastError?"error":d>0?"connected":"idle";return(0,b.jsxs)("button",{type:"button",onClick:()=>{y.notify.component({className:"sm:max-w-3xl",renderer:({close:c})=>(0,b.jsx)(Z,{name:a.name,onDone:c})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,b.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,b.jsx)(_,{server:a})}),(0,b.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,b.jsx)("span",{className:"truncate text-sm font-medium",children:a.name}),"connected"===f&&(0,b.jsx)(c.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,b.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===f?(0,b.jsx)("span",{className:"text-destructive",children:a.lastError}):(0,b.jsxs)(b.Fragment,{children:[d>0?`${d} ${1===d?"tool":"tools"}`:"No tools yet",(0,b.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",al(a.config)]})]})})]}),(0,b.jsx)(e.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function _({server:a}){let c,d=(c=U.find(b=>P(b.config)?P(a.config)&&b.config.url.replace(/\/+$/,"")===a.config.url.replace(/\/+$/,""):!P(a.config)&&b.config.command===a.config.command&&(b.config.args??[]).join(" ")===(a.config.args??[]).join(" "))??U.find(b=>b.name===a.name),c?.icon);return d?(0,b.jsx)(z.SiteIcon,{host:d,className:"size-5",fallback:(0,b.jsx)(l,{className:"size-4"})}):(0,b.jsx)(l,{className:"size-4"})}function aa({tool:a,serverName:c}){let[f,g]=(0,o.useState)(!1),[h,i]=(0,o.useState)(!1),[j,k]=(0,o.useState)(!1),l=[["inputSchema",a.inputSchema],["outputSchema",a.outputSchema]].filter(([,a])=>a);return(0,b.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-sm",children:a.name}),l.length>0&&(0,b.jsxs)(q.Button,{size:"xs",variant:"ghost",className:"shrink-0 font-mono",onClick:()=>g(!f),children:[f?(0,b.jsx)(d.ChevronDown,{}):(0,b.jsx)(e.ChevronRight,{}),"Schema"]}),(0,b.jsxs)(q.Button,{size:"xs",variant:"ghost",className:"shrink-0 font-mono",onClick:()=>i(!h),children:[h?(0,b.jsx)(d.ChevronDown,{}):(0,b.jsx)(e.ChevronRight,{}),"Test"]})]}),a.description?(0,b.jsx)("p",{className:(0,t.cn)("mt-0.5 text-xs leading-relaxed text-muted-foreground",!j&&"line-clamp-2",a.description.length>140&&"cursor-pointer"),onClick:()=>k(!j),children:a.description}):null,f?(0,b.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:l.map(([a,c])=>(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===a?"in":"out"}),(0,b.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function a(b,c=0){if(!b||"object"!=typeof b)return"unknown";let d=" ".repeat(c+1),e=" ".repeat(c);if(Array.isArray(b.enum))return b.enum.map(a=>JSON.stringify(a)).join(" | ");let f=b.anyOf??b.oneOf;if(Array.isArray(f))return f.map(b=>a(b,c)).join(" | ");if("array"===b.type){let d=a(b.items,c);return/[|{]/.test(d)?`(${d})[]`:`${d}[]`}if("object"===b.type||b.properties){let f=b.properties;if(!f||0===Object.keys(f).length)return"{}";let g=b.required??[],h=Object.entries(f).map(([b,e])=>{let f=g.includes(b)?"":"?",h=e?.description,i="string"==typeof h&&h.length<=60?` // ${h}`:"";return`${d}${b}${f}: ${a(e,c+1)}${i}`});return`{
2
2
  ${h.join("\n")}
3
3
  ${e}}`}return Array.isArray(b.type)?b.type.join(" | "):"string"==typeof b.type?b.type:"unknown"}(c)})]},a))}):null,h?(0,b.jsx)(ab,{tool:a,serverName:c}):null]})}function ab({tool:a,serverName:c}){let[d,e]=(0,o.useState)(()=>(function(a){let b=a.inputSchema?.properties;if(!b||"object"!=typeof b)return"{}";let c={};for(let[a,d]of Object.entries(b))c[a]=d?.type==="number"||d?.type==="integer"?0:d?.type!=="boolean"&&(d?.type==="array"?[]:d?.type==="object"?{}:"");return JSON.stringify(c,null,2)})(a)),[g,h]=(0,o.useState)(""),[i,j,k,l,m]=(0,X.useServerAction)(F,{errorMessage:!1});return(0,b.jsxs)("div",{className:"mt-2 space-y-2 rounded-lg border border-input p-3",children:[(0,b.jsx)(C.Textarea,{value:d,onChange:a=>e(a.target.value),spellCheck:!1,className:"min-h-24 resize-none font-mono text-xs"}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsx)("span",{className:"font-mono text-xs text-destructive",children:g||l}),(0,b.jsxs)(q.Button,{size:"sm",loading:j,onClick:()=>{let b;try{b=d.trim()?JSON.parse(d):void 0}catch{h("Not valid JSON");return}h(""),m(),i(c,a.name,b)},children:[!j&&(0,b.jsx)(f.Play,{}),"Run"]})]}),void 0!==k&&(0,b.jsx)("div",{className:"overflow-x-auto rounded-lg bg-muted/40 p-3",children:(0,b.jsx)(u,{data:k,initialExpandDepth:3})})]})}function ac(a){return y.notify.component({className:"sm:max-w-lg",renderer:({close:c})=>(0,b.jsx)(ad,{initial:a,onDone:c})})}function ad({initial:a,onDone:c}){let d=a&&P(a.config)?a.config:void 0,e=a&&!P(a.config)?a.config:void 0,[f,g]=(0,W.useObjectState)({mode:e?"stdio":"http",name:a?.name??"",url:d?.url??"",headers:ag(d?.headers),command:e?.command??"",args:(e?.args??[]).join(" "),env:ag(e?.env),raw:""}),{mode:h,name:i,url:j,headers:k,command:l,args:m,env:n,raw:p}=f,[t,u]=(0,X.useServerAction)(I,{...aj,onOk:a=>{aj.onOk(a),"error"!==a.status&&c()}}),v=(0,o.useMemo)(()=>{var a,b,c,d,e;let f,g;return"json"===h?function(a){let b,c=a.trim();if(!c)return{value:null,error:""};try{b=JSON.parse(c)}catch{return{value:null,error:"Not valid JSON"}}let d=N.safeParse(b);if(d.success)return{value:{name:null,config:d.data},error:""};let e=T.safeParse(b);if(!e.success)return{value:null,error:"Needs a url or a command"};let f=Object.entries("mcpServers"in e.data?e.data.mcpServers:e.data)[0];return f?{value:{name:f[0],config:f[1]},error:""}:{value:null,error:"No server in there"}}(p):"http"===h?(a=j,b=k,(f=L.safeParse({url:a.trim(),headers:ah(b)})).success?{value:{name:null,config:f.data},error:""}:{value:null,error:a.trim()?"Needs a valid url":""}):(c=l,d=m,e=n,(g=M.safeParse({command:c.trim(),args:d.split(/\s+/).filter(Boolean),env:ah(e)})).success?{value:{name:null,config:g.data},error:""}:{value:null,error:c.trim()?"Needs a command":""})},[h,p,j,k,l,m,n]),w="json"===h?p:JSON.stringify([h,j,k,l,m,n]),[x,y]=(0,o.useState)(w);(0,o.useEffect)(()=>{let a=setTimeout(()=>y(w),700);return()=>clearTimeout(a)},[w]);let z=x===w?v.error:"",D=i||v.value?.name||"",E=S.safeParse({name:D,config:v.value?.config});function F(a){let b=v.value?.config;return b?"json"===a?g({mode:a,raw:JSON.stringify(b,null,2)}):"http"===a&&P(b)?g({mode:a,url:b.url,headers:ag(b.headers)}):"stdio"!==a||P(b)?void g({mode:a}):g({mode:a,command:b.command,args:(b.args??[]).join(" "),env:ag(b.env)}):g({mode:a})}let G=(0,b.jsxs)("span",{className:"flex items-center gap-2 font-mono text-xs text-muted-foreground",children:["JSON",(0,b.jsx)(A.Switch,{size:"sm",checked:"json"===h,onCheckedChange:a=>{let b;return a?F("json"):void F((b=v.value?.config)&&!P(b)?"stdio":"http")}})]});return(0,b.jsx)(V.SettingDialogContent,{title:"Add MCP server",description:"Its tools become available to every bot.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q.Button,{variant:"ghost",onClick:c,children:"Cancel"}),(0,b.jsx)(q.Button,{disabled:!E.success,loading:u,onClick:()=>{E.success&&!u&&t(E.data)},children:"Connect"})]}),children:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(r.Field,{children:[(0,b.jsx)(r.FieldLabel,{children:"Name"}),(0,b.jsx)(s.Input,{value:D,onChange:a=>g({name:a.target.value}),placeholder:"notion",spellCheck:!1})]}),"json"===h?(0,b.jsxs)(r.Field,{children:[(0,b.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,b.jsx)(r.FieldLabel,{children:"JSON"}),G]}),(0,b.jsx)(C.Textarea,{value:p,onChange:a=>g({raw:a.target.value}),spellCheck:!1,placeholder:ai,className:"min-h-64 resize-none font-mono text-xs"})]}):(0,b.jsxs)(B.Tabs,{value:h,onValueChange:a=>F(a),className:"gap-6",children:[(0,b.jsxs)(r.Field,{children:[(0,b.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,b.jsx)(r.FieldLabel,{children:"Transport"}),G]}),(0,b.jsxs)(B.TabsList,{className:"w-full",children:[(0,b.jsx)(B.TabsTrigger,{value:"http",children:"HTTP"}),(0,b.jsx)(B.TabsTrigger,{value:"stdio",children:"STDIO"})]})]}),(0,b.jsxs)(B.TabsContent,{value:"http",className:"space-y-6",children:[(0,b.jsxs)(r.Field,{children:[(0,b.jsx)(r.FieldLabel,{children:"URL"}),(0,b.jsx)(s.Input,{value:j,onChange:a=>g({url:a.target.value}),placeholder:"https://mcp.notion.com/mcp",spellCheck:!1,className:"font-mono text-xs"})]}),(0,b.jsx)(ae,{label:"Headers",pairs:k,onChange:a=>g({headers:a}),keyPlaceholder:"Authorization",valuePlaceholder:"Bearer sk-..."})]}),(0,b.jsxs)(B.TabsContent,{value:"stdio",className:"space-y-6",children:[(0,b.jsxs)(r.Field,{children:[(0,b.jsx)(r.FieldLabel,{children:"Command"}),(0,b.jsx)(s.Input,{value:l,onChange:a=>g({command:a.target.value}),placeholder:"npx",spellCheck:!1,className:"font-mono text-xs"})]}),(0,b.jsxs)(r.Field,{children:[(0,b.jsx)(r.FieldLabel,{children:"Args"}),(0,b.jsx)(s.Input,{value:m,onChange:a=>g({args:a.target.value}),placeholder:"-y @notionhq/notion-mcp-server",spellCheck:!1,className:"font-mono text-xs"})]}),(0,b.jsx)(ae,{label:"Env",pairs:n,onChange:a=>g({env:a}),keyPlaceholder:"NOTION_TOKEN",valuePlaceholder:"ntn_..."})]})]}),z&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:z})]})})}function ae({label:a,pairs:c,onChange:d,keyPlaceholder:e,valuePlaceholder:f}){let h=(a,b)=>d(c.map(c=>c.id===a?{...c,...b}:c));return(0,b.jsxs)(r.Field,{children:[(0,b.jsx)(r.FieldLabel,{children:a}),(0,b.jsxs)("div",{className:"space-y-2",children:[c.map(a=>(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(s.Input,{value:a.key,onChange:b=>h(a.id,{key:b.target.value}),placeholder:e,spellCheck:!1,className:"font-mono text-xs"}),(0,b.jsx)(s.Input,{value:a.value,onChange:b=>h(a.id,{value:b.target.value}),placeholder:f,spellCheck:!1,className:"font-mono text-xs"}),(0,b.jsx)(q.Button,{variant:"ghost",size:"icon","aria-label":"Remove this row",onClick:()=>d(c.filter(b=>b.id!==a.id)),children:(0,b.jsx)(n.X,{})})]},a.id)),(0,b.jsxs)(q.Button,{variant:"outline",size:"sm",onClick:()=>d([...c,af()]),children:[(0,b.jsx)(g.Plus,{}),"Add"]})]})]})}let af=(a="",b="")=>({id:crypto.randomUUID(),key:a,value:b}),ag=a=>Object.entries(a??{}).map(([a,b])=>af(a,b)),ah=a=>{let b=a.filter(a=>a.key.trim());if(b.length)return Object.fromEntries(b.map(a=>[a.key.trim(),a.value]))},ai=`/** STDIO Example */
4
4
  {
@@ -1,4 +1,4 @@
1
- module.exports=[857022,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(752562),e=a.i(141146),f=a.i(164831);let g={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};g.node;let h=(0,f.default)(g);var i=a.i(403512),j=a.i(951675),k=a.i(474215),l=a.i(572131),m=a.i(767561),n=a.i(340695),o=a.i(316474),p=a.i(205522),q=a.i(446181),r=a.i(950463),s=a.i(621958),t=a.i(546893),u=a.i(287702),v=a.i(379630),w=a.i(61876),x=a.i(275086),y=a.i(172654),z=a.i(327598);let A={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};A.node;let B=(0,f.default)(A);var C=a.i(589027),D=a.i(875160);let E={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};E.node;let F=(0,f.default)(E);var G=a.i(545097),H=a.i(608902),I=a.i(421042),J=a.i(497895);let K=new y.DefaultChatTransport({api:m.queryKey.memoryEdit});function L({notes:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,l.useState)({provider:null,model:""}),[g,h]=(0,l.useState)(!1),{messages:i,sendMessage:j,setMessages:k,status:m,stop:o,error:p,clearError:q}=(0,x.useChat)({transport:K}),r=(0,l.useRef)(o);r.current=o,(0,l.useEffect)(()=>()=>{r.current()},[]);let s=(0,l.useRef)(new Map);for(let b of a)for(let a of b.facts)s.current.set(a.id,{text:a.text,path:b.path});let t="submitted"===m||"streaming"===m,u=!!(e.provider&&e.model.trim()),w=[...i].reverse().find(a=>"assistant"===a.role),A=w?.parts??[],B=A.filter(y.isToolUIPart),D=A.flatMap(a=>"text"===a.type?[a.text]:[]).join(" ").trim(),E=!!p||B.some(a=>"output-error"===a.state),F=B.filter(a=>"output-available"===a.state&&(0,y.getToolName)(a)!==I.TOOL_NAMES.memory_recall).length;(0,l.useEffect)(()=>{if("ready"!==m||E||0===i.length)return;let a=setTimeout(()=>k([]),4e3);return()=>clearTimeout(a)},[m,E,i.length,k]);let M=t?(0,b.jsx)(G.ShinyText,{text:"Working on memory",className:"text-xs"}):p?(0,b.jsx)("span",{className:"text-xs text-destructive",children:p.message}):w?(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:D||(0===F?"Nothing to change":1===F?"1 change saved":`${F} changes saved`)}):null;return(0,b.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[g&&(0,b.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,b.jsx)(H.ModelPicker,{provider:e.provider,model:e.model,unset:"Provider",onChange:f})}),B.length>0&&(0,b.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:B.map(a=>(0,b.jsx)(N,{name:(0,y.getToolName)(a),input:a.input,state:a.state,errorText:"output-error"===a.state?a.errorText:void 0,known:s.current},a.toolCallId))}),M&&(0,b.jsx)("p",{className:"max-w-full truncate px-1",children:M}),(0,b.jsxs)("form",{onSubmit:a=>{a.preventDefault();let b=c.trim();b&&u&&!t&&(d(""),h(!1),q(),k([]),j({text:b},{body:{model:e}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,b.jsx)("input",{autoFocus:!0,value:c,onChange:a=>d(a.target.value),disabled:t,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,b.jsxs)(n.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>h(!g),className:(0,J.cn)("max-w-44",!u&&"text-muted-foreground"),children:[u&&e.provider?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.ProviderIcon,{provider:e.provider,className:"size-3"}),(0,b.jsx)("span",{className:"truncate",children:e.model})]}):"Model",(0,b.jsx)(C.ChevronDown,{className:"text-muted-foreground"})]}),(0,b.jsx)(n.Button,{type:"submit",size:"icon-sm",loading:t,disabled:!c.trim()||!u||t,"aria-label":"Send",children:!t&&(0,b.jsx)(z.ArrowUp,{})})]})]})})}let M={Remember:i.Plus,Replace:h,Forget:F,Rename:h,Opened:B};function N({name:a,input:c,state:e,errorText:f,known:g}){let h=function(a,b,c){if(a===I.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(b??{}).path??"",lines:[]};if(a===I.TOOL_NAMES.memory_describe){let a=b??{};return{kind:"Rename",path:a.path??"",lines:a.description?[{after:`“${a.description}”`}]:[]}}if(a===I.TOOL_NAMES.memory_forget){let a=((b??{}).factIds??[]).filter(a=>null!=a),d=a.map(a=>c.get(a));return{kind:"Forget",path:d.find(a=>a)?.path??"",lines:a.map((a,b)=>({before:d[b]?.text??`Fact #${a}`}))}}let d=b??{},e=d.path??"",f=(d.facts??[]).filter(a=>null!=a),g=f.map(a=>null!=a.replaces?{before:c.get(a.replaces)?.text??`Fact #${a.replaces}`,after:a.text}:{after:a.text});return a===I.TOOL_NAMES.memory_create&&d.description&&g.unshift({after:`“${d.description}”`}),{kind:f.some(a=>null!=a.replaces)?"Replace":"Remember",path:e,lines:g}}(a,c,g),i=M[h.kind],j="output-error"===e;return(0,b.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,b.jsx)(i,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[h.lines.map((a,c)=>(0,b.jsxs)("div",{children:[a.before&&(0,b.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:a.before}),a.after&&(0,b.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:a.after})]},`${h.kind}-${c}`)),(0,b.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[h.kind,h.path&&` \xb7 ${h.path}`]}),j&&f&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:f})]}),(0,b.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:j?(0,b.jsx)(k.X,{className:"size-3.5 text-destructive"}):"output-available"===e?(0,b.jsx)(d.Check,{className:"size-3.5"}):(0,b.jsx)(D.Loader2,{className:"size-3.5 animate-spin"})})]})}var O=a.i(405050);let P=(0,O.createServerReference)("7f36ef65e0999e581019f3781598593e1adfca7e9f",O.callServer,void 0,O.findSourceMapURL,"addFactsAction"),Q=(0,O.createServerReference)("7f809fadf05dfd1471be3deb91f50e730f88e052e2",O.callServer,void 0,O.findSourceMapURL,"createNoteAction"),R=(0,O.createServerReference)("7fe69846bef49475439ac13aeaba84c330f55581ff",O.callServer,void 0,O.findSourceMapURL,"deleteNoteAction"),S=(0,O.createServerReference)("7f573722a43fd1090aadde790cab56c124f87018c6",O.callServer,void 0,O.findSourceMapURL,"forgetFactAction"),T=(0,O.createServerReference)("7fa82e367938237be61dd9ea0fc9d471c03a34f351",O.callServer,void 0,O.findSourceMapURL,"reviseFactAction"),U=(0,O.createServerReference)("7f8d038ee9171376dc45bd6395a34683e6c3072e84",O.callServer,void 0,O.findSourceMapURL,"updateNoteAction");var V=a.i(156757),W=a.i(199169);let X=V.z.enum(["user","call","bot"]);V.z.string().trim().min(1,"A note needs a line saying what it is about").max(u.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${u.MEMORY_LIMITS.descriptionChars} characters`);let Y=V.z.object({id:V.z.number(),text:V.z.string(),source:X.nullish(),createdAt:W.DateLikeSchema});V.z.object({id:V.z.number(),path:V.z.string(),description:V.z.string(),ownedByUser:V.z.boolean(),hits:V.z.number(),lastReadAt:W.DateLikeSchema.nullable(),createdAt:W.DateLikeSchema,updatedAt:W.DateLikeSchema,factCount:V.z.number(),facts:Y.array()});let Z=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],$=Z.filter(a=>!a.path.endsWith("/")).map(a=>a.path),_=Z.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1));RegExp(`^(?:${$.join("|")}|(?:${_.join("|")})/.+)$`);var aa=a.i(619477),ab=a.i(332033),ac=a.i(313237),ad=a.i(862966),ae=a.i(759497);let af=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ag={onOk:()=>(0,ae.revalidate)(m.queryKey.memory)},ah=w.textModelProviderSchema.options.filter(a=>"chatgpt"!==a).slice(0,3);function ai(){return(0,b.jsx)("span",{className:"mr-0.5 flex items-center",children:ah.map(a=>(0,b.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,b.jsx)(v.ProviderIcon,{provider:a,className:"size-3"})},a))})}function aj(a,b){return c=>{(0,ab.composing)(c)||("Enter"===c.key&&(c.preventDefault(),a()),"Escape"===c.key&&(c.stopPropagation(),b()))}}function ak({note:a,open:c,onToggle:d}){var f;let g,i,k,m,o,[p,r]=(0,l.useState)(!1),[s,t]=(0,ac.useServerAction)(R,ag),u=async()=>{await q.notify.confirm({title:`Forget ${a.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&s(a.id)},v=(0,b.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(g=(f=a.path).indexOf("/"))?f:f.slice(g+1)});return(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),v,(0,b.jsx)(al,{note:a,onDone:()=>r(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("button",{type:"button","aria-expanded":c,onClick:d,className:(0,J.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(i=a.path,!$.includes(i)&&.15>(k=(0,W.toDate)(a.lastReadAt??a.createdAt),m=Math.max(0,(Date.now()-k.getTime())/864e5),(a.hits+1)/(1+m))&&!c&&"opacity-55")),children:[(0,b.jsx)(e.ChevronRight,{className:(0,J.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),v,(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:a.description}),(0,b.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[a.factCount," ",1===a.factCount?"fact":"facts"]}),(0,b.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:a.lastReadAt?"Last read back":"Never read back",children:a.lastReadAt?(0,W.shortAgo)(a.lastReadAt):"—"})]}),(0,b.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:c&&(0,b.jsxs)(b.Fragment,{children:[(o=a.path,!$.includes(o)&&(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>r(!0),children:(0,b.jsx)(h,{})})),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:t,onClick:u,children:!t&&(0,b.jsx)(j.Trash2,{})})]})})]})}),c&&(0,b.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,b.jsx)(am,{noteId:a.id}),a.facts.map(c=>(0,b.jsx)(an,{noteId:a.id,fact:c},c.id))]})]})}function al({note:a,onDone:c}){let[e,f]=(0,l.useState)(a.description),[g,h]=(0,ac.useServerAction)(U,{onOk:()=>{c(),(0,ae.revalidate)(m.queryKey.memory)}}),i=()=>{let b=e.trim();if(!b||b===a.description)return c();g(a.id,{description:b})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:e,onChange:a=>f(a.target.value),onKeyDown:aj(i,c),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:h,onClick:i,children:!h&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:c,children:(0,b.jsx)(k.X,{})})]})}function am({noteId:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,ac.useServerAction)(P,{onOk:()=>{d(""),(0,ae.revalidate)(m.queryKey.memory)}}),g=()=>{let b=c.trim();b&&!f&&e(a,[b])};return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,b.jsx)(p.Input,{value:c,onChange:a=>d(a.target.value),onKeyDown:aj(g,()=>d("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",loading:f,disabled:!c.trim(),onClick:g,children:[!f&&(0,b.jsx)(i.Plus,{}),"Add"]})]})}function an({noteId:a,fact:e}){let f,[g,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(e.text),[s,t]=(0,ac.useServerAction)(T,{onOk:()=>{i(!1),(0,ae.revalidate)(m.queryKey.memory)}}),[u,v]=(0,ac.useServerAction)(S,ag),w=async()=>{await q.notify.confirm({title:"Forget this fact?",description:`"${e.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&u(a,e.id)},x=()=>{let b=o.trim();if(!b||b===e.text)return i(!1);s(a,e.id,b)},y="user"===(f=e.source)?"you":"call"===f?"on a call":"bot"===f?"a bot":"";return(0,b.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:o,onChange:a=>r(a.target.value),onKeyDown:aj(x,()=>i(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:t,onClick:x,children:!t&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>i(!1),children:(0,b.jsx)(k.X,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:e.text}),(0,b.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,c.format)(e.createdAt,"yyyy.MM.dd"),y&&` \xb7 ${y}`]}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{r(e.text),i(!0)},children:(0,b.jsx)(h,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:v,onClick:()=>void w(),children:!v&&(0,b.jsx)(j.Trash2,{})})]})})}let ao=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ap(){return q.notify.component({className:"sm:max-w-lg",renderer:({close:a})=>(0,b.jsx)(aq,{onDone:a})})}function aq({onDone:a}){let[c,d]=(0,l.useState)("people"),[e,f]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[j,k]=(0,l.useState)(""),[q,r,,v]=(0,ac.useServerAction)(Q,{errorMessage:!1,onOk:()=>{(0,ae.revalidate)(m.queryKey.memory),a()}}),w=ao.find(a=>a.key===c),x=e.trim()&&g.trim()&&!r,y=()=>{x&&q(`${c}/${e.trim()}`,g.trim(),j.split("\n").map(a=>a.trim()).filter(Boolean))};return(0,b.jsxs)(aa.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(n.Button,{disabled:!x,loading:r,onClick:y,children:[!r&&(0,b.jsx)(i.Plus,{}),"Create"]})]}),children:[(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{children:"Kind"}),(0,b.jsx)(s.Tabs,{value:c,onValueChange:a=>d(a),children:(0,b.jsx)(s.TabsList,{className:"w-full",children:ao.map(a=>(0,b.jsx)(s.TabsTrigger,{value:a.key,children:a.label},a.key))})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,b.jsxs)(o.FieldContent,{children:[(0,b.jsx)(p.Input,{id:"note-name",value:e,onChange:a=>f(a.target.value),placeholder:w?.placeholder,spellCheck:!1,required:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[c,"/",e.trim()||"…"]})]})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,b.jsx)(o.FieldContent,{children:(0,b.jsx)(p.Input,{id:"note-summary",value:g,onChange:a=>h(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||229===a.keyCode||"Enter"===a.key&&y()},placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,b.jsx)(t.Textarea,{id:"note-facts",value:j,onChange:a=>k(a.target.value),placeholder:`One per line
1
+ module.exports=[857022,a=>{"use strict";var b=a.i(187924),c=a.i(256711),d=a.i(752562),e=a.i(141146),f=a.i(164831);let g={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};g.node;let h=(0,f.default)(g);var i=a.i(403512),j=a.i(951675),k=a.i(474215),l=a.i(572131),m=a.i(767561),n=a.i(340695),o=a.i(316474),p=a.i(205522),q=a.i(446181),r=a.i(950463),s=a.i(621958),t=a.i(546893),u=a.i(287702),v=a.i(379630),w=a.i(61876),x=a.i(275086),y=a.i(172654),z=a.i(327598);let A={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};A.node;let B=(0,f.default)(A);var C=a.i(589027),D=a.i(875160);let E={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};E.node;let F=(0,f.default)(E);var G=a.i(545097),H=a.i(608902),I=a.i(421042),J=a.i(497895);let K=new y.DefaultChatTransport({api:m.queryKey.memoryEdit});function L({notes:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,l.useState)({provider:null,model:""}),[g,h]=(0,l.useState)(!1),{messages:i,sendMessage:j,setMessages:k,status:m,stop:o,error:p,clearError:q}=(0,x.useChat)({transport:K}),r=(0,l.useRef)(o);r.current=o,(0,l.useEffect)(()=>()=>{r.current()},[]);let s=(0,l.useRef)(new Map);for(let b of a)for(let a of b.facts)s.current.set(a.id,{text:a.text,path:b.path});let t="submitted"===m||"streaming"===m,u=!!(e.provider&&e.model.trim()),w=[...i].reverse().find(a=>"assistant"===a.role),A=w?.parts??[],B=A.filter(y.isToolUIPart),D=A.flatMap(a=>"text"===a.type?[a.text]:[]).join(" ").trim(),E=!!p||B.some(a=>"output-error"===a.state),F=B.filter(a=>"output-available"===a.state&&(0,y.getToolName)(a)!==I.TOOL_NAMES.memory_recall).length;(0,l.useEffect)(()=>{if("ready"!==m||E||0===i.length)return;let a=setTimeout(()=>k([]),4e3);return()=>clearTimeout(a)},[m,E,i.length,k]);let M=t?(0,b.jsx)(G.ShinyText,{text:"Working on memory",className:"text-xs"}):p?(0,b.jsx)("span",{className:"text-xs text-destructive",children:p.message}):w?(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:D||(0===F?"Nothing to change":1===F?"1 change saved":`${F} changes saved`)}):null;return(0,b.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[g&&(0,b.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,b.jsx)(H.ModelPicker,{provider:e.provider,model:e.model,unset:"Provider",onChange:f})}),B.length>0&&(0,b.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:B.map(a=>(0,b.jsx)(N,{name:(0,y.getToolName)(a),input:a.input,state:a.state,errorText:"output-error"===a.state?a.errorText:void 0,known:s.current},a.toolCallId))}),M&&(0,b.jsx)("p",{className:"max-w-full truncate px-1",children:M}),(0,b.jsxs)("form",{onSubmit:a=>{a.preventDefault();let b=c.trim();b&&u&&!t&&(d(""),h(!1),q(),k([]),j({text:b},{body:{model:e}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,b.jsx)("input",{autoFocus:!0,value:c,onChange:a=>d(a.target.value),disabled:t,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,b.jsxs)(n.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>h(!g),className:(0,J.cn)("max-w-44",!u&&"text-muted-foreground"),children:[u&&e.provider?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.ProviderIcon,{provider:e.provider,className:"size-3"}),(0,b.jsx)("span",{className:"truncate",children:e.model})]}):"Model",(0,b.jsx)(C.ChevronDown,{className:"text-muted-foreground"})]}),(0,b.jsx)(n.Button,{type:"submit",size:"icon-sm",loading:t,disabled:!c.trim()||!u||t,"aria-label":"Send",children:!t&&(0,b.jsx)(z.ArrowUp,{})})]})]})})}let M={Remember:i.Plus,Replace:h,Forget:F,Rename:h,Opened:B};function N({name:a,input:c,state:e,errorText:f,known:g}){let h=function(a,b,c){if(a===I.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(b??{}).path??"",lines:[]};if(a===I.TOOL_NAMES.memory_describe){let a=b??{};return{kind:"Rename",path:a.path??"",lines:a.description?[{after:`“${a.description}”`}]:[]}}if(a===I.TOOL_NAMES.memory_forget){let a=((b??{}).factIds??[]).filter(a=>null!=a),d=a.map(a=>c.get(a));return{kind:"Forget",path:d.find(a=>a)?.path??"",lines:a.map((a,b)=>({before:d[b]?.text??`Fact #${a}`}))}}let d=b??{},e=d.path??"",f=(d.facts??[]).filter(a=>null!=a),g=f.map(a=>null!=a.replaces?{before:c.get(a.replaces)?.text??`Fact #${a.replaces}`,after:a.text}:{after:a.text});return a===I.TOOL_NAMES.memory_create&&d.description&&g.unshift({after:`“${d.description}”`}),{kind:f.some(a=>null!=a.replaces)?"Replace":"Remember",path:e,lines:g}}(a,c,g),i=M[h.kind],j="output-error"===e;return(0,b.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,b.jsx)(i,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[h.lines.map((a,c)=>(0,b.jsxs)("div",{children:[a.before&&(0,b.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:a.before}),a.after&&(0,b.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:a.after})]},`${h.kind}-${c}`)),(0,b.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[h.kind,h.path&&` \xb7 ${h.path}`]}),j&&f&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:f})]}),(0,b.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:j?(0,b.jsx)(k.X,{className:"size-3.5 text-destructive"}):"output-available"===e?(0,b.jsx)(d.Check,{className:"size-3.5"}):(0,b.jsx)(D.Loader2,{className:"size-3.5 animate-spin"})})]})}var O=a.i(405050);let P=(0,O.createServerReference)("7fc9ce111da41e854550d81d32040be514de06366a",O.callServer,void 0,O.findSourceMapURL,"addFactsAction"),Q=(0,O.createServerReference)("7f2fc0f6577174ca8ef3955b0b5f9671954efec55a",O.callServer,void 0,O.findSourceMapURL,"createNoteAction"),R=(0,O.createServerReference)("7f80c8dd127a02226d22e682b03a84fd9519251004",O.callServer,void 0,O.findSourceMapURL,"deleteNoteAction"),S=(0,O.createServerReference)("7f9f8c21fd08fa9fabd5c917a315a90274cb0f49c0",O.callServer,void 0,O.findSourceMapURL,"forgetFactAction"),T=(0,O.createServerReference)("7f2eb399eb579824b1370715048ff178b0a8875b2e",O.callServer,void 0,O.findSourceMapURL,"reviseFactAction"),U=(0,O.createServerReference)("7f73c45e7c56401b782e74a6d54385b56aa00f1001",O.callServer,void 0,O.findSourceMapURL,"updateNoteAction");var V=a.i(156757),W=a.i(199169);let X=V.z.enum(["user","call","bot"]);V.z.string().trim().min(1,"A note needs a line saying what it is about").max(u.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${u.MEMORY_LIMITS.descriptionChars} characters`);let Y=V.z.object({id:V.z.number(),text:V.z.string(),source:X.nullish(),createdAt:W.DateLikeSchema});V.z.object({id:V.z.number(),path:V.z.string(),description:V.z.string(),ownedByUser:V.z.boolean(),hits:V.z.number(),lastReadAt:W.DateLikeSchema.nullable(),createdAt:W.DateLikeSchema,updatedAt:W.DateLikeSchema,factCount:V.z.number(),facts:Y.array()});let Z=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],$=Z.filter(a=>!a.path.endsWith("/")).map(a=>a.path),_=Z.filter(a=>a.path.endsWith("/")).map(a=>a.path.slice(0,-1));RegExp(`^(?:${$.join("|")}|(?:${_.join("|")})/.+)$`);var aa=a.i(619477),ab=a.i(332033),ac=a.i(313237),ad=a.i(862966),ae=a.i(759497);let af=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ag={onOk:()=>(0,ae.revalidate)(m.queryKey.memory)},ah=w.textModelProviderSchema.options.filter(a=>"chatgpt"!==a).slice(0,3);function ai(){return(0,b.jsx)("span",{className:"mr-0.5 flex items-center",children:ah.map(a=>(0,b.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,b.jsx)(v.ProviderIcon,{provider:a,className:"size-3"})},a))})}function aj(a,b){return c=>{(0,ab.composing)(c)||("Enter"===c.key&&(c.preventDefault(),a()),"Escape"===c.key&&(c.stopPropagation(),b()))}}function ak({note:a,open:c,onToggle:d}){var f;let g,i,k,m,o,[p,r]=(0,l.useState)(!1),[s,t]=(0,ac.useServerAction)(R,ag),u=async()=>{await q.notify.confirm({title:`Forget ${a.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&s(a.id)},v=(0,b.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(g=(f=a.path).indexOf("/"))?f:f.slice(g+1)});return(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),v,(0,b.jsx)(al,{note:a,onDone:()=>r(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("button",{type:"button","aria-expanded":c,onClick:d,className:(0,J.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(i=a.path,!$.includes(i)&&.15>(k=(0,W.toDate)(a.lastReadAt??a.createdAt),m=Math.max(0,(Date.now()-k.getTime())/864e5),(a.hits+1)/(1+m))&&!c&&"opacity-55")),children:[(0,b.jsx)(e.ChevronRight,{className:(0,J.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),v,(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:a.description}),(0,b.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[a.factCount," ",1===a.factCount?"fact":"facts"]}),(0,b.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:a.lastReadAt?"Last read back":"Never read back",children:a.lastReadAt?(0,W.shortAgo)(a.lastReadAt):"—"})]}),(0,b.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:c&&(0,b.jsxs)(b.Fragment,{children:[(o=a.path,!$.includes(o)&&(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>r(!0),children:(0,b.jsx)(h,{})})),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:t,onClick:u,children:!t&&(0,b.jsx)(j.Trash2,{})})]})})]})}),c&&(0,b.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,b.jsx)(am,{noteId:a.id}),a.facts.map(c=>(0,b.jsx)(an,{noteId:a.id,fact:c},c.id))]})]})}function al({note:a,onDone:c}){let[e,f]=(0,l.useState)(a.description),[g,h]=(0,ac.useServerAction)(U,{onOk:()=>{c(),(0,ae.revalidate)(m.queryKey.memory)}}),i=()=>{let b=e.trim();if(!b||b===a.description)return c();g(a.id,{description:b})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:e,onChange:a=>f(a.target.value),onKeyDown:aj(i,c),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:h,onClick:i,children:!h&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:c,children:(0,b.jsx)(k.X,{})})]})}function am({noteId:a}){let[c,d]=(0,l.useState)(""),[e,f]=(0,ac.useServerAction)(P,{onOk:()=>{d(""),(0,ae.revalidate)(m.queryKey.memory)}}),g=()=>{let b=c.trim();b&&!f&&e(a,[b])};return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,b.jsx)(p.Input,{value:c,onChange:a=>d(a.target.value),onKeyDown:aj(g,()=>d("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",loading:f,disabled:!c.trim(),onClick:g,children:[!f&&(0,b.jsx)(i.Plus,{}),"Add"]})]})}function an({noteId:a,fact:e}){let f,[g,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(e.text),[s,t]=(0,ac.useServerAction)(T,{onOk:()=>{i(!1),(0,ae.revalidate)(m.queryKey.memory)}}),[u,v]=(0,ac.useServerAction)(S,ag),w=async()=>{await q.notify.confirm({title:"Forget this fact?",description:`"${e.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&u(a,e.id)},x=()=>{let b=o.trim();if(!b||b===e.text)return i(!1);s(a,e.id,b)},y="user"===(f=e.source)?"you":"call"===f?"on a call":"bot"===f?"a bot":"";return(0,b.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Input,{autoFocus:!0,value:o,onChange:a=>r(a.target.value),onKeyDown:aj(x,()=>i(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:t,onClick:x,children:!t&&(0,b.jsx)(d.Check,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>i(!1),children:(0,b.jsx)(k.X,{})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:e.text}),(0,b.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,c.format)(e.createdAt,"yyyy.MM.dd"),y&&` \xb7 ${y}`]}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{r(e.text),i(!0)},children:(0,b.jsx)(h,{})}),(0,b.jsx)(n.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:v,onClick:()=>void w(),children:!v&&(0,b.jsx)(j.Trash2,{})})]})})}let ao=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ap(){return q.notify.component({className:"sm:max-w-lg",renderer:({close:a})=>(0,b.jsx)(aq,{onDone:a})})}function aq({onDone:a}){let[c,d]=(0,l.useState)("people"),[e,f]=(0,l.useState)(""),[g,h]=(0,l.useState)(""),[j,k]=(0,l.useState)(""),[q,r,,v]=(0,ac.useServerAction)(Q,{errorMessage:!1,onOk:()=>{(0,ae.revalidate)(m.queryKey.memory),a()}}),w=ao.find(a=>a.key===c),x=e.trim()&&g.trim()&&!r,y=()=>{x&&q(`${c}/${e.trim()}`,g.trim(),j.split("\n").map(a=>a.trim()).filter(Boolean))};return(0,b.jsxs)(aa.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.Button,{variant:"ghost",onClick:a,children:"Cancel"}),(0,b.jsxs)(n.Button,{disabled:!x,loading:r,onClick:y,children:[!r&&(0,b.jsx)(i.Plus,{}),"Create"]})]}),children:[(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{children:"Kind"}),(0,b.jsx)(s.Tabs,{value:c,onValueChange:a=>d(a),children:(0,b.jsx)(s.TabsList,{className:"w-full",children:ao.map(a=>(0,b.jsx)(s.TabsTrigger,{value:a.key,children:a.label},a.key))})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,b.jsxs)(o.FieldContent,{children:[(0,b.jsx)(p.Input,{id:"note-name",value:e,onChange:a=>f(a.target.value),placeholder:w?.placeholder,spellCheck:!1,required:!0}),(0,b.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[c,"/",e.trim()||"…"]})]})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,b.jsx)(o.FieldContent,{children:(0,b.jsx)(p.Input,{id:"note-summary",value:g,onChange:a=>h(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||229===a.keyCode||"Enter"===a.key&&y()},placeholder:"One line Thursday sees in her list",maxLength:u.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,b.jsxs)(o.Field,{children:[(0,b.jsx)(o.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,b.jsx)(t.Textarea,{id:"note-facts",value:j,onChange:a=>k(a.target.value),placeholder:`One per line
2
2
  ${w?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),v&&(0,b.jsx)("p",{className:"font-mono text-xs text-destructive",children:v})]})}a.s(["MemorySetting",0,function(){let{items:a,isLoading:c,isLoadingMore:d,error:e,hasMore:f,sentinelRef:g}=(0,ad.useServerPages)({key:a=>m.queryKey.memoryPage(a*u.PAGE_SIZE)}),[h,j]=(0,l.useState)(""),[k,o]=(0,l.useState)(new Set),[p,q]=(0,l.useState)(!1);if(c)return(0,b.jsx)(aa.SettingSkeleton,{});if(e)return(0,b.jsx)(aa.SettingError,{message:e.message});let s=h.trim().toLowerCase(),t=s?a.filter(a=>[a.path,a.description,...a.facts.map(a=>a.text)].some(a=>a.toLowerCase().includes(s))):a,v=a.reduce((a,b)=>a+b.factCount,0),w=f?"+":"";return(0,b.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,b.jsxs)(aa.SettingScreen,{footer:(0,b.jsxs)(n.Button,{size:"sm",variant:p?"secondary":"ghost","aria-pressed":p,onClick:()=>q(!p),children:[(0,b.jsx)(ai,{}),"Edit with a model"]}),children:[(0,b.jsx)(aa.SettingToolbar,{count:(0,b.jsxs)("span",{className:"flex items-center gap-3",children:[`${a.length}${w} notes \xb7 ${v}${w} facts`,(0,b.jsxs)(n.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ap,children:[(0,b.jsx)(i.Plus,{}),"New note"]})]}),children:(0,b.jsx)(aa.SettingFilter,{value:h,onChange:j,placeholder:"Filter memory"})}),s&&0===t.length&&(0,b.jsx)("p",{className:"px-1 text-xs text-muted-foreground/60",children:"Nothing matches"}),af.map(({key:a,label:c})=>{let d=t.filter(b=>(function(a){if($.includes(a))return"you";let b=a.slice(0,a.indexOf("/"));return _.includes(b)?b:"other"})(b.path)===a);return 0===d.length?null:(0,b.jsx)(aa.SettingGroup,{label:c,children:(0,b.jsx)(aa.SettingItems,{children:d.map(a=>(0,b.jsx)(ak,{note:a,open:k.has(a.id)!==!!s,onToggle:()=>{let b;return b=a.id,o(a=>{let c=new Set(a);return c.delete(b)||c.add(b),c})}},a.id))})},a)}),(0,b.jsx)(aa.SettingMore,{hasMore:f,loading:d,sentinelRef:g,ghost:(0,b.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,b.jsx)(r.Skeleton,{className:"h-3 w-24"}),(0,b.jsx)(r.Skeleton,{className:"h-3 w-56"})]})})]}),p&&(0,b.jsx)(L,{notes:a})]})}],857022)}];
3
3
 
4
4
  //# sourceMappingURL=features_memory_components_memory-setting_tsx_0oa43sw._.js.map