cortex-react-components 2.18.6 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/{chunk-MFUZNS7C.mjs → chunk-2BRDNDUB.mjs} +1 -1
  2. package/dist/{chunk-JSHD7QTU.mjs → chunk-2YULWG5F.mjs} +1 -1
  3. package/dist/{chunk-QILFMWE5.mjs → chunk-3HNU2NYP.mjs} +1 -1
  4. package/dist/{chunk-GO42W2BM.mjs → chunk-3NRXQBBS.mjs} +1 -1
  5. package/dist/{chunk-MEVSHOG4.mjs → chunk-3Y7QG6VP.mjs} +1 -1
  6. package/dist/{chunk-YWRU7OE3.mjs → chunk-5MWZTJYP.mjs} +1 -1
  7. package/dist/{chunk-XYJ4S67W.mjs → chunk-6MSM3CZ6.mjs} +1 -1
  8. package/dist/{chunk-CTC6WSB6.mjs → chunk-75F3LJMX.mjs} +1 -1
  9. package/dist/{chunk-33CHGT4N.mjs → chunk-7R47MHQE.mjs} +1 -1
  10. package/dist/{chunk-PAEL4O5F.mjs → chunk-AEACICA7.mjs} +1 -1
  11. package/dist/{chunk-RMZLEIRP.mjs → chunk-AJQHGVZ5.mjs} +1 -1
  12. package/dist/{chunk-VQBOJHZF.mjs → chunk-C4RWEPVF.mjs} +1 -1
  13. package/dist/{chunk-3EGSOIRH.mjs → chunk-CXOVEABI.mjs} +1 -1
  14. package/dist/{chunk-CCJJAUGB.mjs → chunk-EM3T2XYC.mjs} +1 -1
  15. package/dist/{chunk-347B45ZS.mjs → chunk-EPJJKGCG.mjs} +1 -1
  16. package/dist/{chunk-JNJJAJPI.mjs → chunk-FE7ZGUPU.mjs} +1 -1
  17. package/dist/{chunk-YPSUDHCJ.mjs → chunk-GHOL5L32.mjs} +1 -1
  18. package/dist/chunk-GLARGNXX.mjs +4 -0
  19. package/dist/{chunk-JEWBD2UD.mjs → chunk-GTZDHELR.mjs} +1 -1
  20. package/dist/{chunk-R33MOMFK.mjs → chunk-GTZJWMZR.mjs} +1 -1
  21. package/dist/{chunk-4DR4ILAP.mjs → chunk-H7NKR2WR.mjs} +1 -1
  22. package/dist/chunk-HEKQ55BA.mjs +4 -0
  23. package/dist/{chunk-H5VFV6Q4.mjs → chunk-LJXTXROJ.mjs} +1 -1
  24. package/dist/chunk-MTA6RFZ7.mjs +1 -0
  25. package/dist/{chunk-6EKGV4I2.mjs → chunk-NINFDOV5.mjs} +1 -1
  26. package/dist/chunk-PLOUY2B7.mjs +4 -0
  27. package/dist/{chunk-MGSTQLZC.mjs → chunk-RGOKBIQ5.mjs} +1 -1
  28. package/dist/{chunk-HLTP3ZQN.mjs → chunk-RJGYVDOU.mjs} +1 -1
  29. package/dist/chunk-SH5SK6V2.mjs +1 -0
  30. package/dist/{chunk-UTRR5NUU.mjs → chunk-TVTTUSWM.mjs} +1 -1
  31. package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
  32. package/dist/{chunk-WAVVCASZ.mjs → chunk-UJITFLIZ.mjs} +1 -1
  33. package/dist/chunk-W2LPR7SX.mjs +1 -0
  34. package/dist/{chunk-ANCSWAD7.mjs → chunk-WIRQ5IRT.mjs} +1 -1
  35. package/dist/{chunk-QZIJTAPO.mjs → chunk-ZEALRBXW.mjs} +1 -1
  36. package/dist/components/Blocks/Banner.mjs +1 -1
  37. package/dist/components/Blocks/CallToAction.mjs +1 -1
  38. package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
  39. package/dist/components/Blocks/Content.mjs +1 -1
  40. package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
  41. package/dist/components/Blocks/RelatedPosts.mjs +1 -1
  42. package/dist/components/Blocks/RenderBlocks.mjs +1 -1
  43. package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
  44. package/dist/components/Blocks/index.mjs +1 -1
  45. package/dist/components/Cards/ContentCard.mjs +1 -1
  46. package/dist/components/Cards/FeatureCard.mjs +1 -1
  47. package/dist/components/Cards/index.mjs +1 -1
  48. package/dist/components/Chat/ChatInterface.js +6 -6
  49. package/dist/components/Chat/ChatInterface.mjs +1 -1
  50. package/dist/components/Chat/CopilotInterface.js +3 -3
  51. package/dist/components/Chat/CopilotInterface.mjs +1 -1
  52. package/dist/components/Chat/PartTypes/MessageHandler.js +5 -5
  53. package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
  54. package/dist/components/Chat/PartTypes/PartApprovalTool.js +4 -4
  55. package/dist/components/Chat/PartTypes/PartApprovalTool.mjs +1 -1
  56. package/dist/components/Chat/PartTypes/PartAuthenticateTool.d.ts +2 -1
  57. package/dist/components/Chat/PartTypes/PartAuthenticateTool.js +3 -3
  58. package/dist/components/Chat/PartTypes/PartAuthenticateTool.mjs +1 -1
  59. package/dist/components/Chat/PartTypes/index.js +6 -6
  60. package/dist/components/Chat/PartTypes/index.mjs +1 -1
  61. package/dist/components/Chat/demo-long-messages.js +11 -11
  62. package/dist/components/Chat/demo-long-messages.mjs +1 -1
  63. package/dist/components/Chat/demo-tests.js +32 -32
  64. package/dist/components/Chat/demo-tests.mjs +1 -1
  65. package/dist/components/Chat/demo.js +3 -3
  66. package/dist/components/Chat/demo.mjs +1 -1
  67. package/dist/components/Chat/example-usage.js +3 -3
  68. package/dist/components/Chat/example-usage.mjs +1 -1
  69. package/dist/components/Chat/example-with-vercel-ai.js +3 -3
  70. package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
  71. package/dist/components/Chat/index.js +4 -4
  72. package/dist/components/Chat/index.mjs +1 -1
  73. package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
  74. package/dist/components/DigitalColleagues/index.mjs +1 -1
  75. package/dist/components/Foundary/Knowledge/add-knowledge-modal.js +1 -1
  76. package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
  77. package/dist/components/Foundary/MainPage.mjs +1 -1
  78. package/dist/components/Foundary/Pages/dashboardpage.js +1 -1
  79. package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
  80. package/dist/components/Foundary/Views/KnowledgeView.js +1 -2
  81. package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
  82. package/dist/components/Foundary/Views/index.js +1 -1
  83. package/dist/components/Foundary/Views/index.mjs +1 -1
  84. package/dist/components/Foundary/document-edit.js +1 -1
  85. package/dist/components/Foundary/document-edit.mjs +1 -1
  86. package/dist/components/Foundary/document-preview-examples.js +5 -5
  87. package/dist/components/Foundary/document-preview-examples.mjs +1 -1
  88. package/dist/components/Foundary/document-preview.js +1 -1
  89. package/dist/components/Foundary/document-preview.mjs +1 -1
  90. package/dist/components/Foundary/index.js +1 -1
  91. package/dist/components/Foundary/index.mjs +1 -1
  92. package/dist/components/Foundary/knowledge-browser.js +1 -1
  93. package/dist/components/Foundary/knowledge-browser.mjs +1 -1
  94. package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
  95. package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
  96. package/dist/components/HeaderFooter/index.mjs +1 -1
  97. package/dist/components/Heros/HighImpact/index.mjs +1 -1
  98. package/dist/components/Heros/LowImpact/index.mjs +1 -1
  99. package/dist/components/Heros/MediumImpact/index.mjs +1 -1
  100. package/dist/components/Heros/RenderHero.mjs +1 -1
  101. package/dist/components/Heros/SectionHero/index.mjs +1 -1
  102. package/dist/components/Heros/index.mjs +1 -1
  103. package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
  104. package/dist/components/Layouts/Print.mjs +1 -1
  105. package/dist/components/Layouts/SlideShow.mjs +1 -1
  106. package/dist/components/Layouts/index.mjs +1 -1
  107. package/dist/components/Other/index.mjs +1 -1
  108. package/dist/components/Payload/RichText/index.mjs +1 -1
  109. package/dist/components/Payload/RichText/serialize.mjs +1 -1
  110. package/dist/components/Payload/index.mjs +1 -1
  111. package/dist/components/index.js +20 -20
  112. package/dist/components/index.mjs +1 -1
  113. package/dist/globals.css +1 -1
  114. package/dist/index.js +25 -25
  115. package/dist/index.mjs +1 -1
  116. package/dist/metafile-cjs.json +1 -1
  117. package/dist/metafile-esm.json +1 -1
  118. package/dist/pages/Blog.mjs +1 -1
  119. package/dist/pages/Documentation.mjs +1 -1
  120. package/dist/pages/IndexPage.mjs +1 -1
  121. package/dist/pages/Intranet.mjs +1 -1
  122. package/dist/pages/LandingPage.mjs +1 -1
  123. package/dist/pages/Page.mjs +1 -1
  124. package/dist/pages/Publish.mjs +1 -1
  125. package/dist/pages/Website.mjs +1 -1
  126. package/dist/sections/AboutSection.mjs +1 -1
  127. package/dist/sections/BlogDetail.mjs +1 -1
  128. package/dist/sections/BlogList.mjs +1 -1
  129. package/dist/sections/BlogListSection.mjs +1 -1
  130. package/dist/sections/ContactSection.mjs +1 -1
  131. package/dist/sections/PageSections.mjs +1 -1
  132. package/dist/sections/PricingSection.mjs +1 -1
  133. package/dist/sections/ServiceDetail.mjs +1 -1
  134. package/dist/sections/ServiceDetailSection.mjs +1 -1
  135. package/dist/sections/ServiceSection.mjs +1 -1
  136. package/dist/sections/form/index.mjs +1 -1
  137. package/dist/sections/index.mjs +1 -1
  138. package/package.json +1 -1
  139. package/dist/chunk-3DZFESHK.mjs +0 -4
  140. package/dist/chunk-3F6AUCZF.mjs +0 -1
  141. package/dist/chunk-3ZQFJ5WD.mjs +0 -4
  142. package/dist/chunk-HHPTGV4F.mjs +0 -4
  143. package/dist/chunk-V5VE3EIY.mjs +0 -1
  144. package/dist/chunk-WRZP5K5X.mjs +0 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";import{a}from"../../chunk-JSHD7QTU.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-WAVVCASZ.mjs";import"../../chunk-347B45ZS.mjs";import"../../chunk-WRZP5K5X.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as CopilotInterface};
