@decocms/mesh 1.11.1 → 1.12.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 (107) hide show
  1. package/dist/client/assets/{AlertCircle-fQ1a-Kye.js → AlertCircle-CRLweBkr.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-BiKe-UDJ.js → ArrowLeft-DfQz7YbP.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-B3ly4A-X.js → ChevronDown-ZO3Wlgkk.js} +1 -1
  4. package/dist/client/assets/{ChevronRight-CXZWZETT.js → ChevronRight-BPIYvimG.js} +1 -1
  5. package/dist/client/assets/{Copy01-CYicndkm.js → Copy01-CQZAbEwU.js} +1 -1
  6. package/dist/client/assets/{DotsHorizontal-By0WO0xT.js → DotsHorizontal-gKr61GPJ.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-D6iehcQW.js → DotsVertical-BRB99_wf.js} +1 -1
  8. package/dist/client/assets/{File06-BJJWTDds.js → File06-AZUmgwwB.js} +1 -1
  9. package/dist/client/assets/{FilterLines-Bl9i76YX.js → FilterLines-BVJGM8Yy.js} +1 -1
  10. package/dist/client/assets/{FlipBackward-h1suVrc9.js → FlipBackward-D2snIvVA.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-McK6f_RW.js → GitBranch01-BqxbNL1-.js} +1 -1
  12. package/dist/client/assets/{Grid01-nuISl4Jo.js → Grid01-DvNuuuCQ.js} +1 -1
  13. package/dist/client/assets/{Inbox01-BXcb_6qt.js → Inbox01-CpKg5AaJ.js} +1 -1
  14. package/dist/client/assets/{InfoCircle-D8RiAWfe.js → InfoCircle-Bn9chr5H.js} +1 -1
  15. package/dist/client/assets/{Key01-BQ_2OE0w.js → Key01-C7wPsHjA.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-42UxL9hq.js → LinkExternal01-DBWs13wu.js} +1 -1
  17. package/dist/client/assets/{Loading01-BJF4I2Ad.js → Loading01-ol6YE3uU.js} +1 -1
  18. package/dist/client/assets/{Lock01-BrzFrmRw.js → Lock01-CaL8sf5y.js} +1 -1
  19. package/dist/client/assets/{Play-MQJiRz2-.js → Play-QpPR3uuS.js} +1 -1
  20. package/dist/client/assets/{Plus-DMj-o9Gi.js → Plus-Dj_8zgGI.js} +1 -1
  21. package/dist/client/assets/{Terminal-CW45jfl-.js → Terminal-BcZbtSfr.js} +1 -1
  22. package/dist/client/assets/{Trash01-BmyJcEM6.js → Trash01-dxE-iYht.js} +1 -1
  23. package/dist/client/assets/{X-3dUB6f8T.js → X-BvKeBLsh.js} +1 -1
  24. package/dist/client/assets/{XClose-CCiTTWan.js → XClose-BnA_V6wK.js} +1 -1
  25. package/dist/client/assets/{alert-dialog-B5AngVSr.js → alert-dialog-DRnTpMl_.js} +1 -1
  26. package/dist/client/assets/{auth-catchall-nRP-qv3i.js → auth-catchall-DEYgws1t.js} +1 -1
  27. package/dist/client/assets/{auth-bKqgeTR4.js → auth-kMcVrAGe.js} +1 -1
  28. package/dist/client/assets/{avatar-B3qfE1qj.js → avatar-CSdVudJi.js} +1 -1
  29. package/dist/client/assets/{badge-DnxI94Ef.js → badge-DgawqffN.js} +1 -1
  30. package/dist/client/assets/{button-P1l4UZMh.js → button-DNDGU2TI.js} +1 -1
  31. package/dist/client/assets/{card-DlmzE0V_.js → card-Bm3Srv__.js} +1 -1
  32. package/dist/client/assets/{checkbox-Da1a0gnC.js → checkbox-khNtwUU2.js} +1 -1
  33. package/dist/client/assets/{collection-detail-C-lRKJ6c.js → collection-detail-BsVxb5vf.js} +1 -1
  34. package/dist/client/assets/{collection-display-button-DEihXWWS.js → collection-display-button-Bg2te3H-.js} +1 -1
  35. package/dist/client/assets/{collection-header-DldCjJ2b.js → collection-header-Cg64mtbo.js} +1 -1
  36. package/dist/client/assets/{collection-page-DUqbzyRz.js → collection-page-DgWl3hcu.js} +1 -1
  37. package/dist/client/assets/{collection-search-078Tk8ke.js → collection-search-D_WbnaGd.js} +1 -1
  38. package/dist/client/assets/{collection-tab-D9t_zdu8.js → collection-tab-CkvC0Ng5.js} +1 -1
  39. package/dist/client/assets/{collection-table-wrapper-s0V0lVte.js → collection-table-wrapper-BziKCd5v.js} +1 -1
  40. package/dist/client/assets/{connection-card-Bq4SPs9k.js → connection-card-zLdRh2-_.js} +1 -1
  41. package/dist/client/assets/{connection-detail-G_uQHX56.js → connection-detail-DZjDWBtk.js} +1 -1
  42. package/dist/client/assets/{connections-CjllWosN.js → connections-CtPrTwps.js} +1 -1
  43. package/dist/client/assets/constants-DKCqnrVH.js +1 -0
  44. package/dist/client/assets/{create-organization-dialog-BjXNKLri.js → create-organization-dialog-ChswR6No.js} +1 -1
  45. package/dist/client/assets/{dialog-DskfmP3S.js → dialog-BQAmZYkz.js} +1 -1
  46. package/dist/client/assets/{dropdown-menu-C_0icbcC.js → dropdown-menu-DrJ8JVyD.js} +1 -1
  47. package/dist/client/assets/{empty-state-DGPTU48f.js → empty-state-B4Ut902H.js} +1 -1
  48. package/dist/client/assets/{env-vars-editor-DHPvpktS.js → env-vars-editor-CENWD4Cw.js} +1 -1
  49. package/dist/client/assets/{error-boundary-DVR3TWt5.js → error-boundary-CdDh2rh4.js} +1 -1
  50. package/dist/client/assets/{extract-connection-data-sl_xi-NX.js → extract-connection-data-BbV8sTs8.js} +1 -1
  51. package/dist/client/assets/{form-Dt7KStxI.js → form-CeAHJl1w.js} +1 -1
  52. package/dist/client/assets/{formatDistanceToNow-CxdFFLDu.js → formatDistanceToNow-DjIxnUs1.js} +1 -1
  53. package/dist/client/assets/{gateway-detail-CQ2HJebN.js → gateway-detail-8Dc836Ad.js} +1 -1
  54. package/dist/client/assets/{gateway-selector-C50wFrLo.js → gateway-selector-BUzUwyXz.js} +1 -1
  55. package/dist/client/assets/{gateways-Brw5ylzi.js → gateways-B6IfFHkd.js} +1 -1
  56. package/dist/client/assets/{home-DT_gtVKG.js → home-CRBWRUEj.js} +1 -1
  57. package/dist/client/assets/{index-CQ5PpV5-.js → index-1K95O_Cd.js} +2 -2
  58. package/dist/client/assets/{index-JM_K-0vS.js → index-DKhlCI_x.js} +2 -2
  59. package/dist/client/assets/{index-DB3jkZVV.js → index-DxooMZcP.js} +1 -1
  60. package/dist/client/assets/{input-lEjyv7_t.js → input-DebjWxRP.js} +1 -1
  61. package/dist/client/assets/{layout-Mi4JIpR6.js → layout-IbRPe8u0.js} +1 -1
  62. package/dist/client/assets/{lazy-highlighter-6XYxZAuO.js → lazy-highlighter-_VEiNIwF.js} +1 -1
  63. package/dist/client/assets/{localstorage-keys-DmEm8_Oa.js → localstorage-keys--yzYYtLR.js} +1 -1
  64. package/dist/client/assets/{login-DaHhOJbN.js → login-DJYtWwhL.js} +1 -1
  65. package/dist/client/assets/mcp-oauth-Di1GqXp6.js +1 -0
  66. package/dist/client/assets/{mcp-server-detail-DERmLIXK.js → mcp-server-detail-BkrHrvqf.js} +1 -1
  67. package/dist/client/assets/{members-DzWV9w7S.js → members-GgcoJjv3.js} +1 -1
  68. package/dist/client/assets/{monaco-editor-B-DMAUS8.js → monaco-editor-BuCuW23d.js} +1 -1
  69. package/dist/client/assets/{monitoring-Bw9ECV_3.js → monitoring-B6ODnzEG.js} +1 -1
  70. package/dist/client/assets/{oauth-callback-ChEIlyyo.js → oauth-callback-tl2SaLew.js} +1 -1
  71. package/dist/client/assets/{page-DNqUgOCd.js → page-DNKosrcW.js} +1 -1
  72. package/dist/client/assets/{page-DieG1pN7.js → page-DPTyuA_g.js} +1 -1
  73. package/dist/client/assets/{pin-to-sidebar-button-CbQe-lRF.js → pin-to-sidebar-button-CLRQf-ha.js} +1 -1
  74. package/dist/client/assets/{popover-D51HT9Xp.js → popover-Cp6Pxses.js} +1 -1
  75. package/dist/client/assets/{project-context-provider-DxPsvg7o.js → project-context-provider-d0n4IqI8.js} +1 -1
  76. package/dist/client/assets/{resizable-uj7Ud0Nv.js → resizable-BaqsD3z5.js} +1 -1
  77. package/dist/client/assets/{resource-tabs-mvYm33c6.js → resource-tabs-B7IS9MYq.js} +1 -1
  78. package/dist/client/assets/{select-DDRl1Qvs.js → select-CbMi2p4J.js} +1 -1
  79. package/dist/client/assets/{settings-BFSp8ZnH.js → settings-B3v-qHnr.js} +1 -1
  80. package/dist/client/assets/{shell-layout-DsOoA3nx.js → shell-layout-VY8-JBMj.js} +1 -1
  81. package/dist/client/assets/{spinner-pX_8yHq8.js → spinner-BNiD7mdl.js} +1 -1
  82. package/dist/client/assets/{switch-6o4pER7R.js → switch-0oisonmD.js} +1 -1
  83. package/dist/client/assets/{textarea-BIJ4bnK1.js → textarea-CH1xmcup.js} +1 -1
  84. package/dist/client/assets/{thread-history-popover-BLJ6aCqn.js → thread-history-popover-CRZLvWh-.js} +4 -4
  85. package/dist/client/assets/{tools-list-K2fXAvZZ.js → tools-list-B-vCEw-I.js} +1 -1
  86. package/dist/client/assets/{use-binding-DODEZIVG.js → use-binding-DTexNl5P.js} +1 -1
  87. package/dist/client/assets/{use-connection-BLmwBfcI.js → use-connection-BijkkxIc.js} +1 -1
  88. package/dist/client/assets/{use-connection-resources-CFssgYId.js → use-connection-resources-0t3vJgjj.js} +1 -1
  89. package/dist/client/assets/{use-gateway-C8PgG30I.js → use-gateway-DgOBTOgO.js} +1 -1
  90. package/dist/client/assets/{use-list-state-CNyb0sVm.js → use-list-state-BdubfiP7.js} +1 -1
  91. package/dist/client/assets/{use-mcp-askdlkSn.js → use-mcp-CYeeos2J.js} +1 -1
  92. package/dist/client/assets/{use-members-MyMMikAQ.js → use-members-Ooe4w4iC.js} +1 -1
  93. package/dist/client/assets/{use-mobile-aroC6xLW.js → use-mobile-GFCY3ihJ.js} +1 -1
  94. package/dist/client/assets/{use-organization-settings-447_kc1C.js → use-organization-settings-BpZsf9_f.js} +1 -1
  95. package/dist/client/assets/{use-tool-call-9WIw8dXG.js → use-tool-call-C_ljOxo5.js} +1 -1
  96. package/dist/client/assets/useQuery-BcmdVjIq.js +1 -0
  97. package/dist/client/assets/{value-DFuI_KD4.js → value-DdxHI7TH.js} +1 -1
  98. package/dist/client/assets/{view-mode-toggle-B2u6HchE.js → view-mode-toggle-DHIMDUvK.js} +1 -1
  99. package/dist/client/assets/{workflow-dtZDbGNi.js → workflow-DLx3xIl6.js} +1 -1
  100. package/dist/client/index.html +1 -1
  101. package/dist/server/cli.js +164 -164
  102. package/dist/server/migrate.js +85 -85
  103. package/dist/server/server.js +152 -152
  104. package/package.json +1 -1
  105. package/dist/client/assets/constants--AQKkMmO.js +0 -1
  106. package/dist/client/assets/mcp-oauth-CK__gbJ2.js +0 -1
  107. package/dist/client/assets/useQuery-CVizz7NG.js +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-6XYxZAuO.js","assets/index-JM_K-0vS.js","assets/index-BjKus4OW.css"])))=>i.map(i=>d[i]);
