@decocms/mesh 1.9.0 → 1.10.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 (111) hide show
  1. package/dist/client/assets/{AlertCircle-BrGqb-qb.js → AlertCircle-DxJIdkjA.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-B6h573ak.js → ArrowLeft-CrgZDDUZ.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-BuogCeI0.js → ChevronDown-B2VaHCqC.js} +1 -1
  4. package/dist/client/assets/{Clock-LzAlJ-1R.js → Clock-CafJ8d76.js} +1 -1
  5. package/dist/client/assets/{Code01-Wll8WS4F.js → Code01-BHMAmoGH.js} +1 -1
  6. package/dist/client/assets/{Copy01-_s71W2Ph.js → Copy01-DfnjsOeR.js} +1 -1
  7. package/dist/client/assets/{CpuChip02-BwTl0fBj.js → CpuChip02-qVpLCR0_.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-BQk5hPxb.js → DotsVertical-DIWcHGKr.js} +1 -1
  9. package/dist/client/assets/{File06-CpSSTggW.js → File06-DSeIH9xM.js} +1 -1
  10. package/dist/client/assets/{FlipBackward-C0O2fx27.js → FlipBackward-s0RSv_vj.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-DjmPf135.js → GitBranch01-CeFBxnqq.js} +1 -1
  12. package/dist/client/assets/{Grid01-CmB5R6oU.js → Grid01-Ch9rI6P9.js} +1 -1
  13. package/dist/client/assets/{Inbox01-Ct-8Lwpv.js → Inbox01-7z9hTUsw.js} +1 -1
  14. package/dist/client/assets/{InfoCircle-D6JXYJn_.js → InfoCircle-DQaxWpv9.js} +1 -1
  15. package/dist/client/assets/{Key01-ZVAVplBN.js → Key01-CH9qCC00.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DfHTXuZ9.js → LinkExternal01-DZDUBWQO.js} +1 -1
  17. package/dist/client/assets/{Loading01-0wYmSKV6.js → Loading01-B0dLQInZ.js} +1 -1
  18. package/dist/client/assets/{Lock01-D5nrmOSx.js → Lock01-wpG8qO-9.js} +1 -1
  19. package/dist/client/assets/{Play-BedrzKsi.js → Play-DSXQEflq.js} +1 -1
  20. package/dist/client/assets/{Plus-DofiSAMU.js → Plus-D_XbrIfI.js} +1 -1
  21. package/dist/client/assets/{SearchMd-D70t5LVP.js → SearchMd-BJbLhbUT.js} +1 -1
  22. package/dist/client/assets/{Terminal-CStBCUAd.js → Terminal-BSL9-A7C.js} +1 -1
  23. package/dist/client/assets/{Trash01-DnTS63e5.js → Trash01-aTCf1hVv.js} +1 -1
  24. package/dist/client/assets/{X-DeVUfdHG.js → X-BgwVwwIy.js} +1 -1
  25. package/dist/client/assets/{XClose-5A0s2w1d.js → XClose-sskkBH5X.js} +1 -1
  26. package/dist/client/assets/{alert-dialog-BU8uTWb8.js → alert-dialog-DIexFXOj.js} +1 -1
  27. package/dist/client/assets/{auth-DpA5_jth.js → auth-BnF0Tfz9.js} +1 -1
  28. package/dist/client/assets/{auth-catchall-2WBu6I6H.js → auth-catchall-Cp5vKmTi.js} +1 -1
  29. package/dist/client/assets/{avatar-KDpJ2jsd.js → avatar-Bf0qQU4w.js} +1 -1
  30. package/dist/client/assets/{badge-CStgouQf.js → badge-CgEtLuTw.js} +1 -1
  31. package/dist/client/assets/{button-IijH0wdI.js → button-O0CudEuW.js} +1 -1
  32. package/dist/client/assets/{card-BnWpolEI.js → card-ciO_SNWh.js} +1 -1
  33. package/dist/client/assets/{checkbox-BYeNlYdH.js → checkbox-DUc30Qpz.js} +1 -1
  34. package/dist/client/assets/{collection-detail-DnxFiEu9.js → collection-detail-msiVYwQa.js} +41 -41
  35. package/dist/client/assets/{collection-display-button-2ZQ5sQTW.js → collection-display-button-BVgPIpv0.js} +1 -1
  36. package/dist/client/assets/{collection-header-DBUE7n6H.js → collection-header-BkZGWAxm.js} +1 -1
  37. package/dist/client/assets/{collection-page-BHk1uJKe.js → collection-page-CREYFoHa.js} +1 -1
  38. package/dist/client/assets/{collection-search-CM9rltH6.js → collection-search-s9G5Psps.js} +1 -1
  39. package/dist/client/assets/{collection-tab-ClOnLgHC.js → collection-tab-T_hhyR7G.js} +1 -1
  40. package/dist/client/assets/{collection-table-wrapper-BRI7T6RJ.js → collection-table-wrapper-Dnmr37nE.js} +1 -1
  41. package/dist/client/assets/{connection-card-DMv3uM_n.js → connection-card-Dcrw1pJ1.js} +1 -1
  42. package/dist/client/assets/{connection-detail-Cs5NpuH7.js → connection-detail-ByP6chqW.js} +1 -1
  43. package/dist/client/assets/{connections-DSbytdP0.js → connections-DYOzkJYx.js} +1 -1
  44. package/dist/client/assets/constants-BG4081pg.js +1 -0
  45. package/dist/client/assets/{create-organization-dialog-DbNHSUuq.js → create-organization-dialog-CYQoklT3.js} +1 -1
  46. package/dist/client/assets/{dialog-CJsBFVDy.js → dialog-D4dy2US8.js} +1 -1
  47. package/dist/client/assets/{dropdown-menu-BvLCKekW.js → dropdown-menu-DjELCVXr.js} +1 -1
  48. package/dist/client/assets/{empty-state-Bg-FRZa4.js → empty-state-CA7indKP.js} +1 -1
  49. package/dist/client/assets/{env-vars-editor-Z7SwcUr8.js → env-vars-editor-CFmirc3J.js} +1 -1
  50. package/dist/client/assets/{error-boundary-CsEoagci.js → error-boundary-Ba_T3BIS.js} +1 -1
  51. package/dist/client/assets/{extract-connection-data-BgA1QcA6.js → extract-connection-data-Bm1qZWCV.js} +1 -1
  52. package/dist/client/assets/{form-BjarY-Jq.js → form-rbCVC2Lc.js} +1 -1
  53. package/dist/client/assets/{formatDistanceToNow-fhdySMxO.js → formatDistanceToNow-Bsssu-td.js} +1 -1
  54. package/dist/client/assets/{gateway-detail-DeFxNps5.js → gateway-detail-JYrV5S3_.js} +1 -1
  55. package/dist/client/assets/{gateways-CXlSFkKr.js → gateways--haP9jLk.js} +1 -1
  56. package/dist/client/assets/{home-BXCs6vTQ.js → home-0xYKq0nN.js} +1 -1
  57. package/dist/client/assets/index-B9fZ40p9.js +155 -0
  58. package/dist/client/assets/{index-CRGUNI2v.js → index-BGmLHZvN.js} +1 -1
  59. package/dist/client/assets/{index-B_OB0BCO.js → index-BNguAQBW.js} +1 -1
  60. package/dist/client/assets/{index-BGEzzv-W.js → index-C9WZdaPe.js} +1 -1
  61. package/dist/client/assets/index-CmUsR6rx.css +1 -0
  62. package/dist/client/assets/{input-BxywPo2X.js → input-C3lfdgit.js} +1 -1
  63. package/dist/client/assets/{layout-Dfp1nH3g.js → layout-BgUF9JkX.js} +1 -1
  64. package/dist/client/assets/{lazy-highlighter-DYlTa9LA.js → lazy-highlighter-Buv6v3mS.js} +1 -1
  65. package/dist/client/assets/{localstorage-keys-Bj9V9Nbd.js → localstorage-keys-BGRuWcRT.js} +1 -1
  66. package/dist/client/assets/{login-BfaeBzql.js → login-fFNSXfGP.js} +1 -1
  67. package/dist/client/assets/{mcp-oauth-Vd_yzV5S.js → mcp-oauth-DacADfyW.js} +1 -1
  68. package/dist/client/assets/{members-fIe1QSNh.js → members-CAufZALX.js} +1 -1
  69. package/dist/client/assets/{monaco-editor-mQfzbJMr.js → monaco-editor-uZe9l_bJ.js} +1 -1
  70. package/dist/client/assets/{monitoring-I1RqzeAN.js → monitoring-DTJtueom.js} +1 -1
  71. package/dist/client/assets/{oauth-callback-Cwog6Jzh.js → oauth-callback-zUOuo71p.js} +1 -1
  72. package/dist/client/assets/{page-BVptnX4j.js → page-BP6lcPxY.js} +1 -1
  73. package/dist/client/assets/{pin-to-sidebar-button-C8t5xznu.js → pin-to-sidebar-button-DcWM6FTO.js} +1 -1
  74. package/dist/client/assets/{popover-CwHNob2q.js → popover-BRnyFKtN.js} +1 -1
  75. package/dist/client/assets/{resizable-DybyPt6-.js → resizable-Bcc9SJfZ.js} +1 -1
  76. package/dist/client/assets/{resource-tabs-s0IiCCzU.js → resource-tabs-ltvgVmlK.js} +1 -1
  77. package/dist/client/assets/{responsive-select-INSf3elv.js → responsive-select-BbaQnOfE.js} +1 -1
  78. package/dist/client/assets/{select-C0rvNlZx.js → select-Dsuiuagq.js} +1 -1
  79. package/dist/client/assets/{settings-3Or8ShnF.js → settings-Br4mx_yy.js} +1 -1
  80. package/dist/client/assets/{shell-layout-4x0MHQQc.js → shell-layout-CM_S8ji4.js} +1 -1
  81. package/dist/client/assets/{spinner-D7ZAVJCR.js → spinner-CDnZnQfr.js} +1 -1
  82. package/dist/client/assets/{store-Bl_0XUq8.js → store-CJqU95FV.js} +1 -1
  83. package/dist/client/assets/{store-app-detail--3qLKygc.js → store-app-detail-Bb4mx26e.js} +1 -1
  84. package/dist/client/assets/{switch-D37mVt_9.js → switch-DhyQ2_hE.js} +1 -1
  85. package/dist/client/assets/{textarea-DNeEC-Sl.js → textarea-CvmD-TCl.js} +1 -1
  86. package/dist/client/assets/{thread-history-popover-CykPOF9f.js → thread-history-popover-BQKKEP-v.js} +4 -4
  87. package/dist/client/assets/{tools-list-CFmwpEf4.js → tools-list-zpc-T8zT.js} +1 -1
  88. package/dist/client/assets/{tooltip-CSuczTFq.js → tooltip-DaImUyOX.js} +1 -1
  89. package/dist/client/assets/{types-CJK7iTsI.js → types-BDHiECry.js} +1 -1
  90. package/dist/client/assets/{use-binding-C5e_Y70M.js → use-binding-BWHEOuVA.js} +8 -8
  91. package/dist/client/assets/{use-connection-CsPrFY0x.js → use-connection-9XNP6qUi.js} +1 -1
  92. package/dist/client/assets/{use-connection-resources-CjjFKWSM.js → use-connection-resources-DbXXhKLF.js} +1 -1
  93. package/dist/client/assets/{use-gateway-Bz_y7oh7.js → use-gateway-BU92tNo7.js} +1 -1
  94. package/dist/client/assets/{use-list-state-B13SO1z3.js → use-list-state-vrSW0egR.js} +1 -1
  95. package/dist/client/assets/{use-mcp-CPBDJGOj.js → use-mcp-BXJqKT0W.js} +1 -1
  96. package/dist/client/assets/{use-members-b3tDRslY.js → use-members-eTAFi1HF.js} +1 -1
  97. package/dist/client/assets/{use-mobile-VYFif8jU.js → use-mobile-CG0P5-tt.js} +1 -1
  98. package/dist/client/assets/{use-organization-settings-i4aS_Egu.js → use-organization-settings-jxyxG3Do.js} +1 -1
  99. package/dist/client/assets/{use-tool-call-BdbJ3oy8.js → use-tool-call-vWU--CYB.js} +1 -1
  100. package/dist/client/assets/useQuery-nlt5lRkW.js +1 -0
  101. package/dist/client/assets/{useSuspenseInfiniteQuery-BLpBJxLd.js → useSuspenseInfiniteQuery-o35GYPjZ.js} +1 -1
  102. package/dist/client/assets/{view-mode-toggle-BXo-WMnB.js → view-mode-toggle-CTKggGXJ.js} +1 -1
  103. package/dist/client/assets/{workflow-wGJTSVc-.js → workflow-DTYA39cO.js} +1 -1
  104. package/dist/client/index.html +2 -2
  105. package/dist/server/cli.js +2 -2
  106. package/dist/server/server.js +2 -2
  107. package/package.json +1 -1
  108. package/dist/client/assets/constants-TKUQnnwA.js +0 -1
  109. package/dist/client/assets/index-9pHY4m3c.css +0 -1
  110. package/dist/client/assets/index-BLgTJ8o3.js +0 -155
  111. package/dist/client/assets/useQuery-DXchCtgN.js +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-DYlTa9LA.js","assets/index-BLgTJ8o3.js","assets/index-9pHY4m3c.css"])))=>i.map(i=>d[i]);
