@decocms/mesh 2.12.0 → 2.13.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 (144) hide show
  1. package/dist/client/assets/{AlertCircle-Cso_Xxvk.js → AlertCircle-CtP28Oyz.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-BrsZ2N_5.js → ArrowLeft-Bps-R0_t.js} +1 -1
  3. package/dist/client/assets/{Check-JFkjTCfG.js → Check-Bkw0Gz-n.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-HtFMO0lw.js → ChevronDown-mvTJP4-S.js} +1 -1
  5. package/dist/client/assets/{Clock-CW5u1cfj.js → Clock-DiHiAbv6.js} +1 -1
  6. package/dist/client/assets/{Code01-CgNchnl3.js → Code01-CTUZx8UP.js} +1 -1
  7. package/dist/client/assets/{Copy01-Dadp_RDG.js → Copy01-BctGx-5E.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-B0A7sUYv.js → DotsHorizontal-MMZ1EZhB.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BHUUUCDx.js → DotsVertical-CzCtj25W.js} +1 -1
  10. package/dist/client/assets/{Edit01-CxRkZTQ1.js → Edit01-BD5iJRQz.js} +1 -1
  11. package/dist/client/assets/{File06-D0TXCuMx.js → File06-nV81V8TD.js} +1 -1
  12. package/dist/client/assets/{FilterLines-_uykt7r4.js → FilterLines-CBfbdjv3.js} +1 -1
  13. package/dist/client/assets/{FlipBackward-GGMv99yc.js → FlipBackward-CpWoOBPz.js} +1 -1
  14. package/dist/client/assets/{GitBranch01-BUTuezlq.js → GitBranch01-DWYSSAGj.js} +1 -1
  15. package/dist/client/assets/{Grid01-BbdtRdR8.js → Grid01-BEpepbVy.js} +1 -1
  16. package/dist/client/assets/{Inbox01-CgwXLK3n.js → Inbox01-DkMyh-FB.js} +1 -1
  17. package/dist/client/assets/{InfoCircle-D6qJG9Nl.js → InfoCircle-BXctEVkS.js} +1 -1
  18. package/dist/client/assets/{Key01-8ewaPBuD.js → Key01-ChIWeKNh.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-D0Wjfr3t.js → LinkExternal01-By7zx70s.js} +1 -1
  20. package/dist/client/assets/{Loading01-NW_f44Lz.js → Loading01-CdaWSExX.js} +1 -1
  21. package/dist/client/assets/{Lock01-BTPtPjN4.js → Lock01-txD_UwBx.js} +1 -1
  22. package/dist/client/assets/{Play-CIMfsFF1.js → Play-CjVz5-Yt.js} +1 -1
  23. package/dist/client/assets/{Plus-DaP4KLuJ.js → Plus-CovnOzP9.js} +1 -1
  24. package/dist/client/assets/{SearchMd-tOSOFUes.js → SearchMd-YxKkBPG0.js} +1 -1
  25. package/dist/client/assets/{Terminal-ANRX3jJ8.js → Terminal-DYwA22tz.js} +1 -1
  26. package/dist/client/assets/{Trash01-CjDzx3jP.js → Trash01-DopdNXEu.js} +1 -1
  27. package/dist/client/assets/{X-D3ljCSd1.js → X-DcqsnRSe.js} +1 -1
  28. package/dist/client/assets/{XClose-Ba3zyI0J.js → XClose-D0utLGU3.js} +1 -1
  29. package/dist/client/assets/{alert-dialog-_Gzpv9vf.js → alert-dialog-B2ogXLEp.js} +1 -1
  30. package/dist/client/assets/{auth-C9dSkS_x.js → auth-CNkA6dk2.js} +1 -1
  31. package/dist/client/assets/{auth-catchall-DRL5ZGJM.js → auth-catchall-BG5YjEP_.js} +1 -1
  32. package/dist/client/assets/{avatar-D1o5pnzU.js → avatar-KT16fAYd.js} +1 -1
  33. package/dist/client/assets/{badge-0b6sJe4S.js → badge-8BCP2QJ_.js} +1 -1
  34. package/dist/client/assets/{card-B3fsloDi.js → card-XgDm8_H9.js} +1 -1
  35. package/dist/client/assets/{checkbox-2xIaHvS4.js → checkbox-B9Ss6ffk.js} +1 -1
  36. package/dist/client/assets/{collection-detail-Bu5gtjud.js → collection-detail-BJvqsPlx.js} +1 -1
  37. package/dist/client/assets/{collection-display-button-BGIcja12.js → collection-display-button-DroTLKfu.js} +1 -1
  38. package/dist/client/assets/{collection-header-DhWbmVkk.js → collection-header-CUphFaJM.js} +1 -1
  39. package/dist/client/assets/{collection-page-B4ZjGX9V.js → collection-page-C8c74lBQ.js} +1 -1
  40. package/dist/client/assets/{collection-search-CYZk6T6Z.js → collection-search-DIEJ7x7R.js} +1 -1
  41. package/dist/client/assets/{collection-tab-IeT0mJ-2.js → collection-tab-BQr3sv8I.js} +1 -1
  42. package/dist/client/assets/{collection-table-wrapper-D2niE2Ci.js → collection-table-wrapper-x8zydyA0.js} +1 -1
  43. package/dist/client/assets/{connection-card-D0c_wvmz.js → connection-card-CTMXB5Zh.js} +1 -1
  44. package/dist/client/assets/{connection-detail-BmNPUV8x.js → connection-detail-BU82m59Z.js} +1 -1
  45. package/dist/client/assets/{connections-U2y3agtD.js → connections-B-zsqKwM.js} +1 -1
  46. package/dist/client/assets/constants-8DEiLmV-.js +1 -0
  47. package/dist/client/assets/{create-organization-dialog-D0WQQsLG.js → create-organization-dialog-CHS4cOdy.js} +1 -1
  48. package/dist/client/assets/{dialog-BXeLl5mO.js → dialog-D9LHhl79.js} +1 -1
  49. package/dist/client/assets/{dropdown-menu-CnL8UM0z.js → dropdown-menu-DjFWyTtD.js} +1 -1
  50. package/dist/client/assets/{empty-state-BmkZOMzL.js → empty-state-DSGxvcRL.js} +1 -1
  51. package/dist/client/assets/{empty-state-DzS1Zp7m.js → empty-state-DgOO5bI1.js} +1 -1
  52. package/dist/client/assets/env-vars-editor-mM2KyO-W.js +1 -0
  53. package/dist/client/assets/{error-boundary-BQnJ9S9E.js → error-boundary-uBvOVTCE.js} +1 -1
  54. package/dist/client/assets/extract-connection-data-DMhfaAiL.js +1 -0
  55. package/dist/client/assets/{form-DrOt6d2d.js → form-orY-xngM.js} +1 -1
  56. package/dist/client/assets/{gateway-detail-CniDbJPb.js → gateway-detail-Bnl2H9_J.js} +1 -1
  57. package/dist/client/assets/{gateways-DmEpJOpx.js → gateways-RS5E135D.js} +1 -1
  58. package/dist/client/assets/{home-HrkEcREJ.js → home-HRdtfNlr.js} +1 -1
  59. package/dist/client/assets/index-9MwexYU6.css +1 -0
  60. package/dist/client/assets/{index-CBIrwxtj.js → index-BuPukvJG.js} +3 -3
  61. package/dist/client/assets/{index-DMNk-OUX.js → index-Bz1LU39D.js} +2 -2
  62. package/dist/client/assets/{index-XOpbMEap.js → index-Cw3bkeXO.js} +1 -1
  63. package/dist/client/assets/{index-GoXtajA4.js → index-K2EwRRk6.js} +2 -2
  64. package/dist/client/assets/{index-Bb8rHnPb.js → index-o28bnKR9.js} +1 -1
  65. package/dist/client/assets/{input-68J17rBp.js → input-CtiQUsvV.js} +1 -1
  66. package/dist/client/assets/{layout-Olb4shdE.js → layout-C8G6tSLB.js} +1 -1
  67. package/dist/client/assets/{lazy-highlighter-Ccgc_fxj.js → lazy-highlighter-C5pGkBnk.js} +1 -1
  68. package/dist/client/assets/localstorage-keys-5oG1CfEQ.js +1 -0
  69. package/dist/client/assets/{login-UTKAAaeX.js → login-BvQHpiOu.js} +1 -1
  70. package/dist/client/assets/{mcp-oauth-Db8WtQ8u.js → mcp-oauth-BzcB2WNx.js} +1 -1
  71. package/dist/client/assets/mcp-server-card-BawKO-ZK.js +1 -0
  72. package/dist/client/assets/mcp-server-detail-CxrhH1J8.js +1 -0
  73. package/dist/client/assets/{members-V-vtwMYY.js → members-C0iWKqGR.js} +1 -1
  74. package/dist/client/assets/{monaco-editor-B_MycISs.js → monaco-editor-BmVBfnK5.js} +1 -1
  75. package/dist/client/assets/{monitoring-CBmCnQ7i.js → monitoring-7ik3wQUY.js} +1 -1
  76. package/dist/client/assets/{oauth-callback-BYBqbF1w.js → oauth-callback-Coasa0XK.js} +1 -1
  77. package/dist/client/assets/page-DsAOPS13.js +1 -0
  78. package/dist/client/assets/{page-DrIZd1pO.js → page-yu9K5Vtj.js} +1 -1
  79. package/dist/client/assets/{pin-to-sidebar-button-B1xHHS9n.js → pin-to-sidebar-button-C-akIZzz.js} +1 -1
  80. package/dist/client/assets/{popover-DC9U4d6e.js → popover-QWczrvYc.js} +1 -1
  81. package/dist/client/assets/{project-context-provider-BJIP5a-U.js → project-context-provider-_aLYBfO9.js} +1 -1
  82. package/dist/client/assets/registry-utils-BIzwINzW.js +1 -0
  83. package/dist/client/assets/{resizable-CW5_SPIS.js → resizable-djk090hC.js} +1 -1
  84. package/dist/client/assets/{resource-tabs-BKSlcL1W.js → resource-tabs-GXDudjH9.js} +1 -1
  85. package/dist/client/assets/{select-B9KJyTZZ.js → select-Bxj6_TSM.js} +1 -1
  86. package/dist/client/assets/{settings-CYg4YPRI.js → settings-0nIjjKRi.js} +1 -1
  87. package/dist/client/assets/{shell-layout-KIN6fL5j.js → shell-layout-BFIjeoYr.js} +1 -1
  88. package/dist/client/assets/{spinner-B0sczm1j.js → spinner-C7HX4n17.js} +1 -1
  89. package/dist/client/assets/{switch-BuVvmF04.js → switch-zovYrKoi.js} +1 -1
  90. package/dist/client/assets/{textarea-BAUX8Qgd.js → textarea-D76YOeHc.js} +1 -1
  91. package/dist/client/assets/{thread-history-popover-Dv63nk6L.js → thread-history-popover-BKo2wskT.js} +1 -1
  92. package/dist/client/assets/{tool-set-selector-DMsE0yRo.js → tool-set-selector-Dfdgsx2h.js} +1 -1
  93. package/dist/client/assets/{tools-list-Dgf0oqyC.js → tools-list-C2S7XIkI.js} +1 -1
  94. package/dist/client/assets/{use-binding-Dj4lal1A.js → use-binding-UNVemCFv.js} +1 -1
  95. package/dist/client/assets/{use-connection-DoWszS3j.js → use-connection-BXdeHsm0.js} +1 -1
  96. package/dist/client/assets/{use-connection-resources-BywYCfzc.js → use-connection-resources-C8cAy7Nl.js} +1 -1
  97. package/dist/client/assets/{use-create-gateway-Ca5SEa8I.js → use-create-gateway-D8vNiD2K.js} +1 -1
  98. package/dist/client/assets/{use-gateway-CRpsitbG.js → use-gateway-BhC1hXIm.js} +1 -1
  99. package/dist/client/assets/{use-gateway-system-prompt-B4ia2QxW.js → use-gateway-system-prompt-uetw6YB3.js} +1 -1
  100. package/dist/client/assets/{use-list-state-CPUcOhR_.js → use-list-state-CAv4RNZg.js} +1 -1
  101. package/dist/client/assets/{use-mcp-L2lisTXg.js → use-mcp-kCjFuvFP.js} +1 -1
  102. package/dist/client/assets/{use-members-7eRdYOTr.js → use-members-9nvpFN_1.js} +1 -1
  103. package/dist/client/assets/{use-mobile--ytA5LT5.js → use-mobile-sd5ko6M_.js} +1 -1
  104. package/dist/client/assets/{use-organization-settings-D6rXW2c_.js → use-organization-settings-DBRSoBd0.js} +1 -1
  105. package/dist/client/assets/{use-tool-call-BBonHr6l.js → use-tool-call-BLplGau6.js} +1 -1
  106. package/dist/client/assets/{value-Bd2XBV_y.js → value-DxHsXzsm.js} +1 -1
  107. package/dist/client/assets/{view-mode-toggle-BpjQ6V4P.js → view-mode-toggle-CVcyaB_S.js} +1 -1
  108. package/dist/client/assets/{workflow-CjynHD6b.js → workflow-BUV3CQv_.js} +1 -1
  109. package/dist/client/index.html +2 -2
  110. package/dist/server/cli.js +201 -201
  111. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/LICENSE +47 -0
  112. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/README.md +82 -0
  113. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.d.ts +11 -0
  114. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.mjs +43 -0
  115. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cjs +45 -0
  116. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.cjs +46 -0
  117. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.d.ts +11 -0
  118. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.d.ts +11 -0
  119. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.mjs +46 -0
  120. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.wasm +0 -0
  121. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.mts +83 -0
  122. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.ts +83 -0
  123. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js +2 -0
  124. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js.map +1 -0
  125. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs +2 -0
  126. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs.map +1 -0
  127. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.mts +20 -0
  128. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.ts +20 -0
  129. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js +2 -0
  130. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js.map +1 -0
  131. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs +2 -0
  132. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs.map +1 -0
  133. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/package.json +61 -0
  134. package/dist/server/server.js +197 -197
  135. package/package.json +1 -1
  136. package/dist/client/assets/constants-Cy709IUA.js +0 -1
  137. package/dist/client/assets/env-vars-editor-B_mIaT86.js +0 -1
  138. package/dist/client/assets/extract-connection-data-DPoJQhk8.js +0 -1
  139. package/dist/client/assets/index-ChrSnaFS.css +0 -1
  140. package/dist/client/assets/localstorage-keys-C62ZbWuB.js +0 -1
  141. package/dist/client/assets/mcp-server-detail-BvVQovUz.js +0 -1
  142. package/dist/client/assets/page-DYF0Qz3l.js +0 -1
  143. package/dist/client/assets/registry-utils-B7t_ZBUi.js +0 -1
  144. package/dist/client/assets/server-name-C3ttWdyD.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-Ccgc_fxj.js","assets/index-DMNk-OUX.js","assets/index-ChrSnaFS.css"])))=>i.map(i=>d[i]);