2
+ "use strict";import{a}from"../../chunk-2YULWG5F.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-UJITFLIZ.mjs";import"../../chunk-EPJJKGCG.mjs";import"../../chunk-MTA6RFZ7.mjs";import"../../chunk-SH5SK6V2.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as CopilotInterface};
@@ -2,19 +2,19 @@
2
2
  "use strict";
3
3
  'use client';
4
4
 
5
- "use strict";var kt=Object.create;var de=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var St=(e,t)=>{for(var o in t)de(e,o,{get:t[o],enumerable:!0})},je=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pt(t))!At.call(e,a)&&a!==o&&de(e,a,{get:()=>t[a],enumerable:!(s=Tt(t,a))||s.enumerable});return e};var ee=(e,t,o)=>(o=e!=null?kt(Rt(e)):{},je(t||!e||!e.__esModule?de(o,"default",{value:e,enumerable:!0}):o,e)),Mt=e=>je(de({},"__esModule",{value:!0}),e);var Co={};St(Co,{messageHandler:()=>yo});module.exports=Mt(Co);var Fe=ee(require("react"));var Ce=require("react"),I=require("react/jsx-runtime"),Ue=({isOpen:e=!0,authUrl:t,onClose:o,onSuccess:s,description:a="This endpoint requires authentication to sync functions."})=>{let[n,r]=(0,Ce.useState)(!1),[i,d]=(0,Ce.useState)(""),p=()=>{if(!t){d("No authentication URL provided");return}r(!0),d("");try{let u=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!u){d("Popup blocked. Please allow popups for this site and try again."),r(!1);return}let g=setInterval(()=>{try{u.closed&&(clearInterval(g),r(!1),s(),o())}catch{}},1e3);setTimeout(()=>{u.closed||(u.close(),clearInterval(g),r(!1),d("Authentication timed out. Please try again."))},6e5)}catch{d("Failed to open authentication window"),r(!1)}},f=async()=>{try{await navigator.clipboard.writeText(t),d("")}catch{d("Failed to copy URL to clipboard")}};return e?(0,I.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,I.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,I.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,I.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:a}),i&&(0,I.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:i}),(0,I.jsxs)("div",{className:"flex gap-2",children:[(0,I.jsx)("button",{onClick:p,disabled:n||!t,className:`
5
+ "use strict";var kt=Object.create;var de=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var At=(e,t)=>{for(var o in t)de(e,o,{get:t[o],enumerable:!0})},Ge=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pt(t))!Lt.call(e,s)&&s!==o&&de(e,s,{get:()=>t[s],enumerable:!(a=Tt(t,s))||a.enumerable});return e};var ee=(e,t,o)=>(o=e!=null?kt(Rt(e)):{},Ge(t||!e||!e.__esModule?de(o,"default",{value:e,enumerable:!0}):o,e)),Mt=e=>Ge(de({},"__esModule",{value:!0}),e);var Co={};At(Co,{messageHandler:()=>yo});module.exports=Mt(Co);var Ue=ee(require("react"));var Ce=require("react"),I=require("react/jsx-runtime"),We=({isOpen:e=!0,authUrl:t,onClose:o,onSuccess:a,description:s="This endpoint requires authentication to sync functions."})=>{let[n,r]=(0,Ce.useState)(!1),[i,d]=(0,Ce.useState)(""),p=()=>{if(!t){d("No authentication URL provided");return}r(!0),d("");try{let u=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!u){d("Popup blocked. Please allow popups for this site and try again."),r(!1);return}let f=setInterval(()=>{try{u.closed&&(clearInterval(f),r(!1),a(),o())}catch{}},1e3);setTimeout(()=>{u.closed||(u.close(),clearInterval(f),r(!1),d("Authentication timed out. Please try again."))},6e5)}catch{d("Failed to open authentication window"),r(!1)}},b=async()=>{try{await navigator.clipboard.writeText(t),d("")}catch{d("Failed to copy URL to clipboard")}};return e?(0,I.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,I.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,I.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,I.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:s}),i&&(0,I.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:i}),(0,I.jsxs)("div",{className:"flex gap-2",children:[(0,I.jsx)("button",{onClick:p,disabled:n||!t,className:`
6
6
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
7
7
  ${n||!t?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
8
- `,children:n?"Authenticating...":"Authenticate"}),(0,I.jsx)("button",{onClick:f,disabled:!t,className:`
8
+ `,children:n?"Authenticating...":"Authenticate"}),(0,I.jsx)("button",{onClick:b,disabled:!t,className:`
9
9
  px-4 py-2 text-white border-none rounded text-sm
10
10
  ${t?"bg-blue-600 hover:bg-blue-700 cursor-pointer":"bg-gray-400 cursor-not-allowed"}
11
- `,children:"Copy URL"}),(0,I.jsx)("button",{onClick:o,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var we=({toolPart:e,index:t,addToolResult:o})=>{let[s,a]=Fe.default.useState(!0),n=()=>{o(e.input?.toolCallId,e.input?.tool,"Authentication completed"),a(!1)};switch(e.state){case"input-available":return(0,I.jsxs)("div",{className:"mb-2",children:[(0,I.jsx)(Ue,{isOpen:s,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>a(!1),onSuccess:n,description:e.output?.reason||e.input?.reason}),!s&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var Ne=ee(require("react"));var We=({isOpen:e=!0,reason:t,onClose:o,onApprove:s,onDeny:a,title:n="Approval Required"})=>{let[r,i]=(0,Ce.useState)(!1),d=()=>{i(!0),s(),o()},p=()=>{i(!0),a(),o()},f=()=>{i(!0),a(),o()};return e?(0,I.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,I.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:n}),(0,I.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:t}),(0,I.jsxs)("div",{className:"flex gap-2",children:[(0,I.jsx)("button",{onClick:d,disabled:r,className:`
11
+ `,children:"Copy URL"}),(0,I.jsx)("button",{onClick:o,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var we=({toolPart:e,index:t,addToolResult:o})=>{let[a,s]=Ue.default.useState(!0),n=()=>{o(e.toolCallId,e.type,"Authentication completed"),s(!1)};switch(e.state){case"input-available":return(0,I.jsxs)("div",{className:"mb-2",children:[(0,I.jsx)(We,{isOpen:a,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>s(!1),onSuccess:n,description:e.output?.reason||e.input?.reason}),!a&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);case"output-available":return(0,I.jsx)(I.Fragment,{children:e.output==="Authentication completed"?(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})}):(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Authentication failed"]})})});default:return null}};var Ne=ee(require("react"));var Ve=({isOpen:e=!0,reason:t,onClose:o,onApprove:a,onDeny:s,title:n="Approval Required"})=>{let[r,i]=(0,Ce.useState)(!1),d=()=>{i(!0),a(),o()},p=()=>{i(!0),s(),o()},b=()=>{i(!0),s(),o()};return e?(0,I.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,I.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:n}),(0,I.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:t}),(0,I.jsxs)("div",{className:"flex gap-2",children:[(0,I.jsx)("button",{onClick:d,disabled:r,className:`
12
12
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
13
13
  ${r?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
14
14
  `,children:r?"Processing...":"Approve"}),(0,I.jsx)("button",{onClick:p,disabled:r,className:`
15
15
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
16
16
  ${r?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700 cursor-pointer"}
17
- `,children:r?"Processing...":"Deny"}),(0,I.jsx)("button",{onClick:f,disabled:r,className:`
17
+ `,children:r?"Processing...":"Deny"}),(0,I.jsx)("button",{onClick:b,disabled:r,className:`
18
18
  px-4 py-2 text-white border-none rounded text-sm
19
19
  ${r?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
20
- `,children:"Cancel"})]})]}):null};var $e=({toolPart:e,index:t,addToolResult:o})=>{let[s,a]=Ne.default.useState(!0),[n,r]=Ne.default.useState(null),i=()=>{o(e.toolCallId,e.type,"Approved"),a(!1),r("approve")},d=()=>{o(e.toolCallId,e.type,"Denied"),a(!1),r("deny")};switch(e.state){case"input-available":return(0,I.jsxs)("div",{className:"mb-2",children:[(0,I.jsx)(We,{isOpen:s,onApprove:i,onDeny:d,onClose:()=>a(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!s&&(0,I.jsxs)(I.Fragment,{children:[n==="approve"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),n==="deny"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var Re=require("@radix-ui/react-use-controllable-state");var q=ee(require("@radix-ui/react-collapsible")),ce=q.Root,pe=q.CollapsibleTrigger,ue=q.CollapsibleContent;var et=require("clsx");var Pe="-",It=e=>{let t=zt(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:r=>{let i=r.split(Pe);return i[0]===""&&i.length!==1&&i.shift(),Je(i,t)||Lt(r)},getConflictingClassGroupIds:(r,i)=>{let d=o[r]||[];return i&&s[r]?[...d,...s[r]]:d}}},Je=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],s=t.nextPart.get(o),a=s?Je(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;let n=e.join(Pe);return t.validators.find(({validator:r})=>r(n))?.classGroupId},_e=/^\[(.+)\]$/,Lt=e=>{if(_e.test(e)){let t=_e.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},zt=e=>{let{theme:t,prefix:o}=e,s={nextPart:new Map,validators:[]};return Dt(Object.entries(e.classGroups),o).forEach(([n,r])=>{Te(r,s,n,t)}),s},Te=(e,t,o,s)=>{e.forEach(a=>{if(typeof a=="string"){let n=a===""?t:qe(t,a);n.classGroupId=o;return}if(typeof a=="function"){if(Et(a)){Te(a(s),t,o,s);return}t.validators.push({validator:a,classGroupId:o});return}Object.entries(a).forEach(([n,r])=>{Te(r,qe(t,n),o,s)})})},qe=(e,t)=>{let o=e;return t.split(Pe).forEach(s=>{o.nextPart.has(s)||o.nextPart.set(s,{nextPart:new Map,validators:[]}),o=o.nextPart.get(s)}),o},Et=e=>e.isThemeGetter,Dt=(e,t)=>t?e.map(([o,s])=>{let a=s.map(n=>typeof n=="string"?t+n:typeof n=="object"?Object.fromEntries(Object.entries(n).map(([r,i])=>[t+r,i])):n);return[o,a]}):e,Bt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,s=new Map,a=(n,r)=>{o.set(n,r),t++,t>e&&(t=0,s=o,o=new Map)};return{get(n){let r=o.get(n);if(r!==void 0)return r;if((r=s.get(n))!==void 0)return a(n,r),r},set(n,r){o.has(n)?o.set(n,r):a(n,r)}}},Xe="!",Ht=e=>{let{separator:t,experimentalParseClassName:o}=e,s=t.length===1,a=t[0],n=t.length,r=i=>{let d=[],p=0,f=0,u;for(let v=0;v<i.length;v++){let w=i[v];if(p===0){if(w===a&&(s||i.slice(v,v+n)===t)){d.push(i.slice(f,v)),f=v+n;continue}if(w==="/"){u=v;continue}}w==="["?p++:w==="]"&&p--}let g=d.length===0?i:i.substring(f),C=g.startsWith(Xe),k=C?g.substring(1):g,y=u&&u>f?u-f:void 0;return{modifiers:d,hasImportantModifier:C,baseClassName:k,maybePostfixModifierPosition:y}};return o?i=>o({className:i,parseClassName:r}):r},Ot=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(s=>{s[0]==="["?(t.push(...o.sort(),s),o=[]):o.push(s)}),t.push(...o.sort()),t},Gt=e=>({cache:Bt(e.cacheSize),parseClassName:Ht(e),...It(e)}),jt=/\s+/,Ut=(e,t)=>{let{parseClassName:o,getClassGroupId:s,getConflictingClassGroupIds:a}=t,n=[],r=e.trim().split(jt),i="";for(let d=r.length-1;d>=0;d-=1){let p=r[d],{modifiers:f,hasImportantModifier:u,baseClassName:g,maybePostfixModifierPosition:C}=o(p),k=!!C,y=s(k?g.substring(0,C):g);if(!y){if(!k){i=p+(i.length>0?" "+i:i);continue}if(y=s(g),!y){i=p+(i.length>0?" "+i:i);continue}k=!1}let v=Ot(f).join(":"),w=u?v+Xe:v,S=w+y;if(n.includes(S))continue;n.push(S);let Z=a(y,k);for(let W=0;W<Z.length;++W){let se=Z[W];n.push(w+se)}i=p+(i.length>0?" "+i:i)}return i};function Ft(){let e=0,t,o,s="";for(;e<arguments.length;)(t=arguments[e++])&&(o=Ke(t))&&(s&&(s+=" "),s+=o);return s}var Ke=e=>{if(typeof e=="string")return e;let t,o="";for(let s=0;s<e.length;s++)e[s]&&(t=Ke(e[s]))&&(o&&(o+=" "),o+=t);return o};function Vt(e,...t){let o,s,a,n=r;function r(d){let p=t.reduce((f,u)=>u(f),e());return o=Gt(p),s=o.cache.get,a=o.cache.set,n=i,i(d)}function i(d){let p=s(d);if(p)return p;let f=Ut(d,o);return a(d,f),f}return function(){return n(Ft.apply(null,arguments))}}var b=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},Ye=/^\[(?:([a-z-]+):)?(.+)\]$/i,Wt=/^\d+\/\d+$/,$t=new Set(["px","full","screen"]),_t=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|me|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|I|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Jt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Xt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)I-?((\d+)?\.?(\d+)[a-z]+|0)/,Kt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,O=e=>J(e)||$t.has(e)||Wt.test(e),U=e=>X(e,"length",no),J=e=>!!e&&!Number.isNaN(Number(e)),ke=e=>X(e,"number",J),te=e=>!!e&&Number.isInteger(Number(e)),Yt=e=>e.endsWith("%")&&J(e.slice(0,-1)),c=e=>Ye.test(e),F=e=>_t.test(e),Zt=new Set(["length","size","percentage"]),Qt=e=>X(e,Zt,Ze),eo=e=>X(e,"position",Ze),to=new Set(["image","url"]),oo=e=>X(e,to,so),ro=e=>X(e,"",ao),oe=()=>!0,X=(e,t,o)=>{let s=Ye.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):o(s[2]):!1},no=e=>qt.test(e)&&!Jt.test(e),Ze=()=>!1,ao=e=>Xt.test(e),so=e=>Kt.test(e);var io=()=>{let e=b("colors"),t=b("spacing"),o=b("blur"),s=b("brightness"),a=b("borderColor"),n=b("borderRadius"),r=b("borderSpacing"),i=b("borderWidth"),d=b("contrast"),p=b("grayscale"),f=b("hueRotate"),u=b("invert"),g=b("gap"),C=b("gradientColorStops"),k=b("gradientColorStopPositions"),y=b("inset"),v=b("margin"),w=b("opacity"),S=b("padding"),Z=b("saturate"),W=b("scale"),se=b("sepia"),ze=b("skew"),Ee=b("space"),De=b("translate"),he=()=>["auto","contain","none"],xe=()=>["auto","hidden","clip","visible","scroll"],ve=()=>["auto",c,t],x=()=>[c,t],Be=()=>["",O,U],ie=()=>["auto",J,c],He=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],le=()=>["solid","dashed","dotted","double","none"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",c],Ge=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[J,c];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[O,U],blur:["none","",F,c],brightness:D(),borderColor:[e],borderRadius:["none","","full",F,c],borderSpacing:x(),borderWidth:Be(),contrast:D(),grayscale:Q(),hueRotate:D(),invert:Q(),gap:x(),gradientColorStops:[e],gradientColorStopPositions:[Yt,U],inset:ve(),margin:ve(),opacity:D(),padding:x(),saturate:D(),scale:D(),sepia:Q(),skew:D(),space:x(),translate:x()},classGroups:{aspect:[{aspect:["auto","square","video",c]}],container:["container"],columns:[{columns:[F]}],"break-after":[{"break-after":Ge()}],"break-before":[{"break-before":Ge()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...He(),c]}],overflow:[{overflow:xe()}],"overflow-x":[{"overflow-x":xe()}],"overflow-y":[{"overflow-y":xe()}],overscroll:[{overscroll:he()}],"overscroll-x":[{"overscroll-x":he()}],"overscroll-y":[{"overscroll-y":he()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",te,c]}],basis:[{basis:ve()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",c]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",te,c]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",te,c]},c]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[te,c]},c]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",c]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",c]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ye()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ye(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ye(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],me:[{me:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[Ee]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Ee]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",c,t]}],"min-w":[{"min-w":[c,t,"min","max","fit"]}],"max-w":[{"max-w":[c,t,"none","full","min","max","fit","prose",{screen:[F]},F]}],I:[{I:[c,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-I":[{"min-I":[c,t,"min","max","fit","svh","lvh","dvh"]}],"max-I":[{"max-I":[c,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[c,t,"auto","min","max","fit"]}],"font-size":[{text:["base",F,U]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ke]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",c]}],"line-clamp":[{"line-clamp":["none",J,ke]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",O,c]}],"list-image":[{"list-image":["none",c]}],"list-style-type":[{list:["none","disc","decimal",c]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",O,U]}],"underline-offset":[{"underline-offset":["auto",O,c]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",c]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",c]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...He(),eo]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Qt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","I","tl"]},oo]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[C]}],"gradient-via":[{via:[C]}],"gradient-to":[{to:[C]}],rounded:[{rounded:[n]}],"rounded-s":[{"rounded-s":[n]}],"rounded-e":[{"rounded-e":[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-I":[{"rounded-I":[n]}],"rounded-ss":[{"rounded-ss":[n]}],"rounded-se":[{"rounded-se":[n]}],"rounded-ee":[{"rounded-ee":[n]}],"rounded-es":[{"rounded-es":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-I":[{"border-I":[i]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...le(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:le()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-I":[{"border-I":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...le()]}],"outline-offset":[{"outline-offset":[O,c]}],"outline-w":[{outline:[O,U]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[O,U]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",F,ro]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Oe()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[s]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",F,c]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[se]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[r]}],"border-spacing-x":[{"border-spacing-x":[r]}],"border-spacing-y":[{"border-spacing-y":[r]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",c]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",c]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",c]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[W]}],"scale-x":[{"scale-x":[W]}],"scale-y":[{"scale-y":[W]}],rotate:[{rotate:[te,c]}],"translate-x":[{"translate-x":[De]}],"translate-y":[{"translate-y":[De]}],"skew-x":[{"skew-x":[ze]}],"skew-y":[{"skew-y":[ze]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",c]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",c]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",c]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[O,U,ke]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","me","pr","pb","pl"],px:["pr","pl"],py:["me","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","I"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-I","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-I":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-I"],"border-w-x":["border-w-r","border-w-I"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-I"],"border-color-x":["border-color-r","border-color-I"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-me","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-me","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var Qe=Vt(io);function m(...e){return Qe((0,et.clsx)(e))}var me=require("lucide-react");var ot=require("streamdown"),re=(0,Ce.memo)(({className:e,...t})=>(0,I.jsx)(ot.Streamdown,{className:m("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);re.displayName="Response";var nt=(0,Ce.createContext)(null),lo=()=>{let e=(0,Ce.useContext)(nt);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},co=1e3,po=1e3,Ae=(0,Ce.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:s=!0,onOpenChange:a,duration:n,children:r,...i})=>{let[d,p]=(0,Re.useControllableState)({prop:o,defaultProp:s,onChange:a}),[f,u]=(0,Re.useControllableState)({prop:n,defaultProp:0}),[g,C]=(0,Ce.useState)(!1),[k,y]=(0,Ce.useState)(null);(0,Ce.useEffect)(()=>{t?k===null&&y(Date.now()):k!==null&&(u(Math.ceil((Date.now()-k)/po)),y(null))},[t,k,u]),(0,Ce.useEffect)(()=>{if(s&&!t&&d&&!g){let w=setTimeout(()=>{p(!1),C(!0)},co);return()=>clearTimeout(w)}},[t,d,s,p,g]);let v=w=>{p(w)};return(0,I.jsx)(nt.Provider,{value:{isStreaming:t,isOpen:d,setIsOpen:p,duration:f},children:(0,I.jsx)(ce,{className:m("not-prose mb-4",e),onOpenChange:v,open:d,...i,children:r})})}),uo=(e,t)=>e||t===0?(0,I.jsx)("p",{children:"Thinking..."}):t===void 0?(0,I.jsx)("p",{children:"Thought for a few seconds"}):(0,I.jsxs)("p",{children:["Thought for ",t," seconds"]}),Se=(0,Ce.memo)(({className:e,children:t,...o})=>{let{isStreaming:s,isOpen:a,duration:n}=lo();return(0,I.jsx)(pe,{className:m("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(me.BrainIcon,{className:"size-4"}),uo(s,n),(0,I.jsx)(me.ChevronDownIcon,{className:m("size-4 transition-transform",a?"rotate-180":"rotate-0")})]})})}),Me=(0,Ce.memo)(({className:e,children:t,...o})=>(0,I.jsx)(ue,{className:m("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,I.jsx)(re,{className:"grid gap-2",children:t})}));Ae.displayName="Reasoning";Se.displayName="ReasoningTrigger";Me.displayName="ReasoningContent";var at=require("class-variance-authority");var mo=(0,at.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function K({className:e,variant:t,...o}){return(0,I.jsx)("div",{className:m(mo({variant:t}),e),...o})}var it=require("@radix-ui/react-slot"),dt=ee(require("react")),go=(0,at.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"I-10 px-4 py-2",icon:"I-10 w-10",lg:"I-11 rounded px-8",sm:"I-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),ne=dt.forwardRef(({asChild:e=!1,className:t,size:o,variant:s,...a},n)=>(0,I.jsx)(e?it.Slot:"button",{className:m(go({className:t,size:o,variant:s})),ref:n,...a}));ne.displayName="Button";var Ie=require("react-syntax-highlighter"),fe=require("react-syntax-highlighter/dist/esm/styles/prism"),fo=(0,Ce.createContext)({code:""}),be=({code:e,language:t,showLineNumbers:o=!1,className:s,children:a,...n})=>(0,I.jsx)(fo.Provider,{value:{code:e},children:(0,I.jsx)("div",{className:m("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",s),...n,children:(0,I.jsxs)("div",{className:"relative",children:[(0,I.jsx)(Ie.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:fe.oneLight,children:e}),(0,I.jsx)(Ie.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:fe.oneDark,children:e}),a&&(0,I.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:a})]})})});var ut=({className:e,...t})=>(0,I.jsx)(ce,{className:m("not-prose mb-4 w-full",e),...t}),bo=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,I.jsxs)(K,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,I.jsx)(me.CircleIcon,{className:"size-4"}),"input-available":(0,I.jsx)(me.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,I.jsx)(me.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,I.jsx)(me.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},mt=({className:e,type:t,state:o,...s})=>(0,I.jsxs)(pe,{className:m("flex w-full items-center justify-between gap-4 p-3 pl-0 w-2xl",e),...s,children:[(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[(0,I.jsx)(me.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,I.jsx)("span",{className:"font-medium text-sm",children:t}),bo(o)]}),(0,I.jsx)(me.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),gt=({className:e,...t})=>(0,I.jsx)(ue,{className:m("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),ft=({className:e,input:t,...o})=>(0,I.jsxs)("div",{className:m("space-y-2 overflow-hidden p-4",e),...o,children:[(0,I.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,I.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,I.jsx)(be,{code:JSON.stringify(t,null,2),language:"json"})})]}),bt=({className:e,output:t,errorText:o,...s})=>{if(!(t||o))return null;let a=(0,I.jsx)("div",{children:t});return typeof t=="object"?a=(0,I.jsx)(be,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a=(0,I.jsx)(be,{code:t,language:"json"})),(0,I.jsxs)("div",{className:m("space-y-2 p-4",e),...s,children:[(0,I.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,I.jsxs)("div",{className:m("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,I.jsx)("div",{children:o}),a]})]})};var $=ee(require("react"));var L=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("rounded-xl border bg-card text-card-foreground shadow",e),...t}));L.displayName="Card";var G=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("flex flex-col space-y-1.5 p-6",e),...t}));G.displayName="CardHeader";var j=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("font-semibold leading-none tracking-tight",e),...t}));j.displayName="CardTitle";var Le=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("text-sm text-muted-foreground",e),...t}));Le.displayName="CardDescription";var z=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("p-6 me-0",e),...t}));z.displayName="CardContent";var ae=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("flex items-center p-6 me-0",e),...t}));ae.displayName="CardFooter";var vt=require("date-fns");function ht({taskId:e,polling:t=!0,system:o="payload"}){let[s,a]=(0,Ce.useState)(null),[n,r]=(0,Ce.useState)(!1),[i,d]=(0,Ce.useState)(null),p=async(u=!0)=>{if(e){u&&r(!0);try{let g=await fetch(`/api/tasks/${e}`);if(!g.ok)throw new Error(`Failed to fetch task: ${g.statusText}`);let C=await g.json();a(C)}catch(g){console.error("Error fetching task:",g),d(g instanceof Error?g:new Error("Unknown error occurred"))}finally{u&&r(!1)}}},f=()=>p(!1);return(0,Ce.useEffect)(()=>{e&&p(!0);let u=null;return e&&t&&(u=setInterval(f,5e3)),()=>{u&&clearInterval(u)}},[e,t]),{task:s,loading:n,error:i}}var ho=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},xo=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function yt({data:e}){let{id:t,system:o,fetchLatest:s,taskData:a,error:n}=e||{};if(!t)return null;let r=null,i=!0,d=n,p=s!==void 0?s:!0;if(r=a||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:s,system:o,fetchLatest:p,taskData:r,error:d}),p){let{task:C,loading:k,error:y}=ht({taskId:t,system:o});r=C,i=k,d=y}else i=!1;let f=ho(r?.status||"todo"),u=xo(r?.status||"todo"),g=r?.dateLogged||new Date().toISOString();try{let C=new Date(r?.dateLogged||"");isNaN(C.getTime())||(g=(0,vt.formatDistanceToNow)(C,{addSuffix:!0}))}catch{}return(0,I.jsxs)(L,{className:m("w-full max-w-md shadow-md",d&&"border border-destructive"),children:[(0,I.jsxs)(G,{className:"pb-2",children:[(0,I.jsxs)("div",{className:"flex justify-between items-start",children:[(0,I.jsx)(j,{className:"text-lg font-semibold",children:i?"Loading...":r?.name||"Task"}),(0,I.jsx)(K,{className:`${f}`,children:u})]}),r?.project&&(0,I.jsxs)(Le,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,I.jsx)(z,{className:"pb-2",children:i?(0,I.jsx)("div",{className:"animate-pulse I-4 bg-gray-200 rounded w-3/4 mb-2"}):d?(0,I.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,I.jsx)("p",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,I.jsx)(ae,{className:"me-2 flex items-center justify-between",children:(0,I.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,I.jsx)(me.Clock,{className:"I-3 w-3 mr-1"}),(0,I.jsxs)("span",{children:["Created ",g]}),(0,I.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,I.jsxs)("span",{children:["Task #",t]})]})})]})}function Nt({artefact:e,taskId:t,taskData:o,loading:s=!1,error:a=null}){let n=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=n.dateLogged;try{let i=new Date(n.dateLogged);isNaN(i.getTime())||(r=(0,vt.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,I.jsxs)(L,{className:"w-full max-w-md shadow-md",children:[(0,I.jsx)(G,{className:"pb-2",children:(0,I.jsx)("div",{className:"flex justify-between items-start",children:(0,I.jsx)(j,{className:"text-lg font-semibold",children:s?"Loading...":n.name})})}),(0,I.jsx)(z,{className:"pb-2",children:s?(0,I.jsx)("div",{className:"animate-pulse I-4 bg-gray-200 rounded w-3/4 mb-2"}):a?(0,I.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,I.jsx)("p",{className:"text-sm text-foreground",children:e})}),(0,I.jsx)(ae,{className:"me-2 flex items-center justify-between",children:(0,I.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,I.jsx)(me.Clock,{className:"I-3 w-3 mr-1"}),(0,I.jsxs)("span",{children:["Created ",r]}),(0,I.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,I.jsxs)("span",{children:["Task #",n.id]})]})})]})}var vo=e=>e.startsWith("image/")?(0,I.jsx)(me.Image,{className:"I-4 w-4"}):e.startsWith("text/")?(0,I.jsx)(me.FileText,{className:"I-4 w-4"}):(0,I.jsx)(me.File,{className:"I-4 w-4"}),yo=({message:e,addToolResult:t,status:o,messages:s})=>e.parts.map((a,n)=>{if(a.type==="text")return(0,I.jsx)(re,{children:a.text},`${n}`);if(a.type==="file"){let r=a;return(0,I.jsx)("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[vo(r.mediaType||"application/octet-stream"),(0,I.jsx)("div",{className:"flex-1 min-w-0",children:(0,I.jsx)("p",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,I.jsx)(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"I-8 w-8 p-0",children:(0,I.jsx)(me.Download,{className:"I-4 w-4"})})]})},n)}if(a.type.startsWith("tool-")){let r=a,i=a.type.replace("tool-","");if(i==="task")switch(r.state){case"input-available":return(0,I.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},n);case"output-available":return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(yt,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},n);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},n);default:return null}if(a.type==="tool-requestEndpointLogin")return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(we,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(a.type==="tool-authenticate")return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(we,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(a.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",r),(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)($e,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(i==="artefact")switch(r.state){case"input-available":return(0,I.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},n);case"output-available":return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(Nt,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},n);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},n);default:return null}return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(L,{className:"w-full max-w-md",children:[(0,I.jsx)(G,{children:(0,I.jsx)(j,{className:"text-lg",children:i})}),(0,I.jsxs)(z,{children:[r.state==="input-available"&&(0,I.jsxs)("p",{className:"text-sm",children:["Processing ",i,"..."]}),r.state==="output-available"&&(0,I.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,I.jsxs)("p",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},n)}if(a.type.startsWith("data-")){let r=a,i=a.type.replace("data-","");return i==="reference"?(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(L,{className:"w-full",children:(0,I.jsx)(z,{className:"p-4",children:(0,I.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((d,p)=>(0,I.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted/50",children:[(0,I.jsx)(K,{variant:"outline",children:d.type||"link"}),(0,I.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,I.jsx)("p",{className:"text-sm font-medium truncate",children:d.title}),d.description&&(0,I.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:d.description})]}),d.url&&(0,I.jsx)(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(d.url,"_blank"),className:"I-8 w-8 p-0",children:(0,I.jsx)(me.ExternalLink,{className:"I-4 w-4"})})]},p))})})})},n):i==="menu"?(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(L,{className:"w-full",children:[(0,I.jsx)(G,{children:(0,I.jsx)(j,{className:"text-lg",children:r.data?.title})}),(0,I.jsx)(z,{children:(0,I.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((d,p)=>(0,I.jsx)(ne,{variant:"outline",className:"w-full justify-start",onClick:d.action,children:(0,I.jsxs)("div",{className:"text-left",children:[(0,I.jsx)("p",{className:"font-medium",children:d.label}),d.description&&(0,I.jsx)("p",{className:"text-xs text-muted-foreground",children:d.description})]})},p))})})]})},n):(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(L,{className:"w-full max-w-md",children:[(0,I.jsx)(G,{children:(0,I.jsx)(j,{className:"text-lg",children:i})}),(0,I.jsx)(z,{children:(0,I.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},n)}if(a.type==="reasoning")return(0,I.jsxs)(Ae,{className:"w-full",isStreaming:o==="streaming"&&n===e.parts.length-1&&e.id===s.at(-1)?.id,children:[(0,I.jsx)(Se,{}),(0,I.jsx)(Me,{children:a.text})]},`${n}`);if(a.type==="dynamic-tool")return(0,I.jsxs)(ut,{defaultOpen:a.state!=="output-available",children:[(0,I.jsx)(mt,{type:`tool-${a.toolName}`,state:a.state}),(0,I.jsxs)(gt,{children:[(0,I.jsx)(ft,{input:a.input}),(0,I.jsx)(bt,{output:a.output,errorText:a.errorText})]})]},`${e.id}-${n}`)});0&&(module.exports={messageHandler});
20
+ `,children:"Cancel"})]})]}):null};var $e=({toolPart:e,index:t,addToolResult:o})=>{let[a,s]=Ne.default.useState(!0),[n,r]=Ne.default.useState(null),i=()=>{o(e.toolCallId,e.type,"Approved"),s(!1),r("approve")},d=()=>{o(e.toolCallId,e.type,"Denied"),s(!1),r("deny")};switch(e.state){case"input-available":return(0,I.jsxs)("div",{className:"mb-2",children:[(0,I.jsx)(Ve,{isOpen:a,onApprove:i,onDeny:d,onClose:()=>s(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,I.jsxs)(I.Fragment,{children:[n==="approve"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),n==="deny"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);case"output-available":return(0,I.jsxs)(I.Fragment,{children:[e.output==="approve"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),e.output==="deny"&&(0,I.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,I.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,I.jsx)("svg",{className:"I-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,I.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]});default:return null}};var Re=require("@radix-ui/react-use-controllable-state");var q=ee(require("@radix-ui/react-collapsible")),ce=q.Root,pe=q.CollapsibleTrigger,ue=q.CollapsibleContent;var et=require("clsx");var Pe="-",St=e=>{let t=zt(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:r=>{let i=r.split(Pe);return i[0]===""&&i.length!==1&&i.shift(),Je(i,t)||It(r)},getConflictingClassGroupIds:(r,i)=>{let d=o[r]||[];return i&&a[r]?[...d,...a[r]]:d}}},Je=(e,t)=>{if(e.length===0)return t.classGroupId;let o=e[0],a=t.nextPart.get(o),s=a?Je(e.slice(1),a):void 0;if(s)return s;if(t.validators.length===0)return;let n=e.join(Pe);return t.validators.find(({validator:r})=>r(n))?.classGroupId},_e=/^\[(.+)\]$/,It=e=>{if(_e.test(e)){let t=_e.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},zt=e=>{let{theme:t,prefix:o}=e,a={nextPart:new Map,validators:[]};return Bt(Object.entries(e.classGroups),o).forEach(([n,r])=>{Te(r,a,n,t)}),a},Te=(e,t,o,a)=>{e.forEach(s=>{if(typeof s=="string"){let n=s===""?t:qe(t,s);n.classGroupId=o;return}if(typeof s=="function"){if(Et(s)){Te(s(a),t,o,a);return}t.validators.push({validator:s,classGroupId:o});return}Object.entries(s).forEach(([n,r])=>{Te(r,qe(t,n),o,a)})})},qe=(e,t)=>{let o=e;return t.split(Pe).forEach(a=>{o.nextPart.has(a)||o.nextPart.set(a,{nextPart:new Map,validators:[]}),o=o.nextPart.get(a)}),o},Et=e=>e.isThemeGetter,Bt=(e,t)=>t?e.map(([o,a])=>{let s=a.map(n=>typeof n=="string"?t+n:typeof n=="object"?Object.fromEntries(Object.entries(n).map(([r,i])=>[t+r,i])):n);return[o,s]}):e,Dt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,a=new Map,s=(n,r)=>{o.set(n,r),t++,t>e&&(t=0,a=o,o=new Map)};return{get(n){let r=o.get(n);if(r!==void 0)return r;if((r=a.get(n))!==void 0)return s(n,r),r},set(n,r){o.has(n)?o.set(n,r):s(n,r)}}},Xe="!",Ht=e=>{let{separator:t,experimentalParseClassName:o}=e,a=t.length===1,s=t[0],n=t.length,r=i=>{let d=[],p=0,b=0,u;for(let y=0;y<i.length;y++){let N=i[y];if(p===0){if(N===s&&(a||i.slice(y,y+n)===t)){d.push(i.slice(b,y)),b=y+n;continue}if(N==="/"){u=y;continue}}N==="["?p++:N==="]"&&p--}let f=d.length===0?i:i.substring(b),w=f.startsWith(Xe),P=w?f.substring(1):f,C=u&&u>b?u-b:void 0;return{modifiers:d,hasImportantModifier:w,baseClassName:P,maybePostfixModifierPosition:C}};return o?i=>o({className:i,parseClassName:r}):r},Ot=e=>{if(e.length<=1)return e;let t=[],o=[];return e.forEach(a=>{a[0]==="["?(t.push(...o.sort(),a),o=[]):o.push(a)}),t.push(...o.sort()),t},jt=e=>({cache:Dt(e.cacheSize),parseClassName:Ht(e),...St(e)}),Gt=/\s+/,Wt=(e,t)=>{let{parseClassName:o,getClassGroupId:a,getConflictingClassGroupIds:s}=t,n=[],r=e.trim().split(Gt),i="";for(let d=r.length-1;d>=0;d-=1){let p=r[d],{modifiers:b,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:w}=o(p),P=!!w,C=a(P?f.substring(0,w):f);if(!C){if(!P){i=p+(i.length>0?" "+i:i);continue}if(C=a(f),!C){i=p+(i.length>0?" "+i:i);continue}P=!1}let y=Ot(b).join(":"),N=u?y+Xe:y,M=N+C;if(n.includes(M))continue;n.push(M);let Z=s(C,P);for(let V=0;V<Z.length;++V){let ae=Z[V];n.push(N+ae)}i=p+(i.length>0?" "+i:i)}return i};function Ut(){let e=0,t,o,a="";for(;e<arguments.length;)(t=arguments[e++])&&(o=Ke(t))&&(a&&(a+=" "),a+=o);return a}var Ke=e=>{if(typeof e=="string")return e;let t,o="";for(let a=0;a<e.length;a++)e[a]&&(t=Ke(e[a]))&&(o&&(o+=" "),o+=t);return o};function Ft(e,...t){let o,a,s,n=r;function r(d){let p=t.reduce((b,u)=>u(b),e());return o=jt(p),a=o.cache.get,s=o.cache.set,n=i,i(d)}function i(d){let p=a(d);if(p)return p;let b=Wt(d,o);return s(d,b),b}return function(){return n(Ut.apply(null,arguments))}}var x=e=>{let t=o=>o[e]||[];return t.isThemeGetter=!0,t},Ye=/^\[(?:([a-z-]+):)?(.+)\]$/i,Vt=/^\d+\/\d+$/,$t=new Set(["px","full","screen"]),_t=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|me|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|I|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Jt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Xt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)I-?((\d+)?\.?(\d+)[a-z]+|0)/,Kt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,O=e=>J(e)||$t.has(e)||Vt.test(e),W=e=>X(e,"length",no),J=e=>!!e&&!Number.isNaN(Number(e)),ke=e=>X(e,"number",J),te=e=>!!e&&Number.isInteger(Number(e)),Yt=e=>e.endsWith("%")&&J(e.slice(0,-1)),c=e=>Ye.test(e),U=e=>_t.test(e),Zt=new Set(["length","size","percentage"]),Qt=e=>X(e,Zt,Ze),eo=e=>X(e,"position",Ze),to=new Set(["image","url"]),oo=e=>X(e,to,ao),ro=e=>X(e,"",so),oe=()=>!0,X=(e,t,o)=>{let a=Ye.exec(e);return a?a[1]?typeof t=="string"?a[1]===t:t.has(a[1]):o(a[2]):!1},no=e=>qt.test(e)&&!Jt.test(e),Ze=()=>!1,so=e=>Xt.test(e),ao=e=>Kt.test(e);var io=()=>{let e=x("colors"),t=x("spacing"),o=x("blur"),a=x("brightness"),s=x("borderColor"),n=x("borderRadius"),r=x("borderSpacing"),i=x("borderWidth"),d=x("contrast"),p=x("grayscale"),b=x("hueRotate"),u=x("invert"),f=x("gap"),w=x("gradientColorStops"),P=x("gradientColorStopPositions"),C=x("inset"),y=x("margin"),N=x("opacity"),M=x("padding"),Z=x("saturate"),V=x("scale"),ae=x("sepia"),ze=x("skew"),Ee=x("space"),Be=x("translate"),xe=()=>["auto","contain","none"],he=()=>["auto","hidden","clip","visible","scroll"],ve=()=>["auto",c,t],v=()=>[c,t],De=()=>["",O,W],ie=()=>["auto",J,c],He=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],le=()=>["solid","dashed","dotted","double","none"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",c],je=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[J,c];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[O,W],blur:["none","",U,c],brightness:D(),borderColor:[e],borderRadius:["none","","full",U,c],borderSpacing:v(),borderWidth:De(),contrast:D(),grayscale:Q(),hueRotate:D(),invert:Q(),gap:v(),gradientColorStops:[e],gradientColorStopPositions:[Yt,W],inset:ve(),margin:ve(),opacity:D(),padding:v(),saturate:D(),scale:D(),sepia:Q(),skew:D(),space:v(),translate:v()},classGroups:{aspect:[{aspect:["auto","square","video",c]}],container:["container"],columns:[{columns:[U]}],"break-after":[{"break-after":je()}],"break-before":[{"break-before":je()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...He(),c]}],overflow:[{overflow:he()}],"overflow-x":[{"overflow-x":he()}],"overflow-y":[{"overflow-y":he()}],overscroll:[{overscroll:xe()}],"overscroll-x":[{"overscroll-x":xe()}],"overscroll-y":[{"overscroll-y":xe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",te,c]}],basis:[{basis:ve()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",c]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",te,c]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",te,c]},c]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[te,c]},c]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",c]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",c]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ye()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ye(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ye(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],me:[{me:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[Ee]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Ee]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",c,t]}],"min-w":[{"min-w":[c,t,"min","max","fit"]}],"max-w":[{"max-w":[c,t,"none","full","min","max","fit","prose",{screen:[U]},U]}],I:[{I:[c,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-I":[{"min-I":[c,t,"min","max","fit","svh","lvh","dvh"]}],"max-I":[{"max-I":[c,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[c,t,"auto","min","max","fit"]}],"font-size":[{text:["base",U,W]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ke]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",c]}],"line-clamp":[{"line-clamp":["none",J,ke]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",O,c]}],"list-image":[{"list-image":["none",c]}],"list-style-type":[{list:["none","disc","decimal",c]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",O,W]}],"underline-offset":[{"underline-offset":["auto",O,c]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",c]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",c]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...He(),eo]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Qt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","I","tl"]},oo]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[P]}],"gradient-via-pos":[{via:[P]}],"gradient-to-pos":[{to:[P]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],rounded:[{rounded:[n]}],"rounded-s":[{"rounded-s":[n]}],"rounded-e":[{"rounded-e":[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-I":[{"rounded-I":[n]}],"rounded-ss":[{"rounded-ss":[n]}],"rounded-se":[{"rounded-se":[n]}],"rounded-ee":[{"rounded-ee":[n]}],"rounded-es":[{"rounded-es":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-I":[{"border-I":[i]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...le(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:le()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-I":[{"border-I":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...le()]}],"outline-offset":[{"outline-offset":[O,c]}],"outline-w":[{outline:[O,W]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:De()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[O,W]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",U,ro]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Oe()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[a]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",U,c]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[u]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[ae]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[a]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[r]}],"border-spacing-x":[{"border-spacing-x":[r]}],"border-spacing-y":[{"border-spacing-y":[r]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",c]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",c]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",c]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[V]}],"scale-x":[{"scale-x":[V]}],"scale-y":[{"scale-y":[V]}],rotate:[{rotate:[te,c]}],"translate-x":[{"translate-x":[Be]}],"translate-y":[{"translate-y":[Be]}],"skew-x":[{"skew-x":[ze]}],"skew-y":[{"skew-y":[ze]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",c]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",c]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",c]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[O,W,ke]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","me","pr","pb","pl"],px:["pr","pl"],py:["me","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","I"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-I","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-I":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-I"],"border-w-x":["border-w-r","border-w-I"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-I"],"border-color-x":["border-color-r","border-color-I"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-me","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-me","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var Qe=Ft(io);function m(...e){return Qe((0,et.clsx)(e))}var me=require("lucide-react");var ot=require("streamdown"),re=(0,Ce.memo)(({className:e,...t})=>(0,I.jsx)(ot.Streamdown,{className:m("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);re.displayName="Response";var nt=(0,Ce.createContext)(null),lo=()=>{let e=(0,Ce.useContext)(nt);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},co=1e3,po=1e3,Le=(0,Ce.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:s,duration:n,children:r,...i})=>{let[d,p]=(0,Re.useControllableState)({prop:o,defaultProp:a,onChange:s}),[b,u]=(0,Re.useControllableState)({prop:n,defaultProp:0}),[f,w]=(0,Ce.useState)(!1),[P,C]=(0,Ce.useState)(null);(0,Ce.useEffect)(()=>{t?P===null&&C(Date.now()):P!==null&&(u(Math.ceil((Date.now()-P)/po)),C(null))},[t,P,u]),(0,Ce.useEffect)(()=>{if(a&&!t&&d&&!f){let N=setTimeout(()=>{p(!1),w(!0)},co);return()=>clearTimeout(N)}},[t,d,a,p,f]);let y=N=>{p(N)};return(0,I.jsx)(nt.Provider,{value:{isStreaming:t,isOpen:d,setIsOpen:p,duration:b},children:(0,I.jsx)(ce,{className:m("not-prose mb-4",e),onOpenChange:y,open:d,...i,children:r})})}),uo=(e,t)=>e||t===0?(0,I.jsx)("p",{children:"Thinking..."}):t===void 0?(0,I.jsx)("p",{children:"Thought for a few seconds"}):(0,I.jsxs)("p",{children:["Thought for ",t," seconds"]}),Ae=(0,Ce.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:s,duration:n}=lo();return(0,I.jsx)(pe,{className:m("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(me.BrainIcon,{className:"size-4"}),uo(a,n),(0,I.jsx)(me.ChevronDownIcon,{className:m("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),Me=(0,Ce.memo)(({className:e,children:t,...o})=>(0,I.jsx)(ue,{className:m("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,I.jsx)(re,{className:"grid gap-2",children:t})}));Le.displayName="Reasoning";Ae.displayName="ReasoningTrigger";Me.displayName="ReasoningContent";var st=require("class-variance-authority");var mo=(0,st.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function K({className:e,variant:t,...o}){return(0,I.jsx)("div",{className:m(mo({variant:t}),e),...o})}var it=require("@radix-ui/react-slot"),dt=ee(require("react")),fo=(0,st.cva)("inline-flex items-center justify-center whitespace-nowrap rounded text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{defaultVariants:{size:"default",variant:"default"},variants:{size:{clear:"",default:"I-10 px-4 py-2",icon:"I-10 w-10",lg:"I-11 rounded px-8",sm:"I-9 rounded px-3"},variant:{default:"bg-accent text-accent-foreground hover:bg-background hover:text-accent hover:border-accent hover:border",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-card hover:text-accent",link:"text-primary items-start justify-start underline-offset-4 hover:underline",outline:"border border-border bg-background hover:bg-card hover:text-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent"}}}),ne=dt.forwardRef(({asChild:e=!1,className:t,size:o,variant:a,...s},n)=>(0,I.jsx)(e?it.Slot:"button",{className:m(fo({className:t,size:o,variant:a})),ref:n,...s}));ne.displayName="Button";var Se=require("react-syntax-highlighter"),ge=require("react-syntax-highlighter/dist/esm/styles/prism"),go=(0,Ce.createContext)({code:""}),be=({code:e,language:t,showLineNumbers:o=!1,className:a,children:s,...n})=>(0,I.jsx)(go.Provider,{value:{code:e},children:(0,I.jsx)("div",{className:m("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...n,children:(0,I.jsxs)("div",{className:"relative",children:[(0,I.jsx)(Se.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:ge.oneLight,children:e}),(0,I.jsx)(Se.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:ge.oneDark,children:e}),s&&(0,I.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:s})]})})});var ut=({className:e,...t})=>(0,I.jsx)(ce,{className:m("not-prose mb-4 w-full",e),...t}),bo=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,I.jsxs)(K,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,I.jsx)(me.CircleIcon,{className:"size-4"}),"input-available":(0,I.jsx)(me.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,I.jsx)(me.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,I.jsx)(me.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},mt=({className:e,type:t,state:o,...a})=>(0,I.jsxs)(pe,{className:m("flex w-full items-center justify-between gap-4 p-3 pl-0 w-2xl",e),...a,children:[(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[(0,I.jsx)(me.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,I.jsx)("span",{className:"font-medium text-sm",children:t}),bo(o)]}),(0,I.jsx)(me.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),ft=({className:e,...t})=>(0,I.jsx)(ue,{className:m("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),gt=({className:e,input:t,...o})=>(0,I.jsxs)("div",{className:m("space-y-2 overflow-hidden p-4",e),...o,children:[(0,I.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,I.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,I.jsx)(be,{code:JSON.stringify(t,null,2),language:"json"})})]}),bt=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let s=(0,I.jsx)("div",{children:t});return typeof t=="object"?s=(0,I.jsx)(be,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(s=(0,I.jsx)(be,{code:t,language:"json"})),(0,I.jsxs)("div",{className:m("space-y-2 p-4",e),...a,children:[(0,I.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,I.jsxs)("div",{className:m("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,I.jsx)("div",{children:o}),s]})]})};var $=ee(require("react"));var z=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("rounded-xl border bg-card text-card-foreground shadow",e),...t}));z.displayName="Card";var j=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("flex flex-col space-y-1.5 p-6",e),...t}));j.displayName="CardHeader";var G=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("font-semibold leading-none tracking-tight",e),...t}));G.displayName="CardTitle";var Ie=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("text-sm text-muted-foreground",e),...t}));Ie.displayName="CardDescription";var E=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("p-6 me-0",e),...t}));E.displayName="CardContent";var se=$.forwardRef(({className:e,...t},o)=>(0,I.jsx)("div",{ref:o,className:m("flex items-center p-6 me-0",e),...t}));se.displayName="CardFooter";var vt=require("date-fns");function xt({taskId:e,polling:t=!0,system:o="payload"}){let[a,s]=(0,Ce.useState)(null),[n,r]=(0,Ce.useState)(!1),[i,d]=(0,Ce.useState)(null),p=async(u=!0)=>{if(e){u&&r(!0);try{let f=await fetch(`/api/tasks/${e}`);if(!f.ok)throw new Error(`Failed to fetch task: ${f.statusText}`);let w=await f.json();s(w)}catch(f){console.error("Error fetching task:",f),d(f instanceof Error?f:new Error("Unknown error occurred"))}finally{u&&r(!1)}}},b=()=>p(!1);return(0,Ce.useEffect)(()=>{e&&p(!0);let u=null;return e&&t&&(u=setInterval(b,5e3)),()=>{u&&clearInterval(u)}},[e,t]),{task:a,loading:n,error:i}}var xo=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},ho=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function yt({data:e}){let{id:t,system:o,fetchLatest:a,taskData:s,error:n}=e||{};if(!t)return null;let r=null,i=!0,d=n,p=a!==void 0?a:!0;if(r=s||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:p,taskData:r,error:d}),p){let{task:w,loading:P,error:C}=xt({taskId:t,system:o});r=w,i=P,d=C}else i=!1;let b=xo(r?.status||"todo"),u=ho(r?.status||"todo"),f=r?.dateLogged||new Date().toISOString();try{let w=new Date(r?.dateLogged||"");isNaN(w.getTime())||(f=(0,vt.formatDistanceToNow)(w,{addSuffix:!0}))}catch{}return(0,I.jsxs)(z,{className:m("w-full max-w-md shadow-md",d&&"border border-destructive"),children:[(0,I.jsxs)(j,{className:"pb-2",children:[(0,I.jsxs)("div",{className:"flex justify-between items-start",children:[(0,I.jsx)(G,{className:"text-lg font-semibold",children:i?"Loading...":r?.name||"Task"}),(0,I.jsx)(K,{className:`${b}`,children:u})]}),r?.project&&(0,I.jsxs)(Ie,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,I.jsx)(E,{className:"pb-2",children:i?(0,I.jsx)("div",{className:"animate-pulse I-4 bg-gray-200 rounded w-3/4 mb-2"}):d?(0,I.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,I.jsx)("p",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,I.jsx)(se,{className:"me-2 flex items-center justify-between",children:(0,I.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,I.jsx)(me.Clock,{className:"I-3 w-3 mr-1"}),(0,I.jsxs)("span",{children:["Created ",f]}),(0,I.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,I.jsxs)("span",{children:["Task #",t]})]})})]})}function Nt({artefact:e,taskId:t,taskData:o,loading:a=!1,error:s=null}){let n=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=n.dateLogged;try{let i=new Date(n.dateLogged);isNaN(i.getTime())||(r=(0,vt.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,I.jsxs)(z,{className:"w-full max-w-md shadow-md",children:[(0,I.jsx)(j,{className:"pb-2",children:(0,I.jsx)("div",{className:"flex justify-between items-start",children:(0,I.jsx)(G,{className:"text-lg font-semibold",children:a?"Loading...":n.name})})}),(0,I.jsx)(E,{className:"pb-2",children:a?(0,I.jsx)("div",{className:"animate-pulse I-4 bg-gray-200 rounded w-3/4 mb-2"}):s?(0,I.jsx)("p",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,I.jsx)("p",{className:"text-sm text-foreground",children:e})}),(0,I.jsx)(se,{className:"me-2 flex items-center justify-between",children:(0,I.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,I.jsx)(me.Clock,{className:"I-3 w-3 mr-1"}),(0,I.jsxs)("span",{children:["Created ",r]}),(0,I.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,I.jsxs)("span",{children:["Task #",n.id]})]})})]})}var vo=e=>e.startsWith("image/")?(0,I.jsx)(me.Image,{className:"I-4 w-4"}):e.startsWith("text/")?(0,I.jsx)(me.FileText,{className:"I-4 w-4"}):(0,I.jsx)(me.File,{className:"I-4 w-4"}),yo=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((s,n)=>{if(s.type==="text")return(0,I.jsx)(re,{children:s.text},`${n}`);if(s.type==="file"){let r=s;return(0,I.jsx)("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[vo(r.mediaType||"application/octet-stream"),(0,I.jsx)("div",{className:"flex-1 min-w-0",children:(0,I.jsx)("p",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,I.jsx)(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"I-8 w-8 p-0",children:(0,I.jsx)(me.Download,{className:"I-4 w-4"})})]})},n)}if(s.type.startsWith("tool-")){let r=s,i=s.type.replace("tool-","");if(i==="task")switch(r.state){case"input-available":return(0,I.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},n);case"output-available":return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(yt,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},n);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},n);default:return null}if(s.type==="tool-requestEndpointLogin")return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(we,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(s.type==="tool-authenticate")return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(we,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(s.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",r),(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)($e,{toolPart:r,index:n,addToolResult:t??(()=>{})})},n);if(i==="artefact")switch(r.state){case"input-available":return(0,I.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},n);case"output-available":return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(Nt,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},n);case"output-error":return(0,I.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},n);default:return null}return(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(z,{className:"w-full max-w-md",children:[(0,I.jsx)(j,{children:(0,I.jsx)(G,{className:"text-lg",children:i})}),(0,I.jsxs)(E,{children:[r.state==="input-available"&&(0,I.jsxs)("p",{className:"text-sm",children:["Processing ",i,"..."]}),r.state==="output-available"&&(0,I.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,I.jsxs)("p",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},n)}if(s.type.startsWith("data-")){let r=s,i=s.type.replace("data-","");return i==="reference"?(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsx)(z,{className:"w-full",children:(0,I.jsx)(E,{className:"p-4",children:(0,I.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((d,p)=>(0,I.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted/50",children:[(0,I.jsx)(K,{variant:"outline",children:d.type||"link"}),(0,I.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,I.jsx)("p",{className:"text-sm font-medium truncate",children:d.title}),d.description&&(0,I.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:d.description})]}),d.url&&(0,I.jsx)(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(d.url,"_blank"),className:"I-8 w-8 p-0",children:(0,I.jsx)(me.ExternalLink,{className:"I-4 w-4"})})]},p))})})})},n):i==="menu"?(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(z,{className:"w-full",children:[(0,I.jsx)(j,{children:(0,I.jsx)(G,{className:"text-lg",children:r.data?.title})}),(0,I.jsx)(E,{children:(0,I.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((d,p)=>(0,I.jsx)(ne,{variant:"outline",className:"w-full justify-start",onClick:d.action,children:(0,I.jsxs)("div",{className:"text-left",children:[(0,I.jsx)("p",{className:"font-medium",children:d.label}),d.description&&(0,I.jsx)("p",{className:"text-xs text-muted-foreground",children:d.description})]})},p))})})]})},n):(0,I.jsx)("div",{className:"mb-2",children:(0,I.jsxs)(z,{className:"w-full max-w-md",children:[(0,I.jsx)(j,{children:(0,I.jsx)(G,{className:"text-lg",children:i})}),(0,I.jsx)(E,{children:(0,I.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},n)}if(s.type==="reasoning")return(0,I.jsxs)(Le,{className:"w-full",isStreaming:o==="streaming"&&n===e.parts.length-1&&e.id===a.I(-1)?.id,children:[(0,I.jsx)(Ae,{}),(0,I.jsx)(Me,{children:s.text})]},`${n}`);if(s.type==="dynamic-tool")return(0,I.jsxs)(ut,{defaultOpen:s.state!=="output-available",children:[(0,I.jsx)(mt,{type:`tool-${s.toolName}`,state:s.state}),(0,I.jsxs)(ft,{children:[(0,I.jsx)(gt,{input:s.input}),(0,I.jsx)(bt,{output:s.output,errorText:s.errorText})]})]},`${e.id}-${n}`)});0&&(module.exports={messageHandler});
@@ -1 +1 @@
1
- import{a}from"../../../chunk-347B45ZS.mjs";import"../../../chunk-WRZP5K5X.mjs";import"../../../chunk-V5VE3EIY.mjs";import"../../../chunk-6OCLRAHU.mjs";import"../../../chunk-5Y6FKL5W.mjs";import"../../../chunk-EW6KWAHS.mjs";import"../../../chunk-7JDMW5R3.mjs";import"../../../chunk-6OT5PQXV.mjs";import"../../../chunk-YPZAYXNQ.mjs";import"../../../chunk-QM5FOQHG.mjs";import"../../../chunk-UA2E23AS.mjs";import"../../../chunk-RL6365DN.mjs";import"../../../chunk-LTTO57ZK.mjs";import"../../../chunk-YNCJATT7.mjs";import"../../../chunk-ZUA4KNIR.mjs";import"../../../chunk-CSBGSBEU.mjs";import"../../../chunk-YO3GQYRJ.mjs";import"../../../chunk-EGEO3FNE.mjs";import"../../../chunk-MDJREBVI.mjs";import"../../../chunk-ZWHGOTSF.mjs";import"../../../chunk-Q3G5UAAD.mjs";import"../../../chunk-XGRRLABA.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as messageHandler};
1
+ import{a}from"../../../chunk-EPJJKGCG.mjs";import"../../../chunk-MTA6RFZ7.mjs";import"../../../chunk-SH5SK6V2.mjs";import"../../../chunk-6OCLRAHU.mjs";import"../../../chunk-5Y6FKL5W.mjs";import"../../../chunk-EW6KWAHS.mjs";import"../../../chunk-7JDMW5R3.mjs";import"../../../chunk-UA2E23AS.mjs";import"../../../chunk-6OT5PQXV.mjs";import"../../../chunk-YPZAYXNQ.mjs";import"../../../chunk-QM5FOQHG.mjs";import"../../../chunk-RL6365DN.mjs";import"../../../chunk-LTTO57ZK.mjs";import"../../../chunk-YNCJATT7.mjs";import"../../../chunk-ZUA4KNIR.mjs";import"../../../chunk-CSBGSBEU.mjs";import"../../../chunk-YO3GQYRJ.mjs";import"../../../chunk-EGEO3FNE.mjs";import"../../../chunk-MDJREBVI.mjs";import"../../../chunk-ZWHGOTSF.mjs";import"../../../chunk-Q3G5UAAD.mjs";import"../../../chunk-XGRRLABA.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as messageHandler};
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  "use strict";
3
3
 
4
- "use strict";var f=Object.create;var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var w=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},v=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!A.call(e,n)&&n!==o&&p(e,n,{get:()=>t[n],enumerable:!(l=y(t,n))||l.enumerable});return e};var C=(e,t,o)=>(o=e!=null?f(k(e)):{},v(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),N=e=>v(p({},"__esModule",{value:!0}),e);var T={};w(T,{PartApprovalTool:()=>R});module.exports=N(T);var c=C(require("react"));var m=require("react"),a=require("react/jsx-runtime"),g=({isOpen:e=!0,reason:t,onClose:o,onApprove:l,onDeny:n,title:d="Approval Required"})=>{let[s,i]=(0,m.useState)(!1),u=()=>{i(!0),l(),o()},b=()=>{i(!0),n(),o()},x=()=>{i(!0),n(),o()};return e?(0,a.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,a.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:d}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:t}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:u,disabled:s,className:`
4
+ "use strict";var f=Object.create;var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var w=(e,r)=>{for(var o in r)p(e,o,{get:r[o],enumerable:!0})},m=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of h(r))!N.call(e,n)&&n!==o&&p(e,n,{get:()=>r[n],enumerable:!(a=y(r,n))||a.enumerable});return e};var A=(e,r,o)=>(o=e!=null?f(k(e)):{},m(r||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>m(p({},"__esModule",{value:!0}),e);var L={};w(L,{PartApprovalTool:()=>R});module.exports=C(L);var c=A(require("react"));var v=require("react"),l=require("react/jsx-runtime"),g=({isOpen:e=!0,reason:r,onClose:o,onApprove:a,onDeny:n,title:d="Approval Required"})=>{let[s,i]=(0,v.useState)(!1),u=()=>{i(!0),a(),o()},b=()=>{i(!0),n(),o()},x=()=>{i(!0),n(),o()};return e?(0,l.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full shadow-lg",children:[(0,l.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:d}),(0,l.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:r}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{onClick:u,disabled:s,className:`
5
5
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
6
6
  ${s?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
7
- `,children:s?"Processing...":"Approve"}),(0,a.jsx)("button",{onClick:b,disabled:s,className:`
7
+ `,children:s?"Processing...":"Approve"}),(0,l.jsx)("button",{onClick:b,disabled:s,className:`
8
8
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
9
9
  ${s?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700 cursor-pointer"}
10
- `,children:s?"Processing...":"Deny"}),(0,a.jsx)("button",{onClick:x,disabled:s,className:`
10
+ `,children:s?"Processing...":"Deny"}),(0,l.jsx)("button",{onClick:x,disabled:s,className:`
11
11
  px-4 py-2 text-white border-none rounded text-sm
12
12
  ${s?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
13
- `,children:"Cancel"})]})]}):null};var R=({toolPart:e,index:t,addToolResult:o})=>{let[l,n]=c.default.useState(!0),[d,s]=c.default.useState(null),i=()=>{o(e.toolCallId,e.type,"Approved"),n(!1),s("approve")},u=()=>{o(e.toolCallId,e.type,"Denied"),n(!1),s("deny")};switch(e.state){case"input-available":return(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)(g,{isOpen:l,onApprove:i,onDeny:u,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!l&&(0,a.jsxs)(a.Fragment,{children:[d==="approve"&&(0,a.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,a.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,a.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),d==="deny"&&(0,a.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,a.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,a.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,a.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};0&&(module.exports={PartApprovalTool});
13
+ `,children:"Cancel"})]})]}):null};var R=({toolPart:e,index:r,addToolResult:o})=>{let[a,n]=c.default.useState(!0),[d,s]=c.default.useState(null),i=()=>{o(e.toolCallId,e.type,"Approved"),n(!1),s("approve")},u=()=>{o(e.toolCallId,e.type,"Denied"),n(!1),s("deny")};switch(e.state){case"input-available":return(0,l.jsxs)("div",{className:"mb-2",children:[(0,l.jsx)(g,{isOpen:a,onApprove:i,onDeny:u,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,l.jsxs)(l.Fragment,{children:[d==="approve"&&(0,l.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,l.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,l.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),d==="deny"&&(0,l.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,l.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,l.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},r);case"output-error":return(0,l.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},r);case"output-available":return(0,l.jsxs)(l.Fragment,{children:[e.output==="approve"&&(0,l.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,l.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,l.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),e.output==="deny"&&(0,l.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,l.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,l.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]});default:return null}};0&&(module.exports={PartApprovalTool});
@@ -1 +1 @@
1
- import{a}from"../../../chunk-WRZP5K5X.mjs";import"../../../chunk-6OT5PQXV.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as PartApprovalTool};
1
+ import{a}from"../../../chunk-MTA6RFZ7.mjs";import"../../../chunk-6OT5PQXV.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as PartApprovalTool};
@@ -1,6 +1,7 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  interface TaskToolPart {
3
3
  type: string;
4
+ toolCallId: string;
4
5
  state: 'input-available' | 'output-available' | 'output-error';
5
6
  input?: any;
6
7
  output?: any;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  "use strict";
3
3
 
4
- "use strict";var y=Object.create;var c=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},g=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!N.call(e,n)&&n!==o&&c(e,n,{get:()=>t[n],enumerable:!(a=w(t,n))||a.enumerable});return e};var C=(e,t,o)=>(o=e!=null?y(k(e)):{},g(t||!e||!e.__esModule?c(o,"default",{value:e,enumerable:!0}):o,e)),R=e=>g(c({},"__esModule",{value:!0}),e);var L={};A(L,{PartAuthenticateTool:()=>O});module.exports=R(L);var f=C(require("react"));var p=require("react"),r=require("react/jsx-runtime"),h=({isOpen:e=!0,authUrl:t,onClose:o,onSuccess:a,description:n="This endpoint requires authentication to sync functions."})=>{let[d,u]=(0,p.useState)(!1),[b,i]=(0,p.useState)(""),v=()=>{if(!t){i("No authentication URL provided");return}u(!0),i("");try{let l=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!l){i("Popup blocked. Please allow popups for this site and try again."),u(!1);return}let m=setInterval(()=>{try{l.closed&&(clearInterval(m),u(!1),a(),o())}catch{}},1e3);setTimeout(()=>{l.closed||(l.close(),clearInterval(m),u(!1),i("Authentication timed out. Please try again."))},6e5)}catch{i("Failed to open authentication window"),u(!1)}},x=async()=>{try{await navigator.clipboard.writeText(t),i("")}catch{i("Failed to copy URL to clipboard")}};return e?(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,r.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,r.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:n}),b&&(0,r.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:b}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:v,disabled:d||!t,className:`
4
+ "use strict";var y=Object.create;var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},g=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of k(t))!A.call(e,i)&&i!==r&&u(e,i,{get:()=>t[i],enumerable:!(s=w(t,i))||s.enumerable});return e};var T=(e,t,r)=>(r=e!=null?y(N(e)):{},g(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)),L=e=>g(u({},"__esModule",{value:!0}),e);var O={};C(O,{PartAuthenticateTool:()=>R});module.exports=L(O);var f=T(require("react"));var p=require("react"),n=require("react/jsx-runtime"),h=({isOpen:e=!0,authUrl:t,onClose:r,onSuccess:s,description:i="This endpoint requires authentication to sync functions."})=>{let[d,c]=(0,p.useState)(!1),[m,a]=(0,p.useState)(""),v=()=>{if(!t){a("No authentication URL provided");return}c(!0),a("");try{let l=window.open(t,"oauth-popup","width=600,height=700,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,status=no");if(!l){a("Popup blocked. Please allow popups for this site and try again."),c(!1);return}let b=setInterval(()=>{try{l.closed&&(clearInterval(b),c(!1),s(),r())}catch{}},1e3);setTimeout(()=>{l.closed||(l.close(),clearInterval(b),c(!1),a("Authentication timed out. Please try again."))},6e5)}catch{a("Failed to open authentication window"),c(!1)}},x=async()=>{try{await navigator.clipboard.writeText(t),a("")}catch{a("Failed to copy URL to clipboard")}};return e?(0,n.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[1000]",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-[90%] shadow-lg",children:[(0,n.jsx)("h3",{className:"text-lg font-bold mb-3 text-primary",children:"Authentication Required"}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:i}),m&&(0,n.jsx)("div",{className:"mb-4 p-2 bg-red-50 border border-red-200 rounded text-red-600 text-xs",children:m}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{onClick:v,disabled:d||!t,className:`
5
5
  px-4 py-2 text-white border-none rounded text-sm font-bold flex-1
6
6
  ${d||!t?"bg-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 cursor-pointer"}
7
- `,children:d?"Authenticating...":"Authenticate"}),(0,r.jsx)("button",{onClick:x,disabled:!t,className:`
7
+ `,children:d?"Authenticating...":"Authenticate"}),(0,n.jsx)("button",{onClick:x,disabled:!t,className:`
8
8
  px-4 py-2 text-white border-none rounded text-sm
9
9
  ${t?"bg-blue-600 hover:bg-blue-700 cursor-pointer":"bg-gray-400 cursor-not-allowed"}
10
- `,children:"Copy URL"}),(0,r.jsx)("button",{onClick:o,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var O=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=f.default.useState(!0),d=()=>{o(e.input?.toolCallId,e.input?.tool,"Authentication completed"),n(!1)};switch(e.state){case"input-available":return(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)(h,{isOpen:a,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>n(!1),onSuccess:d,description:e.output?.reason||e.input?.reason}),!a&&(0,r.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,r.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,r.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,r.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};0&&(module.exports={PartAuthenticateTool});
10
+ `,children:"Copy URL"}),(0,n.jsx)("button",{onClick:r,className:"px-4 py-2 bg-gray-500 hover:bg-gray-600 text-white border-none rounded text-sm cursor-pointer",children:"Cancel"})]})]})}):null};var R=({toolPart:e,index:t,addToolResult:r})=>{let[s,i]=f.default.useState(!0),d=()=>{r(e.toolCallId,e.type,"Authentication completed"),i(!1)};switch(e.state){case"input-available":return(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)(h,{isOpen:s,authUrl:e.input?.url||e.input?.authUrl,onClose:()=>i(!1),onSuccess:d,description:e.output?.reason||e.input?.reason}),!s&&(0,n.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,n.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,n.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})})]},t);case"output-error":return(0,n.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);case"output-available":return(0,n.jsx)(n.Fragment,{children:e.output==="Authentication completed"?(0,n.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,n.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,n.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Authentication completed"]})}):(0,n.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,n.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,n.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Authentication failed"]})})});default:return null}};0&&(module.exports={PartAuthenticateTool});
@@ -1 +1 @@
1
- import{a}from"../../../chunk-V5VE3EIY.mjs";import"../../../chunk-QM5FOQHG.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as PartAuthenticateTool};
1
+ import{a}from"../../../chunk-SH5SK6V2.mjs";import"../../../chunk-QM5FOQHG.mjs";import"../../../chunk-YEKQJ4YC.mjs";export{a as PartAuthenticateTool};