2
- import{r as V,c as W,j as m,B as Bi,p as Fi,K as Oe,d as yc,t as di,E as Ac,F as kc,H as $e,v as q,_ as pr,I as hu,J as Cc,L as Ic,M as Sc,Q as Be,V as Bn,W as qn,s as be,X,Y as Tt,Z as Nc,$ as ye,a0 as wc,a1 as Ui,a2 as Rc,h as Oc}from"./index-JM_K-0vS.js";import{c as ce,u as vt,B as Ye}from"./button-P1l4UZMh.js";import{u as St,c as an,b as sn,T as un,a as pu,i as Jt}from"./project-context-provider-DxPsvg7o.js";import{E as Lc,u as Dc}from"./use-binding-DODEZIVG.js";import{P as mu,a as gu,b as Eu}from"./popover-D51HT9Xp.js";import{i as bu}from"./AlertCircle-fQ1a-Kye.js";import{i as vc}from"./error-boundary-DVR3TWt5.js";import{i as Pc}from"./X-3dUB6f8T.js";import{i as Mc,c as Bc}from"./Grid01-nuISl4Jo.js";import{i as Fc,R as Uc,f as Hc,g as jc,h as zc}from"./gateway-selector-C50wFrLo.js";import{T as $c}from"./textarea-BIJ4bnK1.js";import{u as Yc,L as qc}from"./localstorage-keys-DmEm8_Oa.js";import{i as Tu}from"./ChevronRight-CXZWZETT.js";import{a as Hi}from"./Copy01-CYicndkm.js";import{i as Vc}from"./Terminal-CW45jfl-.js";import{M as xu,s as Sa}from"./monaco-editor-B-DMAUS8.js";import{b as Wc,c as Qc,d as Gc,A as Xc,a as Zc,e as Kc,g as Jc,f as ed}from"./alert-dialog-B5AngVSr.js";import{i as td}from"./File06-BJJWTDds.js";import{i as nd}from"./InfoCircle-D8RiAWfe.js";import{U as rd,a as id,c as ad,u as sd,i as _u,b as ud,E as od}from"./use-connection-BLmwBfcI.js";import{O as ld,a as cd,g as dd}from"./well-known-mcp-D13f-8h2.js";import{g as fd}from"./generate-id-Dyweu44Y.js";import{s as hd}from"./Trash01-BmyJcEM6.js";const yu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));yu.displayName="Coins01";const Au=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Au.displayName="CornerUpLeft";const ku=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));ku.displayName="CurrencyDollar";const Cu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Cu.displayName="Edit02";const Iu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Iu.displayName="Image01";const Su=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Su.displayName="Lightbulb01";const Nu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Nu.displayName="LogOut04";const Cr=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Cr.displayName="Stars01";const wu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));wu.displayName="Target04";function i_(){const t=W.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=m.jsxs("div",{className:"flex items-center gap-3",children:[e,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),m.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:m.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,m.jsxs("div",{className:"flex items-end gap-2",children:[m.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),m.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[m.jsx(tr,{align:"right",width:"w-3/4"}),m.jsx(tr,{align:"left",width:"w-full",lines:3}),m.jsx(tr,{align:"right",width:"w-2/3"}),m.jsx(tr,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:m.jsx("div",{className:"relative flex-1",children:m.jsxs("div",{className:"space-y-2 p-2",children:[m.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),m.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=a):a=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("div",{className:"flex items-center gap-1",children:m.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=s):s=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[r,i,m.jsx("div",{className:"px-4 py-4",children:m.jsx("div",{className:"mx-auto w-full max-w-2xl",children:m.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[a,m.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[s,m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),m.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=u):u=t[6],u}function tr(t){const e=W.c(22),{align:n,width:r,lines:i}=t,a=r===void 0?"w-full":r,s=i===void 0?1:i,u=n==="right"?"flex-row-reverse":"flex-row";let o;e[0]!==u?(o=ce("flex w-full gap-4 px-4 py-2",u),e[0]=u,e[1]=o):o=e[1];const l=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let d;e[2]!==l?(d=ce("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=d):d=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=f):f=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let h;e[5]!==p||e[6]!==a?(h=ce("min-w-0 rounded-2xl p-4",p,a),e[5]=p,e[6]=a,e[7]=h):h=e[7];let g;e[8]!==s?(g=Array.from({length:s}),e[8]=s,e[9]=g):g=e[9];let _;e[10]!==s||e[11]!==g?(_=m.jsx("div",{className:"space-y-2",children:g.map((E,R)=>m.jsx("div",{className:ce("h-3 rounded bg-muted-foreground/20 animate-pulse",R===s-1?"w-3/4":"w-full"),style:{animationDelay:`${R*.1}s`}},R))}),e[10]=s,e[11]=g,e[12]=_):_=e[12];let y;e[13]!==_||e[14]!==h?(y=m.jsx("div",{className:h,children:_}),e[13]=_,e[14]=h,e[15]=y):y=e[15];let T;e[16]!==y||e[17]!==d?(T=m.jsxs("div",{className:d,children:[f,y]}),e[16]=y,e[17]=d,e[18]=T):T=e[18];let S;return e[19]!==T||e[20]!==o?(S=m.jsx("div",{className:o,children:T}),e[19]=T,e[20]=o,e[21]=S):S=e[21],S}var Fn;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),s={};for(const u of a)s[u]=i[u];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Fn||(Fn={}));var Na;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Na||(Na={}));Fn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Fn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class mr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let u=r,o=0;for(;o<s.path.length;){const l=s.path[o];o===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(n(s))):u[l]=u[l]||{_errors:[]},u=u[l],o++}}};return i(this),r}static assert(e){if(!(e instanceof mr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}mr.create=t=>new mr(t);var wa;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(wa||(wa={}));var ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));function Bt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function pd(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Bt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let zr;function Ir(){return zr||(zr=pd("keyval-store","keyval")),zr}function ji(t,e=Ir()){return e("readonly",n=>Bt(n.get(t)))}function Sn(t,e,n=Ir()){return n("readwrite",r=>(r.put(e,t),Bt(r.transaction)))}function Ru(t,e=Ir()){return e("readwrite",n=>(n.delete(t),Bt(n.transaction)))}function md(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Bt(t.transaction)}function Ou(t=Ir()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Bt(e.getAllKeys()),Bt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>md(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function gd(t,e){const n=`${t}:threads:${e}`;return await ji(n)??null}async function Ed(t){const e=`${t}:threads:`;return(await Ou()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function Lu(t,e){const n=`${t}:messages:`;return Ou().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function a_(t){const e=W.c(14),{locator:n}=St(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=Oe.threads(n),e[0]=r,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==r||e[4]!==n?(a=async()=>await Ed(n),e[3]=r,e[4]=n,e[5]=a):a=e[5];let s;e[6]!==i||e[7]!==a?(s={queryKey:i,queryFn:a,staleTime:3e4},e[6]=i,e[7]=a,e[8]=s):s=e[8];const{data:u,refetch:o}=Fi(s);let l;e[9]!==u?(l=u??[],e[9]=u,e[10]=l):l=e[10];let d;return e[11]!==o||e[12]!==l?(d={threads:l,refetch:o},e[11]=o,e[12]=l,e[13]=d):d=e[13],d}function bd(t){const e=W.c(11),{locator:n}=St();let r;e[0]!==n||e[1]!==t?(r=Oe.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>Lu(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Fi(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function zi(){const t=W.c(28),{locator:e}=St(),n=Bi();let r;t[0]!==e?(r=async y=>{const T=`${e}:threads:${y.id}`;return await Sn(T,y),y},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=y=>{n.invalidateQueries({queryKey:Oe.threads(e)}),y.gatewayId&&n.invalidateQueries({queryKey:Oe.gatewayThreads(e,y.gatewayId)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=vt(a);let u;t[8]!==e?(u=async y=>{const{id:T,updates:S}=y,E=`${e}:threads:${T}`,R=await ji(E);if(!R)throw new Error(`Thread ${T} not found`);const O={...R,...S};return await Sn(E,O),O},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=y=>{n.invalidateQueries({queryKey:Oe.threads(e)}),n.invalidateQueries({queryKey:Oe.thread(e,y.id)}),y.gatewayId&&n.invalidateQueries({queryKey:Oe.gatewayThreads(e,y.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 d=vt(l);let f;t[16]!==e?(f=async y=>{const T=`${e}:threads:${y}`;return await Ru(T),y},t[16]=e,t[17]=f):f=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:Oe.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==f||t[22]!==p?(h={mutationFn:f,onSuccess:p},t[21]=f,t[22]=p,t[23]=h):h=t[23];const g=vt(h);let _;return t[24]!==g||t[25]!==s||t[26]!==d?(_={insert:s,update:d,delete:g},t[24]=g,t[25]=s,t[26]=d,t[27]=_):_=t[27],_}function Du(){const t=W.c(37),{locator:e}=St(),n=Bi();let r;t[0]!==e?(r=async R=>{const O=`${e}:messages:${R.id}`;return await Sn(O,R),R},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=R=>{const O=R.metadata?.thread_id||R.threadId;O&&n.invalidateQueries({queryKey:Oe.threadMessages(e,O)}),n.invalidateQueries({queryKey:Oe.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=vt(a);let u;t[8]!==e?(u=async R=>(await Promise.all(R.map(O=>{const I=`${e}:messages:${O.id}`;return Sn(I,O)})),R),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=R=>{const O=new Set;for(const I of R){const v=I.metadata?.thread_id||I.threadId;v&&O.add(v)}for(const I of O)n.invalidateQueries({queryKey:Oe.threadMessages(e,I)});n.invalidateQueries({queryKey:Oe.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 d=vt(l);let f;t[16]!==e?(f=async R=>{const{id:O,updates:I}=R,v=`${e}:messages:${O}`,B=await ji(v);if(!B)throw new Error(`Message ${O} not found`);const z={...B,...I};return await Sn(v,z),z},t[16]=e,t[17]=f):f=t[17];let p;t[18]!==e||t[19]!==n?(p=R=>{const O=R.metadata?.thread_id||R.threadId;O&&n.invalidateQueries({queryKey:Oe.threadMessages(e,O)}),n.invalidateQueries({queryKey:Oe.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==f||t[22]!==p?(h={mutationFn:f,onSuccess:p},t[21]=f,t[22]=p,t[23]=h):h=t[23];const g=vt(h);let _;t[24]!==e?(_=async R=>{const O=`${e}:messages:${R}`;return await Ru(O),R},t[24]=e,t[25]=_):_=t[25];let y;t[26]!==e||t[27]!==n?(y=()=>{n.invalidateQueries({queryKey:Oe.messages(e)})},t[26]=e,t[27]=n,t[28]=y):y=t[28];let T;t[29]!==y||t[30]!==_?(T={mutationFn:_,onSuccess:y},t[29]=y,t[30]=_,t[31]=T):T=t[31];const S=vt(T);let E;return t[32]!==S||t[33]!==s||t[34]!==d||t[35]!==g?(E={insert:s,insertMany:d,update:g,delete:S},t[32]=S,t[33]=s,t[34]=d,t[35]=g,t[36]=E):E=t[36],E}function s_(){const t=W.c(5),e=Bi(),{org:n}=St();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const i=yc(r);let a;return t[1]!==n||t[2]!==i||t[3]!==e?(a=s=>{const o=s.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!o||!o[1])return;const l=o[1],d=i.connectionId;if(!d)return;e.invalidateQueries({queryKey:Oe.collection(n.slug,d,l)});const f=l.toLowerCase().replace(/_/g," ");di.success(`${f} updated`)},t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}var vu="vercel.ai.error",Td=Symbol.for(vu),Ra,Oa,It=class Pu extends(Oa=Error,Ra=Td,Oa){constructor({name:e,message:n,cause:r}){super(n),this[Ra]=!0,this.name=e,this.cause=r}static isInstance(e){return Pu.hasMarker(e,vu)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function Mu(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Bu="AI_InvalidArgumentError",Fu=`vercel.ai.error.${Bu}`,xd=Symbol.for(Fu),La,Da,_d=class extends(Da=It,La=xd,Da){constructor({message:t,cause:e,argument:n}){super({name:Bu,message:t,cause:e}),this[La]=!0,this.argument=n}static isInstance(t){return It.hasMarker(t,Fu)}},Uu="AI_JSONParseError",Hu=`vercel.ai.error.${Uu}`,yd=Symbol.for(Hu),va,Pa,Ma=class extends(Pa=It,va=yd,Pa){constructor({text:t,cause:e}){super({name:Uu,message:`JSON parsing failed: Text: ${t}.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-_VEiNIwF.js","assets/index-DKhlCI_x.js","assets/index-BjKus4OW.css"])))=>i.map(i=>d[i]);
2
+ import{r as V,c as W,j as m,B as Bi,p as Fi,K as Oe,d as yc,t as di,E as Ac,F as kc,H as $e,v as q,_ as pr,I as hu,J as Cc,L as Ic,M as Sc,Q as Be,V as Bn,W as qn,s as be,X,Y as Tt,Z as Nc,$ as ye,a0 as wc,a1 as Ui,a2 as Rc,h as Oc}from"./index-DKhlCI_x.js";import{c as ce,u as vt,B as Ye}from"./button-DNDGU2TI.js";import{u as St,c as an,b as sn,T as un,a as pu,i as Jt}from"./project-context-provider-d0n4IqI8.js";import{E as Lc,u as Dc}from"./use-binding-DTexNl5P.js";import{P as mu,a as gu,b as Eu}from"./popover-Cp6Pxses.js";import{i as bu}from"./AlertCircle-CRLweBkr.js";import{i as vc}from"./error-boundary-CdDh2rh4.js";import{i as Pc}from"./X-BvKeBLsh.js";import{i as Mc,c as Bc}from"./Grid01-DvNuuuCQ.js";import{i as Fc,R as Uc,f as Hc,g as jc,h as zc}from"./gateway-selector-BUzUwyXz.js";import{T as $c}from"./textarea-CH1xmcup.js";import{u as Yc,L as qc}from"./localstorage-keys--yzYYtLR.js";import{i as Tu}from"./ChevronRight-BPIYvimG.js";import{a as Hi}from"./Copy01-CQZAbEwU.js";import{i as Vc}from"./Terminal-BcZbtSfr.js";import{M as xu,s as Sa}from"./monaco-editor-BuCuW23d.js";import{b as Wc,c as Qc,d as Gc,A as Xc,a as Zc,e as Kc,g as Jc,f as ed}from"./alert-dialog-DRnTpMl_.js";import{i as td}from"./File06-AZUmgwwB.js";import{i as nd}from"./InfoCircle-Bn9chr5H.js";import{U as rd,a as id,c as ad,u as sd,i as _u,b as ud,E as od}from"./use-connection-BijkkxIc.js";import{O as ld,a as cd,g as dd}from"./well-known-mcp-D13f-8h2.js";import{g as fd}from"./generate-id-Dyweu44Y.js";import{s as hd}from"./Trash01-dxE-iYht.js";const yu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));yu.displayName="Coins01";const Au=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Au.displayName="CornerUpLeft";const ku=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));ku.displayName="CurrencyDollar";const Cu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Cu.displayName="Edit02";const Iu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Iu.displayName="Image01";const Su=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Su.displayName="Lightbulb01";const Nu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Nu.displayName="LogOut04";const Cr=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));Cr.displayName="Stars01";const wu=({size:t=24,color:e="currentColor",...n})=>V.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},V.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"}));wu.displayName="Target04";function i_(){const t=W.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=m.jsxs("div",{className:"flex items-center gap-3",children:[e,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),m.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:m.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,m.jsxs("div",{className:"flex items-end gap-2",children:[m.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),m.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[m.jsx(tr,{align:"right",width:"w-3/4"}),m.jsx(tr,{align:"left",width:"w-full",lines:3}),m.jsx(tr,{align:"right",width:"w-2/3"}),m.jsx(tr,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:m.jsx("div",{className:"relative flex-1",children:m.jsxs("div",{className:"space-y-2 p-2",children:[m.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),m.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=a):a=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("div",{className:"flex items-center gap-1",children:m.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=s):s=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[r,i,m.jsx("div",{className:"px-4 py-4",children:m.jsx("div",{className:"mx-auto w-full max-w-2xl",children:m.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[a,m.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[s,m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),m.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=u):u=t[6],u}function tr(t){const e=W.c(22),{align:n,width:r,lines:i}=t,a=r===void 0?"w-full":r,s=i===void 0?1:i,u=n==="right"?"flex-row-reverse":"flex-row";let o;e[0]!==u?(o=ce("flex w-full gap-4 px-4 py-2",u),e[0]=u,e[1]=o):o=e[1];const l=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let d;e[2]!==l?(d=ce("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=d):d=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=m.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=f):f=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let h;e[5]!==p||e[6]!==a?(h=ce("min-w-0 rounded-2xl p-4",p,a),e[5]=p,e[6]=a,e[7]=h):h=e[7];let g;e[8]!==s?(g=Array.from({length:s}),e[8]=s,e[9]=g):g=e[9];let _;e[10]!==s||e[11]!==g?(_=m.jsx("div",{className:"space-y-2",children:g.map((E,R)=>m.jsx("div",{className:ce("h-3 rounded bg-muted-foreground/20 animate-pulse",R===s-1?"w-3/4":"w-full"),style:{animationDelay:`${R*.1}s`}},R))}),e[10]=s,e[11]=g,e[12]=_):_=e[12];let y;e[13]!==_||e[14]!==h?(y=m.jsx("div",{className:h,children:_}),e[13]=_,e[14]=h,e[15]=y):y=e[15];let T;e[16]!==y||e[17]!==d?(T=m.jsxs("div",{className:d,children:[f,y]}),e[16]=y,e[17]=d,e[18]=T):T=e[18];let S;return e[19]!==T||e[20]!==o?(S=m.jsx("div",{className:o,children:T}),e[19]=T,e[20]=o,e[21]=S):S=e[21],S}var Fn;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),s={};for(const u of a)s[u]=i[u];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Fn||(Fn={}));var Na;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Na||(Na={}));Fn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Fn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class mr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let u=r,o=0;for(;o<s.path.length;){const l=s.path[o];o===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(n(s))):u[l]=u[l]||{_errors:[]},u=u[l],o++}}};return i(this),r}static assert(e){if(!(e instanceof mr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}mr.create=t=>new mr(t);var wa;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(wa||(wa={}));var ee;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ee||(ee={}));function Bt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function pd(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Bt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let zr;function Ir(){return zr||(zr=pd("keyval-store","keyval")),zr}function ji(t,e=Ir()){return e("readonly",n=>Bt(n.get(t)))}function Sn(t,e,n=Ir()){return n("readwrite",r=>(r.put(e,t),Bt(r.transaction)))}function Ru(t,e=Ir()){return e("readwrite",n=>(n.delete(t),Bt(n.transaction)))}function md(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Bt(t.transaction)}function Ou(t=Ir()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Bt(e.getAllKeys()),Bt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>md(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function gd(t,e){const n=`${t}:threads:${e}`;return await ji(n)??null}async function Ed(t){const e=`${t}:threads:`;return(await Ou()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function Lu(t,e){const n=`${t}:messages:`;return Ou().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function a_(t){const e=W.c(14),{locator:n}=St(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=Oe.threads(n),e[0]=r,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==r||e[4]!==n?(a=async()=>await Ed(n),e[3]=r,e[4]=n,e[5]=a):a=e[5];let s;e[6]!==i||e[7]!==a?(s={queryKey:i,queryFn:a,staleTime:3e4},e[6]=i,e[7]=a,e[8]=s):s=e[8];const{data:u,refetch:o}=Fi(s);let l;e[9]!==u?(l=u??[],e[9]=u,e[10]=l):l=e[10];let d;return e[11]!==o||e[12]!==l?(d={threads:l,refetch:o},e[11]=o,e[12]=l,e[13]=d):d=e[13],d}function bd(t){const e=W.c(11),{locator:n}=St();let r;e[0]!==n||e[1]!==t?(r=Oe.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>Lu(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Fi(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function zi(){const t=W.c(28),{locator:e}=St(),n=Bi();let r;t[0]!==e?(r=async y=>{const T=`${e}:threads:${y.id}`;return await Sn(T,y),y},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=y=>{n.invalidateQueries({queryKey:Oe.threads(e)}),y.gatewayId&&n.invalidateQueries({queryKey:Oe.gatewayThreads(e,y.gatewayId)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=vt(a);let u;t[8]!==e?(u=async y=>{const{id:T,updates:S}=y,E=`${e}:threads:${T}`,R=await ji(E);if(!R)throw new Error(`Thread ${T} not found`);const O={...R,...S};return await Sn(E,O),O},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=y=>{n.invalidateQueries({queryKey:Oe.threads(e)}),n.invalidateQueries({queryKey:Oe.thread(e,y.id)}),y.gatewayId&&n.invalidateQueries({queryKey:Oe.gatewayThreads(e,y.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 d=vt(l);let f;t[16]!==e?(f=async y=>{const T=`${e}:threads:${y}`;return await Ru(T),y},t[16]=e,t[17]=f):f=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:Oe.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==f||t[22]!==p?(h={mutationFn:f,onSuccess:p},t[21]=f,t[22]=p,t[23]=h):h=t[23];const g=vt(h);let _;return t[24]!==g||t[25]!==s||t[26]!==d?(_={insert:s,update:d,delete:g},t[24]=g,t[25]=s,t[26]=d,t[27]=_):_=t[27],_}function Du(){const t=W.c(37),{locator:e}=St(),n=Bi();let r;t[0]!==e?(r=async R=>{const O=`${e}:messages:${R.id}`;return await Sn(O,R),R},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=R=>{const O=R.metadata?.thread_id||R.threadId;O&&n.invalidateQueries({queryKey:Oe.threadMessages(e,O)}),n.invalidateQueries({queryKey:Oe.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=vt(a);let u;t[8]!==e?(u=async R=>(await Promise.all(R.map(O=>{const I=`${e}:messages:${O.id}`;return Sn(I,O)})),R),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=R=>{const O=new Set;for(const I of R){const v=I.metadata?.thread_id||I.threadId;v&&O.add(v)}for(const I of O)n.invalidateQueries({queryKey:Oe.threadMessages(e,I)});n.invalidateQueries({queryKey:Oe.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 d=vt(l);let f;t[16]!==e?(f=async R=>{const{id:O,updates:I}=R,v=`${e}:messages:${O}`,B=await ji(v);if(!B)throw new Error(`Message ${O} not found`);const z={...B,...I};return await Sn(v,z),z},t[16]=e,t[17]=f):f=t[17];let p;t[18]!==e||t[19]!==n?(p=R=>{const O=R.metadata?.thread_id||R.threadId;O&&n.invalidateQueries({queryKey:Oe.threadMessages(e,O)}),n.invalidateQueries({queryKey:Oe.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==f||t[22]!==p?(h={mutationFn:f,onSuccess:p},t[21]=f,t[22]=p,t[23]=h):h=t[23];const g=vt(h);let _;t[24]!==e?(_=async R=>{const O=`${e}:messages:${R}`;return await Ru(O),R},t[24]=e,t[25]=_):_=t[25];let y;t[26]!==e||t[27]!==n?(y=()=>{n.invalidateQueries({queryKey:Oe.messages(e)})},t[26]=e,t[27]=n,t[28]=y):y=t[28];let T;t[29]!==y||t[30]!==_?(T={mutationFn:_,onSuccess:y},t[29]=y,t[30]=_,t[31]=T):T=t[31];const S=vt(T);let E;return t[32]!==S||t[33]!==s||t[34]!==d||t[35]!==g?(E={insert:s,insertMany:d,update:g,delete:S},t[32]=S,t[33]=s,t[34]=d,t[35]=g,t[36]=E):E=t[36],E}function s_(){const t=W.c(5),e=Bi(),{org:n}=St();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const i=yc(r);let a;return t[1]!==n||t[2]!==i||t[3]!==e?(a=s=>{const o=s.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!o||!o[1])return;const l=o[1],d=i.connectionId;if(!d)return;e.invalidateQueries({queryKey:Oe.collection(n.slug,d,l)});const f=l.toLowerCase().replace(/_/g," ");di.success(`${f} updated`)},t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}var vu="vercel.ai.error",Td=Symbol.for(vu),Ra,Oa,It=class Pu extends(Oa=Error,Ra=Td,Oa){constructor({name:e,message:n,cause:r}){super(n),this[Ra]=!0,this.name=e,this.cause=r}static isInstance(e){return Pu.hasMarker(e,vu)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function Mu(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Bu="AI_InvalidArgumentError",Fu=`vercel.ai.error.${Bu}`,xd=Symbol.for(Fu),La,Da,_d=class extends(Da=It,La=xd,Da){constructor({message:t,cause:e,argument:n}){super({name:Bu,message:t,cause:e}),this[La]=!0,this.argument=n}static isInstance(t){return It.hasMarker(t,Fu)}},Uu="AI_JSONParseError",Hu=`vercel.ai.error.${Uu}`,yd=Symbol.for(Hu),va,Pa,Ma=class extends(Pa=It,va=yd,Pa){constructor({text:t,cause:e}){super({name:Uu,message:`JSON parsing failed: Text: ${t}.
3
3
  Error message: ${Mu(e)}`,cause:e}),this[va]=!0,this.text=t}static isInstance(t){return It.hasMarker(t,Hu)}},ju="AI_TypeValidationError",zu=`vercel.ai.error.${ju}`,Ad=Symbol.for(zu),Ba,Fa,en=class fi extends(Fa=It,Ba=Ad,Fa){constructor({value:e,cause:n}){super({name:ju,message:`Type validation failed: Value: ${JSON.stringify(e)}.
4
4
  Error message: ${Mu(n)}`,cause:n}),this[Ba]=!0,this.value=e}static isInstance(e){return It.hasMarker(e,zu)}static wrap({value:e,cause:n}){return fi.isInstance(n)&&n.value===e?n:new fi({value:e,cause:n})}},Vn=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let u=0;u<e;u++)s[u]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new _d({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},kd=Vn();function Ua(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Dt(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function Ha(t,...e){const n=new Headers(Dt(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var Cd=/"__proto__"\s*:/,Id=/"constructor"\s*:/;function ja(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Cd.test(t)===!1&&Id.test(t)===!1?e:Sd(e)}function Sd(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function Nd(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return ja(t)}try{return ja(t)}finally{Error.stackTraceLimit=e}}function $u(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:n}=t;if(n!=null)for(const r of Object.keys(n))n[r]=Ot(n[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(Ot):Ot(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(Ot)),t.allOf!=null&&(t.allOf=t.allOf.map(Ot)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(Ot));const{definitions:e}=t;if(e!=null)for(const n of Object.keys(e))e[n]=Ot(e[n]);return t}function Ot(t){return typeof t=="boolean"?t:$u(t)}var wd=Symbol("Let zodToJsonSchema decide on which parser to use"),za={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Rd=t=>typeof t=="string"?{...za,name:t}:{...za,...t};function Xe(){return{}}function Od(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==ee.ZodAny&&(a.items=pe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function Ld(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function Dd(){return{type:"boolean"}}function Yu(t,e){return pe(t.type._def,e)}var vd=(t,e)=>pe(t.innerType._def,e);function qu(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>qu(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Pd(t)}}var Pd=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function Md(t,e){return{...pe(t.innerType._def,e),default:t.defaultValue()}}function Bd(t,e){return e.effectStrategy==="input"?pe(t.schema._def,e):Xe()}function Fd(t){return{type:"string",enum:Array.from(t.values)}}var Ud=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Hd(t,e){const n=[pe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(Ud(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...u}=i;a=u}r.push(a)}}),r.length?{allOf:r}:void 0}function jd(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var $r=void 0,nt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>($r===void 0&&($r=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$r),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Vu(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":rt(n,"email",r.message,e);break;case"format:idn-email":rt(n,"idn-email",r.message,e);break;case"pattern:zod":Me(n,nt.email,r.message,e);break}break;case"url":rt(n,"uri",r.message,e);break;case"uuid":rt(n,"uuid",r.message,e);break;case"regex":Me(n,r.regex,r.message,e);break;case"cuid":Me(n,nt.cuid,r.message,e);break;case"cuid2":Me(n,nt.cuid2,r.message,e);break;case"startsWith":Me(n,RegExp(`^${Yr(r.value,e)}`),r.message,e);break;case"endsWith":Me(n,RegExp(`${Yr(r.value,e)}$`),r.message,e);break;case"datetime":rt(n,"date-time",r.message,e);break;case"date":rt(n,"date",r.message,e);break;case"time":rt(n,"time",r.message,e);break;case"duration":rt(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{Me(n,RegExp(Yr(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&rt(n,"ipv4",r.message,e),r.version!=="v4"&&rt(n,"ipv6",r.message,e);break}case"base64url":Me(n,nt.base64url,r.message,e);break;case"jwt":Me(n,nt.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Me(n,nt.ipv4Cidr,r.message,e),r.version!=="v4"&&Me(n,nt.ipv6Cidr,r.message,e);break}case"emoji":Me(n,nt.emoji(),r.message,e);break;case"ulid":{Me(n,nt.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{rt(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{Me(n,nt.base64,r.message,e);break}}break}case"nanoid":Me(n,nt.nanoid,r.message,e)}return n}function Yr(t,e){return e.patternStrategy==="escape"?$d(t):t}var zd=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $d(t){let e="";for(let n=0;n<t.length;n++)zd.has(t[n])||(e+="\\"),e+=t[n];return e}function rt(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function Me(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:$a(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=$a(e,r)}function $a(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,u=!1,o=!1;for(let l=0;l<i.length;l++){if(s){a+=i[l],s=!1;continue}if(r.i){if(u){if(i[l].match(/[a-z]/)){o?(a+=i[l],a+=`${i[l-2]}-${i[l]}`.toUpperCase(),o=!1):i[l+1]==="-"&&((n=i[l+2])!=null&&n.match(/[a-z]/))?(a+=i[l],o=!0):a+=`${i[l]}${i[l].toUpperCase()}`;continue}}else if(i[l].match(/[a-z]/)){a+=`[${i[l]}${i[l].toUpperCase()}]`;continue}}if(r.m){if(i[l]==="^"){a+=`(^|(?<=[\r
5
5
  ]))`;continue}else if(i[l]==="$"){a+=`($|(?=[\r
6
6
  ]))`;continue}}if(r.s&&i[l]==="."){a+=u?`${i[l]}\r
7
7
  `:`[${i[l]}\r
8
- ]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function Wu(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ee.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...d}=Vu(t.keyType._def,e);return{...o,propertyNames:d}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ee.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ee.ZodBranded&&t.keyType._def.type._def.typeName===ee.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...d}=Yu(t.keyType._def,e);return{...o,propertyNames:d}}}return o}function Yd(t,e){if(e.mapStrategy==="record")return Wu(t,e);const n=pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Xe(),r=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Xe();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function qd(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function Vd(){return{not:Xe()}}function Wd(){return{type:"null"}}var hi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Qd(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in hi&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=hi[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return Gd(t,e)}var Gd=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function Xd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[hi[t.innerType._def.typeName],"null"]};const n=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Zd(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function Kd(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=ef(u),l=pe(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=Jd(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Jd(t,e){if(t.catchall._def.typeName!=="ZodNever")return pe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function ef(t){try{return t.isOptional()}catch{return!0}}var tf=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return pe(t.innerType._def,e);const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xe()},r]}:Xe()},nf=(t,e)=>{if(e.pipeStrategy==="input")return pe(t.in._def,e);if(e.pipeStrategy==="output")return pe(t.out._def,e);const n=pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function rf(t,e){return pe(t.type._def,e)}function af(t,e){const r={type:"array",uniqueItems:!0,items:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function sf(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function uf(){return{not:Xe()}}function of(){return Xe()}var lf=(t,e)=>pe(t.innerType._def,e),cf=(t,e,n)=>{switch(e){case ee.ZodString:return Vu(t,n);case ee.ZodNumber:return Zd(t);case ee.ZodObject:return Kd(t,n);case ee.ZodBigInt:return Ld(t);case ee.ZodBoolean:return Dd();case ee.ZodDate:return qu(t,n);case ee.ZodUndefined:return uf();case ee.ZodNull:return Wd();case ee.ZodArray:return Od(t,n);case ee.ZodUnion:case ee.ZodDiscriminatedUnion:return Qd(t,n);case ee.ZodIntersection:return Hd(t,n);case ee.ZodTuple:return sf(t,n);case ee.ZodRecord:return Wu(t,n);case ee.ZodLiteral:return jd(t);case ee.ZodEnum:return Fd(t);case ee.ZodNativeEnum:return qd(t);case ee.ZodNullable:return Xd(t,n);case ee.ZodOptional:return tf(t,n);case ee.ZodMap:return Yd(t,n);case ee.ZodSet:return af(t,n);case ee.ZodLazy:return()=>t.getter()._def;case ee.ZodPromise:return rf(t,n);case ee.ZodNaN:case ee.ZodNever:return Vd();case ee.ZodEffects:return Bd(t,n);case ee.ZodAny:return Xe();case ee.ZodUnknown:return of();case ee.ZodDefault:return Md(t,n);case ee.ZodBranded:return Yu(t,n);case ee.ZodReadonly:return lf(t,n);case ee.ZodCatch:return vd(t,n);case ee.ZodPipeline:return nf(t,n);case ee.ZodFunction:case ee.ZodVoid:case ee.ZodSymbol:return;default:return(r=>{})()}},df=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==wd)return o}if(i&&!n){const o=ff(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=cf(t,t.typeName,e),u=typeof s=="function"?pe(s(),e):s;if(u&&hf(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var ff=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:df(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Xe()):e.$refStrategy==="seen"?Xe():void 0}},hf=(t,e,n)=>(t.description&&(n.description=t.description),n),pf=t=>{const e=Rd(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},mf=(t,e)=>{var n;const r=pf(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,f])=>{var p;return{...l,[d]:(p=pe(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Xe()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Xe(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},pi=Symbol.for("vercel.ai.schema");function gf(t){let e;return()=>(e==null&&(e=t()),e)}function Sr(t,{validate:e}={}){return{[pi]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Ef(t){return typeof t=="object"&&t!==null&&pi in t&&t[pi]===!0&&"jsonSchema"in t&&"validate"in t}function $i(t){return t==null?Sr({properties:{},additionalProperties:!1}):Ef(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Qu(t):bf(t):t()}function bf(t){return Sr(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new en({value:e,cause:n.issues})}}})}function Tf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Sr(()=>mf(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function xf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Sr(()=>$u(kc(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await Ac(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function _f(t){return"_zod"in t}function Qu(t,e){return _f(t)?xf(t):Tf(t)}async function Ya({value:t,schema:e}){const n=await Un({value:t,schema:e});if(!n.success)throw en.wrap({value:t,cause:n.error});return n.value}async function Un({value:t,schema:e}){const n=$i(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:en.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:en.wrap({value:t,cause:r}),rawValue:t}}}async function Ft({text:t,schema:e}){try{const n=Nd(t);return e==null?{success:!0,value:n,rawValue:n}:await Un({value:n,schema:e})}catch(n){return{success:!1,error:Ma.isInstance(n)?n:new Ma({text:t,cause:n}),rawValue:void 0}}}function yf({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Lc).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Ft({text:n,schema:e}))}}))}async function At(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Af=Object.defineProperty,kf=(t,e)=>{for(var n in e)Af(t,n,{get:e[n],enumerable:!0})},Gu="AI_NoObjectGeneratedError",Xu=`vercel.ai.error.${Gu}`,Cf=Symbol.for(Xu),Zu,Ct=class extends It{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:Gu,message:t,cause:e}),this[Zu]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return It.hasMarker(t,Xu)}};Zu=Cf;var qa="6.0.22",Ku=$e([q(),pr(Uint8Array),pr(ArrayBuffer),hu(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Hn=Cc(()=>$e([Ic(),q(),Sc(),Be(),Bn(q(),Hn.optional()),qn(Hn)])),ue=Bn(q(),Bn(q(),Hn.optional())),Ju=be({type:X("text"),text:q(),providerOptions:ue.optional()}),If=be({type:X("image"),image:$e([Ku,pr(URL)]),mediaType:q().optional(),providerOptions:ue.optional()}),eo=be({type:X("file"),data:$e([Ku,pr(URL)]),filename:q().optional(),mediaType:q(),providerOptions:ue.optional()}),Sf=be({type:X("reasoning"),text:q(),providerOptions:ue.optional()}),Nf=be({type:X("tool-call"),toolCallId:q(),toolName:q(),input:Tt(),providerOptions:ue.optional(),providerExecuted:Be().optional()}),wf=Nc("type",[be({type:X("text"),value:q(),providerOptions:ue.optional()}),be({type:X("json"),value:Hn,providerOptions:ue.optional()}),be({type:X("execution-denied"),reason:q().optional(),providerOptions:ue.optional()}),be({type:X("error-text"),value:q(),providerOptions:ue.optional()}),be({type:X("error-json"),value:Hn,providerOptions:ue.optional()}),be({type:X("content"),value:qn($e([be({type:X("text"),text:q(),providerOptions:ue.optional()}),be({type:X("media"),data:q(),mediaType:q()}),be({type:X("file-data"),data:q(),mediaType:q(),filename:q().optional(),providerOptions:ue.optional()}),be({type:X("file-url"),url:q(),providerOptions:ue.optional()}),be({type:X("file-id"),fileId:$e([q(),Bn(q(),q())]),providerOptions:ue.optional()}),be({type:X("image-data"),data:q(),mediaType:q(),providerOptions:ue.optional()}),be({type:X("image-url"),url:q(),providerOptions:ue.optional()}),be({type:X("image-file-id"),fileId:$e([q(),Bn(q(),q())]),providerOptions:ue.optional()}),be({type:X("custom"),providerOptions:ue.optional()})]))})]),to=be({type:X("tool-result"),toolCallId:q(),toolName:q(),output:wf,providerOptions:ue.optional()}),Rf=be({type:X("tool-approval-request"),approvalId:q(),toolCallId:q()}),Of=be({type:X("tool-approval-response"),approvalId:q(),approved:Be(),reason:q().optional()}),Lf=be({role:X("system"),content:q(),providerOptions:ue.optional()}),Df=be({role:X("user"),content:$e([q(),qn($e([Ju,If,eo]))]),providerOptions:ue.optional()}),vf=be({role:X("assistant"),content:$e([q(),qn($e([Ju,eo,Sf,Nf,to,Rf]))]),providerOptions:ue.optional()}),Pf=be({role:X("tool"),content:qn($e([to,Of])),providerOptions:ue.optional()});$e([Lf,Df,vf,Pf]);function no(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=no(a,i):n[r]=i}return n}var Mf={};kf(Mf,{array:()=>Hf,choice:()=>jf,json:()=>zf,object:()=>Uf,text:()=>Ff});function Bf(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,d){switch(o){case'"':{n=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const f=t.substring(r,o+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const d=t.substring(r,t.length);"true".startsWith(d)?u+="true".slice(d.length):"false".startsWith(d)?u+="false".slice(d.length):"null".startsWith(d)&&(u+="null".slice(d.length))}}return u}async function Wn(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Ft({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Ft({text:Bf(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Ff=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),Uf=({schema:t,name:e,description:n})=>{const r=$i(t);return{responseFormat:At(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Ft({text:i});if(!s.success)throw new Ct({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await Un({value:s.value,schema:r});if(!u.success)throw new Ct({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await Wn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Hf=({element:t,name:e,description:n})=>{const r=$i(t);return{responseFormat:At(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Ft({text:i});if(!s.success)throw new Ct({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Ct({message:"No object generated: response did not match schema.",cause:new en({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await Un({value:o,schema:r});if(!l.success)throw new Ct({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await Wn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const d=await Un({value:l,schema:r});d.success&&o.push(d.value)}return{partial:o}}}}}},jf=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Ft({text:r});if(!a.success)throw new Ct({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Ct({message:"No object generated: response did not match schema.",cause:new en({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await Wn(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),zf=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Ft({text:n});if(!i.success)throw new Ct({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await Wn(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});Vn({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
+ ]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function Wu(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ee.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...d}=Vu(t.keyType._def,e);return{...o,propertyNames:d}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ee.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ee.ZodBranded&&t.keyType._def.type._def.typeName===ee.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...d}=Yu(t.keyType._def,e);return{...o,propertyNames:d}}}return o}function Yd(t,e){if(e.mapStrategy==="record")return Wu(t,e);const n=pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Xe(),r=pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Xe();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function qd(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function Vd(){return{not:Xe()}}function Wd(){return{type:"null"}}var hi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Qd(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in hi&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=hi[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return Gd(t,e)}var Gd=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function Xd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[hi[t.innerType._def.typeName],"null"]};const n=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Zd(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function Kd(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=ef(u),l=pe(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=Jd(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Jd(t,e){if(t.catchall._def.typeName!=="ZodNever")return pe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function ef(t){try{return t.isOptional()}catch{return!0}}var tf=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return pe(t.innerType._def,e);const r=pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xe()},r]}:Xe()},nf=(t,e)=>{if(e.pipeStrategy==="input")return pe(t.in._def,e);if(e.pipeStrategy==="output")return pe(t.out._def,e);const n=pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function rf(t,e){return pe(t.type._def,e)}function af(t,e){const r={type:"array",uniqueItems:!0,items:pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function sf(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function uf(){return{not:Xe()}}function of(){return Xe()}var lf=(t,e)=>pe(t.innerType._def,e),cf=(t,e,n)=>{switch(e){case ee.ZodString:return Vu(t,n);case ee.ZodNumber:return Zd(t);case ee.ZodObject:return Kd(t,n);case ee.ZodBigInt:return Ld(t);case ee.ZodBoolean:return Dd();case ee.ZodDate:return qu(t,n);case ee.ZodUndefined:return uf();case ee.ZodNull:return Wd();case ee.ZodArray:return Od(t,n);case ee.ZodUnion:case ee.ZodDiscriminatedUnion:return Qd(t,n);case ee.ZodIntersection:return Hd(t,n);case ee.ZodTuple:return sf(t,n);case ee.ZodRecord:return Wu(t,n);case ee.ZodLiteral:return jd(t);case ee.ZodEnum:return Fd(t);case ee.ZodNativeEnum:return qd(t);case ee.ZodNullable:return Xd(t,n);case ee.ZodOptional:return tf(t,n);case ee.ZodMap:return Yd(t,n);case ee.ZodSet:return af(t,n);case ee.ZodLazy:return()=>t.getter()._def;case ee.ZodPromise:return rf(t,n);case ee.ZodNaN:case ee.ZodNever:return Vd();case ee.ZodEffects:return Bd(t,n);case ee.ZodAny:return Xe();case ee.ZodUnknown:return of();case ee.ZodDefault:return Md(t,n);case ee.ZodBranded:return Yu(t,n);case ee.ZodReadonly:return lf(t,n);case ee.ZodCatch:return vd(t,n);case ee.ZodPipeline:return nf(t,n);case ee.ZodFunction:case ee.ZodVoid:case ee.ZodSymbol:return;default:return(r=>{})()}},df=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==wd)return o}if(i&&!n){const o=ff(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=cf(t,t.typeName,e),u=typeof s=="function"?pe(s(),e):s;if(u&&hf(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var ff=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:df(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Xe()):e.$refStrategy==="seen"?Xe():void 0}},hf=(t,e,n)=>(t.description&&(n.description=t.description),n),pf=t=>{const e=Rd(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},mf=(t,e)=>{var n;const r=pf(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,f])=>{var p;return{...l,[d]:(p=pe(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Xe()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Xe(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},pi=Symbol.for("vercel.ai.schema");function gf(t){let e;return()=>(e==null&&(e=t()),e)}function Sr(t,{validate:e}={}){return{[pi]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Ef(t){return typeof t=="object"&&t!==null&&pi in t&&t[pi]===!0&&"jsonSchema"in t&&"validate"in t}function $i(t){return t==null?Sr({properties:{},additionalProperties:!1}):Ef(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Qu(t):bf(t):t()}function bf(t){return Sr(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new en({value:e,cause:n.issues})}}})}function Tf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Sr(()=>mf(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function xf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Sr(()=>$u(kc(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await Ac(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function _f(t){return"_zod"in t}function Qu(t,e){return _f(t)?xf(t):Tf(t)}async function Ya({value:t,schema:e}){const n=await Un({value:t,schema:e});if(!n.success)throw en.wrap({value:t,cause:n.error});return n.value}async function Un({value:t,schema:e}){const n=$i(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:en.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:en.wrap({value:t,cause:r}),rawValue:t}}}async function Ft({text:t,schema:e}){try{const n=Nd(t);return e==null?{success:!0,value:n,rawValue:n}:await Un({value:n,schema:e})}catch(n){return{success:!1,error:Ma.isInstance(n)?n:new Ma({text:t,cause:n}),rawValue:void 0}}}function yf({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Lc).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Ft({text:n,schema:e}))}}))}async function At(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Af=Object.defineProperty,kf=(t,e)=>{for(var n in e)Af(t,n,{get:e[n],enumerable:!0})},Gu="AI_NoObjectGeneratedError",Xu=`vercel.ai.error.${Gu}`,Cf=Symbol.for(Xu),Zu,Ct=class extends It{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:Gu,message:t,cause:e}),this[Zu]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return It.hasMarker(t,Xu)}};Zu=Cf;var qa="6.0.23",Ku=$e([q(),pr(Uint8Array),pr(ArrayBuffer),hu(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Hn=Cc(()=>$e([Ic(),q(),Sc(),Be(),Bn(q(),Hn.optional()),qn(Hn)])),ue=Bn(q(),Bn(q(),Hn.optional())),Ju=be({type:X("text"),text:q(),providerOptions:ue.optional()}),If=be({type:X("image"),image:$e([Ku,pr(URL)]),mediaType:q().optional(),providerOptions:ue.optional()}),eo=be({type:X("file"),data:$e([Ku,pr(URL)]),filename:q().optional(),mediaType:q(),providerOptions:ue.optional()}),Sf=be({type:X("reasoning"),text:q(),providerOptions:ue.optional()}),Nf=be({type:X("tool-call"),toolCallId:q(),toolName:q(),input:Tt(),providerOptions:ue.optional(),providerExecuted:Be().optional()}),wf=Nc("type",[be({type:X("text"),value:q(),providerOptions:ue.optional()}),be({type:X("json"),value:Hn,providerOptions:ue.optional()}),be({type:X("execution-denied"),reason:q().optional(),providerOptions:ue.optional()}),be({type:X("error-text"),value:q(),providerOptions:ue.optional()}),be({type:X("error-json"),value:Hn,providerOptions:ue.optional()}),be({type:X("content"),value:qn($e([be({type:X("text"),text:q(),providerOptions:ue.optional()}),be({type:X("media"),data:q(),mediaType:q()}),be({type:X("file-data"),data:q(),mediaType:q(),filename:q().optional(),providerOptions:ue.optional()}),be({type:X("file-url"),url:q(),providerOptions:ue.optional()}),be({type:X("file-id"),fileId:$e([q(),Bn(q(),q())]),providerOptions:ue.optional()}),be({type:X("image-data"),data:q(),mediaType:q(),providerOptions:ue.optional()}),be({type:X("image-url"),url:q(),providerOptions:ue.optional()}),be({type:X("image-file-id"),fileId:$e([q(),Bn(q(),q())]),providerOptions:ue.optional()}),be({type:X("custom"),providerOptions:ue.optional()})]))})]),to=be({type:X("tool-result"),toolCallId:q(),toolName:q(),output:wf,providerOptions:ue.optional()}),Rf=be({type:X("tool-approval-request"),approvalId:q(),toolCallId:q()}),Of=be({type:X("tool-approval-response"),approvalId:q(),approved:Be(),reason:q().optional()}),Lf=be({role:X("system"),content:q(),providerOptions:ue.optional()}),Df=be({role:X("user"),content:$e([q(),qn($e([Ju,If,eo]))]),providerOptions:ue.optional()}),vf=be({role:X("assistant"),content:$e([q(),qn($e([Ju,eo,Sf,Nf,to,Rf]))]),providerOptions:ue.optional()}),Pf=be({role:X("tool"),content:qn($e([to,Of])),providerOptions:ue.optional()});$e([Lf,Df,vf,Pf]);function no(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=no(a,i):n[r]=i}return n}var Mf={};kf(Mf,{array:()=>Hf,choice:()=>jf,json:()=>zf,object:()=>Uf,text:()=>Ff});function Bf(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,d){switch(o){case'"':{n=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const f=t.substring(r,o+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const d=t.substring(r,t.length);"true".startsWith(d)?u+="true".slice(d.length):"false".startsWith(d)?u+="false".slice(d.length):"null".startsWith(d)&&(u+="null".slice(d.length))}}return u}async function Wn(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Ft({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Ft({text:Bf(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Ff=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),Uf=({schema:t,name:e,description:n})=>{const r=$i(t);return{responseFormat:At(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Ft({text:i});if(!s.success)throw new Ct({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await Un({value:s.value,schema:r});if(!u.success)throw new Ct({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await Wn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Hf=({element:t,name:e,description:n})=>{const r=$i(t);return{responseFormat:At(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Ft({text:i});if(!s.success)throw new Ct({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Ct({message:"No object generated: response did not match schema.",cause:new en({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await Un({value:o,schema:r});if(!l.success)throw new Ct({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await Wn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const d=await Un({value:l,schema:r});d.success&&o.push(d.value)}return{partial:o}}}}}},jf=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Ft({text:r});if(!a.success)throw new Ct({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Ct({message:"No object generated: response did not match schema.",cause:new en({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await Wn(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),zf=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Ft({text:n});if(!i.success)throw new Ct({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await Wn(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});Vn({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
9
9
 
10
10
  `)},flush(t){t.enqueue(`data: [DONE]
11
11
 
@@ -93,6 +93,6 @@ Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An err
93
93
  `))+1))}const s="#".repeat(i),u=n.enter("headingAtx"),o=n.enter("phrasing");a.move(s+" ");let l=n.containerPhrasing(t,{before:"# ",after:`
94
94
  `,...a.current()});return/^[\t ]/.test(l)&&(l=Yn(l.charCodeAt(0))+l.slice(1)),l=l?s+" "+l:s,n.options.closeAtx&&(l+=" "+s),o(),u(),l}$l.peek=yT;function $l(t){return t.value||""}function yT(){return"<"}Yl.peek=AT;function Yl(t,e,n,r){const i=Ea(n),a=i==='"'?"Quote":"Apostrophe",s=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${a}`),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(")"),s(),l}function AT(){return"!"}ql.peek=kT;function ql(t,e,n,r){const i=t.referenceType,a=n.enter("imageReference");let s=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+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=d,a(),i==="full"||!l||l!==f?o+=u.move(f+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function kT(){return"!"}Vl.peek=CT;function Vl(t,e,n){let r=t.value||"",i="`",a=-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+" ");++a<n.unsafe.length;){const s=n.unsafe[a],u=n.compilePattern(s);let o;if(s.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 CT(){return"`"}function Wl(t,e){const n=ra(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))}Ql.peek=IT;function Ql(t,e,n,r){const i=Ea(n),a=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,o;if(Wl(t,n)){const d=n.stack;n.stack=[],u=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(t,{before:f,after:">",...s.current()})),f+=s.move(">"),u(),n.stack=d,f}u=n.enter("link"),o=n.enter("label");let l=s.move("[");return l+=s.move(n.containerPhrasing(t,{before:l,after:"](",...s.current()})),l+=s.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),l+=s.move("<"),l+=s.move(n.safe(t.url,{before:l,after:">",...s.current()})),l+=s.move(">")):(o=n.enter("destinationRaw"),l+=s.move(n.safe(t.url,{before:l,after:t.title?" ":")",...s.current()}))),o(),t.title&&(o=n.enter(`title${a}`),l+=s.move(" "+i),l+=s.move(n.safe(t.title,{before:l,after:i,...s.current()})),l+=s.move(i),o()),l+=s.move(")"),u(),l}function IT(t,e,n){return Wl(t,n)?"<":"["}Gl.peek=ST;function Gl(t,e,n,r){const i=t.referenceType,a=n.enter("linkReference");let s=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+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=d,a(),i==="full"||!l||l!==f?o+=u.move(f+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function ST(){return"["}function ba(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 NT(t){const e=ba(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 wT(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 Xl(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 RT(t,e,n,r){const i=n.enter("list"),a=n.bulletCurrent;let s=t.ordered?wT(n):ba(n);const u=t.ordered?s==="."?")":".":NT(n);let o=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){const d=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&d&&(!d.children||!d.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),Xl(n)===s&&d){let f=-1;for(;++f<t.children.length;){const p=t.children[f];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(s=u),n.bulletCurrent=s;const l=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=a,i(),l}function OT(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 LT(t,e,n,r){const i=OT(n);let a=n.bulletCurrent||ba(n);e&&e.type==="list"&&e.ordered&&(a=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(s-a.length)),u.shift(s);const o=n.enter("listItem"),l=n.indentLines(n.containerFlow(t,u.current()),d);return o(),l;function d(f,p,h){return p?(h?"":" ".repeat(s))+f:(h?a:a+" ".repeat(s-a.length))+f}}function DT(t,e,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),s=n.containerPhrasing(t,r);return a(),i(),s}const vT=Pr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function PT(t,e,n,r){return(t.children.some(function(s){return vT(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function MT(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Zl.peek=BT;function Zl(t,e,n,r){const i=MT(n),a=n.enter("strong"),s=n.createTracker(r),u=s.move(i+i);let o=s.move(n.containerPhrasing(t,{after:i,before:u,...s.current()}));const l=o.charCodeAt(0),d=kr(r.before.charCodeAt(r.before.length-1),l,i);d.inside&&(o=Yn(l)+o.slice(1));const f=o.charCodeAt(o.length-1),p=kr(r.after.charCodeAt(0),f,i);p.inside&&(o=o.slice(0,-1)+Yn(f));const h=s.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},u+o+h}function BT(t,e,n){return n.options.strong||"*"}function FT(t,e,n,r){return n.safe(t.value,r)}function UT(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 HT(t,e,n){const r=(Xl(n)+(n.options.ruleSpaces?" ":"")).repeat(UT(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Kl={blockquote:lT,break:su,code:mT,definition:ET,emphasis:zl,hardBreak:su,heading:_T,html:$l,image:Yl,imageReference:ql,inlineCode:Vl,link:Ql,linkReference:Gl,list:RT,listItem:LT,paragraph:DT,root:PT,strong:Zl,text:FT,thematicBreak:HT};function jT(){return{enter:{table:zT,tableData:uu,tableHeader:uu,tableRow:YT},exit:{codeText:qT,table:$T,tableData:ci,tableHeader:ci,tableRow:ci}}}function zT(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 $T(t){this.exit(t),this.data.inTable=void 0}function YT(t){this.enter({type:"tableRow",children:[]},t)}function ci(t){this.exit(t)}function uu(t){this.enter({type:"tableCell",children:[]},t)}function qT(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,VT));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function VT(t,e){return e==="|"?e:t}function WT(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
95
95
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:o,tableRow:u}};function s(h,g,_,y){return l(d(h,_,y),h.align)}function u(h,g,_,y){const T=f(h,_,y),S=l([T]);return S.slice(0,S.indexOf(`
96
- `))}function o(h,g,_,y){const T=_.enter("tableCell"),S=_.enter("phrasing"),E=_.containerPhrasing(h,{...y,before:a,after:a});return S(),T(),E}function l(h,g){return uT(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(h,g,_){const y=h.children;let T=-1;const S=[],E=g.enter("table");for(;++T<y.length;)S[T]=f(y[T],g,_);return E(),S}function f(h,g,_){const y=h.children;let T=-1;const S=[],E=g.enter("tableRow");for(;++T<y.length;)S[T]=o(y[T],h,g,_);return E(),S}function p(h,g,_){let y=Kl.inlineCode(h,g,_);return _.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function QT(){return{exit:{taskListCheckValueChecked:ou,taskListCheckValueUnchecked:ou,paragraph:XT}}}function GT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ZT}}}function ou(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function XT(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 a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===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 ZT(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Kl.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(d){return d+s}}function KT(){return[R2(),Z2(),tT(),jT(),QT()]}function JT(t){return{extensions:[O2(),K2(t),nT(),WT(t),GT()]}}const ex={tokenize:sx,partial:!0},Jl={tokenize:ux,partial:!0},ec={tokenize:ox,partial:!0},tc={tokenize:lx,partial:!0},tx={tokenize:cx,partial:!0},nc={name:"wwwAutolink",tokenize:ix,previous:ic},rc={name:"protocolAutolink",tokenize:ax,previous:ac},Et={name:"emailAutolink",tokenize:rx,previous:sc},dt={};function nx(){return{text:dt}}let Lt=48;for(;Lt<123;)dt[Lt]=Et,Lt++,Lt===58?Lt=65:Lt===91&&(Lt=97);dt[43]=Et;dt[45]=Et;dt[46]=Et;dt[95]=Et;dt[72]=[Et,rc];dt[104]=[Et,rc];dt[87]=[Et,nc];dt[119]=[Et,nc];function rx(t,e,n){const r=this;let i,a;return s;function s(f){return!Mi(f)||!sc.call(r,r.previous)||Ta(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(f))}function u(f){return Mi(f)?(t.consume(f),u):f===64?(t.consume(f),o):n(f)}function o(f){return f===46?t.check(tx,d,l)(f):f===45||f===95||De(f)?(a=!0,t.consume(f),o):d(f)}function l(f){return t.consume(f),i=!0,o}function d(f){return a&&i&&Fe(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function ix(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!ic.call(r,r.previous)||Ta(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(ex,t.attempt(Jl,t.attempt(ec,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function ax(t,e,n){const r=this;let i="",a=!1;return s;function s(f){return(f===72||f===104)&&ac.call(r,r.previous)&&!Ta(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),u):n(f)}function u(f){if(Fe(f)&&i.length<5)return i+=String.fromCodePoint(f),t.consume(f),u;if(f===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(f),o}return n(f)}function o(f){return f===47?(t.consume(f),a?l:(a=!0,o)):n(f)}function l(f){return f===null||Tr(f)||Te(f)||Ht(f)||Lr(f)?n(f):t.attempt(Jl,t.attempt(ec,d),n)(f)}function d(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function sx(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function ux(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(tc,o,u)(l):l===null||Te(l)||Ht(l)||l!==45&&Lr(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function ox(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(tc,e,a)(s):s===null||Te(s)||Ht(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function lx(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),a):u===93?(t.consume(u),i):u===60||u===null||Te(u)||Ht(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Te(u)||Ht(u)?e(u):r(u)}function a(u){return Fe(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):Fe(u)?(t.consume(u),s):n(u)}}function cx(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return De(a)?n(a):e(a)}}function ic(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Te(t)}function ac(t){return!Fe(t)}function sc(t){return!(t===47||Mi(t))}function Mi(t){return t===43||t===45||t===46||t===95||De(t)}function Ta(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 dx={tokenize:Tx,partial:!0};function fx(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:gx,continuation:{tokenize:Ex},exit:bx}},text:{91:{name:"gfmFootnoteCall",tokenize:mx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hx,resolveTo:px}}}}function hx(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=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(!s||!s._balanced)return n(o);const l=it(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function px(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 a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function mx(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),o}function o(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(f){if(a>999||f===93&&!s||f===null||f===91||Te(f))return n(f);if(f===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(it(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return Te(f)||(s=!0),a++,t.consume(f),f===92?d:l}function d(f){return f===91||f===92||f===93?(t.consume(f),a++,l):l(f)}}function gx(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=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",d):n(g)}function d(g){if(s>999||g===93&&!u||g===null||g===91||Te(g))return n(g);if(g===93){t.exit("chunkString");const _=t.exit("gfmFootnoteDefinitionLabelString");return a=it(r.sliceSerialize(_)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Te(g)||(u=!0),s++,t.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(t.consume(g),s++,d):d(g)}function p(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),i.includes(a)||i.push(a),oe(t,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return e(g)}}function Ex(t,e,n){return t.check(Zn,e,t.attempt(dx,e,n))}function bx(t){t.exit("gfmFootnoteDefinition")}function Tx(t,e,n){const r=this;return oe(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function xx(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},f={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",d,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",f,u]],h=u.parser.constructs.insideSpan.null;h&&Ge(p,p.length,0,Dr(h,s.slice(l+1,o),u)),Ge(p,p.length,0,[["exit",f,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",d,u]]),Ge(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,d=this.events;let f=0;return p;function p(g){return l===126&&d[d.length-1][1].type!=="characterEscape"?o(g):(s.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const _=tn(l);if(g===126)return f>1?o(g):(s.consume(g),f++,h);if(f<2&&!n)return o(g);const y=s.exit("strikethroughSequenceTemporary"),T=tn(g);return y._open=!T||T===2&&!!_,y._close=!_||_===2&&!!T,u(g)}}}class _x{constructor(){this.map=[]}add(e,n,r){yx(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[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 a of i)e.push(a);i=r.pop()}this.map.length=0}}function yx(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 Ax(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 a=r.length-1;r[a]=r[a]==="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 kx(){return{flow:{null:{name:"table",tokenize:Cx,resolveAll:Ix}}}}function Cx(t,e,n){const r=this;let i=0,a=0,s;return u;function u(N){let F=r.events.length-1;for(;F>-1;){const $=r.events[F][1].type;if($==="lineEnding"||$==="linePrefix")F--;else break}const P=F>-1?r.events[F][1].type:null,Z=P==="tableHead"||P==="tableRow"?I:o;return Z===I&&r.parser.lazy[r.now().line]?n(N):Z(N)}function o(N){return t.enter("tableHead"),t.enter("tableRow"),l(N)}function l(N){return N===124||(s=!0,a+=1),d(N)}function d(N){return N===null?n(N):G(N)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),h):n(N):ie(N)?oe(t,d,"whitespace")(N):(a+=1,s&&(s=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),s=!0,d):(t.enter("data"),f(N)))}function f(N){return N===null||N===124||Te(N)?(t.exit("data"),d(N)):(t.consume(N),N===92?p:f)}function p(N){return N===92||N===124?(t.consume(N),f):f(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),s=!1,ie(N)?oe(t,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?y(N):N===124?(s=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),_):O(N)}function _(N){return ie(N)?oe(t,y,"whitespace")(N):y(N)}function y(N){return N===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),T):N===45?(a+=1,T(N)):N===null||G(N)?R(N):O(N)}function T(N){return N===45?(t.enter("tableDelimiterFiller"),S(N)):O(N)}function S(N){return N===45?(t.consume(N),S):N===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),E):(t.exit("tableDelimiterFiller"),E(N))}function E(N){return ie(N)?oe(t,R,"whitespace")(N):R(N)}function R(N){return N===124?g(N):N===null||G(N)?!s||i!==a?O(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):O(N)}function O(N){return n(N)}function I(N){return t.enter("tableRow"),v(N)}function v(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),v):N===null||G(N)?(t.exit("tableRow"),e(N)):ie(N)?oe(t,v,"whitespace")(N):(t.enter("data"),B(N))}function B(N){return N===null||N===124||Te(N)?(t.exit("data"),v(N)):(t.consume(N),N===92?z:B)}function z(N){return N===92||N===124?(t.consume(N),B):B(N)}}function Ix(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,d,f;const p=new _x;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(lu(p,e,o,l,d),d=void 0,o=0),l={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",l,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",d,e]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],f=ur(p,e,a,i,void 0,f),a=[0,0,0,0]),s[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],f=ur(p,e,a,i,void 0,f)),a=s,s=[a[1],n,0,0])):g.type==="tableHead"?(u=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],f=ur(p,e,a,i,n,f)):s[1]!==0&&(f=ur(p,e,s,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&lu(p,e,o,l,d),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=Ax(e.events,n))}return t}function ur(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},Xt(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=Xt(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=Xt(e.events,n[2]),d=Xt(e.events,n[3]),f={type:u,start:Object.assign({},l),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",f,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,_=n[3]-n[2]-1;t.add(g,_,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return i!==void 0&&(a.end=Object.assign({},Xt(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function lu(t,e,n,r,i){const a=[],s=Xt(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function Xt(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Sx={name:"tasklistCheck",tokenize:wx};function Nx(){return{text:{91:Sx}}}function wx(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"),a)}function a(o){return Te(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return G(o)?e(o):ie(o)?t.check({tokenize:Rx},e,n)(o):n(o)}}function Rx(t,e,n){return oe(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function Ox(t){return Po([nx(),fx(),xx(t),kx(),Nx()])}const Lx={};function Dx(t){const e=this,n=t||Lx,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ox(n)),a.push(KT()),s.push(JT(n))}const vx=V.lazy(()=>Rc(()=>import("./lazy-highlighter-6XYxZAuO.js"),__vite__mapDeps([0,1,2])));function uc(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Px(){const t=W.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=m.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(Mx)}),t[1]=r):r=t[1],r}function Mx(t,e){return m.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&m.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&&m.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&&m.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),m.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&&m.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function Bx(t){const e=W.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=uc(),a=Fx;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?m.jsx(Jt,{size:12}):m.jsx(Hi,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=m.jsx("div",{className:"flex justify-end items-center",children:m.jsxs(Ye,{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 d;e[7]!==t?(d=m.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:m.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==d?(f=m.jsxs(m.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function Fx(t){return t?Array.from(t.querySelectorAll("tr")).map(Ux).join(`
96
+ `))}function o(h,g,_,y){const T=_.enter("tableCell"),S=_.enter("phrasing"),E=_.containerPhrasing(h,{...y,before:a,after:a});return S(),T(),E}function l(h,g){return uT(h,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(h,g,_){const y=h.children;let T=-1;const S=[],E=g.enter("table");for(;++T<y.length;)S[T]=f(y[T],g,_);return E(),S}function f(h,g,_){const y=h.children;let T=-1;const S=[],E=g.enter("tableRow");for(;++T<y.length;)S[T]=o(y[T],h,g,_);return E(),S}function p(h,g,_){let y=Kl.inlineCode(h,g,_);return _.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function QT(){return{exit:{taskListCheckValueChecked:ou,taskListCheckValueUnchecked:ou,paragraph:XT}}}function GT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ZT}}}function ou(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function XT(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 a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===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 ZT(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Kl.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(d){return d+s}}function KT(){return[R2(),Z2(),tT(),jT(),QT()]}function JT(t){return{extensions:[O2(),K2(t),nT(),WT(t),GT()]}}const ex={tokenize:sx,partial:!0},Jl={tokenize:ux,partial:!0},ec={tokenize:ox,partial:!0},tc={tokenize:lx,partial:!0},tx={tokenize:cx,partial:!0},nc={name:"wwwAutolink",tokenize:ix,previous:ic},rc={name:"protocolAutolink",tokenize:ax,previous:ac},Et={name:"emailAutolink",tokenize:rx,previous:sc},dt={};function nx(){return{text:dt}}let Lt=48;for(;Lt<123;)dt[Lt]=Et,Lt++,Lt===58?Lt=65:Lt===91&&(Lt=97);dt[43]=Et;dt[45]=Et;dt[46]=Et;dt[95]=Et;dt[72]=[Et,rc];dt[104]=[Et,rc];dt[87]=[Et,nc];dt[119]=[Et,nc];function rx(t,e,n){const r=this;let i,a;return s;function s(f){return!Mi(f)||!sc.call(r,r.previous)||Ta(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(f))}function u(f){return Mi(f)?(t.consume(f),u):f===64?(t.consume(f),o):n(f)}function o(f){return f===46?t.check(tx,d,l)(f):f===45||f===95||De(f)?(a=!0,t.consume(f),o):d(f)}function l(f){return t.consume(f),i=!0,o}function d(f){return a&&i&&Fe(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function ix(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!ic.call(r,r.previous)||Ta(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(ex,t.attempt(Jl,t.attempt(ec,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function ax(t,e,n){const r=this;let i="",a=!1;return s;function s(f){return(f===72||f===104)&&ac.call(r,r.previous)&&!Ta(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),u):n(f)}function u(f){if(Fe(f)&&i.length<5)return i+=String.fromCodePoint(f),t.consume(f),u;if(f===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(f),o}return n(f)}function o(f){return f===47?(t.consume(f),a?l:(a=!0,o)):n(f)}function l(f){return f===null||Tr(f)||Te(f)||Ht(f)||Lr(f)?n(f):t.attempt(Jl,t.attempt(ec,d),n)(f)}function d(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function sx(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function ux(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(tc,o,u)(l):l===null||Te(l)||Ht(l)||l!==45&&Lr(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function ox(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(tc,e,a)(s):s===null||Te(s)||Ht(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function lx(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),a):u===93?(t.consume(u),i):u===60||u===null||Te(u)||Ht(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Te(u)||Ht(u)?e(u):r(u)}function a(u){return Fe(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):Fe(u)?(t.consume(u),s):n(u)}}function cx(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return De(a)?n(a):e(a)}}function ic(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Te(t)}function ac(t){return!Fe(t)}function sc(t){return!(t===47||Mi(t))}function Mi(t){return t===43||t===45||t===46||t===95||De(t)}function Ta(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 dx={tokenize:Tx,partial:!0};function fx(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:gx,continuation:{tokenize:Ex},exit:bx}},text:{91:{name:"gfmFootnoteCall",tokenize:mx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hx,resolveTo:px}}}}function hx(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=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(!s||!s._balanced)return n(o);const l=it(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function px(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 a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function mx(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),o}function o(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(f){if(a>999||f===93&&!s||f===null||f===91||Te(f))return n(f);if(f===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(it(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return Te(f)||(s=!0),a++,t.consume(f),f===92?d:l}function d(f){return f===91||f===92||f===93?(t.consume(f),a++,l):l(f)}}function gx(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=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",d):n(g)}function d(g){if(s>999||g===93&&!u||g===null||g===91||Te(g))return n(g);if(g===93){t.exit("chunkString");const _=t.exit("gfmFootnoteDefinitionLabelString");return a=it(r.sliceSerialize(_)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(g),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Te(g)||(u=!0),s++,t.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(t.consume(g),s++,d):d(g)}function p(g){return g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),i.includes(a)||i.push(a),oe(t,h,"gfmFootnoteDefinitionWhitespace")):n(g)}function h(g){return e(g)}}function Ex(t,e,n){return t.check(Zn,e,t.attempt(dx,e,n))}function bx(t){t.exit("gfmFootnoteDefinition")}function Tx(t,e,n){const r=this;return oe(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function xx(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},f={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",d,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",f,u]],h=u.parser.constructs.insideSpan.null;h&&Ge(p,p.length,0,Dr(h,s.slice(l+1,o),u)),Ge(p,p.length,0,[["exit",f,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",d,u]]),Ge(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,d=this.events;let f=0;return p;function p(g){return l===126&&d[d.length-1][1].type!=="characterEscape"?o(g):(s.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const _=tn(l);if(g===126)return f>1?o(g):(s.consume(g),f++,h);if(f<2&&!n)return o(g);const y=s.exit("strikethroughSequenceTemporary"),T=tn(g);return y._open=!T||T===2&&!!_,y._close=!_||_===2&&!!T,u(g)}}}class _x{constructor(){this.map=[]}add(e,n,r){yx(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[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 a of i)e.push(a);i=r.pop()}this.map.length=0}}function yx(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 Ax(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 a=r.length-1;r[a]=r[a]==="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 kx(){return{flow:{null:{name:"table",tokenize:Cx,resolveAll:Ix}}}}function Cx(t,e,n){const r=this;let i=0,a=0,s;return u;function u(N){let F=r.events.length-1;for(;F>-1;){const $=r.events[F][1].type;if($==="lineEnding"||$==="linePrefix")F--;else break}const P=F>-1?r.events[F][1].type:null,Z=P==="tableHead"||P==="tableRow"?I:o;return Z===I&&r.parser.lazy[r.now().line]?n(N):Z(N)}function o(N){return t.enter("tableHead"),t.enter("tableRow"),l(N)}function l(N){return N===124||(s=!0,a+=1),d(N)}function d(N){return N===null?n(N):G(N)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),h):n(N):ie(N)?oe(t,d,"whitespace")(N):(a+=1,s&&(s=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),s=!0,d):(t.enter("data"),f(N)))}function f(N){return N===null||N===124||Te(N)?(t.exit("data"),d(N)):(t.consume(N),N===92?p:f)}function p(N){return N===92||N===124?(t.consume(N),f):f(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),s=!1,ie(N)?oe(t,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?y(N):N===124?(s=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),_):O(N)}function _(N){return ie(N)?oe(t,y,"whitespace")(N):y(N)}function y(N){return N===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),T):N===45?(a+=1,T(N)):N===null||G(N)?R(N):O(N)}function T(N){return N===45?(t.enter("tableDelimiterFiller"),S(N)):O(N)}function S(N){return N===45?(t.consume(N),S):N===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),E):(t.exit("tableDelimiterFiller"),E(N))}function E(N){return ie(N)?oe(t,R,"whitespace")(N):R(N)}function R(N){return N===124?g(N):N===null||G(N)?!s||i!==a?O(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):O(N)}function O(N){return n(N)}function I(N){return t.enter("tableRow"),v(N)}function v(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),v):N===null||G(N)?(t.exit("tableRow"),e(N)):ie(N)?oe(t,v,"whitespace")(N):(t.enter("data"),B(N))}function B(N){return N===null||N===124||Te(N)?(t.exit("data"),v(N)):(t.consume(N),N===92?z:B)}function z(N){return N===92||N===124?(t.consume(N),B):B(N)}}function Ix(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,d,f;const p=new _x;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(lu(p,e,o,l,d),d=void 0,o=0),l={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",l,e]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(n,0,[["enter",d,e]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],f=ur(p,e,a,i,void 0,f),a=[0,0,0,0]),s[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],f=ur(p,e,a,i,void 0,f)),a=s,s=[a[1],n,0,0])):g.type==="tableHead"?(u=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],f=ur(p,e,a,i,n,f)):s[1]!==0&&(f=ur(p,e,s,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&lu(p,e,o,l,d),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=Ax(e.events,n))}return t}function ur(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},Xt(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=Xt(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=Xt(e.events,n[2]),d=Xt(e.events,n[3]),f={type:u,start:Object.assign({},l),end:Object.assign({},d)};if(t.add(n[2],0,[["enter",f,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,_=n[3]-n[2]-1;t.add(g,_,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return i!==void 0&&(a.end=Object.assign({},Xt(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function lu(t,e,n,r,i){const a=[],s=Xt(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function Xt(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Sx={name:"tasklistCheck",tokenize:wx};function Nx(){return{text:{91:Sx}}}function wx(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"),a)}function a(o){return Te(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return G(o)?e(o):ie(o)?t.check({tokenize:Rx},e,n)(o):n(o)}}function Rx(t,e,n){return oe(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function Ox(t){return Po([nx(),fx(),xx(t),kx(),Nx()])}const Lx={};function Dx(t){const e=this,n=t||Lx,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ox(n)),a.push(KT()),s.push(JT(n))}const vx=V.lazy(()=>Rc(()=>import("./lazy-highlighter-_VEiNIwF.js"),__vite__mapDeps([0,1,2])));function uc(){const t=W.c(3),[e,n]=V.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function Px(){const t=W.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=m.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(Mx)}),t[1]=r):r=t[1],r}function Mx(t,e){return m.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&m.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&&m.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&&m.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),m.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&&m.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function Bx(t){const e=W.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=uc(),a=Fx;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?m.jsx(Jt,{size:12}):m.jsx(Hi,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=m.jsx("div",{className:"flex justify-end items-center",children:m.jsxs(Ye,{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 d;e[7]!==t?(d=m.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:m.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=d):d=e[8];let f;return e[9]!==l||e[10]!==d?(f=m.jsxs(m.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11],f}function Fx(t){return t?Array.from(t.querySelectorAll("tr")).map(Ux).join(`
97
97
  `):""}function Ux(t){return Array.from(t.querySelectorAll("th,td")).map(Hx).join(",")}function Hx(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const jx=[Dx],zx=[k2],$x={p:t=>m.jsx("p",{...t,className:"leading-relaxed text-sm mb-2 last:mb-0"}),strong:t=>m.jsx("strong",{...t,className:"font-bold"}),em:t=>m.jsx("em",{...t,className:"italic"}),a:t=>m.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-primary-dark hover:underline break-all font-medium"}),ul:t=>m.jsx("ul",{...t,className:"list-disc ml-6 my-4 space-y-2"}),ol:t=>m.jsx("ol",{...t,className:"list-decimal ml-6 my-4 space-y-2"}),li:t=>m.jsx("li",{...t,className:"leading-relaxed text-sm"}),code:t=>m.jsx("code",{...t,className:"px-1 py-0.5 bg-muted rounded text-sm font-mono break-all"}),pre:t=>m.jsx("pre",{...t,className:"flex w-full min-w-0 my-4 bg-muted rounded overflow-hidden",children:m.jsx("code",{className:"flex-1 min-w-0 p-4 text-sm font-mono whitespace-pre overflow-x-auto",children:t.children})}),table:t=>m.jsx(Bx,{...t}),thead:t=>m.jsx("thead",{...t,className:"bg-muted",children:t.children}),tr:t=>m.jsx("tr",{...t,className:"even:bg-muted/50 border-b border-border last:border-0"}),th:t=>m.jsx("th",{...t,className:"px-4 py-2 text-left font-semibold text-muted-foreground border-b border-border"}),td:t=>m.jsx("td",{...t,className:"px-4 py-2 border-b border-border"})},oc=V.memo(t=>{const e=W.c(2),{content:n}=t;let r;return e[0]!==n?(r=m.jsx(og,{remarkPlugins:jx,rehypePlugins:zx,components:$x,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function Yx(t){const e=W.c(20),{language:n,content:r}=t,{handleCopy:i,copied:a}=uc(),s=n||"text";let u;e[0]!==s?(u=m.jsx("span",{className:"text-xs font-mono uppercase text-muted-foreground tracking-widest select-none",children:s}),e[0]=s,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]!==a?(l=a?m.jsx(Jt,{size:14}):m.jsx(Hi,{size:14}),e[5]=a,e[6]=l):l=e[6];let d;e[7]!==o||e[8]!==l?(d=m.jsx(Ye,{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]=d):d=e[9];let f;e[10]!==u||e[11]!==d?(f=m.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 bg-muted border-b border-border",children:[u,d]}),e[10]=u,e[11]=d,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=m.jsx(Px,{}),e[13]=p):p=e[13];let h;e[14]!==r||e[15]!==n?(h=m.jsx(V.Suspense,{fallback:p,children:m.jsx(vx,{language:n,content:r})}),e[14]=r,e[15]=n,e[16]=h):h=e[16];let g;return e[17]!==f||e[18]!==h?(g=m.jsxs("div",{className:"my-4 rounded-lg bg-muted overflow-hidden border border-border grid min-w-0",children:[f,h]}),e[17]=f,e[18]=h,e[19]=g):g=e[19],g}oc.displayName="MemoizedMarkdownBlock";const xa=t=>{const e=W.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=he.lexer(r),e[0]=r,e[1]=i):i=e[1];const a=i;let s;if(e[2]!==a||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?m.jsx(Yx,{language:o.lang,content:o.text},`${n}-block_${l}`):m.jsx(oc,{content:o.raw},`${n}-block_${l}`),e[5]=n,e[6]=u):u=e[6],s=a.map(u),e[2]=a,e[3]=n,e[4]=s}else s=e[4];return s};xa.displayName="MemoizedMarkdown";function lc(t){const e=W.c(18),{id:n,part:r,copyable:i,extraActions:a,hasToolCallAfter:s}=t,u=i===void 0?!1:i,o=s===void 0?!1:s,{handleCopy:l}=Th(),[d,f]=V.useState(!1);let p;e[0]!==l||e[1]!==r.text?(p=async()=>{await l(r.text),f(!0),setTimeout(()=>f(!1),2e3)},e[0]=l,e[1]=r.text,e[2]=p):p=e[2];const h=p,g=u&&a,_=g||a,y=!o&&"mb-2";let T;e[3]!==y?(T=ce("group/part relative",y),e[3]=y,e[4]=T):T=e[4];let S;e[5]!==n||e[6]!==r.text?(S=m.jsx(xa,{id:n,text:r.text}),e[5]=n,e[6]=r.text,e[7]=S):S=e[7];let E;e[8]!==a||e[9]!==h||e[10]!==d||e[11]!==_||e[12]!==g?(E=_&&m.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:m.jsxs("div",{className:"flex items-center gap-1",children:[g&&m.jsx(Ye,{onClick:h,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground size-6 whitespace-nowrap",children:d?m.jsx(Jt,{size:12}):m.jsx(Hi,{size:12})}),a]})}),e[8]=a,e[9]=h,e[10]=d,e[11]=_,e[12]=g,e[13]=E):E=e[13];let R;return e[14]!==T||e[15]!==S||e[16]!==E?(R=m.jsxs("div",{className:T,children:[S,E]}),e[14]=T,e[15]=S,e[16]=E,e[17]=R):R=e[17],R}function qx(t){const e=W.c(4),{output:n}=t;let r;if(e[0]!==n){const s=JSON.stringify(n,null,2);r=s.length>2e3?s.slice(0,2e3)+"...[TRUNCATED]":s,e[0]=n,e[1]=r}else r=e[1];const i=r;let a;return e[2]!==i?(a=m.jsx("div",{className:"h-full",children:m.jsx(xu,{code:i,language:"json",height:"100%",readOnly:!0})}),e[2]=i,e[3]=a):a=e[3],a}function cu(t){const e=W.c(35),{part:n}=t,{state:r}=n;let i;e[0]!==n?(i="toolName"in n?n.toolName:n.type.replace("tool-",""),e[0]=n,e[1]=i):i=e[1];const a=i,[s,u]=V.useState(!1),o=(r==="input-streaming"||r==="input-available"||r==="output-available")&&!!n.input,l=r==="output-available",d=r==="output-error";let f;e[2]!==s?(f=()=>u(!s),e[2]=s,e[3]=f):f=e[3];let p;e[4]!==r?(p=r==="output-error"?m.jsx(bu,{className:"size-4 text-destructive shrink-0"}):m.jsx(Vc,{className:ce("size-4 text-muted-foreground shrink-0",(r==="input-streaming"||r==="input-available")&&"shimmer")}),e[4]=r,e[5]=p):p=e[5];const h=r==="output-error"&&"text-destructive/90",g=(r==="input-streaming"||r==="input-available")&&"shimmer";let _;e[6]!==h||e[7]!==g?(_=ce("text-xs font-medium text-muted-foreground truncate",h,g),e[6]=h,e[7]=g,e[8]=_):_=e[8];const y=r==="input-streaming"&&`Streaming ${a} arguments`,T=r==="input-available"&&`Calling ${a}`,S=r==="output-available"&&`Called ${a}`,E=r==="output-error"&&`Error calling ${a}`;let R;e[9]!==E||e[10]!==_||e[11]!==y||e[12]!==T||e[13]!==S?(R=m.jsxs("span",{className:_,children:[y,T,S,E]}),e[9]=E,e[10]=_,e[11]=y,e[12]=T,e[13]=S,e[14]=R):R=e[14];let O;e[15]!==R||e[16]!==p?(O=m.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[p,R]}),e[15]=R,e[16]=p,e[17]=O):O=e[17];const I=s&&"rotate-90";let v;e[18]!==I?(v=ce("size-4 text-muted-foreground transition-transform",I),e[18]=I,e[19]=v):v=e[19];let B;e[20]!==v?(B=m.jsx("div",{className:"flex items-center gap-2 shrink-0",children:m.jsx(Tu,{className:v})}),e[20]=v,e[21]=B):B=e[21];let z;e[22]!==O||e[23]!==B||e[24]!==f?(z=m.jsxs("button",{type:"button",onClick:f,className:"flex items-center gap-2 w-full cursor-pointer p-3",children:[O,B]}),e[22]=O,e[23]=B,e[24]=f,e[25]=z):z=e[25];let N;e[26]!==s||e[27]!==n||e[28]!==d||e[29]!==o||e[30]!==l?(N=s&&m.jsxs("div",{className:"flex ml-[7px] px-3 pb-3",children:[m.jsx("div",{className:"w-4 relative shrink-0",children:m.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-0.25 bg-border"})}),m.jsxs("div",{className:"flex flex-col gap-4 flex-1 min-w-0 pt-2",children:[o&&m.jsxs("div",{className:"flex flex-col gap-0.5",children:[m.jsx("div",{className:"px-1 h-5 flex items-center",children:m.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Input"})}),m.jsx("div",{className:"border border-border rounded-lg p-2 h-full max-h-[200px]",children:m.jsx(xu,{code:JSON.stringify(n.input,null,2),language:"json",foldOnMount:!0,height:"100%",readOnly:!0})})]}),l&&m.jsxs("div",{className:"flex flex-col gap-0.5",children:[m.jsx("div",{className:"px-1 h-5 flex items-center",children:m.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output"})}),m.jsx("div",{className:"border border-border rounded-lg max-h-[200px] overflow-auto p-2 h-full",children:m.jsx(qx,{output:n.output})})]}),d&&m.jsxs("div",{className:"flex flex-col gap-0.5",children:[m.jsx("div",{className:"px-1 h-5 flex items-center",children:m.jsx("span",{className:"text-xs font-medium text-destructive/90",children:"Error"})}),m.jsx("div",{className:"border border-destructive/20 rounded-lg max-h-[200px] overflow-auto p-2 bg-destructive/10",children:m.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[26]=s,e[27]=n,e[28]=d,e[29]=o,e[30]=l,e[31]=N):N=e[31];let F;return e[32]!==z||e[33]!==N?(F=m.jsx("div",{className:"flex flex-col my-4 w-full min-w-0",children:m.jsxs("div",{className:"border border-border/75 rounded-lg flex flex-col bg-background w-full min-w-0 overflow-hidden",children:[z,N]})}),e[32]=z,e[33]=N,e[34]=F):F=e[34],F}const Vx={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 Wx(t){if(!t?.providerMetadata)return null;for(const e of Object.values(Vx)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function Qx(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+(Wx(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function Gx(t){const e=W.c(38),{messages:n}=t;let r,i,a,s,u,o,l,d,f,p,h,g;if(e[0]!==n){g=Symbol.for("react.early_return_sentinel");e:{const R=Qx(n);if(!R){g=null;break e}const{totalTokens:O,inputTokens:I,outputTokens:v,cost:B}=R;if(a=B,!O&&!I&&!v){g=null;break e}i=an;let z;e[13]===Symbol.for("react.memo_cache_sentinel")?(z=m.jsx(yu,{size:12}),e[13]=z):z=e[13];const N=m.jsxs(Ye,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap",children:[z,m.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:O.toLocaleString()})]});e[14]!==N?(h=m.jsx(sn,{asChild:!0,children:N}),e[14]=N,e[15]=h):h=e[15],r=un,f="top",p="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=m.jsx("span",{className:"text-muted",children:"in"}),e[16]=o):o=e[16],l=m.jsx("span",{children:I.toLocaleString()}),e[17]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("span",{className:"text-muted",children:"out"}),e[17]=d):d=e[17],s=v.toLocaleString()}e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=o,e[7]=l,e[8]=d,e[9]=f,e[10]=p,e[11]=h,e[12]=g}else r=e[1],i=e[2],a=e[3],s=e[4],u=e[5],o=e[6],l=e[7],d=e[8],f=e[9],p=e[10],h=e[11],g=e[12];if(g!==Symbol.for("react.early_return_sentinel"))return g;let _;e[18]!==s?(_=m.jsx("span",{children:s}),e[18]=s,e[19]=_):_=e[19];let y;e[20]!==a?(y=a>0&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-muted",children:"cost"}),m.jsxs("span",{children:["$",a.toFixed(4)]})]}),e[20]=a,e[21]=y):y=e[21];let T;e[22]!==_||e[23]!==y||e[24]!==u||e[25]!==o||e[26]!==l||e[27]!==d?(T=m.jsxs("div",{className:u,children:[o,l,d,_,y]}),e[22]=_,e[23]=y,e[24]=u,e[25]=o,e[26]=l,e[27]=d,e[28]=T):T=e[28];let S;e[29]!==r||e[30]!==T||e[31]!==f||e[32]!==p?(S=m.jsx(r,{side:f,className:p,children:T}),e[29]=r,e[30]=T,e[31]=f,e[32]=p,e[33]=S):S=e[33];let E;return e[34]!==i||e[35]!==S||e[36]!==h?(E=m.jsxs(i,{children:[h,S]}),e[34]=i,e[35]=S,e[36]=h,e[37]=E):E=e[37],E}const Xx={planning:{icon:m.jsx(wu,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:m.jsx(Cr,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},Zx=1200;function Kx(){const t=W.c(7),[e,n]=V.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},Zx);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),V.useEffect(r,i);const a=Xx[e];let s;t[2]!==a.label?(s=m.jsxs("span",{className:"text-xs text-muted-foreground shimmer",children:[a.label,"..."]}),t[2]=a.label,t[3]=s):s=t[3];let u;return t[4]!==a.icon||t[5]!==s?(u=m.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:m.jsxs("span",{className:"flex items-center gap-1.5",children:[a.icon,s]})}),t[4]=a.icon,t[5]=s,t[6]=u):u=t[6],u}function Jx(t){const e=W.c(10),{duration:n,parts:r,id:i}=t,a=n/1e3;let s;e[0]!==a?(s=a.toFixed(1),e[0]=a,e[1]=s):s=e[1];const u=s,[o,l]=V.useState(!1),[d,f]=V.useState(!1);let p;if(e[2]!==i||e[3]!==d||e[4]!==o||e[5]!==r||e[6]!==u){const h=r.filter(t3),g=h.some(e3),_=g||d;let y,T;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=()=>l(!0),T=()=>l(!1),e[8]=y,e[9]=T):(y=e[8],T=e[9]),p=m.jsxs("div",{className:"flex flex-col mb-2",children:[m.jsx("button",{type:"button",onClick:()=>!g&&f(!d),onMouseEnter:y,onMouseLeave:T,className:ce("flex items-center gap-1.5 py-2 opacity-60 transition-opacity",!g&&"cursor-pointer hover:opacity-100",g&&"cursor-default"),children:m.jsxs("span",{className:"flex items-center gap-1.5",children:[g?m.jsx(Cr,{className:"text-muted-foreground shrink-0 shimmer",size:14}):o?m.jsx(Tu,{className:ce("text-muted-foreground transition-transform shrink-0",d&&"rotate-90"),size:14}):m.jsx(Su,{className:"text-muted-foreground shrink-0",size:14}),m.jsx("span",{className:ce("text-xs text-muted-foreground",g&&"shimmer"),children:g?"Thinking...":`Thought for ${u}s`})]})}),_&&m.jsx("div",{className:"ml-[6px] border-l-2 pl-4 mt-1 mb-2 max-h-[300px] overflow-y-auto",children:h.map((S,E)=>m.jsx("div",{className:"text-muted-foreground markdown-sm pb-2",children:m.jsx(xa,{id:`${i}-reasoning-${E}`,text:S.text})},`${i}-reasoning-${E}`))})]}),e[2]=i,e[3]=d,e[4]=o,e[5]=r,e[6]=u,e[7]=p}else p=e[7];return p}function e3(t){return t.state==="streaming"}function t3(t){return t.type==="reasoning"}function n3(t){const e=W.c(11),{part:n,id:r,usageStats:i,isFollowedByToolCall:a}=t;switch(n.type){case"dynamic-tool":{let s;return e[0]!==r||e[1]!==n?(s=m.jsx(cu,{part:n,id:r}),e[0]=r,e[1]=n,e[2]=s):s=e[2],s}case"text":{let s;return e[3]!==r||e[4]!==a||e[5]!==n||e[6]!==i?(s=m.jsx(lc,{id:r,part:n,extraActions:i,copyable:!0,hasToolCallAfter:a}),e[3]=r,e[4]=a,e[5]=n,e[6]=i,e[7]=s):s=e[7],s}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;default:if(n.type.startsWith("tool-")){const s=n;let u;return e[8]!==r||e[9]!==s?(u=m.jsx(cu,{part:s,id:r}),e[8]=r,e[9]=s,e[10]=u):u=e[10],u}}throw new Error(`Unknown part type: ${n.type}`)}function r3(t){const e=W.c(32),{message:n,status:r,className:i}=t,{id:a,parts:s}=n,l=r==="streaming"||r==="submitted",d=V.useRef(null);let f;e[0]!==a?(f=()=>{const $=localStorage.getItem(`msg-duration-${a}`);return $?Number($):null},e[0]=a,e[1]=f):f=e[1];const[p,h]=V.useState(f);let g,_;e[2]!==l?(g=()=>{l&&d.current===null&&(d.current=Date.now())},_=[l],e[2]=l,e[3]=g,e[4]=_):(g=e[3],_=e[4]),V.useEffect(g,_);let y,T;e[5]!==p||e[6]!==a||e[7]!==s.length?(y=()=>{if(s.length>0&&p===null&&d.current!==null){const $=Date.now()-d.current;h($),localStorage.setItem(`msg-duration-${a}`,$.toString())}},T=[s.length,p,a],e[5]=p,e[6]=a,e[7]=s.length,e[8]=y,e[9]=T):(y=e[8],T=e[9]),V.useEffect(y,T);const S=s.length>0;let E;e[10]!==s?(E=s.some(a3),e[10]=s,e[11]=E):E=e[11];const R=E;let O;e[12]!==l||e[13]!==s?(O=l&&s.some(i3),e[12]=l,e[13]=s,e[14]=O):O=e[14];const v=S&&(R||O)&&p!==null;let B;e[15]!==n?(B=m.jsx(Gx,{messages:[n]}),e[15]=n,e[16]=B):B=e[16];const z=B;let N;e[17]!==i?(N=ce("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]=N):N=e[18];let F;e[19]!==p||e[20]!==S||e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==v||e[25]!==z?(F=S?m.jsxs(m.Fragment,{children:[v&&m.jsx(Jx,{duration:p,parts:s,id:a}),s.map(($,H)=>{const Q=s[H+1],te=Q&&(Q.type==="dynamic-tool"||Q.type.startsWith("tool-"));return m.jsx(n3,{part:$,id:a,usageStats:H===s.length-1?z:void 0,isFollowedByToolCall:te},`${a}-${H}`)})]}):l?m.jsx(Kx,{}):null,e[19]=p,e[20]=S,e[21]=a,e[22]=l,e[23]=s,e[24]=v,e[25]=z,e[26]=F):F=e[26];let P;e[27]!==F?(P=m.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:m.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-sm wrap-break-word overflow-wrap-anywhere bg-transparent",children:F})}),e[27]=F,e[28]=P):P=e[28];let Z;return e[29]!==P||e[30]!==N?(Z=m.jsx("div",{className:N,children:P}),e[29]=P,e[30]=N,e[31]=Z):Z=e[31],Z}function i3(t){return t.type==="reasoning"&&t.state==="streaming"}function a3(t){return t.type==="reasoning"}const cc=V.createContext(null);function dc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=m.jsx(m.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function s3(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(!V.isValidElement(r))continue;if(r.props?.message?.role==="assistant"){const a=t[n-1],s=V.isValidElement(a)&&a.props?.message?.role,u=a&&V.isValidElement(a)&&s==="user"?a:null;e.push({user:u,assistant:r})}}return e}function u3(t){const e=W.c(27),{children:n,className:r,minHeightOffset:i}=t,a=V.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const u=V.useRef(s);let o,l,d,f,p,h,g;if(e[1]!==n||e[2]!==r||e[3]!==i){const S=V.Children.toArray(n),E=S[S.length-1];l=E&&V.isValidElement(E)&&E.type===dc?E:null;const R=l?S.slice(0,-1):S,O=s3(R);let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=B=>{const z=u.current[B];if(z&&a.current){const N=a.current.offsetTop,F=z.offsetTop;a.current.scrollTo({top:F-N,behavior:"smooth"})}},e[11]=I):I=e[11];const v=I;o=cc.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(g={scrollToPair:v},e[12]=g):g=e[12],p=a,e[13]!==r?(h=ce("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],d="flex flex-col min-w-0 max-w-2xl mx-auto w-full",f=O.map((B,z)=>{const N=z===O.length-1;return m.jsxs("div",{ref:F=>{u.current[z]=F},className:"flex flex-col pb-2",style:N&&i?{minHeight:`calc(100vh - ${i}px)`}:void 0,children:[m.jsx("div",{className:"sticky top-0 z-50 bg-background w-full h-4"}),m.jsx("div",{className:"sticky mb-3 top-4 z-50",children:B.user&&V.isValidElement(B.user)?V.cloneElement(B.user,{pairIndex:z}):B.user}),B.assistant]},z)}),e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=l,e[6]=d,e[7]=f,e[8]=p,e[9]=h,e[10]=g}else o=e[4],l=e[5],d=e[6],f=e[7],p=e[8],h=e[9],g=e[10];let _;e[15]!==l||e[16]!==d||e[17]!==f?(_=m.jsxs("div",{className:d,children:[f,l]}),e[15]=l,e[16]=d,e[17]=f,e[18]=_):_=e[18];let y;e[19]!==p||e[20]!==h||e[21]!==_?(y=m.jsx("div",{ref:p,className:h,children:_}),e[19]=p,e[20]=h,e[21]=_,e[22]=y):y=e[22];let T;return e[23]!==o||e[24]!==g||e[25]!==y?(T=m.jsx(o,{value:g,children:y}),e[23]=o,e[24]=g,e[25]=y,e[26]=T):T=e[26],T}function o3(t){const e=W.c(5),{locator:n}=St(),r=Du(),i=zi();let a;return e[0]!==n||e[1]!==r||e[2]!==t||e[3]!==i?(a=async(u,o,l)=>{const d=await Lu(n,l),f=d.findIndex(y=>y.id===u);if(f===-1){console.warn(`[branch] Message ${u} not found in thread ${l}`);return}const p=d.slice(0,f).filter(l3),h=crypto.randomUUID(),g=new Date().toISOString(),_={id:h,title:"",created_at:g,updated_at:g,hidden:!1};if(await i.insert.mutateAsync(_),p.length>0){const y=p.map(T=>({...T,id:crypto.randomUUID(),metadata:{...T.metadata,thread_id:h,created_at:T.metadata?.created_at||g}}));await r.insertMany.mutateAsync(y)}t(h)},e[0]=n,e[1]=r,e[2]=t,e[3]=i,e[4]=a):a=e[4],a}function l3(t){return t.role!=="system"}function c3(t){const e=W.c(18),{messageId:n,parts:r}=t,[i,a]=V.useState(!1),{setInputValue:s,startBranch:u,setActiveThreadId:o,activeThreadId:l}=hh(),d=o3(o);let f;e[0]!==r?(f=r.filter(f3).map(d3).join(`
98
98
  `),e[0]=r,e[1]=f):f=e[1];const p=f;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=I=>{I.stopPropagation(),a(!0)},e[2]=h):h=e[2];const g=h;let _;e[3]!==l||e[4]!==d||e[5]!==n||e[6]!==p||e[7]!==s||e[8]!==u?(_=async()=>{await d(n,p,l),s(p),u({originalThreadId:l,originalMessageId:n,originalMessageText:p}),a(!1)},e[3]=l,e[4]=d,e[5]=n,e[6]=p,e[7]=s,e[8]=u,e[9]=_):_=e[9];const y=_;let T;e[10]===Symbol.for("react.memo_cache_sentinel")?(T=m.jsx("div",{className:"flex justify-center items-end px-2 pb-1",children:m.jsxs(an,{children:[m.jsx(sn,{asChild:!0,children:m.jsx(Ye,{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:m.jsx(Cu,{size:16,className:"p-0.5"})})}),m.jsx(un,{side:"bottom",children:"Edit message"})]})}),e[10]=T):T=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=m.jsxs(Wc,{children:[m.jsx(Qc,{children:"Edit message?"}),m.jsx(Gc,{children:"This will create a new conversation branch from this point. The original conversation will remain unchanged."})]}),e[11]=S):S=e[11];let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=m.jsx(Xc,{children:"Cancel"}),e[12]=E):E=e[12];let R;e[13]!==y?(R=m.jsxs(Zc,{children:[S,m.jsxs(Kc,{children:[E,m.jsx(Jc,{onClick:y,children:"Confirm"})]})]}),e[13]=y,e[14]=R):R=e[14];let O;return e[15]!==i||e[16]!==R?(O=m.jsxs(m.Fragment,{children:[T,m.jsx(ed,{open:i,onOpenChange:a,children:R})]}),e[15]=i,e[16]=R,e[17]=O):O=e[17],O}function d3(t){return t.text}function f3(t){return t.type==="text"}function h3(t){const e=W.c(29),{message:n,className:r,pairIndex:i}=t,{id:a,parts:s}=n,u=V.useContext(cc),[o,l]=V.useState(!1);if(!s||s.length===0)return null;let d;e[0]!==u||e[1]!==i?(d=()=>{l(!0),i!==void 0&&u?.scrollToPair(i)},e[0]=u,e[1]=i,e[2]=d):d=e[2];const f=d;let p;e[3]!==r?(p=ce("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]=p):p=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 _=o?"overflow-auto opacity-100":"overflow-hidden opacity-99 mask-b-from-1%";let y;e[7]!==_?(y=ce("z-10 px-4 py-2 transition-opacity max-h-[120px] flex-1",_),e[7]=_,e[8]=y):y=e[8];let T;if(e[9]!==a||e[10]!==s){let v;e[12]!==a?(v=(B,z)=>B.type==="text"?m.jsx(lc,{id:a,part:B},`${a}-${z}`):null,e[12]=a,e[13]=v):v=e[13],T=s.map(v),e[9]=a,e[10]=s,e[11]=T}else T=e[11];let S;e[14]!==T?(S=m.jsx("div",{children:T}),e[14]=T,e[15]=S):S=e[15];let E;e[16]!==y||e[17]!==S?(E=m.jsx("div",{className:y,children:S}),e[16]=y,e[17]=S,e[18]=E):E=e[18];let R;e[19]!==a||e[20]!==s?(R=m.jsx(c3,{messageId:a,parts:s}),e[19]=a,e[20]=s,e[21]=R):R=e[21];let O;e[22]!==f||e[23]!==R||e[24]!==E?(O=m.jsxs("div",{tabIndex:0,onClick:f,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:[E,R]}),e[22]=f,e[23]=R,e[24]=E,e[25]=O):O=e[25];let I;return e[26]!==O||e[27]!==p?(I=m.jsx(m.Fragment,{children:m.jsx("div",{className:p,children:O})}),e[26]=O,e[27]=p,e[28]=I):I=e[28],I}function p3(t,e){const n=W.c(4);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const i=r,a=t??rd;let s;return n[2]!==a?(s=ad(a),n[2]=a,n[3]=s):s=n[3],id(a,"LLM",s,i)}function m3(){const t=W.c(8),e=sd();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=Dc(n),i=p3(r?.id);if(!i||!r){let s;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2],s}let a;if(t[3]!==r||t[4]!==i){let s;t[6]!==r?(s=u=>({...u,name:u.title,contextWindow:u.limits?.contextWindow,outputLimit:u.limits?.maxOutputTokens,inputCost:u.costs?.input,outputCost:u.costs?.output,provider:u.provider,connectionId:r.id,connectionName:r.title}),t[6]=r,t[7]=s):s=t[7],a=i.map(s).sort(g3),t[3]=r,t[4]=i,t[5]=a}else a=t[5];return a}function g3(t,e){return t.name.localeCompare(e.name)}const E3={reasoning:{icon:m.jsx(Cr,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:m.jsx(Iu,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:m.jsx(td,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:m.jsx(_u,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},fc=V.memo(function(e){const n=W.c(11),{capability:r}=e,i=E3[r];let a;n[0]!==r||n[1]!==i?(a=i||{icon:m.jsx(Jt,{className:"size-4"}),bg:"bg-slate-200",text:"text-slate-700",label:r},n[0]=r,n[1]=i,n[2]=a):a=n[2];const s=a,u=`flex items-center justify-center h-6 w-6 rounded-sm ${s.bg} ${s.text}`;let o;n[3]!==s.icon||n[4]!==u?(o=m.jsx(sn,{asChild:!0,children:m.jsx("div",{className:u,children:s.icon})}),n[3]=s.icon,n[4]=u,n[5]=o):o=n[5];let l;n[6]!==s.label?(l=m.jsx(un,{children:m.jsx("p",{children:s.label})}),n[6]=s.label,n[7]=l):l=n[7];let d;return n[8]!==o||n[9]!==l?(d=m.jsxs(an,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=d):d=n[10],d}),du=V.memo(function(e){const n=W.c(54),{model:r,compact:i}=e,a=i===void 0?!1:i;if(!r){let T;return n[0]===Symbol.for("react.memo_cache_sentinel")?(T=m.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 s=r.contextWindow||r.inputCost||r.outputCost||r.outputLimit;if(!s&&!a){let T;n[1]!==r.logo||n[2]!==r.name?(T=r.logo&&m.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 S;n[4]!==r.name?(S=m.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[4]=r.name,n[5]=S):S=n[5];let E;n[6]!==T||n[7]!==S?(E=m.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[T,S]}),n[6]=T,n[7]=S,n[8]=E):E=n[8];let R;n[9]!==r.description?(R=r.description&&m.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),n[9]=r.description,n[10]=R):R=n[10];let O;return n[11]!==E||n[12]!==R?(O=m.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[E,R]}),n[11]=E,n[12]=R,n[13]=O):O=n[13],O}if(!s&&a)return null;if(a){let T;n[14]!==r.contextWindow?(T=r.contextWindow&&m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"Context"}),m.jsxs("span",{className:"text-foreground font-medium",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[14]=r.contextWindow,n[15]=T):T=n[15];let S;n[16]!==r.inputCost?(S=r.inputCost&&m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),m.jsxs("span",{className:"text-foreground font-medium",children:["$",r.inputCost.toFixed(2)," / 1M"]})]}),n[16]=r.inputCost,n[17]=S):S=n[17];let E;n[18]!==r.outputCost?(E=r.outputCost&&m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),m.jsxs("span",{className:"text-foreground font-medium",children:["$",r.outputCost.toFixed(2)," / 1M"]})]}),n[18]=r.outputCost,n[19]=E):E=n[19];let R;n[20]!==r.outputLimit?(R=r.outputLimit&&m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),m.jsxs("span",{className:"text-foreground font-medium",children:[r.outputLimit.toLocaleString()," tokens"]})]}),n[20]=r.outputLimit,n[21]=R):R=n[21];let O;return n[22]!==T||n[23]!==S||n[24]!==E||n[25]!==R?(O=m.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[T,S,E,R]}),n[22]=T,n[23]=S,n[24]=E,n[25]=R,n[26]=O):O=n[26],O}let u;n[27]!==r.logo||n[28]!==r.name?(u=r.logo&&m.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=m.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=m.jsxs("div",{className:"flex items-center gap-3",children:[u,o]}),n[32]=u,n[33]=o,n[34]=l):l=n[34];let d;n[35]!==r.capabilities?(d=r.capabilities&&r.capabilities.length>0&&m.jsx("div",{className:"flex items-center gap-2",children:r.capabilities.map(x3)}),n[35]=r.capabilities,n[36]=d):d=n[36];let f;n[37]!==l||n[38]!==d?(f=m.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[l,d]}),n[37]=l,n[38]=d,n[39]=f):f=n[39];let p;n[40]!==r.contextWindow?(p=r.contextWindow&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Bc,{className:"w-3.5 h-3.5 text-muted-foreground"}),m.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),m.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[40]=r.contextWindow,n[41]=p):p=n[41];let h;n[42]!==r.inputCost||n[43]!==r.outputCost?(h=(r.inputCost||r.outputCost)&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(ku,{className:"w-3.5 h-3.5 text-muted-foreground"}),m.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),m.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.inputCost!==null&&r.inputCost!==void 0&&m.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.inputCost.toFixed(2)," / 1M tokens (input)"]}),r.outputCost!==null&&r.outputCost!==void 0&&m.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&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Nu,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),m.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),m.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 _;n[47]!==p||n[48]!==h||n[49]!==g?(_=m.jsxs("div",{className:"flex flex-col gap-4",children:[p,h,g]}),n[47]=p,n[48]=h,n[49]=g,n[50]=_):_=n[50];let y;return n[51]!==_||n[52]!==f?(y=m.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[f,_]}),n[51]=_,n[52]=f,n[53]=y):y=n[53],y}),b3=V.memo(function(e){const n=W.c(27),{model:r,onHover:i,isSelected:a,hasExpandedInfo:s}=e,u=s?"rounded-t-lg":"rounded-lg";let o;n[0]!==u?(o=ce("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 d;n[5]!==r.logo||n[6]!==r.name?(d=r.logo&&m.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]=d):d=n[7];let f;n[8]!==r.name?(f=m.jsx("span",{className:"text-sm text-foreground",children:r.name}),n[8]=r.name,n[9]=f):f=n[9];let p;n[10]!==s||n[11]!==r.capabilities?(p=s&&r.capabilities&&r.capabilities.length>0&&m.jsx("div",{className:"md:hidden flex items-center gap-1.5 ml-auto",children:r.capabilities.map(_3)}),n[10]=s,n[11]=r.capabilities,n[12]=p):p=n[12];let h;n[13]!==s||n[14]!==a?(h=a&&!s&&m.jsx(Jt,{className:"w-4 h-4 text-foreground ml-auto"}),n[13]=s,n[14]=a,n[15]=h):h=n[15];let g;n[16]!==s||n[17]!==a?(g=a&&s&&m.jsx(Jt,{className:"w-4 h-4 text-foreground ml-2 shrink-0"}),n[16]=s,n[17]=a,n[18]=g):g=n[18];let _;return n[19]!==o||n[20]!==l||n[21]!==d||n[22]!==f||n[23]!==p||n[24]!==h||n[25]!==g?(_=m.jsxs("div",{className:o,onMouseEnter:l,children:[d,f,p,h,g]}),n[19]=o,n[20]=l,n[21]=d,n[22]=f,n[23]=p,n[24]=h,n[25]=g,n[26]=_):_=n[26],_});function T3(t){const e=W.c(9),{model:n}=t;if(!n){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("span",{className:"text-sm text-muted-foreground",children:"Select model"}),e[0]=s):s=e[0],s}let r;e[1]!==n.logo||e[2]!==n.name?(r=n.logo&&m.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=m.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 a;return e[6]!==r||e[7]!==i?(a=m.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]=a):a=e[8],a}function c_(t){const e=W.c(57),{selectedModel:n,onModelChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"borderless":i,o=s===void 0?"Select model":s,[l,d]=V.useState(!1),[f,p]=V.useState(null),[h,g]=V.useState(!1),_=m3();let y;e[0]!==_||e[1]!==n?(y=n?_.find(le=>le.id===n.id&&le.connectionId===n.connectionId)?.id:void 0,e[0]=_,e[1]=n,e[2]=y):y=e[2];const T=y;let S;if(e[3]!==_||e[4]!==T){let le;e[6]!==T?(le=de=>de.id===T,e[6]=T,e[7]=le):le=e[7],S=_.find(le),e[3]=_,e[4]=T,e[5]=S}else S=e[5];const E=S;let R;e[8]!==_||e[9]!==r?(R=le=>{const de=_.find(_e=>_e.id===le);de&&(r({id:de.id,connectionId:de.connectionId,provider:de.provider??void 0}),d(!1))},e[8]=_,e[9]=r,e[10]=R):R=e[10];const O=R;if(_.length===0)return null;const I=T||"",v=u==="borderless"&&"md:border-none";let B;e[11]!==a||e[12]!==v?(B=ce("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",v,a),e[11]=a,e[12]=v,e[13]=B):B=e[13];let z;e[14]!==E?(z=m.jsx(T3,{model:E}),e[14]=E,e[15]=z):z=e[15];let N;e[16]!==o||e[17]!==z?(N=m.jsx(Uc,{placeholder:o,className:"min-w-0 max-w-full",children:z}),e[16]=o,e[17]=z,e[18]=N):N=e[18];let F;e[19]!==N||e[20]!==B?(F=m.jsx(Hc,{size:"sm",className:B,children:N}),e[19]=N,e[20]=B,e[21]=F):F=e[21];let P;e[22]!==h?(P=()=>g(!h),e[22]=h,e[23]=P):P=e[23];const Z=h?"text-foreground":"text-muted-foreground";let $;e[24]!==Z?($=ce("w-5 h-5 transition-colors",Z),e[24]=Z,e[25]=$):$=e[25];let H;e[26]!==$?(H=m.jsx(nd,{className:$}),e[26]=$,e[27]=H):H=e[27];let Q;e[28]!==P||e[29]!==H?(Q=m.jsx("button",{type:"button",onClick:P,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:H}),e[28]=P,e[29]=H,e[30]=Q):Q=e[30];let te;if(e[31]!==O||e[32]!==_||e[33]!==T||e[34]!==h){let le;e[36]!==O||e[37]!==T||e[38]!==h?(le=de=>m.jsxs("div",{onClick:()=>O(de.id),className:ce("rounded-lg mb-1",de.id===T&&"bg-accent"),children:[m.jsx(b3,{model:de,onHover:p,isSelected:de.id===T,hasExpandedInfo:h}),h&&m.jsx("div",{className:"md:hidden",children:m.jsx(du,{model:de,compact:!0})})]},de.id),e[36]=O,e[37]=T,e[38]=h,e[39]=le):le=e[39],te=_.map(le),e[31]=O,e[32]=_,e[33]=T,e[34]=h,e[35]=te}else te=e[35];let K;e[40]!==te?(K=m.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 md:border-r",children:te}),e[40]=te,e[41]=K):K=e[41];const ge=f||E||null;let k;e[42]!==ge?(k=m.jsx("div",{className:"hidden md:block md:w-[300px] p-3",children:m.jsx(du,{model:ge})}),e[42]=ge,e[43]=k):k=e[43];let ae;e[44]!==K||e[45]!==k?(ae=m.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[K,k]}),e[44]=K,e[45]=k,e[46]=ae):ae=e[46];let me;e[47]!==o||e[48]!==Q||e[49]!==ae?(me=m.jsx(jc,{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:Q,children:ae}),e[47]=o,e[48]=Q,e[49]=ae,e[50]=me):me=e[50];let C;return e[51]!==O||e[52]!==l||e[53]!==F||e[54]!==me||e[55]!==I?(C=m.jsxs(zc,{open:l,onOpenChange:d,value:I,onValueChange:O,children:[F,me]}),e[51]=O,e[52]=l,e[53]=F,e[54]=me,e[55]=I,e[56]=C):C=e[56],C}function x3(t){return m.jsx(fc,{capability:t},t)}function _3(t){return m.jsx(fc,{capability:t},t)}function y3({messageCount:t,sentinelRef:e}){const n=V.useRef(t),r=V.useRef(0);t>n.current&&r.current!==t&&queueMicrotask(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"start"}),r.current=t}),n.current=t}function fu(t,e){const n=V.Children.toArray(t);for(const r of n)if(V.isValidElement(r)&&r.type===e)return r;return null}function A3(t){const e=W.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=ce("flex flex-col h-full w-full bg-sidebar transform-[translateZ(0)]",n),e[0]=n,e[1]=i):i=e[1];let a;return e[2]!==r||e[3]!==i?(a=m.jsx("div",{className:i,children:r}),e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function k3(t){const e=W.c(11),{children:n}=t;let r;e[0]!==n?(r=fu(n,hc),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==n?(a=fu(n,pc),e[2]=n,e[3]=a):a=e[3];const s=a,u=i?.props.children;let o;e[4]!==u?(o=m.jsx("div",{className:"flex items-center gap-2",children:u}),e[4]=u,e[5]=o):o=e[5];const l=s?.props.children;let d;e[6]!==l?(d=m.jsx("div",{className:"flex items-center gap-1",children:l}),e[6]=l,e[7]=d):d=e[7];let f;return e[8]!==o||e[9]!==d?(f=m.jsxs("div",{className:"flex h-12 items-center justify-between border-b border-border px-4 flex-none",children:[o,d]}),e[8]=o,e[9]=d,e[10]=f):f=e[10],f}function hc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=m.jsx(m.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function pc(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=m.jsx(m.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function C3(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=ce("flex-1 min-h-0 overflow-y-auto",r),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=m.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function I3(t){const e=W.c(2),{children:n}=t;let r;return e[0]!==n?(r=m.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 S3(t){const e=W.c(12),{messages:n,status:r,minHeightOffset:i}=t,a=i===void 0?240:i,s=V.useRef(null);let u;e[0]!==n.length?(u={messageCount:n.length,sentinelRef:s},e[0]=n.length,e[1]=u):u=e[1],y3(u);let o;if(e[2]!==n||e[3]!==r){let f;e[5]!==n.length||e[6]!==r?(f=(p,h)=>p.role==="user"?m.jsx(h3,{message:p},p.id):p.role==="assistant"?m.jsx(r3,{message:p,status:h===n.length-1?r:void 0},p.id):null,e[5]=n.length,e[6]=r,e[7]=f):f=e[7],o=n.map(f),e[2]=n,e[3]=r,e[4]=o}else o=e[4];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=m.jsx(dc,{children:m.jsx("div",{ref:s,className:"h-0"})}),e[8]=l):l=e[8];let d;return e[9]!==a||e[10]!==o?(d=m.jsxs(u3,{minHeightOffset:a,children:[o,l]}),e[9]=a,e[10]=o,e[11]=d):d=e[11],d}function N3(t){const e=W.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=ce("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 a;return e[2]!==n||e[3]!==i?(a=m.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function _a(t){const e=W.c(24),{title:n,description:r,icon:i,variant:a,onDismiss:s,children:u}=t,o=a===void 0?"default":a;let l,d,f,p,h;if(e[0]!==u||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==o){const E={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];p=ce("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full",E.container),h=i&&m.jsx("div",{className:ce("mt-0.5 shrink-0",E.icon),children:i}),l="flex-1 min-w-0",d=n&&m.jsx("div",{className:ce("text-xs mb-1",E.title),children:n}),f=r&&m.jsx("div",{className:ce("text-xs line-clamp-2",E.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]=d,e[7]=f,e[8]=p,e[9]=h}else l=e[5],d=e[6],f=e[7],p=e[8],h=e[9];let g;e[10]!==u?(g=u&&m.jsx("div",{className:"flex gap-2",children:u}),e[10]=u,e[11]=g):g=e[11];let _;e[12]!==l||e[13]!==d||e[14]!==f||e[15]!==g?(_=m.jsxs("div",{className:l,children:[d,f,g]}),e[12]=l,e[13]=d,e[14]=f,e[15]=g,e[16]=_):_=e[16];let y;e[17]!==s?(y=s&&m.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:m.jsx(Pc,{size:14})}),e[17]=s,e[18]=y):y=e[18];let T;return e[19]!==p||e[20]!==h||e[21]!==_||e[22]!==y?(T=m.jsxs("div",{className:p,children:[h,_,y]}),e[19]=p,e[20]=h,e[21]=_,e[22]=y,e[23]=T):T=e[23],T}function w3(t){const e=W.c(10),{branchContext:n,clearBranchContext:r,onGoToOriginalMessage:i,setInputValue:a}=t;if(!n)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx(Au,{size:14}),e[0]=s):s=e[0];let u;e[1]!==r||e[2]!==a?(u=()=>{r(),a("")},e[1]=r,e[2]=a,e[3]=u):u=e[3];let o;e[4]!==i?(o=m.jsx(Ye,{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=m.jsx(_a,{variant:"default",title:"Editing message (click to view original)",description:n.originalMessageText,icon:s,onDismiss:u,children:o}),e[6]=n.originalMessageText,e[7]=u,e[8]=o,e[9]=l):l=e[9],l}function R3(t){const e=W.c(8),{error:n,onFixInChat:r,onDismiss:i}=t;if(!n)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx(bu,{size:16}),e[0]=a):a=e[0];let s;e[1]!==r?(s=m.jsx(Ye,{size:"sm",variant:"outline",onClick:r,className:"h-7 text-xs",children:"Fix in chat"}),e[1]=r,e[2]=s):s=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx(Ye,{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]!==s?(o=m.jsxs(_a,{variant:"danger",title:"Error occurred",description:n.message,icon:a,onDismiss:i,children:[s,u]}),e[4]=n.message,e[5]=i,e[6]=s,e[7]=o):o=e[7],o}function O3(t){const e=W.c(7),{finishReason:n,onContinue:r,onDismiss:i}=t;if(!n||n==="stop")return null;const s=L3(n);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx(vc,{size:16}),e[0]=u):u=e[0];let o;e[1]!==r?(o=m.jsx(Ye,{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]!==s||e[5]!==o?(l=m.jsx(_a,{variant:"warning",title:"Response incomplete",description:s,icon:u,onDismiss:i,children:o}),e[3]=i,e[4]=s,e[5]=o,e[6]=l):l=e[6],l}function L3(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 d_=Object.assign(A3,{Header:Object.assign(k3,{Left:hc,Right:pc}),Main:C3,Messages:S3,EmptyState:I3,Footer:N3,Input:bh,BranchPreview:w3,ErrorBanner:R3,FinishReasonWarning:O3,Provider:dh});function f_({title:t="No model provider connected",description:e="Connect to a model provider to unlock AI-powered features.",orgSlug:n,orgId:r,userId:i,allConnections:a,onInstallMcpServer:s}){const[u,o]=V.useState(!1),l=ud(),d=Oc(),f=async()=>{if(!r||!i){di.error("Not authenticated");return}o(!0);try{const p=a?.find(_=>_.connection_url===cd);if(p){d({to:"/$org/mcps/$connectionId",params:{org:n,connectionId:p.id}});return}const h=dd({id:fd("conn")}),g=await l.create.mutateAsync(h);d({to:"/$org/mcps/$connectionId",params:{org:n,connectionId:g.id}})}catch(p){di.error(`Failed to connect OpenRouter: ${p instanceof Error?p.message:String(p)}`)}finally{o(!1)}};return m.jsx(od,{image:m.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),title:t,description:e,actions:m.jsxs(m.Fragment,{children:[m.jsxs(Ye,{variant:"outline",onClick:f,disabled:u,children:[m.jsx("img",{src:ld,alt:"OpenRouter",className:"size-4"}),u?"Installing...":"Install OpenRouter"]}),m.jsx(Ye,{variant:"outline",onClick:s,children:"Install Connection"})]})})}function D3(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5);return i<1?"now":i<60?`${i}m`:`${a}h`}function v3(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(n.getTime()-864e5),i=new Date(n.getTime()-7*864e5),a=new Date(n.getTime()-30*864e5),s=[],u=[],o=[],l=[],d=[];for(const p of t){const h=new Date(p.updated_at);h>=n?s.push(p):h>=r?u.push(p):h>=i?o.push(p):h>=a?l.push(p):d.push(p)}const f=[];return s.length>0&&f.push({label:"Today",threads:s,showRelativeTime:!0}),u.length>0&&f.push({label:"Yesterday",threads:u,showRelativeTime:!1}),o.length>0&&f.push({label:"7 days ago",threads:o,showRelativeTime:!1}),l.length>0&&f.push({label:"30 days ago",threads:l,showRelativeTime:!1}),d.length>0&&f.push({label:"Older",threads:d,showRelativeTime:!1}),f}function h_(t){const e=W.c(49),{threads:n,activeThreadId:r,onSelectThread:i,onRemoveThread:a,onOpen:s,variant:u}=t,o=u===void 0?"icon":u,[l,d]=V.useState("");let f,p,h,g,_,y,T,S,E,R,O,I;if(e[0]!==r||e[1]!==s||e[2]!==a||e[3]!==i||e[4]!==l||e[5]!==n||e[6]!==o){const P=l.trim()?n.filter(K=>(K.title||"New chat").toLowerCase().includes(l.toLowerCase())):n,Z=v3(P);let $;e[19]!==s?($=K=>{K?s?.():d("")},e[19]=s,e[20]=$):$=e[20];const H=$;g=pu,h=an,p=mu,R=H,e[21]!==o?(O=m.jsx(sn,{asChild:!0,children:m.jsx(gu,{asChild:!0,children:o==="outline"?m.jsx(Ye,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:m.jsx(Sa,{size:16})}):m.jsx(Ye,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:m.jsx(Sa,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[21]=o,e[22]=O):O=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(I=m.jsx(un,{children:"Chat history"}),e[23]=I):I=e[23],f=Eu,T="end",S="w-80 p-0";let Q;e[24]===Symbol.for("react.memo_cache_sentinel")?(Q=m.jsx(_u,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=Q):Q=e[24];let te;e[25]===Symbol.for("react.memo_cache_sentinel")?(te=K=>d(K.target.value),e[25]=te):te=e[25],e[26]!==l?(E=m.jsx("div",{className:"border-b",children:m.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[Q,m.jsx("input",{type:"text",placeholder:"Search chats...",value:l,onChange:te,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[26]=l,e[27]=E):E=e[27],_="max-h-[300px] overflow-y-auto",y=P.length===0?m.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:l.trim()?"No chats found":"No chats yet"}):Z.map((K,ge)=>m.jsxs("div",{children:[ge>0&&m.jsx("div",{className:"border-t mx-3"}),m.jsx("div",{className:"px-3 py-1",children:m.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:K.label})}),K.threads.map(k=>{const ae=k.id===r;return m.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${ae?"bg-accent/50":""}`,onClick:()=>i(k.id),children:[m.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[m.jsx("span",{className:"text-sm truncate",children:k.title||"New chat"}),m.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:ae?"current":K.showRelativeTime?D3(k.updated_at):null})]}),m.jsx("button",{type:"button",onClick:me=>{me.stopPropagation(),a(k.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:m.jsx(hd,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},k.id)})]},K.label)),e[0]=r,e[1]=s,e[2]=a,e[3]=i,e[4]=l,e[5]=n,e[6]=o,e[7]=f,e[8]=p,e[9]=h,e[10]=g,e[11]=_,e[12]=y,e[13]=T,e[14]=S,e[15]=E,e[16]=R,e[17]=O,e[18]=I}else f=e[7],p=e[8],h=e[9],g=e[10],_=e[11],y=e[12],T=e[13],S=e[14],E=e[15],R=e[16],O=e[17],I=e[18];let v;e[28]!==_||e[29]!==y?(v=m.jsx("div",{className:_,children:y}),e[28]=_,e[29]=y,e[30]=v):v=e[30];let B;e[31]!==f||e[32]!==v||e[33]!==T||e[34]!==S||e[35]!==E?(B=m.jsxs(f,{align:T,className:S,children:[E,v]}),e[31]=f,e[32]=v,e[33]=T,e[34]=S,e[35]=E,e[36]=B):B=e[36];let z;e[37]!==p||e[38]!==B||e[39]!==R||e[40]!==O||e[41]!==I?(z=m.jsxs(p,{onOpenChange:R,children:[O,I,B]}),e[37]=p,e[38]=B,e[39]=R,e[40]=O,e[41]=I,e[42]=z):z=e[42];let N;e[43]!==h||e[44]!==z?(N=m.jsx(h,{children:z}),e[43]=h,e[44]=z,e[45]=N):N=e[45];let F;return e[46]!==g||e[47]!==N?(F=m.jsx(g,{children:N}),e[46]=g,e[47]=N,e[48]=F):F=e[48],F}export{d_ as C,i_ as D,l_ as G,c_ as M,f_ as N,h_ as T,Gx as U,a_ as a,m3 as b,s_ as c,o_ as d,dh as e,bh as f,hh as u};
@@ -1 +1 @@
1
- import{K as B,j as t,c as O,h as Q,r as k}from"./index-JM_K-0vS.js";import{u as U}from"./useQuery-CVizz7NG.js";import{i as W}from"./File06-BJJWTDds.js";import{i as Y}from"./Loading01-BJF4I2Ad.js";import{e as J}from"./github-icon-BrF3LMLL.js";import{C as P}from"./collection-display-button-DEihXWWS.js";import{C as X}from"./collection-search-078Tk8ke.js";import{C as Z}from"./collection-table-wrapper-s0V0lVte.js";import{E as z,I as ee}from"./use-connection-BLmwBfcI.js";import{C as te}from"./card-DlmzE0V_.js";import{V as se}from"./layout-Mi4JIpR6.js";function oe(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function re(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,i)=>i.includes("target=")?e.replace(/target="[^"]*"/gi,'target="_blank"'):`<a ${i} target="_blank" rel="noopener noreferrer">`)}function ne(s){let e=oe(s);return e=re(e),e}function we({repository:s}){const e=s?J(s):null,{data:i,isLoading:c}=U({queryKey:B.githubReadme(e?.owner,e?.repo),queryFn:async()=>{if(!e)return null;try{const l=await fetch(`https://api.github.com/repos/${e.owner}/${e.repo}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!l.ok){if(l.status===404)return null;throw new Error(`Failed to fetch README: ${l.statusText}`)}const m=await l.text();return ne(m)}catch(l){return console.error("Error fetching README:",l),null}},enabled:!!e&&!!s,staleTime:3600*1e3,gcTime:1440*60*1e3});return c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}):i?t.jsx("div",{className:"p-5 markdown-body",style:{backgroundColor:"transparent"},dangerouslySetInnerHTML:{__html:i}}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(W,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]})}function ve(s){const e=O.c(39),{tools:i,connectionId:c,org:l,onToolClick:m,showToolbar:L,emptyMessage:M}=s,D=L===void 0?!0:L,j=M===void 0?"This connection doesn't have any tools yet.":M,I=Q(),[n,$]=k.useState(""),[d,H]=k.useState("table"),[r,A]=k.useState("name"),[a,_]=k.useState("asc");let y;e[0]!==a||e[1]!==r?(y=o=>{r===o?(_(me),a==="desc"&&A(void 0)):(A(o),_("asc"))},e[0]=a,e[1]=r,e[2]=y):y=e[2];const u=y;let N;e[3]!==c||e[4]!==I||e[5]!==m||e[6]!==l?(N=o=>{m?m(o):c&&l&&I({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:l,connectionId:c,collectionName:"tools",itemId:encodeURIComponent(o.name)}})},e[3]=c,e[4]=I,e[5]=m,e[6]=l,e[7]=N):N=e[7];const w=N;let v;if(e[8]!==n||e[9]!==a||e[10]!==r||e[11]!==i){const o=!i||i.length===0?[]:n.trim()?(()=>{const R=n.toLowerCase();return i.filter(b=>b.name.toLowerCase().includes(R)||b.description&&b.description.toLowerCase().includes(R))})():i;v=!r||!a?o:[...o].sort((R,b)=>{const q=R[r]||"",G=b[r]||"",K=String(q).localeCompare(String(G));return a==="asc"?K:-K}),e[8]=n,e[9]=a,e[10]=r,e[11]=i,e[12]=v}else v=e[12];const g=v;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=[{id:"name",header:"Name",render:ce,sortable:!0},{id:"description",header:"Description",render:le,cellClassName:"flex-1",sortable:!0}],e[13]=C):C=e[13];const V=C;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=V.filter(ie).map(ae),e[14]=S):S=e[14];const F=S;let f;e[15]!==u||e[16]!==D||e[17]!==a||e[18]!==r||e[19]!==d?(f=D&&t.jsx(se,{children:t.jsx(P,{viewMode:d,onViewModeChange:H,sortKey:r,sortDirection:a,onSort:u,sortOptions:F})}),e[15]=u,e[16]=D,e[17]=a,e[18]=r,e[19]=d,e[20]=f):f=e[20];let E;e[21]===Symbol.for("react.memo_cache_sentinel")?(E=o=>{o.key==="Escape"&&($(""),o.target.blur())},e[21]=E):E=e[21];let p;e[22]!==n?(p=t.jsx(X,{value:n,onChange:$,placeholder:"Search tools...",onKeyDown:E}),e[22]=n,e[23]=p):p=e[23];let h;e[24]!==j||e[25]!==u||e[26]!==w||e[27]!==n||e[28]!==a||e[29]!==r||e[30]!==g||e[31]!==d?(h=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.length===0?t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:g.map(o=>t.jsx(te,{className:"cursor-pointer transition-colors",onClick:()=>w(o),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ee,{icon:null,name:o.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:o.description||"No description"})]})]})},o.name))})}):t.jsx(Z,{columns:V,data:g,isLoading:!1,sortKey:r,sortDirection:a,onSort:u,onRowClick:o=>w(o),emptyState:t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j})}),e[24]=j,e[25]=u,e[26]=w,e[27]=n,e[28]=a,e[29]=r,e[30]=g,e[31]=d,e[32]=h):h=e[32];let x;e[33]!==p||e[34]!==h?(x=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p,h]}),e[33]=p,e[34]=h,e[35]=x):x=e[35];let T;return e[36]!==x||e[37]!==f?(T=t.jsxs(t.Fragment,{children:[f,x]}),e[36]=x,e[37]=f,e[38]=T):T=e[38],T}function ae(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function ie(s){return s.sortable}function le(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ce(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function me(s){return s==="asc"?"desc":s==="desc"?null:"asc"}export{we as R,ve as T};
1
+ import{K as B,j as t,c as O,h as Q,r as k}from"./index-DKhlCI_x.js";import{u as U}from"./useQuery-BcmdVjIq.js";import{i as W}from"./File06-AZUmgwwB.js";import{i as Y}from"./Loading01-ol6YE3uU.js";import{e as J}from"./github-icon-BrF3LMLL.js";import{C as P}from"./collection-display-button-Bg2te3H-.js";import{C as X}from"./collection-search-D_WbnaGd.js";import{C as Z}from"./collection-table-wrapper-BziKCd5v.js";import{E as z,I as ee}from"./use-connection-BijkkxIc.js";import{C as te}from"./card-Bm3Srv__.js";import{V as se}from"./layout-IbRPe8u0.js";function oe(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function re(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,i)=>i.includes("target=")?e.replace(/target="[^"]*"/gi,'target="_blank"'):`<a ${i} target="_blank" rel="noopener noreferrer">`)}function ne(s){let e=oe(s);return e=re(e),e}function we({repository:s}){const e=s?J(s):null,{data:i,isLoading:c}=U({queryKey:B.githubReadme(e?.owner,e?.repo),queryFn:async()=>{if(!e)return null;try{const l=await fetch(`https://api.github.com/repos/${e.owner}/${e.repo}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!l.ok){if(l.status===404)return null;throw new Error(`Failed to fetch README: ${l.statusText}`)}const m=await l.text();return ne(m)}catch(l){return console.error("Error fetching README:",l),null}},enabled:!!e&&!!s,staleTime:3600*1e3,gcTime:1440*60*1e3});return c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}):i?t.jsx("div",{className:"p-5 markdown-body",style:{backgroundColor:"transparent"},dangerouslySetInnerHTML:{__html:i}}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(W,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]})}function ve(s){const e=O.c(39),{tools:i,connectionId:c,org:l,onToolClick:m,showToolbar:L,emptyMessage:M}=s,D=L===void 0?!0:L,j=M===void 0?"This connection doesn't have any tools yet.":M,I=Q(),[n,$]=k.useState(""),[d,H]=k.useState("table"),[r,A]=k.useState("name"),[a,_]=k.useState("asc");let y;e[0]!==a||e[1]!==r?(y=o=>{r===o?(_(me),a==="desc"&&A(void 0)):(A(o),_("asc"))},e[0]=a,e[1]=r,e[2]=y):y=e[2];const u=y;let N;e[3]!==c||e[4]!==I||e[5]!==m||e[6]!==l?(N=o=>{m?m(o):c&&l&&I({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:l,connectionId:c,collectionName:"tools",itemId:encodeURIComponent(o.name)}})},e[3]=c,e[4]=I,e[5]=m,e[6]=l,e[7]=N):N=e[7];const w=N;let v;if(e[8]!==n||e[9]!==a||e[10]!==r||e[11]!==i){const o=!i||i.length===0?[]:n.trim()?(()=>{const R=n.toLowerCase();return i.filter(b=>b.name.toLowerCase().includes(R)||b.description&&b.description.toLowerCase().includes(R))})():i;v=!r||!a?o:[...o].sort((R,b)=>{const q=R[r]||"",G=b[r]||"",K=String(q).localeCompare(String(G));return a==="asc"?K:-K}),e[8]=n,e[9]=a,e[10]=r,e[11]=i,e[12]=v}else v=e[12];const g=v;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=[{id:"name",header:"Name",render:ce,sortable:!0},{id:"description",header:"Description",render:le,cellClassName:"flex-1",sortable:!0}],e[13]=C):C=e[13];const V=C;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=V.filter(ie).map(ae),e[14]=S):S=e[14];const F=S;let f;e[15]!==u||e[16]!==D||e[17]!==a||e[18]!==r||e[19]!==d?(f=D&&t.jsx(se,{children:t.jsx(P,{viewMode:d,onViewModeChange:H,sortKey:r,sortDirection:a,onSort:u,sortOptions:F})}),e[15]=u,e[16]=D,e[17]=a,e[18]=r,e[19]=d,e[20]=f):f=e[20];let E;e[21]===Symbol.for("react.memo_cache_sentinel")?(E=o=>{o.key==="Escape"&&($(""),o.target.blur())},e[21]=E):E=e[21];let p;e[22]!==n?(p=t.jsx(X,{value:n,onChange:$,placeholder:"Search tools...",onKeyDown:E}),e[22]=n,e[23]=p):p=e[23];let h;e[24]!==j||e[25]!==u||e[26]!==w||e[27]!==n||e[28]!==a||e[29]!==r||e[30]!==g||e[31]!==d?(h=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.length===0?t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:g.map(o=>t.jsx(te,{className:"cursor-pointer transition-colors",onClick:()=>w(o),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ee,{icon:null,name:o.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:o.description||"No description"})]})]})},o.name))})}):t.jsx(Z,{columns:V,data:g,isLoading:!1,sortKey:r,sortDirection:a,onSort:u,onRowClick:o=>w(o),emptyState:t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j})}),e[24]=j,e[25]=u,e[26]=w,e[27]=n,e[28]=a,e[29]=r,e[30]=g,e[31]=d,e[32]=h):h=e[32];let x;e[33]!==p||e[34]!==h?(x=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p,h]}),e[33]=p,e[34]=h,e[35]=x):x=e[35];let T;return e[36]!==x||e[37]!==f?(T=t.jsxs(t.Fragment,{children:[f,x]}),e[36]=x,e[37]=f,e[38]=T):T=e[38],T}function ae(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function ie(s){return s.sortable}function le(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ce(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function me(s){return s==="asc"?"desc":s==="desc"?null:"asc"}export{we as R,ve as T};