@jait/gateway 0.1.359 → 0.1.361

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 (59) hide show
  1. package/dist/routes/chat.d.ts.map +1 -1
  2. package/dist/routes/chat.js +7 -2
  3. package/dist/routes/chat.js.map +1 -1
  4. package/package.json +1 -1
  5. package/web-dist/assets/{_basePickBy-B6y4dQg2.js → _basePickBy-DIhL_HGn.js} +1 -1
  6. package/web-dist/assets/{_baseUniq-P0CNkgLx.js → _baseUniq-CUI7xvDV.js} +1 -1
  7. package/web-dist/assets/{arc-Dy_xAujl.js → arc-1t0orlFE.js} +1 -1
  8. package/web-dist/assets/{architectureDiagram-2XIMDMQ5-CcLgYlkC.js → architectureDiagram-2XIMDMQ5-twf4IxmH.js} +1 -1
  9. package/web-dist/assets/{blockDiagram-WCTKOSBZ-ChWaUHnl.js → blockDiagram-WCTKOSBZ-CxW58r1f.js} +1 -1
  10. package/web-dist/assets/{c4Diagram-IC4MRINW-DkzaHC9Y.js → c4Diagram-IC4MRINW-wZdR0BHp.js} +1 -1
  11. package/web-dist/assets/channel-BkXzbEIW.js +1 -0
  12. package/web-dist/assets/{chunk-4BX2VUAB-D5ZTy4L2.js → chunk-4BX2VUAB-DXqjwFjC.js} +1 -1
  13. package/web-dist/assets/{chunk-55IACEB6-Dy3a5FtR.js → chunk-55IACEB6-De-iDQxV.js} +1 -1
  14. package/web-dist/assets/{chunk-FMBD7UC4-DbcMpJ7m.js → chunk-FMBD7UC4-kcaU34bv.js} +1 -1
  15. package/web-dist/assets/{chunk-JSJVCQXG-BMQ-OrQN.js → chunk-JSJVCQXG-CXBV8wCe.js} +1 -1
  16. package/web-dist/assets/{chunk-KX2RTZJC-Dxr1rGpv.js → chunk-KX2RTZJC-D7k7JgqU.js} +1 -1
  17. package/web-dist/assets/{chunk-NQ4KR5QH-BFby0PUa.js → chunk-NQ4KR5QH-DTXGqMz_.js} +1 -1
  18. package/web-dist/assets/{chunk-QZHKN3VN-CO-IOHjL.js → chunk-QZHKN3VN-4PKr84b9.js} +1 -1
  19. package/web-dist/assets/{chunk-WL4C6EOR-zQawjobb.js → chunk-WL4C6EOR-BKeNjivG.js} +1 -1
  20. package/web-dist/assets/classDiagram-VBA2DB6C-Dze8THow.js +1 -0
  21. package/web-dist/assets/classDiagram-v2-RAHNMMFH-Dze8THow.js +1 -0
  22. package/web-dist/assets/clone-DGJzcJrQ.js +1 -0
  23. package/web-dist/assets/{cose-bilkent-S5V4N54A-DJRBhZ9n.js → cose-bilkent-S5V4N54A-BjpxaRPu.js} +1 -1
  24. package/web-dist/assets/{dagre-KLK3FWXG-CvwJzXww.js → dagre-KLK3FWXG-gAHNuLWz.js} +1 -1
  25. package/web-dist/assets/{diagram-E7M64L7V-C57ZwG2s.js → diagram-E7M64L7V-BkApwq5Q.js} +1 -1
  26. package/web-dist/assets/{diagram-IFDJBPK2-B3liE4sT.js → diagram-IFDJBPK2-BEm_QJoq.js} +1 -1
  27. package/web-dist/assets/{diagram-P4PSJMXO-wu5XS4-m.js → diagram-P4PSJMXO-RGo6-4-V.js} +1 -1
  28. package/web-dist/assets/{erDiagram-INFDFZHY-DRcVirIE.js → erDiagram-INFDFZHY-DiPmidZB.js} +1 -1
  29. package/web-dist/assets/{flowDiagram-PKNHOUZH-Dqv7cd9s.js → flowDiagram-PKNHOUZH-B6IZwKMs.js} +1 -1
  30. package/web-dist/assets/{ganttDiagram-A5KZAMGK-PJo-kYFl.js → ganttDiagram-A5KZAMGK-DKGNAYv6.js} +1 -1
  31. package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-5Rb8wBrv.js → gitGraphDiagram-K3NZZRJ6-CRMfB4F2.js} +1 -1
  32. package/web-dist/assets/{graph-DDTdiKsj.js → graph-Cg8fkL4Y.js} +1 -1
  33. package/web-dist/assets/{index-dMwurs7X.js → index-BNdSqEux.js} +4 -4
  34. package/web-dist/assets/index-C8RawvRp.css +32 -0
  35. package/web-dist/assets/{infoDiagram-LFFYTUFH-zcsFeJ4m.js → infoDiagram-LFFYTUFH-QvsCHeM_.js} +1 -1
  36. package/web-dist/assets/{ishikawaDiagram-PHBUUO56-Ds72xvJG.js → ishikawaDiagram-PHBUUO56-42wZbXY0.js} +1 -1
  37. package/web-dist/assets/{journeyDiagram-4ABVD52K-rJlqsrEv.js → journeyDiagram-4ABVD52K-C_q-EmNL.js} +1 -1
  38. package/web-dist/assets/{kanban-definition-K7BYSVSG-DJ3yApJ6.js → kanban-definition-K7BYSVSG-CA6wXyRp.js} +1 -1
  39. package/web-dist/assets/{layout-BkLNNIvt.js → layout-DnGfyXBB.js} +1 -1
  40. package/web-dist/assets/{linear-DhGA975S.js → linear-o-XtK31n.js} +1 -1
  41. package/web-dist/assets/{mindmap-definition-YRQLILUH-DHu3lczO.js → mindmap-definition-YRQLILUH-BHBsqkXi.js} +1 -1
  42. package/web-dist/assets/{pieDiagram-SKSYHLDU-DU-KqaFD.js → pieDiagram-SKSYHLDU-ClcpY074.js} +1 -1
  43. package/web-dist/assets/{quadrantDiagram-337W2JSQ-B4AxgVsa.js → quadrantDiagram-337W2JSQ-GvlA6Gj2.js} +1 -1
  44. package/web-dist/assets/{requirementDiagram-Z7DCOOCP-DiEERhoX.js → requirementDiagram-Z7DCOOCP-CauzFlz4.js} +1 -1
  45. package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-Cu4dVvXg.js → sankeyDiagram-WA2Y5GQK-3IYjZnLH.js} +1 -1
  46. package/web-dist/assets/{sequenceDiagram-2WXFIKYE-BdQ03G7t.js → sequenceDiagram-2WXFIKYE-CxGt1IaP.js} +1 -1
  47. package/web-dist/assets/{stateDiagram-RAJIS63D-CbDYqEHa.js → stateDiagram-RAJIS63D-DdjaHEcy.js} +1 -1
  48. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-C0Ja8vL1.js +1 -0
  49. package/web-dist/assets/{timeline-definition-YZTLITO2-CWOOnY49.js → timeline-definition-YZTLITO2-H4tp5PiJ.js} +1 -1
  50. package/web-dist/assets/{treemap-KZPCXAKY-DQ3Mp8aH.js → treemap-KZPCXAKY-C3iFktmo.js} +1 -1
  51. package/web-dist/assets/{vennDiagram-LZ73GAT5-DTQe4_WH.js → vennDiagram-LZ73GAT5-DPD8srTY.js} +1 -1
  52. package/web-dist/assets/{xychartDiagram-JWTSCODW-CmblIR7M.js → xychartDiagram-JWTSCODW-B6VN7b8S.js} +1 -1
  53. package/web-dist/index.html +2 -2
  54. package/web-dist/assets/channel-C1pNnZCG.js +0 -1
  55. package/web-dist/assets/classDiagram-VBA2DB6C-DbkzUpgT.js +0 -1
  56. package/web-dist/assets/classDiagram-v2-RAHNMMFH-DbkzUpgT.js +0 -1
  57. package/web-dist/assets/clone-i3RNG-Wr.js +0 -1
  58. package/web-dist/assets/index-D5hM9zSI.css +0 -32
  59. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-TJ-TmBn6.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-CvwJzXww.js","./graph-DDTdiKsj.js","./_baseUniq-P0CNkgLx.js","./layout-BkLNNIvt.js","./_basePickBy-B6y4dQg2.js","./clone-i3RNG-Wr.js","./cose-bilkent-S5V4N54A-DJRBhZ9n.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-DkzaHC9Y.js","./chunk-JSJVCQXG-BMQ-OrQN.js","./flowDiagram-PKNHOUZH-Dqv7cd9s.js","./chunk-FMBD7UC4-DbcMpJ7m.js","./chunk-55IACEB6-Dy3a5FtR.js","./chunk-KX2RTZJC-Dxr1rGpv.js","./channel-C1pNnZCG.js","./erDiagram-INFDFZHY-DRcVirIE.js","./gitGraphDiagram-K3NZZRJ6-5Rb8wBrv.js","./chunk-4BX2VUAB-D5ZTy4L2.js","./chunk-QZHKN3VN-CO-IOHjL.js","./treemap-KZPCXAKY-DQ3Mp8aH.js","./ganttDiagram-A5KZAMGK-PJo-kYFl.js","./linear-DhGA975S.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-zcsFeJ4m.js","./pieDiagram-SKSYHLDU-DU-KqaFD.js","./arc-Dy_xAujl.js","./quadrantDiagram-337W2JSQ-B4AxgVsa.js","./xychartDiagram-JWTSCODW-CmblIR7M.js","./requirementDiagram-Z7DCOOCP-DiEERhoX.js","./sequenceDiagram-2WXFIKYE-BdQ03G7t.js","./classDiagram-VBA2DB6C-DbkzUpgT.js","./chunk-WL4C6EOR-zQawjobb.js","./classDiagram-v2-RAHNMMFH-DbkzUpgT.js","./stateDiagram-RAJIS63D-CbDYqEHa.js","./chunk-NQ4KR5QH-BFby0PUa.js","./stateDiagram-v2-FVOUBMTO-TJ-TmBn6.js","./journeyDiagram-4ABVD52K-rJlqsrEv.js","./timeline-definition-YZTLITO2-CWOOnY49.js","./mindmap-definition-YRQLILUH-DHu3lczO.js","./kanban-definition-K7BYSVSG-DJ3yApJ6.js","./diagram-P4PSJMXO-wu5XS4-m.js","./diagram-IFDJBPK2-B3liE4sT.js","./blockDiagram-WCTKOSBZ-ChWaUHnl.js","./architectureDiagram-2XIMDMQ5-CcLgYlkC.js","./diagram-E7M64L7V-C57ZwG2s.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-gAHNuLWz.js","./graph-Cg8fkL4Y.js","./_baseUniq-CUI7xvDV.js","./layout-DnGfyXBB.js","./_basePickBy-DIhL_HGn.js","./clone-DGJzcJrQ.js","./cose-bilkent-S5V4N54A-BjpxaRPu.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-wZdR0BHp.js","./chunk-JSJVCQXG-CXBV8wCe.js","./flowDiagram-PKNHOUZH-B6IZwKMs.js","./chunk-FMBD7UC4-kcaU34bv.js","./chunk-55IACEB6-De-iDQxV.js","./chunk-KX2RTZJC-D7k7JgqU.js","./channel-BkXzbEIW.js","./erDiagram-INFDFZHY-DiPmidZB.js","./gitGraphDiagram-K3NZZRJ6-CRMfB4F2.js","./chunk-4BX2VUAB-DXqjwFjC.js","./chunk-QZHKN3VN-4PKr84b9.js","./treemap-KZPCXAKY-C3iFktmo.js","./ganttDiagram-A5KZAMGK-DKGNAYv6.js","./linear-o-XtK31n.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-QvsCHeM_.js","./pieDiagram-SKSYHLDU-ClcpY074.js","./arc-1t0orlFE.js","./quadrantDiagram-337W2JSQ-GvlA6Gj2.js","./xychartDiagram-JWTSCODW-B6VN7b8S.js","./requirementDiagram-Z7DCOOCP-CauzFlz4.js","./sequenceDiagram-2WXFIKYE-CxGt1IaP.js","./classDiagram-VBA2DB6C-Dze8THow.js","./chunk-WL4C6EOR-BKeNjivG.js","./classDiagram-v2-RAHNMMFH-Dze8THow.js","./stateDiagram-RAJIS63D-DdjaHEcy.js","./chunk-NQ4KR5QH-DTXGqMz_.js","./stateDiagram-v2-FVOUBMTO-C0Ja8vL1.js","./journeyDiagram-4ABVD52K-C_q-EmNL.js","./timeline-definition-YZTLITO2-H4tp5PiJ.js","./mindmap-definition-YRQLILUH-BHBsqkXi.js","./kanban-definition-K7BYSVSG-CA6wXyRp.js","./diagram-P4PSJMXO-RGo6-4-V.js","./diagram-IFDJBPK2-BEm_QJoq.js","./blockDiagram-WCTKOSBZ-CxW58r1f.js","./architectureDiagram-2XIMDMQ5-twf4IxmH.js","./diagram-E7M64L7V-BkApwq5Q.js"])))=>i.map(i=>d[i]);