2
- import{r as j,ag as Js,c as V,j as p,aP as vt,s as ea,K as Me,p as ta,a0 as na,aQ as $o,ac as Yo,ai as qo,aE as Vo,ad as Vr,ae as Wo,af as Go,aa as Qo,ah as Ko}from"./index-DMNk-OUX.js";import{I as ra,U as Xo,b as Zo,c as Jo}from"./empty-state-DzS1Zp7m.js";import{c as ae,u as Et,I as ia,B as We}from"./input-68J17rBp.js";import{a as el,b as tl,P as nl}from"./popover-DC9U4d6e.js";import{u as Bt,T as jn,b as zn,a as rl,c as $n}from"./project-context-provider-BJIP5a-U.js";import{i as xt}from"./Check-JFkjTCfG.js";import{i as sa,u as il}from"./use-gateway-CRpsitbG.js";import{i as Wr}from"./SearchMd-tOSOFUes.js";import{u as sl}from"./use-create-gateway-Ca5SEa8I.js";import{i as aa}from"./AlertCircle-Cso_Xxvk.js";import{i as al}from"./error-boundary-BQnJ9S9E.js";import{i as ul}from"./X-D3ljCSd1.js";import{a as ol,i as ua,c as ll}from"./Grid01-BbdtRdR8.js";import{T as cl}from"./textarea-BAUX8Qgd.js";import{u as oa,L as la}from"./localstorage-keys-C62ZbWuB.js";import{a as Gr}from"./Copy01-Dadp_RDG.js";import{i as fl}from"./Terminal-ANRX3jJ8.js";import{M as ca}from"./monaco-editor-B_MycISs.js";import{b as dl,c as hl,d as ml,A as pl,a as gl,e as El,g as bl,f as Tl}from"./alert-dialog-_Gzpv9vf.js";import{b as xl,a as _l,c as Al,S as kl}from"./select-B9KJyTZZ.js";import{u as Cl}from"./use-mobile--ytA5LT5.js";import{i as Nl}from"./File06-D0TXCuMx.js";import{i as yl}from"./InfoCircle-D6qJG9Nl.js";import{u as Sl}from"./use-connection-DoWszS3j.js";import{u as Il}from"./use-binding-Dj4lal1A.js";const fa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));fa.displayName="Atom02";const da=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));da.displayName="Coins01";const ha=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M9 14 4 9m0 0 5-5M4 9h6.4c3.36 0 5.04 0 6.324.654a6 6 0 0 1 2.622 2.622C20 13.56 20 15.24 20 18.6V20"}));ha.displayName="CornerUpLeft";const ma=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));ma.displayName="CurrencyDollar";const pa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));pa.displayName="Edit02";const ga=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));ga.displayName="Image01";const Ea=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Ea.displayName="Lightbulb01";const ba=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));ba.displayName="LogOut04";const Yn=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));Yn.displayName="Stars01";const Ta=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Ta.displayName="Stop";const xa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));xa.displayName="Target04";function Mi({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=wl({defaultProp:e,onChange:n}),s=t!==void 0,a=s?t:r,u=Js(n),o=j.useCallback(l=>{if(s){const d=typeof l=="function"?l(t):l;d!==t&&u(d)}else i(l)},[s,t,i,u]);return[a,o]}function wl({defaultProp:t,onChange:e}){const n=j.useState(t),[r]=n,i=j.useRef(r),s=Js(e);return j.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}function Ll(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Root,{"data-slot":"drawer",...n}),e[2]=n,e[3]=r):r=e[3],r}function Rl(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Trigger,{"data-slot":"drawer-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Ol(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Portal,{"data-slot":"drawer-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function Dl(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx(vt.Overlay,{"data-slot":"drawer-overlay",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function Pl(t){const e=V.c(12);let n,r,i;e[0]!==t?({className:r,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(Dl,{}),e[4]=s):s=e[4];let a;e[5]!==r?(a=ae("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r),e[5]=r,e[6]=a):a=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=u):u=e[7];let o;return e[8]!==n||e[9]!==i||e[10]!==a?(o=p.jsxs(Ol,{"data-slot":"drawer-portal",children:[s,p.jsxs(vt.Content,{"data-slot":"drawer-content",className:a,...i,children:[u,n]})]}),e[8]=n,e[9]=i,e[10]=a,e[11]=o):o=e[11],o}function Ml(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("flex flex-col gap-1.5 px-4 py-2",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx("div",{"data-slot":"drawer-header",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function vl(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("text-foreground font-semibold",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx(vt.Title,{"data-slot":"drawer-title",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function Bl(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=la.developerMode(),t[0]=e):e=t[0],oa(e,!1)}function _t(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Fl(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=_t(i),n.then(s=>{s.onclose=()=>n=void 0},()=>{}),n};return(i,s)=>r().then(a=>s(a.transaction(e,i).objectStore(e)))}let ur;function qn(){return ur||(ur=Fl("keyval-store","keyval")),ur}function Qr(t,e=qn()){return e("readonly",n=>_t(n.get(t)))}function en(t,e,n=qn()){return n("readwrite",r=>(r.put(e,t),_t(r.transaction)))}function _a(t,e=qn()){return e("readwrite",n=>(n.delete(t),_t(n.transaction)))}function Hl(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},_t(t.transaction)}function Aa(t=qn()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([_t(e.getAllKeys()),_t(e.getAll())]).then(([r,i])=>r.map((s,a)=>[s,i[a]]));const n=[];return t("readonly",r=>Hl(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Kb(t,e){const n=`${t}:threads:${e}`;return await Qr(n)??null}async function Ul(t){const e=`${t}:threads:`;return(await Aa()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,s)=>String(s.updated_at).localeCompare(String(i.updated_at)))}function ka(t,e){const n=`${t}:messages:`;return Aa().then(r=>r.filter(([s])=>typeof s=="string"&&s.startsWith(n)).map(([,s])=>s).filter(s=>s.metadata?.thread_id===e||s.threadId===e).sort((s,a)=>{const u=s.metadata?.created_at||s.createdAt||"",o=a.metadata?.created_at||a.createdAt||"";return String(u).localeCompare(String(o))}))}function Xb(t){const e=V.c(14),{locator:n}=Bt(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=Me.threads(n),e[0]=r,e[1]=n,e[2]=i):i=e[2];let s;e[3]!==r||e[4]!==n?(s=async()=>await Ul(n),e[3]=r,e[4]=n,e[5]=s):s=e[5];let a;e[6]!==i||e[7]!==s?(a={queryKey:i,queryFn:s,staleTime:3e4},e[6]=i,e[7]=s,e[8]=a):a=e[8];const{data:u,refetch:o}=ta(a);let l;e[9]!==u?(l=u??[],e[9]=u,e[10]=l):l=e[10];let f;return e[11]!==o||e[12]!==l?(f={threads:l,refetch:o},e[11]=o,e[12]=l,e[13]=f):f=e[13],f}function Zb(t){const e=V.c(11),{locator:n}=Bt();let r;e[0]!==n||e[1]!==t?(r=Me.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>ka(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let s;e[6]!==r||e[7]!==i?(s={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=s):s=e[8];const{data:a}=ta(s);let u;return e[9]!==a?(u=a??[],e[9]=a,e[10]=u):u=e[10],u}function Ca(){const t=V.c(28),{locator:e}=Bt(),n=ea();let r;t[0]!==e?(r=async C=>{const T=`${e}:threads:${C.id}`;return await en(T,C),C},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=C=>{n.invalidateQueries({queryKey:Me.threads(e)}),C.gatewayId&&n.invalidateQueries({queryKey:Me.gatewayThreads(e,C.gatewayId)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let s;t[5]!==r||t[6]!==i?(s={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=s):s=t[7];const a=Et(s);let u;t[8]!==e?(u=async C=>{const{id:T,updates:y}=C,N=`${e}:threads:${T}`,L=await Qr(N);if(!L)throw new Error(`Thread ${T} not found`);const O={...L,...y};return await en(N,O),O},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=C=>{n.invalidateQueries({queryKey:Me.threads(e)}),n.invalidateQueries({queryKey:Me.thread(e,C.id)}),C.gatewayId&&n.invalidateQueries({queryKey:Me.gatewayThreads(e,C.gatewayId)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Et(l);let d;t[16]!==e?(d=async C=>{const T=`${e}:threads:${C}`;return await _a(T),C},t[16]=e,t[17]=d):d=t[17];let m;t[18]!==e||t[19]!==n?(m=()=>{n.invalidateQueries({queryKey:Me.threads(e)})},t[18]=e,t[19]=n,t[20]=m):m=t[20];let h;t[21]!==d||t[22]!==m?(h={mutationFn:d,onSuccess:m},t[21]=d,t[22]=m,t[23]=h):h=t[23];const g=Et(h);let A;return t[24]!==g||t[25]!==a||t[26]!==f?(A={insert:a,update:f,delete:g},t[24]=g,t[25]=a,t[26]=f,t[27]=A):A=t[27],A}function jl(){const t=V.c(37),{locator:e}=Bt(),n=ea();let r;t[0]!==e?(r=async L=>{const O=`${e}:messages:${L.id}`;return await en(O,L),L},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=L=>{const O=L.metadata?.thread_id||L.threadId;O&&n.invalidateQueries({queryKey:Me.threadMessages(e,O)}),n.invalidateQueries({queryKey:Me.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let s;t[5]!==r||t[6]!==i?(s={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=s):s=t[7];const a=Et(s);let u;t[8]!==e?(u=async L=>(await Promise.all(L.map(O=>{const S=`${e}:messages:${O.id}`;return en(S,O)})),L),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=L=>{const O=new Set;for(const S of L){const B=S.metadata?.thread_id||S.threadId;B&&O.add(B)}for(const S of O)n.invalidateQueries({queryKey:Me.threadMessages(e,S)});n.invalidateQueries({queryKey:Me.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Et(l);let d;t[16]!==e?(d=async L=>{const{id:O,updates:S}=L,B=`${e}:messages:${O}`,$=await Qr(B);if(!$)throw new Error(`Message ${O} not found`);const H={...$,...S};return await en(B,H),H},t[16]=e,t[17]=d):d=t[17];let m;t[18]!==e||t[19]!==n?(m=L=>{const O=L.metadata?.thread_id||L.threadId;O&&n.invalidateQueries({queryKey:Me.threadMessages(e,O)}),n.invalidateQueries({queryKey:Me.messages(e)})},t[18]=e,t[19]=n,t[20]=m):m=t[20];let h;t[21]!==d||t[22]!==m?(h={mutationFn:d,onSuccess:m},t[21]=d,t[22]=m,t[23]=h):h=t[23];const g=Et(h);let A;t[24]!==e?(A=async L=>{const O=`${e}:messages:${L}`;return await _a(O),L},t[24]=e,t[25]=A):A=t[25];let C;t[26]!==e||t[27]!==n?(C=()=>{n.invalidateQueries({queryKey:Me.messages(e)})},t[26]=e,t[27]=n,t[28]=C):C=t[28];let T;t[29]!==C||t[30]!==A?(T={mutationFn:A,onSuccess:C},t[29]=C,t[30]=A,t[31]=T):T=t[31];const y=Et(T);let N;return t[32]!==y||t[33]!==a||t[34]!==f||t[35]!==g?(N={insert:a,insertMany:f,update:g,delete:y},t[32]=y,t[33]=a,t[34]=f,t[35]=g,t[36]=N):N=t[36],N}const Na={inputValue:"",branchContext:null,pendingSubmit:!1};function zl(t,e){switch(e.type){case"SET_INPUT":return{...t,inputValue:e.payload};case"START_BRANCH":return{...t,branchContext:e.payload};case"CLEAR_BRANCH":return{...t,branchContext:null};case"SET_PENDING_SUBMIT":return{...t,pendingSubmit:e.payload};case"RESET":return Na;default:return t}}const ya=j.createContext(null),Sa=()=>crypto.randomUUID();function $l(t){const e=V.c(16),{children:n}=t,{locator:r}=Bt(),[i,s]=j.useReducer(zl,Na),a=Ca(),[u,o]=oa(la.threadManagerState(r)+":active-id",Yl);let l;e[0]!==o||e[1]!==a?(l=C=>{const T=C?.id||crypto.randomUUID(),y=new Date().toISOString(),N={id:T,title:C?.title||"",created_at:C?.created_at||y,updated_at:C?.updated_at||y,hidden:C?.hidden??!1,gatewayId:C?.gatewayId};return a.insert.mutate(N),o(T),N},e[0]=o,e[1]=a,e[2]=l):l=e[2];const f=l;let d;e[3]!==u||e[4]!==o||e[5]!==a?(d=C=>{a.update.mutate({id:C,updates:{hidden:!0,updated_at:new Date().toISOString()}}),u===C&&o(Sa())},e[3]=u,e[4]=o,e[5]=a,e[6]=d):d=e[6];const m=d;let h;e[7]!==u||e[8]!==f||e[9]!==m||e[10]!==i||e[11]!==o?(h={interactionState:i,interactionDispatch:s,activeThreadId:u,createThread:f,setActiveThreadId:o,hideThread:m},e[7]=u,e[8]=f,e[9]=m,e[10]=i,e[11]=o,e[12]=h):h=e[12];const g=h;let A;return e[13]!==n||e[14]!==g?(A=p.jsx(ya.Provider,{value:g,children:n}),e[13]=n,e[14]=g,e[15]=A):A=e[15],A}function Yl(t){return t||Sa()}function ql(){const t=V.c(19),e=j.useContext(ya);if(!e)throw new Error("useChat must be used within a ChatProvider");const{interactionState:n,interactionDispatch:r}=e;let i,s,a,u,o;t[0]!==r?(i=f=>r({type:"SET_INPUT",payload:f}),s=f=>r({type:"START_BRANCH",payload:f}),a=()=>r({type:"CLEAR_BRANCH"}),u=f=>r({type:"SET_PENDING_SUBMIT",payload:f}),o=()=>r({type:"RESET"}),t[0]=r,t[1]=i,t[2]=s,t[3]=a,t[4]=u,t[5]=o):(i=t[1],s=t[2],a=t[3],u=t[4],o=t[5]);let l;return t[6]!==e.activeThreadId||t[7]!==e.createThread||t[8]!==e.hideThread||t[9]!==e.setActiveThreadId||t[10]!==n.branchContext||t[11]!==n.inputValue||t[12]!==n.pendingSubmit||t[13]!==i||t[14]!==s||t[15]!==a||t[16]!==u||t[17]!==o?(l={inputValue:n.inputValue,branchContext:n.branchContext,pendingSubmit:n.pendingSubmit,setInputValue:i,startBranch:s,clearBranch:a,setPendingSubmit:u,reset:o,activeThreadId:e.activeThreadId,createThread:e.createThread,setActiveThreadId:e.setActiveThreadId,hideThread:e.hideThread},t[6]=e.activeThreadId,t[7]=e.createThread,t[8]=e.hideThread,t[9]=e.setActiveThreadId,t[10]=n.branchContext,t[11]=n.inputValue,t[12]=n.pendingSubmit,t[13]=i,t[14]=s,t[15]=a,t[16]=u,t[17]=o,t[18]=l):l=t[18],l}function Vl(){const t=V.c(2),e=il();let n;return t[0]!==e?(n=e??[],t[0]=e,t[1]=n):n=t[1],n}function Wl(t){const e=V.c(24),{gateway:n,isSelected:r}=t,i=r&&"bg-accent";let s;e[0]!==i?(s=ae("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",i),e[0]=i,e[1]=s):s=e[1];let a;e[2]!==n.fallbackIcon?(a=n.fallbackIcon??p.jsx(sa,{}),e[2]=n.fallbackIcon,e[3]=a):a=e[3];let u;e[4]!==n.icon||e[5]!==n.title||e[6]!==a?(u=p.jsx(ra,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:a,className:"size-10 rounded-xl border border-stone-200/60 shadow-sm shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a,e[7]=u):u=e[7];let o;e[8]!==n.title?(o=p.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=o):o=e[9];let l;e[10]!==r?(l=r&&p.jsx(xt,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=l):l=e[11];let f;e[12]!==o||e[13]!==l?(f=p.jsxs("div",{className:"flex items-center justify-between",children:[o,l]}),e[12]=o,e[13]=l,e[14]=f):f=e[14];let d;e[15]!==n.description?(d=n.description&&p.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let m;e[17]!==f||e[18]!==d?(m=p.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,d]}),e[17]=f,e[18]=d,e[19]=m):m=e[19];let h;return e[20]!==s||e[21]!==u||e[22]!==m?(h=p.jsxs("div",{className:s,children:[u,m]}),e[20]=s,e[21]=u,e[22]=m,e[23]=h):h=e[23],h}function Gl(t){const e=V.c(25),{gateways:n,selectedGatewayId:r,onGatewayChange:i,searchInputRef:s}=t,[a,u]=j.useState(""),o=j.useRef(null),l=s??o;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},e[0]=f):f=e[0];const{createGateway:d,isCreating:m}=sl(f);let h;e:{if(!a.trim()){h=n;break e}let H;if(e[1]!==n||e[2]!==a){const I=a.toLowerCase();H=n.filter(F=>F.title.toLowerCase().includes(I)||F.description?.toLowerCase().includes(I)),e[1]=n,e[2]=a,e[3]=H}else H=e[3];h=H}const g=h;let A;e[4]!==i?(A=H=>{i(H),u("")},e[4]=i,e[5]=A):A=e[5];const C=A;let T;e[6]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(Wr,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[6]=T):T=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=H=>u(H.target.value),e[7]=y):y=e[7];let N;e[8]!==l||e[9]!==a?(N=p.jsx(ia,{ref:l,type:"text",placeholder:"Search for an agent...",value:a,onChange:y,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[8]=l,e[9]=a,e[10]=N):N=e[10];const L=m?"Creating...":"Create Agent";let O;e[11]!==d||e[12]!==m||e[13]!==L?(O=p.jsx(We,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:m,children:L}),e[11]=d,e[12]=m,e[13]=L,e[14]=O):O=e[14];let S;e[15]!==N||e[16]!==O?(S=p.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:p.jsxs("div",{className:"relative flex items-center gap-2",children:[T,N,O]})}),e[15]=N,e[16]=O,e[17]=S):S=e[17];let B;e[18]!==g||e[19]!==C||e[20]!==r?(B=p.jsx("div",{className:"overflow-y-auto p-1.5",children:g.length>0?p.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:g.map(H=>p.jsx("div",{role:"button",tabIndex:0,onClick:()=>C(H.id),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),C(H.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:p.jsx(Wl,{gateway:H,isSelected:H.id===r})},H.id))}):p.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"})}),e[18]=g,e[19]=C,e[20]=r,e[21]=B):B=e[21];let $;return e[22]!==B||e[23]!==S?($=p.jsxs("div",{className:"flex flex-col max-h-[400px]",children:[S,B]}),e[22]=B,e[23]=S,e[24]=$):$=e[24],$}function Jb(t){const e=V.c(37),{selectedGatewayId:n,onGatewayChange:r,className:i,placeholder:s,showTooltip:a,disabled:u}=t,o=s===void 0?"Select Agent":s,l=a===void 0?!0:a,f=u===void 0?!1:u,[d,m]=j.useState(!1),h=j.useRef(null),g=Vl();let A,C;e[0]!==d?(A=()=>{d&&setTimeout(()=>{h.current?.focus()},0)},C=[d],e[0]=d,e[1]=A,e[2]=C):(A=e[1],C=e[2]),j.useEffect(A,C);let T;e[3]!==g||e[4]!==n?(T=n?g.find(te=>te.id===n):null,e[3]=g,e[4]=n,e[5]=T):T=e[5];const y=T;let N;e[6]!==r?(N=te=>{r(te),m(!1)},e[6]=r,e[7]=N):N=e[7];const L=N;let O;e[8]===Symbol.for("react.memo_cache_sentinel")?(O=te=>{m(te)},e[8]=O):O=e[8];const S=O,B=f?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let $;e[9]!==i||e[10]!==B?($=ae("flex items-center justify-center p-1 rounded-md transition-colors shrink-0",B,i),e[9]=i,e[10]=B,e[11]=$):$=e[11];let H;e[12]!==y?(H=y?p.jsx(ra,{icon:y.icon,name:y.title,size:"xs",fallbackIcon:y.fallbackIcon??p.jsx(sa,{size:12}),className:"size-5 rounded-md"}):p.jsx("img",{src:"/favicon.svg",alt:"Default Agent",className:"size-5 rounded-md"}),e[12]=y,e[13]=H):H=e[13];let I;e[14]!==f||e[15]!==o||e[16]!==$||e[17]!==H?(I=p.jsx("button",{type:"button",disabled:f,className:$,"aria-label":o,children:H}),e[14]=f,e[15]=o,e[16]=$,e[17]=H,e[18]=I):I=e[18];const F=I,z=f?!1:d,G=f?void 0:S;let Y;e[19]!==F?(Y=p.jsx(zn,{asChild:!0,children:p.jsx(el,{asChild:!0,children:F})}),e[19]=F,e[20]=Y):Y=e[20];let M;e[21]!==d||e[22]!==y?.title||e[23]!==l?(M=l&&!d&&p.jsx(jn,{side:"top",className:"text-xs",children:y?.title??"Choose an agent to chat with"}),e[21]=d,e[22]=y?.title,e[23]=l,e[24]=M):M=e[24];let W;e[25]!==Y||e[26]!==M?(W=p.jsx(rl,{children:p.jsxs($n,{children:[Y,M]})}),e[25]=Y,e[26]=M,e[27]=W):W=e[27];let K;e[28]!==g||e[29]!==L||e[30]!==n?(K=p.jsx(tl,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:p.jsx(Gl,{gateways:g,selectedGatewayId:n,onGatewayChange:L,searchInputRef:h})}),e[28]=g,e[29]=L,e[30]=n,e[31]=K):K=e[31];let ee;return e[32]!==z||e[33]!==G||e[34]!==W||e[35]!==K?(ee=p.jsxs(nl,{open:z,onOpenChange:G,children:[W,K]}),e[32]=z,e[33]=G,e[34]=W,e[35]=K,e[36]=ee):ee=e[36],ee}function Ql(t){const e=V.c(65),{value:n,onChange:r,onSubmit:i,onStop:s,disabled:a,isStreaming:u,placeholder:o,className:l,centered:f,contextContent:d,leftActions:m,rightActions:h,maxTextHeight:g,children:A}=t,C=o===void 0?"Ask anything or @ for context":o,T=g===void 0?"164px":g;let y;e[0]!==a||e[1]!==u||e[2]!==n?(y=!a&&!u&&n.trim().length>0,e[0]=a,e[1]=u,e[2]=n,e[3]=y):y=e[3];const N=y;let L;e[4]!==N||e[5]!==u||e[6]!==s||e[7]!==i?(L=xe=>{xe.preventDefault(),u&&s?s():N&&i()},e[4]=N,e[5]=u,e[6]=s,e[7]=i,e[8]=L):L=e[8];const O=L;let S;e[9]!==N||e[10]!==i?(S=xe=>{xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),N&&i())},e[9]=N,e[10]=i,e[11]=S):S=e[11];const B=S;let $;e[12]!==l?($=ae("w-full",l),e[12]=l,e[13]=$):$=e[13];let H;e[14]!==d?(H=d&&p.jsx("div",{className:"mb-1",children:d}),e[14]=d,e[15]=H):H=e[15];let I;e[16]!==T?(I={maxHeight:T},e[16]=T,e[17]=I):I=e[17];let F;e[18]!==r?(F=xe=>r(xe.target.value),e[18]=r,e[19]=F):F=e[19];const z=a||u;let G;e[20]===Symbol.for("react.memo_cache_sentinel")?(G=ae("placeholder:text-muted-foreground resize-none focus-visible:ring-0 border-0 p-2 !text-[15px] min-h-[20px] w-full","rounded-none shadow-none"),e[20]=G):G=e[20];let Y;e[21]===Symbol.for("react.memo_cache_sentinel")?(Y={minHeight:"20px",height:"auto",overflow:"hidden"},e[21]=Y):Y=e[21];let M;e[22]!==B||e[23]!==C||e[24]!==F||e[25]!==z||e[26]!==n?(M=p.jsx(cl,{value:n,onChange:F,onKeyDown:B,placeholder:C,disabled:z,className:G,rows:1,style:Y}),e[22]=B,e[23]=C,e[24]=F,e[25]=z,e[26]=n,e[27]=M):M=e[27];let W;e[28]!==M||e[29]!==I?(W=p.jsx("div",{className:"overflow-y-auto relative flex-1",style:I,children:M}),e[28]=M,e[29]=I,e[30]=W):W=e[30];let K;e[31]!==W||e[32]!==H?(K=p.jsxs("div",{className:"relative flex flex-col gap-2 p-2.5 flex-1",children:[H,W]}),e[31]=W,e[32]=H,e[33]=K):K=e[33];let ee;e[34]!==A||e[35]!==m?(ee=p.jsxs("div",{className:"flex items-center overflow-hidden gap-2 min-w-0",children:[m,A]}),e[34]=A,e[35]=m,e[36]=ee):ee=e[36];const te=u?"button":"submit";let _;e[37]!==u||e[38]!==s?(_=xe=>{u&&(xe.preventDefault(),xe.stopPropagation(),s?.())},e[37]=u,e[38]=s,e[39]=_):_=e[39];const oe=N||u?"default":"ghost",pe=!N&&!u,k=!N&&!u&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let le;e[40]!==k?(le=ae("size-8 rounded-full transition-all",k),e[40]=k,e[41]=le):le=e[41];const _e=u?"Stop generating":"Send message (Enter)";let ue;e[42]!==u?(ue=u?p.jsx(Ta,{size:20}):p.jsx(ol,{size:20}),e[42]=u,e[43]=ue):ue=e[43];let Ae;e[44]!==te||e[45]!==_||e[46]!==oe||e[47]!==pe||e[48]!==le||e[49]!==_e||e[50]!==ue?(Ae=p.jsx(We,{type:te,onClick:_,variant:oe,size:"icon",disabled:pe,className:le,title:_e,children:ue}),e[44]=te,e[45]=_,e[46]=oe,e[47]=pe,e[48]=le,e[49]=_e,e[50]=ue,e[51]=Ae):Ae=e[51];let ge;e[52]!==h||e[53]!==Ae?(ge=p.jsxs("div",{className:"flex items-center gap-1",children:[h,Ae]}),e[52]=h,e[53]=Ae,e[54]=ge):ge=e[54];let be;e[55]!==ee||e[56]!==ge?(be=p.jsxs("div",{className:"flex items-center justify-between p-2.5",children:[ee,ge]}),e[55]=ee,e[56]=ge,e[57]=be):be=e[57];let de;e[58]!==K||e[59]!==be?(de=p.jsxs("div",{className:"relative rounded-xl w-full min-h-[130px] flex flex-col border border-border bg-background",children:[K,be]}),e[58]=K,e[59]=be,e[60]=de):de=e[60];let ke;return e[61]!==O||e[62]!==de||e[63]!==$?(ke=p.jsx("form",{onSubmit:O,className:$,children:de}),e[61]=O,e[62]=de,e[63]=$,e[64]=ke):ke=e[64],ke}function Kl(){const t=V.c(3),[e,n]=j.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async a=>{await navigator.clipboard.writeText(a),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let s;return t[1]!==e?(s={handleCopy:i,copied:e},t[1]=e,t[2]=s):s=t[2],s}function Kr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=Kr();function Ia(t){Ct=t}var tn={exec:()=>null};function ce(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Be.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Xl=/^(?:[ \t]*(?:\n|$))+/,Zl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ec=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xr=/(?:[*+-]|\d{1,9}[.)])/,wa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,La=ce(wa).replace(/bull/g,Xr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tc=ce(wa).replace(/bull/g,Xr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Zr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nc=/^[^\n]+/,Jr=/(?!\s*\])(?:\\.|[^\[\]\\])+/,rc=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ic=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xr).getRegex(),Vn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ei=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sc=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ei).replace("tag",Vn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ra=ce(Zr).replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex(),ac=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ra).getRegex(),ti={blockquote:ac,code:Zl,def:rc,fences:Jl,heading:ec,hr:pn,html:sc,lheading:La,list:ic,newline:Xl,paragraph:Ra,table:tn,text:nc},vi=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex(),uc={...ti,lheading:tc,table:vi,paragraph:ce(Zr).replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vi).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex()},oc={...ti,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ei).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Zr).replace("hr",pn).replace("heading",` *#{1,6} *[^
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-C5pGkBnk.js","assets/index-Bz1LU39D.js","assets/index-9MwexYU6.css"])))=>i.map(i=>d[i]);
2
+ import{r as j,ag as Js,c as V,j as p,aP as vt,s as ea,K as Me,p as ta,a0 as na,aQ as $o,ac as Yo,ai as qo,aE as Vo,ad as Vr,ae as Wo,af as Go,aa as Qo,ah as Ko}from"./index-Bz1LU39D.js";import{I as ra,U as Xo,b as Zo,c as Jo}from"./empty-state-DgOO5bI1.js";import{c as ae,u as Et,I as ia,B as We}from"./input-CtiQUsvV.js";import{a as el,b as tl,P as nl}from"./popover-QWczrvYc.js";import{u as Bt,T as jn,b as zn,a as rl,c as $n}from"./project-context-provider-_aLYBfO9.js";import{i as xt}from"./Check-Bkw0Gz-n.js";import{i as sa,u as il}from"./use-gateway-BhC1hXIm.js";import{i as Wr}from"./SearchMd-YxKkBPG0.js";import{u as sl}from"./use-create-gateway-D8vNiD2K.js";import{i as aa}from"./AlertCircle-CtP28Oyz.js";import{i as al}from"./error-boundary-uBvOVTCE.js";import{i as ul}from"./X-DcqsnRSe.js";import{a as ol,i as ua,c as ll}from"./Grid01-BEpepbVy.js";import{T as cl}from"./textarea-D76YOeHc.js";import{u as oa,L as la}from"./localstorage-keys-5oG1CfEQ.js";import{a as Gr}from"./Copy01-BctGx-5E.js";import{i as fl}from"./Terminal-DYwA22tz.js";import{M as ca}from"./monaco-editor-BmVBfnK5.js";import{b as dl,c as hl,d as ml,A as pl,a as gl,e as El,g as bl,f as Tl}from"./alert-dialog-B2ogXLEp.js";import{b as xl,a as _l,c as Al,S as kl}from"./select-Bxj6_TSM.js";import{u as Cl}from"./use-mobile-sd5ko6M_.js";import{i as Nl}from"./File06-nV81V8TD.js";import{i as yl}from"./InfoCircle-BXctEVkS.js";import{u as Sl}from"./use-connection-BXdeHsm0.js";import{u as Il}from"./use-binding-UNVemCFv.js";const fa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));fa.displayName="Atom02";const da=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));da.displayName="Coins01";const ha=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M9 14 4 9m0 0 5-5M4 9h6.4c3.36 0 5.04 0 6.324.654a6 6 0 0 1 2.622 2.622C20 13.56 20 15.24 20 18.6V20"}));ha.displayName="CornerUpLeft";const ma=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));ma.displayName="CurrencyDollar";const pa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));pa.displayName="Edit02";const ga=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));ga.displayName="Image01";const Ea=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));Ea.displayName="Lightbulb01";const ba=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));ba.displayName="LogOut04";const Yn=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));Yn.displayName="Stars01";const Ta=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Ta.displayName="Stop";const xa=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));xa.displayName="Target04";function Mi({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=wl({defaultProp:e,onChange:n}),s=t!==void 0,a=s?t:r,u=Js(n),o=j.useCallback(l=>{if(s){const d=typeof l=="function"?l(t):l;d!==t&&u(d)}else i(l)},[s,t,i,u]);return[a,o]}function wl({defaultProp:t,onChange:e}){const n=j.useState(t),[r]=n,i=j.useRef(r),s=Js(e);return j.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}function Ll(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Root,{"data-slot":"drawer",...n}),e[2]=n,e[3]=r):r=e[3],r}function Rl(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Trigger,{"data-slot":"drawer-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Ol(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(vt.Portal,{"data-slot":"drawer-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function Dl(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx(vt.Overlay,{"data-slot":"drawer-overlay",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function Pl(t){const e=V.c(12);let n,r,i;e[0]!==t?({className:r,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(Dl,{}),e[4]=s):s=e[4];let a;e[5]!==r?(a=ae("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r),e[5]=r,e[6]=a):a=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=u):u=e[7];let o;return e[8]!==n||e[9]!==i||e[10]!==a?(o=p.jsxs(Ol,{"data-slot":"drawer-portal",children:[s,p.jsxs(vt.Content,{"data-slot":"drawer-content",className:a,...i,children:[u,n]})]}),e[8]=n,e[9]=i,e[10]=a,e[11]=o):o=e[11],o}function Ml(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("flex flex-col gap-1.5 px-4 py-2",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx("div",{"data-slot":"drawer-header",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function vl(t){const e=V.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=ae("text-foreground font-semibold",n),e[3]=n,e[4]=i):i=e[4];let s;return e[5]!==r||e[6]!==i?(s=p.jsx(vt.Title,{"data-slot":"drawer-title",className:i,...r}),e[5]=r,e[6]=i,e[7]=s):s=e[7],s}function Bl(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=la.developerMode(),t[0]=e):e=t[0],oa(e,!1)}function _t(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Fl(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=_t(i),n.then(s=>{s.onclose=()=>n=void 0},()=>{}),n};return(i,s)=>r().then(a=>s(a.transaction(e,i).objectStore(e)))}let ur;function qn(){return ur||(ur=Fl("keyval-store","keyval")),ur}function Qr(t,e=qn()){return e("readonly",n=>_t(n.get(t)))}function en(t,e,n=qn()){return n("readwrite",r=>(r.put(e,t),_t(r.transaction)))}function _a(t,e=qn()){return e("readwrite",n=>(n.delete(t),_t(n.transaction)))}function Hl(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},_t(t.transaction)}function Aa(t=qn()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([_t(e.getAllKeys()),_t(e.getAll())]).then(([r,i])=>r.map((s,a)=>[s,i[a]]));const n=[];return t("readonly",r=>Hl(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Kb(t,e){const n=`${t}:threads:${e}`;return await Qr(n)??null}async function Ul(t){const e=`${t}:threads:`;return(await Aa()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,s)=>String(s.updated_at).localeCompare(String(i.updated_at)))}function ka(t,e){const n=`${t}:messages:`;return Aa().then(r=>r.filter(([s])=>typeof s=="string"&&s.startsWith(n)).map(([,s])=>s).filter(s=>s.metadata?.thread_id===e||s.threadId===e).sort((s,a)=>{const u=s.metadata?.created_at||s.createdAt||"",o=a.metadata?.created_at||a.createdAt||"";return String(u).localeCompare(String(o))}))}function Xb(t){const e=V.c(14),{locator:n}=Bt(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=Me.threads(n),e[0]=r,e[1]=n,e[2]=i):i=e[2];let s;e[3]!==r||e[4]!==n?(s=async()=>await Ul(n),e[3]=r,e[4]=n,e[5]=s):s=e[5];let a;e[6]!==i||e[7]!==s?(a={queryKey:i,queryFn:s,staleTime:3e4},e[6]=i,e[7]=s,e[8]=a):a=e[8];const{data:u,refetch:o}=ta(a);let l;e[9]!==u?(l=u??[],e[9]=u,e[10]=l):l=e[10];let f;return e[11]!==o||e[12]!==l?(f={threads:l,refetch:o},e[11]=o,e[12]=l,e[13]=f):f=e[13],f}function Zb(t){const e=V.c(11),{locator:n}=Bt();let r;e[0]!==n||e[1]!==t?(r=Me.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>ka(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let s;e[6]!==r||e[7]!==i?(s={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=s):s=e[8];const{data:a}=ta(s);let u;return e[9]!==a?(u=a??[],e[9]=a,e[10]=u):u=e[10],u}function Ca(){const t=V.c(28),{locator:e}=Bt(),n=ea();let r;t[0]!==e?(r=async C=>{const T=`${e}:threads:${C.id}`;return await en(T,C),C},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=C=>{n.invalidateQueries({queryKey:Me.threads(e)}),C.gatewayId&&n.invalidateQueries({queryKey:Me.gatewayThreads(e,C.gatewayId)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let s;t[5]!==r||t[6]!==i?(s={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=s):s=t[7];const a=Et(s);let u;t[8]!==e?(u=async C=>{const{id:T,updates:y}=C,N=`${e}:threads:${T}`,L=await Qr(N);if(!L)throw new Error(`Thread ${T} not found`);const O={...L,...y};return await en(N,O),O},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=C=>{n.invalidateQueries({queryKey:Me.threads(e)}),n.invalidateQueries({queryKey:Me.thread(e,C.id)}),C.gatewayId&&n.invalidateQueries({queryKey:Me.gatewayThreads(e,C.gatewayId)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Et(l);let d;t[16]!==e?(d=async C=>{const T=`${e}:threads:${C}`;return await _a(T),C},t[16]=e,t[17]=d):d=t[17];let m;t[18]!==e||t[19]!==n?(m=()=>{n.invalidateQueries({queryKey:Me.threads(e)})},t[18]=e,t[19]=n,t[20]=m):m=t[20];let h;t[21]!==d||t[22]!==m?(h={mutationFn:d,onSuccess:m},t[21]=d,t[22]=m,t[23]=h):h=t[23];const g=Et(h);let A;return t[24]!==g||t[25]!==a||t[26]!==f?(A={insert:a,update:f,delete:g},t[24]=g,t[25]=a,t[26]=f,t[27]=A):A=t[27],A}function jl(){const t=V.c(37),{locator:e}=Bt(),n=ea();let r;t[0]!==e?(r=async L=>{const O=`${e}:messages:${L.id}`;return await en(O,L),L},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=L=>{const O=L.metadata?.thread_id||L.threadId;O&&n.invalidateQueries({queryKey:Me.threadMessages(e,O)}),n.invalidateQueries({queryKey:Me.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let s;t[5]!==r||t[6]!==i?(s={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=s):s=t[7];const a=Et(s);let u;t[8]!==e?(u=async L=>(await Promise.all(L.map(O=>{const S=`${e}:messages:${O.id}`;return en(S,O)})),L),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=L=>{const O=new Set;for(const S of L){const B=S.metadata?.thread_id||S.threadId;B&&O.add(B)}for(const S of O)n.invalidateQueries({queryKey:Me.threadMessages(e,S)});n.invalidateQueries({queryKey:Me.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Et(l);let d;t[16]!==e?(d=async L=>{const{id:O,updates:S}=L,B=`${e}:messages:${O}`,$=await Qr(B);if(!$)throw new Error(`Message ${O} not found`);const H={...$,...S};return await en(B,H),H},t[16]=e,t[17]=d):d=t[17];let m;t[18]!==e||t[19]!==n?(m=L=>{const O=L.metadata?.thread_id||L.threadId;O&&n.invalidateQueries({queryKey:Me.threadMessages(e,O)}),n.invalidateQueries({queryKey:Me.messages(e)})},t[18]=e,t[19]=n,t[20]=m):m=t[20];let h;t[21]!==d||t[22]!==m?(h={mutationFn:d,onSuccess:m},t[21]=d,t[22]=m,t[23]=h):h=t[23];const g=Et(h);let A;t[24]!==e?(A=async L=>{const O=`${e}:messages:${L}`;return await _a(O),L},t[24]=e,t[25]=A):A=t[25];let C;t[26]!==e||t[27]!==n?(C=()=>{n.invalidateQueries({queryKey:Me.messages(e)})},t[26]=e,t[27]=n,t[28]=C):C=t[28];let T;t[29]!==C||t[30]!==A?(T={mutationFn:A,onSuccess:C},t[29]=C,t[30]=A,t[31]=T):T=t[31];const y=Et(T);let N;return t[32]!==y||t[33]!==a||t[34]!==f||t[35]!==g?(N={insert:a,insertMany:f,update:g,delete:y},t[32]=y,t[33]=a,t[34]=f,t[35]=g,t[36]=N):N=t[36],N}const Na={inputValue:"",branchContext:null,pendingSubmit:!1};function zl(t,e){switch(e.type){case"SET_INPUT":return{...t,inputValue:e.payload};case"START_BRANCH":return{...t,branchContext:e.payload};case"CLEAR_BRANCH":return{...t,branchContext:null};case"SET_PENDING_SUBMIT":return{...t,pendingSubmit:e.payload};case"RESET":return Na;default:return t}}const ya=j.createContext(null),Sa=()=>crypto.randomUUID();function $l(t){const e=V.c(16),{children:n}=t,{locator:r}=Bt(),[i,s]=j.useReducer(zl,Na),a=Ca(),[u,o]=oa(la.threadManagerState(r)+":active-id",Yl);let l;e[0]!==o||e[1]!==a?(l=C=>{const T=C?.id||crypto.randomUUID(),y=new Date().toISOString(),N={id:T,title:C?.title||"",created_at:C?.created_at||y,updated_at:C?.updated_at||y,hidden:C?.hidden??!1,gatewayId:C?.gatewayId};return a.insert.mutate(N),o(T),N},e[0]=o,e[1]=a,e[2]=l):l=e[2];const f=l;let d;e[3]!==u||e[4]!==o||e[5]!==a?(d=C=>{a.update.mutate({id:C,updates:{hidden:!0,updated_at:new Date().toISOString()}}),u===C&&o(Sa())},e[3]=u,e[4]=o,e[5]=a,e[6]=d):d=e[6];const m=d;let h;e[7]!==u||e[8]!==f||e[9]!==m||e[10]!==i||e[11]!==o?(h={interactionState:i,interactionDispatch:s,activeThreadId:u,createThread:f,setActiveThreadId:o,hideThread:m},e[7]=u,e[8]=f,e[9]=m,e[10]=i,e[11]=o,e[12]=h):h=e[12];const g=h;let A;return e[13]!==n||e[14]!==g?(A=p.jsx(ya.Provider,{value:g,children:n}),e[13]=n,e[14]=g,e[15]=A):A=e[15],A}function Yl(t){return t||Sa()}function ql(){const t=V.c(19),e=j.useContext(ya);if(!e)throw new Error("useChat must be used within a ChatProvider");const{interactionState:n,interactionDispatch:r}=e;let i,s,a,u,o;t[0]!==r?(i=f=>r({type:"SET_INPUT",payload:f}),s=f=>r({type:"START_BRANCH",payload:f}),a=()=>r({type:"CLEAR_BRANCH"}),u=f=>r({type:"SET_PENDING_SUBMIT",payload:f}),o=()=>r({type:"RESET"}),t[0]=r,t[1]=i,t[2]=s,t[3]=a,t[4]=u,t[5]=o):(i=t[1],s=t[2],a=t[3],u=t[4],o=t[5]);let l;return t[6]!==e.activeThreadId||t[7]!==e.createThread||t[8]!==e.hideThread||t[9]!==e.setActiveThreadId||t[10]!==n.branchContext||t[11]!==n.inputValue||t[12]!==n.pendingSubmit||t[13]!==i||t[14]!==s||t[15]!==a||t[16]!==u||t[17]!==o?(l={inputValue:n.inputValue,branchContext:n.branchContext,pendingSubmit:n.pendingSubmit,setInputValue:i,startBranch:s,clearBranch:a,setPendingSubmit:u,reset:o,activeThreadId:e.activeThreadId,createThread:e.createThread,setActiveThreadId:e.setActiveThreadId,hideThread:e.hideThread},t[6]=e.activeThreadId,t[7]=e.createThread,t[8]=e.hideThread,t[9]=e.setActiveThreadId,t[10]=n.branchContext,t[11]=n.inputValue,t[12]=n.pendingSubmit,t[13]=i,t[14]=s,t[15]=a,t[16]=u,t[17]=o,t[18]=l):l=t[18],l}function Vl(){const t=V.c(2),e=il();let n;return t[0]!==e?(n=e??[],t[0]=e,t[1]=n):n=t[1],n}function Wl(t){const e=V.c(24),{gateway:n,isSelected:r}=t,i=r&&"bg-accent";let s;e[0]!==i?(s=ae("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",i),e[0]=i,e[1]=s):s=e[1];let a;e[2]!==n.fallbackIcon?(a=n.fallbackIcon??p.jsx(sa,{}),e[2]=n.fallbackIcon,e[3]=a):a=e[3];let u;e[4]!==n.icon||e[5]!==n.title||e[6]!==a?(u=p.jsx(ra,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:a,className:"size-10 rounded-xl border border-stone-200/60 shadow-sm shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a,e[7]=u):u=e[7];let o;e[8]!==n.title?(o=p.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=o):o=e[9];let l;e[10]!==r?(l=r&&p.jsx(xt,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=l):l=e[11];let f;e[12]!==o||e[13]!==l?(f=p.jsxs("div",{className:"flex items-center justify-between",children:[o,l]}),e[12]=o,e[13]=l,e[14]=f):f=e[14];let d;e[15]!==n.description?(d=n.description&&p.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let m;e[17]!==f||e[18]!==d?(m=p.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,d]}),e[17]=f,e[18]=d,e[19]=m):m=e[19];let h;return e[20]!==s||e[21]!==u||e[22]!==m?(h=p.jsxs("div",{className:s,children:[u,m]}),e[20]=s,e[21]=u,e[22]=m,e[23]=h):h=e[23],h}function Gl(t){const e=V.c(25),{gateways:n,selectedGatewayId:r,onGatewayChange:i,searchInputRef:s}=t,[a,u]=j.useState(""),o=j.useRef(null),l=s??o;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},e[0]=f):f=e[0];const{createGateway:d,isCreating:m}=sl(f);let h;e:{if(!a.trim()){h=n;break e}let H;if(e[1]!==n||e[2]!==a){const I=a.toLowerCase();H=n.filter(F=>F.title.toLowerCase().includes(I)||F.description?.toLowerCase().includes(I)),e[1]=n,e[2]=a,e[3]=H}else H=e[3];h=H}const g=h;let A;e[4]!==i?(A=H=>{i(H),u("")},e[4]=i,e[5]=A):A=e[5];const C=A;let T;e[6]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(Wr,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[6]=T):T=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=H=>u(H.target.value),e[7]=y):y=e[7];let N;e[8]!==l||e[9]!==a?(N=p.jsx(ia,{ref:l,type:"text",placeholder:"Search for an agent...",value:a,onChange:y,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[8]=l,e[9]=a,e[10]=N):N=e[10];const L=m?"Creating...":"Create Agent";let O;e[11]!==d||e[12]!==m||e[13]!==L?(O=p.jsx(We,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:m,children:L}),e[11]=d,e[12]=m,e[13]=L,e[14]=O):O=e[14];let S;e[15]!==N||e[16]!==O?(S=p.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:p.jsxs("div",{className:"relative flex items-center gap-2",children:[T,N,O]})}),e[15]=N,e[16]=O,e[17]=S):S=e[17];let B;e[18]!==g||e[19]!==C||e[20]!==r?(B=p.jsx("div",{className:"overflow-y-auto p-1.5",children:g.length>0?p.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:g.map(H=>p.jsx("div",{role:"button",tabIndex:0,onClick:()=>C(H.id),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),C(H.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:p.jsx(Wl,{gateway:H,isSelected:H.id===r})},H.id))}):p.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"})}),e[18]=g,e[19]=C,e[20]=r,e[21]=B):B=e[21];let $;return e[22]!==B||e[23]!==S?($=p.jsxs("div",{className:"flex flex-col max-h-[400px]",children:[S,B]}),e[22]=B,e[23]=S,e[24]=$):$=e[24],$}function Jb(t){const e=V.c(37),{selectedGatewayId:n,onGatewayChange:r,className:i,placeholder:s,showTooltip:a,disabled:u}=t,o=s===void 0?"Select Agent":s,l=a===void 0?!0:a,f=u===void 0?!1:u,[d,m]=j.useState(!1),h=j.useRef(null),g=Vl();let A,C;e[0]!==d?(A=()=>{d&&setTimeout(()=>{h.current?.focus()},0)},C=[d],e[0]=d,e[1]=A,e[2]=C):(A=e[1],C=e[2]),j.useEffect(A,C);let T;e[3]!==g||e[4]!==n?(T=n?g.find(te=>te.id===n):null,e[3]=g,e[4]=n,e[5]=T):T=e[5];const y=T;let N;e[6]!==r?(N=te=>{r(te),m(!1)},e[6]=r,e[7]=N):N=e[7];const L=N;let O;e[8]===Symbol.for("react.memo_cache_sentinel")?(O=te=>{m(te)},e[8]=O):O=e[8];const S=O,B=f?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let $;e[9]!==i||e[10]!==B?($=ae("flex items-center justify-center p-1 rounded-md transition-colors shrink-0",B,i),e[9]=i,e[10]=B,e[11]=$):$=e[11];let H;e[12]!==y?(H=y?p.jsx(ra,{icon:y.icon,name:y.title,size:"xs",fallbackIcon:y.fallbackIcon??p.jsx(sa,{size:12}),className:"size-5 rounded-md"}):p.jsx("img",{src:"/favicon.svg",alt:"Default Agent",className:"size-5 rounded-md"}),e[12]=y,e[13]=H):H=e[13];let I;e[14]!==f||e[15]!==o||e[16]!==$||e[17]!==H?(I=p.jsx("button",{type:"button",disabled:f,className:$,"aria-label":o,children:H}),e[14]=f,e[15]=o,e[16]=$,e[17]=H,e[18]=I):I=e[18];const F=I,z=f?!1:d,G=f?void 0:S;let Y;e[19]!==F?(Y=p.jsx(zn,{asChild:!0,children:p.jsx(el,{asChild:!0,children:F})}),e[19]=F,e[20]=Y):Y=e[20];let M;e[21]!==d||e[22]!==y?.title||e[23]!==l?(M=l&&!d&&p.jsx(jn,{side:"top",className:"text-xs",children:y?.title??"Choose an agent to chat with"}),e[21]=d,e[22]=y?.title,e[23]=l,e[24]=M):M=e[24];let W;e[25]!==Y||e[26]!==M?(W=p.jsx(rl,{children:p.jsxs($n,{children:[Y,M]})}),e[25]=Y,e[26]=M,e[27]=W):W=e[27];let K;e[28]!==g||e[29]!==L||e[30]!==n?(K=p.jsx(tl,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:p.jsx(Gl,{gateways:g,selectedGatewayId:n,onGatewayChange:L,searchInputRef:h})}),e[28]=g,e[29]=L,e[30]=n,e[31]=K):K=e[31];let ee;return e[32]!==z||e[33]!==G||e[34]!==W||e[35]!==K?(ee=p.jsxs(nl,{open:z,onOpenChange:G,children:[W,K]}),e[32]=z,e[33]=G,e[34]=W,e[35]=K,e[36]=ee):ee=e[36],ee}function Ql(t){const e=V.c(65),{value:n,onChange:r,onSubmit:i,onStop:s,disabled:a,isStreaming:u,placeholder:o,className:l,centered:f,contextContent:d,leftActions:m,rightActions:h,maxTextHeight:g,children:A}=t,C=o===void 0?"Ask anything or @ for context":o,T=g===void 0?"164px":g;let y;e[0]!==a||e[1]!==u||e[2]!==n?(y=!a&&!u&&n.trim().length>0,e[0]=a,e[1]=u,e[2]=n,e[3]=y):y=e[3];const N=y;let L;e[4]!==N||e[5]!==u||e[6]!==s||e[7]!==i?(L=xe=>{xe.preventDefault(),u&&s?s():N&&i()},e[4]=N,e[5]=u,e[6]=s,e[7]=i,e[8]=L):L=e[8];const O=L;let S;e[9]!==N||e[10]!==i?(S=xe=>{xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),N&&i())},e[9]=N,e[10]=i,e[11]=S):S=e[11];const B=S;let $;e[12]!==l?($=ae("w-full",l),e[12]=l,e[13]=$):$=e[13];let H;e[14]!==d?(H=d&&p.jsx("div",{className:"mb-1",children:d}),e[14]=d,e[15]=H):H=e[15];let I;e[16]!==T?(I={maxHeight:T},e[16]=T,e[17]=I):I=e[17];let F;e[18]!==r?(F=xe=>r(xe.target.value),e[18]=r,e[19]=F):F=e[19];const z=a||u;let G;e[20]===Symbol.for("react.memo_cache_sentinel")?(G=ae("placeholder:text-muted-foreground resize-none focus-visible:ring-0 border-0 p-2 !text-[15px] min-h-[20px] w-full","rounded-none shadow-none"),e[20]=G):G=e[20];let Y;e[21]===Symbol.for("react.memo_cache_sentinel")?(Y={minHeight:"20px",height:"auto",overflow:"hidden"},e[21]=Y):Y=e[21];let M;e[22]!==B||e[23]!==C||e[24]!==F||e[25]!==z||e[26]!==n?(M=p.jsx(cl,{value:n,onChange:F,onKeyDown:B,placeholder:C,disabled:z,className:G,rows:1,style:Y}),e[22]=B,e[23]=C,e[24]=F,e[25]=z,e[26]=n,e[27]=M):M=e[27];let W;e[28]!==M||e[29]!==I?(W=p.jsx("div",{className:"overflow-y-auto relative flex-1",style:I,children:M}),e[28]=M,e[29]=I,e[30]=W):W=e[30];let K;e[31]!==W||e[32]!==H?(K=p.jsxs("div",{className:"relative flex flex-col gap-2 p-2.5 flex-1",children:[H,W]}),e[31]=W,e[32]=H,e[33]=K):K=e[33];let ee;e[34]!==A||e[35]!==m?(ee=p.jsxs("div",{className:"flex items-center overflow-hidden gap-2 min-w-0",children:[m,A]}),e[34]=A,e[35]=m,e[36]=ee):ee=e[36];const te=u?"button":"submit";let _;e[37]!==u||e[38]!==s?(_=xe=>{u&&(xe.preventDefault(),xe.stopPropagation(),s?.())},e[37]=u,e[38]=s,e[39]=_):_=e[39];const oe=N||u?"default":"ghost",pe=!N&&!u,k=!N&&!u&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed";let le;e[40]!==k?(le=ae("size-8 rounded-full transition-all",k),e[40]=k,e[41]=le):le=e[41];const _e=u?"Stop generating":"Send message (Enter)";let ue;e[42]!==u?(ue=u?p.jsx(Ta,{size:20}):p.jsx(ol,{size:20}),e[42]=u,e[43]=ue):ue=e[43];let Ae;e[44]!==te||e[45]!==_||e[46]!==oe||e[47]!==pe||e[48]!==le||e[49]!==_e||e[50]!==ue?(Ae=p.jsx(We,{type:te,onClick:_,variant:oe,size:"icon",disabled:pe,className:le,title:_e,children:ue}),e[44]=te,e[45]=_,e[46]=oe,e[47]=pe,e[48]=le,e[49]=_e,e[50]=ue,e[51]=Ae):Ae=e[51];let ge;e[52]!==h||e[53]!==Ae?(ge=p.jsxs("div",{className:"flex items-center gap-1",children:[h,Ae]}),e[52]=h,e[53]=Ae,e[54]=ge):ge=e[54];let be;e[55]!==ee||e[56]!==ge?(be=p.jsxs("div",{className:"flex items-center justify-between p-2.5",children:[ee,ge]}),e[55]=ee,e[56]=ge,e[57]=be):be=e[57];let de;e[58]!==K||e[59]!==be?(de=p.jsxs("div",{className:"relative rounded-xl w-full min-h-[130px] flex flex-col border border-border bg-background",children:[K,be]}),e[58]=K,e[59]=be,e[60]=de):de=e[60];let ke;return e[61]!==O||e[62]!==de||e[63]!==$?(ke=p.jsx("form",{onSubmit:O,className:$,children:de}),e[61]=O,e[62]=de,e[63]=$,e[64]=ke):ke=e[64],ke}function Kl(){const t=V.c(3),[e,n]=j.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async a=>{await navigator.clipboard.writeText(a),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let s;return t[1]!==e?(s={handleCopy:i,copied:e},t[1]=e,t[2]=s):s=t[2],s}function Kr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=Kr();function Ia(t){Ct=t}var tn={exec:()=>null};function ce(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Be.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Xl=/^(?:[ \t]*(?:\n|$))+/,Zl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ec=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xr=/(?:[*+-]|\d{1,9}[.)])/,wa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,La=ce(wa).replace(/bull/g,Xr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tc=ce(wa).replace(/bull/g,Xr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Zr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nc=/^[^\n]+/,Jr=/(?!\s*\])(?:\\.|[^\[\]\\])+/,rc=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ic=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xr).getRegex(),Vn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ei=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sc=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ei).replace("tag",Vn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ra=ce(Zr).replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex(),ac=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ra).getRegex(),ti={blockquote:ac,code:Zl,def:rc,fences:Jl,heading:ec,hr:pn,html:sc,lheading:La,list:ic,newline:Xl,paragraph:Ra,table:tn,text:nc},vi=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex(),uc={...ti,lheading:tc,table:vi,paragraph:ce(Zr).replace("hr",pn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vi).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vn).getRegex()},oc={...ti,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ei).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Zr).replace("hr",pn).replace("heading",` *#{1,6} *[^
3
3
  ]`).replace("lheading",La).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Oa=/^( {2,}|\\)\n(?!\s*$)/,fc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Wn=/[\p{P}\p{S}]/u,ni=/[\s\p{P}\p{S}]/u,Da=/[^\s\p{P}\p{S}]/u,dc=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ni).getRegex(),Pa=/(?!~)[\p{P}\p{S}]/u,hc=/(?!~)[\s\p{P}\p{S}]/u,mc=/(?:[^\s\p{P}\p{S}]|~)/u,pc=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ma=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,gc=ce(Ma,"u").replace(/punct/g,Wn).getRegex(),Ec=ce(Ma,"u").replace(/punct/g,Pa).getRegex(),va="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bc=ce(va,"gu").replace(/notPunctSpace/g,Da).replace(/punctSpace/g,ni).replace(/punct/g,Wn).getRegex(),Tc=ce(va,"gu").replace(/notPunctSpace/g,mc).replace(/punctSpace/g,hc).replace(/punct/g,Pa).getRegex(),xc=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Da).replace(/punctSpace/g,ni).replace(/punct/g,Wn).getRegex(),_c=ce(/\\(punct)/,"gu").replace(/punct/g,Wn).getRegex(),Ac=ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kc=ce(ei).replace("(?:-->|$)","-->").getRegex(),Cc=ce("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",kc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),On=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Nc=ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",On).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ba=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",On).replace("ref",Jr).getRegex(),Fa=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Jr).getRegex(),yc=ce("reflink|nolink(?!\\()","g").replace("reflink",Ba).replace("nolink",Fa).getRegex(),ri={_backpedal:tn,anyPunctuation:_c,autolink:Ac,blockSkip:pc,br:Oa,code:cc,del:tn,emStrongLDelim:gc,emStrongRDelimAst:bc,emStrongRDelimUnd:xc,escape:lc,link:Nc,nolink:Fa,punctuation:dc,reflink:Ba,reflinkSearch:yc,tag:Cc,text:fc,url:tn},Sc={...ri,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",On).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",On).getRegex()},Sr={...ri,emStrongRDelimAst:Tc,emStrongLDelim:Ec,url:ce(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ic={...Sr,br:ce(Oa).replace("{2,}","*").getRegex(),text:ce(Sr.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},An={normal:ti,gfm:uc,pedantic:oc},qt={normal:ri,gfm:Sr,breaks:Ic,pedantic:Sc},wc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Bi=t=>wc[t];function Xe(t,e){if(e){if(Be.escapeTest.test(t))return t.replace(Be.escapeReplace,Bi)}else if(Be.escapeTestNoEncode.test(t))return t.replace(Be.escapeReplaceNoEncode,Bi);return t}function Fi(t){try{t=encodeURI(t).replace(Be.percentDecode,"%")}catch{return null}return t}function Hi(t,e){const n=t.replace(Be.findPipe,(s,a,u)=>{let o=!1,l=a;for(;--l>=0&&u[l]==="\\";)o=!o;return o?"|":" |"}),r=n.split(Be.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Be.slashPipe,"|");return r}function Vt(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function Lc(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ui(t,e,n,r,i){const s=e.href,a=e.title||null,u=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,o}function Rc(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
4
4
  `).map(s=>{const a=s.match(n.other.beginningSpace);if(a===null)return s;const[u]=a;return u.length>=i.length?s.slice(i.length):s}).join(`
5
5
  `)}var Dn=class{options;rules;lexer;constructor(t){this.options=t||Ct}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Vt(n,`
@@ -83,6 +83,6 @@ Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An err
83
83
  `))+1))}const a="#".repeat(i),u=n.enter("headingAtx"),o=n.enter("phrasing");s.move(a+" ");let l=n.containerPhrasing(t,{before:"# ",after:`
84
84
  `,...s.current()});return/^[\t ]/.test(l)&&(l=mn(l.charCodeAt(0))+l.slice(1)),l=l?a+" "+l:a,n.options.closeAtx&&(l+=" "+a),o(),u(),l}oo.peek=e2;function oo(t){return t.value||""}function e2(){return"<"}lo.peek=t2;function lo(t,e,n,r){const i=ki(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const o=n.createTracker(r);let l=o.move("![");return l+=o.move(n.safe(t.alt,{before:l,after:"]",...o.current()})),l+=o.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),l+=o.move("<"),l+=o.move(n.safe(t.url,{before:l,after:">",...o.current()})),l+=o.move(">")):(u=n.enter("destinationRaw"),l+=o.move(n.safe(t.url,{before:l,after:t.title?" ":")",...o.current()}))),u(),t.title&&(u=n.enter(`title${s}`),l+=o.move(" "+i),l+=o.move(n.safe(t.title,{before:l,after:i,...o.current()})),l+=o.move(i),u()),l+=o.move(")"),a(),l}function t2(){return"!"}co.peek=n2;function co(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let o=u.move("![");const l=n.safe(t.alt,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return a(),n.stack=f,s(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function n2(){return"!"}fo.peek=r2;function fo(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],u=n.compilePattern(a);let o;if(a.atBreak)for(;o=u.exec(r);){let l=o.index;r.charCodeAt(l)===10&&r.charCodeAt(l-1)===13&&l--,r=r.slice(0,l)+" "+r.slice(o.index+1)}}return i+r+i}function r2(){return"`"}function ho(t,e){const n=li(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}mo.peek=i2;function mo(t,e,n,r){const i=ki(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,o;if(ho(t,n)){const f=n.stack;n.stack=[],u=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(t,{before:d,after:">",...a.current()})),d+=a.move(">"),u(),n.stack=f,d}u=n.enter("link"),o=n.enter("label");let l=a.move("[");return l+=a.move(n.containerPhrasing(t,{before:l,after:"](",...a.current()})),l+=a.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),l+=a.move("<"),l+=a.move(n.safe(t.url,{before:l,after:">",...a.current()})),l+=a.move(">")):(o=n.enter("destinationRaw"),l+=a.move(n.safe(t.url,{before:l,after:t.title?" ":")",...a.current()}))),o(),t.title&&(o=n.enter(`title${s}`),l+=a.move(" "+i),l+=a.move(n.safe(t.title,{before:l,after:i,...a.current()})),l+=a.move(i),o()),l+=a.move(")"),u(),l}function i2(t,e,n){return ho(t,n)?"<":"["}po.peek=s2;function po(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let o=u.move("[");const l=n.containerPhrasing(t,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return a(),n.stack=f,s(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function s2(){return"["}function Ci(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function a2(t){const e=Ci(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function u2(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function go(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function o2(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=t.ordered?u2(n):Ci(n);const u=t.ordered?a==="."?")":".":a2(n);let o=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(o=!0),go(n)===a&&f){let d=-1;for(;++d<t.children.length;){const m=t.children[d];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(a=u),n.bulletCurrent=a;const l=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),l}function l2(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function c2(t,e,n,r){const i=l2(n);let s=n.bulletCurrent||Ci(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(a-s.length)),u.shift(a);const o=n.enter("listItem"),l=n.indentLines(n.containerFlow(t,u.current()),f);return o(),l;function f(d,m,h){return m?(h?"":" ".repeat(a))+d:(h?s:s+" ".repeat(a-s.length))+d}}function f2(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(t,r);return s(),i(),a}const d2=Jn(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function h2(t,e,n,r){return(t.children.some(function(a){return d2(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function m2(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Eo.peek=p2;function Eo(t,e,n,r){const i=m2(n),s=n.enter("strong"),a=n.createTracker(r),u=a.move(i+i);let o=a.move(n.containerPhrasing(t,{after:i,before:u,...a.current()}));const l=o.charCodeAt(0),f=Un(r.before.charCodeAt(r.before.length-1),l,i);f.inside&&(o=mn(l)+o.slice(1));const d=o.charCodeAt(o.length-1),m=Un(r.after.charCodeAt(0),d,i);m.inside&&(o=o.slice(0,-1)+mn(d));const h=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:f.outside},u+o+h}function p2(t,e,n){return n.options.strong||"*"}function g2(t,e,n,r){return n.safe(t.value,r)}function E2(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function b2(t,e,n){const r=(go(n)+(n.options.ruleSpaces?" ":"")).repeat(E2(n));return n.options.ruleSpaces?r.slice(0,-1):r}const bo={blockquote:jg,break:Vs,code:Wg,definition:Qg,emphasis:uo,hardBreak:Vs,heading:Jg,html:oo,image:lo,imageReference:co,inlineCode:fo,link:mo,linkReference:po,list:o2,listItem:c2,paragraph:f2,root:h2,strong:Eo,text:g2,thematicBreak:b2};function T2(){return{enter:{table:x2,tableData:Ws,tableHeader:Ws,tableRow:A2},exit:{codeText:k2,table:_2,tableData:yr,tableHeader:yr,tableRow:yr}}}function x2(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function _2(t){this.exit(t),this.data.inTable=void 0}function A2(t){this.enter({type:"tableRow",children:[]},t)}function yr(t){this.exit(t)}function Ws(t){this.enter({type:"tableCell",children:[]},t)}function k2(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,C2));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function C2(t,e){return e==="|"?e:t}function N2(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
85
85
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:o,tableRow:u}};function a(h,g,A,C){return l(f(h,A,C),h.align)}function u(h,g,A,C){const T=d(h,A,C),y=l([T]);return y.slice(0,y.indexOf(`
86
- `))}function o(h,g,A,C){const T=A.enter("tableCell"),y=A.enter("phrasing"),N=A.containerPhrasing(h,{...C,before:s,after:s});return y(),T(),N}function l(h,g){return Hg(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function f(h,g,A){const C=h.children;let T=-1;const y=[],N=g.enter("table");for(;++T<C.length;)y[T]=d(C[T],g,A);return N(),y}function d(h,g,A){const C=h.children;let T=-1;const y=[],N=g.enter("tableRow");for(;++T<C.length;)y[T]=o(C[T],h,g,A);return N(),y}function m(h,g,A){let C=bo.inlineCode(h,g,A);return A.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function y2(){return{exit:{taskListCheckValueChecked:Gs,taskListCheckValueUnchecked:Gs,paragraph:I2}}}function S2(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:w2}}}function Gs(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function I2(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,a;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function w2(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(a);let o=bo.listItem(t,e,n,{...r,...u.current()});return s&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+a}}function L2(){return[og(),wg(),Dg(),T2(),y2()]}function R2(t){return{extensions:[lg(),Lg(t),Pg(),N2(t),S2()]}}const O2={tokenize:F2,partial:!0},To={tokenize:H2,partial:!0},xo={tokenize:U2,partial:!0},_o={tokenize:j2,partial:!0},D2={tokenize:z2,partial:!0},Ao={name:"wwwAutolink",tokenize:v2,previous:Co},ko={name:"protocolAutolink",tokenize:B2,previous:No},ut={name:"emailAutolink",tokenize:M2,previous:yo},tt={};function P2(){return{text:tt}}let gt=48;for(;gt<123;)tt[gt]=ut,gt++,gt===58?gt=65:gt===91&&(gt=97);tt[43]=ut;tt[45]=ut;tt[46]=ut;tt[95]=ut;tt[72]=[ut,ko];tt[104]=[ut,ko];tt[87]=[ut,Ao];tt[119]=[ut,Ao];function M2(t,e,n){const r=this;let i,s;return a;function a(d){return!Yr(d)||!yo.call(r,r.previous)||Ni(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return Yr(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(D2,f,l)(d):d===45||d===95||Le(d)?(s=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return s&&i&&ve(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function v2(t,e,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Co.call(r,r.previous)||Ni(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(O2,t.attempt(To,t.attempt(xo,s),n),n)(a))}function s(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function B2(t,e,n){const r=this;let i="",s=!1;return a;function a(d){return(d===72||d===104)&&No.call(r,r.previous)&&!Ni(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if(ve(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const m=i.toLowerCase();if(m==="http"||m==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),s?l:(s=!0,o)):n(d)}function l(d){return d===null||Mn(d)||me(d)||kt(d)||Kn(d)?n(d):t.attempt(To,t.attempt(xo,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function F2(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),s):n(a)}function s(a){return a===null?n(a):e(a)}}function H2(t,e,n){let r,i,s;return a;function a(l){return l===46||l===95?t.check(_o,o,u)(l):l===null||me(l)||kt(l)||l!==45&&Kn(l)?o(l):(s=!0,t.consume(l),a)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),a}function o(l){return i||r||!s?n(l):e(l)}}function U2(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(_o,e,s)(a):a===null||me(a)||kt(a)?e(a):(t.consume(a),i)}function s(a){return a===41&&r++,t.consume(a),i}}function j2(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),s):u===93?(t.consume(u),i):u===60||u===null||me(u)||kt(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||me(u)||kt(u)?e(u):r(u)}function s(u){return ve(u)?a(u):n(u)}function a(u){return u===59?(t.consume(u),r):ve(u)?(t.consume(u),a):n(u)}}function z2(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return Le(s)?n(s):e(s)}}function Co(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||me(t)}function No(t){return!ve(t)}function yo(t){return!(t===47||Yr(t))}function Yr(t){return t===43||t===45||t===46||t===95||Le(t)}function Ni(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $2={tokenize:X2,partial:!0};function Y2(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G2,continuation:{tokenize:Q2},exit:K2}},text:{91:{name:"gfmFootnoteCall",tokenize:W2},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q2,resolveTo:V2}}}}function q2(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){a=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!a||!a._balanced)return n(o);const l=Qe(r.sliceSerialize({start:a.end,end:r.now()}));return l.codePointAt(0)!==94||!s.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function V2(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function W2(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(s>999||d===93&&!a||d===null||d===91||me(d))return n(d);if(d===93){t.exit("chunkString");const m=t.exit("gfmFootnoteCallString");return i.includes(Qe(r.sliceSerialize(m)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return me(d)||(a=!0),s++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),s++,l):l(d)}}function G2(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,u;return o;function o(g){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(g){return g===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(g)}function f(g){if(a>999||g===93&&!u||g===null||g===91||me(g))return n(g);if(g===93){t.exit("chunkString");const A=t.exit("gfmFootnoteDefinitionLabelString");return s=Qe(r.sliceSerialize(A)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),m}return me(g)||(u=!0),a++,t.consume(g),g===92?d:f}function d(g){return g===91||g===92||g===93?(t.consume(g),a++,f):f(g)}function m(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),i.includes(s)||i.push(s),se(t,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return e(g)}}function Q2(t,e,n){return t.check(bn,e,t.attempt($2,e,n))}function K2(t){t.exit("gfmFootnoteDefinition")}function X2(t,e,n){const r=this;return se(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(s):n(s)}}function Z2(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,u){let o=-1;for(;++o<a.length;)if(a[o][0]==="enter"&&a[o][1].type==="strikethroughSequenceTemporary"&&a[o][1]._close){let l=o;for(;l--;)if(a[l][0]==="exit"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._open&&a[o][1].end.offset-a[o][1].start.offset===a[l][1].end.offset-a[l][1].start.offset){a[o][1].type="strikethroughSequence",a[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[l][1].start),end:Object.assign({},a[o][1].end)},d={type:"strikethroughText",start:Object.assign({},a[l][1].end),end:Object.assign({},a[o][1].start)},m=[["enter",f,u],["enter",a[l][1],u],["exit",a[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&Ye(m,m.length,0,Xn(h,a.slice(l+1,o),u)),Ye(m,m.length,0,[["exit",d,u],["enter",a[o][1],u],["exit",a[o][1],u],["exit",f,u]]),Ye(a,l-1,o-l+3,m),o=l+m.length-2;break}}for(o=-1;++o<a.length;)a[o][1].type==="strikethroughSequenceTemporary"&&(a[o][1].type="data");return a}function s(a,u,o){const l=this.previous,f=this.events;let d=0;return m;function m(g){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(g):(a.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const A=Dt(l);if(g===126)return d>1?o(g):(a.consume(g),d++,h);if(d<2&&!n)return o(g);const C=a.exit("strikethroughSequenceTemporary"),T=Dt(g);return C._open=!T||T===2&&!!A,C._close=!A||A===2&&!!T,u(g)}}}class J2{constructor(){this.map=[]}add(e,n,r){eE(this,e,n,r)}consume(e){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function eE(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function tE(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function nE(){return{flow:{null:{name:"table",tokenize:rE,resolveAll:iE}}}}function rE(t,e,n){const r=this;let i=0,s=0,a;return u;function u(I){let F=r.events.length-1;for(;F>-1;){const Y=r.events[F][1].type;if(Y==="lineEnding"||Y==="linePrefix")F--;else break}const z=F>-1?r.events[F][1].type:null,G=z==="tableHead"||z==="tableRow"?S:o;return G===S&&r.parser.lazy[r.now().line]?n(I):G(I)}function o(I){return t.enter("tableHead"),t.enter("tableRow"),l(I)}function l(I){return I===124||(a=!0,s+=1),f(I)}function f(I){return I===null?n(I):Q(I)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),h):n(I):ne(I)?se(t,f,"whitespace")(I):(s+=1,a&&(a=!1,i+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),d(I)))}function d(I){return I===null||I===124||me(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?m:d)}function m(I){return I===92||I===124?(t.consume(I),d):d(I)}function h(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,ne(I)?se(t,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):g(I))}function g(I){return I===45||I===58?C(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),A):O(I)}function A(I){return ne(I)?se(t,C,"whitespace")(I):C(I)}function C(I){return I===58?(s+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),T):I===45?(s+=1,T(I)):I===null||Q(I)?L(I):O(I)}function T(I){return I===45?(t.enter("tableDelimiterFiller"),y(I)):O(I)}function y(I){return I===45?(t.consume(I),y):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(I))}function N(I){return ne(I)?se(t,L,"whitespace")(I):L(I)}function L(I){return I===124?g(I):I===null||Q(I)?!a||i!==s?O(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):O(I)}function O(I){return n(I)}function S(I){return t.enter("tableRow"),B(I)}function B(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),B):I===null||Q(I)?(t.exit("tableRow"),e(I)):ne(I)?se(t,B,"whitespace")(I):(t.enter("data"),$(I))}function $(I){return I===null||I===124||me(I)?(t.exit("data"),B(I)):(t.consume(I),I===92?H:$)}function H(I){return I===92||I===124?(t.consume(I),$):$(I)}}function iE(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],u=!1,o=0,l,f,d;const m=new J2;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(Qs(m,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",l,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",f,e]])),i=g.type==="tableDelimiterRow"?2:f?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],d=Sn(m,e,s,i,void 0,d),s=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],d=Sn(m,e,s,i,void 0,d)),s=a,a=[s[1],n,0,0])):g.type==="tableHead"?(u=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,s[1]!==0?(a[0]=a[1],d=Sn(m,e,s,i,n,d)):a[1]!==0&&(d=Sn(m,e,a,i,n,d)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(o!==0&&Qs(m,e,o,l,f),m.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=tE(e.events,n))}return t}function Sn(t,e,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Lt(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const o=Lt(e.events,n[1]);if(s={type:a,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const l=Lt(e.events,n[2]),f=Lt(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const m=e.events[n[2]],h=e.events[n[3]];if(m[1].end=Object.assign({},h[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,A=n[3]-n[2]-1;t.add(g,A,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Lt(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function Qs(t,e,n,r,i){const s=[],a=Lt(e.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,e])),r.end=Object.assign({},a),s.push(["exit",r,e]),t.add(n+1,0,s)}function Lt(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const sE={name:"tasklistCheck",tokenize:uE};function aE(){return{text:{91:sE}}}function uE(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),s)}function s(o){return me(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),a):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),a):n(o)}function a(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return Q(o)?e(o):ne(o)?t.check({tokenize:oE},e,n)(o):n(o)}}function oE(t,e,n){return se(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function lE(t){return eu([P2(),Y2(),Z2(t),nE(),aE()])}const cE={};function fE(t){const e=this,n=t||cE,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(lE(n)),s.push(L2()),a.push(R2(n))}const dE=j.lazy(()=>$o(()=>import("./lazy-highlighter-Ccgc_fxj.js"),__vite__mapDeps([0,1,2])));function So(){const t=V.c(3),[e,n]=j.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async a=>{await navigator.clipboard.writeText(a),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let s;return t[1]!==e?(s={handleCopy:i,copied:e},t[1]=e,t[2]=s):s=t[2],s}function hE(){const t=V.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(mE)}),t[1]=r):r=t[1],r}function mE(t,e){return p.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&p.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function pE(t){const e=V.c(12),n=j.useRef(null),{handleCopy:r,copied:i}=So(),s=gE;let a;e[0]!==r?(a=async()=>{const m=s(n.current);await r(m)},e[0]=r,e[1]=a):a=e[1];const u=a;let o;e[2]!==i?(o=i?p.jsx(xt,{size:12}):p.jsx(Gr,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=p.jsx("div",{className:"flex justify-end items-center",children:p.jsxs(We,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=p.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:p.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=p.jsxs(p.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function gE(t){return t?Array.from(t.querySelectorAll("tr")).map(EE).join(`
86
+ `))}function o(h,g,A,C){const T=A.enter("tableCell"),y=A.enter("phrasing"),N=A.containerPhrasing(h,{...C,before:s,after:s});return y(),T(),N}function l(h,g){return Hg(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function f(h,g,A){const C=h.children;let T=-1;const y=[],N=g.enter("table");for(;++T<C.length;)y[T]=d(C[T],g,A);return N(),y}function d(h,g,A){const C=h.children;let T=-1;const y=[],N=g.enter("tableRow");for(;++T<C.length;)y[T]=o(C[T],h,g,A);return N(),y}function m(h,g,A){let C=bo.inlineCode(h,g,A);return A.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function y2(){return{exit:{taskListCheckValueChecked:Gs,taskListCheckValueUnchecked:Gs,paragraph:I2}}}function S2(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:w2}}}function Gs(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function I2(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,a;for(;++s<i.length;){const u=i[s];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function w2(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(a);let o=bo.listItem(t,e,n,{...r,...u.current()});return s&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+a}}function L2(){return[og(),wg(),Dg(),T2(),y2()]}function R2(t){return{extensions:[lg(),Lg(t),Pg(),N2(t),S2()]}}const O2={tokenize:F2,partial:!0},To={tokenize:H2,partial:!0},xo={tokenize:U2,partial:!0},_o={tokenize:j2,partial:!0},D2={tokenize:z2,partial:!0},Ao={name:"wwwAutolink",tokenize:v2,previous:Co},ko={name:"protocolAutolink",tokenize:B2,previous:No},ut={name:"emailAutolink",tokenize:M2,previous:yo},tt={};function P2(){return{text:tt}}let gt=48;for(;gt<123;)tt[gt]=ut,gt++,gt===58?gt=65:gt===91&&(gt=97);tt[43]=ut;tt[45]=ut;tt[46]=ut;tt[95]=ut;tt[72]=[ut,ko];tt[104]=[ut,ko];tt[87]=[ut,Ao];tt[119]=[ut,Ao];function M2(t,e,n){const r=this;let i,s;return a;function a(d){return!Yr(d)||!yo.call(r,r.previous)||Ni(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return Yr(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(D2,f,l)(d):d===45||d===95||Le(d)?(s=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return s&&i&&ve(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function v2(t,e,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Co.call(r,r.previous)||Ni(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(O2,t.attempt(To,t.attempt(xo,s),n),n)(a))}function s(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function B2(t,e,n){const r=this;let i="",s=!1;return a;function a(d){return(d===72||d===104)&&No.call(r,r.previous)&&!Ni(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if(ve(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const m=i.toLowerCase();if(m==="http"||m==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),s?l:(s=!0,o)):n(d)}function l(d){return d===null||Mn(d)||me(d)||kt(d)||Kn(d)?n(d):t.attempt(To,t.attempt(xo,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function F2(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),s):n(a)}function s(a){return a===null?n(a):e(a)}}function H2(t,e,n){let r,i,s;return a;function a(l){return l===46||l===95?t.check(_o,o,u)(l):l===null||me(l)||kt(l)||l!==45&&Kn(l)?o(l):(s=!0,t.consume(l),a)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),a}function o(l){return i||r||!s?n(l):e(l)}}function U2(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(_o,e,s)(a):a===null||me(a)||kt(a)?e(a):(t.consume(a),i)}function s(a){return a===41&&r++,t.consume(a),i}}function j2(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),s):u===93?(t.consume(u),i):u===60||u===null||me(u)||kt(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||me(u)||kt(u)?e(u):r(u)}function s(u){return ve(u)?a(u):n(u)}function a(u){return u===59?(t.consume(u),r):ve(u)?(t.consume(u),a):n(u)}}function z2(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return Le(s)?n(s):e(s)}}function Co(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||me(t)}function No(t){return!ve(t)}function yo(t){return!(t===47||Yr(t))}function Yr(t){return t===43||t===45||t===46||t===95||Le(t)}function Ni(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $2={tokenize:X2,partial:!0};function Y2(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G2,continuation:{tokenize:Q2},exit:K2}},text:{91:{name:"gfmFootnoteCall",tokenize:W2},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q2,resolveTo:V2}}}}function q2(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){a=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!a||!a._balanced)return n(o);const l=Qe(r.sliceSerialize({start:a.end,end:r.now()}));return l.codePointAt(0)!==94||!s.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function V2(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function W2(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(s>999||d===93&&!a||d===null||d===91||me(d))return n(d);if(d===93){t.exit("chunkString");const m=t.exit("gfmFootnoteCallString");return i.includes(Qe(r.sliceSerialize(m)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return me(d)||(a=!0),s++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),s++,l):l(d)}}function G2(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,u;return o;function o(g){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(g){return g===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(g)}function f(g){if(a>999||g===93&&!u||g===null||g===91||me(g))return n(g);if(g===93){t.exit("chunkString");const A=t.exit("gfmFootnoteDefinitionLabelString");return s=Qe(r.sliceSerialize(A)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),m}return me(g)||(u=!0),a++,t.consume(g),g===92?d:f}function d(g){return g===91||g===92||g===93?(t.consume(g),a++,f):f(g)}function m(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),i.includes(s)||i.push(s),se(t,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return e(g)}}function Q2(t,e,n){return t.check(bn,e,t.attempt($2,e,n))}function K2(t){t.exit("gfmFootnoteDefinition")}function X2(t,e,n){const r=this;return se(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(s):n(s)}}function Z2(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,u){let o=-1;for(;++o<a.length;)if(a[o][0]==="enter"&&a[o][1].type==="strikethroughSequenceTemporary"&&a[o][1]._close){let l=o;for(;l--;)if(a[l][0]==="exit"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._open&&a[o][1].end.offset-a[o][1].start.offset===a[l][1].end.offset-a[l][1].start.offset){a[o][1].type="strikethroughSequence",a[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[l][1].start),end:Object.assign({},a[o][1].end)},d={type:"strikethroughText",start:Object.assign({},a[l][1].end),end:Object.assign({},a[o][1].start)},m=[["enter",f,u],["enter",a[l][1],u],["exit",a[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&Ye(m,m.length,0,Xn(h,a.slice(l+1,o),u)),Ye(m,m.length,0,[["exit",d,u],["enter",a[o][1],u],["exit",a[o][1],u],["exit",f,u]]),Ye(a,l-1,o-l+3,m),o=l+m.length-2;break}}for(o=-1;++o<a.length;)a[o][1].type==="strikethroughSequenceTemporary"&&(a[o][1].type="data");return a}function s(a,u,o){const l=this.previous,f=this.events;let d=0;return m;function m(g){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(g):(a.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const A=Dt(l);if(g===126)return d>1?o(g):(a.consume(g),d++,h);if(d<2&&!n)return o(g);const C=a.exit("strikethroughSequenceTemporary"),T=Dt(g);return C._open=!T||T===2&&!!A,C._close=!A||A===2&&!!T,u(g)}}}class J2{constructor(){this.map=[]}add(e,n,r){eE(this,e,n,r)}consume(e){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function eE(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function tE(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function nE(){return{flow:{null:{name:"table",tokenize:rE,resolveAll:iE}}}}function rE(t,e,n){const r=this;let i=0,s=0,a;return u;function u(I){let F=r.events.length-1;for(;F>-1;){const Y=r.events[F][1].type;if(Y==="lineEnding"||Y==="linePrefix")F--;else break}const z=F>-1?r.events[F][1].type:null,G=z==="tableHead"||z==="tableRow"?S:o;return G===S&&r.parser.lazy[r.now().line]?n(I):G(I)}function o(I){return t.enter("tableHead"),t.enter("tableRow"),l(I)}function l(I){return I===124||(a=!0,s+=1),f(I)}function f(I){return I===null?n(I):Q(I)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),h):n(I):ne(I)?se(t,f,"whitespace")(I):(s+=1,a&&(a=!1,i+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),d(I)))}function d(I){return I===null||I===124||me(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?m:d)}function m(I){return I===92||I===124?(t.consume(I),d):d(I)}function h(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,ne(I)?se(t,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):g(I))}function g(I){return I===45||I===58?C(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),A):O(I)}function A(I){return ne(I)?se(t,C,"whitespace")(I):C(I)}function C(I){return I===58?(s+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),T):I===45?(s+=1,T(I)):I===null||Q(I)?L(I):O(I)}function T(I){return I===45?(t.enter("tableDelimiterFiller"),y(I)):O(I)}function y(I){return I===45?(t.consume(I),y):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(I))}function N(I){return ne(I)?se(t,L,"whitespace")(I):L(I)}function L(I){return I===124?g(I):I===null||Q(I)?!a||i!==s?O(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):O(I)}function O(I){return n(I)}function S(I){return t.enter("tableRow"),B(I)}function B(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),B):I===null||Q(I)?(t.exit("tableRow"),e(I)):ne(I)?se(t,B,"whitespace")(I):(t.enter("data"),$(I))}function $(I){return I===null||I===124||me(I)?(t.exit("data"),B(I)):(t.consume(I),I===92?H:$)}function H(I){return I===92||I===124?(t.consume(I),$):$(I)}}function iE(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],u=!1,o=0,l,f,d;const m=new J2;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(Qs(m,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",l,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",f,e]])),i=g.type==="tableDelimiterRow"?2:f?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],d=Sn(m,e,s,i,void 0,d),s=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],d=Sn(m,e,s,i,void 0,d)),s=a,a=[s[1],n,0,0])):g.type==="tableHead"?(u=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,s[1]!==0?(a[0]=a[1],d=Sn(m,e,s,i,n,d)):a[1]!==0&&(d=Sn(m,e,a,i,n,d)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(o!==0&&Qs(m,e,o,l,f),m.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=tE(e.events,n))}return t}function Sn(t,e,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},Lt(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const o=Lt(e.events,n[1]);if(s={type:a,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const l=Lt(e.events,n[2]),f=Lt(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const m=e.events[n[2]],h=e.events[n[3]];if(m[1].end=Object.assign({},h[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,A=n[3]-n[2]-1;t.add(g,A,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Lt(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function Qs(t,e,n,r,i){const s=[],a=Lt(e.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,e])),r.end=Object.assign({},a),s.push(["exit",r,e]),t.add(n+1,0,s)}function Lt(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const sE={name:"tasklistCheck",tokenize:uE};function aE(){return{text:{91:sE}}}function uE(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),s)}function s(o){return me(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),a):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),a):n(o)}function a(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return Q(o)?e(o):ne(o)?t.check({tokenize:oE},e,n)(o):n(o)}}function oE(t,e,n){return se(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function lE(t){return eu([P2(),Y2(),Z2(t),nE(),aE()])}const cE={};function fE(t){const e=this,n=t||cE,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(lE(n)),s.push(L2()),a.push(R2(n))}const dE=j.lazy(()=>$o(()=>import("./lazy-highlighter-C5pGkBnk.js"),__vite__mapDeps([0,1,2])));function So(){const t=V.c(3),[e,n]=j.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async a=>{await navigator.clipboard.writeText(a),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let s;return t[1]!==e?(s={handleCopy:i,copied:e},t[1]=e,t[2]=s):s=t[2],s}function hE(){const t=V.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(mE)}),t[1]=r):r=t[1],r}function mE(t,e){return p.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&p.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&p.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function pE(t){const e=V.c(12),n=j.useRef(null),{handleCopy:r,copied:i}=So(),s=gE;let a;e[0]!==r?(a=async()=>{const m=s(n.current);await r(m)},e[0]=r,e[1]=a):a=e[1];const u=a;let o;e[2]!==i?(o=i?p.jsx(xt,{size:12}):p.jsx(Gr,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=p.jsx("div",{className:"flex justify-end items-center",children:p.jsxs(We,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=p.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:p.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=p.jsxs(p.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function gE(t){return t?Array.from(t.querySelectorAll("tr")).map(EE).join(`
87
87
  `):""}function EE(t){return Array.from(t.querySelectorAll("th,td")).map(bE).join(",")}function bE(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const TE=[fE],xE=[ng],_E={p:t=>p.jsx("p",{...t,className:"leading-relaxed text-[15px] mb-2 last:mb-0"}),strong:t=>p.jsx("strong",{...t,className:"font-bold"}),em:t=>p.jsx("em",{...t,className:"italic"}),a:t=>p.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-primary-dark hover:underline break-all font-medium"}),ul:t=>p.jsx("ul",{...t,className:"list-disc ml-6 my-4 space-y-2"}),ol:t=>p.jsx("ol",{...t,className:"list-decimal ml-6 my-4 space-y-2"}),li:t=>p.jsx("li",{...t,className:"leading-relaxed text-[15px]"}),code:t=>p.jsx("code",{...t,className:"px-1 py-0.5 bg-muted rounded text-[15px] font-mono break-all"}),pre:t=>p.jsx("pre",{...t,className:"flex w-full min-w-0 my-4 bg-muted rounded overflow-hidden",children:p.jsx("code",{className:"flex-1 min-w-0 p-4 text-[15px] font-mono whitespace-pre overflow-x-auto",children:t.children})}),table:t=>p.jsx(pE,{...t}),thead:t=>p.jsx("thead",{...t,className:"bg-muted",children:t.children}),tr:t=>p.jsx("tr",{...t,className:"even:bg-muted/50 border-b border-border last:border-0"}),th:t=>p.jsx("th",{...t,className:"px-4 py-2 text-left font-semibold text-muted-foreground border-b border-border"}),td:t=>p.jsx("td",{...t,className:"px-4 py-2 border-b border-border"})},Io=j.memo(t=>{const e=V.c(2),{content:n}=t;let r;return e[0]!==n?(r=p.jsx(Uh,{remarkPlugins:TE,rehypePlugins:xE,components:_E,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function AE(t){const e=V.c(20),{language:n,content:r}=t,{handleCopy:i,copied:s}=So(),a=n||"text";let u;e[0]!==a?(u=p.jsx("span",{className:"text-xs font-mono uppercase text-muted-foreground tracking-widest select-none",children:a}),e[0]=a,e[1]=u):u=e[1];let o;e[2]!==r||e[3]!==i?(o=()=>i(r),e[2]=r,e[3]=i,e[4]=o):o=e[4];let l;e[5]!==s?(l=s?p.jsx(xt,{size:14}):p.jsx(Gr,{size:14}),e[5]=s,e[6]=l):l=e[6];let f;e[7]!==o||e[8]!==l?(f=p.jsx(We,{size:"icon",variant:"ghost",onClick:o,"aria-label":"Copy code",className:"text-muted-foreground hover:text-foreground rounded-lg h-8 w-8",children:l}),e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==u||e[11]!==f?(d=p.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 bg-muted border-b border-border",children:[u,f]}),e[10]=u,e[11]=f,e[12]=d):d=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=p.jsx(hE,{}),e[13]=m):m=e[13];let h;e[14]!==r||e[15]!==n?(h=p.jsx(j.Suspense,{fallback:m,children:p.jsx(dE,{language:n,content:r})}),e[14]=r,e[15]=n,e[16]=h):h=e[16];let g;return e[17]!==d||e[18]!==h?(g=p.jsxs("div",{className:"my-4 rounded-lg bg-muted overflow-hidden border border-border grid min-w-0",children:[d,h]}),e[17]=d,e[18]=h,e[19]=g):g=e[19],g}Io.displayName="MemoizedMarkdownBlock";const yi=t=>{const e=V.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=fe.lexer(r),e[0]=r,e[1]=i):i=e[1];const s=i;let a;if(e[2]!==s||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?p.jsx(AE,{language:o.lang,content:o.text},`${n}-block_${l}`):p.jsx(Io,{content:o.raw},`${n}-block_${l}`),e[5]=n,e[6]=u):u=e[6],a=s.map(u),e[2]=s,e[3]=n,e[4]=a}else a=e[4];return a};yi.displayName="MemoizedMarkdown";function wo(t){const e=V.c(18),{id:n,part:r,copyable:i,extraActions:s,hasToolCallAfter:a}=t,u=i===void 0?!1:i,o=a===void 0?!1:a,{handleCopy:l}=Kl(),[f,d]=j.useState(!1);let m;e[0]!==l||e[1]!==r.text?(m=async()=>{await l(r.text),d(!0),setTimeout(()=>d(!1),2e3)},e[0]=l,e[1]=r.text,e[2]=m):m=e[2];const h=m,g=u&&s,A=g||s,C=!o&&"mb-2";let T;e[3]!==C?(T=ae("group/part relative",C),e[3]=C,e[4]=T):T=e[4];let y;e[5]!==n||e[6]!==r.text?(y=p.jsx(yi,{id:n,text:r.text}),e[5]=n,e[6]=r.text,e[7]=y):y=e[7];let N;e[8]!==s||e[9]!==h||e[10]!==f||e[11]!==A||e[12]!==g?(N=A&&p.jsx("div",{className:"flex w-full items-center text-xs text-muted-foreground opacity-0 pointer-events-none transition-all duration-200 group-hover/part:opacity-100 group-hover/part:pointer-events-auto mt-2",children:p.jsxs("div",{className:"flex items-center gap-1",children:[g&&p.jsx(We,{onClick:h,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground size-6 whitespace-nowrap",children:f?p.jsx(xt,{size:12}):p.jsx(Gr,{size:12})}),s]})}),e[8]=s,e[9]=h,e[10]=f,e[11]=A,e[12]=g,e[13]=N):N=e[13];let L;return e[14]!==T||e[15]!==y||e[16]!==N?(L=p.jsxs("div",{className:T,children:[y,N]}),e[14]=T,e[15]=y,e[16]=N,e[17]=L):L=e[17],L}function kE(t){const e=V.c(4),{output:n}=t;let r;if(e[0]!==n){const a=JSON.stringify(n,null,2);r=a.length>2e3?a.slice(0,2e3)+"...[TRUNCATED]":a,e[0]=n,e[1]=r}else r=e[1];const i=r;let s;return e[2]!==i?(s=p.jsx("div",{className:"h-full",children:p.jsx(ca,{code:i,language:"json",height:"100%",readOnly:!0})}),e[2]=i,e[3]=s):s=e[3],s}var ar="Collapsible",[CE,eT]=Yo(ar),[NE,Si]=CE(ar),Lo=j.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:a,...u}=t,[o,l]=qo({prop:r,defaultProp:i??!1,onChange:a,caller:ar});return p.jsx(NE,{scope:n,disabled:s,contentId:Vo(),open:o,onOpenToggle:j.useCallback(()=>l(f=>!f),[l]),children:p.jsx(Vr.div,{"data-state":Ri(o),"data-disabled":s?"":void 0,...u,ref:e})})});Lo.displayName=ar;var Ro="CollapsibleTrigger",Ii=j.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=Si(Ro,n);return p.jsx(Vr.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Ri(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Go(t.onClick,i.onOpenToggle)})});Ii.displayName=Ro;var wi="CollapsibleContent",Li=j.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Si(wi,t.__scopeCollapsible);return p.jsx(Wo,{present:n||i.open,children:({present:s})=>p.jsx(yE,{...r,ref:e,present:s})})});Li.displayName=wi;var yE=j.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,a=Si(wi,n),[u,o]=j.useState(r),l=j.useRef(null),f=Qo(e,l),d=j.useRef(0),m=d.current,h=j.useRef(0),g=h.current,A=a.open||u,C=j.useRef(A),T=j.useRef(void 0);return j.useEffect(()=>{const y=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(y)},[]),Ko(()=>{const y=l.current;if(y){T.current=T.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const N=y.getBoundingClientRect();d.current=N.height,h.current=N.width,C.current||(y.style.transitionDuration=T.current.transitionDuration,y.style.animationName=T.current.animationName),o(r)}},[a.open,r]),p.jsx(Vr.div,{"data-state":Ri(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!A,...s,ref:f,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:A&&i})});function Ri(t){return t?"open":"closed"}var SE=Lo,tT=Ii,nT=Li;function IE(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(SE,{"data-slot":"collapsible",...n}),e[2]=n,e[3]=r):r=e[3],r}function wE(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(Ii,{"data-slot":"collapsible-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function LE(t){const e=V.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(Li,{"data-slot":"collapsible-content",...n}),e[2]=n,e[3]=r):r=e[3],r}function RE(t){return t.split(/[_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}function Ks(t){const e=V.c(70),{part:n,isFirstInSequence:r,isLastInSequence:i,hasNextToolCall:s}=t,a=r===void 0?!1:r,u=i===void 0?!1:i,o=s===void 0?!1:s,{state:l}=n;let f;e[0]!==n?(f="toolName"in n?n.toolName:n.type.replace("tool-",""),e[0]=n,e[1]=f):f=e[1];const d=f;let m;e[2]!==d?(m=RE(d),e[2]=d,e[3]=m):m=e[3];const h=m,[g,A]=j.useState(!1),[C]=Bl(),T=(l==="input-streaming"||l==="input-available"||l==="output-available")&&!!n.input,y=l==="output-available",N=l==="output-error";if(!C){const _e=l==="input-streaming"||l==="input-available",ue=l==="output-available",Ae=l==="output-error",ge=a&&"mt-2",be=u&&"mb-2";let de;e[4]!==ge||e[5]!==be?(de=ae("flex items-center gap-1.5 py-2 opacity-75 relative",ge,be),e[4]=ge,e[5]=be,e[6]=de):de=e[6];let ke;e[7]===Symbol.for("react.memo_cache_sentinel")?(ke=p.jsx(fa,{className:"size-4 text-muted-foreground shrink-0"}),e[7]=ke):ke=e[7];let xe;e[8]!==o?(xe=o&&p.jsx("div",{className:"absolute left-1/2 top-full w-px bg-border -translate-x-1/2",style:{height:"calc(100% + 1rem)"}}),e[8]=o,e[9]=xe):xe=e[9];let De;e[10]!==xe?(De=p.jsxs("div",{className:"relative shrink-0 flex items-center",children:[ke,xe]}),e[10]=xe,e[11]=De):De=e[11];let Pe;e[12]!==h||e[13]!==_e?(Pe=_e&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground shimmer",children:"Calling"})," ",p.jsxs("span",{className:"text-muted-foreground/75 shimmer",children:[h,"..."]})]}),e[12]=h,e[13]=_e,e[14]=Pe):Pe=e[14];let we;e[15]!==h||e[16]!==ue?(we=ue&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground",children:"Called"})," ",p.jsx("span",{className:"text-muted-foreground/75",children:h})]}),e[15]=h,e[16]=ue,e[17]=we):we=e[17];let Fe;e[18]!==h||e[19]!==Ae?(Fe=Ae&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-destructive/90",children:"Error calling"})," ",p.jsx("span",{className:"text-destructive/75",children:h})]}),e[18]=h,e[19]=Ae,e[20]=Fe):Fe=e[20];let re;e[21]!==Pe||e[22]!==we||e[23]!==Fe?(re=p.jsxs("span",{className:"text-[15px]",children:[Pe,we,Fe]}),e[21]=Pe,e[22]=we,e[23]=Fe,e[24]=re):re=e[24];let Ie;return e[25]!==De||e[26]!==re||e[27]!==de?(Ie=p.jsxs("div",{className:de,children:[De,re]}),e[25]=De,e[26]=re,e[27]=de,e[28]=Ie):Ie=e[28],Ie}let L;e[29]!==l?(L=l==="output-error"?p.jsx(aa,{className:"size-4 text-destructive shrink-0"}):p.jsx(fl,{className:ae("size-4 text-muted-foreground shrink-0",(l==="input-streaming"||l==="input-available")&&"shimmer")}),e[29]=l,e[30]=L):L=e[30];const O=l==="output-error"&&"text-destructive/90",S=(l==="input-streaming"||l==="input-available")&&"shimmer";let B;e[31]!==O||e[32]!==S?(B=ae("text-[15px] font-medium text-muted-foreground truncate",O,S),e[31]=O,e[32]=S,e[33]=B):B=e[33];const $=l==="input-streaming"&&`Streaming ${d} arguments`,H=l==="input-available"&&`Calling ${d}`,I=l==="output-available"&&`Called ${d}`,F=l==="output-error"&&`Error calling ${d}`;let z;e[34]!==$||e[35]!==H||e[36]!==I||e[37]!==F||e[38]!==B?(z=p.jsxs("span",{className:B,children:[$,H,I,F]}),e[34]=$,e[35]=H,e[36]=I,e[37]=F,e[38]=B,e[39]=z):z=e[39];let G;e[40]!==z||e[41]!==L?(G=p.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[L,z]}),e[40]=z,e[41]=L,e[42]=G):G=e[42];const Y=g&&"rotate-90";let M;e[43]!==Y?(M=ae("size-4 text-muted-foreground transition-transform duration-200",Y),e[43]=Y,e[44]=M):M=e[44];let W;e[45]!==M?(W=p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(ua,{className:M})}),e[45]=M,e[46]=W):W=e[46];let K;e[47]!==G||e[48]!==W?(K=p.jsxs(wE,{className:"flex items-center gap-2 w-full cursor-pointer p-3 hover:bg-accent/50 transition-colors",children:[G,W]}),e[47]=G,e[48]=W,e[49]=K):K=e[49];let ee;e[50]===Symbol.for("react.memo_cache_sentinel")?(ee=p.jsx("div",{className:"w-4 relative shrink-0",children:p.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-0.25 bg-border"})}),e[50]=ee):ee=e[50];let te;e[51]!==n.input||e[52]!==T?(te=T&&p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("div",{className:"px-1 h-5 flex items-center",children:p.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Input"})}),p.jsx("div",{className:"border border-border rounded-lg p-2 h-full max-h-[200px]",children:p.jsx(ca,{code:JSON.stringify(n.input,null,2),language:"json",foldOnMount:!0,height:"100%",readOnly:!0})})]}),e[51]=n.input,e[52]=T,e[53]=te):te=e[53];let _;e[54]!==n.output||e[55]!==y?(_=y&&p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("div",{className:"px-1 h-5 flex items-center",children:p.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output"})}),p.jsx("div",{className:"border border-border rounded-lg max-h-[200px] overflow-auto p-2 h-full",children:p.jsx(kE,{output:n.output})})]}),e[54]=n.output,e[55]=y,e[56]=_):_=e[56];let oe;e[57]!==n||e[58]!==N?(oe=N&&p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("div",{className:"px-1 h-5 flex items-center",children:p.jsx("span",{className:"text-xs font-medium text-destructive/90",children:"Error"})}),p.jsx("div",{className:"border border-destructive/20 rounded-lg max-h-[200px] overflow-auto p-2 bg-destructive/10",children:p.jsx("pre",{className:"text-xs font-mono text-destructive whitespace-pre-wrap wrap-break-word",children:"errorText"in n&&typeof n.errorText=="string"?n.errorText:"An unknown error occurred"})})]}),e[57]=n,e[58]=N,e[59]=oe):oe=e[59];let pe;e[60]!==te||e[61]!==_||e[62]!==oe?(pe=p.jsx(LE,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:p.jsxs("div",{className:"flex ml-[7px] px-3 pb-3",children:[ee,p.jsxs("div",{className:"flex flex-col gap-4 flex-1 min-w-0 pt-2",children:[te,_,oe]})]})}),e[60]=te,e[61]=_,e[62]=oe,e[63]=pe):pe=e[63];let k;e[64]!==K||e[65]!==pe?(k=p.jsxs("div",{className:"border border-border/75 rounded-lg flex flex-col bg-background w-full min-w-0 overflow-hidden",children:[K,pe]}),e[64]=K,e[65]=pe,e[66]=k):k=e[66];let le;return e[67]!==g||e[68]!==k?(le=p.jsx("div",{className:"flex flex-col my-4 w-full min-w-0",children:p.jsx(IE,{open:g,onOpenChange:A,children:k})}),e[67]=g,e[68]=k,e[69]=le):le=e[69],le}const OE={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function DE(t){if(!t?.providerMetadata)return null;for(const e of Object.values(OE)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function PE(t){return t.reduce((e,n)=>{const r=n.metadata?.usage;return r?{inputTokens:e.inputTokens+(r.inputTokens??0),outputTokens:e.outputTokens+(r.outputTokens??0),totalTokens:e.totalTokens+(r.totalTokens??0),cost:e.cost+(DE(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function ME(t){const e=V.c(38),{messages:n}=t;let r,i,s,a,u,o,l,f,d,m,h,g;if(e[0]!==n){g=Symbol.for("react.early_return_sentinel");e:{const L=PE(n);if(!L){g=null;break e}const{totalTokens:O,inputTokens:S,outputTokens:B,cost:$}=L;if(s=$,!O&&!S&&!B){g=null;break e}i=$n;let H;e[13]===Symbol.for("react.memo_cache_sentinel")?(H=p.jsx(da,{size:12}),e[13]=H):H=e[13];const I=p.jsxs(We,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap",children:[H,p.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:O.toLocaleString()})]});e[14]!==I?(h=p.jsx(zn,{asChild:!0,children:I}),e[14]=I,e[15]=h):h=e[15],r=jn,d="top",m="font-mono text-[11px]",u="grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",e[16]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx("span",{className:"text-muted",children:"in"}),e[16]=o):o=e[16],l=p.jsx("span",{children:S.toLocaleString()}),e[17]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx("span",{className:"text-muted",children:"out"}),e[17]=f):f=e[17],a=B.toLocaleString()}e[0]=n,e[1]=r,e[2]=i,e[3]=s,e[4]=a,e[5]=u,e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=m,e[11]=h,e[12]=g}else r=e[1],i=e[2],s=e[3],a=e[4],u=e[5],o=e[6],l=e[7],f=e[8],d=e[9],m=e[10],h=e[11],g=e[12];if(g!==Symbol.for("react.early_return_sentinel"))return g;let A;e[18]!==a?(A=p.jsx("span",{children:a}),e[18]=a,e[19]=A):A=e[19];let C;e[20]!==s?(C=s>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cost"}),p.jsxs("span",{children:["$",s.toFixed(4)]})]}),e[20]=s,e[21]=C):C=e[21];let T;e[22]!==A||e[23]!==C||e[24]!==u||e[25]!==o||e[26]!==l||e[27]!==f?(T=p.jsxs("div",{className:u,children:[o,l,f,A,C]}),e[22]=A,e[23]=C,e[24]=u,e[25]=o,e[26]=l,e[27]=f,e[28]=T):T=e[28];let y;e[29]!==r||e[30]!==T||e[31]!==d||e[32]!==m?(y=p.jsx(r,{side:d,className:m,children:T}),e[29]=r,e[30]=T,e[31]=d,e[32]=m,e[33]=y):y=e[33];let N;return e[34]!==i||e[35]!==y||e[36]!==h?(N=p.jsxs(i,{children:[h,y]}),e[34]=i,e[35]=y,e[36]=h,e[37]=N):N=e[37],N}const vE={planning:{icon:p.jsx(xa,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:p.jsx(Yn,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},BE=1200;function FE(){const t=V.c(7),[e,n]=j.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},BE);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),j.useEffect(r,i);const s=vE[e];let a;t[2]!==s.label?(a=p.jsxs("span",{className:"text-[15px] text-muted-foreground shimmer",children:[s.label,"..."]}),t[2]=s.label,t[3]=a):a=t[3];let u;return t[4]!==s.icon||t[5]!==a?(u=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[s.icon,a]})}),t[4]=s.icon,t[5]=a,t[6]=u):u=t[6],u}function HE(t){const e=V.c(10),{duration:n,parts:r,id:i}=t,s=n/1e3;let a;e[0]!==s?(a=s.toFixed(1),e[0]=s,e[1]=a):a=e[1];const u=a,[o,l]=j.useState(!1),[f,d]=j.useState(!1);let m;if(e[2]!==i||e[3]!==f||e[4]!==o||e[5]!==r||e[6]!==u){const h=r.filter(jE),g=h.some(UE),A=g||f;let C,T;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=()=>l(!0),T=()=>l(!1),e[8]=C,e[9]=T):(C=e[8],T=e[9]),m=p.jsxs("div",{className:"flex flex-col mb-2",children:[p.jsx("button",{type:"button",onClick:()=>!g&&d(!f),onMouseEnter:C,onMouseLeave:T,className:ae("flex items-center gap-1.5 py-2 opacity-60 transition-opacity",!g&&"cursor-pointer hover:opacity-100",g&&"cursor-default"),children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[g?p.jsx(Yn,{className:"text-muted-foreground shrink-0 shimmer",size:14}):o?p.jsx(ua,{className:ae("text-muted-foreground transition-transform shrink-0",f&&"rotate-90"),size:14}):p.jsx(Ea,{className:"text-muted-foreground shrink-0",size:14}),p.jsx("span",{className:ae("text-[15px] text-muted-foreground",g&&"shimmer"),children:g?"Thinking...":`Thought for ${u}s`})]})}),A&&p.jsx("div",{className:"ml-[6px] border-l-2 pl-4 mt-1 mb-2 max-h-[300px] overflow-y-auto",children:h.map((y,N)=>p.jsx("div",{className:"text-muted-foreground markdown-sm pb-2",children:p.jsx(yi,{id:`${i}-reasoning-${N}`,text:y.text})},`${i}-reasoning-${N}`))})]}),e[2]=i,e[3]=f,e[4]=o,e[5]=r,e[6]=u,e[7]=m}else m=e[7];return m}function UE(t){return t.state==="streaming"}function jE(t){return t.type==="reasoning"}function zE(t){const e=V.c(17),{part:n,id:r,usageStats:i,isFollowedByToolCall:s,isFirstToolCallInSequence:a,isLastToolCallInSequence:u,hasNextToolCall:o}=t;switch(n.type){case"dynamic-tool":{let l;return e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==u||e[4]!==n?(l=p.jsx(Ks,{part:n,id:r,isFirstInSequence:a,isLastInSequence:u,hasNextToolCall:o}),e[0]=o,e[1]=r,e[2]=a,e[3]=u,e[4]=n,e[5]=l):l=e[5],l}case"text":{let l;return e[6]!==r||e[7]!==s||e[8]!==n||e[9]!==i?(l=p.jsx(wo,{id:r,part:n,extraActions:i,copyable:!0,hasToolCallAfter:s}),e[6]=r,e[7]=s,e[8]=n,e[9]=i,e[10]=l):l=e[10],l}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;default:if(n.type.startsWith("tool-")){const l=n;let f;return e[11]!==o||e[12]!==r||e[13]!==a||e[14]!==u||e[15]!==l?(f=p.jsx(Ks,{part:l,id:r,isFirstInSequence:a,isLastInSequence:u,hasNextToolCall:o}),e[11]=o,e[12]=r,e[13]=a,e[14]=u,e[15]=l,e[16]=f):f=e[16],f}}throw new Error(`Unknown part type: ${n.type}`)}function $E(t){const e=V.c(32),{message:n,status:r,className:i}=t,{id:s,parts:a}=n,l=r==="streaming"||r==="submitted",f=j.useRef(null);let d;e[0]!==s?(d=()=>{const Y=localStorage.getItem(`msg-duration-${s}`);return Y?Number(Y):null},e[0]=s,e[1]=d):d=e[1];const[m,h]=j.useState(d);let g,A;e[2]!==l?(g=()=>{l&&f.current===null&&(f.current=Date.now())},A=[l],e[2]=l,e[3]=g,e[4]=A):(g=e[3],A=e[4]),j.useEffect(g,A);let C,T;e[5]!==m||e[6]!==s||e[7]!==a.length?(C=()=>{if(a.length>0&&m===null&&f.current!==null){const Y=Date.now()-f.current;h(Y),localStorage.setItem(`msg-duration-${s}`,Y.toString())}},T=[a.length,m,s],e[5]=m,e[6]=s,e[7]=a.length,e[8]=C,e[9]=T):(C=e[8],T=e[9]),j.useEffect(C,T);const y=a.length>0;let N;e[10]!==a?(N=a.some(qE),e[10]=a,e[11]=N):N=e[11];const L=N;let O;e[12]!==l||e[13]!==a?(O=l&&a.some(YE),e[12]=l,e[13]=a,e[14]=O):O=e[14];const B=y&&(L||O)&&m!==null;let $;e[15]!==n?($=p.jsx(ME,{messages:[n]}),e[15]=n,e[16]=$):$=e[16];const H=$;let I;e[17]!==i?(I=ae("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",i),e[17]=i,e[18]=I):I=e[18];let F;e[19]!==m||e[20]!==y||e[21]!==s||e[22]!==l||e[23]!==a||e[24]!==B||e[25]!==H?(F=y?p.jsxs(p.Fragment,{children:[B&&p.jsx(HE,{duration:m,parts:a,id:s}),a.map((Y,M)=>{const W=a[M+1],K=a[M-1],ee=W&&(W.type==="dynamic-tool"||W.type.startsWith("tool-")),te=Y.type==="dynamic-tool"||Y.type.startsWith("tool-"),_=K&&(K.type==="dynamic-tool"||K.type.startsWith("tool-")),oe=W&&(W.type==="dynamic-tool"||W.type.startsWith("tool-")),pe=te&&!_,k=te&&!oe,le=te&&oe;return p.jsx(zE,{part:Y,id:s,usageStats:M===a.length-1?H:void 0,isFollowedByToolCall:ee,isFirstToolCallInSequence:pe,isLastToolCallInSequence:k,hasNextToolCall:le},`${s}-${M}`)})]}):l?p.jsx(FE,{}):null,e[19]=m,e[20]=y,e[21]=s,e[22]=l,e[23]=a,e[24]=B,e[25]=H,e[26]=F):F=e[26];let z;e[27]!==F?(z=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[15px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:F})}),e[27]=F,e[28]=z):z=e[28];let G;return e[29]!==z||e[30]!==I?(G=p.jsx("div",{className:I,children:z}),e[29]=z,e[30]=I,e[31]=G):G=e[31],G}function YE(t){return t.type==="reasoning"&&t.state==="streaming"}function qE(t){return t.type==="reasoning"}const Oo=j.createContext(null);function Do(t){const e=V.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx(p.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function VE(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(!j.isValidElement(r))continue;if(r.props?.message?.role==="assistant"){const s=t[n-1],a=j.isValidElement(s)&&s.props?.message?.role,u=s&&j.isValidElement(s)&&a==="user"?s:null;e.push({user:u,assistant:r})}}return e}function WE(t){const e=V.c(27),{children:n,className:r,minHeightOffset:i}=t,s=j.useRef(null);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];const u=j.useRef(a);let o,l,f,d,m,h,g;if(e[1]!==n||e[2]!==r||e[3]!==i){const y=j.Children.toArray(n),N=y[y.length-1];l=N&&j.isValidElement(N)&&N.type===Do?N:null;const L=l?y.slice(0,-1):y,O=VE(L);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=$=>{const H=u.current[$];if(H&&s.current){const I=s.current.offsetTop,F=H.offsetTop;s.current.scrollTo({top:F-I,behavior:"smooth"})}},e[11]=S):S=e[11];const B=S;o=Oo.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(g={scrollToPair:B},e[12]=g):g=e[12],m=s,e[13]!==r?(h=ae("w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",r),e[13]=r,e[14]=h):h=e[14],f="flex flex-col min-w-0 max-w-2xl mx-auto w-full",d=O.map(($,H)=>{const I=H===O.length-1;return p.jsxs("div",{ref:F=>{u.current[H]=F},className:"flex flex-col pb-2",style:I&&i?{minHeight:`calc(100vh - ${i}px)`}:void 0,children:[p.jsx("div",{className:"sticky top-0 z-50 bg-background w-full h-4"}),p.jsx("div",{className:"sticky mb-3 top-4 z-50",children:$.user&&j.isValidElement($.user)?j.cloneElement($.user,{pairIndex:H}):$.user}),$.assistant]},H)}),e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=l,e[6]=f,e[7]=d,e[8]=m,e[9]=h,e[10]=g}else o=e[4],l=e[5],f=e[6],d=e[7],m=e[8],h=e[9],g=e[10];let A;e[15]!==l||e[16]!==f||e[17]!==d?(A=p.jsxs("div",{className:f,children:[d,l]}),e[15]=l,e[16]=f,e[17]=d,e[18]=A):A=e[18];let C;e[19]!==m||e[20]!==h||e[21]!==A?(C=p.jsx("div",{ref:m,className:h,children:A}),e[19]=m,e[20]=h,e[21]=A,e[22]=C):C=e[22];let T;return e[23]!==o||e[24]!==g||e[25]!==C?(T=p.jsx(o,{value:g,children:C}),e[23]=o,e[24]=g,e[25]=C,e[26]=T):T=e[26],T}function GE(t){const e=V.c(5),{locator:n}=Bt(),r=jl(),i=Ca();let s;return e[0]!==n||e[1]!==r||e[2]!==t||e[3]!==i?(s=async(u,o,l)=>{const f=await ka(n,l),d=f.findIndex(C=>C.id===u);if(d===-1){console.warn(`[branch] Message ${u} not found in thread ${l}`);return}const m=f.slice(0,d).filter(QE),h=crypto.randomUUID(),g=new Date().toISOString(),A={id:h,title:"",created_at:g,updated_at:g,hidden:!1};if(await i.insert.mutateAsync(A),m.length>0){const C=m.map(T=>({...T,id:crypto.randomUUID(),metadata:{...T.metadata,thread_id:h,created_at:T.metadata?.created_at||g}}));await r.insertMany.mutateAsync(C)}t(h)},e[0]=n,e[1]=r,e[2]=t,e[3]=i,e[4]=s):s=e[4],s}function QE(t){return t.role!=="system"}function KE(t){const e=V.c(18),{messageId:n,parts:r}=t,[i,s]=j.useState(!1),{setInputValue:a,startBranch:u,setActiveThreadId:o,activeThreadId:l}=ql(),f=GE(o);let d;e[0]!==r?(d=r.filter(ZE).map(XE).join(`
88
88
  `),e[0]=r,e[1]=d):d=e[1];const m=d;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=S=>{S.stopPropagation(),s(!0)},e[2]=h):h=e[2];const g=h;let A;e[3]!==l||e[4]!==f||e[5]!==n||e[6]!==m||e[7]!==a||e[8]!==u?(A=async()=>{await f(n,m,l),a(m),u({originalThreadId:l,originalMessageId:n,originalMessageText:m}),s(!1)},e[3]=l,e[4]=f,e[5]=n,e[6]=m,e[7]=a,e[8]=u,e[9]=A):A=e[9];const C=A;let T;e[10]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx("div",{className:"flex justify-center items-end px-2 pb-1",children:p.jsxs($n,{children:[p.jsx(zn,{asChild:!0,children:p.jsx(We,{onClick:g,variant:"ghost",size:"xs",className:"opacity-0 group-hover:opacity-100 hover:bg-gray-200/70 rounded-md transition-opacity text-muted-foreground hover:text-foreground aspect-square w-6 h-6 p-0",children:p.jsx(pa,{size:16,className:"p-0.5"})})}),p.jsx(jn,{side:"bottom",children:"Edit message"})]})}),e[10]=T):T=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=p.jsxs(dl,{children:[p.jsx(hl,{children:"Edit message?"}),p.jsx(ml,{children:"This will create a new conversation branch from this point. The original conversation will remain unchanged."})]}),e[11]=y):y=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(pl,{children:"Cancel"}),e[12]=N):N=e[12];let L;e[13]!==C?(L=p.jsxs(gl,{children:[y,p.jsxs(El,{children:[N,p.jsx(bl,{onClick:C,children:"Confirm"})]})]}),e[13]=C,e[14]=L):L=e[14];let O;return e[15]!==i||e[16]!==L?(O=p.jsxs(p.Fragment,{children:[T,p.jsx(Tl,{open:i,onOpenChange:s,children:L})]}),e[15]=i,e[16]=L,e[17]=O):O=e[17],O}function XE(t){return t.text}function ZE(t){return t.type==="text"}function JE(t){const e=V.c(29),{message:n,className:r,pairIndex:i}=t,{id:s,parts:a}=n,u=j.useContext(Oo),[o,l]=j.useState(!1);if(!a||a.length===0)return null;let f;e[0]!==u||e[1]!==i?(f=()=>{l(!0),i!==void 0&&u?.scrollToPair(i)},e[0]=u,e[1]=i,e[2]=f):f=e[2];const d=f;let m;e[3]!==r?(m=ae("message-block w-full min-w-0 group relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=m):m=e[4];let h,g;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=()=>l(!0),g=()=>l(!1),e[5]=h,e[6]=g):(h=e[5],g=e[6]);const A=o?"overflow-auto opacity-100":"overflow-hidden opacity-99 mask-b-from-1%";let C;e[7]!==A?(C=ae("z-10 px-4 py-2 transition-opacity max-h-[120px] flex-1",A),e[7]=A,e[8]=C):C=e[8];let T;if(e[9]!==s||e[10]!==a){let B;e[12]!==s?(B=($,H)=>$.type==="text"?p.jsx(wo,{id:s,part:$},`${s}-${H}`):null,e[12]=s,e[13]=B):B=e[13],T=a.map(B),e[9]=s,e[10]=a,e[11]=T}else T=e[11];let y;e[14]!==T?(y=p.jsx("div",{children:T}),e[14]=T,e[15]=y):y=e[15];let N;e[16]!==C||e[17]!==y?(N=p.jsx("div",{className:C,children:y}),e[16]=C,e[17]=y,e[18]=N):N=e[18];let L;e[19]!==s||e[20]!==a?(L=p.jsx(KE,{messageId:s,parts:a}),e[19]=s,e[20]=a,e[21]=L):L=e[21];let O;e[22]!==d||e[23]!==L||e[24]!==N?(O=p.jsxs("div",{tabIndex:0,onClick:d,onFocus:h,onBlur:g,className:"w-full border min-w-0 shadow-xs rounded-lg text-[0.9375rem] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[N,L]}),e[22]=d,e[23]=L,e[24]=N,e[25]=O):O=e[25];let S;return e[26]!==O||e[27]!==m?(S=p.jsx(p.Fragment,{children:p.jsx("div",{className:m,children:O})}),e[26]=O,e[27]=m,e[28]=S):S=e[28],S}const Po=j.createContext({isMobile:!1,setValue:()=>{}}),Oi=()=>j.useContext(Po),eb=t=>{const e=V.c(37);let n,r,i,s,a,u,o,l;e[0]!==t?({children:n,defaultOpen:r,open:u,onOpenChange:s,defaultValue:i,value:l,onValueChange:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=s,e[5]=a,e[6]=u,e[7]=o,e[8]=l):(n=e[1],r=e[2],i=e[3],s=e[4],a=e[5],u=e[6],o=e[7],l=e[8]);const f=Cl(),d=r??!1;let m;e[9]!==s||e[10]!==u||e[11]!==d?(m={prop:u,defaultProp:d,onChange:s},e[9]=s,e[10]=u,e[11]=d,e[12]=m):m=e[12];const[h,g]=Mi(m);let A;e[13]!==i||e[14]!==a||e[15]!==l?(A={prop:l,defaultProp:i,onChange:a},e[13]=i,e[14]=a,e[15]=l,e[16]=A):A=e[16];const[C,T]=Mi(A);let y;e[17]!==T?(y=$=>{$&&T($)},e[17]=T,e[18]=y):y=e[18];const N=y;let L;e[19]!==f||e[20]!==N?(L={isMobile:f,setValue:N},e[19]=f,e[20]=N,e[21]=L):L=e[21];let O;e[22]!==n||e[23]!==h||e[24]!==o||e[25]!==g?(O=p.jsx(Ll,{open:h,onOpenChange:g,...o,children:n}),e[22]=n,e[23]=h,e[24]=o,e[25]=g,e[26]=O):O=e[26];let S;e[27]!==h||e[28]!==o||e[29]!==g||e[30]!==N||e[31]!==O||e[32]!==C?(S=p.jsx(kl,{open:h,onOpenChange:g,value:C,onValueChange:N,...o,children:O}),e[27]=h,e[28]=o,e[29]=g,e[30]=N,e[31]=O,e[32]=C,e[33]=S):S=e[33];let B;return e[34]!==L||e[35]!==S?(B=p.jsx(Po.Provider,{value:L,children:S}),e[34]=L,e[35]=S,e[36]=B):B=e[36],B},tb=t=>{const{children:e,title:n,headerActions:r,...i}=t,{isMobile:s}=Oi(),{className:a,...u}=i;return s?p.jsxs(Pl,{...u,children:[p.jsxs(Ml,{className:ae(r?"flex flex-row items-center justify-between":"hidden"),children:[p.jsx(vl,{children:n}),r]}),p.jsx("div",{className:ae("flex flex-col gap-2 p-2 py-4",a),children:e})]}):p.jsx(Al,{...i,children:e})},nb=t=>{const e=V.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=Oi();let s;return e[3]!==n||e[4]!==i||e[5]!==r?(s=i?p.jsx(Rl,{asChild:!0,children:p.jsx(We,{variant:"outline",...r,children:n})}):p.jsx(_l,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=s):s=e[6],s},rb=t=>{const e=V.c(7);let n,r;e[0]!==t?({children:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const{isMobile:i}=Oi();let s;return e[3]!==n||e[4]!==i||e[5]!==r?(s=i?p.jsx("span",{...r,children:n}):p.jsx(xl,{...r,children:n}),e[3]=n,e[4]=i,e[5]=r,e[6]=s):s=e[6],s};function ib(t,e){const n=V.c(4);let r;n[0]!==e?(r=e===void 0?{}:e,n[0]=e,n[1]=r):r=n[1];const i=r,s=t??Xo;let a;return n[2]!==s?(a=Jo(s),n[2]=s,n[3]=a):a=n[3],Zo(s,"LLM",a,i)}const sb=["x-ai/grok-code-fast-1","anthropic/claude-sonnet-4.5","google/gemini-2.5-flash","xiaomi/mimo-v2-flash:free","google/gemini-3-flash-preview","deepseek/deepseek-v3.2","anthropic/claude-opus-4.5","x-ai/grok-4.1-fast","google/gemini-2.5-flash-lite","google/gemini-2.0-flash-001"],qr=new Map;sb.forEach((t,e)=>{qr.set(t,e)});function ab(){const t=V.c(9),e=Sl();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=Il(n);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i={pageSize:999},t[2]=i):i=t[2];const s=ib(r?.id,i);if(!s||!r){let o;return t[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[3]=o):o=t[3],o}let a;if(t[4]!==r||t[5]!==s){let o;t[7]!==r?(o=l=>({...l,name:l.title,contextWindow:l.limits?.contextWindow,outputLimit:l.limits?.maxOutputTokens,inputCost:l.costs?.input,outputCost:l.costs?.output,provider:l.provider,connectionId:r.id,connectionName:r.title}),t[7]=r,t[8]=o):o=t[8],a=s.filter(ob).map(o).sort(ub),t[4]=r,t[5]=s,t[6]=a}else a=t[6];return a}function ub(t,e){const n=qr.get(t.id),r=qr.get(e.id);return n!==void 0&&r!==void 0?n-r:n!==void 0?-1:r!==void 0?1:t.name.localeCompare(e.name)}function ob(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const lb={reasoning:{icon:p.jsx(Yn,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:p.jsx(ga,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:p.jsx(Nl,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:p.jsx(Wr,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},Mo=j.memo(function(e){const n=V.c(11),{capability:r}=e,i=lb[r];let s;n[0]!==r||n[1]!==i?(s=i||{icon:p.jsx(xt,{className:"size-4"}),bg:"bg-slate-200",text:"text-slate-700",label:r},n[0]=r,n[1]=i,n[2]=s):s=n[2];const a=s,u=`flex items-center justify-center h-6 w-6 rounded-sm ${a.bg} ${a.text}`;let o;n[3]!==a.icon||n[4]!==u?(o=p.jsx(zn,{asChild:!0,children:p.jsx("div",{className:u,children:a.icon})}),n[3]=a.icon,n[4]=u,n[5]=o):o=n[5];let l;n[6]!==a.label?(l=p.jsx(jn,{children:p.jsx("p",{children:a.label})}),n[6]=a.label,n[7]=l):l=n[7];let f;return n[8]!==o||n[9]!==l?(f=p.jsxs($n,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=f):f=n[10],f}),Xs=j.memo(function(e){const n=V.c(54),{model:r,compact:i}=e,s=i===void 0?!1:i;if(!r){let T;return n[0]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),n[0]=T):T=n[0],T}const a=r.contextWindow||r.inputCost||r.outputCost||r.outputLimit;if(!a&&!s){let T;n[1]!==r.logo||n[2]!==r.name?(T=r.logo&&p.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[1]=r.logo,n[2]=r.name,n[3]=T):T=n[3];let y;n[4]!==r.name?(y=p.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[4]=r.name,n[5]=y):y=n[5];let N;n[6]!==T||n[7]!==y?(N=p.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[T,y]}),n[6]=T,n[7]=y,n[8]=N):N=n[8];let L;n[9]!==r.description?(L=r.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),n[9]=r.description,n[10]=L):L=n[10];let O;return n[11]!==N||n[12]!==L?(O=p.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[N,L]}),n[11]=N,n[12]=L,n[13]=O):O=n[13],O}if(!a&&s)return null;if(s){let T;n[14]!==r.contextWindow?(T=r.contextWindow&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Context"}),p.jsxs("span",{className:"text-foreground font-medium",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[14]=r.contextWindow,n[15]=T):T=n[15];let y;n[16]!==r.inputCost?(y=r.inputCost&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),p.jsxs("span",{className:"text-foreground font-medium",children:["$",r.inputCost.toFixed(2)," / 1M"]})]}),n[16]=r.inputCost,n[17]=y):y=n[17];let N;n[18]!==r.outputCost?(N=r.outputCost&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),p.jsxs("span",{className:"text-foreground font-medium",children:["$",r.outputCost.toFixed(2)," / 1M"]})]}),n[18]=r.outputCost,n[19]=N):N=n[19];let L;n[20]!==r.outputLimit?(L=r.outputLimit&&p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),p.jsxs("span",{className:"text-foreground font-medium",children:[r.outputLimit.toLocaleString()," tokens"]})]}),n[20]=r.outputLimit,n[21]=L):L=n[21];let O;return n[22]!==T||n[23]!==y||n[24]!==N||n[25]!==L?(O=p.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[T,y,N,L]}),n[22]=T,n[23]=y,n[24]=N,n[25]=L,n[26]=O):O=n[26],O}let u;n[27]!==r.logo||n[28]!==r.name?(u=r.logo&&p.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[27]=r.logo,n[28]=r.name,n[29]=u):u=n[29];let o;n[30]!==r.name?(o=p.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[30]=r.name,n[31]=o):o=n[31];let l;n[32]!==u||n[33]!==o?(l=p.jsxs("div",{className:"flex items-center gap-3",children:[u,o]}),n[32]=u,n[33]=o,n[34]=l):l=n[34];let f;n[35]!==r.capabilities?(f=r.capabilities&&r.capabilities.length>0&&p.jsx("div",{className:"flex items-center gap-2",children:r.capabilities.map(db)}),n[35]=r.capabilities,n[36]=f):f=n[36];let d;n[37]!==l||n[38]!==f?(d=p.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[l,f]}),n[37]=l,n[38]=f,n[39]=d):d=n[39];let m;n[40]!==r.contextWindow?(m=r.contextWindow&&p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(ll,{className:"w-3.5 h-3.5 text-muted-foreground"}),p.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[40]=r.contextWindow,n[41]=m):m=n[41];let h;n[42]!==r.inputCost||n[43]!==r.outputCost?(h=(r.inputCost||r.outputCost)&&p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(ma,{className:"w-3.5 h-3.5 text-muted-foreground"}),p.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.inputCost!==null&&r.inputCost!==void 0&&p.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.inputCost.toFixed(2)," / 1M tokens (input)"]}),r.outputCost!==null&&r.outputCost!==void 0&&p.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.outputCost.toFixed(2)," / 1M tokens (output)"]})]})]}),n[42]=r.inputCost,n[43]=r.outputCost,n[44]=h):h=n[44];let g;n[45]!==r.outputLimit?(g=r.outputLimit&&p.jsxs("div",{className:"flex flex-col gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(ba,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),p.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.outputLimit.toLocaleString()," token limit"]})]}),n[45]=r.outputLimit,n[46]=g):g=n[46];let A;n[47]!==m||n[48]!==h||n[49]!==g?(A=p.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,g]}),n[47]=m,n[48]=h,n[49]=g,n[50]=A):A=n[50];let C;return n[51]!==A||n[52]!==d?(C=p.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[d,A]}),n[51]=A,n[52]=d,n[53]=C):C=n[53],C}),cb=j.memo(function(e){const n=V.c(27),{model:r,onHover:i,isSelected:s,hasExpandedInfo:a}=e,u=a?"rounded-t-lg":"rounded-lg";let o;n[0]!==u?(o=ae("flex items-center gap-2 h-10 py-4 px-3 hover:bg-accent cursor-pointer",u),n[0]=u,n[1]=o):o=n[1];let l;n[2]!==r||n[3]!==i?(l=()=>i(r),n[2]=r,n[3]=i,n[4]=l):l=n[4];let f;n[5]!==r.logo||n[6]!==r.name?(f=r.logo&&p.jsx("img",{src:r.logo,className:"w-5 h-5 shrink-0",alt:r.name}),n[5]=r.logo,n[6]=r.name,n[7]=f):f=n[7];let d;n[8]!==r.name?(d=p.jsx("span",{className:"text-sm text-foreground",children:r.name}),n[8]=r.name,n[9]=d):d=n[9];let m;n[10]!==a||n[11]!==r.capabilities?(m=a&&r.capabilities&&r.capabilities.length>0&&p.jsx("div",{className:"md:hidden flex items-center gap-1.5 ml-auto",children:r.capabilities.map(hb)}),n[10]=a,n[11]=r.capabilities,n[12]=m):m=n[12];let h;n[13]!==a||n[14]!==s?(h=s&&!a&&p.jsx(xt,{className:"w-4 h-4 text-foreground ml-auto"}),n[13]=a,n[14]=s,n[15]=h):h=n[15];let g;n[16]!==a||n[17]!==s?(g=s&&a&&p.jsx(xt,{className:"w-4 h-4 text-foreground ml-2 shrink-0"}),n[16]=a,n[17]=s,n[18]=g):g=n[18];let A;return n[19]!==o||n[20]!==l||n[21]!==f||n[22]!==d||n[23]!==m||n[24]!==h||n[25]!==g?(A=p.jsxs("div",{className:o,onMouseEnter:l,children:[f,d,m,h,g]}),n[19]=o,n[20]=l,n[21]=f,n[22]=d,n[23]=m,n[24]=h,n[25]=g,n[26]=A):A=n[26],A});function fb(t){const e=V.c(9),{model:n}=t;if(!n){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx("span",{className:"text-sm text-muted-foreground",children:"Select model"}),e[0]=a):a=e[0],a}let r;e[1]!==n.logo||e[2]!==n.name?(r=n.logo&&p.jsx("img",{src:n.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:n.name}),e[1]=n.logo,e[2]=n.name,e[3]=r):r=e[3];let i;e[4]!==n.name?(i=p.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors truncate min-w-0 max-w-[200px] hidden sm:inline-block",children:n.name}),e[4]=n.name,e[5]=i):i=e[5];let s;return e[6]!==r||e[7]!==i?(s=p.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-w-full",children:[r,i]}),e[6]=r,e[7]=i,e[8]=s):s=e[8],s}function rT(t){const e=V.c(67),{selectedModel:n,onModelChange:r,variant:i,className:s,placeholder:a}=t,u=i===void 0?"borderless":i,o=a===void 0?"Select model":a,[l,f]=j.useState(!1),[d,m]=j.useState(null),[h,g]=j.useState(!1),[A,C]=j.useState(""),T=j.useRef(null),y=ab();let N,L;e[0]!==l?(N=()=>{l&&setTimeout(()=>{T.current?.focus()},0)},L=[l],e[0]=l,e[1]=N,e[2]=L):(N=e[1],L=e[2]),j.useEffect(N,L);let O;e[3]!==y||e[4]!==n?(O=n?y.find(re=>re.id===n.id&&re.connectionId===n.connectionId)?.id:void 0,e[3]=y,e[4]=n,e[5]=O):O=e[5];const S=O;let B;if(e[6]!==y||e[7]!==S){let re;e[9]!==S?(re=Ie=>Ie.id===S,e[9]=S,e[10]=re):re=e[10],B=y.find(re),e[6]=y,e[7]=S,e[8]=B}else B=e[8];const $=B;let H;e:{if(!A.trim()){H=y;break e}let re;if(e[11]!==y||e[12]!==A){const Ie=A.toLowerCase();re=y.filter(ot=>ot.name.toLowerCase().includes(Ie)||ot.provider?.toLowerCase().includes(Ie)||ot.description?.toLowerCase().includes(Ie)),e[11]=y,e[12]=A,e[13]=re}else re=e[13];H=re}const I=H;let F;e[14]!==y||e[15]!==r?(F=re=>{const Ie=y.find(ot=>ot.id===re);Ie&&(r({id:Ie.id,connectionId:Ie.connectionId,provider:Ie.provider??void 0}),C(""),f(!1))},e[14]=y,e[15]=r,e[16]=F):F=e[16];const z=F;let G;e[17]===Symbol.for("react.memo_cache_sentinel")?(G=re=>{f(re),re||C("")},e[17]=G):G=e[17];const Y=G;if(y.length===0)return null;const M=S||"",W=u==="borderless"&&"md:border-none";let K;e[18]!==s||e[19]!==W?(K=ae("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 max-w-full",W,s),e[18]=s,e[19]=W,e[20]=K):K=e[20];let ee;e[21]!==$?(ee=p.jsx(fb,{model:$}),e[21]=$,e[22]=ee):ee=e[22];let te;e[23]!==o||e[24]!==ee?(te=p.jsx(rb,{placeholder:o,className:"min-w-0 max-w-full",children:ee}),e[23]=o,e[24]=ee,e[25]=te):te=e[25];let _;e[26]!==K||e[27]!==te?(_=p.jsx(nb,{size:"sm",className:K,children:te}),e[26]=K,e[27]=te,e[28]=_):_=e[28];let oe;e[29]!==h?(oe=()=>g(!h),e[29]=h,e[30]=oe):oe=e[30];const pe=h?"text-foreground":"text-muted-foreground";let k;e[31]!==pe?(k=ae("w-5 h-5 transition-colors",pe),e[31]=pe,e[32]=k):k=e[32];let le;e[33]!==k?(le=p.jsx(yl,{className:k}),e[33]=k,e[34]=le):le=e[34];let _e;e[35]!==oe||e[36]!==le?(_e=p.jsx("button",{type:"button",onClick:oe,className:"md:hidden flex items-center justify-center h-8 w-8 rounded-lg hover:bg-accent transition-colors","aria-label":"Toggle model info",children:le}),e[35]=oe,e[36]=le,e[37]=_e):_e=e[37];let ue;e[38]===Symbol.for("react.memo_cache_sentinel")?(ue=p.jsx(Wr,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[38]=ue):ue=e[38];let Ae;e[39]===Symbol.for("react.memo_cache_sentinel")?(Ae=re=>C(re.target.value),e[39]=Ae):Ae=e[39];let ge;e[40]!==A?(ge=p.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:p.jsxs("div",{className:"relative",children:[ue,p.jsx(ia,{ref:T,type:"text",placeholder:"Search for a model...",value:A,onChange:Ae,className:"pl-9 h-9 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none"})]})}),e[40]=A,e[41]=ge):ge=e[41];let be;e[42]!==I||e[43]!==z||e[44]!==S||e[45]!==h?(be=I.length>0?I.map(re=>p.jsxs("div",{onClick:()=>z(re.id),className:ae("rounded-lg mb-1",re.id===S&&"bg-accent"),children:[p.jsx(cb,{model:re,onHover:m,isSelected:re.id===S,hasExpandedInfo:h}),h&&p.jsx("div",{className:"md:hidden",children:p.jsx(Xs,{model:re,compact:!0})})]},re.id)):p.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[42]=I,e[43]=z,e[44]=S,e[45]=h,e[46]=be):be=e[46];let de;e[47]!==be?(de=p.jsx("div",{className:"flex-1 overflow-y-auto px-0.5",children:be}),e[47]=be,e[48]=de):de=e[48];let ke;e[49]!==ge||e[50]!==de?(ke=p.jsxs("div",{className:"flex-1 flex flex-col md:border-r",children:[ge,de]}),e[49]=ge,e[50]=de,e[51]=ke):ke=e[51];const xe=d||$||null;let De;e[52]!==xe?(De=p.jsx("div",{className:"hidden md:block md:w-[300px] p-3",children:p.jsx(Xs,{model:xe})}),e[52]=xe,e[53]=De):De=e[53];let Pe;e[54]!==ke||e[55]!==De?(Pe=p.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[ke,De]}),e[54]=ke,e[55]=De,e[56]=Pe):Pe=e[56];let we;e[57]!==o||e[58]!==_e||e[59]!==Pe?(we=p.jsx(tb,{title:o,className:"w-full md:w-auto md:min-w-[600px] [&_button[aria-label='Scroll down']]:!hidden [&_button[aria-label='Scroll up']]:!hidden",headerActions:_e,children:Pe}),e[57]=o,e[58]=_e,e[59]=Pe,e[60]=we):we=e[60];let Fe;return e[61]!==z||e[62]!==l||e[63]!==M||e[64]!==_||e[65]!==we?(Fe=p.jsxs(eb,{open:l,onOpenChange:Y,value:M,onValueChange:z,children:[_,we]}),e[61]=z,e[62]=l,e[63]=M,e[64]=_,e[65]=we,e[66]=Fe):Fe=e[66],Fe}function db(t){return p.jsx(Mo,{capability:t},t)}function hb(t){return p.jsx(Mo,{capability:t},t)}function mb({messageCount:t,sentinelRef:e}){const n=j.useRef(t),r=j.useRef(0);t>n.current&&r.current!==t&&queueMicrotask(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"start"}),r.current=t}),n.current=t}function Zs(t,e){const n=j.Children.toArray(t);for(const r of n)if(j.isValidElement(r)&&r.type===e)return r;return null}function pb(t){const e=V.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=ae("flex flex-col h-full w-full bg-sidebar transform-[translateZ(0)]",n),e[0]=n,e[1]=i):i=e[1];let s;return e[2]!==r||e[3]!==i?(s=p.jsx("div",{className:i,children:r}),e[2]=r,e[3]=i,e[4]=s):s=e[4],s}function gb(t){const e=V.c(11),{children:n}=t;let r;e[0]!==n?(r=Zs(n,vo),e[0]=n,e[1]=r):r=e[1];const i=r;let s;e[2]!==n?(s=Zs(n,Bo),e[2]=n,e[3]=s):s=e[3];const a=s,u=i?.props.children;let o;e[4]!==u?(o=p.jsx("div",{className:"flex items-center gap-2",children:u}),e[4]=u,e[5]=o):o=e[5];const l=a?.props.children;let f;e[6]!==l?(f=p.jsx("div",{className:"flex items-center gap-1",children:l}),e[6]=l,e[7]=f):f=e[7];let d;return e[8]!==o||e[9]!==f?(d=p.jsxs("div",{className:"flex h-12 items-center justify-between border-b border-border px-4 flex-none",children:[o,f]}),e[8]=o,e[9]=f,e[10]=d):d=e[10],d}function vo(t){const e=V.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx(p.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function Bo(t){const e=V.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx(p.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function Eb(t){const e=V.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=ae("flex-1 min-h-0 overflow-y-auto",r),e[0]=r,e[1]=i):i=e[1];let s;return e[2]!==n||e[3]!==i?(s=p.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=s):s=e[4],s}function bb(t){const e=V.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Tb(t){const e=V.c(12),{messages:n,status:r,minHeightOffset:i}=t,s=i===void 0?240:i,a=j.useRef(null);let u;e[0]!==n.length?(u={messageCount:n.length,sentinelRef:a},e[0]=n.length,e[1]=u):u=e[1],mb(u);let o;if(e[2]!==n||e[3]!==r){let d;e[5]!==n.length||e[6]!==r?(d=(m,h)=>m.role==="user"?p.jsx(JE,{message:m},m.id):m.role==="assistant"?p.jsx($E,{message:m,status:h===n.length-1?r:void 0},m.id):null,e[5]=n.length,e[6]=r,e[7]=d):d=e[7],o=n.map(d),e[2]=n,e[3]=r,e[4]=o}else o=e[4];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Do,{children:p.jsx("div",{ref:a,className:"h-0"})}),e[8]=l):l=e[8];let f;return e[9]!==s||e[10]!==o?(f=p.jsxs(WE,{minHeightOffset:s,children:[o,l]}),e[9]=s,e[10]=o,e[11]=f):f=e[11],f}function xb(t){const e=V.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=ae("flex-none w-full mx-auto p-2","max-w-2xl min-w-0",r),e[0]=r,e[1]=i):i=e[1];let s;return e[2]!==n||e[3]!==i?(s=p.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=s):s=e[4],s}function Di(t){const e=V.c(24),{title:n,description:r,icon:i,variant:s,onDismiss:a,children:u}=t,o=s===void 0?"default":s;let l,f,d,m,h;if(e[0]!==u||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==o){const N={default:{container:"border-muted-foreground/30 bg-muted/50 hover:bg-muted transition-colors",icon:"text-muted-foreground",title:"text-muted-foreground",description:"text-muted-foreground/70"},danger:{container:"border-destructive/30 bg-destructive/5",icon:"text-destructive",title:"text-destructive font-medium",description:"text-muted-foreground"},warning:{container:"border-amber-500/30 bg-amber-500/5",icon:"text-amber-600 dark:text-amber-500",title:"text-amber-600 dark:text-amber-500 font-medium",description:"text-muted-foreground"}}[o];m=ae("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full",N.container),h=i&&p.jsx("div",{className:ae("mt-0.5 shrink-0",N.icon),children:i}),l="flex-1 min-w-0",f=n&&p.jsx("div",{className:ae("text-xs mb-1",N.title),children:n}),d=r&&p.jsx("div",{className:ae("text-xs line-clamp-2",N.description,u?"mb-2":""),children:r}),e[0]=u,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=l,e[6]=f,e[7]=d,e[8]=m,e[9]=h}else l=e[5],f=e[6],d=e[7],m=e[8],h=e[9];let g;e[10]!==u?(g=u&&p.jsx("div",{className:"flex gap-2",children:u}),e[10]=u,e[11]=g):g=e[11];let A;e[12]!==l||e[13]!==f||e[14]!==d||e[15]!==g?(A=p.jsxs("div",{className:l,children:[f,d,g]}),e[12]=l,e[13]=f,e[14]=d,e[15]=g,e[16]=A):A=e[16];let C;e[17]!==a?(C=a&&p.jsx("button",{type:"button",onClick:a,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:p.jsx(ul,{size:14})}),e[17]=a,e[18]=C):C=e[18];let T;return e[19]!==m||e[20]!==h||e[21]!==A||e[22]!==C?(T=p.jsxs("div",{className:m,children:[h,A,C]}),e[19]=m,e[20]=h,e[21]=A,e[22]=C,e[23]=T):T=e[23],T}function _b(t){const e=V.c(10),{branchContext:n,clearBranchContext:r,onGoToOriginalMessage:i,setInputValue:s}=t;if(!n)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(ha,{size:14}),e[0]=a):a=e[0];let u;e[1]!==r||e[2]!==s?(u=()=>{r(),s("")},e[1]=r,e[2]=s,e[3]=u):u=e[3];let o;e[4]!==i?(o=p.jsx(We,{size:"sm",variant:"outline",onClick:i,className:"h-7 text-xs",children:"View original"}),e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==n.originalMessageText||e[7]!==u||e[8]!==o?(l=p.jsx(Di,{variant:"default",title:"Editing message (click to view original)",description:n.originalMessageText,icon:a,onDismiss:u,children:o}),e[6]=n.originalMessageText,e[7]=u,e[8]=o,e[9]=l):l=e[9],l}function Ab(t){const e=V.c(8),{error:n,onFixInChat:r,onDismiss:i}=t;if(!n)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(aa,{size:16}),e[0]=s):s=e[0];let a;e[1]!==r?(a=p.jsx(We,{size:"sm",variant:"outline",onClick:r,className:"h-7 text-xs",children:"Fix in chat"}),e[1]=r,e[2]=a):a=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(We,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"}),e[3]=u):u=e[3];let o;return e[4]!==n.message||e[5]!==i||e[6]!==a?(o=p.jsxs(Di,{variant:"danger",title:"Error occurred",description:n.message,icon:s,onDismiss:i,children:[a,u]}),e[4]=n.message,e[5]=i,e[6]=a,e[7]=o):o=e[7],o}function kb(t){const e=V.c(7),{finishReason:n,onContinue:r,onDismiss:i}=t;if(!n||n==="stop")return null;const a=Cb(n);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(al,{size:16}),e[0]=u):u=e[0];let o;e[1]!==r?(o=p.jsx(We,{size:"sm",variant:"outline",onClick:r,className:"h-7 text-xs",children:"Continue"}),e[1]=r,e[2]=o):o=e[2];let l;return e[3]!==i||e[4]!==a||e[5]!==o?(l=p.jsx(Di,{variant:"warning",title:"Response incomplete",description:a,icon:u,onDismiss:i,children:o}),e[3]=i,e[4]=a,e[5]=o,e[6]=l):l=e[6],l}function Cb(t){switch(t){case"length":return"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.";case"content-filter":return"Response was filtered due to content policy.";case"tool-calls":return"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working.";default:return`Response stopped unexpectedly: ${t}`}}const iT=Object.assign(pb,{Header:Object.assign(gb,{Left:vo,Right:Bo}),Main:Eb,Messages:Tb,EmptyState:bb,Footer:xb,Input:Ql,BranchPreview:_b,ErrorBanner:Ab,FinishReasonWarning:kb,Provider:$l});export{iT as C,Rl as D,Jb as G,rT as M,SE as R,tT as T,ME as U,Pl as a,Ml as b,vl as c,Ll as d,Bl as e,ql as f,Xb as g,Vl as h,ab as i,$l as j,Ql as k,Ca as l,jl as m,Zb as n,Kb as o,Gl as p,Ta as q,eT as r,nT as s,Mi as u};