2
- import{r as V,c as G,e as cu,q as Pi,K as Oe,aW as bc,aM as Tc,aJ as $e,w as q,aX as cr,aY as du,aZ as xc,a_ as _c,a$ as yc,Y as Fe,X as vn,W as zn,v as be,b0 as X,aI as Tt,b1 as Ac,b2 as ye,_ as kc,a3 as Mi,j as m,b3 as Cc,f as Ic,t as ka}from"./index-BLgTJ8o3.js";import{E as Sc,u as Nc}from"./use-binding-C5e_Y70M.js";import{u as Ht,i as Jt,d as fu,c as _r,b as yr,T as Ar,a as wc}from"./tooltip-CSuczTFq.js";import{u as hu,L as Rc}from"./localstorage-keys-Bj9V9Nbd.js";import{u as Dt,c as me,B as Ye}from"./button-IijH0wdI.js";import{i as pu}from"./AlertCircle-BrGqb-qb.js";import{i as Oc}from"./error-boundary-CsEoagci.js";import{i as Lc}from"./X-DeVUfdHG.js";import{i as Dc,c as vc}from"./Grid01-CmB5R6oU.js";import{i as Pc,R as Mc,e as Bc,f as Fc,g as Uc}from"./responsive-select-INSf3elv.js";import{T as Hc}from"./textarea-DNeEC-Sl.js";import{a as Bi}from"./Copy01-_s71W2Ph.js";import{i as jc}from"./Terminal-CStBCUAd.js";import{M as mu}from"./monaco-editor-mQfzbJMr.js";import{b as zc,c as $c,d as Yc,A as qc,a as Vc,e as Wc,g as Qc,f as Gc}from"./alert-dialog-BU8uTWb8.js";import{i as Xc}from"./File06-CpSSTggW.js";import{i as Zc}from"./InfoCircle-D6JXYJn_.js";import{i as gu,E as Kc}from"./SearchMd-D70t5LVP.js";import{U as Jc,e as ed,c as td,u as nd,a as rd}from"./use-connection-CsPrFY0x.js";import{O as id,c as ad,d as sd}from"./well-known-mcp-VNRT0JrW.js";import{g as ud}from"./generate-id-Dyweu44Y.js";import{P as od,a as ld,b as cd}from"./popover-CwHNob2q.js";import{s as Ca}from"./Clock-LzAlJ-1R.js";import{s as dd}from"./Trash01-DnTS63e5.js";const Eu=({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"}));Eu.displayName="Coins01";const bu=({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"}));bu.displayName="CornerUpLeft";const Tu=({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"}));Tu.displayName="CurrencyDollar";const xu=({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"}));xu.displayName="Edit02";const _u=({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"}));_u.displayName="Image01";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 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"}));yu.displayName="Lightbulb01";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:"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"}));Au.displayName="LogOut04";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:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));ku.displayName="MessageChatSquare";const kr=({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"}));kr.displayName="Stars01";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:"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"}));Cu.displayName="Target04";var Pn;(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})(Pn||(Pn={}));var Ia;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ia||(Ia={}));Pn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pn.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 dr 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 dr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pn.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()}}dr.create=t=>new dr(t);var Sa;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Sa||(Sa={}));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 Mt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function fd(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Mt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let jr;function Cr(){return jr||(jr=fd("keyval-store","keyval")),jr}function Fi(t,e=Cr()){return e("readonly",n=>Mt(n.get(t)))}function kn(t,e,n=Cr()){return n("readwrite",r=>(r.put(e,t),Mt(r.transaction)))}function Iu(t,e=Cr()){return e("readwrite",n=>(n.delete(t),Mt(n.transaction)))}function hd(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Mt(t.transaction)}function Su(t=Cr()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Mt(e.getAllKeys()),Mt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>hd(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function pd(t,e){const n=`${t}:threads:${e}`;return await Fi(n)??null}async function md(t){const e=`${t}:threads:`;return(await Su()).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 Nu(t,e){const n=`${t}:messages:`;return Su().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 r_(t){const e=G.c(14),{locator:n}=Ht(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=r?Oe.gatewayThreads(n,r):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()=>{const f=await md(n);return r?f.filter(p=>p.gatewayId===r):f},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}=Pi(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 gd(t){const e=G.c(11),{locator:n}=Ht();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=()=>Nu(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}=Pi(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function Ui(){const t=G.c(28),{locator:e}=Ht(),n=cu();let r;t[0]!==e?(r=async y=>{const T=`${e}:threads:${y.id}`;return await kn(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=Dt(a);let u;t[8]!==e?(u=async y=>{const{id:T,updates:S}=y,E=`${e}:threads:${T}`,R=await Fi(E);if(!R)throw new Error(`Thread ${T} not found`);const O={...R,...S};return await kn(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=Dt(l);let f;t[16]!==e?(f=async y=>{const T=`${e}:threads:${y}`;return await Iu(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=Dt(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 wu(){const t=G.c(37),{locator:e}=Ht(),n=cu();let r;t[0]!==e?(r=async R=>{const O=`${e}:messages:${R.id}`;return await kn(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=Dt(a);let u;t[8]!==e?(u=async R=>(await Promise.all(R.map(O=>{const I=`${e}:messages:${O.id}`;return kn(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=Dt(l);let f;t[16]!==e?(f=async R=>{const{id:O,updates:I}=R,v=`${e}:messages:${O}`,B=await Fi(v);if(!B)throw new Error(`Message ${O} not found`);const z={...B,...I};return await kn(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=Dt(h);let _;t[24]!==e?(_=async R=>{const O=`${e}:messages:${R}`;return await Iu(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=Dt(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}var Ru="vercel.ai.error",Ed=Symbol.for(Ru),Na,wa,It=class Ou extends(wa=Error,Na=Ed,wa){constructor({name:e,message:n,cause:r}){super(n),this[Na]=!0,this.name=e,this.cause=r}static isInstance(e){return Ou.hasMarker(e,Ru)}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 Lu(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Du="AI_InvalidArgumentError",vu=`vercel.ai.error.${Du}`,bd=Symbol.for(vu),Ra,Oa,Td=class extends(Oa=It,Ra=bd,Oa){constructor({message:t,cause:e,argument:n}){super({name:Du,message:t,cause:e}),this[Ra]=!0,this.argument=n}static isInstance(t){return It.hasMarker(t,vu)}},Pu="AI_JSONParseError",Mu=`vercel.ai.error.${Pu}`,xd=Symbol.for(Mu),La,Da,va=class extends(Da=It,La=xd,Da){constructor({text:t,cause:e}){super({name:Pu,message:`JSON parsing failed: Text: ${t}.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-Buv6v3mS.js","assets/index-B9fZ40p9.js","assets/index-CmUsR6rx.css"])))=>i.map(i=>d[i]);
2
+ import{r as V,c as G,e as cu,q as Pi,K as Oe,aV as bc,aL as Tc,aI as $e,w as q,aW as cr,aX as du,aY as xc,aZ as _c,a_ as yc,Y as Fe,X as vn,W as zn,v as be,a$ as X,aH as Tt,b0 as Ac,b1 as ye,_ as kc,a3 as Mi,j as m,b2 as Cc,f as Ic,t as ka}from"./index-B9fZ40p9.js";import{E as Sc,u as Nc}from"./use-binding-BWHEOuVA.js";import{u as Ht,i as Jt,d as fu,c as _r,b as yr,T as Ar,a as wc}from"./tooltip-DaImUyOX.js";import{u as hu,L as Rc}from"./localstorage-keys-BGRuWcRT.js";import{u as Dt,c as me,B as Ye}from"./button-O0CudEuW.js";import{i as pu}from"./AlertCircle-DxJIdkjA.js";import{i as Oc}from"./error-boundary-Ba_T3BIS.js";import{i as Lc}from"./X-BgwVwwIy.js";import{i as Dc,c as vc}from"./Grid01-Ch9rI6P9.js";import{i as Pc,R as Mc,e as Bc,f as Fc,g as Uc}from"./responsive-select-BbaQnOfE.js";import{T as Hc}from"./textarea-CvmD-TCl.js";import{a as Bi}from"./Copy01-DfnjsOeR.js";import{i as jc}from"./Terminal-BSL9-A7C.js";import{M as mu}from"./monaco-editor-uZe9l_bJ.js";import{b as zc,c as $c,d as Yc,A as qc,a as Vc,e as Wc,g as Qc,f as Gc}from"./alert-dialog-DIexFXOj.js";import{i as Xc}from"./File06-DSeIH9xM.js";import{i as Zc}from"./InfoCircle-DQaxWpv9.js";import{i as gu,E as Kc}from"./SearchMd-BJbLhbUT.js";import{U as Jc,e as ed,c as td,u as nd,a as rd}from"./use-connection-9XNP6qUi.js";import{O as id,c as ad,d as sd}from"./well-known-mcp-VNRT0JrW.js";import{g as ud}from"./generate-id-Dyweu44Y.js";import{P as od,a as ld,b as cd}from"./popover-BRnyFKtN.js";import{s as Ca}from"./Clock-CafJ8d76.js";import{s as dd}from"./Trash01-aTCf1hVv.js";const Eu=({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"}));Eu.displayName="Coins01";const bu=({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"}));bu.displayName="CornerUpLeft";const Tu=({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"}));Tu.displayName="CurrencyDollar";const xu=({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"}));xu.displayName="Edit02";const _u=({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"}));_u.displayName="Image01";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 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"}));yu.displayName="Lightbulb01";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:"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"}));Au.displayName="LogOut04";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:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));ku.displayName="MessageChatSquare";const kr=({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"}));kr.displayName="Stars01";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:"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"}));Cu.displayName="Target04";var Pn;(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})(Pn||(Pn={}));var Ia;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ia||(Ia={}));Pn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pn.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 dr 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 dr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pn.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()}}dr.create=t=>new dr(t);var Sa;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Sa||(Sa={}));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 Mt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function fd(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Mt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let jr;function Cr(){return jr||(jr=fd("keyval-store","keyval")),jr}function Fi(t,e=Cr()){return e("readonly",n=>Mt(n.get(t)))}function kn(t,e,n=Cr()){return n("readwrite",r=>(r.put(e,t),Mt(r.transaction)))}function Iu(t,e=Cr()){return e("readwrite",n=>(n.delete(t),Mt(n.transaction)))}function hd(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Mt(t.transaction)}function Su(t=Cr()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Mt(e.getAllKeys()),Mt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>hd(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function pd(t,e){const n=`${t}:threads:${e}`;return await Fi(n)??null}async function md(t){const e=`${t}:threads:`;return(await Su()).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 Nu(t,e){const n=`${t}:messages:`;return Su().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 r_(t){const e=G.c(14),{locator:n}=Ht(),r=t?.gatewayId;let i;e[0]!==r||e[1]!==n?(i=r?Oe.gatewayThreads(n,r):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()=>{const f=await md(n);return r?f.filter(p=>p.gatewayId===r):f},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}=Pi(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 gd(t){const e=G.c(11),{locator:n}=Ht();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=()=>Nu(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}=Pi(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function Ui(){const t=G.c(28),{locator:e}=Ht(),n=cu();let r;t[0]!==e?(r=async y=>{const T=`${e}:threads:${y.id}`;return await kn(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=Dt(a);let u;t[8]!==e?(u=async y=>{const{id:T,updates:S}=y,E=`${e}:threads:${T}`,R=await Fi(E);if(!R)throw new Error(`Thread ${T} not found`);const O={...R,...S};return await kn(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=Dt(l);let f;t[16]!==e?(f=async y=>{const T=`${e}:threads:${y}`;return await Iu(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=Dt(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 wu(){const t=G.c(37),{locator:e}=Ht(),n=cu();let r;t[0]!==e?(r=async R=>{const O=`${e}:messages:${R.id}`;return await kn(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=Dt(a);let u;t[8]!==e?(u=async R=>(await Promise.all(R.map(O=>{const I=`${e}:messages:${O.id}`;return kn(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=Dt(l);let f;t[16]!==e?(f=async R=>{const{id:O,updates:I}=R,v=`${e}:messages:${O}`,B=await Fi(v);if(!B)throw new Error(`Message ${O} not found`);const z={...B,...I};return await kn(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=Dt(h);let _;t[24]!==e?(_=async R=>{const O=`${e}:messages:${R}`;return await Iu(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=Dt(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}var Ru="vercel.ai.error",Ed=Symbol.for(Ru),Na,wa,It=class Ou extends(wa=Error,Na=Ed,wa){constructor({name:e,message:n,cause:r}){super(n),this[Na]=!0,this.name=e,this.cause=r}static isInstance(e){return Ou.hasMarker(e,Ru)}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 Lu(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Du="AI_InvalidArgumentError",vu=`vercel.ai.error.${Du}`,bd=Symbol.for(vu),Ra,Oa,Td=class extends(Oa=It,Ra=bd,Oa){constructor({message:t,cause:e,argument:n}){super({name:Du,message:t,cause:e}),this[Ra]=!0,this.argument=n}static isInstance(t){return It.hasMarker(t,vu)}},Pu="AI_JSONParseError",Mu=`vercel.ai.error.${Pu}`,xd=Symbol.for(Mu),La,Da,va=class extends(Da=It,La=xd,Da){constructor({text:t,cause:e}){super({name:Pu,message:`JSON parsing failed: Text: ${t}.
3
3
  Error message: ${Lu(e)}`,cause:e}),this[La]=!0,this.text=t}static isInstance(t){return It.hasMarker(t,Mu)}},Bu="AI_TypeValidationError",Fu=`vercel.ai.error.${Bu}`,_d=Symbol.for(Fu),Pa,Ma,en=class ci extends(Ma=It,Pa=_d,Ma){constructor({value:e,cause:n}){super({name:Bu,message:`Type validation failed: Value: ${JSON.stringify(e)}.
4
4
  Error message: ${Lu(n)}`,cause:n}),this[Pa]=!0,this.value=e}static isInstance(e){return It.hasMarker(e,Fu)}static wrap({value:e,cause:n}){return ci.isInstance(n)&&n.value===e?n:new ci({value:e,cause:n})}},$n=({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 Td({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},yd=$n();function Ba(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 Lt(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 Fa(t,...e){const n=new Headers(Lt(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var Ad=/"__proto__"\s*:/,kd=/"constructor"\s*:/;function Ua(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Ad.test(t)===!1&&kd.test(t)===!1?e:Cd(e)}function Cd(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 Id(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Ua(t)}try{return Ua(t)}finally{Error.stackTraceLimit=e}}function Uu(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]=Rt(n[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(Rt):Rt(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(Rt)),t.allOf!=null&&(t.allOf=t.allOf.map(Rt)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(Rt));const{definitions:e}=t;if(e!=null)for(const n of Object.keys(e))e[n]=Rt(e[n]);return t}function Rt(t){return typeof t=="boolean"?t:Uu(t)}var Sd=Symbol("Let zodToJsonSchema decide on which parser to use"),Ha={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"},Nd=t=>typeof t=="string"?{...Ha,name:t}:{...Ha,...t};function Xe(){return{}}function wd(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=he(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 Rd(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 Od(){return{type:"boolean"}}function Hu(t,e){return he(t.type._def,e)}var Ld=(t,e)=>he(t.innerType._def,e);function ju(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>ju(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 Dd(t)}}var Dd=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 vd(t,e){return{...he(t.innerType._def,e),default:t.defaultValue()}}function Pd(t,e){return e.effectStrategy==="input"?he(t.schema._def,e):Xe()}function Md(t){return{type:"string",enum:Array.from(t.values)}}var Bd=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Fd(t,e){const n=[he(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),he(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(Bd(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 Ud(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 zr=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:()=>(zr===void 0&&(zr=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zr),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 zu(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":Be(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":Be(n,r.regex,r.message,e);break;case"cuid":Be(n,nt.cuid,r.message,e);break;case"cuid2":Be(n,nt.cuid2,r.message,e);break;case"startsWith":Be(n,RegExp(`^${$r(r.value,e)}`),r.message,e);break;case"endsWith":Be(n,RegExp(`${$r(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":{Be(n,RegExp($r(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":Be(n,nt.base64url,r.message,e);break;case"jwt":Be(n,nt.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Be(n,nt.ipv4Cidr,r.message,e),r.version!=="v4"&&Be(n,nt.ipv6Cidr,r.message,e);break}case"emoji":Be(n,nt.emoji(),r.message,e);break;case"ulid":{Be(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":{Be(n,nt.base64,r.message,e);break}}break}case"nanoid":Be(n,nt.nanoid,r.message,e)}return n}function $r(t,e){return e.patternStrategy==="escape"?jd(t):t}var Hd=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function jd(t){let e="";for(let n=0;n<t.length;n++)Hd.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 Be(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:ja(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=ja(e,r)}function ja(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 $u(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=he(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}=zu(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}=Hu(t.keyType._def,e);return{...o,propertyNames:d}}}return o}function zd(t,e){if(e.mapStrategy==="record")return $u(t,e);const n=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Xe(),r=he(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 $d(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 Yd(){return{not:Xe()}}function qd(){return{type:"null"}}var di={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vd(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in di&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=di[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 Wd(t,e)}var Wd=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>he(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 Qd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[di[t.innerType._def.typeName],"null"]};const n=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Gd(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 Xd(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=Kd(u),l=he(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=Zd(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Zd(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(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 Kd(t){try{return t.isOptional()}catch{return!0}}var Jd=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return he(t.innerType._def,e);const r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xe()},r]}:Xe()},ef=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);const n=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function tf(t,e){return he(t.type._def,e)}function nf(t,e){const r={type:"array",uniqueItems:!0,items:he(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 rf(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>he(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>he(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function af(){return{not:Xe()}}function sf(){return Xe()}var uf=(t,e)=>he(t.innerType._def,e),of=(t,e,n)=>{switch(e){case ee.ZodString:return zu(t,n);case ee.ZodNumber:return Gd(t);case ee.ZodObject:return Xd(t,n);case ee.ZodBigInt:return Rd(t);case ee.ZodBoolean:return Od();case ee.ZodDate:return ju(t,n);case ee.ZodUndefined:return af();case ee.ZodNull:return qd();case ee.ZodArray:return wd(t,n);case ee.ZodUnion:case ee.ZodDiscriminatedUnion:return Vd(t,n);case ee.ZodIntersection:return Fd(t,n);case ee.ZodTuple:return rf(t,n);case ee.ZodRecord:return $u(t,n);case ee.ZodLiteral:return Ud(t);case ee.ZodEnum:return Md(t);case ee.ZodNativeEnum:return $d(t);case ee.ZodNullable:return Qd(t,n);case ee.ZodOptional:return Jd(t,n);case ee.ZodMap:return zd(t,n);case ee.ZodSet:return nf(t,n);case ee.ZodLazy:return()=>t.getter()._def;case ee.ZodPromise:return tf(t,n);case ee.ZodNaN:case ee.ZodNever:return Yd();case ee.ZodEffects:return Pd(t,n);case ee.ZodAny:return Xe();case ee.ZodUnknown:return sf();case ee.ZodDefault:return vd(t,n);case ee.ZodBranded:return Hu(t,n);case ee.ZodReadonly:return uf(t,n);case ee.ZodCatch:return Ld(t,n);case ee.ZodPipeline:return ef(t,n);case ee.ZodFunction:case ee.ZodVoid:case ee.ZodSymbol:return;default:return(r=>{})()}},lf=(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 he(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!==Sd)return o}if(i&&!n){const o=cf(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=of(t,t.typeName,e),u=typeof s=="function"?he(s(),e):s;if(u&&df(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var cf=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:lf(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}},df=(t,e,n)=>(t.description&&(n.description=t.description),n),ff=t=>{const e=Nd(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}]))}},hf=(t,e)=>{var n;const r=ff(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,f])=>{var p;return{...l,[d]:(p=he(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=he(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},fi=Symbol.for("vercel.ai.schema");function pf(t){let e;return()=>(e==null&&(e=t()),e)}function Ir(t,{validate:e}={}){return{[fi]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function mf(t){return typeof t=="object"&&t!==null&&fi in t&&t[fi]===!0&&"jsonSchema"in t&&"validate"in t}function Hi(t){return t==null?Ir({properties:{},additionalProperties:!1}):mf(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Yu(t):gf(t):t()}function gf(t){return Ir(()=>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 Ef(t,e){var n;const r=(n=void 0)!=null?n:!1;return Ir(()=>hf(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 bf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Ir(()=>Uu(Tc(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await bc(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Tf(t){return"_zod"in t}function Yu(t,e){return Tf(t)?bf(t):Ef(t)}async function za({value:t,schema:e}){const n=await Mn({value:t,schema:e});if(!n.success)throw en.wrap({value:t,cause:n.error});return n.value}async function Mn({value:t,schema:e}){const n=Hi(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 Bt({text:t,schema:e}){try{const n=Id(t);return e==null?{success:!0,value:n,rawValue:n}:await Mn({value:n,schema:e})}catch(n){return{success:!1,error:va.isInstance(n)?n:new va({text:t,cause:n}),rawValue:void 0}}}function xf({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Sc).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Bt({text:n,schema:e}))}}))}async function At(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var _f=Object.defineProperty,yf=(t,e)=>{for(var n in e)_f(t,n,{get:e[n],enumerable:!0})},qu="AI_NoObjectGeneratedError",Vu=`vercel.ai.error.${qu}`,Af=Symbol.for(Vu),Wu,Ct=class extends It{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:qu,message:t,cause:e}),this[Wu]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return It.hasMarker(t,Vu)}};Wu=Af;var $a="6.0.19",Qu=$e([q(),cr(Uint8Array),cr(ArrayBuffer),du(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Bn=xc(()=>$e([_c(),q(),yc(),Fe(),vn(q(),Bn.optional()),zn(Bn)])),ue=vn(q(),vn(q(),Bn.optional())),Gu=be({type:X("text"),text:q(),providerOptions:ue.optional()}),kf=be({type:X("image"),image:$e([Qu,cr(URL)]),mediaType:q().optional(),providerOptions:ue.optional()}),Xu=be({type:X("file"),data:$e([Qu,cr(URL)]),filename:q().optional(),mediaType:q(),providerOptions:ue.optional()}),Cf=be({type:X("reasoning"),text:q(),providerOptions:ue.optional()}),If=be({type:X("tool-call"),toolCallId:q(),toolName:q(),input:Tt(),providerOptions:ue.optional(),providerExecuted:Fe().optional()}),Sf=Ac("type",[be({type:X("text"),value:q(),providerOptions:ue.optional()}),be({type:X("json"),value:Bn,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:Bn,providerOptions:ue.optional()}),be({type:X("content"),value:zn($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(),vn(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(),vn(q(),q())]),providerOptions:ue.optional()}),be({type:X("custom"),providerOptions:ue.optional()})]))})]),Zu=be({type:X("tool-result"),toolCallId:q(),toolName:q(),output:Sf,providerOptions:ue.optional()}),Nf=be({type:X("tool-approval-request"),approvalId:q(),toolCallId:q()}),wf=be({type:X("tool-approval-response"),approvalId:q(),approved:Fe(),reason:q().optional()}),Rf=be({role:X("system"),content:q(),providerOptions:ue.optional()}),Of=be({role:X("user"),content:$e([q(),zn($e([Gu,kf,Xu]))]),providerOptions:ue.optional()}),Lf=be({role:X("assistant"),content:$e([q(),zn($e([Gu,Xu,Cf,If,Zu,Nf]))]),providerOptions:ue.optional()}),Df=be({role:X("tool"),content:zn($e([Zu,wf])),providerOptions:ue.optional()});$e([Rf,Of,Lf,Df]);function Ku(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]=Ku(a,i):n[r]=i}return n}var vf={};yf(vf,{array:()=>Ff,choice:()=>Uf,json:()=>Hf,object:()=>Bf,text:()=>Mf});function Pf(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 Yn(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Bt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Bt({text:Pf(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Mf=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),Bf=({schema:t,name:e,description:n})=>{const r=Hi(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 Bt({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 Mn({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 Yn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Ff=({element:t,name:e,description:n})=>{const r=Hi(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 Bt({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 Mn({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 Yn(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 Mn({value:l,schema:r});d.success&&o.push(d.value)}return{partial:o}}}}}},Uf=({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 Bt({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 Yn(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}}}}),Hf=({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 Bt({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 Yn(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}}}});$n({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 $u(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=he(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}=zu(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}=Hu(t.keyType._def,e);return{...o,propertyNames:d}}}return o}function zd(t,e){if(e.mapStrategy==="record")return $u(t,e);const n=he(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Xe(),r=he(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 $d(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 Yd(){return{not:Xe()}}function qd(){return{type:"null"}}var di={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vd(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in di&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=di[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 Wd(t,e)}var Wd=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>he(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 Qd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[di[t.innerType._def.typeName],"null"]};const n=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Gd(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 Xd(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=Kd(u),l=he(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=Zd(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Zd(t,e){if(t.catchall._def.typeName!=="ZodNever")return he(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 Kd(t){try{return t.isOptional()}catch{return!0}}var Jd=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return he(t.innerType._def,e);const r=he(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xe()},r]}:Xe()},ef=(t,e)=>{if(e.pipeStrategy==="input")return he(t.in._def,e);if(e.pipeStrategy==="output")return he(t.out._def,e);const n=he(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=he(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function tf(t,e){return he(t.type._def,e)}function nf(t,e){const r={type:"array",uniqueItems:!0,items:he(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 rf(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>he(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:he(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>he(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function af(){return{not:Xe()}}function sf(){return Xe()}var uf=(t,e)=>he(t.innerType._def,e),of=(t,e,n)=>{switch(e){case ee.ZodString:return zu(t,n);case ee.ZodNumber:return Gd(t);case ee.ZodObject:return Xd(t,n);case ee.ZodBigInt:return Rd(t);case ee.ZodBoolean:return Od();case ee.ZodDate:return ju(t,n);case ee.ZodUndefined:return af();case ee.ZodNull:return qd();case ee.ZodArray:return wd(t,n);case ee.ZodUnion:case ee.ZodDiscriminatedUnion:return Vd(t,n);case ee.ZodIntersection:return Fd(t,n);case ee.ZodTuple:return rf(t,n);case ee.ZodRecord:return $u(t,n);case ee.ZodLiteral:return Ud(t);case ee.ZodEnum:return Md(t);case ee.ZodNativeEnum:return $d(t);case ee.ZodNullable:return Qd(t,n);case ee.ZodOptional:return Jd(t,n);case ee.ZodMap:return zd(t,n);case ee.ZodSet:return nf(t,n);case ee.ZodLazy:return()=>t.getter()._def;case ee.ZodPromise:return tf(t,n);case ee.ZodNaN:case ee.ZodNever:return Yd();case ee.ZodEffects:return Pd(t,n);case ee.ZodAny:return Xe();case ee.ZodUnknown:return sf();case ee.ZodDefault:return vd(t,n);case ee.ZodBranded:return Hu(t,n);case ee.ZodReadonly:return uf(t,n);case ee.ZodCatch:return Ld(t,n);case ee.ZodPipeline:return ef(t,n);case ee.ZodFunction:case ee.ZodVoid:case ee.ZodSymbol:return;default:return(r=>{})()}},lf=(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 he(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!==Sd)return o}if(i&&!n){const o=cf(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=of(t,t.typeName,e),u=typeof s=="function"?he(s(),e):s;if(u&&df(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var cf=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:lf(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}},df=(t,e,n)=>(t.description&&(n.description=t.description),n),ff=t=>{const e=Nd(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}]))}},hf=(t,e)=>{var n;const r=ff(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,f])=>{var p;return{...l,[d]:(p=he(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=he(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},fi=Symbol.for("vercel.ai.schema");function pf(t){let e;return()=>(e==null&&(e=t()),e)}function Ir(t,{validate:e}={}){return{[fi]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function mf(t){return typeof t=="object"&&t!==null&&fi in t&&t[fi]===!0&&"jsonSchema"in t&&"validate"in t}function Hi(t){return t==null?Ir({properties:{},additionalProperties:!1}):mf(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Yu(t):gf(t):t()}function gf(t){return Ir(()=>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 Ef(t,e){var n;const r=(n=void 0)!=null?n:!1;return Ir(()=>hf(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 bf(t,e){var n;const r=(n=void 0)!=null?n:!1;return Ir(()=>Uu(Tc(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await bc(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Tf(t){return"_zod"in t}function Yu(t,e){return Tf(t)?bf(t):Ef(t)}async function za({value:t,schema:e}){const n=await Mn({value:t,schema:e});if(!n.success)throw en.wrap({value:t,cause:n.error});return n.value}async function Mn({value:t,schema:e}){const n=Hi(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 Bt({text:t,schema:e}){try{const n=Id(t);return e==null?{success:!0,value:n,rawValue:n}:await Mn({value:n,schema:e})}catch(n){return{success:!1,error:va.isInstance(n)?n:new va({text:t,cause:n}),rawValue:void 0}}}function xf({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Sc).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Bt({text:n,schema:e}))}}))}async function At(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var _f=Object.defineProperty,yf=(t,e)=>{for(var n in e)_f(t,n,{get:e[n],enumerable:!0})},qu="AI_NoObjectGeneratedError",Vu=`vercel.ai.error.${qu}`,Af=Symbol.for(Vu),Wu,Ct=class extends It{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:qu,message:t,cause:e}),this[Wu]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return It.hasMarker(t,Vu)}};Wu=Af;var $a="6.0.21",Qu=$e([q(),cr(Uint8Array),cr(ArrayBuffer),du(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Bn=xc(()=>$e([_c(),q(),yc(),Fe(),vn(q(),Bn.optional()),zn(Bn)])),ue=vn(q(),vn(q(),Bn.optional())),Gu=be({type:X("text"),text:q(),providerOptions:ue.optional()}),kf=be({type:X("image"),image:$e([Qu,cr(URL)]),mediaType:q().optional(),providerOptions:ue.optional()}),Xu=be({type:X("file"),data:$e([Qu,cr(URL)]),filename:q().optional(),mediaType:q(),providerOptions:ue.optional()}),Cf=be({type:X("reasoning"),text:q(),providerOptions:ue.optional()}),If=be({type:X("tool-call"),toolCallId:q(),toolName:q(),input:Tt(),providerOptions:ue.optional(),providerExecuted:Fe().optional()}),Sf=Ac("type",[be({type:X("text"),value:q(),providerOptions:ue.optional()}),be({type:X("json"),value:Bn,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:Bn,providerOptions:ue.optional()}),be({type:X("content"),value:zn($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(),vn(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(),vn(q(),q())]),providerOptions:ue.optional()}),be({type:X("custom"),providerOptions:ue.optional()})]))})]),Zu=be({type:X("tool-result"),toolCallId:q(),toolName:q(),output:Sf,providerOptions:ue.optional()}),Nf=be({type:X("tool-approval-request"),approvalId:q(),toolCallId:q()}),wf=be({type:X("tool-approval-response"),approvalId:q(),approved:Fe(),reason:q().optional()}),Rf=be({role:X("system"),content:q(),providerOptions:ue.optional()}),Of=be({role:X("user"),content:$e([q(),zn($e([Gu,kf,Xu]))]),providerOptions:ue.optional()}),Lf=be({role:X("assistant"),content:$e([q(),zn($e([Gu,Xu,Cf,If,Zu,Nf]))]),providerOptions:ue.optional()}),Df=be({role:X("tool"),content:zn($e([Zu,wf])),providerOptions:ue.optional()});$e([Rf,Of,Lf,Df]);function Ku(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]=Ku(a,i):n[r]=i}return n}var vf={};yf(vf,{array:()=>Ff,choice:()=>Uf,json:()=>Hf,object:()=>Bf,text:()=>Mf});function Pf(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 Yn(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Bt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Bt({text:Pf(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Mf=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),Bf=({schema:t,name:e,description:n})=>{const r=Hi(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 Bt({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 Mn({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 Yn(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Ff=({element:t,name:e,description:n})=>{const r=Hi(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 Bt({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 Mn({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 Yn(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 Mn({value:l,schema:r});d.success&&o.push(d.value)}return{partial:o}}}}}},Uf=({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 Bt({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 Yn(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}}}}),Hf=({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 Bt({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 Yn(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}}}});$n({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=jn(l.charCodeAt(0))+l.slice(1)),l=l?s+" "+l:s,n.options.closeAtx&&(l+=" "+s),o(),u(),l}Ul.peek=xT;function Ul(t){return t.value||""}function xT(){return"<"}Hl.peek=_T;function Hl(t,e,n,r){const i=pa(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 _T(){return"!"}jl.peek=yT;function jl(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 yT(){return"!"}zl.peek=AT;function zl(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 AT(){return"`"}function $l(t,e){const n=ea(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))}Yl.peek=kT;function Yl(t,e,n,r){const i=pa(n),a=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,o;if($l(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 kT(t,e,n){return $l(t,n)?"<":"["}ql.peek=CT;function ql(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 CT(){return"["}function ma(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 IT(t){const e=ma(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 ST(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 Vl(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 NT(t,e,n,r){const i=n.enter("list"),a=n.bulletCurrent;let s=t.ordered?ST(n):ma(n);const u=t.ordered?s==="."?")":".":IT(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),Vl(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 wT(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 RT(t,e,n,r){const i=wT(n);let a=n.bulletCurrent||ma(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 OT(t,e,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),s=n.containerPhrasing(t,r);return a(),i(),s}const LT=vr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DT(t,e,n,r){return(t.children.some(function(s){return LT(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function vT(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Wl.peek=PT;function Wl(t,e,n,r){const i=vT(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=xr(r.before.charCodeAt(r.before.length-1),l,i);d.inside&&(o=jn(l)+o.slice(1));const f=o.charCodeAt(o.length-1),p=xr(r.after.charCodeAt(0),f,i);p.inside&&(o=o.slice(0,-1)+jn(f));const h=s.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},u+o+h}function PT(t,e,n){return n.options.strong||"*"}function MT(t,e,n,r){return n.safe(t.value,r)}function BT(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 FT(t,e,n){const r=(Vl(n)+(n.options.ruleSpaces?" ":"")).repeat(BT(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Ql={blockquote:uT,break:ru,code:hT,definition:mT,emphasis:Fl,hardBreak:ru,heading:TT,html:Ul,image:Hl,imageReference:jl,inlineCode:zl,link:Yl,linkReference:ql,list:NT,listItem:RT,paragraph:OT,root:DT,strong:Wl,text:MT,thematicBreak:FT};function UT(){return{enter:{table:HT,tableData:iu,tableHeader:iu,tableRow:zT},exit:{codeText:$T,table:jT,tableData:li,tableHeader:li,tableRow:li}}}function HT(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 jT(t){this.exit(t),this.data.inTable=void 0}function zT(t){this.enter({type:"tableRow",children:[]},t)}function li(t){this.exit(t)}function iu(t){this.enter({type:"tableCell",children:[]},t)}function $T(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,YT));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function YT(t,e){return e==="|"?e:t}function qT(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 aT(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=Ql.inlineCode(h,g,_);return _.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function VT(){return{exit:{taskListCheckValueChecked:au,taskListCheckValueUnchecked:au,paragraph:QT}}}function WT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GT}}}function au(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function QT(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 GT(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=Ql.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 XT(){return[N2(),G2(),J2(),UT(),VT()]}function ZT(t){return{extensions:[w2(),X2(t),eT(),qT(t),WT()]}}const KT={tokenize:ix,partial:!0},Gl={tokenize:ax,partial:!0},Xl={tokenize:sx,partial:!0},Zl={tokenize:ux,partial:!0},JT={tokenize:ox,partial:!0},Kl={name:"wwwAutolink",tokenize:nx,previous:ec},Jl={name:"protocolAutolink",tokenize:rx,previous:tc},Et={name:"emailAutolink",tokenize:tx,previous:nc},dt={};function ex(){return{text:dt}}let Ot=48;for(;Ot<123;)dt[Ot]=Et,Ot++,Ot===58?Ot=65:Ot===91&&(Ot=97);dt[43]=Et;dt[45]=Et;dt[46]=Et;dt[95]=Et;dt[72]=[Et,Jl];dt[104]=[Et,Jl];dt[87]=[Et,Kl];dt[119]=[Et,Kl];function tx(t,e,n){const r=this;let i,a;return s;function s(f){return!vi(f)||!nc.call(r,r.previous)||ga(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(f))}function u(f){return vi(f)?(t.consume(f),u):f===64?(t.consume(f),o):n(f)}function o(f){return f===46?t.check(JT,d,l)(f):f===45||f===95||ve(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&&Ue(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function nx(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!ec.call(r,r.previous)||ga(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(KT,t.attempt(Gl,t.attempt(Xl,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function rx(t,e,n){const r=this;let i="",a=!1;return s;function s(f){return(f===72||f===104)&&tc.call(r,r.previous)&&!ga(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),u):n(f)}function u(f){if(Ue(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||mr(f)||Te(f)||Ut(f)||Or(f)?n(f):t.attempt(Gl,t.attempt(Xl,d),n)(f)}function d(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function ix(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 ax(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Zl,o,u)(l):l===null||Te(l)||Ut(l)||l!==45&&Or(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 sx(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(Zl,e,a)(s):s===null||Te(s)||Ut(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function ux(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)||Ut(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Te(u)||Ut(u)?e(u):r(u)}function a(u){return Ue(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):Ue(u)?(t.consume(u),s):n(u)}}function ox(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return ve(a)?n(a):e(a)}}function ec(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Te(t)}function tc(t){return!Ue(t)}function nc(t){return!(t===47||vi(t))}function vi(t){return t===43||t===45||t===46||t===95||ve(t)}function ga(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 lx={tokenize:Ex,partial:!0};function cx(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:px,continuation:{tokenize:mx},exit:gx}},text:{91:{name:"gfmFootnoteCall",tokenize:hx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:dx,resolveTo:fx}}}}function dx(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 fx(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 hx(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 px(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 mx(t,e,n){return t.check(Qn,e,t.attempt(lx,e,n))}function gx(t){t.exit("gfmFootnoteDefinition")}function Ex(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 bx(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,Lr(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 Tx{constructor(){this.map=[]}add(e,n,r){xx(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 xx(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 _x(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 yx(){return{flow:{null:{name:"table",tokenize:Ax,resolveAll:kx}}}}function Ax(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):Q(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||Q(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||Q(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||Q(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 kx(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 Tx;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(su(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=rr(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=rr(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=rr(p,e,a,i,n,f)):s[1]!==0&&(f=rr(p,e,s,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&su(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=_x(e.events,n))}return t}function rr(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 su(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 Cx={name:"tasklistCheck",tokenize:Sx};function Ix(){return{text:{91:Cx}}}function Sx(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 Q(o)?e(o):ie(o)?t.check({tokenize:Nx},e,n)(o):n(o)}}function Nx(t,e,n){return oe(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function wx(t){return Oo([ex(),cx(),bx(t),yx(),Ix()])}const Rx={};function Ox(t){const e=this,n=t||Rx,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(wx(n)),a.push(XT()),s.push(ZT(n))}const Lx=V.lazy(()=>Cc(()=>import("./lazy-highlighter-DYlTa9LA.js"),__vite__mapDeps([0,1,2])));function rc(){const t=G.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 Dx(){const t=G.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(vx)}),t[1]=r):r=t[1],r}function vx(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 Px(t){const e=G.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=rc(),a=Mx;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(Bi,{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 Mx(t){return t?Array.from(t.querySelectorAll("tr")).map(Bx).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 aT(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=Ql.inlineCode(h,g,_);return _.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function VT(){return{exit:{taskListCheckValueChecked:au,taskListCheckValueUnchecked:au,paragraph:QT}}}function WT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GT}}}function au(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function QT(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 GT(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=Ql.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 XT(){return[N2(),G2(),J2(),UT(),VT()]}function ZT(t){return{extensions:[w2(),X2(t),eT(),qT(t),WT()]}}const KT={tokenize:ix,partial:!0},Gl={tokenize:ax,partial:!0},Xl={tokenize:sx,partial:!0},Zl={tokenize:ux,partial:!0},JT={tokenize:ox,partial:!0},Kl={name:"wwwAutolink",tokenize:nx,previous:ec},Jl={name:"protocolAutolink",tokenize:rx,previous:tc},Et={name:"emailAutolink",tokenize:tx,previous:nc},dt={};function ex(){return{text:dt}}let Ot=48;for(;Ot<123;)dt[Ot]=Et,Ot++,Ot===58?Ot=65:Ot===91&&(Ot=97);dt[43]=Et;dt[45]=Et;dt[46]=Et;dt[95]=Et;dt[72]=[Et,Jl];dt[104]=[Et,Jl];dt[87]=[Et,Kl];dt[119]=[Et,Kl];function tx(t,e,n){const r=this;let i,a;return s;function s(f){return!vi(f)||!nc.call(r,r.previous)||ga(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(f))}function u(f){return vi(f)?(t.consume(f),u):f===64?(t.consume(f),o):n(f)}function o(f){return f===46?t.check(JT,d,l)(f):f===45||f===95||ve(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&&Ue(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function nx(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!ec.call(r,r.previous)||ga(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(KT,t.attempt(Gl,t.attempt(Xl,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function rx(t,e,n){const r=this;let i="",a=!1;return s;function s(f){return(f===72||f===104)&&tc.call(r,r.previous)&&!ga(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),u):n(f)}function u(f){if(Ue(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||mr(f)||Te(f)||Ut(f)||Or(f)?n(f):t.attempt(Gl,t.attempt(Xl,d),n)(f)}function d(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function ix(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 ax(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Zl,o,u)(l):l===null||Te(l)||Ut(l)||l!==45&&Or(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 sx(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(Zl,e,a)(s):s===null||Te(s)||Ut(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function ux(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)||Ut(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Te(u)||Ut(u)?e(u):r(u)}function a(u){return Ue(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):Ue(u)?(t.consume(u),s):n(u)}}function ox(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return ve(a)?n(a):e(a)}}function ec(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Te(t)}function tc(t){return!Ue(t)}function nc(t){return!(t===47||vi(t))}function vi(t){return t===43||t===45||t===46||t===95||ve(t)}function ga(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 lx={tokenize:Ex,partial:!0};function cx(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:px,continuation:{tokenize:mx},exit:gx}},text:{91:{name:"gfmFootnoteCall",tokenize:hx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:dx,resolveTo:fx}}}}function dx(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 fx(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 hx(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 px(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 mx(t,e,n){return t.check(Qn,e,t.attempt(lx,e,n))}function gx(t){t.exit("gfmFootnoteDefinition")}function Ex(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 bx(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,Lr(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 Tx{constructor(){this.map=[]}add(e,n,r){xx(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 xx(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 _x(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 yx(){return{flow:{null:{name:"table",tokenize:Ax,resolveAll:kx}}}}function Ax(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):Q(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||Q(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||Q(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||Q(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 kx(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 Tx;for(;++n<t.length;){const h=t[n],g=h[1];h[0]==="enter"?g.type==="tableHead"?(u=!1,o!==0&&(su(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=rr(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=rr(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=rr(p,e,a,i,n,f)):s[1]!==0&&(f=rr(p,e,s,i,n,f)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&su(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=_x(e.events,n))}return t}function rr(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 su(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 Cx={name:"tasklistCheck",tokenize:Sx};function Ix(){return{text:{91:Cx}}}function Sx(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 Q(o)?e(o):ie(o)?t.check({tokenize:Nx},e,n)(o):n(o)}}function Nx(t,e,n){return oe(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function wx(t){return Oo([ex(),cx(),bx(t),yx(),Ix()])}const Rx={};function Ox(t){const e=this,n=t||Rx,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(wx(n)),a.push(XT()),s.push(ZT(n))}const Lx=V.lazy(()=>Cc(()=>import("./lazy-highlighter-Buv6v3mS.js"),__vite__mapDeps([0,1,2])));function rc(){const t=G.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 Dx(){const t=G.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(vx)}),t[1]=r):r=t[1],r}function vx(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 Px(t){const e=G.c(12),n=V.useRef(null),{handleCopy:r,copied:i}=rc(),a=Mx;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(Bi,{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 Mx(t){return t?Array.from(t.querySelectorAll("tr")).map(Bx).join(`
97
97
  `):""}function Bx(t){return Array.from(t.querySelectorAll("th,td")).map(Fx).join(",")}function Fx(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const Ux=[Ox],Hx=[y2],jx={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(Px,{...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"})},ic=V.memo(t=>{const e=G.c(2),{content:n}=t;let r;return e[0]!==n?(r=m.jsx(sg,{remarkPlugins:Ux,rehypePlugins:Hx,components:jx,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function zx(t){const e=G.c(20),{language:n,content:r}=t,{handleCopy:i,copied:a}=rc(),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(Bi,{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(Dx,{}),e[13]=p):p=e[13];let h;e[14]!==r||e[15]!==n?(h=m.jsx(V.Suspense,{fallback:p,children:m.jsx(Lx,{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}ic.displayName="MemoizedMarkdownBlock";const Ea=t=>{const e=G.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=fe.lexer(r),e[0]=r,e[1]=i):i=e[1];const a=i;let s;if(e[2]!==a||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?m.jsx(zx,{language:o.lang,content:o.text},`${n}-block_${l}`):m.jsx(ic,{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};Ea.displayName="MemoizedMarkdown";function ac(t){const e=G.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}=Eh(),[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=me("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(Ea,{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(Bi,{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 $x(t){const e=G.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(mu,{code:i,language:"json",height:"100%",readOnly:!0})}),e[2]=i,e[3]=a):a=e[3],a}function uu(t){const e=G.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(pu,{className:"size-4 text-destructive shrink-0"}):m.jsx(jc,{className:me("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?(_=me("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=me("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(fu,{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(mu,{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($x,{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 Yx={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 qx(t){if(!t?.providerMetadata)return null;for(const e of Object.values(Yx)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function Vx(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+(qx(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function Wx(t){const e=G.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=Vx(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=_r;let z;e[13]===Symbol.for("react.memo_cache_sentinel")?(z=m.jsx(Eu,{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(yr,{asChild:!0,children:N}),e[14]=N,e[15]=h):h=e[15],r=Ar,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 Qx={planning:{icon:m.jsx(Cu,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves"},thinking:{icon:m.jsx(kr,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking"}},Gx=1200;function Xx(){const t=G.c(7),[e,n]=V.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},Gx);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),V.useEffect(r,i);const a=Qx[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 Zx(t){const e=G.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(Jx),g=h.some(Kx),_=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:me("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(kr,{className:"text-muted-foreground shrink-0 shimmer",size:14}):o?m.jsx(fu,{className:me("text-muted-foreground transition-transform shrink-0",d&&"rotate-90"),size:14}):m.jsx(yu,{className:"text-muted-foreground shrink-0",size:14}),m.jsx("span",{className:me("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(Ea,{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 Kx(t){return t.state==="streaming"}function Jx(t){return t.type==="reasoning"}function e3(t){const e=G.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(uu,{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(ac,{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(uu,{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 t3(t){const e=G.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(r3),e[10]=s,e[11]=E):E=e[11];const R=E;let O;e[12]!==l||e[13]!==s?(O=l&&s.some(n3),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(Wx,{messages:[n]}),e[15]=n,e[16]=B):B=e[16];const z=B;let N;e[17]!==i?(N=me("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(Zx,{duration:p,parts:s,id:a}),s.map(($,H)=>{const W=s[H+1],te=W&&(W.type==="dynamic-tool"||W.type.startsWith("tool-"));return m.jsx(e3,{part:$,id:a,usageStats:H===s.length-1?z:void 0,isFollowedByToolCall:te},`${a}-${H}`)})]}):l?m.jsx(Xx,{}):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 n3(t){return t.type==="reasoning"&&t.state==="streaming"}function r3(t){return t.type==="reasoning"}const sc=V.createContext(null);function uc(t){const e=G.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 i3(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 a3(t){const e=G.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===uc?E:null;const R=l?S.slice(0,-1):S,O=i3(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=sc.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(g={scrollToPair:v},e[12]=g):g=e[12],p=a,e[13]!==r?(h=me("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 s3(t){const e=G.c(5),{locator:n}=Ht(),r=wu(),i=Ui();let a;return e[0]!==n||e[1]!==r||e[2]!==t||e[3]!==i?(a=async(u,o,l)=>{const d=await Nu(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(u3),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 u3(t){return t.role!=="system"}function o3(t){const e=G.c(18),{messageId:n,parts:r}=t,[i,a]=V.useState(!1),{setInputValue:s,startBranch:u,setActiveThreadId:o,activeThreadId:l}=fh(),d=s3(o);let f;e[0]!==r?(f=r.filter(c3).map(l3).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(_r,{children:[m.jsx(yr,{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(xu,{size:16,className:"p-0.5"})})}),m.jsx(Ar,{side:"bottom",children:"Edit message"})]})}),e[10]=T):T=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=m.jsxs(zc,{children:[m.jsx($c,{children:"Edit message?"}),m.jsx(Yc,{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(qc,{children:"Cancel"}),e[12]=E):E=e[12];let R;e[13]!==y?(R=m.jsxs(Vc,{children:[S,m.jsxs(Wc,{children:[E,m.jsx(Qc,{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(Gc,{open:i,onOpenChange:a,children:R})]}),e[15]=i,e[16]=R,e[17]=O):O=e[17],O}function l3(t){return t.text}function c3(t){return t.type==="text"}function d3(t){const e=G.c(29),{message:n,className:r,pairIndex:i}=t,{id:a,parts:s}=n,u=V.useContext(sc),[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=me("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=me("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(ac,{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(o3,{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 f3(t,e){const n=G.c(4);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const i=r,a=t??Jc;let s;return n[2]!==a?(s=td(a),n[2]=a,n[3]=s):s=n[3],ed(a,"LLM",s,i)}function h3(){const t=G.c(8),e=nd();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=Nc(n),i=f3(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(p3),t[3]=r,t[4]=i,t[5]=a}else a=t[5];return a}function p3(t,e){return t.name.localeCompare(e.name)}const m3={reasoning:{icon:m.jsx(kr,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:m.jsx(_u,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:m.jsx(Xc,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:m.jsx(gu,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},oc=V.memo(function(e){const n=G.c(11),{capability:r}=e,i=m3[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(yr,{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(Ar,{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(_r,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=d):d=n[10],d}),ou=V.memo(function(e){const n=G.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(b3)}),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(vc,{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(Tu,{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(Au,{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}),g3=V.memo(function(e){const n=G.c(27),{model:r,onHover:i,isSelected:a,hasExpandedInfo:s}=e,u=s?"rounded-t-lg":"rounded-lg";let o;n[0]!==u?(o=me("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(T3)}),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 E3(t){const e=G.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 o_(t){const e=G.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),_=h3();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=ce=>ce.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 ce=_.find(_e=>_e.id===le);ce&&(r({id:ce.id,connectionId:ce.connectionId,provider:ce.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=me("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(E3,{model:E}),e[14]=E,e[15]=z):z=e[15];let N;e[16]!==o||e[17]!==z?(N=m.jsx(Mc,{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(Bc,{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?($=me("w-5 h-5 transition-colors",Z),e[24]=Z,e[25]=$):$=e[25];let H;e[26]!==$?(H=m.jsx(Zc,{className:$}),e[26]=$,e[27]=H):H=e[27];let W;e[28]!==P||e[29]!==H?(W=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]=W):W=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=ce=>m.jsxs("div",{onClick:()=>O(ce.id),className:me("rounded-lg mb-1",ce.id===T&&"bg-accent"),children:[m.jsx(g3,{model:ce,onHover:p,isSelected:ce.id===T,hasExpandedInfo:h}),h&&m.jsx("div",{className:"md:hidden",children:m.jsx(ou,{model:ce,compact:!0})})]},ce.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(ou,{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 pe;e[47]!==o||e[48]!==W||e[49]!==ae?(pe=m.jsx(Fc,{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:W,children:ae}),e[47]=o,e[48]=W,e[49]=ae,e[50]=pe):pe=e[50];let C;return e[51]!==O||e[52]!==l||e[53]!==F||e[54]!==pe||e[55]!==I?(C=m.jsxs(Uc,{open:l,onOpenChange:d,value:I,onValueChange:O,children:[F,pe]}),e[51]=O,e[52]=l,e[53]=F,e[54]=pe,e[55]=I,e[56]=C):C=e[56],C}function b3(t){return m.jsx(oc,{capability:t},t)}function T3(t){return m.jsx(oc,{capability:t},t)}function x3({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 lu(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 _3(t){const e=G.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=me("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 y3(t){const e=G.c(11),{children:n}=t;let r;e[0]!==n?(r=lu(n,lc),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==n?(a=lu(n,cc),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 lc(t){const e=G.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 cc(t){const e=G.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 A3(t){const e=G.c(5),{children:n,className:r}=t;let i;e[0]!==r?(i=me("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 k3(t){const e=G.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 C3(t){const e=G.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],x3(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(d3,{message:p},p.id):p.role==="assistant"?m.jsx(t3,{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(uc,{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(a3,{minHeightOffset:a,children:[o,l]}),e[9]=a,e[10]=o,e[11]=d):d=e[11],d}function I3(t){const e=G.c(3),{children:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=me("flex-none w-full mx-auto p-2","max-w-2xl min-w-0"),e[0]=r):r=e[0];let i;return e[1]!==n?(i=m.jsx("div",{className:r,children:n}),e[1]=n,e[2]=i):i=e[2],i}function ba(t){const e=G.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=me("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:me("mt-0.5 shrink-0",E.icon),children:i}),l="flex-1 min-w-0",d=n&&m.jsx("div",{className:me("text-xs mb-1",E.title),children:n}),f=r&&m.jsx("div",{className:me("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(Lc,{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 S3(t){const e=G.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(bu,{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(ba,{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 N3(t){const e=G.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(pu,{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(ba,{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 w3(t){const e=G.c(7),{finishReason:n,onContinue:r,onDismiss:i}=t;if(!n||n==="stop")return null;const s=R3(n);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx(Oc,{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(ba,{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 R3(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 l_=Object.assign(_3,{Header:Object.assign(y3,{Left:lc,Right:cc}),Main:A3,Messages:C3,EmptyState:k3,Footer:I3,Input:gh,BranchPreview:S3,ErrorBanner:N3,FinishReasonWarning:w3,Provider:ch});function c_({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=rd(),d=Ic(),f=async()=>{if(!r||!i){ka.error("Not authenticated");return}o(!0);try{const p=a?.find(_=>_.connection_url===ad);if(p){d({to:"/$org/mcps/$connectionId",params:{org:n,connectionId:p.id}});return}const h=sd({id:ud("conn")}),g=await l.create.mutateAsync(h);d({to:"/$org/mcps/$connectionId",params:{org:n,connectionId:g.id}})}catch(p){ka.error(`Failed to connect OpenRouter: ${p instanceof Error?p.message:String(p)}`)}finally{o(!1)}};return m.jsx(Kc,{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:id,alt:"OpenRouter",className:"size-4"}),u?"Installing...":"Install OpenRouter"]}),m.jsx(Ye,{variant:"outline",onClick:s,children:"Install MCP Server"})]})})}function O3(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 L3(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 d_(t){const e=G.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=L3(P);let $;e[19]!==s?($=K=>{K?s?.():d("")},e[19]=s,e[20]=$):$=e[20];const H=$;g=wc,h=_r,p=od,R=H,e[21]!==o?(O=m.jsx(yr,{asChild:!0,children:m.jsx(ld,{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(Ca,{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(Ca,{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(Ar,{children:"Chat history"}),e[23]=I):I=e[23],f=cd,T="end",S="w-80 p-0";let W;e[24]===Symbol.for("react.memo_cache_sentinel")?(W=m.jsx(gu,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=W):W=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:[W,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?O3(k.updated_at):null})]}),m.jsx("button",{type:"button",onClick:pe=>{pe.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(dd,{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{l_ as C,u_ as G,o_ as M,c_ as N,d_ as T,Wx as U,r_ as a,h3 as b,s_ as c,a_ as d,Ui as e,fh as u};
@@ -1 +1 @@
1
- import{K as B,j as t,c as O,f as Q,r as k}from"./index-BLgTJ8o3.js";import{u as U}from"./useQuery-DXchCtgN.js";import{i as W}from"./File06-CpSSTggW.js";import{i as Y}from"./Loading01-0wYmSKV6.js";import{e as J}from"./registry-utils-ulDDT0d8.js";import{C as P}from"./collection-display-button-2ZQ5sQTW.js";import{C as X}from"./collection-search-CM9rltH6.js";import{C as Z}from"./collection-table-wrapper-BRI7T6RJ.js";import{E as z}from"./SearchMd-D70t5LVP.js";import{I as ee}from"./use-connection-CsPrFY0x.js";import{C as te}from"./card-BnWpolEI.js";import{V as se}from"./layout-Dfp1nH3g.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 ve({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 Ce(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{ve as R,Ce as T};
1
+ import{K as B,j as t,c as O,f as Q,r as k}from"./index-B9fZ40p9.js";import{u as U}from"./useQuery-nlt5lRkW.js";import{i as W}from"./File06-DSeIH9xM.js";import{i as Y}from"./Loading01-B0dLQInZ.js";import{e as J}from"./registry-utils-ulDDT0d8.js";import{C as P}from"./collection-display-button-BVgPIpv0.js";import{C as X}from"./collection-search-s9G5Psps.js";import{C as Z}from"./collection-table-wrapper-Dnmr37nE.js";import{E as z}from"./SearchMd-BJbLhbUT.js";import{I as ee}from"./use-connection-9XNP6qUi.js";import{C as te}from"./card-ciO_SNWh.js";import{V as se}from"./layout-BgUF9JkX.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 ve({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 Ce(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{ve as R,Ce as T};