2
2
  var ghe=Object.defineProperty;var yhe=(e,r,n)=>r in e?ghe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Fe=(e,r,n)=>yhe(e,typeof r!="symbol"?r+"":r,n);function vhe(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function $0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function p1t(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var n=function i(){return this instanceof i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),n}var sT={exports:{}},Jx={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -1116,8 +1116,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
1116
1116
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,o=Math.abs(i-n.x),a=e.width/2;let l=n.x<r.x?a-o:a+o;const d=e.height/2,u=Math.abs(r.y-n.y),h=Math.abs(r.x-n.x);if(Math.abs(s-r.y)*a>Math.abs(i-r.x)*d){let p=n.y<r.y?r.y-d-s:s-d-r.y;l=h*p/u;const g={x:n.x<r.x?n.x+l:n.x-h+l,y:n.y<r.y?n.y+u-p:n.y-u+p};return l===0&&(g.x=r.x,g.y=r.y),h===0&&(g.x=r.x),u===0&&(g.y=r.y),_t.debug(`abc89 top/bottom calc, Q ${u}, q ${p}, R ${h}, r ${l}`,g),g}else{n.x<r.x?l=r.x-a-i:l=i-a-r.x;let p=u*l/h,g=n.x<r.x?n.x+h-l:n.x-h+l,v=n.y<r.y?n.y+p:n.y-p;return _t.debug(`sides calc abc89, Q ${u}, q ${p}, R ${h}, r ${l}`,{_x:g,_y:v}),l===0&&(g=r.x,v=r.y),h===0&&(g=r.x),u===0&&(v=r.y),{x:g,y:v}}},"intersection"),TF=X((e,r)=>{_t.warn("abc88 cutPathAtIntersect",e,r);let n=[],i=e[0],s=!1;return e.forEach(o=>{if(_t.info("abc88 checking point",o,r),!rVe(r,o)&&!s){const a=nVe(r,i,o);_t.debug("abc88 inside",o,i,a),_t.debug("abc88 intersection",a,r);let l=!1;n.forEach(d=>{l=l||d.x===a.x&&d.y===a.y}),n.some(d=>d.x===a.x&&d.y===a.y)?_t.warn("abc88 no intersect",a,n):n.push(a),s=!0}else _t.warn("abc88 outside",o,i),i=o,s||n.push(o)}),_t.debug("returning points",n),n},"cutPathAtIntersect");function mse(e){const r=[],n=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],o=e[i],a=e[i+1];(s.x===o.x&&o.y===a.y&&Math.abs(o.x-a.x)>5&&Math.abs(o.y-s.y)>5||s.y===o.y&&o.x===a.x&&Math.abs(o.x-s.x)>5&&Math.abs(o.y-a.y)>5)&&(r.push(o),n.push(i))}return{cornerPoints:r,cornerPointPositions:n}}X(mse,"extractCornerPoints");var NF=X(function(e,r,n){const i=r.x-e.x,s=r.y-e.y,o=Math.sqrt(i*i+s*s),a=n/o;return{x:r.x-a*i,y:r.y-a*s}},"findAdjacentPoint"),iVe=X(function(e){const{cornerPointPositions:r}=mse(e),n=[];for(let i=0;i<e.length;i++)if(r.includes(i)){const s=e[i-1],o=e[i+1],a=e[i],l=NF(s,a,5),d=NF(o,a,5),u=d.x-l.x,h=d.y-l.y;n.push(l);const p=Math.sqrt(2)*2;let g={x:a.x,y:a.y};if(Math.abs(o.x-s.x)>10&&Math.abs(o.y-s.y)>=10){_t.debug("Corner point fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));const v=5;a.x===l.x?g={x:u<0?l.x-v+p:l.x+v-p,y:h<0?l.y-p:l.y+p}:g={x:u<0?l.x-p:l.x+p,y:h<0?l.y-v+p:l.y+v-p}}else _t.debug("Corner point skipping fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));n.push(g,d)}else n.push(e[i]);return n},"fixCorners"),sVe=X((e,r,n)=>{const i=e-r-n,s=2,o=2,a=s+o,l=Math.floor(i/a),d=Array(l).fill(`${s} ${o}`).join(" ");return`0 ${r} ${d} ${n}`},"generateDashArray"),oVe=X(function(e,r,n,i,s,o,a,l=!1){var L;const{handDrawnSeed:d}=ii();let u=r.points,h=!1;const p=s;var g=o;const v=[];for(const B in r.cssCompiledStyles)mne(B)||v.push(r.cssCompiledStyles[B]);_t.debug("UIO intersect check",r.points,g.x,p.x),g.intersect&&p.intersect&&!l&&(u=u.slice(1,r.points.length-1),u.unshift(p.intersect(u[0])),_t.debug("Last point UIO",r.start,"-->",r.end,u[u.length-1],g,g.intersect(u[u.length-1])),u.push(g.intersect(u[u.length-1])));const b=btoa(JSON.stringify(u));r.toCluster&&(_t.info("to cluster abc88",n.get(r.toCluster)),u=TF(r.points,n.get(r.toCluster).node),h=!0),r.fromCluster&&(_t.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(u,null,2)),u=TF(u.reverse(),n.get(r.fromCluster).node).reverse(),h=!0);let _=u.filter(B=>!Number.isNaN(B.y));const k=QUe(r.curve);k!=="rounded"&&(_=iVe(_));let w=R_;switch(k){case"linear":w=R_;break;case"basis":w=PA;break;case"cardinal":w=Yee;break;case"bumpX":w=Uee;break;case"bumpY":w=Vee;break;case"catmullRom":w=Zee;break;case"monotoneX":w=nte;break;case"monotoneY":w=ite;break;case"natural":w=ote;break;case"step":w=ate;break;case"stepAfter":w=cte;break;case"stepBefore":w=lte;break;case"rounded":w=R_;break;default:w=PA}const{x:C,y:j}=rze(r),T=RIe().x(C).y(j).curve(w);let A;switch(r.thickness){case"normal":A="edge-thickness-normal";break;case"thick":A="edge-thickness-thick";break;case"invisible":A="edge-thickness-invisible";break;default:A="edge-thickness-normal"}switch(r.pattern){case"solid":A+=" edge-pattern-solid";break;case"dotted":A+=" edge-pattern-dotted";break;case"dashed":A+=" edge-pattern-dashed";break;default:A+=" edge-pattern-solid"}let E,R=k==="rounded"?gse(yse(_,r),5):T(_);const P=Array.isArray(r.style)?r.style:[r.style];let H=P.find(B=>B==null?void 0:B.startsWith("stroke:")),$="";r.animate&&($="edge-animation-fast"),r.animation&&($="edge-animation-"+r.animation);let U=!1;if(r.look==="handDrawn"){const B=xr.svg(e);Object.assign([],_);const W=B.path(R,{roughness:.3,seed:d});A+=" transition",E=$r(W).select("path").attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",P?P.reduce((F,V)=>F+";"+V,""):"");let K=E.attr("d");E.attr("d",K),e.node().appendChild(E.node())}else{const B=v.join(";"),W=P?P.reduce((ee,re)=>ee+re+";",""):"",K=(B?B+";"+W+";":W)+";"+(P?P.reduce((ee,re)=>ee+";"+re,""):"");E=e.append("path").attr("d",R).attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",K),H=(L=K.match(/stroke:([^;]+)/))==null?void 0:L[1],U=r.animate===!0||!!r.animation||B.includes("animation");const F=E.node(),V=typeof F.getTotalLength=="function"?F.getTotalLength():0,J=Wz[r.arrowTypeStart]||0,q=Wz[r.arrowTypeEnd]||0;if(r.look==="neo"&&!U){const re=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?sVe(V,J,q):`0 ${J} ${V-J-q} ${q}`}; stroke-dashoffset: 0;`;E.attr("style",re+E.attr("style"))}}E.attr("data-edge",!0),E.attr("data-et","edge"),E.attr("data-id",r.id),E.attr("data-points",b),r.showPoints&&_.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let I="";(ii().flowchart.arrowMarkerAbsolute||ii().state.arrowMarkerAbsolute)&&(I=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,I=I.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),_t.info("arrowTypeStart",r.arrowTypeStart),_t.info("arrowTypeEnd",r.arrowTypeEnd),ZUe(E,r,I,a,i,H);const Y=Math.floor(u.length/2),M=u[Y];od.isLabelCoordinateInPath(M,E.attr("d"))||(h=!0);let z={};return h&&(z.updatedPath=u),z.originalPath=r.points,z},"insertEdge");function gse(e,r){if(e.length<2)return"";let n="";const i=e.length,s=1e-5;for(let o=0;o<i;o++){const a=e[o],l=e[o-1],d=e[o+1];if(o===0)n+=`M${a.x},${a.y}`;else if(o===i-1)n+=`L${a.x},${a.y}`;else{const u=a.x-l.x,h=a.y-l.y,p=d.x-a.x,g=d.y-a.y,v=Math.hypot(u,h),b=Math.hypot(p,g);if(v<s||b<s){n+=`L${a.x},${a.y}`;continue}const _=u/v,k=h/v,w=p/b,C=g/b,j=_*w+k*C,T=Math.max(-1,Math.min(1,j)),A=Math.acos(T);if(A<s||Math.abs(Math.PI-A)<s){n+=`L${a.x},${a.y}`;continue}const E=Math.min(r/Math.sin(A/2),v/2,b/2),R=a.x-_*E,P=a.y-k*E,H=a.x+w*E,$=a.y+C*E;n+=`L${R},${P}`,n+=`Q${a.x},${a.y} ${H},${$}`}}return n}X(gse,"generateRoundedPath");function lO(e,r){if(!e||!r)return{angle:0,deltaX:0,deltaY:0};const n=r.x-e.x,i=r.y-e.y;return{angle:Math.atan2(i,n),deltaX:n,deltaY:i}}X(lO,"calculateDeltaAndAngle");function yse(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&ka[r.arrowTypeStart]){const s=ka[r.arrowTypeStart],o=e[0],a=e[1],{angle:l}=lO(o,a),d=s*Math.cos(l),u=s*Math.sin(l);n[0].x=o.x+d,n[0].y=o.y+u}const i=e.length;if(i>=2&&ka[r.arrowTypeEnd]){const s=ka[r.arrowTypeEnd],o=e[i-1],a=e[i-2],{angle:l}=lO(a,o),d=s*Math.cos(l),u=s*Math.sin(l);n[i-1].x=o.x-d,n[i-1].y=o.y-u}return n}X(yse,"applyMarkerOffsetsToPoints");var aVe=X((e,r,n,i)=>{r.forEach(s=>{SVe[s](e,n,i)})},"insertMarkers"),lVe=X((e,r,n)=>{_t.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionStart").attr("class","marker extension "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionEnd").attr("class","marker extension "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),cVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-compositionStart").attr("class","marker composition "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-compositionEnd").attr("class","marker composition "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),uVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-aggregationStart").attr("class","marker aggregation "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-aggregationEnd").attr("class","marker aggregation "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),dVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-dependencyStart").attr("class","marker dependency "+r).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-dependencyEnd").attr("class","marker dependency "+r).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),hVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-lollipopStart").attr("class","marker lollipop "+r).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",n+"_"+r+"-lollipopEnd").attr("class","marker lollipop "+r).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),fVe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-pointEnd").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-pointStart").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),pVe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-circleEnd").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-circleStart").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),mVe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-crossEnd").attr("class","marker cross "+r).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-crossStart").attr("class","marker cross "+r).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),gVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),yVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-onlyOneStart").attr("class","marker onlyOne "+r).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",n+"_"+r+"-onlyOneEnd").attr("class","marker onlyOne "+r).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),vVe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrOneStart").attr("class","marker zeroOrOne "+r).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const s=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+r).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),s.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),xVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-oneOrMoreStart").attr("class","marker oneOrMore "+r).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",n+"_"+r+"-oneOrMoreEnd").attr("class","marker oneOrMore "+r).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),bVe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+r).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const s=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+r).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),s.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),_Ve=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
1117
1117
  L20,10
1118
1118
  M20,10
1119
- L0,20`)},"requirement_arrow"),wVe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),SVe={extension:lVe,composition:cVe,aggregation:uVe,dependency:dVe,lollipop:hVe,point:fVe,circle:pVe,cross:mVe,barb:gVe,only_one:yVe,zero_or_one:vVe,one_or_more:xVe,zero_or_more:bVe,requirement_arrow:_Ve,requirement_contains:wVe},kVe=aVe,CVe={common:_S,getConfig:Oa,insertCluster:OUe,insertEdge:oVe,insertEdgeLabel:eVe,insertMarkers:kVe,insertNode:pse,interpolateToCurve:jM,labelHelper:Fr,log:_t,positionEdgeLabel:tVe},V2={},vse=X(e=>{for(const r of e)V2[r.name]=r},"registerLayoutLoaders"),jVe=X(()=>{vse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-CvwJzXww.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ge(()=>import("./cose-bilkent-S5V4N54A-DJRBhZ9n.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");jVe();var tvt=X(async(e,r)=>{if(!(e.layoutAlgorithm in V2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=V2[e.layoutAlgorithm];return(await n.loader()).render(e,r,CVe,{algorithm:n.algorithm})},"render"),rvt=X((e="",{fallback:r="dagre"}={})=>{if(e in V2)return e;if(r in V2)return _t.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),TVe=Kre(Object.keys,Object),NVe=Object.prototype,EVe=NVe.hasOwnProperty;function AVe(e){if(!Kj(e))return TVe(e);var r=[];for(var n in Object(e))EVe.call(e,n)&&n!="constructor"&&r.push(n);return r}var cO=q0(Nd,"DataView"),uO=q0(Nd,"Promise"),dO=q0(Nd,"Set"),hO=q0(Nd,"WeakMap"),EF="[object Map]",OVe="[object Object]",AF="[object Promise]",OF="[object Set]",RF="[object WeakMap]",MF="[object DataView]",RVe=V0(cO),MVe=V0(W2),PVe=V0(uO),LVe=V0(dO),$Ve=V0(hO),Ug=U0;(cO&&Ug(new cO(new ArrayBuffer(1)))!=MF||W2&&Ug(new W2)!=EF||uO&&Ug(uO.resolve())!=AF||dO&&Ug(new dO)!=OF||hO&&Ug(new hO)!=RF)&&(Ug=function(e){var r=U0(e),n=r==OVe?e.constructor:void 0,i=n?V0(n):"";if(i)switch(i){case RVe:return MF;case MVe:return EF;case PVe:return AF;case LVe:return OF;case $Ve:return RF}return r});var DVe="[object Map]",IVe="[object Set]",BVe=Object.prototype,zVe=BVe.hasOwnProperty;function PF(e){if(e==null)return!0;if(Yj(e)&&(F5(e)||typeof e=="string"||typeof e.splice=="function"||kM(e)||CM(e)||z5(e)))return!e.length;var r=Ug(e);if(r==DVe||r==IVe)return!e.size;if(Kj(e))return!AVe(e).length;for(var n in e)if(zVe.call(e,n))return!1;return!0}var xse="c4",FVe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),HVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-DkzaHC9Y.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:xse,diagram:e}},"loader"),WVe={id:xse,detector:FVe,loader:HVe},UVe=WVe,bse="flowchart",VVe=X((e,r)=>{var n,i;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),qVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dqv7cd9s.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:bse,diagram:e}},"loader"),GVe={id:bse,detector:VVe,loader:qVe},KVe=GVe,_se="flowchart-v2",YVe=X((e,r)=>{var n,i,s;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((s=r==null?void 0:r.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),XVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dqv7cd9s.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:_se,diagram:e}},"loader"),ZVe={id:_se,detector:YVe,loader:XVe},JVe=ZVe,wse="er",QVe=X(e=>/^\s*erDiagram/.test(e),"detector"),eqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-DRcVirIE.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:wse,diagram:e}},"loader"),tqe={id:wse,detector:QVe,loader:eqe},rqe=tqe,Sse="gitGraph",nqe=X(e=>/^\s*gitGraph/.test(e),"detector"),iqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-5Rb8wBrv.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:Sse,diagram:e}},"loader"),sqe={id:Sse,detector:nqe,loader:iqe},oqe=sqe,kse="gantt",aqe=X(e=>/^\s*gantt/.test(e),"detector"),lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-PJo-kYFl.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:kse,diagram:e}},"loader"),cqe={id:kse,detector:aqe,loader:lqe},uqe=cqe,Cse="info",dqe=X(e=>/^\s*info/.test(e),"detector"),hqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-zcsFeJ4m.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:Cse,diagram:e}},"loader"),fqe={id:Cse,detector:dqe,loader:hqe},jse="pie",pqe=X(e=>/^\s*pie/.test(e),"detector"),mqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-DU-KqaFD.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:jse,diagram:e}},"loader"),gqe={id:jse,detector:pqe,loader:mqe},Tse="quadrantChart",yqe=X(e=>/^\s*quadrantChart/.test(e),"detector"),vqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-B4AxgVsa.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Tse,diagram:e}},"loader"),xqe={id:Tse,detector:yqe,loader:vqe},bqe=xqe,Nse="xychart",_qe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),wqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-CmblIR7M.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Nse,diagram:e}},"loader"),Sqe={id:Nse,detector:_qe,loader:wqe},kqe=Sqe,Ese="requirement",Cqe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),jqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-DiEERhoX.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:Ese,diagram:e}},"loader"),Tqe={id:Ese,detector:Cqe,loader:jqe},Nqe=Tqe,Ase="sequence",Eqe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),Aqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-BdQ03G7t.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Ase,diagram:e}},"loader"),Oqe={id:Ase,detector:Eqe,loader:Aqe},Rqe=Oqe,Ose="class",Mqe=X((e,r)=>{var n;return((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),Pqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-DbkzUpgT.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:Ose,diagram:e}},"loader"),Lqe={id:Ose,detector:Mqe,loader:Pqe},$qe=Lqe,Rse="classDiagram",Dqe=X((e,r)=>{var n;return/^\s*classDiagram/.test(e)&&((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Iqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-DbkzUpgT.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Rse,diagram:e}},"loader"),Bqe={id:Rse,detector:Dqe,loader:Iqe},zqe=Bqe,Mse="state",Fqe=X((e,r)=>{var n;return((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),Hqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-CbDYqEHa.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Mse,diagram:e}},"loader"),Wqe={id:Mse,detector:Fqe,loader:Hqe},Uqe=Wqe,Pse="stateDiagram",Vqe=X((e,r)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),qqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-TJ-TmBn6.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Pse,diagram:e}},"loader"),Gqe={id:Pse,detector:Vqe,loader:qqe},Kqe=Gqe,Lse="journey",Yqe=X(e=>/^\s*journey/.test(e),"detector"),Xqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-rJlqsrEv.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:Lse,diagram:e}},"loader"),Zqe={id:Lse,detector:Yqe,loader:Xqe},Jqe=Zqe,Qqe=X((e,r,n)=>{_t.debug(`rendering svg for syntax error
1120
- `);const i=KIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),uee(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),$se={draw:Qqe},eGe=$se,tGe={db:{},renderer:$se,parser:{parse:X(()=>{},"parse")}},rGe=tGe,Dse="flowchart-elk",nGe=X((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),iGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dqv7cd9s.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Dse,diagram:e}},"loader"),sGe={id:Dse,detector:nGe,loader:iGe},oGe=sGe,Ise="timeline",aGe=X(e=>/^\s*timeline/.test(e),"detector"),lGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-CWOOnY49.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:Ise,diagram:e}},"loader"),cGe={id:Ise,detector:aGe,loader:lGe},uGe=cGe,Bse="mindmap",dGe=X(e=>/^\s*mindmap/.test(e),"detector"),hGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-DHu3lczO.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:Bse,diagram:e}},"loader"),fGe={id:Bse,detector:dGe,loader:hGe},pGe=fGe,zse="kanban",mGe=X(e=>/^\s*kanban/.test(e),"detector"),gGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-DJ3yApJ6.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:zse,diagram:e}},"loader"),yGe={id:zse,detector:mGe,loader:gGe},vGe=yGe,Fse="sankey",xGe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),bGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-Cu4dVvXg.js");return{diagram:r}},[],import.meta.url);return{id:Fse,diagram:e}},"loader"),_Ge={id:Fse,detector:xGe,loader:bGe},wGe=_Ge,Hse="packet",SGe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),kGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-wu5XS4-m.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Hse,diagram:e}},"loader"),CGe={id:Hse,detector:SGe,loader:kGe},Wse="radar",jGe=X(e=>/^\s*radar-beta/.test(e),"detector"),TGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-B3liE4sT.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:Wse,diagram:e}},"loader"),NGe={id:Wse,detector:jGe,loader:TGe},Use="block",EGe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),AGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-ChWaUHnl.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Use,diagram:e}},"loader"),OGe={id:Use,detector:EGe,loader:AGe},RGe=OGe,Vse="architecture",MGe=X(e=>/^\s*architecture/.test(e),"detector"),PGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-CcLgYlkC.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:Vse,diagram:e}},"loader"),LGe={id:Vse,detector:MGe,loader:PGe},$Ge=LGe,qse="ishikawa",DGe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),IGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-Ds72xvJG.js");return{diagram:r}},[],import.meta.url);return{id:qse,diagram:e}},"loader"),BGe={id:qse,detector:DGe,loader:IGe},Gse="venn",zGe=X(e=>/^\s*venn-beta/.test(e),"detector"),FGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-DTQe4_WH.js");return{diagram:r}},[],import.meta.url);return{id:Gse,diagram:e}},"loader"),HGe={id:Gse,detector:zGe,loader:FGe},WGe=HGe,Kse="treemap",UGe=X(e=>/^\s*treemap/.test(e),"detector"),VGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-C57ZwG2s.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Kse,diagram:e}},"loader"),qGe={id:Kse,detector:UGe,loader:VGe},LF=!1,n6=X(()=>{LF||(LF=!0,w5("error",rGe,e=>e.toLowerCase().trim()==="error"),w5("---",{db:{clear:X(()=>{},"clear")},styles:{},renderer:{draw:X(()=>{},"draw")},parser:{parse:X(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:X(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),xA(oGe,pGe,$Ge),xA(UVe,vGe,zqe,$qe,rqe,uqe,fqe,gqe,Nqe,Rqe,JVe,KVe,uGe,oqe,Kqe,Uqe,Jqe,bqe,wGe,CGe,kqe,RGe,NGe,BGe,qGe,WGe))},"addDiagrams"),GGe=X(async()=>{_t.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(w0).map(async([n,{detector:i,loader:s}])=>{if(s)try{SA(n)}catch{try{const{diagram:o,id:a}=await s();w5(a,o,i)}catch(o){throw _t.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete w0[n],o}}}))).filter(n=>n.status==="rejected");if(r.length>0){_t.error(`Failed to load ${r.length} external diagrams`);for(const n of r)_t.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),KGe="graphics-document document";function Yse(e,r){e.attr("role",KGe),r!==""&&e.attr("aria-roledescription",r)}X(Yse,"setA11yDiagramInfo");function Xse(e,r,n,i){if(e.insert!==void 0){if(n){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(n)}if(r){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(r)}}}X(Xse,"addSVGa11yTitleDescription");var h0,fO=(h0=class{constructor(r,n,i,s,o){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=o}static async fromText(r,n={}){var u,h;const i=Oa(),s=GR(r,i);r=ZHe(r)+`
1119
+ L0,20`)},"requirement_arrow"),wVe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),SVe={extension:lVe,composition:cVe,aggregation:uVe,dependency:dVe,lollipop:hVe,point:fVe,circle:pVe,cross:mVe,barb:gVe,only_one:yVe,zero_or_one:vVe,one_or_more:xVe,zero_or_more:bVe,requirement_arrow:_Ve,requirement_contains:wVe},kVe=aVe,CVe={common:_S,getConfig:Oa,insertCluster:OUe,insertEdge:oVe,insertEdgeLabel:eVe,insertMarkers:kVe,insertNode:pse,interpolateToCurve:jM,labelHelper:Fr,log:_t,positionEdgeLabel:tVe},V2={},vse=X(e=>{for(const r of e)V2[r.name]=r},"registerLayoutLoaders"),jVe=X(()=>{vse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-gAHNuLWz.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ge(()=>import("./cose-bilkent-S5V4N54A-BjpxaRPu.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");jVe();var tvt=X(async(e,r)=>{if(!(e.layoutAlgorithm in V2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=V2[e.layoutAlgorithm];return(await n.loader()).render(e,r,CVe,{algorithm:n.algorithm})},"render"),rvt=X((e="",{fallback:r="dagre"}={})=>{if(e in V2)return e;if(r in V2)return _t.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),TVe=Kre(Object.keys,Object),NVe=Object.prototype,EVe=NVe.hasOwnProperty;function AVe(e){if(!Kj(e))return TVe(e);var r=[];for(var n in Object(e))EVe.call(e,n)&&n!="constructor"&&r.push(n);return r}var cO=q0(Nd,"DataView"),uO=q0(Nd,"Promise"),dO=q0(Nd,"Set"),hO=q0(Nd,"WeakMap"),EF="[object Map]",OVe="[object Object]",AF="[object Promise]",OF="[object Set]",RF="[object WeakMap]",MF="[object DataView]",RVe=V0(cO),MVe=V0(W2),PVe=V0(uO),LVe=V0(dO),$Ve=V0(hO),Ug=U0;(cO&&Ug(new cO(new ArrayBuffer(1)))!=MF||W2&&Ug(new W2)!=EF||uO&&Ug(uO.resolve())!=AF||dO&&Ug(new dO)!=OF||hO&&Ug(new hO)!=RF)&&(Ug=function(e){var r=U0(e),n=r==OVe?e.constructor:void 0,i=n?V0(n):"";if(i)switch(i){case RVe:return MF;case MVe:return EF;case PVe:return AF;case LVe:return OF;case $Ve:return RF}return r});var DVe="[object Map]",IVe="[object Set]",BVe=Object.prototype,zVe=BVe.hasOwnProperty;function PF(e){if(e==null)return!0;if(Yj(e)&&(F5(e)||typeof e=="string"||typeof e.splice=="function"||kM(e)||CM(e)||z5(e)))return!e.length;var r=Ug(e);if(r==DVe||r==IVe)return!e.size;if(Kj(e))return!AVe(e).length;for(var n in e)if(zVe.call(e,n))return!1;return!0}var xse="c4",FVe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),HVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-wZdR0BHp.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:xse,diagram:e}},"loader"),WVe={id:xse,detector:FVe,loader:HVe},UVe=WVe,bse="flowchart",VVe=X((e,r)=>{var n,i;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),qVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-B6IZwKMs.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:bse,diagram:e}},"loader"),GVe={id:bse,detector:VVe,loader:qVe},KVe=GVe,_se="flowchart-v2",YVe=X((e,r)=>{var n,i,s;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((s=r==null?void 0:r.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),XVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-B6IZwKMs.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:_se,diagram:e}},"loader"),ZVe={id:_se,detector:YVe,loader:XVe},JVe=ZVe,wse="er",QVe=X(e=>/^\s*erDiagram/.test(e),"detector"),eqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-DiPmidZB.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:wse,diagram:e}},"loader"),tqe={id:wse,detector:QVe,loader:eqe},rqe=tqe,Sse="gitGraph",nqe=X(e=>/^\s*gitGraph/.test(e),"detector"),iqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-CRMfB4F2.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:Sse,diagram:e}},"loader"),sqe={id:Sse,detector:nqe,loader:iqe},oqe=sqe,kse="gantt",aqe=X(e=>/^\s*gantt/.test(e),"detector"),lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-DKGNAYv6.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:kse,diagram:e}},"loader"),cqe={id:kse,detector:aqe,loader:lqe},uqe=cqe,Cse="info",dqe=X(e=>/^\s*info/.test(e),"detector"),hqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-QvsCHeM_.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:Cse,diagram:e}},"loader"),fqe={id:Cse,detector:dqe,loader:hqe},jse="pie",pqe=X(e=>/^\s*pie/.test(e),"detector"),mqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-ClcpY074.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:jse,diagram:e}},"loader"),gqe={id:jse,detector:pqe,loader:mqe},Tse="quadrantChart",yqe=X(e=>/^\s*quadrantChart/.test(e),"detector"),vqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-GvlA6Gj2.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Tse,diagram:e}},"loader"),xqe={id:Tse,detector:yqe,loader:vqe},bqe=xqe,Nse="xychart",_qe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),wqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-B6VN7b8S.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Nse,diagram:e}},"loader"),Sqe={id:Nse,detector:_qe,loader:wqe},kqe=Sqe,Ese="requirement",Cqe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),jqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-CauzFlz4.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:Ese,diagram:e}},"loader"),Tqe={id:Ese,detector:Cqe,loader:jqe},Nqe=Tqe,Ase="sequence",Eqe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),Aqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-CxGt1IaP.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Ase,diagram:e}},"loader"),Oqe={id:Ase,detector:Eqe,loader:Aqe},Rqe=Oqe,Ose="class",Mqe=X((e,r)=>{var n;return((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),Pqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-Dze8THow.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:Ose,diagram:e}},"loader"),Lqe={id:Ose,detector:Mqe,loader:Pqe},$qe=Lqe,Rse="classDiagram",Dqe=X((e,r)=>{var n;return/^\s*classDiagram/.test(e)&&((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Iqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-Dze8THow.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Rse,diagram:e}},"loader"),Bqe={id:Rse,detector:Dqe,loader:Iqe},zqe=Bqe,Mse="state",Fqe=X((e,r)=>{var n;return((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),Hqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-DdjaHEcy.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Mse,diagram:e}},"loader"),Wqe={id:Mse,detector:Fqe,loader:Hqe},Uqe=Wqe,Pse="stateDiagram",Vqe=X((e,r)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),qqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-C0Ja8vL1.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Pse,diagram:e}},"loader"),Gqe={id:Pse,detector:Vqe,loader:qqe},Kqe=Gqe,Lse="journey",Yqe=X(e=>/^\s*journey/.test(e),"detector"),Xqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-C_q-EmNL.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:Lse,diagram:e}},"loader"),Zqe={id:Lse,detector:Yqe,loader:Xqe},Jqe=Zqe,Qqe=X((e,r,n)=>{_t.debug(`rendering svg for syntax error
1120
+ `);const i=KIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),uee(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),$se={draw:Qqe},eGe=$se,tGe={db:{},renderer:$se,parser:{parse:X(()=>{},"parse")}},rGe=tGe,Dse="flowchart-elk",nGe=X((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),iGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-B6IZwKMs.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Dse,diagram:e}},"loader"),sGe={id:Dse,detector:nGe,loader:iGe},oGe=sGe,Ise="timeline",aGe=X(e=>/^\s*timeline/.test(e),"detector"),lGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-H4tp5PiJ.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:Ise,diagram:e}},"loader"),cGe={id:Ise,detector:aGe,loader:lGe},uGe=cGe,Bse="mindmap",dGe=X(e=>/^\s*mindmap/.test(e),"detector"),hGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-BHBsqkXi.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:Bse,diagram:e}},"loader"),fGe={id:Bse,detector:dGe,loader:hGe},pGe=fGe,zse="kanban",mGe=X(e=>/^\s*kanban/.test(e),"detector"),gGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-CA6wXyRp.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:zse,diagram:e}},"loader"),yGe={id:zse,detector:mGe,loader:gGe},vGe=yGe,Fse="sankey",xGe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),bGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-3IYjZnLH.js");return{diagram:r}},[],import.meta.url);return{id:Fse,diagram:e}},"loader"),_Ge={id:Fse,detector:xGe,loader:bGe},wGe=_Ge,Hse="packet",SGe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),kGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-RGo6-4-V.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Hse,diagram:e}},"loader"),CGe={id:Hse,detector:SGe,loader:kGe},Wse="radar",jGe=X(e=>/^\s*radar-beta/.test(e),"detector"),TGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-BEm_QJoq.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:Wse,diagram:e}},"loader"),NGe={id:Wse,detector:jGe,loader:TGe},Use="block",EGe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),AGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-CxW58r1f.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Use,diagram:e}},"loader"),OGe={id:Use,detector:EGe,loader:AGe},RGe=OGe,Vse="architecture",MGe=X(e=>/^\s*architecture/.test(e),"detector"),PGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-twf4IxmH.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:Vse,diagram:e}},"loader"),LGe={id:Vse,detector:MGe,loader:PGe},$Ge=LGe,qse="ishikawa",DGe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),IGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-42wZbXY0.js");return{diagram:r}},[],import.meta.url);return{id:qse,diagram:e}},"loader"),BGe={id:qse,detector:DGe,loader:IGe},Gse="venn",zGe=X(e=>/^\s*venn-beta/.test(e),"detector"),FGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-DPD8srTY.js");return{diagram:r}},[],import.meta.url);return{id:Gse,diagram:e}},"loader"),HGe={id:Gse,detector:zGe,loader:FGe},WGe=HGe,Kse="treemap",UGe=X(e=>/^\s*treemap/.test(e),"detector"),VGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-BkApwq5Q.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Kse,diagram:e}},"loader"),qGe={id:Kse,detector:UGe,loader:VGe},LF=!1,n6=X(()=>{LF||(LF=!0,w5("error",rGe,e=>e.toLowerCase().trim()==="error"),w5("---",{db:{clear:X(()=>{},"clear")},styles:{},renderer:{draw:X(()=>{},"draw")},parser:{parse:X(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:X(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),xA(oGe,pGe,$Ge),xA(UVe,vGe,zqe,$qe,rqe,uqe,fqe,gqe,Nqe,Rqe,JVe,KVe,uGe,oqe,Kqe,Uqe,Jqe,bqe,wGe,CGe,kqe,RGe,NGe,BGe,qGe,WGe))},"addDiagrams"),GGe=X(async()=>{_t.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(w0).map(async([n,{detector:i,loader:s}])=>{if(s)try{SA(n)}catch{try{const{diagram:o,id:a}=await s();w5(a,o,i)}catch(o){throw _t.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete w0[n],o}}}))).filter(n=>n.status==="rejected");if(r.length>0){_t.error(`Failed to load ${r.length} external diagrams`);for(const n of r)_t.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),KGe="graphics-document document";function Yse(e,r){e.attr("role",KGe),r!==""&&e.attr("aria-roledescription",r)}X(Yse,"setA11yDiagramInfo");function Xse(e,r,n,i){if(e.insert!==void 0){if(n){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(n)}if(r){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(r)}}}X(Xse,"addSVGa11yTitleDescription");var h0,fO=(h0=class{constructor(r,n,i,s,o){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=o}static async fromText(r,n={}){var u,h;const i=Oa(),s=GR(r,i);r=ZHe(r)+`
1121
1121
  `;try{SA(s)}catch{const p=BMe(s);if(!p)throw new XQ(`Diagram ${s} not found.`);const{id:g,diagram:v}=await p();w5(g,v)}const{db:o,parser:a,renderer:l,init:d}=SA(s);return a.parser&&(a.parser.yy=o),(u=o.clear)==null||u.call(o),d==null||d(i),n.title&&((h=o.setDiagramTitle)==null||h.call(o,n.title)),await a.parse(r),new h0(s,r,o,a,l)}async render(r,n){await this.renderer.draw(this.text,r,n,this)}getParser(){return this.parser}getType(){return this.type}},X(h0,"Diagram"),h0),$F=[],YGe=X(()=>{$F.forEach(e=>{e()}),$F=[]},"attachFunctions"),XGe=X(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Zse(e){const r=e.match(YQ);if(!r)return{text:e,metadata:{}};let n=tze(r[1],{schema:eze})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const i={};return n.displayMode&&(i.displayMode=n.displayMode.toString()),n.title&&(i.title=n.title.toString()),n.config&&(i.config=n.config),{text:e.slice(r[0].length),metadata:i}}X(Zse,"extractFrontMatter");var ZGe=X(e=>e.replace(/\r\n?/g,`
1122
1122
  `).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),JGe=X(e=>{const{text:r,metadata:n}=Zse(e),{displayMode:i,title:s,config:o={}}=n;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:s,config:o,text:r}},"processFrontmatter"),QGe=X(e=>{const r=od.detectInit(e)??{},n=od.detectDirective(e,"wrap");return Array.isArray(n)?r.wrap=n.some(({type:i})=>i==="wrap"):(n==null?void 0:n.type)==="wrap"&&(r.wrap=!0),{text:IHe(e),directive:r}},"processDirectives");function GM(e){const r=ZGe(e),n=JGe(r),i=QGe(n.text),s=OM(n.config,i.directive);return e=XGe(i.text),{code:e,title:n.title,config:s}}X(GM,"preprocessDiagram");function Jse(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}X(Jse,"toBase64");var eKe=5e4,tKe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",rKe="sandbox",nKe="loose",iKe="http://www.w3.org/2000/svg",sKe="http://www.w3.org/1999/xlink",oKe="http://www.w3.org/1999/xhtml",aKe="100%",lKe="100%",cKe="border:0;margin:0;",uKe="margin:0",dKe="allow-top-navigation-by-user-activation allow-popups",hKe='The "iframe" tag is not supported by your browser.',fKe=["foreignobject"],pKe=["dominant-baseline"];function KM(e){const r=GM(e);return b5(),tPe(r.config??{}),r}X(KM,"processAndSetConfigs");async function Qse(e,r){n6();try{const{code:n,config:i}=KM(e);return{diagramType:(await toe(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}X(Qse,"parse");var DF=X((e,r,n=[])=>`
1123
1123
  .${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),mKe=X((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
@@ -1152,7 +1152,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
1152
1152
  `),n=(u=r.find(p=>p.startsWith("URL: ")))==null?void 0:u.replace("URL: ","").trim(),i=(h=r.find(p=>p.startsWith("Title: ")))==null?void 0:h.replace("Title: ","").trim(),s=r.findIndex(p=>p.trim()==="Interactive elements:"),o=s>=0?r.slice(0,s):r,a=o.findIndex(p=>p.trim()==="Text:"),l=a>=0?o.slice(a+1).join(`
1153
1153
  `).trim():"",d=s>=0?r.slice(s+1).map(p=>p.trim()).filter(Boolean):[];return c.jsxs("div",{className:"space-y-2 rounded-md border bg-muted/20 p-3 text-xs",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-semibold text-foreground/90",children:"Browser snapshot"}),i?c.jsx("div",{className:"text-muted-foreground",children:i}):null,n?c.jsx("div",{className:"font-mono text-xs break-all",children:n}):null]}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-xs uppercase tracking-wide text-muted-foreground",children:"Text"}),c.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-background p-2 font-mono text-xs leading-5",children:l||"(no textual content)"})]}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-xs uppercase tracking-wide text-muted-foreground",children:"Interactive elements"}),d.length?c.jsx("ul",{className:"max-h-40 space-y-1 overflow-auto rounded bg-background p-2 font-mono text-xs",children:d.map((p,g)=>c.jsx("li",{className:"break-all",children:p},`${p}-${g}`))}):c.jsx("div",{className:"rounded bg-background p-2 text-muted-foreground",children:"No interactive elements found."})]})]})}function nXe({path:e}){const[r,n]=y.useState(!1),[i,s]=y.useState(!1),o=e.trim(),a=Eoe(o)??`${Ln()}/api/browser/screenshot?path=${encodeURIComponent(o)}`;return c.jsxs("div",{className:"space-y-2 rounded-md bg-muted/30 p-3 text-xs",children:[c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Screenshot path: ",c.jsx("span",{className:"font-mono break-all",children:o})]}),c.jsxs("div",{className:"group relative overflow-hidden rounded-md bg-background/90 ring-1 ring-inset ring-border/35",children:[c.jsx("img",{src:a,alt:"Browser screenshot",className:"max-h-80 w-full cursor-pointer object-contain transition-opacity group-hover:opacity-80",onLoad:()=>n(!0),onError:()=>n(!1),onClick:()=>r&&s(!0)}),r&&c.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:c.jsx("span",{className:"rounded-full bg-black/60 px-3 py-1.5 text-xs font-medium text-white",children:"Click to expand"})})]}),!r&&c.jsx("div",{className:"rounded bg-background p-2 text-muted-foreground",children:"Preview unavailable in browser. Open the screenshot path directly from the host environment."}),i&&c.jsx(Lh,{open:!0,onOpenChange:l=>!l&&s(!1),children:c.jsx(jd,{className:"max-w-[90vw] max-h-[90vh] p-2",showCloseButton:!0,children:c.jsx("img",{src:a,alt:"Browser screenshot",className:"max-h-[85vh] w-full object-contain"})})})]})}function TC(e){var i;const r=typeof e.args.terminalId=="string"?e.args.terminalId:null;if(r)return r;const n=(i=e.result)==null?void 0:i.data;if(n&&typeof n=="object"){const s=n,o=typeof s.terminalId=="string"?s.terminalId:null;if(o)return o;const a=typeof s.id=="string"?s.id:null;if(a)return a;const l=typeof s.surfaceId=="string"?s.surfaceId:null;if(l)return l}return null}function iXe(e){var n;const r=Da(e.tool);if(r==="surfaces.start"){if(e.args.type==="terminal")return TC(e)!==null;const i=(n=e.result)==null?void 0:n.data;return i&&typeof i=="object"&&i.type==="terminal"?TC(e)!==null:!1}return r==="execute"||r.startsWith("terminal.")?TC(e)!==null:!1}function Ioe(e){if(!e)return null;const r=e.match(/"command"\s*:\s*"((?:[^"\\]|\\.)*)/);return r?r[1].replace(/\\n/g,`
1154
1154
  `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function cu(e,r){if(!e)return null;const n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`"${n}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`),s=e.match(i);return s?s[1].replace(/\\n/g,`
1155
- `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function Boe(e){if(!e)return null;const r=cu(e,"url")??cu(e,"uri")??cu(e,"href")??cu(e,"query")??cu(e,"q");if(r)return Wf(r)??r;const n=cu(e,"type"),i=cu(e,"action");return n==="webSearch"||i==="webSearch"?"web search":n==="fetch"||i==="fetch"?"website":null}function sXe({tool:e,streamingArgs:r}){const n=Da(e),i=Poe[n],s=n.startsWith("terminal."),o=s?Ioe(r):null,a=n==="web"||n==="web.search"||n==="web.fetch"||n==="browser.search"||n==="browser.fetch",l=a?Boe(r):null;return i&&s&&o?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:o}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i&&a&&l?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsxs("span",{children:[i.label,":"]}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:l}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i?c.jsxs("span",{className:"text-blue-400",children:[i.label,c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-1 align-text-bottom"})]}):e?c.jsxs("span",{className:"text-blue-400",children:[c.jsx("code",{className:"text-xs font-mono",children:e}),c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("span",{className:"text-muted-foreground",children:"Preparing..."})}function oXe({tool:e,streamingArgs:r,scrollRef:n}){const i=Da(e),s=i.startsWith("terminal."),o=s?Ioe(r):null,a=i==="web"||i==="web.search"||i==="web.fetch"||i==="browser.search"||i==="browser.fetch",l=a?Boe(r):null;if(s&&o)return c.jsxs("pre",{ref:n,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground"),children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),o,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]});if(a&&l){const d=i==="web.search"||i==="browser.search"?"Searching":"Fetching";return c.jsx("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:[d," ",l,"..."]})]})})}if(i==="memory.save"){const d=cu(r,"scope")??"memory",u=cu(r,"content");return c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Saving memory (",d,")..."]})]}),u?c.jsxs("div",{className:"mt-1 opacity-80",children:['"',ad(u,120),'"']}):null]})}if(i==="cron.add"){const d=cu(r,"name"),u=cu(r,"cron"),h=cu(r,"toolName");return c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Creating cron job",d?`: ${d}`:"..."]})]}),(u||h)&&c.jsxs("div",{className:"mt-1 opacity-80",children:[u?`schedule ${u}`:"",u&&h?" • ":"",h?`tool ${h}`:""]})]})}return r?c.jsxs("pre",{ref:n,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-36 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-muted-foreground"),children:[r,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsx("span",{children:"Preparing..."})]})})}function zoe(e){const r=new Map,n=new Set;for(let i=0;i<e.length;i++){const s=e[i];if(Da(s.tool)!=="agent")continue;const o=[];for(let a=i+1;a<e.length;a++){const l=e[a];if(n.has(l.callId))continue;const d=s.status==="running"||s.status==="pending",u=s.completedAt!=null&&l.startedAt<=s.completedAt;if(d||u)o.push(l),n.add(l.callId);else break}o.length>0&&r.set(s.callId,o)}return{childMap:r,parentSet:n}}function Foe(e){return e==="browserScreenshot"}function Hoe(e){var o,a;const r=Da(e.tool),n=(o=e.result)!=null&&o.data&&typeof e.result.data=="object"?e.result.data:void 0,i=vu(r,e.args,n),s=Roe(r,i,n,(a=e.result)==null?void 0:a.message);return Foe(Moe({tool:r,args:i,status:e.status,displayOutput:Doe(e.result,r)||e.streamingOutput||"",snapshotText:typeof(n==null?void 0:n.snapshot)=="string"?n.snapshot:null,screenshotPath:s}))}function aXe({path:e,onOpenDiff:r,disabled:n}){const i=tP(e),s=!!r&&!n,o=c.jsxs(c.Fragment,{children:[c.jsx(So,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[220px] truncate",children:i})]});return s?c.jsx("span",{role:"button",tabIndex:0,className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground transition-colors hover:bg-muted cursor-pointer",title:`Open diff for ${e}`,onClick:a=>{a.preventDefault(),a.stopPropagation(),r(e)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),r(e))},children:o}):c.jsx("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground",title:e,children:o})}function lXe({call:e,childCalls:r,onOpenTerminal:n,onOpenDiff:i}){var te,se,ge,le,Je,Ze,Ie,ne,Te;const s=Hoe(e),[o,a]=y.useState(e.status==="running"||e.status==="pending"||s),[l,d]=y.useState(()=>Date.now()),u=y.useRef(e.status),h=Da(e.tool),p=(te=e.result)!=null&&te.data&&typeof e.result.data=="object"?e.result.data:void 0,g=vu(h,e.args,p),v=h==="mcp-tool"?eP(g,p):null,b=v?BYe(v.title):null,_=Loe(h),k=(b==null?void 0:b.icon)??_.icon,w=(b==null?void 0:b.color)??_.color,C=VYe(h,g,p,(se=e.result)==null?void 0:se.message),j=kO(h,g),A=Doe(e.result,h)||e.streamingOutput||"",E=typeof(p==null?void 0:p.snapshot)=="string"?p.snapshot:null,R=Roe(h,g,p,(ge=e.result)==null?void 0:ge.message),P=h.startsWith("terminal.")||h==="execute",H=eXe(e),$=iXe(e),U=$?TC(e):null,I=JYe(h,g),Y=e.status==="pending",M=((Je=SO(h,g,p,(le=e.result)==null?void 0:le.message))==null?void 0:Je.trim())??"",z=!!M&&HYe(h),L=aH(A),B=aH(e.streamingArgs),W=Moe({tool:h,args:g,status:e.status,displayOutput:A,snapshotText:E,screenshotPath:R}),K=Foe(W),F=W==="terminal"?!0:W!=="none"&&!K,V=e.status==="pending"||e.status==="running"?sr:e.status==="success"?Hl:Th,J=e.status==="pending"?"text-blue-400":e.status==="running"?"text-muted-foreground":e.status==="success"?"text-green-500":"text-red-500";y.useEffect(()=>{const _e=u.current;!K&&(_e==="running"||_e==="pending")&&e.status!=="running"&&e.status!=="pending"&&a(!1),(e.status==="pending"||e.status==="running"||K)&&a(!0),u.current=e.status},[e.status,K]),y.useEffect(()=>{var _e;h!=="web"&&h!=="web.search"&&h!=="web.fetch"&&h!=="browser.search"&&h!=="browser.fetch"||console.debug("[tool-call-card:web]",{tool:e.tool,normalizedTool:h,callId:e.callId,status:e.status,rawArgs:e.args,normalizedArgs:g,resultMessage:(_e=e.result)==null?void 0:_e.message,resultData:p,streamingArgs:e.streamingArgs})},[e.args,e.callId,(Ze=e.result)==null?void 0:Ze.message,e.status,e.streamingArgs,e.tool,g,h,p]),y.useEffect(()=>{if(e.status!=="running"&&e.status!=="pending")return;const _e=window.setInterval(()=>d(Date.now()),250);return()=>window.clearInterval(_e)},[e.status]);const q=IYe(h,g,p,(Ie=e.result)==null?void 0:Ie.message),re=e.status==="running"||e.status==="pending"?q.running:q.done,de=c.jsxs(c.Fragment,{children:[c.jsx(V,{className:Ve("h-4 w-4 shrink-0",J,(e.status==="running"||e.status==="pending")&&"animate-spin")}),c.jsx(k,{className:Ve("h-4 w-4 shrink-0",w)}),c.jsx("span",{className:"text-sm font-medium text-muted-foreground truncate flex-1",children:Y?c.jsx(sXe,{tool:e.tool,streamingArgs:e.streamingArgs}):P?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",title:C,children:C})]}):z?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[re,":"]}),c.jsx(aXe,{path:M,onOpenDiff:i,disabled:e.status!=="success"})]}):v&&(v.title||v.details)?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[re,":"]}),c.jsxs("span",{className:"min-w-0 truncate",children:[v.title?c.jsx("code",{className:"text-xs font-mono",children:v.title}):null,v.title&&v.details?c.jsx("span",{className:"text-muted-foreground",children:" • "}):null,v.details?c.jsx("span",{className:"text-xs text-muted-foreground",children:v.details}):null]})]}):c.jsxs("span",{children:[re,": ",c.jsx("code",{className:"text-xs font-mono",children:C})]})}),c.jsx("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:c.jsx(jO,{startedAt:e.startedAt,completedAt:e.completedAt,now:l})}),j&&c.jsx("span",{className:"rounded border border-blue-500/25 bg-blue-500/10 px-1.5 py-0.5 text-2xs font-semibold tabular-nums text-blue-500 shrink-0",children:j}),H&&c.jsx("span",{className:Ve("rounded border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wide shrink-0",H.className),children:H.label})]}),fe=W==="pending"?c.jsx(oXe,{tool:e.tool,streamingArgs:e.streamingArgs,scrollRef:B}):W==="terminal"?c.jsxs("pre",{ref:L,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground",e.result&&!e.result.ok&&"text-red-500 dark:text-red-400"),children:[!A&&e.status!=="running"&&c.jsxs("span",{className:"text-muted-foreground",children:[c.jsx("span",{className:"text-emerald-500 dark:text-emerald-400",children:"$ "}),C]}),A,e.status==="running"&&!A&&c.jsx("span",{className:"text-muted-foreground",children:"Running..."}),e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-foreground animate-pulse ml-0.5 align-text-bottom"})]}):W==="browserSnapshot"?c.jsx(rXe,{snapshot:E}):W==="browserScreenshot"?c.jsx(nXe,{path:R}):W==="subagent"?r&&r.length>0?c.jsxs("div",{className:"rounded-lg border border-purple-500/20 bg-purple-500/[0.03] text-xs",children:[(e.status==="running"||e.status==="pending")&&r.length>0&&c.jsxs("div",{className:"flex items-center justify-end gap-2 border-b border-purple-500/15 px-3 py-2 text-xs text-muted-foreground",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-purple-500"}),c.jsxs("span",{children:[r.length," tool",r.length!==1?"s":""]})]}),(e.status==="running"||e.status==="pending")&&r.length===0&&c.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Agent is working..."}),c.jsx("div",{className:"divide-y divide-border/30",children:r.map(_e=>c.jsx(Uf,{call:_e,onOpenTerminal:n,onOpenDiff:i},_e.callId))}),((ne=e.result)==null?void 0:ne.message)&&(e.status==="success"||e.status==="error")&&c.jsxs("div",{className:"border-t border-purple-500/15 px-3 py-2",children:[c.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Result"}),c.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-background/60 p-2 font-mono text-xs leading-5",children:e.result.message})]})]}):c.jsx(tXe,{data:p??{},message:(Te=e.result)==null?void 0:Te.message,status:e.status}):W==="editDiff"?c.jsx(EYe,{filePath:String(g.path??""),oldText:h==="file.patch"||h==="edit"&&g.search!=null?String(g.search??""):void 0,newText:h==="file.patch"||h==="edit"&&g.replace!=null?String(g.replace??""):void 0,writtenContent:h==="file.write"||h==="edit"&&g.content!=null?String(g.content??""):void 0,isNewFile:h==="file.write"}):W==="output"?c.jsxs("pre",{className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground",e.result&&!e.result.ok&&"text-red-500 dark:text-red-400"),children:[A,e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-foreground animate-pulse ml-0.5 align-text-bottom"})]}):W==="runningHint"?c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin"}),c.jsx("span",{children:I})]}),c.jsxs("div",{className:"mt-1 text-xs opacity-75",children:["Elapsed: ",c.jsx(jO,{startedAt:e.startedAt,completedAt:e.completedAt,now:l})]})]}):null;return c.jsxs(Cj,{open:F?o:!1,onOpenChange:a,children:[c.jsxs("div",{className:"group flex items-center gap-2 rounded-md px-3 py-2 hover:bg-muted/50 transition-colors",children:[F?c.jsxs(jj,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx(Ro,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),de]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx("span",{className:"h-3.5 w-3.5 shrink-0"}),de]}),$&&n&&c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),n(U)},children:c.jsx(Cm,{className:"h-3.5 w-3.5"})})}),c.jsx(en,{side:"top",children:"Open terminal"})]}),W==="editDiff"&&i&&e.status==="success"&&M&&c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),i(M)},children:c.jsx(Cm,{className:"h-3.5 w-3.5"})})}),c.jsx(en,{side:"top",children:"Open diff in editor"})]})]}),F&&c.jsx(Tj,{children:c.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:fe})}),K&&c.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:fe})]})}const Uf=y.memo(lXe);Uf.displayName="ToolCallCard";const Woe=3,N1=6;function cXe(e,r){if(!r||e.some(Hoe))return!1;const n=e.filter(i=>i.status!=="running"&&i.status!=="pending");return n.length>=Woe&&n.length===e.length}function uXe({calls:e,collapsible:r,onOpenTerminal:n,onOpenDiff:i}){const[s,o]=y.useState(!1),[a,l]=y.useState(()=>!cXe(e,r)),d=y.useRef(!1),{childMap:u,parentSet:h}=y.useMemo(()=>zoe(e),[e]),p=y.useMemo(()=>e.filter(P=>!h.has(P.callId)),[e,h]),g=p.filter(P=>P.status==="running"||P.status==="pending"),v=p.filter(P=>P.status!=="running"&&P.status!=="pending"),b=g.length===0&&v.length>0,_=r&&b&&v.length>=Woe;if(y.useEffect(()=>{_&&!d.current&&l(!1),d.current=b},[b,_]),e.length===0)return null;const k=v.filter(P=>P.status==="success").length,w=v.filter(P=>P.status==="error").length,C=$oe(v);if(_&&!a)return c.jsx("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18]",children:c.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex w-full items-center gap-2 px-3 py-2 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx(C,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:CO(v)}),k>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-500",children:[c.jsx(Hl,{className:"h-3 w-3"})," ",k]}),w>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-red-500",children:[c.jsx(Th,{className:"h-3 w-3"})," ",w]})]})});const j=!s&&v.length>N1,T=j?v.length-N1:0,A=j?v.slice(-N1):v,E=j?v.slice(0,T).filter(P=>P.status==="success").length:0,R=T-E;return c.jsxs("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18] divide-y divide-border/30",children:[_&&c.jsxs("button",{type:"button",onClick:()=>l(!1),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3 rotate-90 transition-transform"}),c.jsxs("span",{children:["Collapse ",CO(v)]})]}),j&&c.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3"}),c.jsxs("span",{children:[T," earlier tool call",T!==1?"s":"",E>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",E," passed)"]}),R>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",R," failed)"]})]})]}),s&&v.slice(0,T).map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId)),A.map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId)),g.map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId))]})}function Uoe(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0}const TO=y.memo(uXe,(e,r)=>e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.collapsible===r.collapsible&&Uoe(e.calls,r.calls));TO.displayName="ToolCallGroup";function cH(e,r){return r?!1:e.length>0&&e.every(n=>n.status!=="running"&&n.status!=="pending")}function dXe({provider:e,calls:r,isStreaming:n,onOpenTerminal:i,onOpenDiff:s}){const[o,a]=y.useState(()=>!cH(r,n)),[l,d]=y.useState(!1),[u,h]=y.useState(()=>Date.now()),p=y.useRef(!cH(r,n)),g=!!n||r.some(I=>I.status==="running"||I.status==="pending"),v=r.filter(I=>I.status==="success").length,b=r.filter(I=>I.status==="error").length,_=r.length>0?Math.min(...r.map(I=>I.startedAt)):Date.now(),k=!g&&r.length>0?Math.max(...r.map(I=>I.completedAt??I.startedAt)):void 0,w=$oe(r),{childMap:C,parentSet:j}=y.useMemo(()=>zoe(r),[r]),T=y.useMemo(()=>r.filter(I=>!j.has(I.callId)),[r,j]),A=T.filter(I=>I.status==="running"||I.status==="pending"),E=T.filter(I=>I.status!=="running"&&I.status!=="pending"),R=!l&&E.length>N1,P=R?E.length-N1:0,H=R?E.slice(-N1):E,$=R?E.slice(0,P).filter(I=>I.status==="success").length:0,U=P-$;return y.useEffect(()=>{p.current&&!g&&r.length>0&&a(!1),p.current=g},[g,r.length]),y.useEffect(()=>{if(!g)return;const I=window.setInterval(()=>h(Date.now()),250);return()=>window.clearInterval(I)},[g]),r.length===0?null:c.jsx(Cj,{open:o,onOpenChange:a,children:c.jsxs("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18]",children:[c.jsxs(jj,{className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),g?c.jsx(sr,{className:"h-4 w-4 shrink-0 text-muted-foreground animate-spin"}):c.jsx(w,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:CO(r)}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-muted-foreground tabular-nums shrink-0",children:[!g&&b>0&&c.jsxs("span",{className:"text-red-500",children:[b," failed"]}),c.jsx(jO,{startedAt:_,completedAt:k,now:u})]}),!g&&b===0&&v>0&&c.jsx(Hl,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),!g&&b>0&&c.jsx(Th,{className:"h-3.5 w-3.5 shrink-0 text-red-500"})]}),c.jsx(Tj,{children:c.jsxs("div",{className:"divide-y divide-border/30 border-t border-border/30",children:[R&&c.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3"}),c.jsxs("span",{children:[P," earlier tool call",P!==1?"s":"",$>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",$," passed)"]}),U>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",U," failed)"]})]})]}),l&&E.slice(0,P).map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId)),H.map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId)),A.map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId))]})})]})})}const NO=y.memo(dXe,(e,r)=>e.provider===r.provider&&e.isStreaming===r.isStreaming&&e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&Uoe(e.calls,r.calls));NO.displayName="AgentToolCallWrapper";function uH(e){switch(e){case"system":return"border-red-500/35 bg-red-500/10 text-red-700 dark:text-red-300";case"user":return"border-blue-500/35 bg-blue-500/10 text-blue-700 dark:text-blue-300";case"assistant":return"border-emerald-500/35 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";case"tool":return"border-amber-500/35 bg-amber-500/10 text-amber-700 dark:text-amber-300";default:return"border-border bg-muted text-muted-foreground"}}function Vf(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function hXe(e){return"content"in e?Vf(e.content):Vf(e)}function fXe(e){return(Array.isArray(e.tool_calls)?e.tool_calls:Array.isArray(e.toolCalls)?e.toolCalls:[]).map((n,i)=>{const s=n&&typeof n=="object"?n:{},o=s.function&&typeof s.function=="object"?s.function:{};return{id:Vf(s.id||s.call_id||s.tool_call_id||`tool-call-${i+1}`),name:Vf(o.name||s.name||s.tool||"tool"),args:Vf(o.arguments||s.arguments||s.args||{})}})}function pXe(e,r){const n=e&&typeof e=="object"?e:{},i=n.function&&typeof n.function=="object"?n.function:{};return{name:Vf(i.name||n.name||`tool_${r+1}`),description:typeof i.description=="string"?i.description:typeof n.description=="string"?n.description:void 0,raw:e}}function Voe(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function am(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function mXe({flow:e}){const r=e.rounds;if(!r.some(p=>p.metrics))return null;let i=0,s=0,o=0,a=0,l,d=0,u=0;for(const p of r){const g=p.metrics;g&&(i+=g.durationMs,g.promptTokens&&(s+=g.promptTokens),g.completionTokens&&(o+=g.completionTokens),g.totalTokens&&(a+=g.totalTokens),g.tokensPerSecond&&g.completionTokens&&(d+=g.tokensPerSecond*g.completionTokens,u+=g.completionTokens),g.contextUsage&&(l=g.contextUsage))}const h=u>0?Math.round(d/u*10)/10:void 0;return c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Bm,{className:"h-3 w-3"}),"Total Duration"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:Voe(i)}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.length," round",r.length!==1?"s":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(T8,{className:"h-3 w-3"}),"Tokens"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:a>0?am(a):s+o>0?am(s+o):"—"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[s>0?`${am(s)} in`:"",s>0&&o>0?" · ":"",o>0?`${am(o)} out`:"",s===0&&o===0?"estimated":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(dK,{className:"h-3 w-3"}),"Speed"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:h?`${h} tok/s`:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"completion tokens/sec"})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(qge,{className:"h-3 w-3"}),"Context Window"]}),l?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:[Math.round(l.ratio*100),"%"]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[am(l.total)," / ",am(l.limit)," tokens",l.pruned?" (pruned)":""]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"no data"})]})]})]})}function gXe({metrics:e}){return e?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[c.jsx("span",{title:"LLM request duration",children:Voe(e.durationMs)}),e.promptTokens!=null&&c.jsxs("span",{title:"Prompt tokens",children:[am(e.promptTokens)," prompt"]}),e.completionTokens!=null&&c.jsxs("span",{title:"Completion tokens",children:[am(e.completionTokens)," completion"]}),e.tokensPerSecond!=null&&c.jsxs("span",{title:"Completion tokens per second",className:"font-medium text-foreground/80",children:[e.tokensPerSecond," tok/s"]}),e.contextUsage&&c.jsxs("span",{title:"Context window utilisation",children:["ctx ",Math.round(e.contextUsage.ratio*100),"%",e.contextUsage.pruned?" (pruned)":""]})]}):null}function yXe(e,r){const n=[];if(!e)return r?[{id:"assistant-response",kind:"response",content:r}]:n;e.rounds.some(i=>i.metrics)&&n.push({id:"summary",kind:"summary",flow:e});for(const i of e.rounds){const s=Array.isArray(i.messages)?i.messages:[],o=Array.isArray(i.tools)?i.tools.map(pXe):[];n.push({id:`round-${i.round}`,kind:"round",round:i,messageCount:s.length,toolCount:o.length}),s.forEach((a,l)=>{const d=a&&typeof a=="object"?a:{content:a};n.push({id:`round-${i.round}-message-${l}`,kind:"message",roundNumber:i.round,index:l,role:Vf(d.role||"message"),content:hXe(d),raw:a,toolCalls:fXe(d)})}),o.length>0&&n.push({id:`round-${i.round}-tools`,kind:"tools",roundNumber:i.round,tools:o})}return r&&n.push({id:"assistant-response",kind:"response",content:r}),n}function vXe({row:e}){return e.kind==="summary"?c.jsx(mXe,{flow:e.flow}):e.kind==="round"?c.jsxs("div",{className:"rounded-md border border-border bg-background px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"rounded-md bg-foreground px-2 py-1 text-xs font-semibold text-background",children:["Round ",e.round.round]}),c.jsx("span",{className:"text-xs text-muted-foreground",children:e.round.model}),c.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.round.createdAt).toLocaleString()})]}),c.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[c.jsxs("span",{children:[e.messageCount," messages sent"]}),c.jsxs("span",{children:[e.toolCount," tool schemas available"]}),e.round.tool_choice?c.jsxs("span",{children:["tool_choice: ",e.round.tool_choice]}):null]}),c.jsx(gXe,{metrics:e.round.metrics})]}):e.kind==="tools"?c.jsxs("div",{className:"relative ml-4 border-l border-border pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs("div",{className:"rounded-md border border-border/80 bg-muted/25 p-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-foreground",children:[c.jsx(T9,{className:"h-3.5 w-3.5"}),"Tools offered to model in round ",e.roundNumber]}),c.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:e.tools.map(r=>c.jsxs("details",{className:"rounded-md border border-border/70 bg-background/70 p-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs font-medium text-foreground",children:r.name}),r.description?c.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:r.description}):null,c.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/40 p-2 font-mono text-xs leading-5",children:Vf(r.raw)})]},r.name))})]})]}):e.kind==="response"?c.jsxs("div",{className:"relative ml-4 border-l border-border pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-emerald-500/40 bg-background"}),c.jsxs("div",{className:"rounded-md border border-emerald-500/25 bg-emerald-500/10 p-3",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:Ve("rounded-md border px-2 py-0.5 text-xs font-semibold",uH("assistant")),children:"assistant response"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"rendered chat answer"})]}),c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/70 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty response)"})]})]}):c.jsxs("div",{className:"relative ml-4 border-l border-border pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs("div",{className:"rounded-md border border-border/80 bg-background p-3",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:Ve("rounded-md border px-2 py-0.5 text-xs font-semibold",uH(e.role)),children:e.role}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["round ",e.roundNumber," / message ",e.index+1]})]}),c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/35 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty content)"}),e.toolCalls.length>0?c.jsx("div",{className:"mt-3 space-y-2",children:e.toolCalls.map(r=>c.jsxs("details",{className:"rounded-md border border-amber-500/25 bg-amber-500/10 p-2",children:[c.jsxs("summary",{className:"cursor-pointer text-xs font-medium text-amber-800 dark:text-amber-200",children:["Tool call: ",r.name," ",c.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",r.id,")"]})]}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-background/70 p-2 font-mono text-xs leading-5",children:r.args||"{}"})]},r.id))}):null,c.jsxs("details",{className:"mt-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:"Raw message JSON"}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/35 p-2 font-mono text-xs leading-5",children:Vf(e.raw)})]})]})]})}function xXe({open:e,onOpenChange:r,contextFlow:n,responseContent:i}){const[s,o]=y.useState("trace"),[a,l]=y.useState(!1),d=y.useRef(null),u=y.useMemo(()=>yXe(n,i),[n,i]),h=y.useMemo(()=>n?JSON.stringify(n,null,2):"",[n]),p=J9({count:u.length,getScrollElement:()=>d.current,estimateSize:v=>{const b=u[v];return b?b.kind==="summary"?110:b.kind==="round"?120:b.kind==="tools"?Math.min(420,110+b.tools.length*72):b.kind==="response"?Math.min(520,120+Math.ceil(b.content.length/90)*18):Math.min(520,135+Math.ceil(b.content.length/90)*18+b.toolCalls.length*72):120},overscan:5,enabled:e&&s==="trace"});y.useEffect(()=>{if(!e||s!=="trace")return;const v=window.requestAnimationFrame(()=>{p.measure()});return()=>window.cancelAnimationFrame(v)},[e,s,u.length,p]);const g=async()=>{h&&(await navigator.clipboard.writeText(h),l(!0),window.setTimeout(()=>l(!1),1200))};return c.jsx(Lh,{open:e,onOpenChange:r,children:c.jsxs(jd,{showCloseButton:!1,className:"grid h-[85vh] max-w-[min(1200px,96vw)] grid-rows-[auto_minmax(0,1fr)] p-0",children:[c.jsx(Nh,{className:"border-b px-3 py-2",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(bd,{className:"shrink-0 text-sm font-semibold",children:"LLM Context Flow"}),c.jsx(p0,{className:"min-w-0 truncate text-xs",children:n?`${n.provider}${n.model?` / ${n.model}`:""} · ${n.rounds.length} round${n.rounds.length===1?"":"s"}`:"No context snapshot available"}),c.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[c.jsx(we,{type:"button",variant:s==="trace"?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>o("trace"),children:"Trace"}),c.jsx(we,{type:"button",variant:s==="raw"?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>o("raw"),children:"Raw"}),c.jsxs(we,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:g,disabled:!h,children:[a?c.jsx(ss,{className:"mr-1 h-3 w-3"}):c.jsx(du,{className:"mr-1 h-3 w-3"}),a?"Copied":"Copy"]}),c.jsxs(KG,{className:"ml-1 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[c.jsx(Zn,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),s==="trace"?c.jsxs("div",{className:"min-h-0 px-3 pb-3 pt-2",children:[n!=null&&n.note?c.jsx("p",{className:"mb-2 rounded-md border border-border/70 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground",children:n.note}):null,u.length>0?c.jsx("div",{ref:d,className:"h-full min-h-0 overflow-auto pr-2",children:c.jsx("div",{className:"relative w-full",style:{height:`${p.getTotalSize()}px`},children:p.getVirtualItems().map(v=>{const b=u[v.index];return b?c.jsx("div",{"data-index":v.index,ref:p.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${v.start}px)`},children:c.jsx(vXe,{row:b})},b.id):null})})}):c.jsxs("div",{className:"flex h-full items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(hm,{className:"mr-2 h-4 w-4"}),"No context snapshot is available for this message."]})]}):c.jsx("div",{className:"min-h-0 overflow-auto px-3 pb-3 pt-2",children:c.jsx("pre",{className:"min-h-full whitespace-pre-wrap break-words rounded-md border border-border/70 bg-muted/35 p-3 font-mono text-xs leading-relaxed text-foreground [overflow-wrap:anywhere]",children:h||"No context snapshot is available for this message."})})]})})}const EO=/^[A-Za-z]:[\\/]/,bXe=/^\//;function dH(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function _Xe(e){return EO.test(e)||bXe.test(e)}function wXe(e,r){const n=e.replace(/\\/g,"/");if(!n||n==="/")return!1;if(/^L\d+(?:C\d+)?$/i.test(r))return!0;const i=n.split("/").pop()??"";return/\.[A-Za-z0-9]+$/.test(i)}function SXe(e){if(!e)return null;const r=e.trim();if(!r)return null;let n=r,i="";try{const l=new URL(r);if(l.protocol==="http:"||l.protocol==="https:"){if(n=l.pathname,i=l.hash.startsWith("#")?l.hash.slice(1):l.hash,!wXe(n,i))return null}else{const d=r.indexOf("#");d>=0&&(n=r.slice(0,d),i=r.slice(d+1))}}catch{const l=r.indexOf("#");l>=0&&(n=r.slice(0,l),i=r.slice(l+1))}const s=decodeURIComponent(n);if(!_Xe(s))return null;const o={path:s},a=i.match(/^L(\d+)(?:C(\d+))?$/i);return a&&(o.line=Number.parseInt(a[1],10),a[2]&&(o.column=Number.parseInt(a[2],10))),o}function hH(e,r){if(!r)return!1;const n=dH(e),i=dH(r);if(!n||!i)return!1;const s=EO.test(n)?n.toLowerCase():n,o=EO.test(i)?i.toLowerCase():i;return s===o||s.startsWith(`${o}/`)}const kXe=3;function fH(e,r){return!!(e&&e!=="jait"&&r.length>=kXe)}const pH=/<pre[^>]*><code>([\s\S]*)<\/code><\/pre>/;function mH(){return c.jsx("span",{className:"inline-flex items-center gap-1",children:[0,1,2].map(e=>c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current animate-pulse",style:{animationDelay:`${e*160}ms`}},e))})}function CXe(e){const r=e.toLowerCase();return!r||r==="text"||r==="plain"?"txt":r==="shell"||r==="sh"?"bash":r}function jXe({code:e,language:r,className:n}){const[i,s]=y.useState(null);return y.useEffect(()=>{let o=!1;const a=setTimeout(()=>{(async()=>{var h,p;const d=document.documentElement.classList.contains("dark")?"github-dark":"github-light",u=CXe(r);try{const g=await XI(e,{lang:u,theme:d});if(o)return;s(((h=g.match(pH))==null?void 0:h[1])??null)}catch{try{const g=await XI(e,{lang:"txt",theme:d});if(o)return;s(((p=g.match(pH))==null?void 0:p[1])??null)}catch{o||s(null)}}})()},150);return()=>{o=!0,clearTimeout(a)}},[e,r]),i?c.jsx("code",{className:Ve(n,"whitespace-pre"),dangerouslySetInnerHTML:{__html:i}}):c.jsx("code",{className:Ve(n,"whitespace-pre"),children:e})}function qoe(e){return"prose dark:prose-invert max-w-none break-words [overflow-wrap:anywhere] prose-pre:bg-muted prose-pre:border prose-pre:max-w-full prose-pre:overflow-x-auto prose-code:before:content-none prose-code:after:content-none prose-p:leading-relaxed [font-size:0.9rem]"}function TXe(e){const r=e.replace(/\\/g,"/"),n=r.split("/");return n[n.length-1]??r}function NXe({href:e,target:r,onOpenPath:n}){const i=TXe(r.path),s=r.line?`L${r.line}${r.column?`:${r.column}`:""}`:null;return c.jsxs("a",{href:e,className:Ve("not-prose inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle text-xs font-medium leading-none text-foreground no-underline transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),title:r.path,onClick:o=>{o.preventDefault(),n(r.path,r.line,r.column)},children:[c.jsx(So,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[220px] truncate",children:i}),s?c.jsx("span",{className:"shrink-0 rounded bg-background/80 px-1 py-0.5 text-2xs text-muted-foreground",children:s}):null]})}function Goe(e){return{pre:({children:r})=>c.jsx(c.Fragment,{children:r}),code:({node:r,className:n,children:i,ref:s,...o})=>{var l,d;if(!(((l=r==null?void 0:r.position)==null?void 0:l.start.line)===((d=r==null?void 0:r.position)==null?void 0:d.end.line)&&!n)){const u=typeof n=="string"&&n.replace(/^language-/,"").split(" ")[0]||"text",h=String(i??"").replace(/\n$/,"");return c.jsxs(NEe,{code:h,language:u,children:[c.jsxs(EEe,{children:[c.jsx(AEe,{children:c.jsx(OEe,{children:u})}),c.jsx(REe,{children:c.jsx(MEe,{})})]}),c.jsx("div",{className:"overflow-x-auto px-3 py-2 text-sm",children:c.jsx(jXe,{code:h,language:u,className:n})})]})}return c.jsx("code",{className:Ve("not-prose inline-flex max-w-full items-baseline rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle font-mono text-xs font-medium leading-[1.2] text-foreground","shadow-[inset_0_1px_0_hsl(var(--background)/0.55)]"),...o,children:c.jsx("span",{className:"max-w-[32rem] truncate sm:max-w-[40rem]",children:i})})},a:({href:r,ref:n,...i})=>{if(!e)return c.jsx("a",{href:r,...i,children:i.children});const s=SXe(r);return s?c.jsx(NXe,{href:r,target:s,onOpenPath:e}):c.jsx("a",{href:r,...i,children:i.children})},img:({src:r,alt:n,ref:i,...s})=>{const o=typeof r=="string"?Eoe(r):null;return o?c.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"not-prose block overflow-hidden rounded-xl border border-border/60 bg-muted/20 no-underline",children:c.jsx("img",{src:o,alt:n??"Chat image",loading:"lazy",className:"max-h-[28rem] w-full object-contain bg-background/80",...s})}):c.jsx("span",{className:"inline-flex rounded-md border border-dashed border-border/70 px-2 py-1 text-xs text-muted-foreground",children:"image unavailable"})}}}function EXe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Goe(n),[n]);return c.jsx("div",{className:qoe(),children:c.jsx(nJ,{remarkPlugins:[iJ],components:i,children:e})})}function AXe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Goe(n),[n]),s=({blockMatch:a})=>c.jsx(nJ,{remarkPlugins:[iJ],components:i,children:a.output}),{blockMatches:o}=m4e({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:i4e()},isStreamFinished:!1});return c.jsx("div",{className:qoe(),children:o.map((a,l)=>{const d=a.block.component;return c.jsx(d,{blockMatch:a},l)})})}const AO=y.memo(function({content:r,compact:n,isStreaming:i,preferLlmUi:s,onOpenPath:o}){return s&&i?c.jsx(AXe,{content:r,compact:n,onOpenPath:o}):c.jsx(EXe,{content:r,compact:n,onOpenPath:o})});AO.displayName="AssistantMarkdown";function OXe({messageId:e,messageIndex:r,messageFromEnd:n,role:i,content:s,contextFlow:o,displayContent:a,referencedFiles:l,displaySegments:d,attachments:u,thinking:h,thinkingDuration:p,toolCalls:g,segments:v,isStreaming:b,compact:_,preferLlmUi:k,provider:w,onOpenTerminal:C,onEditMessage:j,editComposer:T,onOpenPath:A,onOpenDiff:E}){const R=i==="user",{userDisplayText:P,userDisplaySegments:H}=y.useMemo(()=>{if(!R)return{userDisplayText:s,userDisplaySegments:[]};if(d!=null&&d.length)return{userDisplayText:G1(d),userDisplaySegments:d};if(a){const Be=d5(a,l);return{userDisplayText:a,userDisplaySegments:Be}}const ke=KJ(s);return{userDisplayText:ke.text,userDisplaySegments:ke.displaySegments}},[R,s,a,l,d]),[$,U]=y.useState(!1),[I,Y]=y.useState(!1),[M,z]=y.useState(!1),[L,B]=y.useState(!1),[W,K]=y.useState(!1),[F,V]=y.useState(!1),[J,q]=y.useState(""),[ee,re]=y.useState([]),[de,fe]=y.useState(null),[te,se]=y.useState(null),ge=y.useMemo(()=>{if(!R)return[];const ke=As(te??H).flatMap(Be=>Be.type==="image"?[{name:Be.name,mimeType:Be.mimeType,data:Be.data,preview:`data:${Be.mimeType};base64,${Be.data}`}]:[]);return ke.length>0?ke:u??[]},[u,R,te,H]),le=y.useRef(null),Je=y.useRef(null),Ze=y.useRef(null);y.useEffect(()=>()=>{le.current!==null&&window.clearTimeout(le.current)},[]),y.useEffect(()=>{M||(q(P),re(H))},[M,H,P]),y.useEffect(()=>{if(!te&&de==null)return;const ke=de===P,Be=te===H||JSON.stringify(te??[])===JSON.stringify(H);ke&&Be&&(fe(null),se(null))},[te,de,H,P]),y.useEffect(()=>{var Be;if(!M){B(!1);return}const ke=window.requestAnimationFrame(()=>{B(!0)});return(Be=Ze.current)==null||Be.focus(),()=>window.cancelAnimationFrame(ke)},[M]);const Ie=()=>{var Be;const ke=[];if(g&&g.length>0)for(const it of g){const pt=it.tool.replace(/_/g,"."),st=Object.entries(it.args).filter(([,Xe])=>Xe!=null&&Xe!=="").map(([Xe,Qe])=>`${Xe}: ${typeof Qe=="string"?Qe:JSON.stringify(Qe)}`).join(", "),ot=it.status==="success"?"✓":it.status==="error"?"✗":"…",Dt=it.completedAt&&it.startedAt?`${((it.completedAt-it.startedAt)/1e3).toFixed(1)}s`:"";if(ke.push(`[${ot} ${pt}] ${st}`),(Be=it.result)!=null&&Be.message){const Xe=it.result.message.length>500?it.result.message.slice(0,500)+"…":it.result.message;ke.push(Xe)}Dt&&ke.push(`Duration: ${Dt}`),ke.push("")}return s&&ke.push(R?YJ(H)||P:s),ke.join(`
1155
+ `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function Boe(e){if(!e)return null;const r=cu(e,"url")??cu(e,"uri")??cu(e,"href")??cu(e,"query")??cu(e,"q");if(r)return Wf(r)??r;const n=cu(e,"type"),i=cu(e,"action");return n==="webSearch"||i==="webSearch"?"web search":n==="fetch"||i==="fetch"?"website":null}function sXe({tool:e,streamingArgs:r}){const n=Da(e),i=Poe[n],s=n.startsWith("terminal."),o=s?Ioe(r):null,a=n==="web"||n==="web.search"||n==="web.fetch"||n==="browser.search"||n==="browser.fetch",l=a?Boe(r):null;return i&&s&&o?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:o}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i&&a&&l?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsxs("span",{children:[i.label,":"]}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",children:l}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i?c.jsxs("span",{className:"text-blue-400",children:[i.label,c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-1 align-text-bottom"})]}):e?c.jsxs("span",{className:"text-blue-400",children:[c.jsx("code",{className:"text-xs font-mono",children:e}),c.jsx("span",{className:"inline-block w-1 h-3 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("span",{className:"text-muted-foreground",children:"Preparing..."})}function oXe({tool:e,streamingArgs:r,scrollRef:n}){const i=Da(e),s=i.startsWith("terminal."),o=s?Ioe(r):null,a=i==="web"||i==="web.search"||i==="web.fetch"||i==="browser.search"||i==="browser.fetch",l=a?Boe(r):null;if(s&&o)return c.jsxs("pre",{ref:n,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground"),children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),o,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]});if(a&&l){const d=i==="web.search"||i==="browser.search"?"Searching":"Fetching";return c.jsx("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:[d," ",l,"..."]})]})})}if(i==="memory.save"){const d=cu(r,"scope")??"memory",u=cu(r,"content");return c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Saving memory (",d,")..."]})]}),u?c.jsxs("div",{className:"mt-1 opacity-80",children:['"',ad(u,120),'"']}):null]})}if(i==="cron.add"){const d=cu(r,"name"),u=cu(r,"cron"),h=cu(r,"toolName");return c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Creating cron job",d?`: ${d}`:"..."]})]}),(u||h)&&c.jsxs("div",{className:"mt-1 opacity-80",children:[u?`schedule ${u}`:"",u&&h?" • ":"",h?`tool ${h}`:""]})]})}return r?c.jsxs("pre",{ref:n,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-36 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-muted-foreground"),children:[r,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):c.jsx("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsx("span",{children:"Preparing..."})]})})}function zoe(e){const r=new Map,n=new Set;for(let i=0;i<e.length;i++){const s=e[i];if(Da(s.tool)!=="agent")continue;const o=[];for(let a=i+1;a<e.length;a++){const l=e[a];if(n.has(l.callId))continue;const d=s.status==="running"||s.status==="pending",u=s.completedAt!=null&&l.startedAt<=s.completedAt;if(d||u)o.push(l),n.add(l.callId);else break}o.length>0&&r.set(s.callId,o)}return{childMap:r,parentSet:n}}function Foe(e){return e==="browserScreenshot"}function Hoe(e){var o,a;const r=Da(e.tool),n=(o=e.result)!=null&&o.data&&typeof e.result.data=="object"?e.result.data:void 0,i=vu(r,e.args,n),s=Roe(r,i,n,(a=e.result)==null?void 0:a.message);return Foe(Moe({tool:r,args:i,status:e.status,displayOutput:Doe(e.result,r)||e.streamingOutput||"",snapshotText:typeof(n==null?void 0:n.snapshot)=="string"?n.snapshot:null,screenshotPath:s}))}function aXe({path:e,onOpenDiff:r,disabled:n}){const i=tP(e),s=!!r&&!n,o=c.jsxs(c.Fragment,{children:[c.jsx(So,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[220px] truncate",children:i})]});return s?c.jsx("span",{role:"button",tabIndex:0,className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground transition-colors hover:bg-muted cursor-pointer",title:`Open diff for ${e}`,onClick:a=>{a.preventDefault(),a.stopPropagation(),r(e)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),r(e))},children:o}):c.jsx("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground",title:e,children:o})}function lXe({call:e,childCalls:r,onOpenTerminal:n,onOpenDiff:i}){var te,se,ge,le,Je,Ze,Ie,ne,Te;const s=Hoe(e),[o,a]=y.useState(e.status==="running"||e.status==="pending"||s),[l,d]=y.useState(()=>Date.now()),u=y.useRef(e.status),h=Da(e.tool),p=(te=e.result)!=null&&te.data&&typeof e.result.data=="object"?e.result.data:void 0,g=vu(h,e.args,p),v=h==="mcp-tool"?eP(g,p):null,b=v?BYe(v.title):null,_=Loe(h),k=(b==null?void 0:b.icon)??_.icon,w=(b==null?void 0:b.color)??_.color,C=VYe(h,g,p,(se=e.result)==null?void 0:se.message),j=kO(h,g),A=Doe(e.result,h)||e.streamingOutput||"",E=typeof(p==null?void 0:p.snapshot)=="string"?p.snapshot:null,R=Roe(h,g,p,(ge=e.result)==null?void 0:ge.message),P=h.startsWith("terminal.")||h==="execute",H=eXe(e),$=iXe(e),U=$?TC(e):null,I=JYe(h,g),Y=e.status==="pending",M=((Je=SO(h,g,p,(le=e.result)==null?void 0:le.message))==null?void 0:Je.trim())??"",z=!!M&&HYe(h),L=aH(A),B=aH(e.streamingArgs),W=Moe({tool:h,args:g,status:e.status,displayOutput:A,snapshotText:E,screenshotPath:R}),K=Foe(W),F=W==="terminal"?!0:W!=="none"&&!K,V=e.status==="pending"||e.status==="running"?sr:e.status==="success"?Hl:Th,J=e.status==="pending"?"text-blue-400":e.status==="running"?"text-muted-foreground":e.status==="success"?"text-green-500":"text-red-500";y.useEffect(()=>{const _e=u.current;!K&&(_e==="running"||_e==="pending")&&e.status!=="running"&&e.status!=="pending"&&a(!1),(e.status==="pending"||e.status==="running"||K)&&a(!0),u.current=e.status},[e.status,K]),y.useEffect(()=>{var _e;h!=="web"&&h!=="web.search"&&h!=="web.fetch"&&h!=="browser.search"&&h!=="browser.fetch"||console.debug("[tool-call-card:web]",{tool:e.tool,normalizedTool:h,callId:e.callId,status:e.status,rawArgs:e.args,normalizedArgs:g,resultMessage:(_e=e.result)==null?void 0:_e.message,resultData:p,streamingArgs:e.streamingArgs})},[e.args,e.callId,(Ze=e.result)==null?void 0:Ze.message,e.status,e.streamingArgs,e.tool,g,h,p]),y.useEffect(()=>{if(e.status!=="running"&&e.status!=="pending")return;const _e=window.setInterval(()=>d(Date.now()),250);return()=>window.clearInterval(_e)},[e.status]);const q=IYe(h,g,p,(Ie=e.result)==null?void 0:Ie.message),re=e.status==="running"||e.status==="pending"?q.running:q.done,de=c.jsxs(c.Fragment,{children:[c.jsx(V,{className:Ve("h-4 w-4 shrink-0",J,(e.status==="running"||e.status==="pending")&&"animate-spin")}),c.jsx(k,{className:Ve("h-4 w-4 shrink-0",w)}),c.jsx("span",{className:"text-sm font-medium text-muted-foreground truncate flex-1",children:Y?c.jsx(sXe,{tool:e.tool,streamingArgs:e.streamingArgs}):P?c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center gap-1.5 text-foreground",children:[c.jsx("span",{className:"shrink-0 text-xs text-emerald-500 dark:text-emerald-400 font-mono",children:"$"}),c.jsx("code",{className:"min-w-0 truncate text-xs font-mono",title:C,children:C})]}):z?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[re,":"]}),c.jsx(aXe,{path:M,onOpenDiff:i,disabled:e.status!=="success"})]}):v&&(v.title||v.details)?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[re,":"]}),c.jsxs("span",{className:"min-w-0 truncate",children:[v.title?c.jsx("code",{className:"text-xs font-mono",children:v.title}):null,v.title&&v.details?c.jsx("span",{className:"text-muted-foreground",children:" • "}):null,v.details?c.jsx("span",{className:"text-xs text-muted-foreground",children:v.details}):null]})]}):c.jsxs("span",{children:[re,": ",c.jsx("code",{className:"text-xs font-mono",children:C})]})}),c.jsx("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:c.jsx(jO,{startedAt:e.startedAt,completedAt:e.completedAt,now:l})}),j&&c.jsx("span",{className:"rounded border border-blue-500/25 bg-blue-500/10 px-1.5 py-0.5 text-2xs font-semibold tabular-nums text-blue-500 shrink-0",children:j}),H&&c.jsx("span",{className:Ve("rounded border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wide shrink-0",H.className),children:H.label})]}),fe=W==="pending"?c.jsx(oXe,{tool:e.tool,streamingArgs:e.streamingArgs,scrollRef:B}):W==="terminal"?c.jsxs("pre",{ref:L,className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground",e.result&&!e.result.ok&&"text-red-500 dark:text-red-400"),children:[!A&&e.status!=="running"&&c.jsxs("span",{className:"text-muted-foreground",children:[c.jsx("span",{className:"text-emerald-500 dark:text-emerald-400",children:"$ "}),C]}),A,e.status==="running"&&!A&&c.jsx("span",{className:"text-muted-foreground",children:"Running..."}),e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-foreground animate-pulse ml-0.5 align-text-bottom"})]}):W==="browserSnapshot"?c.jsx(rXe,{snapshot:E}):W==="browserScreenshot"?c.jsx(nXe,{path:R}):W==="subagent"?r&&r.length>0?c.jsxs("div",{className:"rounded-lg border border-purple-500/20 bg-purple-500/[0.03] text-xs",children:[(e.status==="running"||e.status==="pending")&&r.length>0&&c.jsxs("div",{className:"flex items-center justify-end gap-2 border-b border-purple-500/15 px-3 py-2 text-xs text-muted-foreground",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin text-purple-500"}),c.jsxs("span",{children:[r.length," tool",r.length!==1?"s":""]})]}),(e.status==="running"||e.status==="pending")&&r.length===0&&c.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Agent is working..."}),c.jsx("div",{className:"divide-y divide-border/30",children:r.map(_e=>c.jsx(Uf,{call:_e,onOpenTerminal:n,onOpenDiff:i},_e.callId))}),((ne=e.result)==null?void 0:ne.message)&&(e.status==="success"||e.status==="error")&&c.jsxs("div",{className:"border-t border-purple-500/15 px-3 py-2",children:[c.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Result"}),c.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap rounded bg-background/60 p-2 font-mono text-xs leading-5",children:e.result.message})]})]}):c.jsx(tXe,{data:p??{},message:(Te=e.result)==null?void 0:Te.message,status:e.status}):W==="editDiff"?c.jsx(EYe,{filePath:String(g.path??""),oldText:h==="file.patch"||h==="edit"&&g.search!=null?String(g.search??""):void 0,newText:h==="file.patch"||h==="edit"&&g.replace!=null?String(g.replace??""):void 0,writtenContent:h==="file.write"||h==="edit"&&g.content!=null?String(g.content??""):void 0,isNewFile:h==="file.write"}):W==="output"?c.jsxs("pre",{className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-muted/40 text-foreground",e.result&&!e.result.ok&&"text-red-500 dark:text-red-400"),children:[A,e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-foreground animate-pulse ml-0.5 align-text-bottom"})]}):W==="runningHint"?c.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-muted/40 text-foreground"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(sr,{className:"h-3 w-3 animate-spin"}),c.jsx("span",{children:I})]}),c.jsxs("div",{className:"mt-1 text-xs opacity-75",children:["Elapsed: ",c.jsx(jO,{startedAt:e.startedAt,completedAt:e.completedAt,now:l})]})]}):null;return c.jsxs(Cj,{open:F?o:!1,onOpenChange:a,children:[c.jsxs("div",{className:"group flex items-center gap-2 rounded-md px-3 py-2 hover:bg-muted/50 transition-colors",children:[F?c.jsxs(jj,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx(Ro,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),de]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx("span",{className:"h-3.5 w-3.5 shrink-0"}),de]}),$&&n&&c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),n(U)},children:c.jsx(Cm,{className:"h-3.5 w-3.5"})})}),c.jsx(en,{side:"top",children:"Open terminal"})]}),W==="editDiff"&&i&&e.status==="success"&&M&&c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),i(M)},children:c.jsx(Cm,{className:"h-3.5 w-3.5"})})}),c.jsx(en,{side:"top",children:"Open diff in editor"})]})]}),F&&c.jsx(Tj,{children:c.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:fe})}),K&&c.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:fe})]})}const Uf=y.memo(lXe);Uf.displayName="ToolCallCard";const Woe=3,N1=6;function cXe(e,r){if(!r||e.some(Hoe))return!1;const n=e.filter(i=>i.status!=="running"&&i.status!=="pending");return n.length>=Woe&&n.length===e.length}function uXe({calls:e,collapsible:r,onOpenTerminal:n,onOpenDiff:i}){const[s,o]=y.useState(!1),[a,l]=y.useState(()=>!cXe(e,r)),d=y.useRef(!1),{childMap:u,parentSet:h}=y.useMemo(()=>zoe(e),[e]),p=y.useMemo(()=>e.filter(P=>!h.has(P.callId)),[e,h]),g=p.filter(P=>P.status==="running"||P.status==="pending"),v=p.filter(P=>P.status!=="running"&&P.status!=="pending"),b=g.length===0&&v.length>0,_=r&&b&&v.length>=Woe;if(y.useEffect(()=>{_&&!d.current&&l(!1),d.current=b},[b,_]),e.length===0)return null;const k=v.filter(P=>P.status==="success").length,w=v.filter(P=>P.status==="error").length,C=$oe(v);if(_&&!a)return c.jsx("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18]",children:c.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex w-full items-center gap-2 px-3 py-2 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx(C,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:CO(v)}),k>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-500",children:[c.jsx(Hl,{className:"h-3 w-3"})," ",k]}),w>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-red-500",children:[c.jsx(Th,{className:"h-3 w-3"})," ",w]})]})});const j=!s&&v.length>N1,T=j?v.length-N1:0,A=j?v.slice(-N1):v,E=j?v.slice(0,T).filter(P=>P.status==="success").length:0,R=T-E;return c.jsxs("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18] divide-y divide-border/30",children:[_&&c.jsxs("button",{type:"button",onClick:()=>l(!1),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3 rotate-90 transition-transform"}),c.jsxs("span",{children:["Collapse ",CO(v)]})]}),j&&c.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3"}),c.jsxs("span",{children:[T," earlier tool call",T!==1?"s":"",E>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",E," passed)"]}),R>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",R," failed)"]})]})]}),s&&v.slice(0,T).map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId)),A.map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId)),g.map(P=>c.jsx(Uf,{call:P,childCalls:u.get(P.callId),onOpenTerminal:n,onOpenDiff:i},P.callId))]})}function Uoe(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0}const TO=y.memo(uXe,(e,r)=>e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.collapsible===r.collapsible&&Uoe(e.calls,r.calls));TO.displayName="ToolCallGroup";function cH(e,r){return r?!1:e.length>0&&e.every(n=>n.status!=="running"&&n.status!=="pending")}function dXe({provider:e,calls:r,isStreaming:n,onOpenTerminal:i,onOpenDiff:s}){const[o,a]=y.useState(()=>!cH(r,n)),[l,d]=y.useState(!1),[u,h]=y.useState(()=>Date.now()),p=y.useRef(!cH(r,n)),g=!!n||r.some(I=>I.status==="running"||I.status==="pending"),v=r.filter(I=>I.status==="success").length,b=r.filter(I=>I.status==="error").length,_=r.length>0?Math.min(...r.map(I=>I.startedAt)):Date.now(),k=!g&&r.length>0?Math.max(...r.map(I=>I.completedAt??I.startedAt)):void 0,w=$oe(r),{childMap:C,parentSet:j}=y.useMemo(()=>zoe(r),[r]),T=y.useMemo(()=>r.filter(I=>!j.has(I.callId)),[r,j]),A=T.filter(I=>I.status==="running"||I.status==="pending"),E=T.filter(I=>I.status!=="running"&&I.status!=="pending"),R=!l&&E.length>N1,P=R?E.length-N1:0,H=R?E.slice(-N1):E,$=R?E.slice(0,P).filter(I=>I.status==="success").length:0,U=P-$;return y.useEffect(()=>{p.current&&!g&&r.length>0&&a(!1),p.current=g},[g,r.length]),y.useEffect(()=>{if(!g)return;const I=window.setInterval(()=>h(Date.now()),250);return()=>window.clearInterval(I)},[g]),r.length===0?null:c.jsx(Cj,{open:o,onOpenChange:a,children:c.jsxs("div",{className:"my-2 overflow-hidden rounded-xl border border-border/40 bg-muted/[0.18]",children:[c.jsxs(jj,{className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",o&&"rotate-90")}),g?c.jsx(sr,{className:"h-4 w-4 shrink-0 text-muted-foreground animate-spin"}):c.jsx(w,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:CO(r)}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-muted-foreground tabular-nums shrink-0",children:[!g&&b>0&&c.jsxs("span",{className:"text-red-500",children:[b," failed"]}),c.jsx(jO,{startedAt:_,completedAt:k,now:u})]}),!g&&b===0&&v>0&&c.jsx(Hl,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),!g&&b>0&&c.jsx(Th,{className:"h-3.5 w-3.5 shrink-0 text-red-500"})]}),c.jsx(Tj,{children:c.jsxs("div",{className:"divide-y divide-border/30 border-t border-border/30",children:[R&&c.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[c.jsx(Ro,{className:"h-3 w-3"}),c.jsxs("span",{children:[P," earlier tool call",P!==1?"s":"",$>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",$," passed)"]}),U>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",U," failed)"]})]})]}),l&&E.slice(0,P).map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId)),H.map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId)),A.map(I=>c.jsx(Uf,{call:I,childCalls:C.get(I.callId),onOpenTerminal:i,onOpenDiff:s},I.callId))]})})]})})}const NO=y.memo(dXe,(e,r)=>e.provider===r.provider&&e.isStreaming===r.isStreaming&&e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&Uoe(e.calls,r.calls));NO.displayName="AgentToolCallWrapper";function uH(e){switch(e){case"system":return"border-red-500/35 bg-red-500/10 text-red-700 dark:text-red-300";case"user":return"border-blue-500/35 bg-blue-500/10 text-blue-700 dark:text-blue-300";case"assistant":return"border-emerald-500/35 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";case"tool":return"border-amber-500/35 bg-amber-500/10 text-amber-700 dark:text-amber-300";default:return"border-border bg-muted text-muted-foreground"}}function Vf(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function hXe(e){return"content"in e?Vf(e.content):Vf(e)}function fXe(e){return(Array.isArray(e.tool_calls)?e.tool_calls:Array.isArray(e.toolCalls)?e.toolCalls:[]).map((n,i)=>{const s=n&&typeof n=="object"?n:{},o=s.function&&typeof s.function=="object"?s.function:{};return{id:Vf(s.id||s.call_id||s.tool_call_id||`tool-call-${i+1}`),name:Vf(o.name||s.name||s.tool||"tool"),args:Vf(o.arguments||s.arguments||s.args||{})}})}function pXe(e,r){const n=e&&typeof e=="object"?e:{},i=n.function&&typeof n.function=="object"?n.function:{};return{name:Vf(i.name||n.name||`tool_${r+1}`),description:typeof i.description=="string"?i.description:typeof n.description=="string"?n.description:void 0,raw:e}}function Voe(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function am(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function mXe({flow:e}){const r=e.rounds;if(!r.some(p=>p.metrics))return null;let i=0,s=0,o=0,a=0,l,d=0,u=0;for(const p of r){const g=p.metrics;g&&(i+=g.durationMs,g.promptTokens&&(s+=g.promptTokens),g.completionTokens&&(o+=g.completionTokens),g.totalTokens&&(a+=g.totalTokens),g.tokensPerSecond&&g.completionTokens&&(d+=g.tokensPerSecond*g.completionTokens,u+=g.completionTokens),g.contextUsage&&(l=g.contextUsage))}const h=u>0?Math.round(d/u*10)/10:void 0;return c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Bm,{className:"h-3 w-3"}),"Total Duration"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:Voe(i)}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.length," round",r.length!==1?"s":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(T8,{className:"h-3 w-3"}),"Tokens"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:a>0?am(a):s+o>0?am(s+o):"—"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[s>0?`${am(s)} in`:"",s>0&&o>0?" · ":"",o>0?`${am(o)} out`:"",s===0&&o===0?"estimated":""]})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(dK,{className:"h-3 w-3"}),"Speed"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:h?`${h} tok/s`:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"completion tokens/sec"})]}),c.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-2.5 py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(qge,{className:"h-3 w-3"}),"Context Window"]}),l?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:[Math.round(l.ratio*100),"%"]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[am(l.total)," / ",am(l.limit)," tokens",l.pruned?" (pruned)":""]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:"—"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"no data"})]})]})]})}function gXe({metrics:e}){return e?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[c.jsx("span",{title:"LLM request duration",children:Voe(e.durationMs)}),e.promptTokens!=null&&c.jsxs("span",{title:"Prompt tokens",children:[am(e.promptTokens)," prompt"]}),e.completionTokens!=null&&c.jsxs("span",{title:"Completion tokens",children:[am(e.completionTokens)," completion"]}),e.tokensPerSecond!=null&&c.jsxs("span",{title:"Completion tokens per second",className:"font-medium text-foreground/80",children:[e.tokensPerSecond," tok/s"]}),e.contextUsage&&c.jsxs("span",{title:"Context window utilisation",children:["ctx ",Math.round(e.contextUsage.ratio*100),"%",e.contextUsage.pruned?" (pruned)":""]})]}):null}function yXe(e,r){const n=[];if(!e)return r?[{id:"assistant-response",kind:"response",content:r}]:n;e.rounds.some(i=>i.metrics)&&n.push({id:"summary",kind:"summary",flow:e});for(const i of e.rounds){const s=Array.isArray(i.messages)?i.messages:[],o=Array.isArray(i.tools)?i.tools.map(pXe):[];n.push({id:`round-${i.round}`,kind:"round",round:i,messageCount:s.length,toolCount:o.length}),s.forEach((a,l)=>{const d=a&&typeof a=="object"?a:{content:a};n.push({id:`round-${i.round}-message-${l}`,kind:"message",roundNumber:i.round,index:l,role:Vf(d.role||"message"),content:hXe(d),raw:a,toolCalls:fXe(d)})}),o.length>0&&n.push({id:`round-${i.round}-tools`,kind:"tools",roundNumber:i.round,tools:o})}return r&&n.push({id:"assistant-response",kind:"response",content:r}),n}function vXe({row:e}){if(e.kind==="summary")return c.jsx(mXe,{flow:e.flow});if(e.kind==="round")return c.jsxs("div",{className:"rounded-md border border-border bg-background px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"rounded-md bg-foreground px-2 py-1 text-xs font-semibold text-background",children:["Round ",e.round.round]}),c.jsx("span",{className:"text-xs text-muted-foreground",children:e.round.model}),c.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.round.createdAt).toLocaleString()})]}),c.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[c.jsxs("span",{children:[e.messageCount," messages sent"]}),c.jsxs("span",{children:[e.toolCount," tool schemas available"]}),e.round.tool_choice?c.jsxs("span",{children:["tool_choice: ",e.round.tool_choice]}):null]}),c.jsx(gXe,{metrics:e.round.metrics})]});if(e.kind==="tools")return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs("div",{className:"rounded-md border border-border/80 bg-muted/25 p-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-foreground",children:[c.jsx(T9,{className:"h-3.5 w-3.5"}),"Tools offered to model in round ",e.roundNumber]}),c.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.tools.map(n=>c.jsxs("details",{className:"rounded-md border border-border/70 bg-background/70 p-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs font-medium text-foreground",children:n.name}),n.description?c.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:n.description}):null,c.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/40 p-2 font-mono text-xs leading-5",children:Vf(n.raw)})]},n.name))})]})]});if(e.kind==="response")return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-emerald-500/40 bg-background"}),c.jsxs("div",{className:"rounded-md border border-emerald-500/25 bg-emerald-500/10 p-3",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:Ve("rounded-md border px-2 py-0.5 text-xs font-semibold",uH("assistant")),children:"assistant response"}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"rendered chat answer"})]}),c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/70 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty response)"})]})]});const r=e.content?e.content.length>80?e.content.slice(0,80)+"...":e.content:"(empty content)";return c.jsxs("div",{className:"relative ml-2 sm:ml-4 border-l border-border pl-2 sm:pl-4",children:[c.jsx("div",{className:"absolute -left-1.5 top-3 h-3 w-3 rounded-full border border-border bg-background"}),c.jsxs("details",{className:"rounded-md border border-border/80 bg-background",children:[c.jsx("summary",{className:"cursor-pointer px-3 py-2",children:c.jsxs("div",{className:"inline-flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:Ve("rounded-md border px-2 py-0.5 text-xs font-semibold",uH(e.role)),children:e.role}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["round ",e.roundNumber," / message ",e.index+1]}),e.toolCalls.length>0?c.jsxs("span",{className:"text-xs text-amber-600 dark:text-amber-400",children:[e.toolCalls.length," tool call",e.toolCalls.length!==1?"s":""]}):null,c.jsx("span",{className:"text-xs text-muted-foreground/60 truncate max-w-[200px] sm:max-w-[400px]",children:r})]})}),c.jsxs("div",{className:"px-3 pb-3",children:[c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/35 p-3 font-mono text-xs leading-5 text-foreground [overflow-wrap:anywhere]",children:e.content||"(empty content)"}),e.toolCalls.length>0?c.jsx("div",{className:"mt-3 space-y-2",children:e.toolCalls.map(n=>c.jsxs("details",{className:"rounded-md border border-amber-500/25 bg-amber-500/10 p-2",children:[c.jsxs("summary",{className:"cursor-pointer text-xs font-medium text-amber-800 dark:text-amber-200",children:["Tool call: ",n.name," ",c.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",n.id,")"]})]}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-background/70 p-2 font-mono text-xs leading-5",children:n.args||"{}"})]},n.id))}):null,c.jsxs("details",{className:"mt-2",children:[c.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:"Raw message JSON"}),c.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted/35 p-2 font-mono text-xs leading-5",children:Vf(e.raw)})]})]})]})]})}function xXe({open:e,onOpenChange:r,contextFlow:n,responseContent:i}){const[s,o]=y.useState("trace"),[a,l]=y.useState(!1),d=y.useRef(null),u=y.useMemo(()=>yXe(n,i),[n,i]),h=y.useMemo(()=>n?JSON.stringify(n,null,2):"",[n]),p=J9({count:u.length,getScrollElement:()=>d.current,estimateSize:v=>{const b=u[v];return b?b.kind==="summary"?110:b.kind==="round"?120:b.kind==="tools"?Math.min(420,110+b.tools.length*72):b.kind==="response"?Math.min(520,120+Math.ceil(b.content.length/90)*18):52:120},overscan:5,enabled:e&&s==="trace"});y.useEffect(()=>{if(!e||s!=="trace")return;const v=window.requestAnimationFrame(()=>{p.measure()});return()=>window.cancelAnimationFrame(v)},[e,s,u.length,p]);const g=async()=>{h&&(await navigator.clipboard.writeText(h),l(!0),window.setTimeout(()=>l(!1),1200))};return c.jsx(Lh,{open:e,onOpenChange:r,children:c.jsxs(jd,{showCloseButton:!1,className:"grid h-[95vh] sm:h-[85vh] max-w-[min(1200px,96vw)] grid-rows-[auto_minmax(0,1fr)] p-0",children:[c.jsx(Nh,{className:"border-b px-3 py-2",children:c.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[c.jsx(bd,{className:"shrink-0 text-sm font-semibold",children:"LLM Context Flow"}),c.jsx(p0,{className:"min-w-0 basis-full truncate text-xs sm:basis-auto",children:n?`${n.provider}${n.model?` / ${n.model}`:""} · ${n.rounds.length} round${n.rounds.length===1?"":"s"}`:"No context snapshot available"}),c.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[c.jsx(we,{type:"button",variant:s==="trace"?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>o("trace"),children:"Trace"}),c.jsx(we,{type:"button",variant:s==="raw"?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>o("raw"),children:"Raw"}),c.jsxs(we,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:g,disabled:!h,children:[a?c.jsx(ss,{className:"mr-1 h-3 w-3"}):c.jsx(du,{className:"mr-1 h-3 w-3"}),a?"Copied":"Copy"]}),c.jsxs(KG,{className:"ml-1 rounded-sm p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[c.jsx(Zn,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),s==="trace"?c.jsxs("div",{className:"min-h-0 px-3 pb-3 pt-2",children:[n!=null&&n.note?c.jsx("p",{className:"mb-2 rounded-md border border-border/70 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground",children:n.note}):null,u.length>0?c.jsx("div",{ref:d,className:"h-full min-h-0 overflow-auto pr-2",children:c.jsx("div",{className:"relative w-full",style:{height:`${p.getTotalSize()}px`},children:p.getVirtualItems().map(v=>{const b=u[v.index];return b?c.jsx("div",{"data-index":v.index,ref:p.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${v.start}px)`},children:c.jsx(vXe,{row:b})},b.id):null})})}):c.jsxs("div",{className:"flex h-full items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(hm,{className:"mr-2 h-4 w-4"}),"No context snapshot is available for this message."]})]}):c.jsx("div",{className:"min-h-0 overflow-auto px-3 pb-3 pt-2",children:c.jsx("pre",{className:"min-h-full whitespace-pre-wrap break-words rounded-md border border-border/70 bg-muted/35 p-3 font-mono text-xs leading-relaxed text-foreground [overflow-wrap:anywhere]",children:h||"No context snapshot is available for this message."})})]})})}const EO=/^[A-Za-z]:[\\/]/,bXe=/^\//;function dH(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function _Xe(e){return EO.test(e)||bXe.test(e)}function wXe(e,r){const n=e.replace(/\\/g,"/");if(!n||n==="/")return!1;if(/^L\d+(?:C\d+)?$/i.test(r))return!0;const i=n.split("/").pop()??"";return/\.[A-Za-z0-9]+$/.test(i)}function SXe(e){if(!e)return null;const r=e.trim();if(!r)return null;let n=r,i="";try{const l=new URL(r);if(l.protocol==="http:"||l.protocol==="https:"){if(n=l.pathname,i=l.hash.startsWith("#")?l.hash.slice(1):l.hash,!wXe(n,i))return null}else{const d=r.indexOf("#");d>=0&&(n=r.slice(0,d),i=r.slice(d+1))}}catch{const l=r.indexOf("#");l>=0&&(n=r.slice(0,l),i=r.slice(l+1))}const s=decodeURIComponent(n);if(!_Xe(s))return null;const o={path:s},a=i.match(/^L(\d+)(?:C(\d+))?$/i);return a&&(o.line=Number.parseInt(a[1],10),a[2]&&(o.column=Number.parseInt(a[2],10))),o}function hH(e,r){if(!r)return!1;const n=dH(e),i=dH(r);if(!n||!i)return!1;const s=EO.test(n)?n.toLowerCase():n,o=EO.test(i)?i.toLowerCase():i;return s===o||s.startsWith(`${o}/`)}const kXe=3;function fH(e,r){return!!(e&&e!=="jait"&&r.length>=kXe)}const pH=/<pre[^>]*><code>([\s\S]*)<\/code><\/pre>/;function mH(){return c.jsx("span",{className:"inline-flex items-center gap-1",children:[0,1,2].map(e=>c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current animate-pulse",style:{animationDelay:`${e*160}ms`}},e))})}function CXe(e){const r=e.toLowerCase();return!r||r==="text"||r==="plain"?"txt":r==="shell"||r==="sh"?"bash":r}function jXe({code:e,language:r,className:n}){const[i,s]=y.useState(null);return y.useEffect(()=>{let o=!1;const a=setTimeout(()=>{(async()=>{var h,p;const d=document.documentElement.classList.contains("dark")?"github-dark":"github-light",u=CXe(r);try{const g=await XI(e,{lang:u,theme:d});if(o)return;s(((h=g.match(pH))==null?void 0:h[1])??null)}catch{try{const g=await XI(e,{lang:"txt",theme:d});if(o)return;s(((p=g.match(pH))==null?void 0:p[1])??null)}catch{o||s(null)}}})()},150);return()=>{o=!0,clearTimeout(a)}},[e,r]),i?c.jsx("code",{className:Ve(n,"whitespace-pre"),dangerouslySetInnerHTML:{__html:i}}):c.jsx("code",{className:Ve(n,"whitespace-pre"),children:e})}function qoe(e){return"prose dark:prose-invert max-w-none break-words [overflow-wrap:anywhere] prose-pre:bg-muted prose-pre:border prose-pre:max-w-full prose-pre:overflow-x-auto prose-code:before:content-none prose-code:after:content-none prose-p:leading-relaxed [font-size:0.9rem]"}function TXe(e){const r=e.replace(/\\/g,"/"),n=r.split("/");return n[n.length-1]??r}function NXe({href:e,target:r,onOpenPath:n}){const i=TXe(r.path),s=r.line?`L${r.line}${r.column?`:${r.column}`:""}`:null;return c.jsxs("a",{href:e,className:Ve("not-prose inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle text-xs font-medium leading-none text-foreground no-underline transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),title:r.path,onClick:o=>{o.preventDefault(),n(r.path,r.line,r.column)},children:[c.jsx(So,{filename:i,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[220px] truncate",children:i}),s?c.jsx("span",{className:"shrink-0 rounded bg-background/80 px-1 py-0.5 text-2xs text-muted-foreground",children:s}):null]})}function Goe(e){return{pre:({children:r})=>c.jsx(c.Fragment,{children:r}),code:({node:r,className:n,children:i,ref:s,...o})=>{var l,d;if(!(((l=r==null?void 0:r.position)==null?void 0:l.start.line)===((d=r==null?void 0:r.position)==null?void 0:d.end.line)&&!n)){const u=typeof n=="string"&&n.replace(/^language-/,"").split(" ")[0]||"text",h=String(i??"").replace(/\n$/,"");return c.jsxs(NEe,{code:h,language:u,children:[c.jsxs(EEe,{children:[c.jsx(AEe,{children:c.jsx(OEe,{children:u})}),c.jsx(REe,{children:c.jsx(MEe,{})})]}),c.jsx("div",{className:"overflow-x-auto px-3 py-2 text-sm",children:c.jsx(jXe,{code:h,language:u,className:n})})]})}return c.jsx("code",{className:Ve("not-prose inline-flex max-w-full items-baseline rounded-md border border-border/70 bg-muted/45 px-2 py-1 align-middle font-mono text-xs font-medium leading-[1.2] text-foreground","shadow-[inset_0_1px_0_hsl(var(--background)/0.55)]"),...o,children:c.jsx("span",{className:"max-w-[32rem] truncate sm:max-w-[40rem]",children:i})})},a:({href:r,ref:n,...i})=>{if(!e)return c.jsx("a",{href:r,...i,children:i.children});const s=SXe(r);return s?c.jsx(NXe,{href:r,target:s,onOpenPath:e}):c.jsx("a",{href:r,...i,children:i.children})},img:({src:r,alt:n,ref:i,...s})=>{const o=typeof r=="string"?Eoe(r):null;return o?c.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"not-prose block overflow-hidden rounded-xl border border-border/60 bg-muted/20 no-underline",children:c.jsx("img",{src:o,alt:n??"Chat image",loading:"lazy",className:"max-h-[28rem] w-full object-contain bg-background/80",...s})}):c.jsx("span",{className:"inline-flex rounded-md border border-dashed border-border/70 px-2 py-1 text-xs text-muted-foreground",children:"image unavailable"})}}}function EXe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Goe(n),[n]);return c.jsx("div",{className:qoe(),children:c.jsx(nJ,{remarkPlugins:[iJ],components:i,children:e})})}function AXe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Goe(n),[n]),s=({blockMatch:a})=>c.jsx(nJ,{remarkPlugins:[iJ],components:i,children:a.output}),{blockMatches:o}=m4e({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:i4e()},isStreamFinished:!1});return c.jsx("div",{className:qoe(),children:o.map((a,l)=>{const d=a.block.component;return c.jsx(d,{blockMatch:a},l)})})}const AO=y.memo(function({content:r,compact:n,isStreaming:i,preferLlmUi:s,onOpenPath:o}){return s&&i?c.jsx(AXe,{content:r,compact:n,onOpenPath:o}):c.jsx(EXe,{content:r,compact:n,onOpenPath:o})});AO.displayName="AssistantMarkdown";function OXe({messageId:e,messageIndex:r,messageFromEnd:n,role:i,content:s,contextFlow:o,displayContent:a,referencedFiles:l,displaySegments:d,attachments:u,thinking:h,thinkingDuration:p,toolCalls:g,segments:v,isStreaming:b,compact:_,preferLlmUi:k,provider:w,onOpenTerminal:C,onEditMessage:j,editComposer:T,onOpenPath:A,onOpenDiff:E}){const R=i==="user",{userDisplayText:P,userDisplaySegments:H}=y.useMemo(()=>{if(!R)return{userDisplayText:s,userDisplaySegments:[]};if(d!=null&&d.length)return{userDisplayText:G1(d),userDisplaySegments:d};if(a){const Be=d5(a,l);return{userDisplayText:a,userDisplaySegments:Be}}const ke=KJ(s);return{userDisplayText:ke.text,userDisplaySegments:ke.displaySegments}},[R,s,a,l,d]),[$,U]=y.useState(!1),[I,Y]=y.useState(!1),[M,z]=y.useState(!1),[L,B]=y.useState(!1),[W,K]=y.useState(!1),[F,V]=y.useState(!1),[J,q]=y.useState(""),[ee,re]=y.useState([]),[de,fe]=y.useState(null),[te,se]=y.useState(null),ge=y.useMemo(()=>{if(!R)return[];const ke=As(te??H).flatMap(Be=>Be.type==="image"?[{name:Be.name,mimeType:Be.mimeType,data:Be.data,preview:`data:${Be.mimeType};base64,${Be.data}`}]:[]);return ke.length>0?ke:u??[]},[u,R,te,H]),le=y.useRef(null),Je=y.useRef(null),Ze=y.useRef(null);y.useEffect(()=>()=>{le.current!==null&&window.clearTimeout(le.current)},[]),y.useEffect(()=>{M||(q(P),re(H))},[M,H,P]),y.useEffect(()=>{if(!te&&de==null)return;const ke=de===P,Be=te===H||JSON.stringify(te??[])===JSON.stringify(H);ke&&Be&&(fe(null),se(null))},[te,de,H,P]),y.useEffect(()=>{var Be;if(!M){B(!1);return}const ke=window.requestAnimationFrame(()=>{B(!0)});return(Be=Ze.current)==null||Be.focus(),()=>window.cancelAnimationFrame(ke)},[M]);const Ie=()=>{var Be;const ke=[];if(g&&g.length>0)for(const it of g){const pt=it.tool.replace(/_/g,"."),st=Object.entries(it.args).filter(([,Xe])=>Xe!=null&&Xe!=="").map(([Xe,Qe])=>`${Xe}: ${typeof Qe=="string"?Qe:JSON.stringify(Qe)}`).join(", "),ot=it.status==="success"?"✓":it.status==="error"?"✗":"…",Dt=it.completedAt&&it.startedAt?`${((it.completedAt-it.startedAt)/1e3).toFixed(1)}s`:"";if(ke.push(`[${ot} ${pt}] ${st}`),(Be=it.result)!=null&&Be.message){const Xe=it.result.message.length>500?it.result.message.slice(0,500)+"…":it.result.message;ke.push(Xe)}Dt&&ke.push(`Duration: ${Dt}`),ke.push("")}return s&&ke.push(R?YJ(H)||P:s),ke.join(`
1156
1156
  `).trim()},ne=async()=>{const ke=Ie();if(!ke)return;const Be=R?XJ(H):null;try{Be&&typeof ClipboardItem<"u"&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([ke],{type:"text/plain"}),[u5]:new Blob([Be],{type:u5})})]):await navigator.clipboard.writeText(ke)}catch{const it=document.createElement("textarea");it.value=ke,it.style.position="fixed",it.style.opacity="0",document.body.appendChild(it),it.focus(),it.select(),document.execCommand("copy"),document.body.removeChild(it)}U(!0),le.current!==null&&window.clearTimeout(le.current),le.current=window.setTimeout(()=>U(!1),1200)},Te=R&&!!e&&!!j,_e=Te,Se=b&&!h&&!s.trim(),Ke=R||!b,wt=y.useCallback(()=>{!Te||W||(q(P),re(H),z(!0))},[Te,W,H,P]),mt=y.useCallback(()=>{q(P),re(H),z(!1)},[H,P]),Mt=()=>{var Be;!Te||M||typeof window<"u"&&(Be=window.getSelection())!=null&&Be.toString().trim()||wt()},Xt=y.useCallback(async(ke,Be)=>{if(!Te||!e||!j||W)return;const it=JJ(ke??J,Be??ee);if(it){if(a8e(it.text,P,H)){z(!1);return}fe(it.text),se(it.displaySegments),z(!1),K(!0);try{await j(e,it.text,r,n,{referencedFiles:it.referencedFiles,displaySegments:it.displaySegments})}catch(pt){throw fe(null),se(null),z(!0),pt}finally{K(!1)}}},[Te,J,ee,W,e,n,r,j,H,P]),Rt=async(ke,Be)=>{if(!Te||!e||!j)return;const it=ke.trim();it&&await j(e,it,r,n,{referencedFiles:(Be??H).filter(pt=>pt.type==="file").map(pt=>({path:pt.path,name:pt.name})),displaySegments:Be??H})},or=async()=>{if(_e){Y(!0);try{await Rt(P,H)}finally{Y(!1)}}},Ee=ke=>M||!Ke||!s?null:c.jsx("div",{className:Ve("absolute z-10 rounded-full border border-border/70 bg-background p-1","right-1 bottom-[.25rem]","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100","touch-device:opacity-80",$&&"opacity-100"),children:c.jsxs(LEe,{children:[Te?c.jsx(nk,{onClick:wt,"aria-label":"Edit message",tooltip:"Edit message",className:"h-6 w-6",children:c.jsx(C9,{className:"h-3.5 w-3.5"})}):null,_e?c.jsx(nk,{onClick:Be=>{Be.preventDefault(),Be.stopPropagation(),or()},disabled:I,"aria-label":"Retry from this message",tooltip:"Retry from this message",className:"h-6 w-6",children:c.jsx(lK,{className:Ve("h-3.5 w-3.5",I&&"animate-spin")})}):null,!R&&o?c.jsx(nk,{onClick:Be=>{Be.preventDefault(),Be.stopPropagation(),V(!0)},"aria-label":"View LLM context",tooltip:"View LLM context",className:"h-6 w-6",children:c.jsx(Of,{className:"h-3.5 w-3.5"})}):null,c.jsx(nk,{onClick:ne,"aria-label":$?"Copied":"Copy message",tooltip:$?"Copied":"Copy message",className:"h-6 w-6",children:$?c.jsx(ss,{className:"h-3.5 w-3.5"}):c.jsx(du,{className:"h-3.5 w-3.5"})})]})}),$e=R?null:Ee();return c.jsxs(c.Fragment,{children:[c.jsx(PEe,{from:i,className:Ve(_?"py-2":"py-4"),children:c.jsxs("div",{className:Ve("min-w-0 max-w-[85%] space-y-2",R&&"order-1"),children:[!R&&h&&c.jsx(t8e,{content:h,isStreaming:!!b&&!s,duration:p}),!R&&v&&v.length>0?c.jsxs("div",{className:"relative min-w-0 max-w-full select-text break-words [overflow-wrap:anywhere]",children:[v.map((ke,Be)=>{if(ke.type==="toolGroup"){const it=(g??[]).filter(st=>ke.callIds.includes(st.callId)),pt=v.slice(Be+1).some(st=>st.type==="text"&&typeof st.content=="string"&&st.content.trim());return it.length>0?fH(w,it)?c.jsx(NO,{provider:w,calls:it,isStreaming:!!b&&Be===v.length-1,onOpenTerminal:C,onOpenDiff:E},`tg-${Be}`):c.jsx(TO,{calls:it,collapsible:pt,onOpenTerminal:C,onOpenDiff:E},`tg-${Be}`):null}return typeof ke.content=="string"&&ke.content.trim()?c.jsx(sN,{"data-message-from":"assistant",className:"max-w-full bg-card/78",children:c.jsx(AO,{content:ke.content,compact:_,isStreaming:!!b&&Be===v.length-1,preferLlmUi:k,onOpenPath:A})},`ts-${Be}`):null}),b&&!s&&!v.some(ke=>ke.type==="text"&&typeof ke.content=="string"&&ke.content.trim())&&c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(mH,{})}),$e]}):c.jsxs(c.Fragment,{children:[g&&g.length>0&&(fH(w,g)?c.jsx(NO,{provider:w,calls:g,isStreaming:b,onOpenTerminal:C,onOpenDiff:E}):c.jsx(TO,{calls:g,collapsible:w!=="jait",onOpenTerminal:C,onOpenDiff:E})),s?R?M?c.jsx("div",{className:"w-full max-w-3xl",onClick:ke=>ke.stopPropagation(),children:c.jsx("div",{className:Ve("space-y-3 origin-bottom transition-all duration-150 ease-out",L?"translate-y-0 opacity-100":"translate-y-2 opacity-0"),children:c.jsx(Jb,{ref:Ze,draftStateKey:`edit:${e??"user-message"}`,value:J,segments:ee,onChange:ke=>{var Be;q(ke),re(((Be=Ze.current)==null?void 0:Be.getSegments())??[])},onSubmit:(ke,Be,it)=>{const pt=it??[],st=G1(pt)||J;re(pt),Xt(st,pt)},disabled:W,controlsDisabled:W,placeholder:"Edit message...",onVoiceInput:T==null?void 0:T.onVoiceInput,voiceRecording:T==null?void 0:T.voiceRecording,voiceLevels:T==null?void 0:T.voiceLevels,voiceTranscribing:T==null?void 0:T.voiceTranscribing,onVoiceStop:T==null?void 0:T.onVoiceStop,mode:T==null?void 0:T.mode,onModeChange:T==null?void 0:T.onModeChange,provider:T==null?void 0:T.provider,onProviderChange:T==null?void 0:T.onProviderChange,responseStyle:T==null?void 0:T.responseStyle,onResponseStyleChange:T==null?void 0:T.onResponseStyleChange,providerRuntimeMode:T==null?void 0:T.providerRuntimeMode,onProviderRuntimeModeChange:T==null?void 0:T.onProviderRuntimeModeChange,cliModel:T==null?void 0:T.cliModel,onCliModelChange:T==null?void 0:T.onCliModelChange,sessionInfo:T==null?void 0:T.sessionInfo,workspaceNodeId:T==null?void 0:T.workspaceNodeId,availableFiles:(T==null?void 0:T.availableFiles)??K1(H),onSearchFiles:T==null?void 0:T.onSearchFiles,workspaceOpen:(T==null?void 0:T.workspaceOpen)??K1(H).length>0,footerTrailingContent:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg",onClick:mt,disabled:W,"aria-label":"Cancel editing message",title:"Cancel editing",children:c.jsx(Zn,{className:"h-3.5 w-3.5"})}),className:"rounded-lg border-primary/20 bg-primary/[0.08] dark:!bg-primary/[0.08] shadow-none [&_.text-muted-foreground]:text-muted-foreground [&>div]:!bg-transparent [&_[contenteditable='true']]:!bg-transparent"},`edit-${e??"user-message"}`)})}):c.jsxs("div",{className:"relative w-fit max-w-full",children:[c.jsx(sN,{ref:Je,"data-message-from":"user",className:Ve("min-w-0 rounded-lg bg-muted px-4 py-3 break-words [overflow-wrap:anywhere]",Te&&!M&&"cursor-text transition-colors hover:bg-muted/80","leading-relaxed [font-size:0.9rem]"),onClick:Mt,title:Te&&!M?"Click to edit message":void 0,children:c.jsxs("div",{className:"min-w-0 space-y-3",children:[c.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:(te??H).length>0?(te??H).map((ke,Be)=>ke.type==="text"?c.jsx("span",{children:ke.text},`text-${Be}`):ke.type==="file"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ke.path,children:[c.jsx(So,{filename:ke.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ke.lineRange?`${ke.name}:${o2(ke.lineRange).replace(/^lines? /,"")}`:ke.name})]},`${ke.path}-${Be}`):ke.type==="workspace"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ke.path,children:[c.jsx(Sj,{name:ke.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ke.name})]},`${ke.path}-${Be}`):ke.type==="terminal"?c.jsxs("span",{className:"mx-[2px] inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-muted/45 px-2 py-1 text-xs font-medium leading-none text-foreground align-middle select-none",title:ke.workspaceRoot?`${ke.terminalId} · ${ke.workspaceRoot}`:ke.terminalId,children:[c.jsx("span",{className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm bg-muted-foreground/15 text-2xs font-bold uppercase text-muted-foreground",children:"T"}),c.jsx("span",{className:"max-w-[180px] truncate",children:ke.lineRange?`${ke.name}:${o2(ke.lineRange).replace(/^lines? /,"")}`:ke.name})]},`${ke.terminalId}-${Be}`):null):de??P}),ge.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:ge.map((ke,Be)=>{const it=ke.preview??`data:${ke.mimeType};base64,${ke.data}`;return c.jsxs(Lh,{children:[c.jsx(h1e,{asChild:!0,children:c.jsxs("button",{type:"button",className:"group block overflow-hidden rounded-lg border border-primary/10 bg-background/65 text-left transition-colors hover:border-primary/25 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","aria-label":`Expand image ${ke.name}`,children:[c.jsxs("span",{className:"relative block",children:[c.jsx("img",{src:it,alt:ke.name,className:"max-h-72 w-full object-cover transition-opacity group-hover:opacity-85"}),c.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:c.jsx("span",{className:"rounded-full bg-black/65 px-3 py-1.5 text-xs font-medium text-white",children:"Click to expand"})})]}),c.jsx("span",{className:"block truncate border-t border-border/60 px-2 py-1 text-xs text-muted-foreground",children:ke.name})]})}),c.jsxs(jd,{className:"max-h-[92vh] max-w-[96vw] gap-2 overflow-hidden p-2",showCloseButton:!0,children:[c.jsx(bd,{className:"mr-8 truncate px-1 text-sm font-medium",children:ke.name}),c.jsx("img",{src:it,alt:ke.name,className:"max-h-[82vh] w-full object-contain"})]})]},`${ke.name}-${Be}`)})})]})}),Ee()]}):c.jsxs("div",{className:"relative min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:[c.jsx(sN,{"data-message-from":"assistant",className:"min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:c.jsx(AO,{content:s,compact:_,isStreaming:b,preferLlmUi:k,onOpenPath:A})}),$e]}):Se?c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(mH,{})}):null]})]})}),c.jsx(xXe,{open:F,onOpenChange:V,contextFlow:o,responseContent:s})]})}const OO=y.memo(OXe,(e,r)=>{const{messageFromEnd:n,messageIndex:i,...s}=e,{messageFromEnd:o,messageIndex:a,...l}=r,d=Object.keys(l);return d.length===Object.keys(s).length&&d.every(u=>Object.is(s[u],l[u]))});OO.displayName="Message";function RXe(e,r){return!e||e==="gateway"?!1:!r.has(e)}function gH(e){const r=new Date(e),i=new Date().getTime()-r.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:r.toLocaleDateString()}function MXe({platform:e}){switch(e){case"windows":case"macos":case"linux":return c.jsx(Aa,{className:"h-2.5 w-2.5"});case"android":case"ios":return c.jsx(H4,{className:"h-2.5 w-2.5"});default:return c.jsx(_i,{className:"h-2.5 w-2.5"})}}function PXe({workspaces:e,personalSessions:r=[],activeWorkspaceId:n,activeSessionId:i,loading:s=!1,hasMoreWorkspaces:o=!1,showFewerWorkspaces:a=!1,onSelectWorkspace:l,onSelectPersonalSession:d,onNewPersonalSession:u,onCreateWorkspace:h,onRemoveWorkspace:p,onChangeDirectory:g,onShowMore:v,onShowFewer:b,sessionInfo:_,nodes:k=[]}){const w=y.useMemo(()=>new Set(k.filter(C=>!C.isGateway).map(C=>C.id)),[k]);return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex h-[35px] shrink-0 items-center justify-between px-3 border-b",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Chats & Workspaces"}),c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:c.jsx(Eo,{className:"h-3.5 w-3.5"})})}),c.jsx(en,{side:"right",children:"New workspace"})]})]}),s?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(sr,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex max-h-[50%] min-h-0 shrink-0 flex-col border-b",children:[c.jsx("div",{className:"flex h-7 shrink-0 items-center justify-between px-3",children:c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Workspaces"})}),c.jsx(fh,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[e.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No workspaces yet.",c.jsx("br",{}),c.jsx("button",{onClick:h,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Choose workspace folder"})]}),e.map(C=>{const j=C.id===n,T=C.nodeId&&C.nodeId!=="gateway"?k.find(E=>E.id===C.nodeId):null,A=RXe(C.nodeId,w);return c.jsxs("div",{className:`group grid w-full grid-cols-[auto,minmax(0,1fr),auto] items-start gap-1.5 px-1.5 py-1.5 text-sm transition-colors ${A||j?"cursor-default":"cursor-pointer"} ${j?"rounded-md bg-secondary/70":A?"opacity-50":"hover:rounded-md hover:bg-muted/40"}`,draggable:!!C.rootPath,onDragStart:E=>{if(!C.rootPath){E.preventDefault();return}E.dataTransfer.effectAllowed="copy",E.dataTransfer.setData(EQ,JSON.stringify(g9e(C.rootPath,C.title||void 0)))},onClick:()=>{!A&&!j&&l(C.id)},children:[j?c.jsx(xh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}):c.jsx(_9,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"min-w-0 overflow-hidden",children:[c.jsx("div",{className:"truncate text-xs font-medium",children:C.title||"Untitled Workspace"}),c.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden text-2xs text-muted-foreground",children:[c.jsx("span",{className:"min-w-0 truncate",children:C.rootPath||"No folder linked"}),c.jsx("span",{className:"shrink-0",children:"·"}),c.jsx("span",{className:"shrink-0",children:gH(C.lastActiveAt)})]}),A&&c.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-2xs text-orange-500",children:[c.jsx(n1e,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:"Node offline"})]}),T&&!A&&c.jsx("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs",children:c.jsxs("span",{className:"inline-flex max-w-full items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-muted-foreground",children:[c.jsx(MXe,{platform:T.platform}),c.jsx("span",{className:"truncate max-w-[80px]",children:T.name})]})}),j&&_&&c.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-2xs text-blue-500",children:[c.jsx("span",{className:"truncate",children:_.provider}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:"·"}),c.jsx(Aa,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:_.isRemote&&_.remoteNode?_.remoteNode.nodeName:"Gateway"})]})]}),c.jsxs("div",{className:"flex shrink-0 self-start gap-0.5",children:[c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon","aria-label":"Change directory",className:"h-5.5 w-5.5 shrink-0 opacity-100 text-muted-foreground transition-opacity hover:text-foreground sm:opacity-0 sm:group-hover:opacity-100",onClick:E=>{E.stopPropagation(),g(C.id)},children:c.jsx(d0e,{className:"h-3 w-3"})})}),c.jsx(en,{side:"right",children:"Change directory"})]}),c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon","aria-label":"Archive workspace",className:"h-5.5 w-5.5 shrink-0 opacity-100 text-muted-foreground transition-opacity hover:text-destructive sm:opacity-0 sm:group-hover:opacity-100",onClick:E=>{E.stopPropagation(),p(C.id)},children:c.jsx(XG,{className:"h-3 w-3"})})}),c.jsx(en,{side:"right",children:"Archive workspace"})]})]})]},C.id)}),o&&v&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:v,children:"Show more workspaces"}),a&&b&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:b,children:"Show fewer workspaces"})]})})]}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex h-7 shrink-0 items-center justify-between px-3",children:[c.jsx("span",{className:"text-2xs font-medium text-muted-foreground",children:"Personal chats"}),u&&c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:u,children:c.jsx(Eo,{className:"h-3 w-3"})})}),c.jsx(en,{side:"right",children:"New personal chat"})]})]}),c.jsx(fh,{className:"min-h-0 flex-1",children:c.jsxs("div",{className:"space-y-0.5 px-1.5 pb-1.5",children:[r.length===0&&c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No personal chats yet.",u&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("button",{onClick:u,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Start a chat"})]})]}),r.map(C=>{const j=n===null&&C.id===i;return c.jsxs("div",{className:`group flex items-center gap-1.5 rounded-md px-1.5 py-1 transition-colors text-sm ${j?"bg-secondary/70 cursor-default":"cursor-pointer hover:bg-muted/40"}`,onClick:()=>{!j&&d&&d(C.id)},children:[c.jsx(hm,{className:`h-3.5 w-3.5 shrink-0 ${j?"text-primary":"text-muted-foreground"}`}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-xs font-medium",children:C.name||"Personal chat"}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:gH(C.lastActiveAt??C.createdAt)})]})]},C.id)})]})})]})]})]})}function LXe(e){const r=new Date(e),i=new Date().getTime()-r.getTime();return i<6e4?"just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:r.toLocaleDateString()}function $Xe({sessions:e,activeSessionId:r,workspaceTitle:n,onSelectSession:i,onNewSession:s,onOpenChange:o,showTitle:a=!0,triggerLabel:l=null}){const[d,u]=y.useState(!1),h=e.find(g=>g.id===r)??e[0]??null,p=g=>{u(g),o==null||o(g)};return c.jsxs("div",{className:a?"flex min-w-0 flex-1 items-center justify-between gap-1.5":"flex items-center gap-1.5",children:[a?c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold leading-tight",children:h!=null&&h.name&&h.name!=="New Chat"?h.name:""}):null,c.jsxs(gu,{open:d,onOpenChange:p,children:[c.jsxs(un,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(yu,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:l?"sm":"icon",className:l?"h-7 shrink-0 rounded-md px-2 text-xs text-muted-foreground hover:text-foreground":"h-6 w-6 shrink-0 rounded-md text-muted-foreground hover:text-foreground",children:[c.jsx(nK,{className:"h-3.5 w-3.5"}),l?c.jsx("span",{children:l}):null]})})}),c.jsx(en,{side:"bottom",children:l??"Sessions"})]}),c.jsxs(wc,{align:"start",className:"w-[min(28rem,calc(100vw-1rem))] p-0",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"Sessions"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:n||"Current workspace"})]}),c.jsxs(we,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{s(),u(!1)},children:[c.jsx(U0e,{className:"mr-1 h-3 w-3"}),"New chat"]})]}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto p-2",children:e.length===0?c.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No sessions yet."}):c.jsx("div",{className:"space-y-0.5",children:e.map(g=>{const v=g.id===r;return c.jsxs("button",{type:"button",className:`flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors ${v?"bg-secondary text-secondary-foreground":"hover:bg-muted/50"}`,onClick:()=>{i(g.id),u(!1)},children:[v?c.jsx(ss,{className:"mt-0.5 h-3 w-3 shrink-0 text-primary"}):c.jsx("span",{className:"mt-1 h-2 w-2 shrink-0 rounded-full bg-muted-foreground/50"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"truncate text-xs font-medium",children:g.name||"Untitled"}),g.status==="archived"&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-1.5 py-0 text-2xs text-muted-foreground",children:[c.jsx(XG,{className:"h-2.5 w-2.5"}),"Archived"]})]}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:LXe(g.lastActiveAt)})]})]},g.id)})})})]})]})]})}function DXe({suggestions:e,onSelect:r,className:n}){return c.jsx("div",{className:Ve("flex flex-wrap gap-2 justify-center",n),children:e.map(i=>c.jsx("button",{onClick:()=>r(i),className:"px-4 py-2 text-sm rounded-full border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:i},i))})}const IXe=L4("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium leading-4 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",success:"border-transparent bg-green-500/15 text-green-700 dark:text-green-400",warning:"border-transparent bg-yellow-500/15 text-yellow-700 dark:text-yellow-400"}},defaultVariants:{variant:"default"}});function nn({className:e,variant:r,...n}){return c.jsx("div",{className:Ve(IXe({variant:r}),e),...n})}const Mn=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Ve("rounded-xl border border-border/70 bg-card text-card-foreground shadow-sm",e),...r}));Mn.displayName="Card";const Koe=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Ve("flex flex-col space-y-1.5 p-6",e),...r}));Koe.displayName="CardHeader";const Yoe=y.forwardRef(({className:e,...r},n)=>c.jsx("h3",{ref:n,className:Ve("font-semibold leading-none tracking-tight",e),...r}));Yoe.displayName="CardTitle";const BXe=y.forwardRef(({className:e,...r},n)=>c.jsx("p",{ref:n,className:Ve("text-sm text-muted-foreground",e),...r}));BXe.displayName="CardDescription";const Xoe=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Ve("p-6 pt-0",e),...r}));Xoe.displayName="CardContent";const zXe=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Ve("flex items-center p-6 pt-0",e),...r}));zXe.displayName="CardFooter";const FXe={pending:{icon:Bm,label:"Pending",color:"text-muted-foreground"},approved:{icon:sr,label:"Running",color:"text-blue-500"},rejected:{icon:Zn,label:"Rejected",color:"text-destructive"},executed:{icon:Hl,label:"Done",color:"text-green-500"},failed:{icon:Ea,label:"Failed",color:"text-destructive"}};function HXe({action:e,expanded:r,onToggle:n}){const i=FXe[e.status],s=i.icon;return c.jsxs("div",{className:"border rounded-md",children:[c.jsxs("button",{type:"button",className:"flex items-center gap-3 w-full px-3 py-2.5 text-left hover:bg-muted/50 transition-colors",onClick:n,children:[c.jsx(s,{className:Ve("h-4 w-4 shrink-0",i.color,e.status==="approved"&&"animate-spin")}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:e.tool}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["Step ",e.order+1]})]}),c.jsx(nn,{variant:"outline",className:"text-2xs px-1.5 py-0",children:i.label}),r?c.jsx(al,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(Ro,{className:"h-4 w-4 text-muted-foreground"})]}),r&&c.jsxs("div",{className:"px-3 pb-3 pt-1 border-t bg-muted/30",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),c.jsx("pre",{className:"text-xs bg-background rounded p-2 overflow-x-auto max-h-48",children:JSON.stringify(e.args,null,2)}),e.result&&c.jsx("div",{className:Ve("mt-2 text-xs rounded p-2",e.result.ok?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-destructive/10 text-destructive"),children:e.result.message})]})]})}function WXe({plan:e,onApprove:r,onReject:n,isExecuting:i,className:s}){const[o,a]=y.useState(new Set),l=g=>{a(v=>{const b=new Set(v);return b.has(g)?b.delete(g):b.add(g),b})},d=e.actions.filter(g=>g.status==="pending").length,u=e.actions.filter(g=>g.status==="executed").length,h=e.actions.filter(g=>g.status==="failed").length,p=d===0;return c.jsxs(Mn,{className:Ve("p-4 space-y-3",s),children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(UXe,{className:"h-4 w-4"}),"Plan",c.jsxs(nn,{variant:"secondary",className:"text-2xs px-1.5 py-0",children:[e.actions.length," step",e.actions.length!==1?"s":""]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.summary})]}),p&&c.jsx(nn,{variant:h>0?"destructive":"success",className:"shrink-0",children:h>0?`${h} failed`:"Complete"})]}),c.jsx("div",{className:"space-y-1.5",children:e.actions.map(g=>c.jsx(HXe,{action:g,expanded:o.has(g.id),onToggle:()=>l(g.id)},g.id))}),d>0&&c.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[c.jsx(we,{size:"sm",onClick:()=>r(),disabled:i,children:i?c.jsxs(c.Fragment,{children:[c.jsx(sr,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Executing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(z4,{className:"h-3.5 w-3.5 mr-1.5"}),"Execute all (",d,")"]})}),c.jsxs(we,{size:"sm",variant:"outline",onClick:n,disabled:i,children:[c.jsx(Zn,{className:"h-3.5 w-3.5 mr-1.5"}),"Reject"]})]}),p&&!i&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:[u>0&&`${u} action${u!==1?"s":""} executed.`,h>0&&` ${h} failed.`]})]})}function UXe({className:e}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[c.jsx("rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}),c.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),c.jsx("path",{d:"M12 11h4"}),c.jsx("path",{d:"M12 16h4"}),c.jsx("path",{d:"M8 11h.01"}),c.jsx("path",{d:"M8 16h.01"})]})}const VXe=5e3;function qXe(e){return e.find(r=>r.status==="in-progress")??null}function Zoe(e){return e.length>0&&e.every(r=>r.status==="completed")}function GXe(e){const r=qXe(e),n=Zoe(e);return{headerLabel:r?r.title:n?"All tasks completed":"Tasks",showHeaderSpinner:!!r,showHeaderCompleted:!r&&n}}function sE({items:e,className:r,onClear:n}){const[i,s]=y.useState(!1),[o,a]=y.useState(!1),l=y.useRef(null),d=y.useMemo(()=>Zoe(e),[e]),u=y.useMemo(()=>GXe(e),[e]);if(y.useEffect(()=>{if(l.current!==null&&(window.clearTimeout(l.current),l.current=null),a(!1),!!d)return l.current=window.setTimeout(()=>{a(!0)},VXe),()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)}},[d,e]),e.length===0||o)return null;const h=e.filter(_=>_.status==="completed").length,p=e.length,g=p>0?Math.round(h/p*100):0,v=i?"Tasks":u.headerLabel,b=d?"bg-green-500":"bg-primary";return c.jsxs("div",{className:Ve("rounded-lg border bg-muted/30 p-3 space-y-2",r),children:[c.jsxs("button",{type:"button",onClick:()=>s(_=>!_),className:"flex items-center gap-2 w-full text-left",children:[c.jsx(al,{className:Ve("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",!i&&"-rotate-90")}),!i&&u.showHeaderSpinner&&c.jsx(sr,{className:"h-3.5 w-3.5 shrink-0 text-primary animate-spin"}),!i&&u.showHeaderCompleted&&c.jsx(Hl,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),c.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-foreground",children:v}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:Ve("h-full rounded-full transition-all duration-300",b),style:{width:`${g}%`}})}),c.jsxs("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[h,"/",p]}),n&&c.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),n()},className:"shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Clear todo list",children:c.jsx(Zn,{className:"h-3 w-3"})})]}),i&&c.jsx("div",{className:"space-y-1",children:e.map(_=>c.jsxs("div",{className:Ve("flex items-start gap-2 text-xs py-0.5",_.status==="completed"&&"text-muted-foreground"),children:[_.status==="completed"?c.jsx(Hl,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-green-500"}):_.status==="in-progress"?c.jsx(sr,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary animate-spin"}):c.jsx(Lge,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/50"}),c.jsx("span",{className:Ve("flex-1 min-w-0",_.status==="completed"&&"line-through"),children:_.title})]},_.id))})]})}function KXe({files:e,onAccept:r,onReject:n,onAcceptAll:i,onRejectAll:s,onFileClick:o,className:a}){const l=y.useRef(null),[d,u]=y.useState(!1);if(y.useEffect(()=>{const p=l.current;if(!p||typeof ResizeObserver>"u")return;const g=()=>{u(p.clientWidth<560)};g();const v=new ResizeObserver(()=>g());return v.observe(p),()=>v.disconnect()},[]),e.length===0)return null;const h=e.filter(p=>p.state==="undecided").length;return c.jsxs("div",{ref:l,className:Ve("overflow-hidden rounded-lg border bg-muted/30",a),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 border-b bg-muted/20 px-3 py-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsx(Ll,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsxs("span",{className:"truncate text-xs font-medium",children:["Files changed (",e.length,")"]}),h>0&&c.jsxs("span",{className:"shrink-0 text-2xs text-amber-500 dark:text-amber-400",children:[h," pending"]})]}),h>0&&c.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[c.jsxs(we,{size:d?"icon":"sm",variant:"ghost",className:Ve("h-6 shrink-0 text-xs",d?"w-6 p-0":"px-2"),onClick:i,title:"Keep all","aria-label":"Keep all",children:[c.jsx(ss,{className:Ve("h-3 w-3 shrink-0",!d&&"mr-1")}),!d&&"Keep all"]}),c.jsxs(we,{size:d?"icon":"sm",variant:"ghost",className:Ve("h-6 shrink-0 text-xs",d?"w-6 p-0":"px-2"),onClick:s,title:"Undo all","aria-label":"Undo all",children:[c.jsx(mh,{className:Ve("h-3 w-3 shrink-0",!d&&"mr-1")}),!d&&"Undo all"]})]})]}),c.jsx("div",{className:"divide-y",children:e.map(p=>c.jsxs("div",{className:Ve("flex items-center gap-2 px-3 py-1.5 text-xs",p.state==="accepted"&&"bg-green-500/5",p.state==="rejected"&&"bg-red-500/5 text-muted-foreground"),children:[c.jsx(So,{filename:p.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("button",{type:"button",className:Ve("min-w-0 flex-1 truncate text-left hover:underline cursor-pointer",p.state==="rejected"&&"line-through"),title:`Review diff for ${p.path}`,onClick:()=>o==null?void 0:o(p.path),children:p.path}),p.state==="undecided"&&c.jsxs("div",{className:"ml-auto flex items-center gap-0.5 shrink-0",children:[c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:()=>o==null?void 0:o(p.path),title:"Review changes",children:c.jsx(Cm,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-green-500/20 text-green-600 dark:text-green-400 transition-colors",onClick:()=>r==null?void 0:r(p.path),title:"Keep all changes",children:c.jsx(ss,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-red-500/20 text-red-600 dark:text-red-400 transition-colors",onClick:()=>n==null?void 0:n(p.path),title:"Undo all changes",children:c.jsx(mh,{className:"h-3 w-3"})})]}),p.state==="accepted"&&c.jsx("span",{className:"text-2xs text-green-600 dark:text-green-400 shrink-0",children:"Kept"}),p.state==="rejected"&&c.jsx("span",{className:"text-2xs text-red-500 shrink-0",children:"Undone"})]},p.path))})]})}function YXe(e,r,n,i){const s=e.findIndex(d=>d.id===r);if(s<0)return e;const o=[...e],[a]=o.splice(s,1);if(!a)return e;if(n==null)return o.push(a),o;const l=o.findIndex(d=>d.id===n);return l<0?e:(o.splice(l+(i==="after"?1:0),0,a),o)}function XXe({item:e,index:r}){return c.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background px-3 py-2 text-sm shadow-2xl ring-1 ring-primary/10",children:[c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:r===0?c.jsx(w9,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(Ro,{className:"h-3.5 w-3.5 text-muted-foreground"})}),c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground",children:c.jsx(rK,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[r===0?c.jsx("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-primary/70",children:"Next"}):c.jsxs("span",{className:"mb-0.5 block text-2xs font-medium uppercase tracking-wider text-muted-foreground",children:["Queued #",r+1]}),c.jsx("span",{className:"whitespace-pre-wrap break-words text-foreground",children:e.displayContent??e.content})]})]})}function ZXe({item:e,index:r,onRemove:n,onEdit:i,onReorder:s,onSendToParallelThread:o,dragActive:a,dropBefore:l,dropAfter:d,onDragStart:u}){const[h,p]=y.useState(!1),[g,v]=y.useState(!0),[b,_]=y.useState(e.displayContent??e.content),k=y.useRef(null),w=h||!a;y.useEffect(()=>{if(h){const A=k.current;A&&(A.focus(),A.setSelectionRange(A.value.length,A.value.length))}},[h]),y.useEffect(()=>{h||_(e.displayContent??e.content)},[e.content,e.displayContent,h]);const C=y.useCallback(()=>{const A=b.trim(),E=e.displayContent??e.content;A&&A!==E&&(i==null||i(e.id,A)),p(!1)},[b,e.content,e.displayContent,e.id,i]),j=y.useCallback(()=>{_(e.displayContent??e.content),p(!1)},[e.content,e.displayContent]),T=y.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),C()):A.key==="Escape"&&j()},[C,j]);return c.jsxs(c.Fragment,{children:[l&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})}),c.jsxs("div",{"data-queue-id":e.id,className:Ve("group flex cursor-grab touch-none items-start gap-2 rounded-lg border border-border/40 bg-muted/50 px-3 py-2 text-sm transition-all duration-150 ease-out hover:bg-muted/70 active:cursor-grabbing",a&&"border-dashed border-primary/35 bg-primary/5 opacity-0"),onPointerDown:A=>{h||!s||A.target.closest('button, textarea, input, a, [data-no-drag="true"]')||u==null||u(e.id,A)},children:[c.jsx("button",{type:"button","data-no-drag":"true",className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground hover:bg-foreground/10 hover:text-foreground transition-colors",onClick:()=>v(A=>!A),"aria-label":g?"Expand queued message":"Collapse queued message",title:g?"Expand queued message":"Collapse queued message",children:g?c.jsx(Ro,{className:"h-3.5 w-3.5"}):r===0?c.jsx(w9,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(al,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s&&!h&&c.jsx("div",{className:"mt-0.5 shrink-0 rounded p-0.5 text-muted-foreground cursor-grab active:cursor-grabbing touch-none",title:"Drag to reorder","aria-label":"Drag to reorder",children:c.jsx(rK,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[r===0&&!h&&c.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-primary/70 block mb-0.5",children:"Next"}),r>0&&!h&&c.jsxs("span",{className:"text-2xs font-medium uppercase tracking-wider text-muted-foreground block mb-0.5",children:["Queued #",r+1]}),h?c.jsx("textarea",{ref:k,value:b,onChange:A=>_(A.target.value),onKeyDown:T,onBlur:C,rows:Math.min(b.split(`
1157
1157
  `).length,5),className:"w-full resize-none rounded border border-primary/30 bg-background px-2 py-1 text-sm outline-none focus:border-primary focus:ring-1 focus:ring-primary/20"}):g?c.jsx("span",{className:"block truncate text-foreground",children:e.displayContent??e.content}):c.jsx("span",{className:"whitespace-pre-wrap break-words text-foreground",children:e.displayContent??e.content})]}),c.jsx("div",{className:Ve("mt-0.5 flex shrink-0 items-center gap-0.5 transition-opacity",w?"opacity-0 group-hover:opacity-100":"opacity-0"),children:h?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:C,title:"Save",children:c.jsx(ss,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-foreground/10 text-muted-foreground transition-colors",onClick:j,title:"Cancel",children:c.jsx(Zn,{className:"h-3.5 w-3.5"})})]}):c.jsxs(c.Fragment,{children:[i&&c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-foreground/10 text-muted-foreground transition-colors",onClick:()=>p(!0),title:"Edit message",children:c.jsx(C9,{className:"h-3 w-3"})}),o&&c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary transition-colors",onClick:()=>o(e.id),title:"Send to parallel thread",children:c.jsx(s0,{className:"h-3 w-3"})}),c.jsx("button",{type:"button","data-no-drag":"true",className:"p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",onClick:()=>n==null?void 0:n(e.id),title:"Remove from queue",children:c.jsx(Zn,{className:"h-3.5 w-3.5"})})]})})]}),d&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})})]})}function yH({items:e,onRemove:r,onEdit:n,onReorder:i,onSendToParallelThread:s,className:o}){const a=y.useRef(null),l=y.useRef(null),[d,u]=y.useState(null),[h,p]=y.useState(null),[g,v]=y.useState(null);y.useEffect(()=>{if(d&&!e.some(C=>C.id===d)){u(null),p(null),v(null);return}h!=null&&h.targetId&&!e.some(C=>C.id===h.targetId)&&p(d?{targetId:d,placement:"before"}:null)},[d,h,e]),y.useEffect(()=>{var R;if(!d||!g)return;document.body.style.cursor="grabbing",document.body.style.userSelect="none",document.body.style.touchAction="none";const C=(P,H)=>{var Y,M;const $=Array.from(((Y=a.current)==null?void 0:Y.querySelectorAll("[data-queue-id]"))??[]);if($.length===0){p(null);return}const U=$.filter(z=>z.dataset.queueId&&z.dataset.queueId!==d);if(U.length===0){p({targetId:null,placement:"after"});return}for(const z of U){const L=z.dataset.queueId;if(!L)continue;const B=z.getBoundingClientRect(),W=B.top+B.height/2;if(H<W){p({targetId:L,placement:"before"});return}}const I=((M=U[U.length-1])==null?void 0:M.dataset.queueId)??null;p(I?{targetId:I,placement:"after"}:{targetId:null,placement:"after"})},j=P=>{P.pointerId===g.pointerId&&(v(H=>H&&{...H,x:P.clientX,y:P.clientY}),C(P.clientX,P.clientY))},T=P=>{var $,U;if(P&&P.pointerId!==g.pointerId)return;d&&h&&h.targetId!==d&&(i==null||i(d,h.targetId,h.placement));const H=l.current;($=H==null?void 0:H.hasPointerCapture)!=null&&$.call(H,g.pointerId)&&((U=H.releasePointerCapture)==null||U.call(H,g.pointerId)),l.current=null,u(null),p(null),v(null)},A=()=>{T()},E=()=>{T()};return window.addEventListener("pointermove",j),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),window.addEventListener("blur",E),(R=l.current)==null||R.addEventListener("lostpointercapture",A),()=>{var P;document.body.style.cursor="",document.body.style.userSelect="",document.body.style.touchAction="",window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T),window.removeEventListener("blur",E),(P=l.current)==null||P.removeEventListener("lostpointercapture",A)}},[g,d,h,i]);const b=y.useCallback((C,j)=>{var E;if(!i||j.button!==0&&j.pointerType!=="touch"&&j.pointerType!=="pen")return;j.preventDefault();const T=j.currentTarget.closest("[data-queue-id]");if(!T)return;l.current=T,(E=T.setPointerCapture)==null||E.call(T,j.pointerId);const A=T.getBoundingClientRect();u(C),p({targetId:C,placement:"before"}),v({id:C,pointerId:j.pointerId,x:j.clientX,y:j.clientY,offsetX:j.clientX-A.left,offsetY:j.clientY-A.top,width:A.width,height:A.height})},[i]);if(e.length===0)return null;const _=d&&h&&(h.targetId!==d||h.placement==="after")?YXe(e,d,h.targetId,h.placement):e,k=g?_.findIndex(C=>C.id===g.id):-1,w=k>=0?_[k]:null;return c.jsxs("div",{ref:a,className:Ve("space-y-1.5",o),children:[c.jsx("div",{className:"flex items-center gap-1.5 px-0.5",children:c.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:[e.length," queued message",e.length!==1?"s":""]})}),_.map((C,j)=>c.jsx(ZXe,{item:C,index:j,onRemove:r,onEdit:n,onReorder:i,onSendToParallelThread:s,dragActive:d===C.id,dropBefore:!!(d&&(h==null?void 0:h.targetId)===C.id&&h.placement==="before"&&d!==C.id),dropAfter:!!(d&&(h==null?void 0:h.targetId)===C.id&&h.placement==="after"&&d!==C.id),onDragStart:b},C.id)),g&&w&&c.jsx("div",{className:"pointer-events-none fixed z-50",style:{left:`${g.x-g.offsetX}px`,top:`${g.y-g.offsetY}px`,width:`${g.width}px`,minHeight:`${g.height}px`},children:c.jsx("div",{className:"scale-[1.01] opacity-95",children:c.jsx(XXe,{item:w,index:k})})})]})}function JXe({usage:e}){if(!e||e.limit<=0)return null;const r=Math.round(e.ratio*100),n=y.useMemo(()=>{if(!e||e.total===0)return[];const k=e.total;return[{label:"System",tokens:e.system,pct:Math.round(e.system/k*100),color:"var(--ctx-system)"},{label:"History",tokens:e.history,pct:Math.round(e.history/k*100),color:"var(--ctx-history)"},{label:"Tool Results",tokens:e.toolResults,pct:Math.round(e.toolResults/k*100),color:"var(--ctx-tool-results)"},{label:"Tools",tokens:e.tools,pct:Math.round(e.tools/k*100),color:"var(--ctx-tools)"}].filter(w=>w.tokens>0)},[e]),i=22,s=3,o=(i-s)/2,a=2*Math.PI*o,l=y.useMemo(()=>{if(!e||e.limit<=0)return[];const k=[];let w=0;for(const C of n){const T=C.tokens/e.limit*a;k.push({offset:w,length:T,color:C.color}),w+=T}return k},[n,e,a]),d=r>=90?"text-red-500":r>=75?"text-amber-500":"text-emerald-500",u=k=>k>=1e3?`${(k/1e3).toFixed(1)}k`:String(k),[h,p]=y.useState(!1),[g,v]=y.useState(!1),b=y.useCallback(()=>p(k=>!k),[]),_=y.useCallback(k=>{v(k),!k&&!h&&p(!1)},[h]);return c.jsxs(un,{open:h||g,onOpenChange:_,children:[c.jsx(dn,{asChild:!0,children:c.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1.5 px-1.5 py-1 rounded-md hover:bg-muted/50 cursor-pointer transition-colors",children:[c.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,className:`-rotate-90 ${d}`,children:[c.jsx("circle",{cx:i/2,cy:i/2,r:o,fill:"none",stroke:"currentColor",strokeWidth:s,opacity:.15}),l.map((k,w)=>c.jsx("circle",{cx:i/2,cy:i/2,r:o,fill:"none",stroke:k.color,strokeWidth:s,strokeDasharray:`${k.length} ${a-k.length}`,strokeDashoffset:-k.offset,strokeLinecap:"round",opacity:.85},w))]}),c.jsxs("span",{className:"text-2xs tabular-nums text-muted-foreground",children:[r,"%"]})]})}),c.jsx(en,{side:"bottom",className:"max-w-[220px] bg-popover text-popover-foreground border shadow-md",onPointerDownOutside:()=>p(!1),children:c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between text-xs font-medium",children:[c.jsx("span",{children:"Context Window"}),c.jsxs("span",{className:"tabular-nums",children:[u(e.total)," / ",u(e.limit)]})]}),c.jsx("div",{className:"w-full h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${r>=90?"bg-red-500":r>=75?"bg-amber-500":"bg-emerald-500"}`,style:{width:`${Math.min(r,100)}%`}})}),c.jsx("div",{className:"space-y-0.5",children:n.map(k=>c.jsxs("div",{className:"flex items-center justify-between text-xs",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:k.color}}),c.jsx("span",{className:"text-muted-foreground",children:k.label})]}),c.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[k.pct,"%"]})]},k.label))}),e.pruned&&c.jsx("div",{className:"text-2xs text-amber-500 pt-0.5 border-t border-border",children:"Old messages pruned to fit context"})]})})]})}const l1=Ln(),QXe=W0();function eZe(e){const[r,n]=y.useState([]),i=y.useCallback(async()=>{try{const l=e?`${l1}/api/consent/pending/${e}`:`${l1}/api/consent/pending`,u=await(await fetch(l)).json();n(u.requests)}catch{}},[e]);y.useEffect(()=>{const l=new WebSocket(QXe);return l.onmessage=d=>{try{const u=JSON.parse(d.data);if(u.type==="consent.required"){const h=u.payload;(!e||h.sessionId===e)&&n(p=>[...p,h])}if(u.type==="consent.resolved"){const h=u.payload;n(p=>p.filter(g=>g.id!==h.requestId))}}catch{}},l.onopen=()=>i(),()=>l.close()},[i,e]);const s=y.useCallback(async l=>{try{await fetch(`${l1}/api/consent/${l}/approve`,{method:"POST"}),n(d=>d.filter(u=>u.id!==l))}catch{}},[]),o=y.useCallback(async(l,d)=>{try{await fetch(`${l1}/api/consent/${l}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:d})}),n(u=>u.filter(h=>h.id!==l))}catch{}},[]),a=y.useCallback(async(l,d)=>{try{const h=await(await fetch(`${l1}/api/consent/pending/${l}/approve-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:d})})).json(),p=new Set(h.requestIds??[]);return p.size>0?n(g=>g.filter(v=>!p.has(v.id))):n(g=>g.filter(v=>v.sessionId!==l)),!0}catch{return!1}},[]);return{queue:r,approve:s,reject:o,approveAllForSession:a,refresh:i}}function tZe(){const[e,r]=y.useState(null),n=y.useCallback(async()=>{try{const s=await(await fetch(`${l1}/api/consent/policy`)).json();r(s)}catch{r(null)}},[]);return y.useEffect(()=>{n()},[n]),{policy:e,refresh:n}}function vH({risk:e}){const r={low:"bg-green-500/10 text-green-600 dark:text-green-400",medium:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",high:"bg-red-500/10 text-red-600 dark:text-red-400"},i={low:F4,medium:uK,high:E8}[e];return c.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${r[e]}`,children:[c.jsx(i,{className:"h-3 w-3"}),e]})}function xH({level:e}){const r={none:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",once:"bg-blue-500/10 text-blue-600 dark:text-blue-400",always:"bg-amber-500/10 text-amber-700 dark:text-amber-300",dangerous:"bg-red-500/10 text-red-600 dark:text-red-400"};return c.jsx("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${r[e]}`,children:e})}function bH({expiresAt:e}){const[r,n]=y.useState("");return y.useEffect(()=>{const i=()=>{const o=new Date(e).getTime()-Date.now();if(o<=0){n("expired");return}const a=Math.ceil(o/1e3);a>60?n(`${Math.ceil(a/60)}m`):n(`${a}s`)};i();const s=setInterval(i,1e3);return()=>clearInterval(s)},[e]),c.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[c.jsx(Bm,{className:"h-3 w-3"}),r]})}function _H({toolName:e}){return e.startsWith("terminal.")?c.jsx(Ao,{className:"h-4 w-4"}):e.startsWith("file.")?c.jsx(Ll,{className:"h-4 w-4"}):c.jsx(oK,{className:"h-4 w-4"})}function rZe({preview:e,toolName:r}){const n=e.command,i=e.path,s=e.content;return n?c.jsxs("div",{className:"rounded-md bg-muted p-3 font-mono text-xs leading-relaxed overflow-x-auto",children:[c.jsx("span",{className:"text-muted-foreground",children:"$ "}),n]}):i?c.jsxs("div",{className:"rounded-md bg-muted p-3 text-xs leading-relaxed overflow-x-auto",children:[c.jsxs("div",{className:"text-muted-foreground mb-1",children:[r,": ",i]}),s&&c.jsx("pre",{className:"font-mono whitespace-pre-wrap",children:s.length>500?s.slice(0,500)+"...":s})]}):c.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs leading-relaxed overflow-x-auto",children:JSON.stringify(e,null,2)})}function nZe({request:e,onApprove:r,onReject:n,compact:i=!1}){const[s,o]=y.useState(!1),a=async()=>{o(!0),r(e.id)},l=async()=>{o(!0),n(e.id)};return i?c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg border bg-card",children:[c.jsx(_H,{toolName:e.toolName}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium truncate",children:e.toolName}),c.jsx(vH,{risk:e.risk}),c.jsx(xH,{level:e.policy.consentLevel}),c.jsx(bH,{expiresAt:e.expiresAt})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e.summary})]}),c.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c.jsxs("button",{onClick:a,disabled:s,className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400 hover:bg-green-500/20 disabled:opacity-50 transition-colors",children:[c.jsx(cD,{className:"h-3 w-3"}),"Approve"]}),c.jsxs("button",{onClick:l,disabled:s,className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 hover:bg-red-500/20 disabled:opacity-50 transition-colors",children:[c.jsx(E8,{className:"h-3 w-3"}),"Reject"]})]})]}):c.jsxs("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-muted/30",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(_H,{toolName:e.toolName}),c.jsx("span",{className:"text-sm font-medium",children:e.toolName}),c.jsx(vH,{risk:e.risk}),c.jsx(xH,{level:e.policy.consentLevel})]}),c.jsx(bH,{expiresAt:e.expiresAt})]}),c.jsxs("div",{className:"p-4 space-y-3",children:[c.jsx("p",{className:"text-sm text-foreground",children:e.summary}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-xs text-muted-foreground",children:e.policy.description}),!e.policy.knownTool&&c.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:"Unknown tool: blocked behind dangerous consent until added to the active profile."})]}),c.jsx(rZe,{preview:e.preview,toolName:e.toolName})]}),c.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t bg-muted/20",children:[c.jsxs("button",{onClick:l,disabled:s,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 hover:bg-red-500/20 disabled:opacity-50 transition-colors",children:[c.jsx(E8,{className:"h-3.5 w-3.5"}),"Reject"]}),c.jsxs("button",{onClick:a,disabled:s,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-xs font-medium bg-green-500/10 text-green-600 dark:text-green-400 hover:bg-green-500/20 disabled:opacity-50 transition-colors",children:[c.jsx(cD,{className:"h-3.5 w-3.5"}),"Approve"]})]})]})}function iZe({status:e}){const r={running:{icon:sr,label:"Running",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},"awaiting-approval":{icon:uK,label:"Awaiting Approval",color:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"},"needs-input":{icon:Bm,label:"Needs Input",color:"bg-orange-500/10 text-orange-600 dark:text-orange-400"},completed:{icon:Hl,label:"Completed",color:"bg-green-500/10 text-green-600 dark:text-green-400"},failed:{icon:Th,label:"Failed",color:"bg-red-500/10 text-red-600 dark:text-red-400"}},{icon:n,label:i,color:s}=r[e];return c.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${s}`,children:[c.jsx(n,{className:`h-3 w-3 ${e==="running"?"animate-spin":""}`}),i]})}function sZe({className:e="",compact:r=!1,sessionId:n,onApproveAllEnabled:i}){const{queue:s,approve:o,reject:a,approveAllForSession:l}=eZe(n),{policy:d}=tZe(),[u,h]=y.useState(!1),p=y.useMemo(()=>n?s.filter(v=>v.sessionId===n):s,[s,n]),g=async()=>{if(!n||u)return;h(!0),await l(n)&&(i==null||i()),h(!1)};return p.length===0?null:c.jsxs("div",{className:`space-y-2 ${e}`,children:[c.jsxs("div",{className:"flex items-center justify-between px-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(iZe,{status:"awaiting-approval"}),c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," pending ",p.length===1?"request":"requests"]}),d&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["Profile: ",c.jsx("span",{className:"font-medium text-foreground",children:d.activeProfileName??"custom"})," ","• ",d.toolCount," configured tools • unknown tools require dangerous consent"]})]})]}),n&&p.length>0&&c.jsx("button",{onClick:g,disabled:u,className:"text-xs text-green-600 hover:text-green-500 dark:text-green-400 dark:hover:text-green-300 disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Approving...":"Approve all in this session"})]}),c.jsx("div",{className:"space-y-2",children:p.map(v=>c.jsx(nZe,{request:v,onApprove:o,onReject:a,compact:r},v.id))})]})}const wH=5e3;let oZe=0,g1=[],n4=new Set;function oE(e,r){g1.push({id:oZe++,ts:Date.now(),type:e,raw:r}),g1.length>wH&&(g1=g1.slice(-wH)),n4.forEach(n=>n())}function aZe(){g1=[],n4.forEach(e=>e())}function lZe(){const[,e]=y.useState(0);return y.useEffect(()=>{const r=()=>e(n=>n+1);return n4.add(r),()=>{n4.delete(r)}},[]),g1}const cZe={request:"text-orange-400",token:"text-gray-400",tool_call_delta:"text-blue-400",tool_start:"text-yellow-400",tool_output:"text-green-400",tool_result:"text-emerald-400",thinking:"text-purple-400",done:"text-gray-500",error:"text-red-400"},aE=20;function uZe({onClose:e}){const r=lZe(),n=y.useRef(null),[i,s]=y.useState(!0),[o,a]=y.useState(""),[l,d]=y.useState(!1),[u,h]=y.useState(new Set),p=y.useCallback(k=>{h(w=>{const C=new Set(w);return C.has(k)?C.delete(k):C.add(k),C})},[]),g=o?r.filter(k=>k.type.includes(o)||k.raw.includes(o)):r,v=J9({count:g.length,getScrollElement:()=>n.current,estimateSize:()=>aE,overscan:30}),b=()=>{const k=g.map(w=>`${new Date(w.ts).toISOString().slice(11,23)} ${w.type} ${w.raw}`).join(`
1158
1158
  `);navigator.clipboard.writeText(k),d(!0),setTimeout(()=>d(!1),1500)};y.useEffect(()=>{i&&g.length>0&&v.scrollToIndex(g.length-1,{align:"end"})},[g.length,i]);const _=y.useCallback(()=>{const k=n.current;if(!k)return;const w=k.scrollHeight-k.scrollTop-k.clientHeight<40;s(w)},[]);return c.jsxs("div",{className:"flex flex-col h-full bg-[#0d1117] text-[#c9d1d9] text-xs font-mono",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-zinc-700/60 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-zinc-400 uppercase tracking-wider",children:"SSE Debug"}),c.jsxs("span",{className:"text-2xs text-zinc-500",children:[g.length,"/",r.length]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",placeholder:"Filter...",value:o,onChange:k=>a(k.target.value),className:"h-5 w-28 px-1.5 text-2xs rounded bg-zinc-800 border border-zinc-700 text-zinc-300 placeholder-zinc-500 focus:outline-none focus:border-blue-500"}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:b,title:"Copy all events",children:l?c.jsx(ss,{className:"h-3 w-3 text-green-400"}):c.jsx(du,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:aZe,children:c.jsx(bh,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:e,children:c.jsx(Zn,{className:"h-3 w-3"})})]})]}),c.jsx("div",{ref:n,onScroll:_,className:"flex-1 overflow-y-auto overflow-x-hidden",children:c.jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative",width:"100%"},children:v.getVirtualItems().map(k=>{const w=g[k.index],C=new Date(w.ts).toISOString().slice(11,23),j=cZe[w.type]??"text-zinc-400",T=w.raw.length>120,A=u.has(w.id),E=T&&!A?w.raw.slice(0,120)+"…":w.raw;return c.jsxs("div",{"data-index":k.index,ref:v.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${k.start}px)`},className:Ve("flex gap-2 px-2 hover:bg-zinc-800/50 leading-tight cursor-pointer select-none",A?"items-start py-1 bg-zinc-800/30":"items-center"),onClick:()=>p(w.id),children:[c.jsx("span",{className:"text-zinc-600 shrink-0 w-20",style:{minHeight:aE},children:C}),c.jsx("span",{className:Ve("shrink-0 w-28 text-right",j),style:{minHeight:aE},children:w.type}),c.jsxs("span",{className:Ve("text-zinc-400 min-w-0",A?"break-all whitespace-pre-wrap":"truncate"),children:[E,T&&!A&&c.jsx("span",{className:"text-zinc-600 ml-1",children:"▸"})]})]},w.id)})})}),!i&&c.jsx("div",{className:"absolute bottom-2 right-4",children:c.jsx(we,{variant:"outline",size:"icon",className:"h-6 w-6 rounded-full bg-zinc-800 border-zinc-600",onClick:()=>{s(!0),v.scrollToIndex(g.length-1,{align:"end"})},children:c.jsx(ZG,{className:"h-3 w-3"})})})]})}function dZe(e,r=[]){let n=[];function i(o,a){const l=y.createContext(a),d=n.length;n=[...n,a];const u=p=>{var w;const{scope:g,children:v,...b}=p,_=((w=g==null?void 0:g[e])==null?void 0:w[d])||l,k=y.useMemo(()=>b,Object.values(b));return c.jsx(_.Provider,{value:k,children:v})};u.displayName=o+"Provider";function h(p,g){var _;const v=((_=g==null?void 0:g[e])==null?void 0:_[d])||l,b=y.useContext(v);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[u,h]}const s=()=>{const o=n.map(a=>y.createContext(a));return function(l){const d=(l==null?void 0:l[e])||o;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return s.scopeName=e,[i,hZe(s,...r)]}function hZe(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=i.reduce((l,{useScope:d,scopeName:u})=>{const p=d(o)[`__scope${u}`];return{...l,...p}},{});return y.useMemo(()=>({[`__scope${r.scopeName}`]:a}),[a])}};return n.scopeName=r.scopeName,n}function Joe(e){const r=y.useRef({value:e,previous:e});return y.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}function fZe(e){const r=pZe(e),n=y.forwardRef((i,s)=>{const{children:o,...a}=i,l=y.Children.toArray(o),d=l.find(gZe);if(d){const u=d.props.children,h=l.map(p=>p===d?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:p);return c.jsx(r,{...a,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return c.jsx(r,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function pZe(e){const r=y.forwardRef((n,i)=>{const{children:s,...o}=n;if(y.isValidElement(s)){const a=vZe(s),l=yZe(o,s.props);return s.type!==y.Fragment&&(l.ref=i?ys(i,a):a),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var mZe=Symbol("radix.slottable");function gZe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mZe}function yZe(e,r){const n={...r};for(const i in r){const s=e[i],o=r[i];/^on[A-Z]/.test(i)?s&&o?n[i]=(...l)=>{const d=o(...l);return s(...l),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...o}:i==="className"&&(n[i]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function vZe(e){var i,s;let r=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=r&&"isReactWarning"in r&&r.isReactWarning;return n?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=r&&"isReactWarning"in r&&r.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xZe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qoe=xZe.reduce((e,r)=>{const n=fZe(`Primitive.${r}`),i=y.forwardRef((s,o)=>{const{asChild:a,...l}=s,d=a?n:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...l,ref:o})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),a6="Switch",[bZe]=dZe(a6),[_Ze,wZe]=bZe(a6),eae=y.forwardRef((e,r)=>{const{__scopeSwitch:n,name:i,checked:s,defaultChecked:o,required:a,disabled:l,value:d="on",onCheckedChange:u,form:h,...p}=e,[g,v]=y.useState(null),b=gn(r,j=>v(j)),_=y.useRef(!1),k=g?h||!!g.closest("form"):!0,[w,C]=jh({prop:s,defaultProp:o??!1,onChange:u,caller:a6});return c.jsxs(_Ze,{scope:n,checked:w,disabled:l,children:[c.jsx(Qoe.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":iae(w),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:b,onClick:Kt(e.onClick,j=>{C(T=>!T),k&&(_.current=j.isPropagationStopped(),_.current||j.stopPropagation())})}),k&&c.jsx(nae,{control:g,bubbles:!_.current,name:i,value:d,checked:w,required:a,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});eae.displayName=a6;var tae="SwitchThumb",rae=y.forwardRef((e,r)=>{const{__scopeSwitch:n,...i}=e,s=wZe(tae,n);return c.jsx(Qoe.span,{"data-state":iae(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:r})});rae.displayName=tae;var SZe="SwitchBubbleInput",nae=y.forwardRef(({__scopeSwitch:e,control:r,checked:n,bubbles:i=!0,...s},o)=>{const a=y.useRef(null),l=gn(a,o),d=Joe(n),u=$K(r);return y.useEffect(()=>{const h=a.current;if(!h)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:i});v.call(h,n),h.dispatchEvent(b)}},[d,n,i]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});nae.displayName=SZe;function iae(e){return e?"checked":"unchecked"}var sae=eae,kZe=rae;const Zf=y.forwardRef(({className:e,...r},n)=>c.jsx(sae,{className:Ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:c.jsx(kZe,{className:Ve("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Zf.displayName=sae.displayName;var RS="Ollama",CZe=.6,jZe=.1,oae="#fff",TZe=oae,NZe="#000",EZe=.75;function q2(e){"@babel/helpers - typeof";return q2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},q2(e)}var AZe=["size","style"];function SH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function lE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?SH(Object(n),!0).forEach(function(i){OZe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function OZe(e,r,n){return r=RZe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function RZe(e){var r=MZe(e,"string");return q2(r)=="symbol"?r:String(r)}function MZe(e,r){if(q2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(q2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function PZe(e,r){if(e==null)return{};var n=LZe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function LZe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var rP=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=PZe(e,AZe);return c.jsxs("svg",lE(lE({fill:"currentColor",fillRule:"evenodd",height:n,style:lE({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:RS}),c.jsx("path",{d:"M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z"})]}))});function G2(e){"@babel/helpers - typeof";return G2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},G2(e)}function kH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function $Ze(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?kH(Object(n),!0).forEach(function(i){DZe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function DZe(e,r,n){return r=IZe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function IZe(e){var r=BZe(e,"string");return G2(r)=="symbol"?r:String(r)}function BZe(e,r){if(G2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(G2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function zZe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var FZe=y.memo(function(e){var r=Object.assign({},(zZe(e),e));return c.jsx(cl,$Ze({Icon:rP,"aria-label":RS,background:TZe,color:NZe,iconMultiple:EZe},r))});function K2(e){"@babel/helpers - typeof";return K2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},K2(e)}var HZe=["size","style"];function CH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function cE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?CH(Object(n),!0).forEach(function(i){WZe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function WZe(e,r,n){return r=UZe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function UZe(e){var r=VZe(e,"string");return K2(r)=="symbol"?r:String(r)}function VZe(e,r){if(K2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(K2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function qZe(e,r){if(e==null)return{};var n=GZe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function GZe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var aae=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=qZe(e,HZe);return c.jsxs("svg",cE(cE({fill:"currentColor",fillRule:"evenodd",height:n,style:cE({flex:"none",lineHeight:1},i),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:RS}),c.jsx("path",{d:"M11.333 2c-2.959 0-5.272.943-6.94 2.884C2.78 6.717 2 9.09 2 12.027c0 2.911.78 5.283 2.394 7.116C6.06 21.03 8.374 22 11.333 22c2.931 0 5.244-.943 6.939-2.83 1.614-1.806 2.42-4.178 2.42-7.143s-.806-5.364-2.42-7.17C16.577 2.943 14.264 2 11.332 2zm0 2.776c1.99 0 3.523.62 4.599 1.914 1.049 1.294 1.587 3.073 1.587 5.337s-.538 4.016-1.587 5.283c-1.076 1.267-2.609 1.914-4.6 1.914-1.99 0-3.55-.674-4.625-1.995-1.05-1.294-1.56-3.019-1.56-5.202 0-2.21.51-3.935 1.56-5.23 1.102-1.347 2.636-2.02 4.626-2.02zM22.979 2v19.623h3.066V2h-3.066zm6.159 0v19.623h3.066V2h-3.066zm12.21 5.31c-1.775 0-3.173.296-4.195.943-1.21.701-1.964 1.833-2.26 3.37l3.04.242c.161-.728.564-1.267 1.156-1.617.511-.323 1.184-.458 2.044-.458 1.99 0 2.986.89 2.986 2.722v.54l-3.04.08c-2.044.054-3.63.485-4.76 1.294-1.237.835-1.829 2.048-1.829 3.612 0 1.159.43 2.102 1.29 2.857.835.728 1.964 1.105 3.417 1.105 1.21 0 2.259-.216 3.146-.62.78-.377 1.453-.89 1.99-1.59v1.833h2.852v-8.895c0-1.698-.43-2.992-1.291-3.882-.969-1.024-2.502-1.536-4.546-1.536zm2.77 7.951v.701c0 1.078-.43 1.968-1.237 2.669-.806.674-1.802 1.024-2.985 1.024-.672 0-1.21-.189-1.64-.512-.431-.324-.62-.728-.62-1.213 0-1.614 1.129-2.473 3.41-2.58l3.073-.089zM56.572 7.31c-1.344 0-2.609.593-3.765 1.806V7.687H49.74v13.936h3.066v-8.356c0-.917.269-1.725.807-2.372.538-.7 1.237-1.024 2.125-1.024 1.828 0 2.743 1.05 2.743 3.18v8.572h3.066v-8.518c0-1.024.242-1.806.78-2.372.511-.593 1.13-.862 1.883-.862 1.075 0 1.829.242 2.313.754.457.486.699 1.294.699 2.4v8.598h3.066v-9.138c0-1.536-.484-2.776-1.398-3.746-.969-.97-2.152-1.429-3.578-1.429-.941 0-1.72.162-2.34.485-.699.324-1.371.917-2.017 1.78-.887-1.51-2.34-2.265-4.384-2.265zm22.593 0c-1.775 0-3.174.296-4.196.943-1.21.701-1.963 1.833-2.26 3.37l3.04.242c.161-.728.565-1.267 1.156-1.617.511-.323 1.184-.458 2.044-.458 1.99 0 2.986.89 2.986 2.722v.54l-3.04.08c-2.043.054-3.63.485-4.76 1.294-1.237.835-1.829 2.048-1.829 3.612 0 1.159.43 2.102 1.291 2.857.834.728 1.964 1.105 3.416 1.105 1.21 0 2.26-.216 3.147-.62.78-.377 1.452-.89 1.99-1.59v1.833H85v-8.895c0-1.698-.43-2.992-1.291-3.882-.968-1.024-2.501-1.536-4.545-1.536zm2.77 7.951v.701c0 1.078-.43 1.968-1.237 2.669-.807.674-1.802 1.024-2.986 1.024-.672 0-1.21-.189-1.64-.512-.43-.324-.619-.728-.619-1.213 0-1.614 1.128-2.473 3.41-2.58l3.072-.089z"})]}))});function Y2(e){"@babel/helpers - typeof";return Y2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Y2(e)}function jH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function KZe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?jH(Object(n),!0).forEach(function(i){YZe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function YZe(e,r,n){return r=XZe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function XZe(e){var r=ZZe(e,"string");return Y2(r)=="symbol"?r:String(r)}function ZZe(e,r){if(Y2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(Y2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function JZe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var QZe=y.memo(function(e){var r=Object.assign({},(JZe(e),e));return c.jsx(ul,KZe({Icon:rP,Text:aae,"aria-label":RS,spaceMultiple:jZe,textMultiple:CZe},r))}),K0=rP;K0.Text=aae;K0.Combine=QZe;K0.Avatar=FZe;K0.colorPrimary=oae;K0.title=RS;var E0="Qwen",eJe=.7,tJe=.2,lae="#615ced",rJe="linear-gradient(to right, #6336E7, #6F69F7)",nJe=lae,iJe="#fff",sJe=.75;function X2(e){"@babel/helpers - typeof";return X2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},X2(e)}var oJe=["size","style"];function TH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function uE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?TH(Object(n),!0).forEach(function(i){aJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function aJe(e,r,n){return r=lJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function lJe(e){var r=cJe(e,"string");return X2(r)=="symbol"?r:String(r)}function cJe(e,r){if(X2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(X2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function uJe(e,r){if(e==null)return{};var n=dJe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function dJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var nP=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=uJe(e,oJe);return c.jsxs("svg",uE(uE({fill:"currentColor",fillRule:"evenodd",height:n,style:uE({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:E0}),c.jsx("path",{d:"M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z"})]}))});function Z2(e){"@babel/helpers - typeof";return Z2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Z2(e)}function NH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function hJe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?NH(Object(n),!0).forEach(function(i){fJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function fJe(e,r,n){return r=pJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function pJe(e){var r=mJe(e,"string");return Z2(r)=="symbol"?r:String(r)}function mJe(e,r){if(Z2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(Z2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function gJe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var yJe=y.memo(function(e){var r=Object.assign({},(gJe(e),e));return c.jsx(cl,hJe({Icon:nP,"aria-label":E0,background:nJe,color:iJe,iconMultiple:sJe},r))});function J2(e){"@babel/helpers - typeof";return J2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},J2(e)}var vJe=["size","style"];function EH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function dE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?EH(Object(n),!0).forEach(function(i){xJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function xJe(e,r,n){return r=bJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function bJe(e){var r=_Je(e,"string");return J2(r)=="symbol"?r:String(r)}function _Je(e,r){if(J2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(J2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function wJe(e,r){if(e==null)return{};var n=SJe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function SJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var cae=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=wJe(e,vJe),o=kOe(E0),a=o.id,l=o.fill;return c.jsxs("svg",dE(dE({height:n,style:dE({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:E0}),c.jsx("path",{d:"M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z",fill:l,fillRule:"nonzero"}),c.jsx("defs",{children:c.jsxs("linearGradient",{id:a,x1:"0%",x2:"100%",y1:"0%",y2:"0%",children:[c.jsx("stop",{offset:"0%",stopColor:"#6336E7",stopOpacity:".84"}),c.jsx("stop",{offset:"100%",stopColor:"#6F69F7",stopOpacity:".84"})]})})]}))});function Q2(e){"@babel/helpers - typeof";return Q2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Q2(e)}var kJe=["size","style"];function AH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function hE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?AH(Object(n),!0).forEach(function(i){CJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function CJe(e,r,n){return r=jJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function jJe(e){var r=TJe(e,"string");return Q2(r)=="symbol"?r:String(r)}function TJe(e,r){if(Q2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(Q2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function NJe(e,r){if(e==null)return{};var n=EJe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function EJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var uae=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=NJe(e,kJe);return c.jsxs("svg",hE(hE({fill:"currentColor",fillRule:"evenodd",height:n,style:hE({flex:"none",lineHeight:1},i),viewBox:"0 0 75 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:E0}),c.jsx("path",{d:"M11.425 14.13h3.642l1.529 1.795a7.89 7.89 0 002.166-2.832 8.36 8.36 0 00.771-3.562c0-2.03-.624-3.664-1.874-4.905-1.24-1.25-2.884-1.874-4.931-1.874-1.028 0-1.99.186-2.885.558A6.99 6.99 0 007.45 4.932 8.576 8.576 0 005.656 7.67a8.354 8.354 0 00-.625 3.19c0 2.003.611 3.643 1.834 4.919 1.223 1.276 2.779 1.914 4.666 1.914.39 0 .793-.031 1.21-.093.425-.062.868-.16 1.329-.293l-2.645-3.177zM18.07 22l-2.127-2.46c-.753.293-1.48.51-2.18.652a9.84 9.84 0 01-2.073.226c-2.97 0-5.326-.85-7.072-2.552C2.873 16.164 2 13.865 2 10.966c0-1.577.28-3.052.837-4.426a10.148 10.148 0 012.406-3.576A10.427 10.427 0 018.713.758C10.025.253 11.429 0 12.927 0c2.915 0 5.25.86 7.005 2.579 1.755 1.72 2.632 4.01 2.632 6.872 0 1.764-.354 3.399-1.063 4.905a10.156 10.156 0 01-3.031 3.776L21.714 22H18.07zm5.743-14.675h2.884l2.047 6.433.054.16c.248.789.38 1.373.399 1.755.097-.302.221-.62.372-.958.16-.345.354-.713.585-1.103l4.227-7.218 2.06 7.43c.08.275.146.559.2.851.053.293.097.63.133 1.01.132-.372.265-.708.398-1.01.142-.3.28-.562.412-.784l3.816-6.567h3.243L36.097 20.71l-2.127-7.045a8.683 8.683 0 01-.213-.798 17.846 17.846 0 01-.146-.97 69.17 69.17 0 01-.519 1.063c-.15.302-.265.514-.345.638l-4.28 7.112-4.653-13.385zm24.392 4.785h6.5c-.026-.85-.292-1.52-.797-2.007-.496-.497-1.166-.745-2.008-.745-.957 0-1.768.248-2.432.745-.665.496-1.086 1.165-1.263 2.007zm6.34 3.948l2.061 1.608c-.735.966-1.533 1.67-2.392 2.114-.86.443-1.848.665-2.965.665-1.87 0-3.38-.563-4.533-1.689-1.152-1.134-1.728-2.623-1.728-4.466 0-2.162.66-3.935 1.98-5.317 1.33-1.391 3.018-2.087 5.066-2.087 1.71 0 3.07.532 4.08 1.595 1.02 1.055 1.53 2.473 1.53 4.254 0 .15-.01.345-.027.585-.01.23-.027.51-.054.837h-9.61c0 1.143.288 2.056.864 2.738.576.674 1.342 1.01 2.3 1.01.664 0 1.293-.159 1.887-.478a4.633 4.633 0 001.542-1.369zm14.317 3.868l.957-7.244c.018-.133.031-.27.04-.412.009-.151.013-.368.013-.652 0-.824-.2-1.453-.598-1.887-.399-.444-.98-.665-1.741-.665-1.188 0-2.118.385-2.792 1.156-.673.763-1.112 1.937-1.316 3.523l-.797 6.181H59.77l1.661-12.601h2.752l-.213 1.515c.727-.664 1.476-1.156 2.247-1.475a6.5 6.5 0 012.486-.479c1.293 0 2.3.341 3.017 1.024.727.673 1.09 1.622 1.09 2.845 0 .31-.018.673-.053 1.09-.036.407-.089.886-.16 1.435l-.877 6.647h-2.858z"})]}))});function ew(e){"@babel/helpers - typeof";return ew=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ew(e)}var AJe=["type","extraStyle"];function OH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function RH(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?OH(Object(n),!0).forEach(function(i){OJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function OJe(e,r,n){return r=RJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function RJe(e){var r=MJe(e,"string");return ew(r)=="symbol"?r:String(r)}function MJe(e,r){if(ew(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(ew(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function PJe(e,r){if(e==null)return{};var n=LJe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function LJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var $Je=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=e.extraStyle,s=PJe(e,AJe),o=n==="color"?cae:nP;return c.jsx(ul,RH({Icon:o,Text:uae,"aria-label":E0,extraStyle:RH({fontWeight:500},i),spaceMultiple:tJe,textMultiple:eJe},s))}),hd=nP;hd.Color=cae;hd.Text=uae;hd.Combine=$Je;hd.Avatar=yJe;hd.colorPrimary=lae;hd.colorGradient=rJe;hd.title=E0;var Rh="Meta",DJe=.75,IJe=.2,BJe="#1d65c1",dae="linear-gradient(45deg, #007FF8, #0668E1, #007FF8)",zJe=dae,FJe="#fff",HJe=.75;function tw(e){"@babel/helpers - typeof";return tw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},tw(e)}var WJe=["size","style"];function MH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function fE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?MH(Object(n),!0).forEach(function(i){UJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function UJe(e,r,n){return r=VJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function VJe(e){var r=qJe(e,"string");return tw(r)=="symbol"?r:String(r)}function qJe(e,r){if(tw(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(tw(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function GJe(e,r){if(e==null)return{};var n=KJe(e,r),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function KJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var iP=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=GJe(e,WJe);return c.jsxs("svg",fE(fE({fill:"currentColor",fillRule:"evenodd",height:n,style:fE({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Rh}),c.jsx("path",{d:"M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z"})]}))});function rw(e){"@babel/helpers - typeof";return rw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},rw(e)}function PH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function YJe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?PH(Object(n),!0).forEach(function(i){XJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function XJe(e,r,n){return r=ZJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function ZJe(e){var r=JJe(e,"string");return rw(r)=="symbol"?r:String(r)}function JJe(e,r){if(rw(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(rw(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function QJe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var eQe=y.memo(function(e){var r=Object.assign({},(QJe(e),e));return c.jsx(cl,YJe({Icon:iP,"aria-label":Rh,background:zJe,color:FJe,iconMultiple:HJe},r))});function nw(e){"@babel/helpers - typeof";return nw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},nw(e)}var tQe=["size","style"];function LH(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function pE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?LH(Object(n),!0).forEach(function(i){rQe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function rQe(e,r,n){return r=nQe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function nQe(e){var r=iQe(e,"string");return nw(r)=="symbol"?r:String(r)}function iQe(e,r){if(nw(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(nw(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function sQe(e,r){return cQe(e)||lQe(e,r)||aQe(e,r)||oQe()}function oQe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.