@jait/gateway 0.1.445 → 0.1.446

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 (62) hide show
  1. package/dist/tools/prompts/shared-sections.d.ts +2 -2
  2. package/dist/tools/prompts/shared-sections.d.ts.map +1 -1
  3. package/dist/tools/prompts/shared-sections.js +5 -2
  4. package/dist/tools/prompts/shared-sections.js.map +1 -1
  5. package/package.json +1 -1
  6. package/web-dist/assets/{_basePickBy-vwgjKPFT.js → _basePickBy-C0xeMzCL.js} +1 -1
  7. package/web-dist/assets/{_baseUniq-CskedJX6.js → _baseUniq-Cpdd1tWi.js} +1 -1
  8. package/web-dist/assets/{arc-JmHTWZ7p.js → arc-DDghAyfu.js} +1 -1
  9. package/web-dist/assets/{architectureDiagram-2XIMDMQ5-32zggPY7.js → architectureDiagram-2XIMDMQ5-7aPVlRJf.js} +1 -1
  10. package/web-dist/assets/{blockDiagram-WCTKOSBZ-UnCUDtqF.js → blockDiagram-WCTKOSBZ-Dl78blHG.js} +1 -1
  11. package/web-dist/assets/{c4Diagram-IC4MRINW-CXdZ6lpb.js → c4Diagram-IC4MRINW-B2wl4mK7.js} +1 -1
  12. package/web-dist/assets/channel-BuilH7Pv.js +1 -0
  13. package/web-dist/assets/{chunk-4BX2VUAB-D1Y7UPiT.js → chunk-4BX2VUAB-CFyL6aiX.js} +1 -1
  14. package/web-dist/assets/{chunk-55IACEB6-DGnA6JH2.js → chunk-55IACEB6-9wd7GXuK.js} +1 -1
  15. package/web-dist/assets/{chunk-FMBD7UC4-BD-GPjKZ.js → chunk-FMBD7UC4-CQ82NDdR.js} +1 -1
  16. package/web-dist/assets/{chunk-JSJVCQXG-DC6kf0pH.js → chunk-JSJVCQXG-Y0Xr5a6D.js} +1 -1
  17. package/web-dist/assets/{chunk-KX2RTZJC-Dhj4IabJ.js → chunk-KX2RTZJC-Z8E9D02W.js} +1 -1
  18. package/web-dist/assets/{chunk-NQ4KR5QH-DF0x-YrQ.js → chunk-NQ4KR5QH-uaZGuHDD.js} +1 -1
  19. package/web-dist/assets/{chunk-QZHKN3VN-P0YBulgE.js → chunk-QZHKN3VN-BMT2EPyC.js} +1 -1
  20. package/web-dist/assets/{chunk-WL4C6EOR-De5mEURo.js → chunk-WL4C6EOR-khAV39Vx.js} +1 -1
  21. package/web-dist/assets/classDiagram-VBA2DB6C-CgHdYKIM.js +1 -0
  22. package/web-dist/assets/classDiagram-v2-RAHNMMFH-CgHdYKIM.js +1 -0
  23. package/web-dist/assets/clone-4Hng0_3M.js +1 -0
  24. package/web-dist/assets/{cose-bilkent-S5V4N54A-piNxB7P4.js → cose-bilkent-S5V4N54A-DHsyHTZd.js} +1 -1
  25. package/web-dist/assets/{dagre-KLK3FWXG-CaqiA13p.js → dagre-KLK3FWXG-oK4s-Hdt.js} +1 -1
  26. package/web-dist/assets/{diagram-E7M64L7V-0qOMs8UI.js → diagram-E7M64L7V-C8k51-cC.js} +1 -1
  27. package/web-dist/assets/{diagram-IFDJBPK2-DJan_W4f.js → diagram-IFDJBPK2-EwISt7PA.js} +1 -1
  28. package/web-dist/assets/{diagram-P4PSJMXO-BeaSFiV0.js → diagram-P4PSJMXO-ySZDscia.js} +1 -1
  29. package/web-dist/assets/{erDiagram-INFDFZHY-C6N0kuAl.js → erDiagram-INFDFZHY-EVWjA3sf.js} +1 -1
  30. package/web-dist/assets/{flowDiagram-PKNHOUZH-BiRUi27S.js → flowDiagram-PKNHOUZH-zj5HRAsJ.js} +1 -1
  31. package/web-dist/assets/{ganttDiagram-A5KZAMGK-CywGz7nU.js → ganttDiagram-A5KZAMGK-Bp5NgGcR.js} +1 -1
  32. package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-It1b6c7e.js → gitGraphDiagram-K3NZZRJ6-0-hbfXPF.js} +1 -1
  33. package/web-dist/assets/{graph-D99Nl1BW.js → graph-BggyKMfo.js} +1 -1
  34. package/web-dist/assets/{index-ATzvb6a3.js → index-Bd1Lr-k3.js} +1 -1
  35. package/web-dist/assets/{index-CS1-3a2Q.js → index-Bo7mi4sI.js} +6 -6
  36. package/web-dist/assets/index-Cq8IOQ36.css +32 -0
  37. package/web-dist/assets/{index-CHxDrHq9.js → index-vH_IM2Q6.js} +1 -1
  38. package/web-dist/assets/{infoDiagram-LFFYTUFH-BVy6S5R7.js → infoDiagram-LFFYTUFH-DrlqUeU4.js} +1 -1
  39. package/web-dist/assets/{ishikawaDiagram-PHBUUO56-UubnteoS.js → ishikawaDiagram-PHBUUO56-C3SnWGNp.js} +1 -1
  40. package/web-dist/assets/{journeyDiagram-4ABVD52K-DKNI_Dnv.js → journeyDiagram-4ABVD52K-DEeW_yOb.js} +1 -1
  41. package/web-dist/assets/{kanban-definition-K7BYSVSG-9z_mhKoE.js → kanban-definition-K7BYSVSG-FM29gKpg.js} +1 -1
  42. package/web-dist/assets/{layout-EwqlCqHr.js → layout-Bbnt-sKP.js} +1 -1
  43. package/web-dist/assets/{linear-D8hcIAD7.js → linear-DIEA_S_R.js} +1 -1
  44. package/web-dist/assets/{mindmap-definition-YRQLILUH-BKg4ze2I.js → mindmap-definition-YRQLILUH-D-8c-93p.js} +1 -1
  45. package/web-dist/assets/{pieDiagram-SKSYHLDU-DGdb_0Z7.js → pieDiagram-SKSYHLDU-srcpZS8v.js} +1 -1
  46. package/web-dist/assets/{quadrantDiagram-337W2JSQ-CY_eWEbD.js → quadrantDiagram-337W2JSQ-BV5SE8BI.js} +1 -1
  47. package/web-dist/assets/{requirementDiagram-Z7DCOOCP-D3B65LEW.js → requirementDiagram-Z7DCOOCP-EaiMvJWs.js} +1 -1
  48. package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-uKY_Zaux.js → sankeyDiagram-WA2Y5GQK-lAl01ROV.js} +1 -1
  49. package/web-dist/assets/{sequenceDiagram-2WXFIKYE-8hG861Pn.js → sequenceDiagram-2WXFIKYE-BCmIdbbn.js} +1 -1
  50. package/web-dist/assets/{stateDiagram-RAJIS63D-YedMaAHI.js → stateDiagram-RAJIS63D-BV4lQzYf.js} +1 -1
  51. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-CIxheqQG.js +1 -0
  52. package/web-dist/assets/{timeline-definition-YZTLITO2-DBvhv1ED.js → timeline-definition-YZTLITO2-Z9qknQl4.js} +1 -1
  53. package/web-dist/assets/{treemap-KZPCXAKY-BnbyUDl_.js → treemap-KZPCXAKY-DelChN1K.js} +1 -1
  54. package/web-dist/assets/{vennDiagram-LZ73GAT5-BpTbgJnx.js → vennDiagram-LZ73GAT5-Dq4AW_h7.js} +1 -1
  55. package/web-dist/assets/{xychartDiagram-JWTSCODW-RnFHWlAK.js → xychartDiagram-JWTSCODW-NnFseC2a.js} +1 -1
  56. package/web-dist/index.html +2 -2
  57. package/web-dist/assets/channel-CkLAj7TX.js +0 -1
  58. package/web-dist/assets/classDiagram-VBA2DB6C-Del1uk2I.js +0 -1
  59. package/web-dist/assets/classDiagram-v2-RAHNMMFH-Del1uk2I.js +0 -1
  60. package/web-dist/assets/clone-Cz9QYpjR.js +0 -1
  61. package/web-dist/assets/index-Bc8FwYAW.css +0 -32
  62. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-BjdTc8_d.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-CaqiA13p.js","./graph-D99Nl1BW.js","./_baseUniq-CskedJX6.js","./layout-EwqlCqHr.js","./_basePickBy-vwgjKPFT.js","./clone-Cz9QYpjR.js","./cose-bilkent-S5V4N54A-piNxB7P4.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-CXdZ6lpb.js","./chunk-JSJVCQXG-DC6kf0pH.js","./flowDiagram-PKNHOUZH-BiRUi27S.js","./chunk-FMBD7UC4-BD-GPjKZ.js","./chunk-55IACEB6-DGnA6JH2.js","./chunk-KX2RTZJC-Dhj4IabJ.js","./channel-CkLAj7TX.js","./erDiagram-INFDFZHY-C6N0kuAl.js","./gitGraphDiagram-K3NZZRJ6-It1b6c7e.js","./chunk-4BX2VUAB-D1Y7UPiT.js","./chunk-QZHKN3VN-P0YBulgE.js","./treemap-KZPCXAKY-BnbyUDl_.js","./ganttDiagram-A5KZAMGK-CywGz7nU.js","./linear-D8hcIAD7.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-BVy6S5R7.js","./pieDiagram-SKSYHLDU-DGdb_0Z7.js","./arc-JmHTWZ7p.js","./quadrantDiagram-337W2JSQ-CY_eWEbD.js","./xychartDiagram-JWTSCODW-RnFHWlAK.js","./requirementDiagram-Z7DCOOCP-D3B65LEW.js","./sequenceDiagram-2WXFIKYE-8hG861Pn.js","./classDiagram-VBA2DB6C-Del1uk2I.js","./chunk-WL4C6EOR-De5mEURo.js","./classDiagram-v2-RAHNMMFH-Del1uk2I.js","./stateDiagram-RAJIS63D-YedMaAHI.js","./chunk-NQ4KR5QH-DF0x-YrQ.js","./stateDiagram-v2-FVOUBMTO-BjdTc8_d.js","./journeyDiagram-4ABVD52K-DKNI_Dnv.js","./timeline-definition-YZTLITO2-DBvhv1ED.js","./mindmap-definition-YRQLILUH-BKg4ze2I.js","./kanban-definition-K7BYSVSG-9z_mhKoE.js","./diagram-P4PSJMXO-BeaSFiV0.js","./diagram-IFDJBPK2-DJan_W4f.js","./blockDiagram-WCTKOSBZ-UnCUDtqF.js","./architectureDiagram-2XIMDMQ5-32zggPY7.js","./diagram-E7M64L7V-0qOMs8UI.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-oK4s-Hdt.js","./graph-BggyKMfo.js","./_baseUniq-Cpdd1tWi.js","./layout-Bbnt-sKP.js","./_basePickBy-C0xeMzCL.js","./clone-4Hng0_3M.js","./cose-bilkent-S5V4N54A-DHsyHTZd.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-B2wl4mK7.js","./chunk-JSJVCQXG-Y0Xr5a6D.js","./flowDiagram-PKNHOUZH-zj5HRAsJ.js","./chunk-FMBD7UC4-CQ82NDdR.js","./chunk-55IACEB6-9wd7GXuK.js","./chunk-KX2RTZJC-Z8E9D02W.js","./channel-BuilH7Pv.js","./erDiagram-INFDFZHY-EVWjA3sf.js","./gitGraphDiagram-K3NZZRJ6-0-hbfXPF.js","./chunk-4BX2VUAB-CFyL6aiX.js","./chunk-QZHKN3VN-BMT2EPyC.js","./treemap-KZPCXAKY-DelChN1K.js","./ganttDiagram-A5KZAMGK-Bp5NgGcR.js","./linear-DIEA_S_R.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-DrlqUeU4.js","./pieDiagram-SKSYHLDU-srcpZS8v.js","./arc-DDghAyfu.js","./quadrantDiagram-337W2JSQ-BV5SE8BI.js","./xychartDiagram-JWTSCODW-NnFseC2a.js","./requirementDiagram-Z7DCOOCP-EaiMvJWs.js","./sequenceDiagram-2WXFIKYE-BCmIdbbn.js","./classDiagram-VBA2DB6C-CgHdYKIM.js","./chunk-WL4C6EOR-khAV39Vx.js","./classDiagram-v2-RAHNMMFH-CgHdYKIM.js","./stateDiagram-RAJIS63D-BV4lQzYf.js","./chunk-NQ4KR5QH-uaZGuHDD.js","./stateDiagram-v2-FVOUBMTO-CIxheqQG.js","./journeyDiagram-4ABVD52K-DEeW_yOb.js","./timeline-definition-YZTLITO2-Z9qknQl4.js","./mindmap-definition-YRQLILUH-D-8c-93p.js","./kanban-definition-K7BYSVSG-FM29gKpg.js","./diagram-P4PSJMXO-ySZDscia.js","./diagram-IFDJBPK2-EwISt7PA.js","./blockDiagram-WCTKOSBZ-Dl78blHG.js","./architectureDiagram-2XIMDMQ5-7aPVlRJf.js","./diagram-E7M64L7V-C8k51-cC.js"])))=>i.map(i=>d[i]);
2
2
  var dfe=Object.defineProperty;var hfe=(e,r,n)=>r in e?dfe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Ve=(e,r,n)=>hfe(e,typeof r!="symbol"?r+"":r,n);function ffe(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 a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{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 a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function ry(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fvt(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 R6={exports:{}},vb={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -914,7 +914,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
914
914
  monaco.config({ paths: { vs: '...' } })
915
915
 
916
916
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
917
- `},hz=V7e(Y7e)(oee),X7e={config:G7e},J7e=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(s){return n.reduceRight(function(a,o){return o(a)},s)}};function lee(e,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&e[n]&&Object.assign(r[n],lee(e[n],r[n]))}),cz(cz({},e),r)}var Z7e={type:"cancelation",msg:"operation is manually canceled"};function XT(e){var r=!1,n=new Promise(function(i,s){e.then(function(a){return r?s(Z7e):i(a)}),e.catch(s)});return n.cancel=function(){return r=!0},n}var Q7e=["monaco"],eMe=W7e.create({config:U7e,isInitialized:!1,resolve:null,reject:null,monaco:null}),cee=C7e(eMe,2),VS=cee[0],iN=cee[1];function tMe(e){var r=X7e.config(e),n=r.monaco,i=S7e(r,Q7e);iN(function(s){return{config:lee(s.config,i),monaco:n}})}function rMe(){var e=VS(function(r){var n=r.monaco,i=r.isInitialized,s=r.resolve;return{monaco:n,isInitialized:i,resolve:s}});if(!e.isInitialized){if(iN({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),XT(JT);if(window.monaco&&window.monaco.editor)return uee(window.monaco),e.resolve(window.monaco),XT(JT);J7e(nMe,sMe)(aMe)}return XT(JT)}function nMe(e){return document.body.appendChild(e)}function iMe(e){var r=document.createElement("script");return e&&(r.src=e),r}function sMe(e){var r=VS(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),n=iMe("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=r.reject,n}function aMe(){var e=VS(function(n){var i=n.config,s=n.resolve,a=n.reject;return{config:i,resolve:s,reject:a}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(n){var i=n.m||n;uee(i),e.resolve(i)},function(n){e.reject(n)})}function uee(e){VS().monaco||iN({monaco:e})}function oMe(){return VS(function(e){var r=e.monaco;return r})}var JT=new Promise(function(e,r){return iN({resolve:e,reject:r})}),sN={config:tMe,init:rMe,__getMonacoInstance:oMe};const dee=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),lMe=Object.freeze(Object.defineProperty({__proto__:null,default:dee},Symbol.toStringTag,{value:"Module"})),cMe=["editor theme","vscode theme","monaco theme","workbench colors"],ZT=new Set,Vw="dark-plus",fz=new WeakSet,pz=dee,uMe={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},dMe={base:"vs-dark",inherit:!1,rules:[...fee(pz.tokenColors??[]),...vMe()],colors:{...pee(pz.colors??{}),...uMe}};function hMe(){return cMe}function hee(e){var r,n;(n=(r=e==null?void 0:e.editor)==null?void 0:r.defineTheme)==null||n.call(r,Vw,dMe)}function fMe(e){!e||typeof e!="object"||fz.has(e)||(fz.add(e),Promise.all([Ze(()=>import("./index-CHxDrHq9.js"),[],import.meta.url),Ze(()=>import("./index-ATzvb6a3.js"),[],import.meta.url)]).then(async([{shikiToMonaco:r},{createHighlighter:n}])=>{var l,d,u;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(f=>f.id))??[]);for(const f of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(f)||((d=i==null?void 0:i.register)==null||d.call(i,{id:f}),s.add(f));const a=await n({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});r(a,e),hee(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Vw&&((u=o==null?void 0:o.setTheme)==null||u.call(o,Vw))}).catch(r=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",r)}))}function pMe(e){var o;const r=mMe(e.text),n=pee(r.colors??{}),i=bMe(r,n),s=((o=r.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${NMe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:fee(r.tokenColors??[]),colors:n},cssVariables:xMe(n),rawColors:n,hasInclude:typeof r.include=="string"&&r.include.trim().length>0}}function mMe(e){const r=jMe(CMe(e)),n=JSON.parse(r);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Theme file must contain a JSON object.");return n}function gMe(e,r){var n;!r||!((n=e==null?void 0:e.editor)!=null&&n.defineTheme)||e.editor.defineTheme(r.monacoThemeName,r.monacoThemeData)}function yMe(e){if(typeof document>"u")return;const r=document.documentElement;r.classList.toggle("dark",e.colorMode==="dark"),r.dataset.monacoTheme=e.monacoThemeName;for(const n of ZT)r.style.removeProperty(n);if(ZT.clear(),!!e.theme)for(const[n,i]of Object.entries(e.theme.cssVariables))r.style.setProperty(n,i),ZT.add(n)}function fee(e){var n;const r=[];for(const i of e){const s=i.settings??{},a=_Me(i.scope);if(a.length===0)continue;const o=gz(s.foreground),l=gz(s.background),d=((n=s.fontStyle)==null?void 0:n.trim())||void 0;for(const u of a)r.push({token:u,foreground:o,background:l,fontStyle:d})}return r}function vMe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function xMe(e){const r={},n=ci(e,["editor.background","sideBar.background","panel.background"]),i=ci(e,["editor.foreground","foreground"]),s=ci(e,["sideBar.background","panel.background","editorWidget.background"]),a=ci(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=ci(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=ci(e,["button.background","focusBorder","textLink.foreground"]),d=ci(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Ei(r,"--background",n),Ei(r,"--foreground",i),Ei(r,"--card",s),Ei(r,"--card-foreground",ci(e,["sideBar.foreground","foreground"])??i),Ei(r,"--popover",ci(e,["editorWidget.background","panel.background"])??s),Ei(r,"--popover-foreground",ci(e,["editorWidget.foreground","foreground"])??i),Ei(r,"--primary",l),Ei(r,"--primary-foreground",mz(l)),Ei(r,"--secondary",ci(e,["tab.inactiveBackground","panel.background"])??a),Ei(r,"--secondary-foreground",ci(e,["tab.inactiveForeground","foreground"])??i),Ei(r,"--muted",a),Ei(r,"--muted-foreground",ci(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Ei(r,"--accent",o),Ei(r,"--accent-foreground",ci(e,["list.activeSelectionForeground","foreground"])??i),Ei(r,"--destructive",ci(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Ei(r,"--destructive-foreground",mz(ci(e,["inputValidation.errorBackground","errorForeground"]))),Ei(r,"--border",d),Ei(r,"--input",ci(e,["input.background","editorWidget.background","dropdown.background"])??d),Ei(r,"--ring",ci(e,["focusBorder","button.background","textLink.foreground"])??l),Ei(r,"--scrollbar-track",ci(e,["editor.background","sideBar.background","panel.background"])??n),Ei(r,"--scrollbar-thumb",ci(e,["scrollbarSlider.background","scrollbar.shadow"])),Ei(r,"--scrollbar-thumb-hover",ci(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Ei(r,"--toast-bg",ci(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Ei(r,"--toast-border",ci(e,["notifications.border","widget.border","panel.border"])??d,!0),Ei(r,"--toast-success-accent",ci(e,["testing.iconPassed","terminal.ansiGreen"])),Ei(r,"--toast-info-accent",ci(e,["textLink.foreground","focusBorder"])??l),Ei(r,"--toast-warning-accent",ci(e,["editorWarning.foreground","terminal.ansiYellow"])),Ei(r,"--toast-error-accent",ci(e,["editorError.foreground","terminal.ansiRed"]));const u=ci(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);u&&(r["--tab-bg"]=u);const f=ci(e,["activityBarBadge.background","button.background","focusBorder"]),p=ci(e,["textLink.foreground","terminal.ansiBlue"]),g=ci(e,["editorWarning.foreground","terminal.ansiYellow"]),v=ci(e,["terminal.ansiMagenta","badge.background"]);return f&&(r["--ctx-system"]=f),p&&(r["--ctx-history"]=p),g&&(r["--ctx-tool-results"]=g),v&&(r["--ctx-tools"]=v),r}function Ei(e,r,n,i=!1){if(!n)return;const s=wMe(n,i);s&&(e[r]=s)}function mz(e){const r=E9(e);return r?(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function bMe(e,r){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const n=E9(r["editor.background"]??r["sideBar.background"]??"");return n&&(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"light":"dark"}function pee(e){const r={};for(const[n,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(r[n]=i.trim());return r}function _Me(e){return Array.isArray(e)?e.flatMap(r=>r.split(",")).map(r=>r.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(r=>r.trim()).filter(Boolean)}function gz(e){if(!e)return;const r=e.trim();if(r.startsWith("#"))return mee(r).slice(1)}function ci(e,r){for(const n of r){const i=e[n];if(typeof i=="string"&&i.trim())return i.trim()}return null}function wMe(e,r=!1){const n=E9(e);if(!n)return null;const i=n.r/255,s=n.g/255,a=n.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),d=o-l,u=(o+l)/2;let f=0;d!==0&&(o===i?f=(s-a)/d%6:o===s?f=(a-i)/d+2:f=(i-s)/d+4,f*=60),f<0&&(f+=360);const p=d===0?0:d/(1-Math.abs(2*u-1)),g=`${Math.round(f)} ${Math.round(p*100)}% ${Math.round(u*100)}%`;return r&&n.a<1?`${g} / ${Number(n.a.toFixed(3))}`:g}function E9(e){if(!e)return null;const r=e.trim();if(!r)return null;if(r.startsWith("#"))return SMe(r);const n=r.match(/^rgba?\(([^)]+)\)$/i);if(!n)return null;const i=n[1].split(",").map(d=>d.trim());if(i.length<3)return null;const s=QT(i[0]),a=QT(i[1]),o=QT(i[2]),l=i[3]==null?1:kMe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function SMe(e){const r=mee(e).slice(1);return r.length===6?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:1}:r.length===8?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:Number.parseInt(r.slice(6,8),16)/255}:null}function QT(e){if(e.endsWith("%")){const n=Number.parseFloat(e.slice(0,-1));return Number.isFinite(n)?yz(Math.round(n/100*255)):null}const r=Number.parseFloat(e);return Number.isFinite(r)?yz(Math.round(r)):null}function kMe(e){const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r)):null}function yz(e){return Math.max(0,Math.min(255,e))}function mee(e){const r=e.trim().slice(1);return r.length===3||r.length===4?`#${r.split("").map(n=>`${n}${n}`).join("").toLowerCase()}`:`#${r.toLowerCase()}`}function CMe(e){let r="",n=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],d=e[o+1];if(i){l===`
917
+ `},hz=V7e(Y7e)(oee),X7e={config:G7e},J7e=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(s){return n.reduceRight(function(a,o){return o(a)},s)}};function lee(e,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&e[n]&&Object.assign(r[n],lee(e[n],r[n]))}),cz(cz({},e),r)}var Z7e={type:"cancelation",msg:"operation is manually canceled"};function XT(e){var r=!1,n=new Promise(function(i,s){e.then(function(a){return r?s(Z7e):i(a)}),e.catch(s)});return n.cancel=function(){return r=!0},n}var Q7e=["monaco"],eMe=W7e.create({config:U7e,isInitialized:!1,resolve:null,reject:null,monaco:null}),cee=C7e(eMe,2),VS=cee[0],iN=cee[1];function tMe(e){var r=X7e.config(e),n=r.monaco,i=S7e(r,Q7e);iN(function(s){return{config:lee(s.config,i),monaco:n}})}function rMe(){var e=VS(function(r){var n=r.monaco,i=r.isInitialized,s=r.resolve;return{monaco:n,isInitialized:i,resolve:s}});if(!e.isInitialized){if(iN({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),XT(JT);if(window.monaco&&window.monaco.editor)return uee(window.monaco),e.resolve(window.monaco),XT(JT);J7e(nMe,sMe)(aMe)}return XT(JT)}function nMe(e){return document.body.appendChild(e)}function iMe(e){var r=document.createElement("script");return e&&(r.src=e),r}function sMe(e){var r=VS(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),n=iMe("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=r.reject,n}function aMe(){var e=VS(function(n){var i=n.config,s=n.resolve,a=n.reject;return{config:i,resolve:s,reject:a}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(n){var i=n.m||n;uee(i),e.resolve(i)},function(n){e.reject(n)})}function uee(e){VS().monaco||iN({monaco:e})}function oMe(){return VS(function(e){var r=e.monaco;return r})}var JT=new Promise(function(e,r){return iN({resolve:e,reject:r})}),sN={config:tMe,init:rMe,__getMonacoInstance:oMe};const dee=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),lMe=Object.freeze(Object.defineProperty({__proto__:null,default:dee},Symbol.toStringTag,{value:"Module"})),cMe=["editor theme","vscode theme","monaco theme","workbench colors"],ZT=new Set,Vw="dark-plus",fz=new WeakSet,pz=dee,uMe={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},dMe={base:"vs-dark",inherit:!1,rules:[...fee(pz.tokenColors??[]),...vMe()],colors:{...pee(pz.colors??{}),...uMe}};function hMe(){return cMe}function hee(e){var r,n;(n=(r=e==null?void 0:e.editor)==null?void 0:r.defineTheme)==null||n.call(r,Vw,dMe)}function fMe(e){!e||typeof e!="object"||fz.has(e)||(fz.add(e),Promise.all([Ze(()=>import("./index-vH_IM2Q6.js"),[],import.meta.url),Ze(()=>import("./index-Bd1Lr-k3.js"),[],import.meta.url)]).then(async([{shikiToMonaco:r},{createHighlighter:n}])=>{var l,d,u;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(f=>f.id))??[]);for(const f of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(f)||((d=i==null?void 0:i.register)==null||d.call(i,{id:f}),s.add(f));const a=await n({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});r(a,e),hee(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Vw&&((u=o==null?void 0:o.setTheme)==null||u.call(o,Vw))}).catch(r=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",r)}))}function pMe(e){var o;const r=mMe(e.text),n=pee(r.colors??{}),i=bMe(r,n),s=((o=r.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${NMe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:fee(r.tokenColors??[]),colors:n},cssVariables:xMe(n),rawColors:n,hasInclude:typeof r.include=="string"&&r.include.trim().length>0}}function mMe(e){const r=jMe(CMe(e)),n=JSON.parse(r);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Theme file must contain a JSON object.");return n}function gMe(e,r){var n;!r||!((n=e==null?void 0:e.editor)!=null&&n.defineTheme)||e.editor.defineTheme(r.monacoThemeName,r.monacoThemeData)}function yMe(e){if(typeof document>"u")return;const r=document.documentElement;r.classList.toggle("dark",e.colorMode==="dark"),r.dataset.monacoTheme=e.monacoThemeName;for(const n of ZT)r.style.removeProperty(n);if(ZT.clear(),!!e.theme)for(const[n,i]of Object.entries(e.theme.cssVariables))r.style.setProperty(n,i),ZT.add(n)}function fee(e){var n;const r=[];for(const i of e){const s=i.settings??{},a=_Me(i.scope);if(a.length===0)continue;const o=gz(s.foreground),l=gz(s.background),d=((n=s.fontStyle)==null?void 0:n.trim())||void 0;for(const u of a)r.push({token:u,foreground:o,background:l,fontStyle:d})}return r}function vMe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function xMe(e){const r={},n=ci(e,["editor.background","sideBar.background","panel.background"]),i=ci(e,["editor.foreground","foreground"]),s=ci(e,["sideBar.background","panel.background","editorWidget.background"]),a=ci(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=ci(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=ci(e,["button.background","focusBorder","textLink.foreground"]),d=ci(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Ei(r,"--background",n),Ei(r,"--foreground",i),Ei(r,"--card",s),Ei(r,"--card-foreground",ci(e,["sideBar.foreground","foreground"])??i),Ei(r,"--popover",ci(e,["editorWidget.background","panel.background"])??s),Ei(r,"--popover-foreground",ci(e,["editorWidget.foreground","foreground"])??i),Ei(r,"--primary",l),Ei(r,"--primary-foreground",mz(l)),Ei(r,"--secondary",ci(e,["tab.inactiveBackground","panel.background"])??a),Ei(r,"--secondary-foreground",ci(e,["tab.inactiveForeground","foreground"])??i),Ei(r,"--muted",a),Ei(r,"--muted-foreground",ci(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Ei(r,"--accent",o),Ei(r,"--accent-foreground",ci(e,["list.activeSelectionForeground","foreground"])??i),Ei(r,"--destructive",ci(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Ei(r,"--destructive-foreground",mz(ci(e,["inputValidation.errorBackground","errorForeground"]))),Ei(r,"--border",d),Ei(r,"--input",ci(e,["input.background","editorWidget.background","dropdown.background"])??d),Ei(r,"--ring",ci(e,["focusBorder","button.background","textLink.foreground"])??l),Ei(r,"--scrollbar-track",ci(e,["editor.background","sideBar.background","panel.background"])??n),Ei(r,"--scrollbar-thumb",ci(e,["scrollbarSlider.background","scrollbar.shadow"])),Ei(r,"--scrollbar-thumb-hover",ci(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Ei(r,"--toast-bg",ci(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Ei(r,"--toast-border",ci(e,["notifications.border","widget.border","panel.border"])??d,!0),Ei(r,"--toast-success-accent",ci(e,["testing.iconPassed","terminal.ansiGreen"])),Ei(r,"--toast-info-accent",ci(e,["textLink.foreground","focusBorder"])??l),Ei(r,"--toast-warning-accent",ci(e,["editorWarning.foreground","terminal.ansiYellow"])),Ei(r,"--toast-error-accent",ci(e,["editorError.foreground","terminal.ansiRed"]));const u=ci(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);u&&(r["--tab-bg"]=u);const f=ci(e,["activityBarBadge.background","button.background","focusBorder"]),p=ci(e,["textLink.foreground","terminal.ansiBlue"]),g=ci(e,["editorWarning.foreground","terminal.ansiYellow"]),v=ci(e,["terminal.ansiMagenta","badge.background"]);return f&&(r["--ctx-system"]=f),p&&(r["--ctx-history"]=p),g&&(r["--ctx-tool-results"]=g),v&&(r["--ctx-tools"]=v),r}function Ei(e,r,n,i=!1){if(!n)return;const s=wMe(n,i);s&&(e[r]=s)}function mz(e){const r=E9(e);return r?(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function bMe(e,r){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const n=E9(r["editor.background"]??r["sideBar.background"]??"");return n&&(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"light":"dark"}function pee(e){const r={};for(const[n,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(r[n]=i.trim());return r}function _Me(e){return Array.isArray(e)?e.flatMap(r=>r.split(",")).map(r=>r.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(r=>r.trim()).filter(Boolean)}function gz(e){if(!e)return;const r=e.trim();if(r.startsWith("#"))return mee(r).slice(1)}function ci(e,r){for(const n of r){const i=e[n];if(typeof i=="string"&&i.trim())return i.trim()}return null}function wMe(e,r=!1){const n=E9(e);if(!n)return null;const i=n.r/255,s=n.g/255,a=n.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),d=o-l,u=(o+l)/2;let f=0;d!==0&&(o===i?f=(s-a)/d%6:o===s?f=(a-i)/d+2:f=(i-s)/d+4,f*=60),f<0&&(f+=360);const p=d===0?0:d/(1-Math.abs(2*u-1)),g=`${Math.round(f)} ${Math.round(p*100)}% ${Math.round(u*100)}%`;return r&&n.a<1?`${g} / ${Number(n.a.toFixed(3))}`:g}function E9(e){if(!e)return null;const r=e.trim();if(!r)return null;if(r.startsWith("#"))return SMe(r);const n=r.match(/^rgba?\(([^)]+)\)$/i);if(!n)return null;const i=n[1].split(",").map(d=>d.trim());if(i.length<3)return null;const s=QT(i[0]),a=QT(i[1]),o=QT(i[2]),l=i[3]==null?1:kMe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function SMe(e){const r=mee(e).slice(1);return r.length===6?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:1}:r.length===8?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:Number.parseInt(r.slice(6,8),16)/255}:null}function QT(e){if(e.endsWith("%")){const n=Number.parseFloat(e.slice(0,-1));return Number.isFinite(n)?yz(Math.round(n/100*255)):null}const r=Number.parseFloat(e);return Number.isFinite(r)?yz(Math.round(r)):null}function kMe(e){const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r)):null}function yz(e){return Math.max(0,Math.min(255,e))}function mee(e){const r=e.trim().slice(1);return r.length===3||r.length===4?`#${r.split("").map(n=>`${n}${n}`).join("").toLowerCase()}`:`#${r.toLowerCase()}`}function CMe(e){let r="",n=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],d=e[o+1];if(i){l===`
918
918
  `&&(i=!1,r+=l);continue}if(s){l==="*"&&d==="/"&&(s=!1,o+=1);continue}if(n){r+=l,a?a=!1:l==="\\"?a=!0:l==='"'&&(n=!1);continue}if(l==='"'){n=!0,r+=l;continue}if(l==="/"&&d==="/"){i=!0,o+=1;continue}if(l==="/"&&d==="*"){s=!0,o+=1;continue}r+=l}return r}function jMe(e){return e.replace(/,\s*([}\]])/g,"$1")}function NMe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"theme"}function vz(){if(typeof document>"u")return"vs";const e=document.documentElement;return e.dataset.monacoTheme??(e.classList.contains("dark")?Vw:"vs")}function qS(){const[e,r]=y.useState(vz);return y.useEffect(()=>{if(typeof document>"u")return;const n=document.documentElement,i=()=>r(vz());i();const s=new MutationObserver(i);return s.observe(n,{attributes:!0,attributeFilter:["class","data-monaco-theme"]}),()=>s.disconnect()},[]),e}const A9="jait:vscode-theme-store",V3=new Set;let Xd=yee(),xz=!1;function gee(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function yee(){const e=gee();if(!e)return{importedThemes:[],activeThemeId:null};let r=null;try{r=e.getItem(A9)}catch{return{importedThemes:[],activeThemeId:null}}if(!r)return{importedThemes:[],activeThemeId:null};try{const n=JSON.parse(r),i=Array.isArray(n.importedThemes)?n.importedThemes.filter(a=>!!(a&&typeof a.id=="string"&&typeof a.monacoThemeName=="string")):[],s=typeof n.activeThemeId=="string"?n.activeThemeId:null;return{importedThemes:i,activeThemeId:i.some(a=>a.id===s)?s:null}}catch{return{importedThemes:[],activeThemeId:null}}}function O9(e){Xd=e;const r=gee();if(r)try{r.setItem(A9,JSON.stringify(e))}catch{}for(const n of V3)n()}function TMe(e){return!xz&&typeof window<"u"&&(xz=!0,window.addEventListener("storage",r=>{if(r.key===A9){Xd=yee();for(const n of V3)n()}})),V3.add(e),()=>V3.delete(e)}function bz(){return Xd}function vee(){const e=y.useSyncExternalStore(TMe,bz,bz);return{...e,activeTheme:e.importedThemes.find(r=>r.id===e.activeThemeId)??null}}function xee(){return Xd.importedThemes.find(e=>e.id===Xd.activeThemeId)??null}function EMe(e,r){const n=`${Date.now().toString(36)}-${MMe(e+r)}`,i=pMe({id:n,sourceLabel:e,text:r});return O9({importedThemes:[...Xd.importedThemes.filter(s=>s.id!==n),i],activeThemeId:n}),i}function Z5(e){O9({...Xd,activeThemeId:e&&Xd.importedThemes.some(r=>r.id===e)?e:null})}function AMe(e){O9({importedThemes:Xd.importedThemes.filter(r=>r.id!==e),activeThemeId:Xd.activeThemeId===e?null:Xd.activeThemeId})}function OMe(e){hee(e);const r=xee();r?gMe(e,r):fMe(e)}function cc(e,r){var n,i;OMe(e),r&&((i=(n=e==null?void 0:e.editor)==null?void 0:n.setTheme)==null||i.call(n,r))}function MMe(e){let r=0;for(let n=0;n<e.length;n+=1)r=(r<<5)-r+e.charCodeAt(n)|0;return Math.abs(r).toString(36)}function S1(e,r){return Math.max(1,e||r||1)}function qw({original:e,modified:r,language:n,modelKey:i,className:s,editorClassName:a,renderSideBySide:o=!1,emptyMessage:l="Files are identical.",options:d}){const u=y.useRef(null),f=y.useRef(null),p=y.useRef(null),g=y.useRef(null),v=y.useRef({original:null,modified:null}),[b,_]=y.useState(!1),[k,w]=y.useState([]),[C,j]=y.useState(0),A=qS(),N=y.useRef(A);y.useEffect(()=>{N.current=A},[A]);const E=y.useMemo(()=>`inmemory://jait-diff/${encodeURIComponent(i??`${n}:${e.length}:${r.length}`)}`,[n,i,r.length,e.length]),P=y.useMemo(()=>({readOnly:!0,renderSideBySide:o,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,fontSize:13,automaticLayout:!0,scrollBeyondLastLine:!1,renderOverviewRuler:!0,ignoreTrimWhitespace:!1,...d}),[d,o]),H=y.useCallback(()=>{var z;const W=f.current;if(!W)return;const B=((z=W.getLineChanges)==null?void 0:z.call(W))??[];w(B.map(O=>({originalStartLineNumber:O.originalStartLineNumber,originalEndLineNumber:O.originalEndLineNumber,modifiedStartLineNumber:O.modifiedStartLineNumber,modifiedEndLineNumber:O.modifiedEndLineNumber})))},[]);y.useEffect(()=>{let W=!1;const B=sN.init();return B.then(z=>{if(W||!u.current)return;p.current=z,cc(z,N.current);const O=z.editor.createDiffEditor(u.current,{automaticLayout:!0,...P});f.current=O,g.current=O.onDidUpdateDiff(()=>H()),_(!0),H()}).catch(z=>{!W&&(z==null?void 0:z.type)!=="cancelation"&&console.error("Monaco initialization: error:",z)}),()=>{var $,R,I,U,Y,F;W=!0,($=g.current)==null||$.dispose(),g.current=null;const z=f.current,O=v.current;try{z==null||z.setModel(null)}catch{}(R=z==null?void 0:z.dispose)==null||R.call(z),(U=(I=O.original)==null?void 0:I.dispose)==null||U.call(I),(F=(Y=O.modified)==null?void 0:Y.dispose)==null||F.call(Y),v.current={original:null,modified:null},f.current=null,p.current=null,_(!1),B.cancel()}},[H]),y.useEffect(()=>{j(0)},[e,r,n]),y.useEffect(()=>{var U,Y;const W=f.current,B=p.current;if(!b||!W||!B)return;const z=v.current,O=B.Uri.parse(`${E}.original`),$=B.Uri.parse(`${E}.modified`);(U=B.editor.getModel(O))==null||U.dispose(),(Y=B.editor.getModel($))==null||Y.dispose();const R=B.editor.createModel(e,n,O),I=B.editor.createModel(r,n,$);return W.setModel({original:R,modified:I}),v.current={original:R,modified:I},H(),()=>{var F,V,Q,q;try{W.setModel(null)}catch{}(V=(F=z.original)==null?void 0:F.dispose)==null||V.call(F),(q=(Q=z.modified)==null?void 0:Q.dispose)==null||q.call(Q),R.dispose(),I.dispose(),(v.current.original===R||v.current.modified===I)&&(v.current={original:null,modified:null})}},[b,n,E,r,e,H]),y.useEffect(()=>{const W=p.current;W&&cc(W,A)},[A]),y.useEffect(()=>{var W,B;(B=(W=f.current)==null?void 0:W.updateOptions)==null||B.call(W,P)},[P]),y.useEffect(()=>{k.length!==0&&j(W=>Math.min(W,k.length-1))},[k]),y.useEffect(()=>{const W=f.current;if(!W||k.length===0)return;const B=k[C];if(!B)return;const z=W.getModifiedEditor(),O=W.getOriginalEditor();try{B.modifiedStartLineNumber>0||B.modifiedEndLineNumber>0?z.revealLineInCenter(S1(B.modifiedStartLineNumber,B.modifiedEndLineNumber)):O.revealLineInCenter(S1(B.originalStartLineNumber,B.originalEndLineNumber))}catch{}},[C,k]),y.useEffect(()=>{const W=f.current,B=p.current;if(!W||!B||k.length===0)return;const z=k[C];if(!z)return;const O=[];(z.originalStartLineNumber>0||z.originalEndLineNumber>0)&&O.push({editor:W.getOriginalEditor(),range:new B.Range(S1(z.originalStartLineNumber,z.originalEndLineNumber),1,S1(z.originalEndLineNumber,z.originalStartLineNumber),1)}),(z.modifiedStartLineNumber>0||z.modifiedEndLineNumber>0)&&O.push({editor:W.getModifiedEditor(),range:new B.Range(S1(z.modifiedStartLineNumber,z.modifiedEndLineNumber),1,S1(z.modifiedEndLineNumber,z.modifiedStartLineNumber),1)});const $=O.map(({editor:R,range:I})=>R.deltaDecorations([],[{range:I,options:{isWholeLine:!0,className:"diff-change-active"}}]));return()=>{var R;for(let I=0;I<O.length;I++)try{(R=O[I])==null||R.editor.deltaDecorations($[I]??[],[])}catch{}}},[C,k]);const G=y.useCallback(()=>{j(W=>Math.max(W-1,0))},[]),D=y.useCallback(()=>{j(W=>Math.min(W+1,k.length-1))},[k.length]);return c.jsxs("div",{className:Te("relative min-h-0",s),children:[c.jsx("div",{className:Te("h-full min-h-0",a),children:c.jsx("div",{ref:u,className:"h-full min-h-0"})}),!b&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted-foreground",children:"Loading diff..."}),k.length>1&&c.jsxs("div",{className:"absolute right-3 top-1/2 z-10 flex -translate-y-1/2 flex-col gap-1.5",children:[c.jsx(we,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:G,disabled:C===0,title:"Previous change",children:c.jsx(sR,{className:"h-5 w-5"})}),c.jsxs("span",{className:"text-center font-medium tabular-nums text-2xs text-muted-foreground",children:[C+1,"/",k.length]}),c.jsx(we,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:D,disabled:C===k.length-1,title:"Next change",children:c.jsx(Rl,{className:"h-5 w-5"})})]}),k.length===0&&e===r&&b&&c.jsx("div",{className:"pointer-events-none absolute inset-x-3 bottom-3 rounded-md border bg-background/90 px-3 py-2 text-center text-xs text-muted-foreground shadow-sm",children:l}),c.jsx("style",{children:`
919
919
  .diff-change-active { outline: 1px solid rgba(99, 102, 241, 0.5); outline-offset: -1px; }
920
920
  `})]})}var RMe={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},eE=RMe,PMe={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},LMe=PMe;function $Me({children:e}){return It.createElement("div",{style:LMe.container},e)}var DMe=$Me,IMe=DMe;function BMe({width:e,height:r,isEditorReady:n,loading:i,_ref:s,className:a,wrapperProps:o}){return It.createElement("section",{style:{...eE.wrapper,width:e,height:r},...o},!n&&It.createElement(IMe,null,i),It.createElement("div",{ref:s,style:{...eE.fullWidth,...!n&&eE.hide},className:a}))}var zMe=BMe,bee=y.memo(zMe);function FMe(e){y.useEffect(e,[])}var _ee=FMe;function HMe(e,r,n=!0){let i=y.useRef(!0);y.useEffect(i.current||!n?()=>{i.current=!1}:e,r)}var Gc=HMe;function Y_(){}function U1(e,r,n,i){return WMe(e,i)||UMe(e,r,n,i)}function WMe(e,r){return e.editor.getModel(wee(e,r))}function UMe(e,r,n,i){return e.editor.createModel(r,n,i?wee(e,i):void 0)}function wee(e,r){return e.Uri.parse(r)}function VMe({original:e,modified:r,language:n,originalLanguage:i,modifiedLanguage:s,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:d=!1,theme:u="light",loading:f="Loading...",options:p={},height:g="100%",width:v="100%",className:b,wrapperProps:_={},beforeMount:k=Y_,onMount:w=Y_}){let[C,j]=y.useState(!1),[A,N]=y.useState(!0),E=y.useRef(null),P=y.useRef(null),H=y.useRef(null),G=y.useRef(w),D=y.useRef(k),W=y.useRef(!1);_ee(()=>{let $=sN.init();return $.then(R=>(P.current=R)&&N(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>E.current?O():$.cancel()}),Gc(()=>{if(E.current&&P.current){let $=E.current.getOriginalEditor(),R=U1(P.current,e||"",i||n||"text",a||"");R!==$.getModel()&&$.setModel(R)}},[a],C),Gc(()=>{if(E.current&&P.current){let $=E.current.getModifiedEditor(),R=U1(P.current,r||"",s||n||"text",o||"");R!==$.getModel()&&$.setModel(R)}},[o],C),Gc(()=>{let $=E.current.getModifiedEditor();$.getOption(P.current.editor.EditorOption.readOnly)?$.setValue(r||""):r!==$.getValue()&&($.executeEdits("",[{range:$.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),$.pushUndoStop())},[r],C),Gc(()=>{var $,R;(R=($=E.current)==null?void 0:$.getModel())==null||R.original.setValue(e||"")},[e],C),Gc(()=>{let{original:$,modified:R}=E.current.getModel();P.current.editor.setModelLanguage($,i||n||"text"),P.current.editor.setModelLanguage(R,s||n||"text")},[n,i,s],C),Gc(()=>{var $;($=P.current)==null||$.editor.setTheme(u)},[u],C),Gc(()=>{var $;($=E.current)==null||$.updateOptions(p)},[p],C);let B=y.useCallback(()=>{var I;if(!P.current)return;D.current(P.current);let $=U1(P.current,e||"",i||n||"text",a||""),R=U1(P.current,r||"",s||n||"text",o||"");(I=E.current)==null||I.setModel({original:$,modified:R})},[n,r,s,e,i,a,o]),z=y.useCallback(()=>{var $;!W.current&&H.current&&(E.current=P.current.editor.createDiffEditor(H.current,{automaticLayout:!0,...p}),B(),($=P.current)==null||$.editor.setTheme(u),j(!0),W.current=!0)},[p,u,B]);y.useEffect(()=>{C&&G.current(E.current,P.current)},[C]),y.useEffect(()=>{!A&&!C&&z()},[A,C,z]);function O(){var R,I,U,Y;let $=(R=E.current)==null?void 0:R.getModel();l||((I=$==null?void 0:$.original)==null||I.dispose()),d||((U=$==null?void 0:$.modified)==null||U.dispose()),(Y=E.current)==null||Y.dispose()}return It.createElement(bee,{width:v,height:g,isEditorReady:C,loading:f,_ref:H,className:b,wrapperProps:_})}var qMe=VMe,GMe=y.memo(qMe);function KMe(e){let r=y.useRef();return y.useEffect(()=>{r.current=e},[e]),r.current}var YMe=KMe,$C=new Map;function XMe({defaultValue:e,defaultLanguage:r,defaultPath:n,value:i,language:s,path:a,theme:o="light",line:l,loading:d="Loading...",options:u={},overrideServices:f={},saveViewState:p=!0,keepCurrentModel:g=!1,width:v="100%",height:b="100%",className:_,wrapperProps:k={},beforeMount:w=Y_,onMount:C=Y_,onChange:j,onValidate:A=Y_}){let[N,E]=y.useState(!1),[P,H]=y.useState(!0),G=y.useRef(null),D=y.useRef(null),W=y.useRef(null),B=y.useRef(C),z=y.useRef(w),O=y.useRef(),$=y.useRef(i),R=YMe(a),I=y.useRef(!1),U=y.useRef(!1);_ee(()=>{let V=sN.init();return V.then(Q=>(G.current=Q)&&H(!1)).catch(Q=>(Q==null?void 0:Q.type)!=="cancelation"&&console.error("Monaco initialization: error:",Q)),()=>D.current?F():V.cancel()}),Gc(()=>{var Q,q,te,ne;let V=U1(G.current,e||i||"",r||s||"",a||n||"");V!==((Q=D.current)==null?void 0:Q.getModel())&&(p&&$C.set(R,(q=D.current)==null?void 0:q.saveViewState()),(te=D.current)==null||te.setModel(V),p&&((ne=D.current)==null||ne.restoreViewState($C.get(a))))},[a],N),Gc(()=>{var V;(V=D.current)==null||V.updateOptions(u)},[u],N),Gc(()=>{!D.current||i===void 0||(D.current.getOption(G.current.editor.EditorOption.readOnly)?D.current.setValue(i):i!==D.current.getValue()&&(U.current=!0,D.current.executeEdits("",[{range:D.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),D.current.pushUndoStop(),U.current=!1))},[i],N),Gc(()=>{var Q,q;let V=(Q=D.current)==null?void 0:Q.getModel();V&&s&&((q=G.current)==null||q.editor.setModelLanguage(V,s))},[s],N),Gc(()=>{var V;l!==void 0&&((V=D.current)==null||V.revealLine(l))},[l],N),Gc(()=>{var V;(V=G.current)==null||V.editor.setTheme(o)},[o],N);let Y=y.useCallback(()=>{var V;if(!(!W.current||!G.current)&&!I.current){z.current(G.current);let Q=a||n,q=U1(G.current,i||e||"",r||s||"",Q||"");D.current=(V=G.current)==null?void 0:V.editor.create(W.current,{model:q,automaticLayout:!0,...u},f),p&&D.current.restoreViewState($C.get(Q)),G.current.editor.setTheme(o),l!==void 0&&D.current.revealLine(l),E(!0),I.current=!0}},[e,r,n,i,s,a,u,f,p,o,l]);y.useEffect(()=>{N&&B.current(D.current,G.current)},[N]),y.useEffect(()=>{!P&&!N&&Y()},[P,N,Y]),$.current=i,y.useEffect(()=>{var V,Q;N&&j&&((V=O.current)==null||V.dispose(),O.current=(Q=D.current)==null?void 0:Q.onDidChangeModelContent(q=>{U.current||j(D.current.getValue(),q)}))},[N,j]),y.useEffect(()=>{if(N){let V=G.current.editor.onDidChangeMarkers(Q=>{var te;let q=(te=D.current.getModel())==null?void 0:te.uri;if(q&&Q.find(ne=>ne.path===q.path)){let ne=G.current.editor.getModelMarkers({resource:q});A==null||A(ne)}});return()=>{V==null||V.dispose()}}return()=>{}},[N,A]);function F(){var V,Q;(V=O.current)==null||V.dispose(),g?p&&$C.set(a,D.current.saveViewState()):(Q=D.current.getModel())==null||Q.dispose(),D.current.dispose()}return It.createElement(bee,{width:v,height:b,isEditorReady:N,loading:d,_ref:W,className:_,wrapperProps:k})}var JMe=XMe,ZMe=y.memo(JMe),GS=ZMe;const QMe=Zn();function eRe(){return T0()}function tRe(e=!1){const r={};e&&(r["Content-Type"]="application/json");const n=eRe();return n&&(r.Authorization=`Bearer ${n}`),r}async function Ji(e,r){const n=await fetch(`${QMe}/api/git/${e}`,{method:"POST",headers:tRe(!0),body:JSON.stringify(r)});if(!n.ok){const i=await n.json().catch(()=>({}));throw new Error(i.error||`Git ${e} failed: ${n.statusText}`)}return n.json()}const Ds={status(e,r){return Ji("status",{cwd:e,...r?{branch:r}:{}})},listBranches(e){return Ji("branches",{cwd:e})},pull(e){return Ji("pull",{cwd:e})},sync(e){return Ji("sync",{cwd:e})},fetch(e,r=!1){return Ji("fetch",{cwd:e,all:r})},runStackedAction(e,r,n){return Ji("run-stacked-action",{cwd:e,action:r,...n!=null&&n.commitMessage?{commitMessage:n.commitMessage}:{},...n!=null&&n.featureBranch?{featureBranch:!0}:{},...n!=null&&n.baseBranch?{baseBranch:n.baseBranch}:{}})},checkout(e,r){return Ji("checkout",{cwd:e,branch:r})},createBranch(e,r,n){return Ji("create-branch",{cwd:e,branch:r,baseBranch:n})},discard(e,r){return Ji("discard",{cwd:e,paths:r})},stage(e,r){return Ji("stage",{cwd:e,paths:r})},unstage(e,r){return Ji("unstage",{cwd:e,paths:r})},init(e){return Ji("init",{cwd:e})},diff(e){return Ji("diff",{cwd:e})},diffStats(e,r,n){return Ji("diff-stats",{cwd:e,...r?{baseBranch:r}:{},...n?{branch:n}:{}})},fileDiffs(e,r,n){return Ji("file-diffs",{cwd:e,...r?{baseBranch:r}:{},...n?{branch:n}:{}}).then(i=>i.files)},createWorktree(e,r,n,i){return Ji("create-worktree",{cwd:e,baseBranch:r,newBranch:n,...i?{path:i}:{}})},removeWorktree(e,r,n=!1){return Ji("remove-worktree",{cwd:e,path:r,force:n})},ghStatus(e){return Ji("gh-status",{...e?{cwd:e}:{}})},ghAuth(e,r){return Ji("gh-auth",{token:e,...r?{cwd:r}:{}})},forgeStatus(e,r){return Ji("forge-status",{...e?{cwd:e}:{},...r?{remoteUrl:r}:{}})},forgeAuth(e,r,n){return Ji("forge-auth",{token:e,...r?{cwd:r}:{},...n?{remoteUrl:n}:{}})},forgePrChecks(e,r,n){return Ji("forge-pr-checks",{cwd:e,branch:r,...n?{remoteUrl:n}:{}})},identity(e){return Ji("identity",{cwd:e})},setIdentity(e,r,n){return Ji("identity",{cwd:e,name:r,email:n})},prChecks(e,r){return Ji("pr-checks",{cwd:e,branch:r})},generateCommitMessage(e,r,n){return Ji("generate-commit-message",{cwd:e,...r?{provider:r}:{},...n?{model:n}:{}})}};var See=Object.defineProperty,X=(e,r)=>See(e,"name",{value:r,configurable:!0}),rRe=(e,r)=>{for(var n in r)See(e,n,{get:r[n],enumerable:!0})},Jf={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},Ot={trace:X((...e)=>{},"trace"),debug:X((...e)=>{},"debug"),info:X((...e)=>{},"info"),warn:X((...e)=>{},"warn"),error:X((...e)=>{},"error"),fatal:X((...e)=>{},"fatal")},M9=X(function(e="fatal"){let r=Jf.fatal;typeof e=="string"?e.toLowerCase()in Jf&&(r=Jf[e]):typeof e=="number"&&(r=e),Ot.trace=()=>{},Ot.debug=()=>{},Ot.info=()=>{},Ot.warn=()=>{},Ot.error=()=>{},Ot.fatal=()=>{},r<=Jf.fatal&&(Ot.fatal=console.error?console.error.bind(console,Ou("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Ou("FATAL"))),r<=Jf.error&&(Ot.error=console.error?console.error.bind(console,Ou("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Ou("ERROR"))),r<=Jf.warn&&(Ot.warn=console.warn?console.warn.bind(console,Ou("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Ou("WARN"))),r<=Jf.info&&(Ot.info=console.info?console.info.bind(console,Ou("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Ou("INFO"))),r<=Jf.debug&&(Ot.debug=console.debug?console.debug.bind(console,Ou("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Ou("DEBUG"))),r<=Jf.trace&&(Ot.trace=console.debug?console.debug.bind(console,Ou("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Ou("TRACE")))},"setLogLevel"),Ou=X(e=>`%c${E8e().format("ss.SSS")} : ${e} : `,"format");const q3={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const r=e/255;return e>.03928?Math.pow((r+.055)/1.055,2.4):r/12.92},hue2rgb:(e,r,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(r-e)*6*n:n<1/2?r:n<2/3?e+(r-e)*(2/3-n)*6:e),hsl2rgb:({h:e,s:r,l:n},i)=>{if(!r)return n*2.55;e/=360,r/=100,n/=100;const s=n<.5?n*(1+r):n+r-n*r,a=2*n-s;switch(i){case"r":return q3.hue2rgb(a,s,e+1/3)*255;case"g":return q3.hue2rgb(a,s,e)*255;case"b":return q3.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:r,b:n},i)=>{e/=255,r/=255,n/=255;const s=Math.max(e,r,n),a=Math.min(e,r,n),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const l=s-a,d=o>.5?l/(2-s-a):l/(s+a);if(i==="s")return d*100;switch(s){case e:return((r-n)/l+(r<n?6:0))*60;case r:return((n-e)/l+2)*60;case n:return((e-r)/l+4)*60;default:return-1}}},nRe={clamp:(e,r,n)=>r>n?Math.min(r,Math.max(n,e)):Math.min(n,Math.max(r,e)),round:e=>Math.round(e*1e10)/1e10},iRe={dec2hex:e=>{const r=Math.round(e).toString(16);return r.length>1?r:`0${r}`}},pn={channel:q3,lang:nRe,unit:iRe},Pm={};for(let e=0;e<=255;e++)Pm[e]=pn.unit.dec2hex(e);const Jo={ALL:0,RGB:1,HSL:2};class sRe{constructor(){this.type=Jo.ALL}get(){return this.type}set(r){if(this.type&&this.type!==r)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=r}reset(){this.type=Jo.ALL}is(r){return this.type===r}}class aRe{constructor(r,n){this.color=n,this.changed=!1,this.data=r,this.type=new sRe}set(r,n){return this.color=n,this.changed=!1,this.data=r,this.type.type=Jo.ALL,this}_ensureHSL(){const r=this.data,{h:n,s:i,l:s}=r;n===void 0&&(r.h=pn.channel.rgb2hsl(r,"h")),i===void 0&&(r.s=pn.channel.rgb2hsl(r,"s")),s===void 0&&(r.l=pn.channel.rgb2hsl(r,"l"))}_ensureRGB(){const r=this.data,{r:n,g:i,b:s}=r;n===void 0&&(r.r=pn.channel.hsl2rgb(r,"r")),i===void 0&&(r.g=pn.channel.hsl2rgb(r,"g")),s===void 0&&(r.b=pn.channel.hsl2rgb(r,"b"))}get r(){const r=this.data,n=r.r;return!this.type.is(Jo.HSL)&&n!==void 0?n:(this._ensureHSL(),pn.channel.hsl2rgb(r,"r"))}get g(){const r=this.data,n=r.g;return!this.type.is(Jo.HSL)&&n!==void 0?n:(this._ensureHSL(),pn.channel.hsl2rgb(r,"g"))}get b(){const r=this.data,n=r.b;return!this.type.is(Jo.HSL)&&n!==void 0?n:(this._ensureHSL(),pn.channel.hsl2rgb(r,"b"))}get h(){const r=this.data,n=r.h;return!this.type.is(Jo.RGB)&&n!==void 0?n:(this._ensureRGB(),pn.channel.rgb2hsl(r,"h"))}get s(){const r=this.data,n=r.s;return!this.type.is(Jo.RGB)&&n!==void 0?n:(this._ensureRGB(),pn.channel.rgb2hsl(r,"s"))}get l(){const r=this.data,n=r.l;return!this.type.is(Jo.RGB)&&n!==void 0?n:(this._ensureRGB(),pn.channel.rgb2hsl(r,"l"))}get a(){return this.data.a}set r(r){this.type.set(Jo.RGB),this.changed=!0,this.data.r=r}set g(r){this.type.set(Jo.RGB),this.changed=!0,this.data.g=r}set b(r){this.type.set(Jo.RGB),this.changed=!0,this.data.b=r}set h(r){this.type.set(Jo.HSL),this.changed=!0,this.data.h=r}set s(r){this.type.set(Jo.HSL),this.changed=!0,this.data.s=r}set l(r){this.type.set(Jo.HSL),this.changed=!0,this.data.l=r}set a(r){this.changed=!0,this.data.a=r}}const aN=new aRe({r:0,g:0,b:0,a:0},"transparent"),rv={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const r=e.match(rv.re);if(!r)return;const n=r[1],i=parseInt(n,16),s=n.length,a=s%4===0,o=s>4,l=o?1:17,d=o?8:4,u=a?0:-1,f=o?255:15;return aN.set({r:(i>>d*(u+3)&f)*l,g:(i>>d*(u+2)&f)*l,b:(i>>d*(u+1)&f)*l,a:a?(i&f)*l/255:1},e)},stringify:e=>{const{r,g:n,b:i,a:s}=e;return s<1?`#${Pm[Math.round(r)]}${Pm[Math.round(n)]}${Pm[Math.round(i)]}${Pm[Math.round(s*255)]}`:`#${Pm[Math.round(r)]}${Pm[Math.round(n)]}${Pm[Math.round(i)]}`}},x0={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const r=e.match(x0.hueRe);if(r){const[,n,i]=r;switch(i){case"grad":return pn.channel.clamp.h(parseFloat(n)*.9);case"rad":return pn.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return pn.channel.clamp.h(parseFloat(n)*360)}}return pn.channel.clamp.h(parseFloat(e))},parse:e=>{const r=e.charCodeAt(0);if(r!==104&&r!==72)return;const n=e.match(x0.re);if(!n)return;const[,i,s,a,o,l]=n;return aN.set({h:x0._hue2deg(i),s:pn.channel.clamp.s(parseFloat(s)),l:pn.channel.clamp.l(parseFloat(a)),a:o?pn.channel.clamp.a(l?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:r,s:n,l:i,a:s}=e;return s<1?`hsla(${pn.lang.round(r)}, ${pn.lang.round(n)}%, ${pn.lang.round(i)}%, ${s})`:`hsl(${pn.lang.round(r)}, ${pn.lang.round(n)}%, ${pn.lang.round(i)}%)`}},X_={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const r=X_.colors[e];if(r)return rv.parse(r)},stringify:e=>{const r=rv.stringify(e);for(const n in X_.colors)if(X_.colors[n]===r)return n}},w_={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const r=e.charCodeAt(0);if(r!==114&&r!==82)return;const n=e.match(w_.re);if(!n)return;const[,i,s,a,o,l,d,u,f]=n;return aN.set({r:pn.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:pn.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:pn.channel.clamp.b(d?parseFloat(l)*2.55:parseFloat(l)),a:u?pn.channel.clamp.a(f?parseFloat(u)/100:parseFloat(u)):1},e)},stringify:e=>{const{r,g:n,b:i,a:s}=e;return s<1?`rgba(${pn.lang.round(r)}, ${pn.lang.round(n)}, ${pn.lang.round(i)}, ${pn.lang.round(s)})`:`rgb(${pn.lang.round(r)}, ${pn.lang.round(n)}, ${pn.lang.round(i)})`}},sf={format:{keyword:X_,hex:rv,rgb:w_,rgba:w_,hsl:x0,hsla:x0},parse:e=>{if(typeof e!="string")return e;const r=rv.parse(e)||w_.parse(e)||x0.parse(e)||X_.parse(e);if(r)return r;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Jo.HSL)||e.data.r===void 0?x0.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?w_.stringify(e):rv.stringify(e)},kee=(e,r)=>{const n=sf.parse(e);for(const i in r)n[i]=pn.channel.clamp[i](r[i]);return sf.stringify(n)},J_=(e,r,n=0,i=1)=>{if(typeof e!="number")return kee(e,{a:r});const s=aN.set({r:pn.channel.clamp.r(e),g:pn.channel.clamp.g(r),b:pn.channel.clamp.b(n),a:pn.channel.clamp.a(i)});return sf.stringify(s)},oRe=e=>{const{r,g:n,b:i}=sf.parse(e),s=.2126*pn.channel.toLinear(r)+.7152*pn.channel.toLinear(n)+.0722*pn.channel.toLinear(i);return pn.lang.round(s)},lRe=e=>oRe(e)>=.5,KS=e=>!lRe(e),Cee=(e,r,n)=>{const i=sf.parse(e),s=i[r],a=pn.channel.clamp[r](s+n);return s!==a&&(i[r]=a),sf.stringify(i)},_r=(e,r)=>Cee(e,"l",r),qr=(e,r)=>Cee(e,"l",-r),Ie=(e,r)=>{const n=sf.parse(e),i={};for(const s in r)r[s]&&(i[s]=n[s]+r[s]);return kee(e,i)},cRe=(e,r,n=50)=>{const{r:i,g:s,b:a,a:o}=sf.parse(e),{r:l,g:d,b:u,a:f}=sf.parse(r),p=n/100,g=p*2-1,v=o-f,_=((g*v===-1?g:(g+v)/(1+g*v))+1)/2,k=1-_,w=i*_+l*k,C=s*_+d*k,j=a*_+u*k,A=o*p+f*(1-p);return J_(w,C,j,A)},lr=(e,r=100)=>{const n=sf.parse(e);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,cRe(n,e,r)};/*! @license DOMPurify 3.3.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.2/LICENSE */const{entries:jee,setPrototypeOf:_z,isFrozen:uRe,getPrototypeOf:dRe,getOwnPropertyDescriptor:hRe}=Object;let{freeze:Ol,seal:sd,create:G3}=Object,{apply:KA,construct:YA}=typeof Reflect<"u"&&Reflect;Ol||(Ol=function(r){return r});sd||(sd=function(r){return r});KA||(KA=function(r,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];return r.apply(n,s)});YA||(YA=function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new r(...i)});const DC=Ml(Array.prototype.forEach),fRe=Ml(Array.prototype.lastIndexOf),wz=Ml(Array.prototype.pop),Mb=Ml(Array.prototype.push),pRe=Ml(Array.prototype.splice),K3=Ml(String.prototype.toLowerCase),tE=Ml(String.prototype.toString),rE=Ml(String.prototype.match),Rb=Ml(String.prototype.replace),mRe=Ml(String.prototype.indexOf),gRe=Ml(String.prototype.trim),qc=Ml(Object.prototype.hasOwnProperty),wl=Ml(RegExp.prototype.test),Pb=yRe(TypeError);function Ml(e){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return KA(e,r,i)}}function yRe(e){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return YA(e,n)}}function Ln(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:K3;_z&&_z(e,null);let i=r.length;for(;i--;){let s=r[i];if(typeof s=="string"){const a=n(s);a!==s&&(uRe(r)||(r[i]=a),s=a)}e[s]=!0}return e}function vRe(e){for(let r=0;r<e.length;r++)qc(e,r)||(e[r]=null);return e}function $h(e){const r=G3(null);for(const[n,i]of jee(e))qc(e,n)&&(Array.isArray(i)?r[n]=vRe(i):i&&typeof i=="object"&&i.constructor===Object?r[n]=$h(i):r[n]=i);return r}function Lb(e,r){for(;e!==null;){const i=hRe(e,r);if(i){if(i.get)return Ml(i.get);if(typeof i.value=="function")return Ml(i.value)}e=dRe(e)}function n(){return null}return n}const Sz=Ol(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),nE=Ol(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),iE=Ol(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xRe=Ol(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sE=Ol(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bRe=Ol(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),kz=Ol(["#text"]),Cz=Ol(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),aE=Ol(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),jz=Ol(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),IC=Ol(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_Re=sd(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wRe=sd(/<%[\w\W]*|[\w\W]*%>/gm),SRe=sd(/\$\{[\w\W]*/gm),kRe=sd(/^data-[\-\w.\u00B7-\uFFFF]+$/),CRe=sd(/^aria-[\-\w]+$/),Nee=sd(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jRe=sd(/^(?:\w+script|data):/i),NRe=sd(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tee=sd(/^html$/i),TRe=sd(/^[a-z][.\w]*(-[.\w]+)+$/i);var Nz=Object.freeze({__proto__:null,ARIA_ATTR:CRe,ATTR_WHITESPACE:NRe,CUSTOM_ELEMENT:TRe,DATA_ATTR:kRe,DOCTYPE_NAME:Tee,ERB_EXPR:wRe,IS_ALLOWED_URI:Nee,IS_SCRIPT_OR_DATA:jRe,MUSTACHE_EXPR:_Re,TMPLIT_EXPR:SRe});const $b={element:1,text:3,progressingInstruction:7,comment:8,document:9},ERe=function(){return typeof window>"u"?null:window},ARe=function(r,n){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const a="dompurify"+(i?"#"+i:"");try{return r.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Tz=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Eee(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ERe();const r=at=>Eee(at);if(r.version="3.3.2",r.removed=[],!e||!e.document||e.document.nodeType!==$b.document||!e.Element)return r.isSupported=!1,r;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:d,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:v}=e,b=d.prototype,_=Lb(b,"cloneNode"),k=Lb(b,"remove"),w=Lb(b,"nextSibling"),C=Lb(b,"childNodes"),j=Lb(b,"parentNode");if(typeof o=="function"){const at=n.createElement("template");at.content&&at.content.ownerDocument&&(n=at.content.ownerDocument)}let A,N="";const{implementation:E,createNodeIterator:P,createDocumentFragment:H,getElementsByTagName:G}=n,{importNode:D}=i;let W=Tz();r.isSupported=typeof jee=="function"&&typeof j=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:z,TMPLIT_EXPR:O,DATA_ATTR:$,ARIA_ATTR:R,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:Y}=Nz;let{IS_ALLOWED_URI:F}=Nz,V=null;const Q=Ln({},[...Sz,...nE,...iE,...sE,...kz]);let q=null;const te=Ln({},[...Cz,...aE,...jz,...IC]);let ne=Object.seal(G3(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,pe=null;const ee=Object.seal(G3(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,he=!0,ke=!1,fe=!0,Ke=!1,ce=!0,nt=!1,qe=!1,pt=!1,Dt=!1,ft=!1,Vt=!1,Kt=!0,mt=!1;const Fe="user-content-";let Et=!0,rr=!1,Ce={},Oe=null;const Qe=Ln({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ut=null;const vt=Ln({},["audio","video","img","source","image","track"]);let me=null;const He=Ln({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),be="http://www.w3.org/1998/Math/MathML",Pe="http://www.w3.org/2000/svg",Ge="http://www.w3.org/1999/xhtml";let Ee=Ge,Nt=!1,st=null;const Pt=Ln({},[be,Pe,Ge],tE);let Qt=Ln({},["mi","mo","mn","ms","mtext"]),Ir=Ln({},["annotation-xml"]);const Ht=Ln({},["title","style","font","a","script"]);let sr=null;const ct=["application/xhtml+xml","text/html"],Ct="text/html";let jt=null,Wt=null;const et=n.createElement("form"),Lt=function(ge){return ge instanceof RegExp||ge instanceof Function},$t=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Wt&&Wt===ge)){if((!ge||typeof ge!="object")&&(ge={}),ge=$h(ge),sr=ct.indexOf(ge.PARSER_MEDIA_TYPE)===-1?Ct:ge.PARSER_MEDIA_TYPE,jt=sr==="application/xhtml+xml"?tE:K3,V=qc(ge,"ALLOWED_TAGS")?Ln({},ge.ALLOWED_TAGS,jt):Q,q=qc(ge,"ALLOWED_ATTR")?Ln({},ge.ALLOWED_ATTR,jt):te,st=qc(ge,"ALLOWED_NAMESPACES")?Ln({},ge.ALLOWED_NAMESPACES,tE):Pt,me=qc(ge,"ADD_URI_SAFE_ATTR")?Ln($h(He),ge.ADD_URI_SAFE_ATTR,jt):He,ut=qc(ge,"ADD_DATA_URI_TAGS")?Ln($h(vt),ge.ADD_DATA_URI_TAGS,jt):vt,Oe=qc(ge,"FORBID_CONTENTS")?Ln({},ge.FORBID_CONTENTS,jt):Qe,se=qc(ge,"FORBID_TAGS")?Ln({},ge.FORBID_TAGS,jt):$h({}),pe=qc(ge,"FORBID_ATTR")?Ln({},ge.FORBID_ATTR,jt):$h({}),Ce=qc(ge,"USE_PROFILES")?ge.USE_PROFILES:!1,ae=ge.ALLOW_ARIA_ATTR!==!1,he=ge.ALLOW_DATA_ATTR!==!1,ke=ge.ALLOW_UNKNOWN_PROTOCOLS||!1,fe=ge.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ke=ge.SAFE_FOR_TEMPLATES||!1,ce=ge.SAFE_FOR_XML!==!1,nt=ge.WHOLE_DOCUMENT||!1,Dt=ge.RETURN_DOM||!1,ft=ge.RETURN_DOM_FRAGMENT||!1,Vt=ge.RETURN_TRUSTED_TYPE||!1,pt=ge.FORCE_BODY||!1,Kt=ge.SANITIZE_DOM!==!1,mt=ge.SANITIZE_NAMED_PROPS||!1,Et=ge.KEEP_CONTENT!==!1,rr=ge.IN_PLACE||!1,F=ge.ALLOWED_URI_REGEXP||Nee,Ee=ge.NAMESPACE||Ge,Qt=ge.MATHML_TEXT_INTEGRATION_POINTS||Qt,Ir=ge.HTML_INTEGRATION_POINTS||Ir,ne=ge.CUSTOM_ELEMENT_HANDLING||{},ge.CUSTOM_ELEMENT_HANDLING&&Lt(ge.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ne.tagNameCheck=ge.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ge.CUSTOM_ELEMENT_HANDLING&&Lt(ge.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ne.attributeNameCheck=ge.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ge.CUSTOM_ELEMENT_HANDLING&&typeof ge.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ne.allowCustomizedBuiltInElements=ge.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ke&&(he=!1),ft&&(Dt=!0),Ce&&(V=Ln({},kz),q=G3(null),Ce.html===!0&&(Ln(V,Sz),Ln(q,Cz)),Ce.svg===!0&&(Ln(V,nE),Ln(q,aE),Ln(q,IC)),Ce.svgFilters===!0&&(Ln(V,iE),Ln(q,aE),Ln(q,IC)),Ce.mathMl===!0&&(Ln(V,sE),Ln(q,jz),Ln(q,IC))),qc(ge,"ADD_TAGS")||(ee.tagCheck=null),qc(ge,"ADD_ATTR")||(ee.attributeCheck=null),ge.ADD_TAGS&&(typeof ge.ADD_TAGS=="function"?ee.tagCheck=ge.ADD_TAGS:(V===Q&&(V=$h(V)),Ln(V,ge.ADD_TAGS,jt))),ge.ADD_ATTR&&(typeof ge.ADD_ATTR=="function"?ee.attributeCheck=ge.ADD_ATTR:(q===te&&(q=$h(q)),Ln(q,ge.ADD_ATTR,jt))),ge.ADD_URI_SAFE_ATTR&&Ln(me,ge.ADD_URI_SAFE_ATTR,jt),ge.FORBID_CONTENTS&&(Oe===Qe&&(Oe=$h(Oe)),Ln(Oe,ge.FORBID_CONTENTS,jt)),ge.ADD_FORBID_CONTENTS&&(Oe===Qe&&(Oe=$h(Oe)),Ln(Oe,ge.ADD_FORBID_CONTENTS,jt)),Et&&(V["#text"]=!0),nt&&Ln(V,["html","head","body"]),V.table&&(Ln(V,["tbody"]),delete se.tbody),ge.TRUSTED_TYPES_POLICY){if(typeof ge.TRUSTED_TYPES_POLICY.createHTML!="function")throw Pb('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ge.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Pb('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=ge.TRUSTED_TYPES_POLICY,N=A.createHTML("")}else A===void 0&&(A=ARe(v,s)),A!==null&&typeof N=="string"&&(N=A.createHTML(""));Ol&&Ol(ge),Wt=ge}},nr=Ln({},[...nE,...iE,...xRe]),ye=Ln({},[...sE,...bRe]),it=function(ge){let gt=j(ge);(!gt||!gt.tagName)&&(gt={namespaceURI:Ee,tagName:"template"});const zt=K3(ge.tagName),Cr=K3(gt.tagName);return st[ge.namespaceURI]?ge.namespaceURI===Pe?gt.namespaceURI===Ge?zt==="svg":gt.namespaceURI===be?zt==="svg"&&(Cr==="annotation-xml"||Qt[Cr]):!!nr[zt]:ge.namespaceURI===be?gt.namespaceURI===Ge?zt==="math":gt.namespaceURI===Pe?zt==="math"&&Ir[Cr]:!!ye[zt]:ge.namespaceURI===Ge?gt.namespaceURI===Pe&&!Ir[Cr]||gt.namespaceURI===be&&!Qt[Cr]?!1:!ye[zt]&&(Ht[zt]||!nr[zt]):!!(sr==="application/xhtml+xml"&&st[ge.namespaceURI]):!1},ir=function(ge){Mb(r.removed,{element:ge});try{j(ge).removeChild(ge)}catch{k(ge)}},Tt=function(ge,gt){try{Mb(r.removed,{attribute:gt.getAttributeNode(ge),from:gt})}catch{Mb(r.removed,{attribute:null,from:gt})}if(gt.removeAttribute(ge),ge==="is")if(Dt||ft)try{ir(gt)}catch{}else try{gt.setAttribute(ge,"")}catch{}},cr=function(ge){let gt=null,zt=null;if(pt)ge="<remove></remove>"+ge;else{const sn=rE(ge,/^[\r\n\t ]+/);zt=sn&&sn[0]}sr==="application/xhtml+xml"&&Ee===Ge&&(ge='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ge+"</body></html>");const Cr=A?A.createHTML(ge):ge;if(Ee===Ge)try{gt=new g().parseFromString(Cr,sr)}catch{}if(!gt||!gt.documentElement){gt=E.createDocument(Ee,"template",null);try{gt.documentElement.innerHTML=Nt?N:Cr}catch{}}const gr=gt.body||gt.documentElement;return ge&&zt&&gr.insertBefore(n.createTextNode(zt),gr.childNodes[0]||null),Ee===Ge?G.call(gt,nt?"html":"body")[0]:nt?gt.documentElement:gr},Br=function(ge){return P.call(ge.ownerDocument||ge,ge,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},_e=function(ge){return ge instanceof p&&(typeof ge.nodeName!="string"||typeof ge.textContent!="string"||typeof ge.removeChild!="function"||!(ge.attributes instanceof f)||typeof ge.removeAttribute!="function"||typeof ge.setAttribute!="function"||typeof ge.namespaceURI!="string"||typeof ge.insertBefore!="function"||typeof ge.hasChildNodes!="function")},tt=function(ge){return typeof l=="function"&&ge instanceof l};function Le(at,ge,gt){DC(at,zt=>{zt.call(r,ge,gt,Wt)})}const ht=function(ge){let gt=null;if(Le(W.beforeSanitizeElements,ge,null),_e(ge))return ir(ge),!0;const zt=jt(ge.nodeName);if(Le(W.uponSanitizeElement,ge,{tagName:zt,allowedTags:V}),ce&&ge.hasChildNodes()&&!tt(ge.firstElementChild)&&wl(/<[/\w!]/g,ge.innerHTML)&&wl(/<[/\w!]/g,ge.textContent)||ge.nodeType===$b.progressingInstruction||ce&&ge.nodeType===$b.comment&&wl(/<[/\w]/g,ge.data))return ir(ge),!0;if(!(ee.tagCheck instanceof Function&&ee.tagCheck(zt))&&(!V[zt]||se[zt])){if(!se[zt]&&ei(zt)&&(ne.tagNameCheck instanceof RegExp&&wl(ne.tagNameCheck,zt)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(zt)))return!1;if(Et&&!Oe[zt]){const Cr=j(ge)||ge.parentNode,gr=C(ge)||ge.childNodes;if(gr&&Cr){const sn=gr.length;for(let Bi=sn-1;Bi>=0;--Bi){const ss=_(gr[Bi],!0);ss.__removalCount=(ge.__removalCount||0)+1,Cr.insertBefore(ss,w(ge))}}}return ir(ge),!0}return ge instanceof d&&!it(ge)||(zt==="noscript"||zt==="noembed"||zt==="noframes")&&wl(/<\/no(script|embed|frames)/i,ge.innerHTML)?(ir(ge),!0):(Ke&&ge.nodeType===$b.text&&(gt=ge.textContent,DC([B,z,O],Cr=>{gt=Rb(gt,Cr," ")}),ge.textContent!==gt&&(Mb(r.removed,{element:ge.cloneNode()}),ge.textContent=gt)),Le(W.afterSanitizeElements,ge,null),!1)},Mt=function(ge,gt,zt){if(pe[gt]||Kt&&(gt==="id"||gt==="name")&&(zt in n||zt in et))return!1;if(!(he&&!pe[gt]&&wl($,gt))){if(!(ae&&wl(R,gt))){if(!(ee.attributeCheck instanceof Function&&ee.attributeCheck(gt,ge))){if(!q[gt]||pe[gt]){if(!(ei(ge)&&(ne.tagNameCheck instanceof RegExp&&wl(ne.tagNameCheck,ge)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(ge))&&(ne.attributeNameCheck instanceof RegExp&&wl(ne.attributeNameCheck,gt)||ne.attributeNameCheck instanceof Function&&ne.attributeNameCheck(gt,ge))||gt==="is"&&ne.allowCustomizedBuiltInElements&&(ne.tagNameCheck instanceof RegExp&&wl(ne.tagNameCheck,zt)||ne.tagNameCheck instanceof Function&&ne.tagNameCheck(zt))))return!1}else if(!me[gt]){if(!wl(F,Rb(zt,U,""))){if(!((gt==="src"||gt==="xlink:href"||gt==="href")&&ge!=="script"&&mRe(zt,"data:")===0&&ut[ge])){if(!(ke&&!wl(I,Rb(zt,U,"")))){if(zt)return!1}}}}}}}return!0},ei=function(ge){return ge!=="annotation-xml"&&rE(ge,Y)},wt=function(ge){Le(W.beforeSanitizeAttributes,ge,null);const{attributes:gt}=ge;if(!gt||_e(ge))return;const zt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let Cr=gt.length;for(;Cr--;){const gr=gt[Cr],{name:sn,namespaceURI:Bi,value:ss}=gr,as=jt(sn),zi=ss;let ze=sn==="value"?zi:gRe(zi);if(zt.attrName=as,zt.attrValue=ze,zt.keepAttr=!0,zt.forceKeepAttr=void 0,Le(W.uponSanitizeAttribute,ge,zt),ze=zt.attrValue,mt&&(as==="id"||as==="name")&&(Tt(sn,ge),ze=Fe+ze),ce&&wl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ze)){Tt(sn,ge);continue}if(as==="attributename"&&rE(ze,"href")){Tt(sn,ge);continue}if(zt.forceKeepAttr)continue;if(!zt.keepAttr){Tt(sn,ge);continue}if(!fe&&wl(/\/>/i,ze)){Tt(sn,ge);continue}Ke&&DC([B,z,O],qt=>{ze=Rb(ze,qt," ")});const Be=jt(ge.nodeName);if(!Mt(Be,as,ze)){Tt(sn,ge);continue}if(A&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Bi)switch(v.getAttributeType(Be,as)){case"TrustedHTML":{ze=A.createHTML(ze);break}case"TrustedScriptURL":{ze=A.createScriptURL(ze);break}}if(ze!==zi)try{Bi?ge.setAttributeNS(Bi,sn,ze):ge.setAttribute(sn,ze),_e(ge)?ir(ge):wz(r.removed)}catch{Tt(sn,ge)}}Le(W.afterSanitizeAttributes,ge,null)},ar=function at(ge){let gt=null;const zt=Br(ge);for(Le(W.beforeSanitizeShadowDOM,ge,null);gt=zt.nextNode();)Le(W.uponSanitizeShadowNode,gt,null),ht(gt),wt(gt),gt.content instanceof a&&at(gt.content);Le(W.afterSanitizeShadowDOM,ge,null)};return r.sanitize=function(at){let ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},gt=null,zt=null,Cr=null,gr=null;if(Nt=!at,Nt&&(at="<!-->"),typeof at!="string"&&!tt(at))if(typeof at.toString=="function"){if(at=at.toString(),typeof at!="string")throw Pb("dirty is not a string, aborting")}else throw Pb("toString is not a function");if(!r.isSupported)return at;if(qe||$t(ge),r.removed=[],typeof at=="string"&&(rr=!1),rr){if(at.nodeName){const ss=jt(at.nodeName);if(!V[ss]||se[ss])throw Pb("root node is forbidden and cannot be sanitized in-place")}}else if(at instanceof l)gt=cr("<!---->"),zt=gt.ownerDocument.importNode(at,!0),zt.nodeType===$b.element&&zt.nodeName==="BODY"||zt.nodeName==="HTML"?gt=zt:gt.appendChild(zt);else{if(!Dt&&!Ke&&!nt&&at.indexOf("<")===-1)return A&&Vt?A.createHTML(at):at;if(gt=cr(at),!gt)return Dt?null:Vt?N:""}gt&&pt&&ir(gt.firstChild);const sn=Br(rr?at:gt);for(;Cr=sn.nextNode();)ht(Cr),wt(Cr),Cr.content instanceof a&&ar(Cr.content);if(rr)return at;if(Dt){if(ft)for(gr=H.call(gt.ownerDocument);gt.firstChild;)gr.appendChild(gt.firstChild);else gr=gt;return(q.shadowroot||q.shadowrootmode)&&(gr=D.call(i,gr,!0)),gr}let Bi=nt?gt.outerHTML:gt.innerHTML;return nt&&V["!doctype"]&&gt.ownerDocument&&gt.ownerDocument.doctype&&gt.ownerDocument.doctype.name&&wl(Tee,gt.ownerDocument.doctype.name)&&(Bi="<!DOCTYPE "+gt.ownerDocument.doctype.name+`>
@@ -1159,8 +1159,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
1159
1159
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,a=Math.abs(i-n.x),o=e.width/2;let l=n.x<r.x?o-a:o+a;const d=e.height/2,u=Math.abs(r.y-n.y),f=Math.abs(r.x-n.x);if(Math.abs(s-r.y)*o>Math.abs(i-r.x)*d){let p=n.y<r.y?r.y-d-s:s-d-r.y;l=f*p/u;const g={x:n.x<r.x?n.x+l:n.x-f+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),f===0&&(g.x=r.x),u===0&&(g.y=r.y),Ot.debug(`abc89 top/bottom calc, Q ${u}, q ${p}, R ${f}, r ${l}`,g),g}else{n.x<r.x?l=r.x-o-i:l=i-o-r.x;let p=u*l/f,g=n.x<r.x?n.x+f-l:n.x-f+l,v=n.y<r.y?n.y+p:n.y-p;return Ot.debug(`sides calc abc89, Q ${u}, q ${p}, R ${f}, r ${l}`,{_x:g,_y:v}),l===0&&(g=r.x,v=r.y),f===0&&(g=r.x),u===0&&(v=r.y),{x:g,y:v}}},"intersection"),XF=X((e,r)=>{Ot.warn("abc88 cutPathAtIntersect",e,r);let n=[],i=e[0],s=!1;return e.forEach(a=>{if(Ot.info("abc88 checking point",a,r),!YWe(r,a)&&!s){const o=XWe(r,i,a);Ot.debug("abc88 inside",a,i,o),Ot.debug("abc88 intersection",o,r);let l=!1;n.forEach(d=>{l=l||d.x===o.x&&d.y===o.y}),n.some(d=>d.x===o.x&&d.y===o.y)?Ot.warn("abc88 no intersect",o,n):n.push(o),s=!0}else Ot.warn("abc88 outside",a,i),i=a,s||n.push(a)}),Ot.debug("returning points",n),n},"cutPathAtIntersect");function Xse(e){const r=[],n=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],a=e[i],o=e[i+1];(s.x===a.x&&a.y===o.y&&Math.abs(a.x-o.x)>5&&Math.abs(a.y-s.y)>5||s.y===a.y&&a.x===o.x&&Math.abs(a.x-s.x)>5&&Math.abs(a.y-o.y)>5)&&(r.push(a),n.push(i))}return{cornerPoints:r,cornerPointPositions:n}}X(Xse,"extractCornerPoints");var JF=X(function(e,r,n){const i=r.x-e.x,s=r.y-e.y,a=Math.sqrt(i*i+s*s),o=n/a;return{x:r.x-o*i,y:r.y-o*s}},"findAdjacentPoint"),JWe=X(function(e){const{cornerPointPositions:r}=Xse(e),n=[];for(let i=0;i<e.length;i++)if(r.includes(i)){const s=e[i-1],a=e[i+1],o=e[i],l=JF(s,o,5),d=JF(a,o,5),u=d.x-l.x,f=d.y-l.y;n.push(l);const p=Math.sqrt(2)*2;let g={x:o.x,y:o.y};if(Math.abs(a.x-s.x)>10&&Math.abs(a.y-s.y)>=10){Ot.debug("Corner point fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));const v=5;o.x===l.x?g={x:u<0?l.x-v+p:l.x+v-p,y:f<0?l.y-p:l.y+p}:g={x:u<0?l.x-p:l.x+p,y:f<0?l.y-v+p:l.y+v-p}}else Ot.debug("Corner point skipping fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));n.push(g,d)}else n.push(e[i]);return n},"fixCorners"),ZWe=X((e,r,n)=>{const i=e-r-n,s=2,a=2,o=s+a,l=Math.floor(i/o),d=Array(l).fill(`${s} ${a}`).join(" ");return`0 ${r} ${d} ${n}`},"generateDashArray"),QWe=X(function(e,r,n,i,s,a,o,l=!1){var R;const{handDrawnSeed:d}=gi();let u=r.points,f=!1;const p=s;var g=a;const v=[];for(const I in r.cssCompiledStyles)Xne(I)||v.push(r.cssCompiledStyles[I]);Ot.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])),Ot.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&&(Ot.info("to cluster abc88",n.get(r.toCluster)),u=XF(r.points,n.get(r.toCluster).node),f=!0),r.fromCluster&&(Ot.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(u,null,2)),u=XF(u.reverse(),n.get(r.fromCluster).node).reverse(),f=!0);let _=u.filter(I=>!Number.isNaN(I.y));const k=qWe(r.curve);k!=="rounded"&&(_=JWe(_));let w=ew;switch(k){case"linear":w=ew;break;case"basis":w=dO;break;case"cardinal":w=Ate;break;case"bumpX":w=Cte;break;case"bumpY":w=jte;break;case"catmullRom":w=Mte;break;case"monotoneX":w=Ite;break;case"monotoneY":w=Bte;break;case"natural":w=Fte;break;case"step":w=Hte;break;case"stepAfter":w=Ute;break;case"stepBefore":w=Wte;break;case"rounded":w=ew;break;default:w=dO}const{x:C,y:j}=YIe(r),A=CDe().x(C).y(j).curve(w);let N;switch(r.thickness){case"normal":N="edge-thickness-normal";break;case"thick":N="edge-thickness-thick";break;case"invisible":N="edge-thickness-invisible";break;default:N="edge-thickness-normal"}switch(r.pattern){case"solid":N+=" edge-pattern-solid";break;case"dotted":N+=" edge-pattern-dotted";break;case"dashed":N+=" edge-pattern-dashed";break;default:N+=" edge-pattern-solid"}let E,P=k==="rounded"?Jse(Zse(_,r),5):A(_);const H=Array.isArray(r.style)?r.style:[r.style];let G=H.find(I=>I==null?void 0:I.startsWith("stroke:")),D="";r.animate&&(D="edge-animation-fast"),r.animation&&(D="edge-animation-"+r.animation);let W=!1;if(r.look==="handDrawn"){const I=Tr.svg(e);Object.assign([],_);const U=I.path(P,{roughness:.3,seed:d});N+=" transition",E=Zr(U).select("path").attr("id",r.id).attr("class"," "+N+(r.classes?" "+r.classes:"")+(D?" "+D:"")).attr("style",H?H.reduce((F,V)=>F+";"+V,""):"");let Y=E.attr("d");E.attr("d",Y),e.node().appendChild(E.node())}else{const I=v.join(";"),U=H?H.reduce((te,ne)=>te+ne+";",""):"",Y=(I?I+";"+U+";":U)+";"+(H?H.reduce((te,ne)=>te+";"+ne,""):"");E=e.append("path").attr("d",P).attr("id",r.id).attr("class"," "+N+(r.classes?" "+r.classes:"")+(D?" "+D:"")).attr("style",Y),G=(R=Y.match(/stroke:([^;]+)/))==null?void 0:R[1],W=r.animate===!0||!!r.animation||I.includes("animation");const F=E.node(),V=typeof F.getTotalLength=="function"?F.getTotalLength():0,Q=hF[r.arrowTypeStart]||0,q=hF[r.arrowTypeEnd]||0;if(r.look==="neo"&&!W){const ne=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?ZWe(V,Q,q):`0 ${Q} ${V-Q-q} ${q}`}; stroke-dashoffset: 0;`;E.attr("style",ne+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(I=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",I.x).attr("cy",I.y)});let B="";(gi().flowchart.arrowMarkerAbsolute||gi().state.arrowMarkerAbsolute)&&(B=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,B=B.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),Ot.info("arrowTypeStart",r.arrowTypeStart),Ot.info("arrowTypeEnd",r.arrowTypeEnd),UWe(E,r,B,o,i,G);const z=Math.floor(u.length/2),O=u[z];Bd.isLabelCoordinateInPath(O,E.attr("d"))||(f=!0);let $={};return f&&($.updatedPath=u),$.originalPath=r.points,$},"insertEdge");function Jse(e,r){if(e.length<2)return"";let n="";const i=e.length,s=1e-5;for(let a=0;a<i;a++){const o=e[a],l=e[a-1],d=e[a+1];if(a===0)n+=`M${o.x},${o.y}`;else if(a===i-1)n+=`L${o.x},${o.y}`;else{const u=o.x-l.x,f=o.y-l.y,p=d.x-o.x,g=d.y-o.y,v=Math.hypot(u,f),b=Math.hypot(p,g);if(v<s||b<s){n+=`L${o.x},${o.y}`;continue}const _=u/v,k=f/v,w=p/b,C=g/b,j=_*w+k*C,A=Math.max(-1,Math.min(1,j)),N=Math.acos(A);if(N<s||Math.abs(Math.PI-N)<s){n+=`L${o.x},${o.y}`;continue}const E=Math.min(r/Math.sin(N/2),v/2,b/2),P=o.x-_*E,H=o.y-k*E,G=o.x+w*E,D=o.y+C*E;n+=`L${P},${H}`,n+=`Q${o.x},${o.y} ${G},${D}`}}return n}X(Jse,"generateRoundedPath");function BO(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(BO,"calculateDeltaAndAngle");function Zse(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&Zo[r.arrowTypeStart]){const s=Zo[r.arrowTypeStart],a=e[0],o=e[1],{angle:l}=BO(a,o),d=s*Math.cos(l),u=s*Math.sin(l);n[0].x=a.x+d,n[0].y=a.y+u}const i=e.length;if(i>=2&&Zo[r.arrowTypeEnd]){const s=Zo[r.arrowTypeEnd],a=e[i-1],o=e[i-2],{angle:l}=BO(o,a),d=s*Math.cos(l),u=s*Math.sin(l);n[i-1].x=a.x-d,n[i-1].y=a.y-u}return n}X(Zse,"applyMarkerOffsetsToPoints");var eUe=X((e,r,n,i)=>{r.forEach(s=>{gUe[s](e,n,i)})},"insertMarkers"),tUe=X((e,r,n)=>{Ot.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"),rUe=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"),nUe=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"),iUe=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"),sUe=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"),aUe=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"),oUe=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"),lUe=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"),cUe=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"),uUe=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"),dUe=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"),hUe=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"),fUe=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"),pUe=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
1160
1160
  L20,10
1161
1161
  M20,10
1162
- L0,20`)},"requirement_arrow"),mUe=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"),gUe={extension:tUe,composition:rUe,aggregation:nUe,dependency:iUe,lollipop:sUe,point:aUe,circle:oUe,cross:lUe,barb:cUe,only_one:uUe,zero_or_one:dUe,one_or_more:hUe,zero_or_more:fUe,requirement_arrow:pUe,requirement_contains:mUe},yUe=eUe,vUe={common:XS,getConfig:il,insertCluster:kWe,insertEdge:QWe,insertEdgeLabel:GWe,insertMarkers:yUe,insertNode:Yse,interpolateToCurve:hP,labelHelper:on,log:Ot,positionEdgeLabel:KWe},a2={},Qse=X(e=>{for(const r of e)a2[r.name]=r},"registerLayoutLoaders"),xUe=X(()=>{Qse([{name:"dagre",loader:X(async()=>await Ze(()=>import("./dagre-KLK3FWXG-CaqiA13p.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ze(()=>import("./cose-bilkent-S5V4N54A-piNxB7P4.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");xUe();var dxt=X(async(e,r)=>{if(!(e.layoutAlgorithm in a2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=a2[e.layoutAlgorithm];return(await n.loader()).render(e,r,vUe,{algorithm:n.algorithm})},"render"),hxt=X((e="",{fallback:r="dagre"}={})=>{if(e in a2)return e;if(r in a2)return Ot.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"),bUe=Ene(Object.keys,Object),_Ue=Object.prototype,wUe=_Ue.hasOwnProperty;function SUe(e){if(!bN(e))return bUe(e);var r=[];for(var n in Object(e))wUe.call(e,n)&&n!="constructor"&&r.push(n);return r}var zO=fy(ch,"DataView"),FO=fy(ch,"Promise"),HO=fy(ch,"Set"),WO=fy(ch,"WeakMap"),ZF="[object Map]",kUe="[object Object]",QF="[object Promise]",eH="[object Set]",tH="[object WeakMap]",rH="[object DataView]",CUe=hy(zO),jUe=hy(i2),NUe=hy(FO),TUe=hy(HO),EUe=hy(WO),d0=dy;(zO&&d0(new zO(new ArrayBuffer(1)))!=rH||i2&&d0(new i2)!=ZF||FO&&d0(FO.resolve())!=QF||HO&&d0(new HO)!=eH||WO&&d0(new WO)!=tH)&&(d0=function(e){var r=dy(e),n=r==kUe?e.constructor:void 0,i=n?hy(n):"";if(i)switch(i){case CUe:return rH;case jUe:return ZF;case NUe:return QF;case TUe:return eH;case EUe:return tH}return r});var AUe="[object Map]",OUe="[object Set]",MUe=Object.prototype,RUe=MUe.hasOwnProperty;function nH(e){if(e==null)return!0;if(_N(e)&&(w4(e)||typeof e=="string"||typeof e.splice=="function"||uP(e)||dP(e)||_4(e)))return!e.length;var r=d0(e);if(r==AUe||r==OUe)return!e.size;if(bN(e))return!SUe(e).length;for(var n in e)if(RUe.call(e,n))return!1;return!0}var eae="c4",PUe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),LUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-CXdZ6lpb.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:eae,diagram:e}},"loader"),$Ue={id:eae,detector:PUe,loader:LUe},DUe=$Ue,tae="flowchart",IUe=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"),BUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-BiRUi27S.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:tae,diagram:e}},"loader"),zUe={id:tae,detector:IUe,loader:BUe},FUe=zUe,rae="flowchart-v2",HUe=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"),WUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-BiRUi27S.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:rae,diagram:e}},"loader"),UUe={id:rae,detector:HUe,loader:WUe},VUe=UUe,nae="er",qUe=X(e=>/^\s*erDiagram/.test(e),"detector"),GUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-C6N0kuAl.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:nae,diagram:e}},"loader"),KUe={id:nae,detector:qUe,loader:GUe},YUe=KUe,iae="gitGraph",XUe=X(e=>/^\s*gitGraph/.test(e),"detector"),JUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-It1b6c7e.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:iae,diagram:e}},"loader"),ZUe={id:iae,detector:XUe,loader:JUe},QUe=ZUe,sae="gantt",eVe=X(e=>/^\s*gantt/.test(e),"detector"),tVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-CywGz7nU.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:sae,diagram:e}},"loader"),rVe={id:sae,detector:eVe,loader:tVe},nVe=rVe,aae="info",iVe=X(e=>/^\s*info/.test(e),"detector"),sVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-BVy6S5R7.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:aae,diagram:e}},"loader"),aVe={id:aae,detector:iVe,loader:sVe},oae="pie",oVe=X(e=>/^\s*pie/.test(e),"detector"),lVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-DGdb_0Z7.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:oae,diagram:e}},"loader"),cVe={id:oae,detector:oVe,loader:lVe},lae="quadrantChart",uVe=X(e=>/^\s*quadrantChart/.test(e),"detector"),dVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-CY_eWEbD.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:lae,diagram:e}},"loader"),hVe={id:lae,detector:uVe,loader:dVe},fVe=hVe,cae="xychart",pVe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),mVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-RnFHWlAK.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:cae,diagram:e}},"loader"),gVe={id:cae,detector:pVe,loader:mVe},yVe=gVe,uae="requirement",vVe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),xVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-D3B65LEW.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:uae,diagram:e}},"loader"),bVe={id:uae,detector:vVe,loader:xVe},_Ve=bVe,dae="sequence",wVe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),SVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-8hG861Pn.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:dae,diagram:e}},"loader"),kVe={id:dae,detector:wVe,loader:SVe},CVe=kVe,hae="class",jVe=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"),NVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-Del1uk2I.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:hae,diagram:e}},"loader"),TVe={id:hae,detector:jVe,loader:NVe},EVe=TVe,fae="classDiagram",AVe=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"),OVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-Del1uk2I.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:fae,diagram:e}},"loader"),MVe={id:fae,detector:AVe,loader:OVe},RVe=MVe,pae="state",PVe=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"),LVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-YedMaAHI.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:pae,diagram:e}},"loader"),$Ve={id:pae,detector:PVe,loader:LVe},DVe=$Ve,mae="stateDiagram",IVe=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"),BVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-BjdTc8_d.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:mae,diagram:e}},"loader"),zVe={id:mae,detector:IVe,loader:BVe},FVe=zVe,gae="journey",HVe=X(e=>/^\s*journey/.test(e),"detector"),WVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-DKNI_Dnv.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:gae,diagram:e}},"loader"),UVe={id:gae,detector:HVe,loader:WVe},VVe=UVe,qVe=X((e,r,n)=>{Ot.debug(`rendering svg for syntax error
1163
- `);const i=FDe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Vee(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"),yae={draw:qVe},GVe=yae,KVe={db:{},renderer:yae,parser:{parse:X(()=>{},"parse")}},YVe=KVe,vae="flowchart-elk",XVe=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"),JVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-BiRUi27S.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:vae,diagram:e}},"loader"),ZVe={id:vae,detector:XVe,loader:JVe},QVe=ZVe,xae="timeline",eqe=X(e=>/^\s*timeline/.test(e),"detector"),tqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-DBvhv1ED.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:xae,diagram:e}},"loader"),rqe={id:xae,detector:eqe,loader:tqe},nqe=rqe,bae="mindmap",iqe=X(e=>/^\s*mindmap/.test(e),"detector"),sqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-BKg4ze2I.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:bae,diagram:e}},"loader"),aqe={id:bae,detector:iqe,loader:sqe},oqe=aqe,_ae="kanban",lqe=X(e=>/^\s*kanban/.test(e),"detector"),cqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-9z_mhKoE.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:_ae,diagram:e}},"loader"),uqe={id:_ae,detector:lqe,loader:cqe},dqe=uqe,wae="sankey",hqe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-uKY_Zaux.js");return{diagram:r}},[],import.meta.url);return{id:wae,diagram:e}},"loader"),pqe={id:wae,detector:hqe,loader:fqe},mqe=pqe,Sae="packet",gqe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),yqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-BeaSFiV0.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Sae,diagram:e}},"loader"),vqe={id:Sae,detector:gqe,loader:yqe},kae="radar",xqe=X(e=>/^\s*radar-beta/.test(e),"detector"),bqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-DJan_W4f.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:kae,diagram:e}},"loader"),_qe={id:kae,detector:xqe,loader:bqe},Cae="block",wqe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),Sqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-UnCUDtqF.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Cae,diagram:e}},"loader"),kqe={id:Cae,detector:wqe,loader:Sqe},Cqe=kqe,jae="architecture",jqe=X(e=>/^\s*architecture/.test(e),"detector"),Nqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-32zggPY7.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:jae,diagram:e}},"loader"),Tqe={id:jae,detector:jqe,loader:Nqe},Eqe=Tqe,Nae="ishikawa",Aqe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),Oqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-UubnteoS.js");return{diagram:r}},[],import.meta.url);return{id:Nae,diagram:e}},"loader"),Mqe={id:Nae,detector:Aqe,loader:Oqe},Tae="venn",Rqe=X(e=>/^\s*venn-beta/.test(e),"detector"),Pqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-BpTbgJnx.js");return{diagram:r}},[],import.meta.url);return{id:Tae,diagram:e}},"loader"),Lqe={id:Tae,detector:Rqe,loader:Pqe},$qe=Lqe,Eae="treemap",Dqe=X(e=>/^\s*treemap/.test(e),"detector"),Iqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-0qOMs8UI.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Eae,diagram:e}},"loader"),Bqe={id:Eae,detector:Dqe,loader:Iqe},iH=!1,EN=X(()=>{iH||(iH=!0,n4("error",YVe,e=>e.toLowerCase().trim()==="error"),n4("---",{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(QVe,oqe,Eqe),XA(DUe,dqe,RVe,EVe,YUe,nVe,aVe,cVe,_Ve,CVe,VUe,FUe,nqe,QUe,FVe,DVe,VVe,fVe,mqe,vqe,yVe,Cqe,_qe,Mqe,Bqe,$qe))},"addDiagrams"),zqe=X(async()=>{Ot.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(F0).map(async([n,{detector:i,loader:s}])=>{if(s)try{eO(n)}catch{try{const{diagram:a,id:o}=await s();n4(o,a,i)}catch(a){throw Ot.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete F0[n],a}}}))).filter(n=>n.status==="rejected");if(r.length>0){Ot.error(`Failed to load ${r.length} external diagrams`);for(const n of r)Ot.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),Fqe="graphics-document document";function Aae(e,r){e.attr("role",Fqe),r!==""&&e.attr("aria-roledescription",r)}X(Aae,"setA11yDiagramInfo");function Oae(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(Oae,"addSVGa11yTitleDescription");var R0,UO=(R0=class{constructor(r,n,i,s,a){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=a}static async fromText(r,n={}){var u,f;const i=il(),s=R9(r,i);r=UFe(r)+`
1162
+ L0,20`)},"requirement_arrow"),mUe=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"),gUe={extension:tUe,composition:rUe,aggregation:nUe,dependency:iUe,lollipop:sUe,point:aUe,circle:oUe,cross:lUe,barb:cUe,only_one:uUe,zero_or_one:dUe,one_or_more:hUe,zero_or_more:fUe,requirement_arrow:pUe,requirement_contains:mUe},yUe=eUe,vUe={common:XS,getConfig:il,insertCluster:kWe,insertEdge:QWe,insertEdgeLabel:GWe,insertMarkers:yUe,insertNode:Yse,interpolateToCurve:hP,labelHelper:on,log:Ot,positionEdgeLabel:KWe},a2={},Qse=X(e=>{for(const r of e)a2[r.name]=r},"registerLayoutLoaders"),xUe=X(()=>{Qse([{name:"dagre",loader:X(async()=>await Ze(()=>import("./dagre-KLK3FWXG-oK4s-Hdt.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ze(()=>import("./cose-bilkent-S5V4N54A-DHsyHTZd.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");xUe();var dxt=X(async(e,r)=>{if(!(e.layoutAlgorithm in a2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=a2[e.layoutAlgorithm];return(await n.loader()).render(e,r,vUe,{algorithm:n.algorithm})},"render"),hxt=X((e="",{fallback:r="dagre"}={})=>{if(e in a2)return e;if(r in a2)return Ot.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"),bUe=Ene(Object.keys,Object),_Ue=Object.prototype,wUe=_Ue.hasOwnProperty;function SUe(e){if(!bN(e))return bUe(e);var r=[];for(var n in Object(e))wUe.call(e,n)&&n!="constructor"&&r.push(n);return r}var zO=fy(ch,"DataView"),FO=fy(ch,"Promise"),HO=fy(ch,"Set"),WO=fy(ch,"WeakMap"),ZF="[object Map]",kUe="[object Object]",QF="[object Promise]",eH="[object Set]",tH="[object WeakMap]",rH="[object DataView]",CUe=hy(zO),jUe=hy(i2),NUe=hy(FO),TUe=hy(HO),EUe=hy(WO),d0=dy;(zO&&d0(new zO(new ArrayBuffer(1)))!=rH||i2&&d0(new i2)!=ZF||FO&&d0(FO.resolve())!=QF||HO&&d0(new HO)!=eH||WO&&d0(new WO)!=tH)&&(d0=function(e){var r=dy(e),n=r==kUe?e.constructor:void 0,i=n?hy(n):"";if(i)switch(i){case CUe:return rH;case jUe:return ZF;case NUe:return QF;case TUe:return eH;case EUe:return tH}return r});var AUe="[object Map]",OUe="[object Set]",MUe=Object.prototype,RUe=MUe.hasOwnProperty;function nH(e){if(e==null)return!0;if(_N(e)&&(w4(e)||typeof e=="string"||typeof e.splice=="function"||uP(e)||dP(e)||_4(e)))return!e.length;var r=d0(e);if(r==AUe||r==OUe)return!e.size;if(bN(e))return!SUe(e).length;for(var n in e)if(RUe.call(e,n))return!1;return!0}var eae="c4",PUe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),LUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-B2wl4mK7.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:eae,diagram:e}},"loader"),$Ue={id:eae,detector:PUe,loader:LUe},DUe=$Ue,tae="flowchart",IUe=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"),BUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-zj5HRAsJ.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:tae,diagram:e}},"loader"),zUe={id:tae,detector:IUe,loader:BUe},FUe=zUe,rae="flowchart-v2",HUe=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"),WUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-zj5HRAsJ.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:rae,diagram:e}},"loader"),UUe={id:rae,detector:HUe,loader:WUe},VUe=UUe,nae="er",qUe=X(e=>/^\s*erDiagram/.test(e),"detector"),GUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-EVWjA3sf.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:nae,diagram:e}},"loader"),KUe={id:nae,detector:qUe,loader:GUe},YUe=KUe,iae="gitGraph",XUe=X(e=>/^\s*gitGraph/.test(e),"detector"),JUe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-0-hbfXPF.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:iae,diagram:e}},"loader"),ZUe={id:iae,detector:XUe,loader:JUe},QUe=ZUe,sae="gantt",eVe=X(e=>/^\s*gantt/.test(e),"detector"),tVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-Bp5NgGcR.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:sae,diagram:e}},"loader"),rVe={id:sae,detector:eVe,loader:tVe},nVe=rVe,aae="info",iVe=X(e=>/^\s*info/.test(e),"detector"),sVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-DrlqUeU4.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:aae,diagram:e}},"loader"),aVe={id:aae,detector:iVe,loader:sVe},oae="pie",oVe=X(e=>/^\s*pie/.test(e),"detector"),lVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-srcpZS8v.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:oae,diagram:e}},"loader"),cVe={id:oae,detector:oVe,loader:lVe},lae="quadrantChart",uVe=X(e=>/^\s*quadrantChart/.test(e),"detector"),dVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-BV5SE8BI.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:lae,diagram:e}},"loader"),hVe={id:lae,detector:uVe,loader:dVe},fVe=hVe,cae="xychart",pVe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),mVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-NnFseC2a.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:cae,diagram:e}},"loader"),gVe={id:cae,detector:pVe,loader:mVe},yVe=gVe,uae="requirement",vVe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),xVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-EaiMvJWs.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:uae,diagram:e}},"loader"),bVe={id:uae,detector:vVe,loader:xVe},_Ve=bVe,dae="sequence",wVe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),SVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-BCmIdbbn.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:dae,diagram:e}},"loader"),kVe={id:dae,detector:wVe,loader:SVe},CVe=kVe,hae="class",jVe=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"),NVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-CgHdYKIM.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:hae,diagram:e}},"loader"),TVe={id:hae,detector:jVe,loader:NVe},EVe=TVe,fae="classDiagram",AVe=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"),OVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-CgHdYKIM.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:fae,diagram:e}},"loader"),MVe={id:fae,detector:AVe,loader:OVe},RVe=MVe,pae="state",PVe=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"),LVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-BV4lQzYf.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:pae,diagram:e}},"loader"),$Ve={id:pae,detector:PVe,loader:LVe},DVe=$Ve,mae="stateDiagram",IVe=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"),BVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-CIxheqQG.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:mae,diagram:e}},"loader"),zVe={id:mae,detector:IVe,loader:BVe},FVe=zVe,gae="journey",HVe=X(e=>/^\s*journey/.test(e),"detector"),WVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-DEeW_yOb.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:gae,diagram:e}},"loader"),UVe={id:gae,detector:HVe,loader:WVe},VVe=UVe,qVe=X((e,r,n)=>{Ot.debug(`rendering svg for syntax error
1163
+ `);const i=FDe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Vee(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"),yae={draw:qVe},GVe=yae,KVe={db:{},renderer:yae,parser:{parse:X(()=>{},"parse")}},YVe=KVe,vae="flowchart-elk",XVe=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"),JVe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-zj5HRAsJ.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:vae,diagram:e}},"loader"),ZVe={id:vae,detector:XVe,loader:JVe},QVe=ZVe,xae="timeline",eqe=X(e=>/^\s*timeline/.test(e),"detector"),tqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-Z9qknQl4.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:xae,diagram:e}},"loader"),rqe={id:xae,detector:eqe,loader:tqe},nqe=rqe,bae="mindmap",iqe=X(e=>/^\s*mindmap/.test(e),"detector"),sqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-D-8c-93p.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:bae,diagram:e}},"loader"),aqe={id:bae,detector:iqe,loader:sqe},oqe=aqe,_ae="kanban",lqe=X(e=>/^\s*kanban/.test(e),"detector"),cqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-FM29gKpg.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:_ae,diagram:e}},"loader"),uqe={id:_ae,detector:lqe,loader:cqe},dqe=uqe,wae="sankey",hqe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-lAl01ROV.js");return{diagram:r}},[],import.meta.url);return{id:wae,diagram:e}},"loader"),pqe={id:wae,detector:hqe,loader:fqe},mqe=pqe,Sae="packet",gqe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),yqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-ySZDscia.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Sae,diagram:e}},"loader"),vqe={id:Sae,detector:gqe,loader:yqe},kae="radar",xqe=X(e=>/^\s*radar-beta/.test(e),"detector"),bqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-EwISt7PA.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:kae,diagram:e}},"loader"),_qe={id:kae,detector:xqe,loader:bqe},Cae="block",wqe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),Sqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-Dl78blHG.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Cae,diagram:e}},"loader"),kqe={id:Cae,detector:wqe,loader:Sqe},Cqe=kqe,jae="architecture",jqe=X(e=>/^\s*architecture/.test(e),"detector"),Nqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-7aPVlRJf.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:jae,diagram:e}},"loader"),Tqe={id:jae,detector:jqe,loader:Nqe},Eqe=Tqe,Nae="ishikawa",Aqe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),Oqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-C3SnWGNp.js");return{diagram:r}},[],import.meta.url);return{id:Nae,diagram:e}},"loader"),Mqe={id:Nae,detector:Aqe,loader:Oqe},Tae="venn",Rqe=X(e=>/^\s*venn-beta/.test(e),"detector"),Pqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-Dq4AW_h7.js");return{diagram:r}},[],import.meta.url);return{id:Tae,diagram:e}},"loader"),Lqe={id:Tae,detector:Rqe,loader:Pqe},$qe=Lqe,Eae="treemap",Dqe=X(e=>/^\s*treemap/.test(e),"detector"),Iqe=X(async()=>{const{diagram:e}=await Ze(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-C8k51-cC.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Eae,diagram:e}},"loader"),Bqe={id:Eae,detector:Dqe,loader:Iqe},iH=!1,EN=X(()=>{iH||(iH=!0,n4("error",YVe,e=>e.toLowerCase().trim()==="error"),n4("---",{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(QVe,oqe,Eqe),XA(DUe,dqe,RVe,EVe,YUe,nVe,aVe,cVe,_Ve,CVe,VUe,FUe,nqe,QUe,FVe,DVe,VVe,fVe,mqe,vqe,yVe,Cqe,_qe,Mqe,Bqe,$qe))},"addDiagrams"),zqe=X(async()=>{Ot.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(F0).map(async([n,{detector:i,loader:s}])=>{if(s)try{eO(n)}catch{try{const{diagram:a,id:o}=await s();n4(o,a,i)}catch(a){throw Ot.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete F0[n],a}}}))).filter(n=>n.status==="rejected");if(r.length>0){Ot.error(`Failed to load ${r.length} external diagrams`);for(const n of r)Ot.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),Fqe="graphics-document document";function Aae(e,r){e.attr("role",Fqe),r!==""&&e.attr("aria-roledescription",r)}X(Aae,"setA11yDiagramInfo");function Oae(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(Oae,"addSVGa11yTitleDescription");var R0,UO=(R0=class{constructor(r,n,i,s,a){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=a}static async fromText(r,n={}){var u,f;const i=il(),s=R9(r,i);r=UFe(r)+`
1164
1164
  `;try{eO(s)}catch{const p=MRe(s);if(!p)throw new Oee(`Diagram ${s} not found.`);const{id:g,diagram:v}=await p();n4(g,v)}const{db:a,parser:o,renderer:l,init:d}=eO(s);return o.parser&&(o.parser.yy=a),(u=a.clear)==null||u.call(a),d==null||d(i),n.title&&((f=a.setDiagramTitle)==null||f.call(a,n.title)),await o.parse(r),new R0(s,r,a,o,l)}async render(r,n){await this.renderer.draw(this.text,r,n,this)}getParser(){return this.parser}getType(){return this.type}},X(R0,"Diagram"),R0),sH=[],Hqe=X(()=>{sH.forEach(e=>{e()}),sH=[]},"attachFunctions"),Wqe=X(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Mae(e){const r=e.match(Aee);if(!r)return{text:e,metadata:{}};let n=KIe(r[1],{schema:GIe})??{};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(Mae,"extractFrontMatter");var Uqe=X(e=>e.replace(/\r\n?/g,`
1165
1165
  `).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),Vqe=X(e=>{const{text:r,metadata:n}=Mae(e),{displayMode:i,title:s,config:a={}}=n;return i&&(a.gantt||(a.gantt={}),a.gantt.displayMode=i),{title:s,config:a,text:r}},"processFrontmatter"),qqe=X(e=>{const r=Bd.detectInit(e)??{},n=Bd.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:OFe(e),directive:r}},"processDirectives");function RP(e){const r=Uqe(e),n=Vqe(r),i=qqe(n.text),s=yP(n.config,i.directive);return e=Wqe(i.text),{code:e,title:n.title,config:s}}X(RP,"preprocessDiagram");function Rae(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}X(Rae,"toBase64");var Gqe=5e4,Kqe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Yqe="sandbox",Xqe="loose",Jqe="http://www.w3.org/2000/svg",Zqe="http://www.w3.org/1999/xlink",Qqe="http://www.w3.org/1999/xhtml",eGe="100%",tGe="100%",rGe="border:0;margin:0;",nGe="margin:0",iGe="allow-top-navigation-by-user-activation allow-popups",sGe='The "iframe" tag is not supported by your browser.',aGe=["foreignobject"],oGe=["dominant-baseline"];function PP(e){const r=RP(e);return t4(),KRe(r.config??{}),r}X(PP,"processAndSetConfigs");async function Pae(e,r){EN();try{const{code:n,config:i}=PP(e);return{diagramType:(await $ae(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}X(Pae,"parse");var aH=X((e,r,n=[])=>`
1166
1166
  .${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),lGe=X((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
@@ -1199,7 +1199,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
1199
1199
  `),n=(u=r.find(p=>p.startsWith("URL: ")))==null?void 0:u.replace("URL: ","").trim(),i=(f=r.find(p=>p.startsWith("Title: ")))==null?void 0:f.replace("Title: ","").trim(),s=r.findIndex(p=>p.trim()==="Interactive elements:"),a=s>=0?r.slice(0,s):r,o=a.findIndex(p=>p.trim()==="Text:"),l=o>=0?a.slice(o+1).join(`
1200
1200
  `).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 HKe({path:e}){const[r,n]=y.useState(!1),[i,s]=y.useState(!1),a=e.trim(),o=Xae(a)??`${Zn()}/api/browser/screenshot?path=${encodeURIComponent(a)}`;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:a})]}),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:o,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(iu,{open:!0,onOpenChange:l=>!l&&s(!1),children:c.jsx(uc,{className:"max-w-[90vw] max-h-[90vh] p-2",showCloseButton:!0,children:c.jsx("img",{src:o,alt:"Browser screenshot",className:"max-h-[85vh] w-full object-contain"})})})]})}function s5(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,a=typeof s.terminalId=="string"?s.terminalId:null;if(a)return a;const o=typeof s.id=="string"?s.id:null;if(o)return o;const l=typeof s.surfaceId=="string"?s.surfaceId:null;if(l)return l}return null}function WKe(e){var n;const r=ko(e.tool);if(r==="surfaces.start"){if(e.args.type==="terminal")return s5(e)!==null;const i=(n=e.result)==null?void 0:n.data;return i&&typeof i=="object"&&i.type==="terminal"?s5(e)!==null:!1}return r==="execute"||r.startsWith("terminal.")?s5(e)!==null:!1}function foe(e){if(!e)return null;const r=e.match(/"command"\s*:\s*"((?:[^"\\]|\\.)*)/);return r?r[1].replace(/\\n/g,`
1201
1201
  `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function Fu(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,`
1202
- `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function poe(e){if(!e)return null;const r=Fu(e,"url")??Fu(e,"uri")??Fu(e,"href")??Fu(e,"query")??Fu(e,"q");if(r)return yp(r)??r;const n=Fu(e,"type"),i=Fu(e,"action");return n==="webSearch"||i==="webSearch"?"web search":n==="fetch"||i==="fetch"?"website":null}function UKe({tool:e,streamingArgs:r}){const n=ko(e),i=noe[n],s=n.startsWith("terminal."),a=s?foe(r):null,o=n==="web"||n==="web.search"||n==="web.fetch"||n==="browser.search"||n==="browser.fetch",l=o?poe(r):null;return i&&s&&a?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:a}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i&&o&&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 VKe({tool:e,streamingArgs:r,scrollRef:n}){const i=ko(e),s=i.startsWith("terminal."),a=s?foe(r):null,o=i==="web"||i==="web.search"||i==="web.fetch"||i==="browser.search"||i==="browser.fetch",l=o?poe(r):null;if(s&&a)return c.jsxs("pre",{ref:n,className:Te("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:"$ "}),a,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]});if(o&&l){const d=i==="web.search"||i==="browser.search"?"Searching":"Fetching";return c.jsx("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:[d," ",l,"..."]})]})})}if(i==="memory.save"){const d=Fu(r,"scope")??"memory",u=Fu(r,"content");return c.jsxs("div",{className:Te("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(Jt,{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:['"',zd(u,120),'"']}):null]})}if(i==="cron.add"){const d=Fu(r,"name"),u=Fu(r,"cron"),f=Fu(r,"toolName");return c.jsxs("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Creating cron job",d?`: ${d}`:"..."]})]}),(u||f)&&c.jsxs("div",{className:"mt-1 opacity-80",children:[u?`schedule ${u}`:"",u&&f?" • ":"",f?`tool ${f}`:""]})]})}return r?c.jsxs("pre",{ref:n,className:Te("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:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsx("span",{children:"Preparing..."})]})})}function moe(e){const r=new Map,n=new Set,i=new Map(e.map(s=>[s.callId,s]));for(const s of e){if(!s.parentCallId||!i.has(s.parentCallId))continue;const a=r.get(s.parentCallId)??[];r.set(s.parentCallId,[...a,s]),n.add(s.callId)}for(let s=0;s<e.length;s++){const a=e[s];if(ko(a.tool)!=="agent")continue;const o=[];for(let l=s+1;l<e.length;l++){const d=e[l];if(n.has(d.callId))continue;const u=a.status==="running"||a.status==="pending",f=a.completedAt!=null&&d.startedAt<=a.completedAt;if(u||f)o.push(d),n.add(d.callId);else break}if(o.length>0){const l=r.get(a.callId)??[];r.set(a.callId,[...l,...o])}}return{childMap:r,parentSet:n}}function goe(e){return e==="browserScreenshot"}function yoe(e){var a,o;const r=ko(e.tool),n=(a=e.result)!=null&&a.data&&typeof e.result.data=="object"?e.result.data:void 0,i=Qc(r,e.args,n),s=toe(r,i,n,(o=e.result)==null?void 0:o.message);return goe(roe({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 qKe({path:e,onOpenDiff:r,disabled:n}){const i=MN(e),s=!!r&&!n,a=c.jsxs(c.Fragment,{children:[c.jsx(Ka,{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:o=>{o.preventDefault(),o.stopPropagation(),r(e)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),r(e))},children:a}):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:a})}function GKe({status:e}){const r=e==="completed"?"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400":e==="error"||e==="interrupted"?"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400":e==="running"||e==="starting"?"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400":"border-border/70 bg-muted/45 text-muted-foreground",n=e==="completed"?ca:e==="error"||e==="interrupted"?rh:e==="running"||e==="starting"?Jt:_5;return c.jsxs("span",{className:Te("inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-2xs font-medium capitalize",r),children:[c.jsx(n,{className:Te("h-3 w-3",(e==="running"||e==="starting")&&"animate-spin")}),e]})}function KKe({items:e,resultMessage:r}){return e.length===0?c.jsx("div",{className:"rounded-md border border-border/60 bg-muted/25 px-3 py-2 text-xs text-muted-foreground",children:"No thread details available."}):c.jsxs("div",{className:"rounded-md border border-purple-500/20 bg-purple-500/[0.025] text-xs",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-purple-500/15 px-3 py-2",children:[c.jsxs("span",{className:"font-medium text-foreground",children:[e.length," thread",e.length===1?"":"s"]}),c.jsxs("span",{className:"text-muted-foreground",children:[e.filter(n=>n.status==="completed").length," completed"]})]}),c.jsx("div",{className:"divide-y divide-border/35",children:e.map((n,i)=>{const s=n.id?n.id.slice(-8):null,a=n.branch??(n.workingDirectory?MN(n.workingDirectory):null);return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate font-medium text-foreground",title:n.title,children:n.title}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-2xs text-muted-foreground",children:[s&&c.jsx("code",{className:"rounded bg-background/70 px-1 py-0.5 font-mono",children:s}),n.providerId&&c.jsx("span",{children:n.providerId}),n.kind&&c.jsx("span",{children:n.kind}),a&&c.jsx("span",{className:"min-w-0 truncate",children:a})]}),n.error&&c.jsx("div",{className:"mt-1 truncate text-2xs text-red-500",title:n.error,children:n.error})]}),c.jsx(GKe,{status:n.status})]},n.id??`${n.title}-${i}`)})}),r&&c.jsx("div",{className:"border-t border-purple-500/15 px-3 py-2 text-2xs text-muted-foreground",children:r})]})}function YKe({call:e,childCalls:r,onOpenTerminal:n,onOpenDiff:i,inlineSecretPrompt:s,renderInlineSecretPrompt:a,hideTopConnector:o=!1,hideBottomConnector:l=!1}){var ft,Vt,Kt,mt,Fe,Et,rr,Ce,Oe,Qe,ut,vt;const d=yoe(e),[u,f]=y.useState(e.status==="running"||e.status==="pending"||d),[p,g]=y.useState(()=>Date.now()),v=y.useRef(e.status),b=ko(e.tool),_=(ft=e.result)!=null&&ft.data&&typeof e.result.data=="object"?e.result.data:void 0,k=Qc(b,e.args,_),w=b==="mcp-tool"?ON(k,_):null,C=w?xKe(w.title):null,j=$P(b),A=(C==null?void 0:C.icon)??j.icon,N=(C==null?void 0:C.color)??j.color,E=jKe(b,k,_,(Vt=e.result)==null?void 0:Vt.message),P=t7(b,k),G=doe(e.result,b)||e.streamingOutput||"",D=typeof(_==null?void 0:_.snapshot)=="string"?_.snapshot:null,W=toe(b,k,_,(Kt=e.result)==null?void 0:Kt.message),B=b.startsWith("terminal.")||b==="execute"||b.startsWith("ssh.")||b==="run.ssh"||b==="elevated.run",z=LKe(e),O=WKe(e),$=O?s5(e):null,R=RKe(b,k),I=s??(a==null?void 0:a(e))??null,U=I!=null,Y=e.status==="pending",F=eoe(b,k,(mt=e.result)==null?void 0:mt.data,(Fe=e.result)==null?void 0:Fe.message).map(me=>me.trim()).filter(Boolean),V=F[0]??((rr=e7(b,k,_,(Et=e.result)==null?void 0:Et.message))==null?void 0:rr.trim())??"",Q=!!V&&SKe(b),q=AH(G),te=AH(e.streamingArgs),ne=roe({tool:b,args:k,status:e.status,displayOutput:G,snapshotText:D,screenshotPath:W}),se=goe(ne),pe=ne==="terminal"?!0:ne!=="none"&&!se,ee=ne==="threadList"?ioe(k,_,e.status):[],ae=U?!0:u,he=y.useCallback(me=>{U&&!me||f(me)},[U]),ke=e.status==="pending"||e.status==="running"?Jt:e.status==="success"?ca:rh,fe=e.status==="pending"?"text-blue-400":e.status==="running"?"text-muted-foreground":e.status==="success"?"text-green-500":"text-red-500",Ke=e.status==="error"?{row:"bg-red-500/[0.035] hover:bg-red-500/[0.06]",icon:"bg-red-500/10",connector:"bg-red-500/25",body:"bg-red-500/[0.025]"}:e.status==="success"?{row:"bg-card/58 hover:bg-muted/42",icon:"bg-emerald-500/[0.08]",connector:"bg-border/55",body:"bg-card/42"}:{row:"bg-primary/[0.045] hover:bg-primary/[0.075]",icon:"bg-primary/10",connector:"bg-primary/30",body:"bg-primary/[0.025]"};y.useEffect(()=>{const me=v.current;!se&&ne!=="threadList"&&(me==="running"||me==="pending")&&e.status!=="running"&&e.status!=="pending"&&f(!1),(e.status==="pending"||e.status==="running"||se||U)&&f(!0),v.current=e.status},[ne,e.status,U,se]),y.useEffect(()=>{var me;b!=="web"&&b!=="web.search"&&b!=="web.fetch"&&b!=="browser.search"&&b!=="browser.fetch"||console.debug("[tool-call-card:web]",{tool:e.tool,normalizedTool:b,callId:e.callId,status:e.status,rawArgs:e.args,normalizedArgs:k,resultMessage:(me=e.result)==null?void 0:me.message,resultData:_,streamingArgs:e.streamingArgs})},[e.args,e.callId,(Ce=e.result)==null?void 0:Ce.message,e.status,e.streamingArgs,e.tool,k,b,_]),y.useEffect(()=>{if(e.status!=="running"&&e.status!=="pending")return;const me=window.setInterval(()=>g(Date.now()),250);return()=>window.clearInterval(me)},[e.status]);const ce=vKe(b,k,_,(Oe=e.result)==null?void 0:Oe.message),qe=e.status==="running"||e.status==="pending"?ce.running:ce.done,pt=c.jsxs(c.Fragment,{children:[c.jsx(ke,{className:Te("h-4 w-4 shrink-0",fe,(e.status==="running"||e.status==="pending")&&"animate-spin")}),c.jsx("span",{className:"flex-1 truncate text-[13px] font-medium text-muted-foreground",children:Y?c.jsx(UKe,{tool:e.tool,streamingArgs:e.streamingArgs}):B?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:E,children:E})]}):Q?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[qe,":"]}),c.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",children:[c.jsx(qKe,{path:V,onOpenDiff:i,disabled:e.status!=="success"}),F.length>1&&c.jsxs("span",{className:"rounded border border-border/60 bg-muted/35 px-1.5 py-0.5 text-2xs text-muted-foreground",children:["+",F.length-1]})]})]}):w&&(w.title||w.details)?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[qe,":"]}),c.jsxs("span",{className:"min-w-0 truncate",children:[w.title?c.jsx("code",{className:"text-[11px] font-mono",children:w.title}):null,w.title&&w.details?c.jsx("span",{className:"text-muted-foreground",children:" • "}):null,w.details?c.jsx("span",{className:"text-xs text-muted-foreground",children:w.details}):null]})]}):c.jsxs("span",{children:[qe,": ",c.jsx("code",{className:"text-[11px] font-mono",children:E})]})}),c.jsx("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:c.jsx(n7,{startedAt:e.startedAt,completedAt:e.completedAt,now:p})}),P&&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:P}),z&&c.jsx("span",{className:Te("rounded border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wide shrink-0",z.className),children:z.label})]}),Dt=ne==="pending"?c.jsx(VKe,{tool:e.tool,streamingArgs:e.streamingArgs,scrollRef:te}):ne==="terminal"?c.jsxs("pre",{ref:q,className:Te("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-72 overflow-y-auto whitespace-pre","bg-zinc-950 text-zinc-100 shadow-inner ring-1 ring-border/40",e.result&&!e.result.ok&&"text-red-200"),children:[!G&&e.status!=="running"&&c.jsxs("span",{className:"text-zinc-400",children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),E]}),G,e.status==="running"&&!G&&c.jsx("span",{className:"text-zinc-400",children:"Running..."}),e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-zinc-100 animate-pulse ml-0.5 align-text-bottom"})]}):ne==="browserSnapshot"?c.jsx(FKe,{snapshot:D}):ne==="browserScreenshot"?c.jsx(HKe,{path:W}):ne==="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(Jt,{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(me=>c.jsx(vp,{call:me,onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:a},me.callId))}),((Qe=e.result)==null?void 0:Qe.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(zKe,{data:_??{},message:(ut=e.result)==null?void 0:ut.message,status:e.status}):ne==="threadList"?c.jsx(KKe,{items:ee,resultMessage:(vt=e.result)==null?void 0:vt.message}):ne==="editDiff"?c.jsx(lKe,{filePath:String(k.path??""),oldText:b==="file.patch"||b==="edit"&&k.search!=null?String(k.search??""):void 0,newText:b==="file.patch"||b==="edit"&&k.replace!=null?String(k.replace??""):void 0,writtenContent:b==="file.write"||b==="edit"&&k.content!=null?String(k.content??""):void 0,isNewFile:b==="file.write"}):ne==="output"?c.jsx(BKe,{output:G,tool:b,isError:!!e.result&&!e.result.ok,isRunning:e.status==="running"}):ne==="runningHint"?c.jsxs("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin"}),c.jsx("span",{children:R})]}),c.jsxs("div",{className:"mt-1 text-xs opacity-75",children:["Elapsed: ",c.jsx(n7,{startedAt:e.startedAt,completedAt:e.completedAt,now:p})]})]}):null;return c.jsxs(zS,{open:pe?ae:!1,onOpenChange:he,children:[c.jsxs("div",{className:"relative pl-8",children:[!o&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 h-6 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, transparent 0 22px, #000 22px 100%)"},"aria-hidden":"true"}),!l&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 bottom-0 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 23px, #000 23px 100%)"},"aria-hidden":"true"}),l&&!o&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 bottom-0 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 100%)"},"aria-hidden":"true"}),c.jsx("div",{className:Te("absolute left-[3px] top-[7px] z-10 flex h-5 w-5 items-center justify-center rounded-md shadow-sm ring-2 ring-background",Ke.icon),children:c.jsx(A,{className:Te("h-3.5 w-3.5 shrink-0",N)})}),c.jsx("div",{className:"group pb-1",children:c.jsxs("div",{className:Te("flex min-h-9 items-center gap-2 rounded-md px-2 py-1.5 transition-colors",Ke.row),children:[pe?c.jsxs(FS,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx(Is,{className:Te("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",ae&&"rotate-90")}),pt]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx("span",{className:"h-3 w-3 shrink-0"}),pt]}),O&&n&&c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:me=>{me.preventDefault(),me.stopPropagation(),n($)},children:c.jsx(wp,{className:"h-3.5 w-3.5"})})}),c.jsx(hn,{side:"top",children:"Open terminal"})]}),ne==="editDiff"&&i&&e.status==="success"&&V&&c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:me=>{me.preventDefault(),me.stopPropagation(),i(V)},children:c.jsx(wp,{className:"h-3.5 w-3.5"})})}),c.jsx(hn,{side:"top",children:"Open diff in editor"})]})]})})]}),pe&&c.jsx(HS,{children:c.jsx("div",{className:Te("ml-8 mr-3 mb-2 rounded-md px-3 py-2",Ke.body),children:Dt})}),se&&c.jsx("div",{className:Te("ml-8 mr-3 mb-2 rounded-md px-3 py-2",Ke.body),children:Dt}),U&&c.jsx("div",{className:"ml-8 mr-3 mb-2 rounded-md border border-yellow-500/20 bg-yellow-500/[0.025] px-3 py-2",children:c.jsx("div",{className:"rounded-lg border border-yellow-500/25 bg-yellow-500/[0.04] p-3",children:I})})]})}const vp=y.memo(YKe);vp.displayName="ToolCallCard";const voe=3,sv=6;function xoe(e,r){return!!r&&e.some(n=>r(n)!=null)}function XKe(e,r){if(!r||e.some(yoe))return!1;const n=e.filter(i=>i.status!=="running"&&i.status!=="pending");return n.length>=voe&&n.length===e.length}function JKe({calls:e,collapsible:r,onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s}){const[a,o]=y.useState(!1),[l,d]=y.useState(()=>!XKe(e,r)),u=y.useRef(!1),{childMap:f,parentSet:p}=y.useMemo(()=>moe(e),[e]),g=y.useMemo(()=>e.filter(D=>!p.has(D.callId)),[e,p]),v=g.filter(D=>D.status==="running"||D.status==="pending"),b=g.filter(D=>D.status!=="running"&&D.status!=="pending"),_=v.length===0&&b.length>0,k=xoe(e,s),w=r&&!k&&_&&b.length>=voe;if(y.useEffect(()=>{if(k){d(!0);return}w&&!u.current&&d(!1),u.current=_},[_,k,w]),e.length===0)return null;const C=b.filter(D=>D.status==="success").length,j=b.filter(D=>D.status==="error").length,A=soe(b);if(w&&!l)return c.jsx("div",{className:"my-2",children:c.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:r7(b)}),C>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-500",children:[c.jsx(ca,{className:"h-3 w-3"})," ",C]}),j>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-red-500",children:[c.jsx(rh,{className:"h-3 w-3"})," ",j]})]})});const N=!a&&b.length>sv,E=N?b.length-sv:0,P=N?b.slice(-sv):b,H=N?b.slice(0,E).filter(D=>D.status==="success").length:0,G=E-H;return c.jsxs("div",{className:"my-2",children:[w&&c.jsxs("button",{type:"button",onClick:()=>d(!1),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3 rotate-90 transition-transform"}),c.jsxs("span",{children:["Collapse ",r7(b)]})]}),N&&c.jsxs("button",{type:"button",onClick:()=>o(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3"}),c.jsxs("span",{children:[E," earlier tool call",E!==1?"s":"",H>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",H," passed)"]}),G>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",G," failed)"]})]})]}),a&&b.slice(0,E).map((D,W,B)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:W===0,hideBottomConnector:W===B.length-1&&P.length===0&&v.length===0},D.callId)),P.map((D,W)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:a?!1:W===0,hideBottomConnector:W===P.length-1&&v.length===0},D.callId)),v.map((D,W)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:b.length===0&&W===0,hideBottomConnector:W===v.length-1},D.callId))]})}function boe(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 s7=y.memo(JKe,(e,r)=>e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.renderInlineSecretPrompt===r.renderInlineSecretPrompt&&e.collapsible===r.collapsible&&boe(e.calls,r.calls));s7.displayName="ToolCallGroup";function PH(e,r){return r?!1:e.length>0&&e.every(n=>n.status!=="running"&&n.status!=="pending")}function ZKe({provider:e,calls:r,isStreaming:n,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a}){const[o,l]=y.useState(()=>!PH(r,n)),[d,u]=y.useState(!1),[f,p]=y.useState(()=>Date.now()),g=y.useRef(!PH(r,n)),v=!!n||r.some(R=>R.status==="running"||R.status==="pending"),b=xoe(r,a),_=b?!0:o,k=y.useCallback(R=>{b&&!R||l(R)},[b]),w=r.filter(R=>R.status==="success").length,C=r.filter(R=>R.status==="error").length,j=r.length>0?Math.min(...r.map(R=>R.startedAt)):Date.now(),A=!v&&r.length>0?Math.max(...r.map(R=>R.completedAt??R.startedAt)):void 0,N=soe(r),{childMap:E,parentSet:P}=y.useMemo(()=>moe(r),[r]),H=y.useMemo(()=>r.filter(R=>!P.has(R.callId)),[r,P]),G=H.filter(R=>R.status==="running"||R.status==="pending"),D=H.filter(R=>R.status!=="running"&&R.status!=="pending"),W=!d&&D.length>sv,B=W?D.length-sv:0,z=W?D.slice(-sv):D,O=W?D.slice(0,B).filter(R=>R.status==="success").length:0,$=B-O;return y.useEffect(()=>{if(b){l(!0),g.current=v;return}g.current&&!v&&r.length>0&&l(!1),g.current=v},[b,v,r.length]),y.useEffect(()=>{if(!v)return;const R=window.setInterval(()=>p(Date.now()),250);return()=>window.clearInterval(R)},[v]),r.length===0?null:c.jsx(zS,{open:_,onOpenChange:k,children:c.jsxs("div",{className:"my-2",children:[c.jsxs(FS,{className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:Te("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",_&&"rotate-90")}),v?c.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground animate-spin"}):c.jsx(N,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:r7(r)}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-muted-foreground tabular-nums shrink-0",children:[!v&&C>0&&c.jsxs("span",{className:"text-red-500",children:[C," failed"]}),c.jsx(n7,{startedAt:j,completedAt:A,now:f})]}),!v&&C===0&&w>0&&c.jsx(ca,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),!v&&C>0&&c.jsx(rh,{className:"h-3.5 w-3.5 shrink-0 text-red-500"})]}),c.jsx(HS,{children:c.jsxs("div",{className:"mt-1",children:[W&&c.jsxs("button",{type:"button",onClick:()=>u(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3"}),c.jsxs("span",{children:[B," earlier tool call",B!==1?"s":"",O>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",O," passed)"]}),$>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",$," failed)"]})]})]}),d&&D.slice(0,B).map((R,I,U)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:I===0,hideBottomConnector:I===U.length-1&&z.length===0&&G.length===0},R.callId)),z.map((R,I)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:d?!1:I===0,hideBottomConnector:I===z.length-1&&G.length===0},R.callId)),G.map((R,I)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:D.length===0&&I===0,hideBottomConnector:I===G.length-1},R.callId))]})})]})})}const a7=y.memo(ZKe,(e,r)=>e.provider===r.provider&&e.isStreaming===r.isStreaming&&e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.renderInlineSecretPrompt===r.renderInlineSecretPrompt&&boe(e.calls,r.calls));a7.displayName="AgentToolCallWrapper";function LH(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 xp(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 QKe(e){return"content"in e?xp(e.content):xp(e)}function eYe(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:{},a=s.function&&typeof s.function=="object"?s.function:{};return{id:xp(s.id||s.call_id||s.tool_call_id||`tool-call-${i+1}`),name:xp(a.name||s.name||s.tool||"tool"),args:xp(a.arguments||s.arguments||s.args||{})}})}function tYe(e,r){const n=e&&typeof e=="object"?e:{},i=n.function&&typeof n.function=="object"?n.function:{};return{name:xp(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 _oe(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Dm(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $H({badge:e,meta:r,preview:n,children:i,tone:s="default",defaultOpen:a=!1,onOpenChange:o}){const[l,d]=y.useState(a);return c.jsx(zS,{open:l,onOpenChange:u=>{d(u),o==null||o()},children:c.jsxs("div",{className:Te("rounded-md border p-3",s==="assistant"?"border-emerald-500/25 bg-emerald-500/10":"border-border/80 bg-background"),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs(FS,{className:"mt-0.5 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground",children:[c.jsx(Is,{className:Te("h-4 w-4 transition-transform",l&&"rotate-90")}),c.jsx("span",{className:"sr-only",children:l?"Collapse section":"Expand section"})]}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e,r]}),n?c.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:n}):null]})]}),c.jsx(HS,{className:"pl-6",children:c.jsx("div",{className:"pt-3",children:i})})]})})}function rYe({flow:e}){const r=e.rounds;if(!r.some(p=>p.metrics))return null;let i=0,s=0,a=0,o=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&&(a+=g.completionTokens),g.totalTokens&&(o+=g.totalTokens),g.tokensPerSecond&&g.completionTokens&&(d+=g.tokensPerSecond*g.completionTokens,u+=g.completionTokens),g.contextUsage&&(l=g.contextUsage))}const f=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(gg,{className:"h-3 w-3"}),"Total Duration"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:_oe(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(iA,{className:"h-3 w-3"}),"Tokens"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:o>0?Dm(o):s+a>0?Dm(s+a):"—"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[s>0?`${Dm(s)} in`:"",s>0&&a>0?" · ":"",a>0?`${Dm(a)} out`:"",s===0&&a===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(iY,{className:"h-3 w-3"}),"Speed"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:f?`${f} 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(G0e,{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:[Dm(l.total)," / ",Dm(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 nYe({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:_oe(e.durationMs)}),e.promptTokens!=null&&c.jsxs("span",{title:"Prompt tokens",children:[Dm(e.promptTokens)," prompt"]}),e.completionTokens!=null&&c.jsxs("span",{title:"Completion tokens",children:[Dm(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 iYe(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:[],a=Array.isArray(i.tools)?i.tools.map(tYe):[];n.push({id:`round-${i.round}`,kind:"round",round:i,messageCount:s.length,toolCount:a.length}),s.forEach((o,l)=>{const d=o&&typeof o=="object"?o:{content:o};n.push({id:`round-${i.round}-message-${l}`,kind:"message",roundNumber:i.round,index:l,role:xp(d.role||"message"),content:QKe(d),raw:o,toolCalls:eYe(d)})}),a.length>0&&n.push({id:`round-${i.round}-tools`,kind:"tools",roundNumber:i.round,tools:a})}return r&&n.push({id:"assistant-response",kind:"response",content:r}),n}function sYe({row:e,onExpandChange:r}){if(e.kind==="summary")return c.jsx(rYe,{flow:e.flow});if(e.kind==="round")return c.jsxs("div",{className:"min-w-0 overflow-hidden rounded-md border border-border bg-background px-3 py-2",children:[c.jsxs("div",{className:"flex min-w-0 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:"min-w-0 break-words text-xs text-muted-foreground",children:e.round.model}),c.jsx("span",{className:"min-w-0 break-words text-xs text-muted-foreground",children:new Date(e.round.createdAt).toLocaleString()})]}),c.jsxs("div",{className:"mt-2 flex min-w-0 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",{className:"min-w-0 break-words",children:["tool_choice: ",e.round.tool_choice]}):null]}),c.jsx(nYe,{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(pR,{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(i=>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:i.name}),i.description?c.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i.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:xp(i.raw)})]},i.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.jsx($H,{tone:"assistant",defaultOpen:!1,onOpenChange:r,badge:c.jsx("span",{className:Te("rounded-md border px-2 py-0.5 text-xs font-semibold",LH("assistant")),children:"assistant response"}),meta:c.jsx("span",{className:"text-xs text-muted-foreground",children:"rendered chat answer"}),preview:c.jsx("span",{className:"block truncate",children:e.content||"(empty response)"}),children: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 n=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($H,{defaultOpen:!1,onOpenChange:r,badge:c.jsx("span",{className:Te("rounded-md border px-2 py-0.5 text-xs font-semibold",LH(e.role)),children:e.role}),meta:c.jsxs(c.Fragment,{children:[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]}),preview:c.jsx("span",{className:"block truncate",children:n}),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(i=>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: ",i.name," ",c.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",i.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:i.args||"{}"})]},i.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:xp(e.raw)})]})]})]})}function aYe({open:e,rows:r,contextFlow:n}){const i=y.useRef(null),s=$R({count:r.length,getScrollElement:()=>i.current,estimateSize:o=>{const l=r[o];return l?l.kind==="summary"?110:l.kind==="round"?120:l.kind==="tools"?Math.min(420,110+l.tools.length*72):l.kind==="response"?72:52:120},overscan:5,enabled:e});y.useEffect(()=>{if(!e)return;const o=window.requestAnimationFrame(()=>{s.measure()});return()=>window.cancelAnimationFrame(o)},[e,r.length,s]);const a=()=>{window.requestAnimationFrame(()=>{s.measure()})};return c.jsxs("div",{className:"flex h-full min-h-0 flex-col px-3 pb-3 pt-2",children:[n!=null&&n.note?c.jsx("p",{className:"mb-2 shrink-0 rounded-md border border-border/70 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground",children:n.note}):null,r.length>0?c.jsx("div",{ref:i,className:"min-h-0 flex-1 overflow-auto pr-2",children:c.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},children:s.getVirtualItems().map(o=>{const l=r[o.index];return l?c.jsx("div",{"data-index":o.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${o.start}px)`},children:c.jsx(sYe,{row:l,onExpandChange:a})},l.id):null})})}):c.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(op,{className:"mr-2 h-4 w-4"}),"No context snapshot is available for this message."]})]})}function oYe({rawText:e}){const r=qS(),n=e||"No context snapshot is available for this message.";return c.jsx("div",{className:"h-full min-h-0 p-3 pt-2",children:c.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border border-border/70 bg-background",children:c.jsx(GS,{height:"100%",language:e?"json":"plaintext",beforeMount:i=>cc(i,r),theme:r,value:n,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,automaticLayout:!0,wordWrap:"on",fontSize:12,lineHeight:18,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,renderLineHighlight:"none",overviewRulerLanes:0,tabSize:2}})})})}function lYe({open:e,onOpenChange:r,contextFlow:n,responseContent:i}){const[s,a]=y.useState("trace"),[o,l]=y.useState(!1),d=y.useMemo(()=>iYe(n,i),[n,i]),u=y.useMemo(()=>n?JSON.stringify(n,null,2):"",[n]),f=async()=>{u&&(await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1200))};return c.jsx(iu,{open:e,onOpenChange:r,children:c.jsxs(uc,{showCloseButton:!1,className:"grid h-[95vh] w-[calc(100dvw-1rem)] max-w-[1200px] grid-rows-[auto_minmax(0,1fr)] overflow-hidden p-0 sm:h-[85vh] sm:w-[96vw]",children:[c.jsx(nd,{className:"border-b px-3 py-2",children:c.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx(dc,{className:"truncate text-sm font-semibold",children:"LLM Context Flow"}),c.jsx(nf,{className:"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:"-my-1 flex shrink-0 items-center gap-1 p-1",children:[c.jsx(we,{type:"button",variant:s==="trace"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a("trace"),children:"Trace"}),c.jsx(we,{type:"button",variant:s==="raw"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a("raw"),children:"Raw"}),c.jsxs(we,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:f,disabled:!u,children:[o?c.jsx(ks,{className:"h-3 w-3 sm:mr-1"}):c.jsx(Kc,{className:"h-3 w-3 sm:mr-1"}),c.jsx("span",{className:"hidden sm:inline",children:o?"Copied":"Copy"}),c.jsx("span",{className:"sr-only",children:o?"Copied":"Copy raw trace"})]}),c.jsxs(rR,{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(Gn,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),s==="trace"?c.jsx(aYe,{open:e,rows:d,contextFlow:n},"trace-list"):c.jsx(oYe,{rawText:u})]})})}const o7=/^[A-Za-z]:[\\/]/,cYe=/^\//;function DH(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function uYe(e){const r=e.pathname||"/",n=/^\/[A-Za-z]:\//.test(r)?r.slice(1):r;return!e.hostname||e.hostname==="localhost"?n:`//${e.hostname}${n}`}function woe(e){return o7.test(e)||cYe.test(e)}function Soe(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]+(?::\d+(?::\d+)?)?$/.test(i)}function dYe(e,r){if(r)return null;const n=e.replace(/\\/g,"/"),i=n.lastIndexOf("/"),a=(i>=0?n.slice(i+1):n).match(/^(.*?):(\d+)(?::(\d+))?$/);if(!a)return null;const o=i>=0?`${e.slice(0,i+1)}${a[1]??""}`:a[1]??"";if(!woe(o)||!Soe(o,`L${a[2]}`))return null;const l={path:o,line:Number.parseInt(a[2],10)};return a[3]&&(l.column=Number.parseInt(a[3],10)),l}function hYe(e){if(!e)return null;const r=e.trim();if(!r)return null;let n=r,i="";try{const d=new URL(r);if(d.protocol==="http:"||d.protocol==="https:"){if(n=d.pathname,i=d.hash.startsWith("#")?d.hash.slice(1):d.hash,!Soe(n,i))return null}else if(d.protocol==="file:")n=uYe(d),i=d.hash.startsWith("#")?d.hash.slice(1):d.hash;else{const u=r.indexOf("#");u>=0&&(n=r.slice(0,u),i=r.slice(u+1))}}catch{const d=r.indexOf("#");d>=0&&(n=r.slice(0,d),i=r.slice(d+1))}let s;try{s=decodeURIComponent(n)}catch{return null}const a=dYe(s,i);if(a)return a;if(!woe(s))return null;const o={path:s},l=i.match(/^L(\d+)(?:C(\d+))?$/i);return l&&(o.line=Number.parseInt(l[1],10),l[2]&&(o.column=Number.parseInt(l[2],10))),o}function IH(e,r){if(!r)return!1;const n=DH(e),i=DH(r);if(!n||!i)return!1;const s=o7.test(n)?n.toLowerCase():n,a=o7.test(i)?i.toLowerCase():i;return s===a||s.startsWith(`${a}/`)}function fYe(e){return e.content.length>0||e.userDisplayText.length>0||e.userDisplaySegments.length>0||e.imageAttachmentCount>0}const pYe=3;function BH(e,r){return!!(e&&e!=="jait"&&r.length>=pYe)}const zH=/<pre[^>]*><code>([\s\S]*)<\/code><\/pre>/;function FH(){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 mYe(e){const r=e.toLowerCase();return!r||r==="text"||r==="plain"?"txt":r==="shell"||r==="sh"?"bash":r}function gYe({code:e,language:r,className:n}){const[i,s]=y.useState(null);return y.useEffect(()=>{let a=!1;const o=setTimeout(()=>{(async()=>{var f,p;const d=document.documentElement.classList.contains("dark")?"github-dark":"github-light",u=mYe(r);try{const g=await jB(e,{lang:u,theme:d});if(a)return;s(((f=g.match(zH))==null?void 0:f[1])??null)}catch{try{const g=await jB(e,{lang:"txt",theme:d});if(a)return;s(((p=g.match(zH))==null?void 0:p[1])??null)}catch{a||s(null)}}})()},150);return()=>{a=!0,clearTimeout(o)}},[e,r]),i?c.jsx("code",{className:Te(n,"whitespace-pre"),dangerouslySetInnerHTML:{__html:i}}):c.jsx("code",{className:Te(n,"whitespace-pre"),children:e})}function koe(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 yYe(e){const r=e.replace(/\\/g,"/"),n=r.split("/");return n[n.length-1]??r}function vYe({href:e,target:r,onOpenPath:n}){const i=yYe(r.path),s=r.line?`L${r.line}${r.column?`:${r.column}`:""}`:null;return c.jsxs("a",{href:e,className:Te("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:a=>{a.preventDefault(),n(r.path,r.line,r.column)},children:[c.jsx(Ka,{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 Coe(e){return{pre:({children:r})=>c.jsx(c.Fragment,{children:r}),code:({node:r,className:n,children:i,ref:s,...a})=>{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",f=String(i??"").replace(/\n$/,"");return c.jsxs(kEe,{code:f,language:u,children:[c.jsxs(CEe,{children:[c.jsx(jEe,{children:c.jsx(NEe,{children:u})}),c.jsx(TEe,{children:c.jsx(EEe,{})})]}),c.jsx("div",{className:"overflow-x-auto px-3 py-2 text-sm",children:c.jsx(gYe,{code:f,language:u,className:n})})]})}return c.jsx("code",{className:Te("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)]"),...a,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=hYe(r);return s?c.jsx(vYe,{href:r,target:s,onOpenPath:e}):c.jsx("a",{href:r,...i,children:i.children})},img:({src:r,alt:n,ref:i,...s})=>{const a=typeof r=="string"?Xae(r):null;return a?c.jsx("a",{href:a,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:a,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 xYe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Coe(n),[n]);return c.jsx("div",{className:koe(),children:c.jsx(jZ,{remarkPlugins:[NZ],components:i,children:e})})}function bYe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Coe(n),[n]),s=({blockMatch:o})=>c.jsx(jZ,{remarkPlugins:[NZ],components:i,children:o.output}),{blockMatches:a}=m4e({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:i4e()},isStreamFinished:!1});return c.jsx("div",{className:koe(),children:a.map((o,l)=>{const d=o.block.component;return c.jsx(d,{blockMatch:o},l)})})}const l7=y.memo(function({content:r,compact:n,isStreaming:i,preferLlmUi:s,onOpenPath:a}){return s&&i?c.jsx(bYe,{content:r,compact:n,onOpenPath:a}):c.jsx(xYe,{content:r,compact:n,onOpenPath:a})});l7.displayName="AssistantMarkdown";function _Ye({messageId:e,messageIndex:r,messageFromEnd:n,role:i,content:s,contextFlow:a,displayContent:o,referencedFiles:l,displaySegments:d,attachments:u,thinking:f,thinkingDuration:p,toolCalls:g,segments:v,isStreaming:b,compact:_,preferLlmUi:k,provider:w,onOpenTerminal:C,renderInlineSecretPrompt:j,onEditMessage:A,editComposer:N,onOpenPath:E,onOpenDiff:P}){const H=i==="user",{userDisplayText:G,userDisplaySegments:D}=y.useMemo(()=>{if(!H)return{userDisplayText:s,userDisplaySegments:[]};if(d!=null&&d.length)return{userDisplayText:I0(d),userDisplaySegments:d};if(o){const He=V5(o,l);return{userDisplayText:o,userDisplaySegments:He}}const me=zA(s);return{userDisplayText:me.text,userDisplaySegments:me.displaySegments}},[H,s,o,l,d]),[W,B]=y.useState(!1),[z,O]=y.useState(!1),[$,R]=y.useState(!1),[I,U]=y.useState(!1),[Y,F]=y.useState(!1),[V,Q]=y.useState(!1),[q,te]=y.useState(""),[ne,se]=y.useState([]),[pe,ee]=y.useState(null),[ae,he]=y.useState(null),ke=y.useMemo(()=>{if(!H)return[];const me=Ks(ae??D).flatMap(He=>He.type==="image"?[{name:He.name,mimeType:He.mimeType,data:He.data,preview:`data:${He.mimeType};base64,${He.data}`}]:[]);return me.length>0?me:u??[]},[u,H,ae,D]),fe=H&&fYe({content:s,userDisplayText:pe??G,userDisplaySegments:ae??D,imageAttachmentCount:ke.length}),Ke=y.useRef(null),ce=y.useRef(null),nt=y.useRef(null);y.useEffect(()=>()=>{Ke.current!==null&&window.clearTimeout(Ke.current)},[]),y.useEffect(()=>{$||(te(G),se(D))},[$,D,G]),y.useEffect(()=>{if(!ae&&pe==null)return;const me=pe===G,He=ae===D||JSON.stringify(ae??[])===JSON.stringify(D);me&&He&&(ee(null),he(null))},[ae,pe,D,G]),y.useEffect(()=>{var He;if(!$){U(!1);return}const me=window.requestAnimationFrame(()=>{U(!0)});return(He=nt.current)==null||He.focus(),()=>window.cancelAnimationFrame(me)},[$]);const qe=()=>{var He;const me=[];if(g&&g.length>0)for(const be of g){const Pe=be.tool.replace(/_/g,"."),Ge=Object.entries(be.args).filter(([,st])=>st!=null&&st!=="").map(([st,Pt])=>`${st}: ${typeof Pt=="string"?Pt:JSON.stringify(Pt)}`).join(", "),Ee=be.status==="success"?"✓":be.status==="error"?"✗":"…",Nt=be.completedAt&&be.startedAt?hoe(be.startedAt,be.completedAt):"";if(me.push(`[${Ee} ${Pe}] ${Ge}`),(He=be.result)!=null&&He.message){const st=be.result.message.length>500?be.result.message.slice(0,500)+"…":be.result.message;me.push(st)}Nt&&me.push(`Duration: ${Nt}`),me.push("")}return s&&me.push(H?bQ(D)||G:s),me.join(`
1202
+ `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):null}function poe(e){if(!e)return null;const r=Fu(e,"url")??Fu(e,"uri")??Fu(e,"href")??Fu(e,"query")??Fu(e,"q");if(r)return yp(r)??r;const n=Fu(e,"type"),i=Fu(e,"action");return n==="webSearch"||i==="webSearch"?"web search":n==="fetch"||i==="fetch"?"website":null}function UKe({tool:e,streamingArgs:r}){const n=ko(e),i=noe[n],s=n.startsWith("terminal."),a=s?foe(r):null,o=n==="web"||n==="web.search"||n==="web.fetch"||n==="browser.search"||n==="browser.fetch",l=o?poe(r):null;return i&&s&&a?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:a}),c.jsx("span",{className:"inline-block w-1 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]}):i&&o&&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 VKe({tool:e,streamingArgs:r,scrollRef:n}){const i=ko(e),s=i.startsWith("terminal."),a=s?foe(r):null,o=i==="web"||i==="web.search"||i==="web.fetch"||i==="browser.search"||i==="browser.fetch",l=o?poe(r):null;if(s&&a)return c.jsxs("pre",{ref:n,className:Te("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:"$ "}),a,c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-blue-400 animate-pulse ml-0.5 align-text-bottom"})]});if(o&&l){const d=i==="web.search"||i==="browser.search"?"Searching":"Fetching";return c.jsx("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:[d," ",l,"..."]})]})})}if(i==="memory.save"){const d=Fu(r,"scope")??"memory",u=Fu(r,"content");return c.jsxs("div",{className:Te("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(Jt,{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:['"',zd(u,120),'"']}):null]})}if(i==="cron.add"){const d=Fu(r,"name"),u=Fu(r,"cron"),f=Fu(r,"toolName");return c.jsxs("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsxs("span",{children:["Creating cron job",d?`: ${d}`:"..."]})]}),(u||f)&&c.jsxs("div",{className:"mt-1 opacity-80",children:[u?`schedule ${u}`:"",u&&f?" • ":"",f?`tool ${f}`:""]})]})}return r?c.jsxs("pre",{ref:n,className:Te("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:Te("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(Jt,{className:"h-3 w-3 animate-spin text-blue-400"}),c.jsx("span",{children:"Preparing..."})]})})}function moe(e){const r=new Map,n=new Set,i=new Map(e.map(s=>[s.callId,s]));for(const s of e){if(!s.parentCallId||!i.has(s.parentCallId))continue;const a=r.get(s.parentCallId)??[];r.set(s.parentCallId,[...a,s]),n.add(s.callId)}for(let s=0;s<e.length;s++){const a=e[s];if(ko(a.tool)!=="agent")continue;const o=[];for(let l=s+1;l<e.length;l++){const d=e[l];if(n.has(d.callId))continue;const u=a.status==="running"||a.status==="pending",f=a.completedAt!=null&&d.startedAt<=a.completedAt;if(u||f)o.push(d),n.add(d.callId);else break}if(o.length>0){const l=r.get(a.callId)??[];r.set(a.callId,[...l,...o])}}return{childMap:r,parentSet:n}}function goe(e){return e==="browserScreenshot"}function yoe(e){var a,o;const r=ko(e.tool),n=(a=e.result)!=null&&a.data&&typeof e.result.data=="object"?e.result.data:void 0,i=Qc(r,e.args,n),s=toe(r,i,n,(o=e.result)==null?void 0:o.message);return goe(roe({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 qKe({path:e,onOpenDiff:r,disabled:n}){const i=MN(e),s=!!r&&!n,a=c.jsxs(c.Fragment,{children:[c.jsx(Ka,{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:o=>{o.preventDefault(),o.stopPropagation(),r(e)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),o.stopPropagation(),r(e))},children:a}):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:a})}function GKe({status:e}){const r=e==="completed"?"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400":e==="error"||e==="interrupted"?"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400":e==="running"||e==="starting"?"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400":"border-border/70 bg-muted/45 text-muted-foreground",n=e==="completed"?ca:e==="error"||e==="interrupted"?rh:e==="running"||e==="starting"?Jt:_5;return c.jsxs("span",{className:Te("inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-2xs font-medium capitalize",r),children:[c.jsx(n,{className:Te("h-3 w-3",(e==="running"||e==="starting")&&"animate-spin")}),e]})}function KKe({items:e,resultMessage:r}){return e.length===0?c.jsx("div",{className:"rounded-md border border-border/60 bg-muted/25 px-3 py-2 text-xs text-muted-foreground",children:"No thread details available."}):c.jsxs("div",{className:"rounded-md border border-purple-500/20 bg-purple-500/[0.025] text-xs",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-purple-500/15 px-3 py-2",children:[c.jsxs("span",{className:"font-medium text-foreground",children:[e.length," thread",e.length===1?"":"s"]}),c.jsxs("span",{className:"text-muted-foreground",children:[e.filter(n=>n.status==="completed").length," completed"]})]}),c.jsx("div",{className:"divide-y divide-border/35",children:e.map((n,i)=>{const s=n.id?n.id.slice(-8):null,a=n.branch??(n.workingDirectory?MN(n.workingDirectory):null);return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate font-medium text-foreground",title:n.title,children:n.title}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-2xs text-muted-foreground",children:[s&&c.jsx("code",{className:"rounded bg-background/70 px-1 py-0.5 font-mono",children:s}),n.providerId&&c.jsx("span",{children:n.providerId}),n.kind&&c.jsx("span",{children:n.kind}),a&&c.jsx("span",{className:"min-w-0 truncate",children:a})]}),n.error&&c.jsx("div",{className:"mt-1 truncate text-2xs text-red-500",title:n.error,children:n.error})]}),c.jsx(GKe,{status:n.status})]},n.id??`${n.title}-${i}`)})}),r&&c.jsx("div",{className:"border-t border-purple-500/15 px-3 py-2 text-2xs text-muted-foreground",children:r})]})}function YKe({call:e,childCalls:r,onOpenTerminal:n,onOpenDiff:i,inlineSecretPrompt:s,renderInlineSecretPrompt:a,hideTopConnector:o=!1,hideBottomConnector:l=!1}){var ft,Vt,Kt,mt,Fe,Et,rr,Ce,Oe,Qe,ut,vt;const d=yoe(e),[u,f]=y.useState(e.status==="running"||e.status==="pending"||d),[p,g]=y.useState(()=>Date.now()),v=y.useRef(e.status),b=ko(e.tool),_=(ft=e.result)!=null&&ft.data&&typeof e.result.data=="object"?e.result.data:void 0,k=Qc(b,e.args,_),w=b==="mcp-tool"?ON(k,_):null,C=w?xKe(w.title):null,j=$P(b),A=(C==null?void 0:C.icon)??j.icon,N=(C==null?void 0:C.color)??j.color,E=jKe(b,k,_,(Vt=e.result)==null?void 0:Vt.message),P=t7(b,k),G=doe(e.result,b)||e.streamingOutput||"",D=typeof(_==null?void 0:_.snapshot)=="string"?_.snapshot:null,W=toe(b,k,_,(Kt=e.result)==null?void 0:Kt.message),B=b.startsWith("terminal.")||b==="execute"||b.startsWith("ssh.")||b==="run.ssh"||b==="elevated.run",z=LKe(e),O=WKe(e),$=O?s5(e):null,R=RKe(b,k),I=s??(a==null?void 0:a(e))??null,U=I!=null,Y=e.status==="pending",F=eoe(b,k,(mt=e.result)==null?void 0:mt.data,(Fe=e.result)==null?void 0:Fe.message).map(me=>me.trim()).filter(Boolean),V=F[0]??((rr=e7(b,k,_,(Et=e.result)==null?void 0:Et.message))==null?void 0:rr.trim())??"",Q=!!V&&SKe(b),q=AH(G),te=AH(e.streamingArgs),ne=roe({tool:b,args:k,status:e.status,displayOutput:G,snapshotText:D,screenshotPath:W}),se=goe(ne),pe=ne==="terminal"?!0:ne!=="none"&&!se,ee=ne==="threadList"?ioe(k,_,e.status):[],ae=U?!0:u,he=y.useCallback(me=>{U&&!me||f(me)},[U]),ke=e.status==="pending"||e.status==="running"?Jt:e.status==="success"?ca:rh,fe=e.status==="pending"?"text-blue-400":e.status==="running"?"text-muted-foreground":e.status==="success"?"text-green-500":"text-red-500",Ke=e.status==="error"?{row:"bg-red-500/[0.035] hover:bg-red-500/[0.06]",icon:"bg-red-500/10",connector:"bg-red-500/25",body:"bg-red-500/[0.025]"}:e.status==="success"?{row:"bg-card/58 hover:bg-muted/42",icon:"bg-emerald-500/[0.08]",connector:"bg-border/55",body:"bg-card/42"}:{row:"bg-primary/[0.045] hover:bg-primary/[0.075]",icon:"bg-primary/10",connector:"bg-primary/30",body:"bg-primary/[0.025]"};y.useEffect(()=>{const me=v.current;!se&&ne!=="threadList"&&(me==="running"||me==="pending")&&e.status!=="running"&&e.status!=="pending"&&f(!1),(e.status==="pending"||e.status==="running"||se||U)&&f(!0),v.current=e.status},[ne,e.status,U,se]),y.useEffect(()=>{var me;b!=="web"&&b!=="web.search"&&b!=="web.fetch"&&b!=="browser.search"&&b!=="browser.fetch"||console.debug("[tool-call-card:web]",{tool:e.tool,normalizedTool:b,callId:e.callId,status:e.status,rawArgs:e.args,normalizedArgs:k,resultMessage:(me=e.result)==null?void 0:me.message,resultData:_,streamingArgs:e.streamingArgs})},[e.args,e.callId,(Ce=e.result)==null?void 0:Ce.message,e.status,e.streamingArgs,e.tool,k,b,_]),y.useEffect(()=>{if(e.status!=="running"&&e.status!=="pending")return;const me=window.setInterval(()=>g(Date.now()),250);return()=>window.clearInterval(me)},[e.status]);const ce=vKe(b,k,_,(Oe=e.result)==null?void 0:Oe.message),qe=e.status==="running"||e.status==="pending"?ce.running:ce.done,pt=c.jsxs(c.Fragment,{children:[c.jsx(ke,{className:Te("h-4 w-4 shrink-0",fe,(e.status==="running"||e.status==="pending")&&"animate-spin")}),c.jsx("span",{className:"flex-1 truncate text-[13px] font-medium text-muted-foreground",children:Y?c.jsx(UKe,{tool:e.tool,streamingArgs:e.streamingArgs}):B?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:E,children:E})]}):Q?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[qe,":"]}),c.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",children:[c.jsx(qKe,{path:V,onOpenDiff:i,disabled:e.status!=="success"}),F.length>1&&c.jsxs("span",{className:"rounded border border-border/60 bg-muted/35 px-1.5 py-0.5 text-2xs text-muted-foreground",children:["+",F.length-1]})]})]}):w&&(w.title||w.details)?c.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[c.jsxs("span",{children:[qe,":"]}),c.jsxs("span",{className:"min-w-0 truncate",children:[w.title?c.jsx("code",{className:"text-[11px] font-mono",children:w.title}):null,w.title&&w.details?c.jsx("span",{className:"text-muted-foreground",children:" • "}):null,w.details?c.jsx("span",{className:"text-xs text-muted-foreground",children:w.details}):null]})]}):c.jsxs("span",{children:[qe,": ",c.jsx("code",{className:"text-[11px] font-mono",children:E})]})}),c.jsx("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:c.jsx(n7,{startedAt:e.startedAt,completedAt:e.completedAt,now:p})}),P&&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:P}),z&&c.jsx("span",{className:Te("rounded border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wide shrink-0",z.className),children:z.label})]}),Dt=ne==="pending"?c.jsx(VKe,{tool:e.tool,streamingArgs:e.streamingArgs,scrollRef:te}):ne==="terminal"?c.jsxs("pre",{ref:q,className:Te("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-72 overflow-y-auto whitespace-pre","bg-zinc-950 text-zinc-100 shadow-inner ring-1 ring-border/40",e.result&&!e.result.ok&&"text-red-200"),children:[!G&&e.status!=="running"&&c.jsxs("span",{className:"text-zinc-400",children:[c.jsx("span",{className:"text-emerald-400",children:"$ "}),E]}),G,e.status==="running"&&!G&&c.jsx("span",{className:"text-zinc-400",children:"Running..."}),e.status==="running"&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-zinc-100 animate-pulse ml-0.5 align-text-bottom"})]}):ne==="browserSnapshot"?c.jsx(FKe,{snapshot:D}):ne==="browserScreenshot"?c.jsx(HKe,{path:W}):ne==="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(Jt,{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(me=>c.jsx(vp,{call:me,onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:a},me.callId))}),((Qe=e.result)==null?void 0:Qe.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(zKe,{data:_??{},message:(ut=e.result)==null?void 0:ut.message,status:e.status}):ne==="threadList"?c.jsx(KKe,{items:ee,resultMessage:(vt=e.result)==null?void 0:vt.message}):ne==="editDiff"?c.jsx(lKe,{filePath:String(k.path??""),oldText:b==="file.patch"||b==="edit"&&k.search!=null?String(k.search??""):void 0,newText:b==="file.patch"||b==="edit"&&k.replace!=null?String(k.replace??""):void 0,writtenContent:b==="file.write"||b==="edit"&&k.content!=null?String(k.content??""):void 0,isNewFile:b==="file.write"}):ne==="output"?c.jsx(BKe,{output:G,tool:b,isError:!!e.result&&!e.result.ok,isRunning:e.status==="running"}):ne==="runningHint"?c.jsxs("div",{className:Te("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(Jt,{className:"h-3 w-3 animate-spin"}),c.jsx("span",{children:R})]}),c.jsxs("div",{className:"mt-1 text-xs opacity-75",children:["Elapsed: ",c.jsx(n7,{startedAt:e.startedAt,completedAt:e.completedAt,now:p})]})]}):null;return c.jsxs(zS,{open:pe?ae:!1,onOpenChange:he,children:[c.jsxs("div",{className:"relative pl-8",children:[!o&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 h-6 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, transparent 0 22px, #000 22px 100%)"},"aria-hidden":"true"}),!l&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 bottom-0 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 23px, #000 23px 100%)"},"aria-hidden":"true"}),l&&!o&&c.jsx("span",{className:Te("absolute left-[12.5px] top-0 bottom-0 w-px",Ke.connector),style:{maskImage:"linear-gradient(to bottom, #000 0 5px, transparent 5px 100%)"},"aria-hidden":"true"}),c.jsx("div",{className:Te("absolute left-[3px] top-[7px] z-10 flex h-5 w-5 items-center justify-center rounded-md shadow-sm ring-2 ring-background",Ke.icon),children:c.jsx(A,{className:Te("h-3.5 w-3.5 shrink-0",N)})}),c.jsx("div",{className:"group pb-1",children:c.jsxs("div",{className:Te("flex min-h-9 items-center gap-2 rounded-md px-2 py-1.5 transition-colors",Ke.row),children:[pe?c.jsxs(FS,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx(Is,{className:Te("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",ae&&"rotate-90")}),pt]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[c.jsx("span",{className:"h-3 w-3 shrink-0"}),pt]}),O&&n&&c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:me=>{me.preventDefault(),me.stopPropagation(),n($)},children:c.jsx(wp,{className:"h-3.5 w-3.5"})})}),c.jsx(hn,{side:"top",children:"Open terminal"})]}),ne==="editDiff"&&i&&e.status==="success"&&V&&c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:me=>{me.preventDefault(),me.stopPropagation(),i(V)},children:c.jsx(wp,{className:"h-3.5 w-3.5"})})}),c.jsx(hn,{side:"top",children:"Open diff in editor"})]})]})})]}),pe&&c.jsx(HS,{children:c.jsx("div",{className:Te("ml-8 mr-3 mb-2 rounded-md px-3 py-2",Ke.body),children:Dt})}),se&&c.jsx("div",{className:Te("ml-8 mr-3 mb-2 rounded-md px-3 py-2",Ke.body),children:Dt}),U&&c.jsx("div",{className:"ml-6 mr-1.5 mb-2 rounded-md bg-yellow-500/[0.035] px-2.5 py-2 ring-1 ring-yellow-500/15 sm:ml-8 sm:mr-3 sm:px-3",children:c.jsx("div",{className:"rounded-md bg-background/35 px-2.5 py-2 sm:px-3",children:I})})]})}const vp=y.memo(YKe);vp.displayName="ToolCallCard";const voe=3,sv=6;function xoe(e,r){return!!r&&e.some(n=>r(n)!=null)}function XKe(e,r){if(!r||e.some(yoe))return!1;const n=e.filter(i=>i.status!=="running"&&i.status!=="pending");return n.length>=voe&&n.length===e.length}function JKe({calls:e,collapsible:r,onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s}){const[a,o]=y.useState(!1),[l,d]=y.useState(()=>!XKe(e,r)),u=y.useRef(!1),{childMap:f,parentSet:p}=y.useMemo(()=>moe(e),[e]),g=y.useMemo(()=>e.filter(D=>!p.has(D.callId)),[e,p]),v=g.filter(D=>D.status==="running"||D.status==="pending"),b=g.filter(D=>D.status!=="running"&&D.status!=="pending"),_=v.length===0&&b.length>0,k=xoe(e,s),w=r&&!k&&_&&b.length>=voe;if(y.useEffect(()=>{if(k){d(!0);return}w&&!u.current&&d(!1),u.current=_},[_,k,w]),e.length===0)return null;const C=b.filter(D=>D.status==="success").length,j=b.filter(D=>D.status==="error").length,A=soe(b);if(w&&!l)return c.jsx("div",{className:"my-2",children:c.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:r7(b)}),C>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-green-500",children:[c.jsx(ca,{className:"h-3 w-3"})," ",C]}),j>0&&c.jsxs("span",{className:"inline-flex items-center gap-0.5 text-red-500",children:[c.jsx(rh,{className:"h-3 w-3"})," ",j]})]})});const N=!a&&b.length>sv,E=N?b.length-sv:0,P=N?b.slice(-sv):b,H=N?b.slice(0,E).filter(D=>D.status==="success").length:0,G=E-H;return c.jsxs("div",{className:"my-2",children:[w&&c.jsxs("button",{type:"button",onClick:()=>d(!1),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3 rotate-90 transition-transform"}),c.jsxs("span",{children:["Collapse ",r7(b)]})]}),N&&c.jsxs("button",{type:"button",onClick:()=>o(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3"}),c.jsxs("span",{children:[E," earlier tool call",E!==1?"s":"",H>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",H," passed)"]}),G>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",G," failed)"]})]})]}),a&&b.slice(0,E).map((D,W,B)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:W===0,hideBottomConnector:W===B.length-1&&P.length===0&&v.length===0},D.callId)),P.map((D,W)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:a?!1:W===0,hideBottomConnector:W===P.length-1&&v.length===0},D.callId)),v.map((D,W)=>c.jsx(vp,{call:D,childCalls:f.get(D.callId),onOpenTerminal:n,onOpenDiff:i,renderInlineSecretPrompt:s,hideTopConnector:b.length===0&&W===0,hideBottomConnector:W===v.length-1},D.callId))]})}function boe(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 s7=y.memo(JKe,(e,r)=>e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.renderInlineSecretPrompt===r.renderInlineSecretPrompt&&e.collapsible===r.collapsible&&boe(e.calls,r.calls));s7.displayName="ToolCallGroup";function PH(e,r){return r?!1:e.length>0&&e.every(n=>n.status!=="running"&&n.status!=="pending")}function ZKe({provider:e,calls:r,isStreaming:n,onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a}){const[o,l]=y.useState(()=>!PH(r,n)),[d,u]=y.useState(!1),[f,p]=y.useState(()=>Date.now()),g=y.useRef(!PH(r,n)),v=!!n||r.some(R=>R.status==="running"||R.status==="pending"),b=xoe(r,a),_=b?!0:o,k=y.useCallback(R=>{b&&!R||l(R)},[b]),w=r.filter(R=>R.status==="success").length,C=r.filter(R=>R.status==="error").length,j=r.length>0?Math.min(...r.map(R=>R.startedAt)):Date.now(),A=!v&&r.length>0?Math.max(...r.map(R=>R.completedAt??R.startedAt)):void 0,N=soe(r),{childMap:E,parentSet:P}=y.useMemo(()=>moe(r),[r]),H=y.useMemo(()=>r.filter(R=>!P.has(R.callId)),[r,P]),G=H.filter(R=>R.status==="running"||R.status==="pending"),D=H.filter(R=>R.status!=="running"&&R.status!=="pending"),W=!d&&D.length>sv,B=W?D.length-sv:0,z=W?D.slice(-sv):D,O=W?D.slice(0,B).filter(R=>R.status==="success").length:0,$=B-O;return y.useEffect(()=>{if(b){l(!0),g.current=v;return}g.current&&!v&&r.length>0&&l(!1),g.current=v},[b,v,r.length]),y.useEffect(()=>{if(!v)return;const R=window.setInterval(()=>p(Date.now()),250);return()=>window.clearInterval(R)},[v]),r.length===0?null:c.jsx(zS,{open:_,onOpenChange:k,children:c.jsxs("div",{className:"my-2",children:[c.jsxs(FS,{className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:Te("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",_&&"rotate-90")}),v?c.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground animate-spin"}):c.jsx(N,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:r7(r)}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-muted-foreground tabular-nums shrink-0",children:[!v&&C>0&&c.jsxs("span",{className:"text-red-500",children:[C," failed"]}),c.jsx(n7,{startedAt:j,completedAt:A,now:f})]}),!v&&C===0&&w>0&&c.jsx(ca,{className:"h-3.5 w-3.5 shrink-0 text-green-500"}),!v&&C>0&&c.jsx(rh,{className:"h-3.5 w-3.5 shrink-0 text-red-500"})]}),c.jsx(HS,{children:c.jsxs("div",{className:"mt-1",children:[W&&c.jsxs("button",{type:"button",onClick:()=>u(!0),className:"mb-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/35",children:[c.jsx(Is,{className:"h-3 w-3"}),c.jsxs("span",{children:[B," earlier tool call",B!==1?"s":"",O>0&&c.jsxs("span",{className:"text-green-500 ml-1",children:["(",O," passed)"]}),$>0&&c.jsxs("span",{className:"text-red-500 ml-1",children:["(",$," failed)"]})]})]}),d&&D.slice(0,B).map((R,I,U)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:I===0,hideBottomConnector:I===U.length-1&&z.length===0&&G.length===0},R.callId)),z.map((R,I)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:d?!1:I===0,hideBottomConnector:I===z.length-1&&G.length===0},R.callId)),G.map((R,I)=>c.jsx(vp,{call:R,childCalls:E.get(R.callId),onOpenTerminal:i,onOpenDiff:s,renderInlineSecretPrompt:a,hideTopConnector:D.length===0&&I===0,hideBottomConnector:I===G.length-1},R.callId))]})})]})})}const a7=y.memo(ZKe,(e,r)=>e.provider===r.provider&&e.isStreaming===r.isStreaming&&e.onOpenTerminal===r.onOpenTerminal&&e.onOpenDiff===r.onOpenDiff&&e.renderInlineSecretPrompt===r.renderInlineSecretPrompt&&boe(e.calls,r.calls));a7.displayName="AgentToolCallWrapper";function LH(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 xp(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 QKe(e){return"content"in e?xp(e.content):xp(e)}function eYe(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:{},a=s.function&&typeof s.function=="object"?s.function:{};return{id:xp(s.id||s.call_id||s.tool_call_id||`tool-call-${i+1}`),name:xp(a.name||s.name||s.tool||"tool"),args:xp(a.arguments||s.arguments||s.args||{})}})}function tYe(e,r){const n=e&&typeof e=="object"?e:{},i=n.function&&typeof n.function=="object"?n.function:{};return{name:xp(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 _oe(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Dm(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $H({badge:e,meta:r,preview:n,children:i,tone:s="default",defaultOpen:a=!1,onOpenChange:o}){const[l,d]=y.useState(a);return c.jsx(zS,{open:l,onOpenChange:u=>{d(u),o==null||o()},children:c.jsxs("div",{className:Te("rounded-md border p-3",s==="assistant"?"border-emerald-500/25 bg-emerald-500/10":"border-border/80 bg-background"),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs(FS,{className:"mt-0.5 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground",children:[c.jsx(Is,{className:Te("h-4 w-4 transition-transform",l&&"rotate-90")}),c.jsx("span",{className:"sr-only",children:l?"Collapse section":"Expand section"})]}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e,r]}),n?c.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:n}):null]})]}),c.jsx(HS,{className:"pl-6",children:c.jsx("div",{className:"pt-3",children:i})})]})})}function rYe({flow:e}){const r=e.rounds;if(!r.some(p=>p.metrics))return null;let i=0,s=0,a=0,o=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&&(a+=g.completionTokens),g.totalTokens&&(o+=g.totalTokens),g.tokensPerSecond&&g.completionTokens&&(d+=g.tokensPerSecond*g.completionTokens,u+=g.completionTokens),g.contextUsage&&(l=g.contextUsage))}const f=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(gg,{className:"h-3 w-3"}),"Total Duration"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:_oe(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(iA,{className:"h-3 w-3"}),"Tokens"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:o>0?Dm(o):s+a>0?Dm(s+a):"—"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[s>0?`${Dm(s)} in`:"",s>0&&a>0?" · ":"",a>0?`${Dm(a)} out`:"",s===0&&a===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(iY,{className:"h-3 w-3"}),"Speed"]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-foreground",children:f?`${f} 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(G0e,{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:[Dm(l.total)," / ",Dm(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 nYe({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:_oe(e.durationMs)}),e.promptTokens!=null&&c.jsxs("span",{title:"Prompt tokens",children:[Dm(e.promptTokens)," prompt"]}),e.completionTokens!=null&&c.jsxs("span",{title:"Completion tokens",children:[Dm(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 iYe(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:[],a=Array.isArray(i.tools)?i.tools.map(tYe):[];n.push({id:`round-${i.round}`,kind:"round",round:i,messageCount:s.length,toolCount:a.length}),s.forEach((o,l)=>{const d=o&&typeof o=="object"?o:{content:o};n.push({id:`round-${i.round}-message-${l}`,kind:"message",roundNumber:i.round,index:l,role:xp(d.role||"message"),content:QKe(d),raw:o,toolCalls:eYe(d)})}),a.length>0&&n.push({id:`round-${i.round}-tools`,kind:"tools",roundNumber:i.round,tools:a})}return r&&n.push({id:"assistant-response",kind:"response",content:r}),n}function sYe({row:e,onExpandChange:r}){if(e.kind==="summary")return c.jsx(rYe,{flow:e.flow});if(e.kind==="round")return c.jsxs("div",{className:"min-w-0 overflow-hidden rounded-md border border-border bg-background px-3 py-2",children:[c.jsxs("div",{className:"flex min-w-0 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:"min-w-0 break-words text-xs text-muted-foreground",children:e.round.model}),c.jsx("span",{className:"min-w-0 break-words text-xs text-muted-foreground",children:new Date(e.round.createdAt).toLocaleString()})]}),c.jsxs("div",{className:"mt-2 flex min-w-0 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",{className:"min-w-0 break-words",children:["tool_choice: ",e.round.tool_choice]}):null]}),c.jsx(nYe,{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(pR,{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(i=>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:i.name}),i.description?c.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:i.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:xp(i.raw)})]},i.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.jsx($H,{tone:"assistant",defaultOpen:!1,onOpenChange:r,badge:c.jsx("span",{className:Te("rounded-md border px-2 py-0.5 text-xs font-semibold",LH("assistant")),children:"assistant response"}),meta:c.jsx("span",{className:"text-xs text-muted-foreground",children:"rendered chat answer"}),preview:c.jsx("span",{className:"block truncate",children:e.content||"(empty response)"}),children: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 n=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($H,{defaultOpen:!1,onOpenChange:r,badge:c.jsx("span",{className:Te("rounded-md border px-2 py-0.5 text-xs font-semibold",LH(e.role)),children:e.role}),meta:c.jsxs(c.Fragment,{children:[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]}),preview:c.jsx("span",{className:"block truncate",children:n}),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(i=>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: ",i.name," ",c.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",i.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:i.args||"{}"})]},i.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:xp(e.raw)})]})]})]})}function aYe({open:e,rows:r,contextFlow:n}){const i=y.useRef(null),s=$R({count:r.length,getScrollElement:()=>i.current,estimateSize:o=>{const l=r[o];return l?l.kind==="summary"?110:l.kind==="round"?120:l.kind==="tools"?Math.min(420,110+l.tools.length*72):l.kind==="response"?72:52:120},overscan:5,enabled:e});y.useEffect(()=>{if(!e)return;const o=window.requestAnimationFrame(()=>{s.measure()});return()=>window.cancelAnimationFrame(o)},[e,r.length,s]);const a=()=>{window.requestAnimationFrame(()=>{s.measure()})};return c.jsxs("div",{className:"flex h-full min-h-0 flex-col px-3 pb-3 pt-2",children:[n!=null&&n.note?c.jsx("p",{className:"mb-2 shrink-0 rounded-md border border-border/70 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground",children:n.note}):null,r.length>0?c.jsx("div",{ref:i,className:"min-h-0 flex-1 overflow-auto pr-2",children:c.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},children:s.getVirtualItems().map(o=>{const l=r[o.index];return l?c.jsx("div",{"data-index":o.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${o.start}px)`},children:c.jsx(sYe,{row:l,onExpandChange:a})},l.id):null})})}):c.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:[c.jsx(op,{className:"mr-2 h-4 w-4"}),"No context snapshot is available for this message."]})]})}function oYe({rawText:e}){const r=qS(),n=e||"No context snapshot is available for this message.";return c.jsx("div",{className:"h-full min-h-0 p-3 pt-2",children:c.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border border-border/70 bg-background",children:c.jsx(GS,{height:"100%",language:e?"json":"plaintext",beforeMount:i=>cc(i,r),theme:r,value:n,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,automaticLayout:!0,wordWrap:"on",fontSize:12,lineHeight:18,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,renderLineHighlight:"none",overviewRulerLanes:0,tabSize:2}})})})}function lYe({open:e,onOpenChange:r,contextFlow:n,responseContent:i}){const[s,a]=y.useState("trace"),[o,l]=y.useState(!1),d=y.useMemo(()=>iYe(n,i),[n,i]),u=y.useMemo(()=>n?JSON.stringify(n,null,2):"",[n]),f=async()=>{u&&(await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1200))};return c.jsx(iu,{open:e,onOpenChange:r,children:c.jsxs(uc,{showCloseButton:!1,className:"grid h-[95vh] w-[calc(100dvw-1rem)] max-w-[1200px] grid-rows-[auto_minmax(0,1fr)] overflow-hidden p-0 sm:h-[85vh] sm:w-[96vw]",children:[c.jsx(nd,{className:"border-b px-3 py-2",children:c.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx(dc,{className:"truncate text-sm font-semibold",children:"LLM Context Flow"}),c.jsx(nf,{className:"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:"-my-1 flex shrink-0 items-center gap-1 p-1",children:[c.jsx(we,{type:"button",variant:s==="trace"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a("trace"),children:"Trace"}),c.jsx(we,{type:"button",variant:s==="raw"?"default":"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a("raw"),children:"Raw"}),c.jsxs(we,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:f,disabled:!u,children:[o?c.jsx(ks,{className:"h-3 w-3 sm:mr-1"}):c.jsx(Kc,{className:"h-3 w-3 sm:mr-1"}),c.jsx("span",{className:"hidden sm:inline",children:o?"Copied":"Copy"}),c.jsx("span",{className:"sr-only",children:o?"Copied":"Copy raw trace"})]}),c.jsxs(rR,{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(Gn,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),s==="trace"?c.jsx(aYe,{open:e,rows:d,contextFlow:n},"trace-list"):c.jsx(oYe,{rawText:u})]})})}const o7=/^[A-Za-z]:[\\/]/,cYe=/^\//;function DH(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function uYe(e){const r=e.pathname||"/",n=/^\/[A-Za-z]:\//.test(r)?r.slice(1):r;return!e.hostname||e.hostname==="localhost"?n:`//${e.hostname}${n}`}function woe(e){return o7.test(e)||cYe.test(e)}function Soe(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]+(?::\d+(?::\d+)?)?$/.test(i)}function dYe(e,r){if(r)return null;const n=e.replace(/\\/g,"/"),i=n.lastIndexOf("/"),a=(i>=0?n.slice(i+1):n).match(/^(.*?):(\d+)(?::(\d+))?$/);if(!a)return null;const o=i>=0?`${e.slice(0,i+1)}${a[1]??""}`:a[1]??"";if(!woe(o)||!Soe(o,`L${a[2]}`))return null;const l={path:o,line:Number.parseInt(a[2],10)};return a[3]&&(l.column=Number.parseInt(a[3],10)),l}function hYe(e){if(!e)return null;const r=e.trim();if(!r)return null;let n=r,i="";try{const d=new URL(r);if(d.protocol==="http:"||d.protocol==="https:"){if(n=d.pathname,i=d.hash.startsWith("#")?d.hash.slice(1):d.hash,!Soe(n,i))return null}else if(d.protocol==="file:")n=uYe(d),i=d.hash.startsWith("#")?d.hash.slice(1):d.hash;else{const u=r.indexOf("#");u>=0&&(n=r.slice(0,u),i=r.slice(u+1))}}catch{const d=r.indexOf("#");d>=0&&(n=r.slice(0,d),i=r.slice(d+1))}let s;try{s=decodeURIComponent(n)}catch{return null}const a=dYe(s,i);if(a)return a;if(!woe(s))return null;const o={path:s},l=i.match(/^L(\d+)(?:C(\d+))?$/i);return l&&(o.line=Number.parseInt(l[1],10),l[2]&&(o.column=Number.parseInt(l[2],10))),o}function IH(e,r){if(!r)return!1;const n=DH(e),i=DH(r);if(!n||!i)return!1;const s=o7.test(n)?n.toLowerCase():n,a=o7.test(i)?i.toLowerCase():i;return s===a||s.startsWith(`${a}/`)}function fYe(e){return e.content.length>0||e.userDisplayText.length>0||e.userDisplaySegments.length>0||e.imageAttachmentCount>0}const pYe=3;function BH(e,r){return!!(e&&e!=="jait"&&r.length>=pYe)}const zH=/<pre[^>]*><code>([\s\S]*)<\/code><\/pre>/;function FH(){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 mYe(e){const r=e.toLowerCase();return!r||r==="text"||r==="plain"?"txt":r==="shell"||r==="sh"?"bash":r}function gYe({code:e,language:r,className:n}){const[i,s]=y.useState(null);return y.useEffect(()=>{let a=!1;const o=setTimeout(()=>{(async()=>{var f,p;const d=document.documentElement.classList.contains("dark")?"github-dark":"github-light",u=mYe(r);try{const g=await jB(e,{lang:u,theme:d});if(a)return;s(((f=g.match(zH))==null?void 0:f[1])??null)}catch{try{const g=await jB(e,{lang:"txt",theme:d});if(a)return;s(((p=g.match(zH))==null?void 0:p[1])??null)}catch{a||s(null)}}})()},150);return()=>{a=!0,clearTimeout(o)}},[e,r]),i?c.jsx("code",{className:Te(n,"whitespace-pre"),dangerouslySetInnerHTML:{__html:i}}):c.jsx("code",{className:Te(n,"whitespace-pre"),children:e})}function koe(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 yYe(e){const r=e.replace(/\\/g,"/"),n=r.split("/");return n[n.length-1]??r}function vYe({href:e,target:r,onOpenPath:n}){const i=yYe(r.path),s=r.line?`L${r.line}${r.column?`:${r.column}`:""}`:null;return c.jsxs("a",{href:e,className:Te("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:a=>{a.preventDefault(),n(r.path,r.line,r.column)},children:[c.jsx(Ka,{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 Coe(e){return{pre:({children:r})=>c.jsx(c.Fragment,{children:r}),code:({node:r,className:n,children:i,ref:s,...a})=>{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",f=String(i??"").replace(/\n$/,"");return c.jsxs(kEe,{code:f,language:u,children:[c.jsxs(CEe,{children:[c.jsx(jEe,{children:c.jsx(NEe,{children:u})}),c.jsx(TEe,{children:c.jsx(EEe,{})})]}),c.jsx("div",{className:"overflow-x-auto px-3 py-2 text-sm",children:c.jsx(gYe,{code:f,language:u,className:n})})]})}return c.jsx("code",{className:Te("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)]"),...a,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=hYe(r);return s?c.jsx(vYe,{href:r,target:s,onOpenPath:e}):c.jsx("a",{href:r,...i,children:i.children})},img:({src:r,alt:n,ref:i,...s})=>{const a=typeof r=="string"?Xae(r):null;return a?c.jsx("a",{href:a,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:a,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 xYe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Coe(n),[n]);return c.jsx("div",{className:koe(),children:c.jsx(jZ,{remarkPlugins:[NZ],components:i,children:e})})}function bYe({content:e,compact:r,onOpenPath:n}){const i=y.useMemo(()=>Coe(n),[n]),s=({blockMatch:o})=>c.jsx(jZ,{remarkPlugins:[NZ],components:i,children:o.output}),{blockMatches:a}=m4e({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:i4e()},isStreamFinished:!1});return c.jsx("div",{className:koe(),children:a.map((o,l)=>{const d=o.block.component;return c.jsx(d,{blockMatch:o},l)})})}const l7=y.memo(function({content:r,compact:n,isStreaming:i,preferLlmUi:s,onOpenPath:a}){return s&&i?c.jsx(bYe,{content:r,compact:n,onOpenPath:a}):c.jsx(xYe,{content:r,compact:n,onOpenPath:a})});l7.displayName="AssistantMarkdown";function _Ye({messageId:e,messageIndex:r,messageFromEnd:n,role:i,content:s,contextFlow:a,displayContent:o,referencedFiles:l,displaySegments:d,attachments:u,thinking:f,thinkingDuration:p,toolCalls:g,segments:v,isStreaming:b,compact:_,preferLlmUi:k,provider:w,onOpenTerminal:C,renderInlineSecretPrompt:j,onEditMessage:A,editComposer:N,onOpenPath:E,onOpenDiff:P}){const H=i==="user",{userDisplayText:G,userDisplaySegments:D}=y.useMemo(()=>{if(!H)return{userDisplayText:s,userDisplaySegments:[]};if(d!=null&&d.length)return{userDisplayText:I0(d),userDisplaySegments:d};if(o){const He=V5(o,l);return{userDisplayText:o,userDisplaySegments:He}}const me=zA(s);return{userDisplayText:me.text,userDisplaySegments:me.displaySegments}},[H,s,o,l,d]),[W,B]=y.useState(!1),[z,O]=y.useState(!1),[$,R]=y.useState(!1),[I,U]=y.useState(!1),[Y,F]=y.useState(!1),[V,Q]=y.useState(!1),[q,te]=y.useState(""),[ne,se]=y.useState([]),[pe,ee]=y.useState(null),[ae,he]=y.useState(null),ke=y.useMemo(()=>{if(!H)return[];const me=Ks(ae??D).flatMap(He=>He.type==="image"?[{name:He.name,mimeType:He.mimeType,data:He.data,preview:`data:${He.mimeType};base64,${He.data}`}]:[]);return me.length>0?me:u??[]},[u,H,ae,D]),fe=H&&fYe({content:s,userDisplayText:pe??G,userDisplaySegments:ae??D,imageAttachmentCount:ke.length}),Ke=y.useRef(null),ce=y.useRef(null),nt=y.useRef(null);y.useEffect(()=>()=>{Ke.current!==null&&window.clearTimeout(Ke.current)},[]),y.useEffect(()=>{$||(te(G),se(D))},[$,D,G]),y.useEffect(()=>{if(!ae&&pe==null)return;const me=pe===G,He=ae===D||JSON.stringify(ae??[])===JSON.stringify(D);me&&He&&(ee(null),he(null))},[ae,pe,D,G]),y.useEffect(()=>{var He;if(!$){U(!1);return}const me=window.requestAnimationFrame(()=>{U(!0)});return(He=nt.current)==null||He.focus(),()=>window.cancelAnimationFrame(me)},[$]);const qe=()=>{var He;const me=[];if(g&&g.length>0)for(const be of g){const Pe=be.tool.replace(/_/g,"."),Ge=Object.entries(be.args).filter(([,st])=>st!=null&&st!=="").map(([st,Pt])=>`${st}: ${typeof Pt=="string"?Pt:JSON.stringify(Pt)}`).join(", "),Ee=be.status==="success"?"✓":be.status==="error"?"✗":"…",Nt=be.completedAt&&be.startedAt?hoe(be.startedAt,be.completedAt):"";if(me.push(`[${Ee} ${Pe}] ${Ge}`),(He=be.result)!=null&&He.message){const st=be.result.message.length>500?be.result.message.slice(0,500)+"…":be.result.message;me.push(st)}Nt&&me.push(`Duration: ${Nt}`),me.push("")}return s&&me.push(H?bQ(D)||G:s),me.join(`
1203
1203
  `).trim()},pt=async()=>{const me=qe();if(!me)return;const He=H?_Q(D):null;try{He&&typeof ClipboardItem<"u"&&navigator.clipboard.write?await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([me],{type:"text/plain"}),[U5]:new Blob([He],{type:U5})})]):await navigator.clipboard.writeText(me)}catch{const be=document.createElement("textarea");be.value=me,be.style.position="fixed",be.style.opacity="0",document.body.appendChild(be),be.focus(),be.select(),document.execCommand("copy"),document.body.removeChild(be)}B(!0),Ke.current!==null&&window.clearTimeout(Ke.current),Ke.current=window.setTimeout(()=>B(!1),1200)},Dt=H&&!!e&&!!A,ft=Dt,Vt=b&&!f&&!(typeof s=="string"?s:"").trim(),Kt=H||!b,mt=y.useCallback(()=>{!Dt||Y||(te(G),se(D),R(!0))},[Dt,Y,D,G]),Fe=y.useCallback(()=>{te(G),se(D),R(!1)},[D,G]),Et=()=>{var He;!Dt||$||typeof window<"u"&&(He=window.getSelection())!=null&&He.toString().trim()||mt()},rr=y.useCallback(async(me,He)=>{if(!Dt||!e||!A||Y)return;const be=r8e(me??q,He??ne,D);if(be){ee(be.text),he(be.displaySegments),R(!1),F(!0);try{await A(e,be.text,r,n,{referencedFiles:be.referencedFiles,displaySegments:be.displaySegments})}catch(Pe){throw ee(null),he(null),R(!0),Pe}finally{F(!1)}}},[Dt,q,ne,Y,e,n,r,A]),Ce=async(me,He)=>{if(!Dt||!e||!A)return;const be=me.trim();be&&await A(e,be,r,n,{referencedFiles:(He??D).filter(Pe=>Pe.type==="file").map(Pe=>({path:Pe.path,name:Pe.name})),displaySegments:He??D})},Oe=async()=>{if(ft){O(!0);try{await Ce(G,D)}finally{O(!1)}}},Qe=me=>$||!Kt||!s?null:c.jsx("div",{className:Te("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",W&&"opacity-100"),children:c.jsxs(OEe,{children:[Dt?c.jsx(AC,{onClick:mt,"aria-label":"Edit message",tooltip:"Edit message",className:"h-6 w-6",children:c.jsx(fR,{className:"h-3.5 w-3.5"})}):null,ft?c.jsx(AC,{onClick:He=>{He.preventDefault(),He.stopPropagation(),Oe()},disabled:z,"aria-label":"Retry from this message",tooltip:"Retry from this message",className:"h-6 w-6",children:c.jsx(tY,{className:Te("h-3.5 w-3.5",z&&"animate-spin")})}):null,!H&&a?c.jsx(AC,{onClick:He=>{He.preventDefault(),He.stopPropagation(),Q(!0)},"aria-label":"View LLM context",tooltip:"View LLM context",className:"h-6 w-6",children:c.jsx(qh,{className:"h-3.5 w-3.5"})}):null,c.jsx(AC,{onClick:pt,"aria-label":W?"Copied":"Copy message",tooltip:W?"Copied":"Copy message",className:"h-6 w-6",children:W?c.jsx(ks,{className:"h-3.5 w-3.5"}):c.jsx(Kc,{className:"h-3.5 w-3.5"})})]})}),ut=H?null:Qe(),vt=!H&&(v==null?void 0:v.some(me=>me.type==="thinking"&&me.content.trim()));return c.jsxs(c.Fragment,{children:[c.jsx(AEe,{from:i,className:Te(_?"py-2":"py-4"),children:c.jsxs("div",{className:Te("min-w-0 max-w-[85%] space-y-2",H&&"order-1"),children:[!H&&f&&!vt&&c.jsx(RB,{content:f,isStreaming:!!b&&!s,duration:p}),!H&&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((me,He)=>{if(me.type==="toolGroup"){const be=(g??[]).filter(Ge=>me.callIds.includes(Ge.callId)),Pe=v.slice(He+1).some(Ge=>Ge.type==="text"&&typeof Ge.content=="string"&&Ge.content.trim());return be.length>0?BH(w,be)?c.jsx(a7,{provider:w,calls:be,isStreaming:!!b&&He===v.length-1,onOpenTerminal:C,onOpenDiff:P,renderInlineSecretPrompt:j},`tg-${He}`):c.jsx(s7,{calls:be,collapsible:Pe,onOpenTerminal:C,onOpenDiff:P,renderInlineSecretPrompt:j},`tg-${He}`):null}return me.type==="thinking"?me.content.trim()?c.jsx(RB,{content:me.content,isStreaming:!!b&&He===v.length-1,duration:p},`th-${He}`):null:me.type==="error"?c.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3 py-2.5 text-sm text-red-600 dark:text-red-400",children:[c.jsx(X1,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:me.content})]},`err-${He}`):typeof me.content=="string"&&me.content.trim()?c.jsx(MT,{"data-message-from":"assistant",className:"max-w-full bg-card/78",children:c.jsx(l7,{content:me.content,compact:_,isStreaming:!!b&&He===v.length-1,preferLlmUi:k,onOpenPath:E})},`ts-${He}`):null}),b&&!s&&!v.some(me=>me.type==="text"&&typeof me.content=="string"&&me.content.trim())&&c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(FH,{})}),ut]}):c.jsxs(c.Fragment,{children:[g&&g.length>0&&(BH(w,g)?c.jsx(a7,{provider:w,calls:g,isStreaming:b,onOpenTerminal:C,onOpenDiff:P,renderInlineSecretPrompt:j}):c.jsx(s7,{calls:g,collapsible:w!=="jait",onOpenTerminal:C,onOpenDiff:P,renderInlineSecretPrompt:j})),fe||s?H?$?c.jsx("div",{className:"w-full max-w-3xl",onClick:me=>me.stopPropagation(),children:c.jsx("div",{className:Te("space-y-3 origin-bottom transition-all duration-150 ease-out",I?"translate-y-0 opacity-100":"translate-y-2 opacity-0"),children:c.jsx(b_,{ref:nt,draftStateKey:`edit:${e??"user-message"}`,value:q,segments:ne,onChange:me=>{var He;te(me),se(((He=nt.current)==null?void 0:He.getSegments())??[])},onSubmit:(me,He,be)=>{const Pe=be??[],Ge=I0(Pe)||q;se(Pe),rr(Ge,Pe)},disabled:Y,controlsDisabled:Y,placeholder:"Edit message...",onVoiceInput:N==null?void 0:N.onVoiceInput,voiceRecording:N==null?void 0:N.voiceRecording,voiceLevels:N==null?void 0:N.voiceLevels,voiceTranscribing:N==null?void 0:N.voiceTranscribing,onVoiceStop:N==null?void 0:N.onVoiceStop,mode:N==null?void 0:N.mode,onModeChange:N==null?void 0:N.onModeChange,provider:N==null?void 0:N.provider,onProviderChange:N==null?void 0:N.onProviderChange,responseStyle:N==null?void 0:N.responseStyle,onResponseStyleChange:N==null?void 0:N.onResponseStyleChange,providerRuntimeMode:N==null?void 0:N.providerRuntimeMode,onProviderRuntimeModeChange:N==null?void 0:N.onProviderRuntimeModeChange,cliModel:N==null?void 0:N.cliModel,onCliModelChange:N==null?void 0:N.onCliModelChange,sessionInfo:N==null?void 0:N.sessionInfo,workspaceNodeId:N==null?void 0:N.workspaceNodeId,availableFiles:(N==null?void 0:N.availableFiles)??B0(D),onSearchFiles:N==null?void 0:N.onSearchFiles,workspaceOpen:(N==null?void 0:N.workspaceOpen)??B0(D).length>0,footerTrailingContent:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg",onClick:Fe,disabled:Y,"aria-label":"Cancel editing message",title:"Cancel editing",children:c.jsx(Gn,{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(MT,{ref:ce,"data-message-from":"user",className:Te("min-w-0 rounded-lg bg-muted px-4 py-3 break-words [overflow-wrap:anywhere]",Dt&&!$&&"cursor-text transition-colors hover:bg-muted/80","leading-relaxed [font-size:0.9rem]"),onClick:Et,title:Dt&&!$?"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:(ae??D).length>0?(ae??D).map((me,He)=>me.type==="text"?c.jsx("span",{children:me.text},`text-${He}`):me.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:me.path,children:[c.jsx(Ka,{filename:me.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:me.lineRange?`${me.name}:${Aw(me.lineRange).replace(/^lines? /,"")}`:me.name})]},`${me.path}-${He}`):me.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:me.path,children:[c.jsx(Qj,{name:me.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[180px] truncate",children:me.name})]},`${me.path}-${He}`):me.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:me.workspaceRoot?`${me.terminalId} · ${me.workspaceRoot}`:me.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:me.lineRange?`${me.name}:${Aw(me.lineRange).replace(/^lines? /,"")}`:me.name})]},`${me.terminalId}-${He}`):null):pe??G}),ke.length>0&&c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:ke.map((me,He)=>{const be=me.preview??`data:${me.mimeType};base64,${me.data}`;return c.jsxs(iu,{children:[c.jsx(xve,{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 ${me.name}`,children:[c.jsxs("span",{className:"relative block",children:[c.jsx("img",{src:be,alt:me.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:me.name})]})}),c.jsxs(uc,{className:"max-h-[92vh] max-w-[96vw] gap-2 overflow-hidden p-2",showCloseButton:!0,children:[c.jsx(dc,{className:"mr-8 truncate px-1 text-sm font-medium",children:me.name}),c.jsx("img",{src:be,alt:me.name,className:"max-h-[82vh] w-full object-contain"})]})]},`${me.name}-${He}`)})})]})}),Qe()]}):c.jsxs("div",{className:"relative min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:[c.jsx(MT,{"data-message-from":"assistant",className:"min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:c.jsx(l7,{content:s,compact:_,isStreaming:b,preferLlmUi:k,onOpenPath:E})}),ut]}):Vt?c.jsx("div",{className:"flex items-center gap-3 px-1 py-1 text-sm text-muted-foreground",children:c.jsx(FH,{})}):null]})]})}),c.jsx(lYe,{open:V,onOpenChange:Q,contextFlow:a,responseContent:s})]})}const c7=y.memo(_Ye,(e,r)=>{const{messageFromEnd:n,messageIndex:i,...s}=e,{messageFromEnd:a,messageIndex:o,...l}=r,d=Object.keys(l);return d.length===Object.keys(s).length&&d.every(u=>Object.is(s[u],l[u]))});c7.displayName="Message";function wYe(e){if(!(e!=null&&e.metadata))return{};try{const r=JSON.parse(e.metadata);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}function joe(e){const r=wYe(e),n=r.repositoryId??r.repoId;return typeof n=="string"&&n.trim()?n.trim():null}function HH(e,r){const n=joe(e);return n?r.find(i=>i.id===n)??null:null}function SYe(e,r){return!e||e==="gateway"?!1:!r.has(e)}function WH(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 kYe({platform:e}){switch(e){case"windows":case"macos":case"linux":return c.jsx(rl,{className:"h-2.5 w-2.5"});case"android":case"ios":return c.jsx(Sj,{className:"h-2.5 w-2.5"});default:return c.jsx(Mi,{className:"h-2.5 w-2.5"})}}function CYe({workspaces:e,personalSessions:r=[],activeWorkspaceId:n,activeSessionId:i,loading:s=!1,hasMoreWorkspaces:a=!1,showFewerWorkspaces:o=!1,onSelectWorkspace:l,onSelectPersonalSession:d,onNewPersonalSession:u,onCreateWorkspace:f,onRemoveWorkspace:p,onChangeDirectory:g,onAssignRepository:v,onShowMore:b,onShowFewer:_,sessionInfo:k,nodes:w=[],repositories:C=[]}){const j=y.useMemo(()=>new Set(w.filter(G=>!G.isGateway).map(G=>G.id)),[w]),[A,N]=y.useState(""),E=A.trim().toLowerCase(),P=y.useMemo(()=>E?e.filter(G=>{const D=HH(G,C),W=G.nodeId&&G.nodeId!=="gateway"?w.find(z=>z.id===G.nodeId):null;return[G.title,G.rootPath,D==null?void 0:D.name,W==null?void 0:W.name,...G.sessions.flatMap(z=>[z.name,z.workspacePath])].some(z=>z==null?void 0:z.toLowerCase().includes(E))}):e,[w,E,C,e]),H=y.useMemo(()=>E?r.filter(G=>[G.name,G.workspacePath].some(D=>D==null?void 0:D.toLowerCase().includes(E))):r,[E,r]);return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex h-[35px] shrink-0 items-center gap-2 px-2.5 border-b",children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md bg-muted/60 px-2 py-1",children:[c.jsx(nl,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("input",{type:"search",value:A,onChange:G=>N(G.target.value),placeholder:"Search chats and workspaces","aria-label":"Search chats and workspaces",className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground"})]}),c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:f,children:c.jsx(Gs,{className:"h-3.5 w-3.5"})})}),c.jsx(hn,{side:"right",children:"New workspace"})]})]}),s?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Jt,{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(Uu,{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:f,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Choose workspace folder"})]}),e.length>0&&P.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching workspaces."}),P.map(G=>{const D=G.id===n,W=G.nodeId&&G.nodeId!=="gateway"?w.find(O=>O.id===G.nodeId):null,B=SYe(G.nodeId,j),z=HH(G,C);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 ${B||D?"cursor-default":"cursor-pointer"} ${D?"rounded-md bg-secondary/70":B?"opacity-50":"hover:rounded-md hover:bg-muted/40"}`,draggable:!!G.rootPath,onDragStart:O=>{if(!G.rootPath){O.preventDefault();return}O.dataTransfer.effectAllowed="copy",O.dataTransfer.setData(see,JSON.stringify(i7e(G.rootPath,G.title||void 0)))},onClick:()=>{!B&&!D&&l(G.id)},children:[D?c.jsx(Jh,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}):c.jsx(oR,{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.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[c.jsx("span",{className:"min-w-0 truncate text-xs font-medium",children:G.title||"Untitled Workspace"}),z&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-2xs text-muted-foreground",children:"·"}),c.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-2xs text-muted-foreground",children:[c.jsx(fp,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:z.name})]})]})]}),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:G.rootPath||"No folder linked"}),c.jsx("span",{className:"shrink-0",children:"·"}),c.jsx("span",{className:"shrink-0",children:WH(G.lastActiveAt)})]}),B&&c.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-2xs text-orange-500",children:[c.jsx(lve,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:"Node offline"})]}),W&&!B&&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(kYe,{platform:W.platform}),c.jsx("span",{className:"truncate max-w-[80px]",children:W.name})]})}),D&&k&&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:k.provider}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:"·"}),c.jsx(rl,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"truncate",children:k.isRemote&&k.remoteNode?k.remoteNode.nodeName:"Gateway"})]})]}),c.jsxs("div",{className:"flex shrink-0 self-start gap-0.5",children:[v&&c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon","aria-label":z?`Repository: ${z.name}`:"Assign repository",disabled:!G.rootPath,className:`h-5.5 w-5.5 shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 ${z?"text-primary hover:text-primary":"text-muted-foreground hover:text-foreground"}`,onClick:O=>{O.stopPropagation(),v(G.id)},children:c.jsx(fp,{className:"h-3 w-3"})})}),c.jsx(hn,{side:"right",children:z?`Repository: ${z.name}`:"Assign repository"})]}),c.jsxs(gn,{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:O=>{O.stopPropagation(),g(G.id)},children:c.jsx(pye,{className:"h-3 w-3"})})}),c.jsx(hn,{side:"right",children:"Change directory"})]}),c.jsxs(gn,{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:O=>{O.stopPropagation(),p(G.id)},children:c.jsx(nR,{className:"h-3 w-3"})})}),c.jsx(hn,{side:"right",children:"Archive workspace"})]})]})]},G.id)}),!E&&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 more workspaces"}),!E&&o&&_&&c.jsx("button",{className:"w-full px-2 py-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:_,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(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:u,children:c.jsx(Gs,{className:"h-3 w-3"})})}),c.jsx(hn,{side:"right",children:"New personal chat"})]})]}),c.jsx(Uu,{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.length>0&&H.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No matching personal chats."}),H.map(G=>{const D=n===null&&G.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 ${D?"bg-secondary/70 cursor-default":"cursor-pointer hover:bg-muted/40"}`,onClick:()=>{!D&&d&&d(G.id)},children:[c.jsx(op,{className:`h-3.5 w-3.5 shrink-0 ${D?"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:G.name||"Personal chat"}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:WH(G.lastActiveAt??G.createdAt)})]})]},G.id)})]})})]})]})]})}function jYe(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 NYe({sessions:e,activeSessionId:r,workspaceTitle:n,onSelectSession:i,onNewSession:s,onOpenChange:a,showTitle:o=!0,triggerLabel:l=null}){const[d,u]=y.useState(!1),f=e.find(g=>g.id===r)??e[0]??null,p=g=>{u(g),a==null||a(g)};return c.jsxs("div",{className:o?"flex min-w-0 flex-1 items-center justify-between gap-1.5":"flex items-center gap-1.5",children:[o?c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold leading-tight",children:f!=null&&f.name&&f.name!=="New Chat"?f.name:""}):null,c.jsxs(Ku,{open:d,onOpenChange:p,children:[c.jsxs(gn,{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(lR,{className:"h-3.5 w-3.5"}),l?c.jsx("span",{children:l}):null]})})}),c.jsx(hn,{side:"bottom",children:l??"Sessions"})]}),c.jsxs(Zc,{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(Kye,{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(ks,{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(nR,{className:"h-2.5 w-2.5"}),"Archived"]})]}),c.jsx("div",{className:"text-2xs text-muted-foreground",children:jYe(g.lastActiveAt)})]})]},g.id)})})})]})]})]})}function TYe({suggestions:e,onSelect:r,className:n}){return c.jsx("div",{className:Te("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 EYe=mj("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 Dr({className:e,variant:r,...n}){return c.jsx("div",{className:Te(EYe({variant:r}),e),...n})}const yn=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Te("rounded-xl border border-border/70 bg-card text-card-foreground shadow-sm",e),...r}));yn.displayName="Card";const Noe=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Te("flex flex-col space-y-1.5 p-6",e),...r}));Noe.displayName="CardHeader";const Toe=y.forwardRef(({className:e,...r},n)=>c.jsx("h3",{ref:n,className:Te("font-semibold leading-none tracking-tight",e),...r}));Toe.displayName="CardTitle";const AYe=y.forwardRef(({className:e,...r},n)=>c.jsx("p",{ref:n,className:Te("text-sm text-muted-foreground",e),...r}));AYe.displayName="CardDescription";const Hh=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Te("p-6 pt-0",e),...r}));Hh.displayName="CardContent";const OYe=y.forwardRef(({className:e,...r},n)=>c.jsx("div",{ref:n,className:Te("flex items-center p-6 pt-0",e),...r}));OYe.displayName="CardFooter";const MYe={pending:{icon:gg,label:"Pending",color:"text-muted-foreground"},approved:{icon:Jt,label:"Running",color:"text-blue-500"},rejected:{icon:Gn,label:"Rejected",color:"text-destructive"},executed:{icon:ca,label:"Done",color:"text-green-500"},failed:{icon:eo,label:"Failed",color:"text-destructive"}};function RYe({action:e,expanded:r,onToggle:n}){const i=MYe[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:Te("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(Dr,{variant:"outline",className:"text-2xs px-1.5 py-0",children:i.label}),r?c.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(Is,{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:Te("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 PYe({plan:e,onApprove:r,onReject:n,isExecuting:i,className:s}){const[a,o]=y.useState(new Set),l=g=>{o(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,f=e.actions.filter(g=>g.status==="failed").length,p=d===0;return c.jsxs(yn,{className:Te("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(LYe,{className:"h-4 w-4"}),"Plan",c.jsxs(Dr,{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(Dr,{variant:f>0?"destructive":"success",className:"shrink-0",children:f>0?`${f} failed`:"Complete"})]}),c.jsx("div",{className:"space-y-1.5",children:e.actions.map(g=>c.jsx(RYe,{action:g,expanded:a.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(Jt,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Executing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(NS,{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(Gn,{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.`,f>0&&` ${f} failed.`]})]})}function LYe({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"})]})}function $Ye(e){return e.find(r=>r.status==="in-progress")??null}function Eoe(e){return e.length>0&&e.every(r=>r.status==="completed")}function DYe(e){const r=$Ye(e),n=Eoe(e);return{headerLabel:r?r.title:n?"All tasks completed":"Tasks",showHeaderSpinner:!!r,showHeaderCompleted:!r&&n}}function TE({items:e,className:r,onClear:n}){const[i,s]=y.useState(!1),a=y.useMemo(()=>Eoe(e),[e]),o=y.useMemo(()=>DYe(e),[e]);if(e.length===0)return null;const l=e.filter(g=>g.status==="completed").length,d=e.length,u=d>0?Math.round(l/d*100):0,f=i?"Tasks":o.headerLabel,p=a?"bg-green-500":"bg-primary";return c.jsxs("div",{className:Te("rounded-lg border bg-muted/30 p-3 space-y-2",r),children:[c.jsxs("button",{type:"button",onClick:()=>s(g=>!g),className:"flex items-center gap-2 w-full text-left",children:[c.jsx(Rl,{className:Te("h-3 w-3 shrink-0 text-muted-foreground transition-transform duration-200",!i&&"-rotate-90")}),!i&&o.showHeaderSpinner&&c.jsx(Jt,{className:"h-3.5 w-3.5 shrink-0 text-primary animate-spin"}),!i&&o.showHeaderCompleted&&c.jsx(ca,{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:f}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:Te("h-full rounded-full transition-all duration-300",p),style:{width:`${u}%`}})}),c.jsxs("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[l,"/",d]}),n&&c.jsx("button",{type:"button",onClick:g=>{g.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(Gn,{className:"h-3 w-3"})})]}),i&&c.jsx("div",{className:"space-y-1",children:e.map(g=>c.jsxs("div",{className:Te("flex items-start gap-2 text-xs py-0.5",g.status==="completed"&&"text-muted-foreground"),children:[g.status==="completed"?c.jsx(ca,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-green-500"}):g.status==="in-progress"?c.jsx(Jt,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary animate-spin"}):c.jsx(aR,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/50"}),c.jsx("span",{className:Te("flex-1 min-w-0",g.status==="completed"&&"line-through"),children:g.title})]},g.id))})]})}function IYe({files:e,onAccept:r,onReject:n,onAcceptAll:i,onRejectAll:s,onFileClick:a,className:o}){const l=y.useRef(null),[d,u]=y.useState(!1),[f,p]=y.useState(!1);if(y.useEffect(()=>{const C=l.current;if(!C||typeof ResizeObserver>"u")return;const j=()=>{u(C.clientWidth<560)};j();const A=new ResizeObserver(()=>j());return A.observe(C),()=>A.disconnect()},[]),e.length===0)return null;const g=e.filter(C=>C.state==="undecided").length,v=e.reduce((C,j)=>C+(j.insertions??0),0),b=e.reduce((C,j)=>C+(j.deletions??0),0),_=e.some(C=>C.insertions!==void 0||C.deletions!==void 0),k=_?null:`${e.length} ${e.length===1?"file":"files"}`,w=({insertions:C,deletions:j})=>c.jsxs("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",C]}),c.jsxs("span",{className:"ml-1 text-red-600 dark:text-red-400",children:["-",j]})]});return c.jsxs("div",{ref:l,className:Te("overflow-hidden rounded-lg border bg-muted/30",o),children:[c.jsxs("div",{className:Te("flex items-center justify-between gap-2 bg-muted/20 px-3 py-2",f&&"border-b"),children:[c.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-1.5 text-left",onClick:()=>p(C=>!C),"aria-expanded":f,children:[c.jsx(Is,{className:Te("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",f&&"rotate-90")}),c.jsx(Wh,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsx("span",{className:"truncate text-xs font-medium",children:"Files changed"}),_&&c.jsx(w,{insertions:v,deletions:b}),k&&c.jsx("span",{className:"shrink-0 whitespace-nowrap text-2xs tabular-nums text-muted-foreground",children:k}),f&&g>0&&c.jsxs("span",{className:"shrink-0 text-2xs text-amber-500 dark:text-amber-400",children:[g," pending"]})]}),g>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:Te("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(ks,{className:Te("h-3 w-3 shrink-0",!d&&"mr-1")}),!d&&"Keep all"]}),c.jsxs(we,{size:d?"icon":"sm",variant:"ghost",className:Te("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(Dd,{className:Te("h-3 w-3 shrink-0",!d&&"mr-1")}),!d&&"Undo all"]})]})]}),f&&c.jsx("div",{className:"divide-y",children:e.map(C=>c.jsxs("div",{className:Te("flex items-center gap-2 px-3 py-1.5 text-xs",C.state==="accepted"&&"bg-green-500/5",C.state==="rejected"&&"bg-red-500/5 text-muted-foreground"),children:[c.jsx(Ka,{filename:C.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("button",{type:"button",className:Te("min-w-0 flex-1 truncate text-left hover:underline cursor-pointer",C.state==="rejected"&&"line-through"),title:`Review diff for ${C.path}`,onClick:()=>a==null?void 0:a(C.path),children:C.path}),_&&c.jsx(w,{insertions:C.insertions??0,deletions:C.deletions??0}),C.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:()=>a==null?void 0:a(C.path),title:"Review changes",children:c.jsx(wp,{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(C.path),title:"Keep all changes",children:c.jsx(ks,{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(C.path),title:"Undo all changes",children:c.jsx(Dd,{className:"h-3 w-3"})})]}),C.state==="accepted"&&c.jsx("span",{className:"text-2xs text-green-600 dark:text-green-400 shrink-0",children:"Kept"}),C.state==="rejected"&&c.jsx("span",{className:"text-2xs text-red-500 shrink-0",children:"Undone"})]},C.path))})]})}function BYe(e,r,n,i){const s=e.findIndex(d=>d.id===r);if(s<0)return e;const a=[...e],[o]=a.splice(s,1);if(!o)return e;if(n==null)return a.push(o),a;const l=a.findIndex(d=>d.id===n);return l<0?e:(a.splice(l+(i==="after"?1:0),0,o),a)}function zYe({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(cR,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(Is,{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(bj,{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 FYe({item:e,index:r,onRemove:n,onEdit:i,onReorder:s,onSteer:a,onSendToParallelThread:o,dragActive:l,dropBefore:d,dropAfter:u,onDragStart:f}){const[p,g]=y.useState(!1),[v,b]=y.useState(!0),[_,k]=y.useState(e.displayContent??e.content),w=y.useRef(null),C=p||!l;y.useEffect(()=>{if(p){const E=w.current;E&&(E.focus(),E.setSelectionRange(E.value.length,E.value.length))}},[p]),y.useEffect(()=>{p||k(e.displayContent??e.content)},[e.content,e.displayContent,p]);const j=y.useCallback(()=>{const E=_.trim(),P=e.displayContent??e.content;E&&E!==P&&(i==null||i(e.id,E)),g(!1)},[_,e.content,e.displayContent,e.id,i]),A=y.useCallback(()=>{k(e.displayContent??e.content),g(!1)},[e.content,e.displayContent]),N=y.useCallback(E=>{E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),j()):E.key==="Escape"&&A()},[j,A]);return c.jsxs(c.Fragment,{children:[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))]"})}),c.jsxs("div",{"data-queue-id":e.id,className:Te("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",l&&"border-dashed border-primary/35 bg-primary/5 opacity-0"),onPointerDown:E=>{p||!s||E.target.closest('button, textarea, input, a, [data-no-drag="true"]')||f==null||f(e.id,E)},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:()=>b(E=>!E),"aria-label":v?"Expand queued message":"Collapse queued message",title:v?"Expand queued message":"Collapse queued message",children:v?c.jsx(Is,{className:"h-3.5 w-3.5"}):r===0?c.jsx(cR,{className:"h-3.5 w-3.5 text-primary"}):c.jsx(Rl,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s&&!p&&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(bj,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[r===0&&!p&&c.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-primary/70 block mb-0.5",children:"Next"}),r>0&&!p&&c.jsxs("span",{className:"text-2xs font-medium uppercase tracking-wider text-muted-foreground block mb-0.5",children:["Queued #",r+1]}),p?c.jsx("textarea",{ref:w,value:_,onChange:E=>k(E.target.value),onKeyDown:N,onBlur:j,rows:Math.min(_.split(`
1204
1204
  `).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"}):v?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:Te("mt-0.5 flex shrink-0 items-center gap-0.5 transition-opacity",a?"opacity-100":C?"opacity-0 group-hover:opacity-100":"opacity-0"),children:p?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:j,title:"Save",children:c.jsx(ks,{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:A,title:"Cancel",children:c.jsx(Gn,{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:()=>g(!0),title:"Edit message",children:c.jsx(fR,{className:"h-3 w-3"})}),a&&c.jsxs("button",{type:"button","data-no-drag":"true",className:"inline-flex h-6 items-center gap-1 rounded border border-primary/25 bg-primary/5 px-1.5 text-2xs font-medium text-primary transition-colors hover:bg-primary/10",onClick:()=>a(e.id),title:"Steer with message",children:[c.jsx("span",{children:"Steer"}),c.jsx(o0e,{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(fp,{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(Gn,{className:"h-3.5 w-3.5"})})]})})]}),u&&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 UH({items:e,onRemove:r,onEdit:n,onReorder:i,onSteer:s,onSendToParallelThread:a,className:o}){const l=y.useRef(null),d=y.useRef(null),[u,f]=y.useState(null),[p,g]=y.useState(null),[v,b]=y.useState(null);y.useEffect(()=>{if(u&&!e.some(j=>j.id===u)){f(null),g(null),b(null);return}p!=null&&p.targetId&&!e.some(j=>j.id===p.targetId)&&g(u?{targetId:u,placement:"before"}:null)},[u,p,e]),y.useEffect(()=>{var H;if(!u||!v)return;document.body.style.cursor="grabbing",document.body.style.userSelect="none",document.body.style.touchAction="none";const j=(G,D)=>{var O,$;const W=Array.from(((O=l.current)==null?void 0:O.querySelectorAll("[data-queue-id]"))??[]);if(W.length===0){g(null);return}const B=W.filter(R=>R.dataset.queueId&&R.dataset.queueId!==u);if(B.length===0){g({targetId:null,placement:"after"});return}for(const R of B){const I=R.dataset.queueId;if(!I)continue;const U=R.getBoundingClientRect(),Y=U.top+U.height/2;if(D<Y){g({targetId:I,placement:"before"});return}}const z=(($=B[B.length-1])==null?void 0:$.dataset.queueId)??null;g(z?{targetId:z,placement:"after"}:{targetId:null,placement:"after"})},A=G=>{G.pointerId===v.pointerId&&(b(D=>D&&{...D,x:G.clientX,y:G.clientY}),j(G.clientX,G.clientY))},N=G=>{var W,B;if(G&&G.pointerId!==v.pointerId)return;u&&p&&p.targetId!==u&&(i==null||i(u,p.targetId,p.placement));const D=d.current;(W=D==null?void 0:D.hasPointerCapture)!=null&&W.call(D,v.pointerId)&&((B=D.releasePointerCapture)==null||B.call(D,v.pointerId)),d.current=null,f(null),g(null),b(null)},E=()=>{N()},P=()=>{N()};return window.addEventListener("pointermove",A),window.addEventListener("pointerup",N),window.addEventListener("pointercancel",N),window.addEventListener("blur",P),(H=d.current)==null||H.addEventListener("lostpointercapture",E),()=>{var G;document.body.style.cursor="",document.body.style.userSelect="",document.body.style.touchAction="",window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",N),window.removeEventListener("pointercancel",N),window.removeEventListener("blur",P),(G=d.current)==null||G.removeEventListener("lostpointercapture",E)}},[v,u,p,i]);const _=y.useCallback((j,A)=>{var P;if(!i||A.button!==0&&A.pointerType!=="touch"&&A.pointerType!=="pen")return;A.preventDefault();const N=A.currentTarget.closest("[data-queue-id]");if(!N)return;d.current=N,(P=N.setPointerCapture)==null||P.call(N,A.pointerId);const E=N.getBoundingClientRect();f(j),g({targetId:j,placement:"before"}),b({id:j,pointerId:A.pointerId,x:A.clientX,y:A.clientY,offsetX:A.clientX-E.left,offsetY:A.clientY-E.top,width:E.width,height:E.height})},[i]);if(e.length===0)return null;const k=u&&p&&(p.targetId!==u||p.placement==="after")?BYe(e,u,p.targetId,p.placement):e,w=v?k.findIndex(j=>j.id===v.id):-1,C=w>=0?k[w]:null;return c.jsxs("div",{ref:l,className:Te("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":""]})}),k.map((j,A)=>c.jsx(FYe,{item:j,index:A,onRemove:r,onEdit:n,onReorder:i,onSteer:s,onSendToParallelThread:a,dragActive:u===j.id,dropBefore:!!(u&&(p==null?void 0:p.targetId)===j.id&&p.placement==="before"&&u!==j.id),dropAfter:!!(u&&(p==null?void 0:p.targetId)===j.id&&p.placement==="after"&&u!==j.id),onDragStart:_},j.id)),v&&C&&c.jsx("div",{className:"pointer-events-none fixed z-50",style:{left:`${v.x-v.offsetX}px`,top:`${v.y-v.offsetY}px`,width:`${v.width}px`,minHeight:`${v.height}px`},children:c.jsx("div",{className:"scale-[1.01] opacity-95",children:c.jsx(zYe,{item:C,index:w})})})]})}function HYe({usage:e}){const[r,n]=y.useState(!1),i=e&&e.limit>0?Math.round(e.ratio*100):0,s=y.useMemo(()=>{if(!e||e.total===0)return[];const g=e.total;return[{label:"System",tokens:e.system,pct:Math.round(e.system/g*100),color:"var(--ctx-system)"},{label:"History",tokens:e.history,pct:Math.round(e.history/g*100),color:"var(--ctx-history)"},{label:"Tool Results",tokens:e.toolResults,pct:Math.round(e.toolResults/g*100),color:"var(--ctx-tool-results)"},{label:"Tools",tokens:e.tools,pct:Math.round(e.tools/g*100),color:"var(--ctx-tools)"}].filter(v=>v.tokens>0)},[e]),a=22,o=3,l=(a-o)/2,d=2*Math.PI*l,u=y.useMemo(()=>{if(!e||e.limit<=0)return[];const g=[];let v=0;for(const b of s){const k=b.tokens/e.limit*d;g.push({offset:v,length:k,color:b.color}),v+=k}return g},[s,e,d]),f=i>=90?"text-red-500":i>=75?"text-amber-500":"text-emerald-500",p=g=>g>=1e3?`${(g/1e3).toFixed(1)}k`:String(g);return!e||e.limit<=0?null:c.jsxs(c.Fragment,{children:[c.jsxs(gn,{children:[c.jsx(dn,{asChild:!0,children:c.jsxs("button",{type:"button",onClick:()=>n(!0),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:a,height:a,viewBox:`0 0 ${a} ${a}`,className:`-rotate-90 ${f}`,children:[c.jsx("circle",{cx:a/2,cy:a/2,r:l,fill:"none",stroke:"currentColor",strokeWidth:o,opacity:.15}),u.map((g,v)=>c.jsx("circle",{cx:a/2,cy:a/2,r:l,fill:"none",stroke:g.color,strokeWidth:o,strokeDasharray:`${g.length} ${d-g.length}`,strokeDashoffset:-g.offset,strokeLinecap:"round",opacity:.85},v))]}),c.jsxs("span",{className:"text-2xs tabular-nums text-muted-foreground",children:[i,"%"]})]})}),c.jsx(hn,{side:"bottom",className:"max-w-[220px] bg-popover text-popover-foreground border shadow-md",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:[p(e.total)," / ",p(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 ${i>=90?"bg-red-500":i>=75?"bg-amber-500":"bg-emerald-500"}`,style:{width:`${Math.min(i,100)}%`}})}),c.jsx("div",{className:"space-y-0.5",children:s.map(g=>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:g.color}}),c.jsx("span",{className:"text-muted-foreground",children:g.label})]}),c.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[g.pct,"%"]})]},g.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"})]})})]}),c.jsx(iu,{open:r,onOpenChange:n,children:c.jsxs(uc,{className:"max-w-sm",children:[c.jsxs(nd,{children:[c.jsx(dc,{className:"text-sm",children:"Context Window Breakdown"}),c.jsxs(nf,{className:"text-xs",children:[p(e.total)," / ",p(e.limit)," tokens used (",i,"%)"]})]}),c.jsxs("div",{className:"space-y-3 pt-1",children:[c.jsx("div",{className:"w-full h-2 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${i>=90?"bg-red-500":i>=75?"bg-amber-500":"bg-emerald-500"}`,style:{width:`${Math.min(i,100)}%`}})}),c.jsx("div",{className:"space-y-2",children:s.map(g=>c.jsxs("div",{className:"flex items-center justify-between text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full",style:{backgroundColor:g.color}}),c.jsx("span",{children:g.label})]}),c.jsxs("div",{className:"text-muted-foreground tabular-nums",children:[c.jsx("span",{className:"font-medium text-foreground",children:p(g.tokens)})," ",c.jsxs("span",{className:"text-xs",children:["(",g.pct,"%)"]})]})]},g.label))}),e.pruned&&c.jsx("div",{className:"rounded-md border border-amber-500/20 bg-amber-500/5 p-2 text-xs text-amber-600",children:"Older messages were pruned to fit within the context window limit."})]})]})})]})}const B1=Zn(),WYe=uy();function UYe(e){const[r,n]=y.useState([]),i=y.useRef(async()=>{}),s=y.useRef(e);s.current=e;const a=y.useCallback(async()=>{try{const u=e?`${B1}/api/consent/pending/${e}`:`${B1}/api/consent/pending`,p=await(await fetch(u)).json();n(p.requests)}catch{}},[e]);i.current=a,y.useEffect(()=>{a()},[a]),y.useEffect(()=>{let u=!1;const f=new WebSocket(WYe);return f.onmessage=p=>{if(!u)try{const g=JSON.parse(p.data);if(g.type==="consent.required"){const v=g.payload,b=s.current;(!b||v.sessionId===b)&&n(_=>[..._,v])}if(g.type==="consent.resolved"){const v=g.payload;n(b=>b.filter(_=>_.id!==v.requestId))}}catch{}},f.onopen=()=>{u||i.current()},()=>{if(u=!0,f.onopen=()=>{try{f.close()}catch{}},f.onmessage=null,f.onerror=null,f.onclose=null,f.readyState===WebSocket.OPEN)try{f.close()}catch{}}},[]);const o=y.useCallback(async u=>{try{await fetch(`${B1}/api/consent/${u}/approve`,{method:"POST"}),n(f=>f.filter(p=>p.id!==u))}catch{}},[]),l=y.useCallback(async(u,f)=>{try{await fetch(`${B1}/api/consent/${u}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:f})}),n(p=>p.filter(g=>g.id!==u))}catch{}},[]),d=y.useCallback(async(u,f)=>{try{const g=await(await fetch(`${B1}/api/consent/pending/${u}/approve-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:f})})).json(),v=new Set(g.requestIds??[]);return v.size>0?n(b=>b.filter(_=>!v.has(_.id))):n(b=>b.filter(_=>_.sessionId!==u)),!0}catch{return!1}},[]);return{queue:r,approve:o,reject:l,approveAllForSession:d,refresh:a}}function VYe(){const[e,r]=y.useState(null),n=y.useCallback(async()=>{try{const s=await(await fetch(`${B1}/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:wj,medium:nY,high:oA}[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 qH({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 GH({expiresAt:e}){const[r,n]=y.useState("");return y.useEffect(()=>{const i=()=>{const a=new Date(e).getTime()-Date.now();if(a<=0){n("expired");return}const o=Math.ceil(a/1e3);o>60?n(`${Math.ceil(o/60)}m`):n(`${o}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(gg,{className:"h-3 w-3"}),r]})}function KH({toolName:e}){return e.startsWith("terminal.")?c.jsx(sa,{className:"h-4 w-4"}):e.startsWith("file.")?c.jsx(Wh,{className:"h-4 w-4"}):c.jsx(QK,{className:"h-4 w-4"})}function qYe({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 GYe({request:e,onApprove:r,onReject:n,compact:i=!1}){const[s,a]=y.useState(!1),o=async()=>{a(!0),r(e.id)},l=async()=>{a(!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(KH,{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(qH,{level:e.policy.consentLevel}),c.jsx(GH,{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:o,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(ID,{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(oA,{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(KH,{toolName:e.toolName}),c.jsx("span",{className:"text-sm font-medium",children:e.toolName}),c.jsx(VH,{risk:e.risk}),c.jsx(qH,{level:e.policy.consentLevel})]}),c.jsx(GH,{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(qYe,{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(oA,{className:"h-3.5 w-3.5"}),"Reject"]}),c.jsxs("button",{onClick:o,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(ID,{className:"h-3.5 w-3.5"}),"Approve"]})]})]})}function KYe({status:e}){const r={running:{icon:Jt,label:"Running",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},"awaiting-approval":{icon:nY,label:"Awaiting Approval",color:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"},"needs-input":{icon:gg,label:"Needs Input",color:"bg-orange-500/10 text-orange-600 dark:text-orange-400"},completed:{icon:ca,label:"Completed",color:"bg-green-500/10 text-green-600 dark:text-green-400"},failed:{icon:rh,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 YYe({className:e="",compact:r=!1,sessionId:n,onApproveAllEnabled:i}){const{queue:s,approve:a,reject:o,approveAllForSession:l}=UYe(n),{policy:d}=VYe(),[u,f]=y.useState(!1),p=y.useMemo(()=>n?s.filter(v=>v.sessionId===n):s,[s,n]),g=async()=>{if(!n||u)return;f(!0),await l(n)&&(i==null||i()),f(!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(KYe,{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(GYe,{request:v,onApprove:a,onReject:o,compact:r},v.id))})]})}const YH=5e3;let XYe=0,q1=[],$4=new Set;function EE(e,r){q1.push({id:XYe++,ts:Date.now(),type:e,raw:r}),q1.length>YH&&(q1=q1.slice(-YH)),$4.forEach(n=>n())}function JYe(){q1=[],$4.forEach(e=>e())}function ZYe(){const[,e]=y.useState(0);return y.useEffect(()=>{const r=()=>e(n=>n+1);return $4.add(r),()=>{$4.delete(r)}},[]),q1}const QYe={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 eXe({onClose:e}){const r=ZYe(),n=y.useRef(null),[i,s]=y.useState(!0),[a,o]=y.useState(""),[l,d]=y.useState(!1),[u,f]=y.useState(new Set),p=y.useCallback(k=>{f(w=>{const C=new Set(w);return C.has(k)?C.delete(k):C.add(k),C})},[]),g=a?r.filter(k=>k.type.includes(a)||k.raw.includes(a)):r,v=$R({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(`
1205
1205
  `);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:a,onChange:k=>o(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(ks,{className:"h-3 w-3 text-green-400"}):c.jsx(Kc,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:JYe,children:c.jsx(lc,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:e,children:c.jsx(Gn,{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=QYe[w.type]??"text-zinc-400",A=w.raw.length>120,N=u.has(w.id),E=A&&!N?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:Te("flex gap-2 px-2 hover:bg-zinc-800/50 leading-tight cursor-pointer select-none",N?"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:Te("shrink-0 w-28 text-right",j),style:{minHeight:AE},children:w.type}),c.jsxs("span",{className:Te("text-zinc-400 min-w-0",N?"break-all whitespace-pre-wrap":"truncate"),children:[E,A&&!N&&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(qK,{className:"h-3 w-3"})})})]})}function tXe(e,r=[]){let n=[];function i(a,o){const l=y.createContext(o),d=n.length;n=[...n,o];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=a+"Provider";function f(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(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[u,f]}const s=()=>{const a=n.map(o=>y.createContext(o));return function(l){const d=(l==null?void 0:l[e])||a;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return s.scopeName=e,[i,rXe(s,...r)]}function rXe(...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(a){const o=i.reduce((l,{useScope:d,scopeName:u})=>{const p=d(a)[`__scope${u}`];return{...l,...p}},{});return y.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])}};return n.scopeName=r.scopeName,n}function Aoe(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 nXe(e){const r=iXe(e),n=y.forwardRef((i,s)=>{const{children:a,...o}=i,l=y.Children.toArray(a),d=l.find(aXe);if(d){const u=d.props.children,f=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,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,f):null})}return c.jsx(r,{...o,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function iXe(e){const r=y.forwardRef((n,i)=>{const{children:s,...a}=n;if(y.isValidElement(s)){const o=lXe(s),l=oXe(a,s.props);return s.type!==y.Fragment&&(l.ref=i?ua(i,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var sXe=Symbol("radix.slottable");function aXe(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sXe}function oXe(e,r){const n={...r};for(const i in r){const s=e[i],a=r[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...l)=>{const d=a(...l);return s(...l),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function lXe(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 cXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ooe=cXe.reduce((e,r)=>{const n=nXe(`Primitive.${r}`),i=y.forwardRef((s,a)=>{const{asChild:o,...l}=s,d=o?n:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...l,ref:a})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),RN="Switch",[uXe]=tXe(RN),[dXe,hXe]=uXe(RN),Moe=y.forwardRef((e,r)=>{const{__scopeSwitch:n,name:i,checked:s,defaultChecked:a,required:o,disabled:l,value:d="on",onCheckedChange:u,form:f,...p}=e,[g,v]=y.useState(null),b=di(r,j=>v(j)),_=y.useRef(!1),k=g?f||!!g.closest("form"):!0,[w,C]=_p({prop:s,defaultProp:a??!1,onChange:u,caller:RN});return c.jsxs(dXe,{scope:n,checked:w,disabled:l,children:[c.jsx(Ooe.button,{type:"button",role:"switch","aria-checked":w,"aria-required":o,"data-state":$oe(w),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:b,onClick:vr(e.onClick,j=>{C(A=>!A),k&&(_.current=j.isPropagationStopped(),_.current||j.stopPropagation())})}),k&&c.jsx(Loe,{control:g,bubbles:!_.current,name:i,value:d,checked:w,required:o,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Moe.displayName=RN;var Roe="SwitchThumb",Poe=y.forwardRef((e,r)=>{const{__scopeSwitch:n,...i}=e,s=hXe(Roe,n);return c.jsx(Ooe.span,{"data-state":$oe(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:r})});Poe.displayName=Roe;var fXe="SwitchBubbleInput",Loe=y.forwardRef(({__scopeSwitch:e,control:r,checked:n,bubbles:i=!0,...s},a)=>{const o=y.useRef(null),l=di(o,a),d=Aoe(n),u=EY(r);return y.useEffect(()=>{const f=o.current;if(!f)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(f,n),f.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}})});Loe.displayName=fXe;function $oe(e){return e?"checked":"unchecked"}var Doe=Moe,pXe=Poe;const Np=y.forwardRef(({className:e,...r},n)=>c.jsx(Doe,{className:Te("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(pXe,{className:Te("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")})}));Np.displayName=Doe.displayName;var ak="Ollama",mXe=.6,gXe=.1,Ioe="#fff",yXe=Ioe,vXe="#000",xXe=.75;function l2(e){"@babel/helpers - typeof";return l2=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},l2(e)}var bXe=["size","style"];function XH(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 OE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?XH(Object(n),!0).forEach(function(i){_Xe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function _Xe(e,r,n){return r=wXe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function wXe(e){var r=SXe(e,"string");return l2(r)=="symbol"?r:String(r)}function SXe(e,r){if(l2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(l2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function kXe(e,r){if(e==null)return{};var n=CXe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function CXe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var DP=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=kXe(e,bXe);return c.jsxs("svg",OE(OE({fill:"currentColor",fillRule:"evenodd",height:n,style:OE({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:ak}),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 c2(e){"@babel/helpers - typeof";return c2=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},c2(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 jXe(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){NXe(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 NXe(e,r,n){return r=TXe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function TXe(e){var r=EXe(e,"string");return c2(r)=="symbol"?r:String(r)}function EXe(e,r){if(c2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(c2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function AXe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var OXe=y.memo(function(e){var r=Object.assign({},(AXe(e),e));return c.jsx(fc,jXe({Icon:DP,"aria-label":ak,background:yXe,color:vXe,iconMultiple:xXe},r))});function u2(e){"@babel/helpers - typeof";return u2=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},u2(e)}var MXe=["size","style"];function ZH(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 ME(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?ZH(Object(n),!0).forEach(function(i){RXe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function RXe(e,r,n){return r=PXe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function PXe(e){var r=LXe(e,"string");return u2(r)=="symbol"?r:String(r)}function LXe(e,r){if(u2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(u2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function $Xe(e,r){if(e==null)return{};var n=DXe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function DXe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Boe=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=$Xe(e,MXe);return c.jsxs("svg",ME(ME({fill:"currentColor",fillRule:"evenodd",height:n,style:ME({flex:"none",lineHeight:1},i),viewBox:"0 0 87 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:ak}),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 d2(e){"@babel/helpers - typeof";return d2=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},d2(e)}function QH(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 IXe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?QH(Object(n),!0).forEach(function(i){BXe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QH(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function BXe(e,r,n){return r=zXe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function zXe(e){var r=FXe(e,"string");return d2(r)=="symbol"?r:String(r)}function FXe(e,r){if(d2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(d2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function HXe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var WXe=y.memo(function(e){var r=Object.assign({},(HXe(e),e));return c.jsx(pc,IXe({Icon:DP,Text:Boe,"aria-label":ak,spaceMultiple:gXe,textMultiple:mXe},r))}),my=DP;my.Text=Boe;my.Combine=WXe;my.Avatar=OXe;my.colorPrimary=Ioe;my.title=ak;var K0="Qwen",UXe=.7,VXe=.2,zoe="#615ced",qXe="linear-gradient(to right, #6336E7, #6F69F7)",GXe=zoe,KXe="#fff",YXe=.75;function h2(e){"@babel/helpers - typeof";return h2=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},h2(e)}var XXe=["size","style"];function eW(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 RE(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?eW(Object(n),!0).forEach(function(i){JXe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function JXe(e,r,n){return r=ZXe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function ZXe(e){var r=QXe(e,"string");return h2(r)=="symbol"?r:String(r)}function QXe(e,r){if(h2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(h2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function eJe(e,r){if(e==null)return{};var n=tJe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function tJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(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=eJe(e,XXe);return c.jsxs("svg",RE(RE({fill:"currentColor",fillRule:"evenodd",height:n,style:RE({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:K0}),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 f2(e){"@babel/helpers - typeof";return f2=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},f2(e)}function tW(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 rJe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?tW(Object(n),!0).forEach(function(i){nJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function nJe(e,r,n){return r=iJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function iJe(e){var r=sJe(e,"string");return f2(r)=="symbol"?r:String(r)}function sJe(e,r){if(f2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(f2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function aJe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var oJe=y.memo(function(e){var r=Object.assign({},(aJe(e),e));return c.jsx(fc,rJe({Icon:IP,"aria-label":K0,background:GXe,color:KXe,iconMultiple:YXe},r))}),lJe=function(r){var n="lobe-icons-".concat(OQ(r),"-fill");return y.useMemo(function(){return{fill:"url(#".concat(n,")"),id:n}},[r])},BP=function(r,n){return y.useMemo(function(){var i=Array.from({length:n},function(s,a){var o="lobe-icons-".concat(OQ(r),"-fill-").concat(a);return{fill:"url(#".concat(o,")"),id:o}});return i},[r,n])};function p2(e){"@babel/helpers - typeof";return p2=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},p2(e)}var cJe=["size","style"];function rW(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?rW(Object(n),!0).forEach(function(i){uJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function uJe(e,r,n){return r=dJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function dJe(e){var r=hJe(e,"string");return p2(r)=="symbol"?r:String(r)}function hJe(e,r){if(p2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(p2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function fJe(e,r){if(e==null)return{};var n=pJe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function pJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Foe=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=fJe(e,cJe),a=lJe(K0),o=a.id,l=a.fill;return c.jsxs("svg",PE(PE({height:n,style:PE({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:K0}),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:o,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 m2(e){"@babel/helpers - typeof";return m2=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},m2(e)}var mJe=["size","style"];function nW(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?nW(Object(n),!0).forEach(function(i){gJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function gJe(e,r,n){return r=yJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function yJe(e){var r=vJe(e,"string");return m2(r)=="symbol"?r:String(r)}function vJe(e,r){if(m2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(m2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function xJe(e,r){if(e==null)return{};var n=bJe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function bJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Hoe=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=xJe(e,mJe);return c.jsxs("svg",LE(LE({fill:"currentColor",fillRule:"evenodd",height:n,style:LE({flex:"none",lineHeight:1},i),viewBox:"0 0 75 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:K0}),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 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)}var _Je=["type","extraStyle"];function iW(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 sW(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?iW(Object(n),!0).forEach(function(i){wJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function wJe(e,r,n){return r=SJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function SJe(e){var r=kJe(e,"string");return g2(r)=="symbol"?r:String(r)}function kJe(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 CJe(e,r){if(e==null)return{};var n=jJe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function jJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var NJe=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=e.extraStyle,s=CJe(e,_Je),a=n==="color"?Foe:IP;return c.jsx(pc,sW({Icon:a,Text:Hoe,"aria-label":K0,extraStyle:sW({fontWeight:500},i),spaceMultiple:VXe,textMultiple:UXe},s))}),Vd=IP;Vd.Color=Foe;Vd.Text=Hoe;Vd.Combine=NJe;Vd.Avatar=oJe;Vd.colorPrimary=zoe;Vd.colorGradient=qXe;Vd.title=K0;var of="Meta",TJe=.75,EJe=.2,AJe="#1d65c1",Woe="linear-gradient(45deg, #007FF8, #0668E1, #007FF8)",OJe=Woe,MJe="#fff",RJe=.75;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)}var PJe=["size","style"];function aW(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 $E(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?aW(Object(n),!0).forEach(function(i){LJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function LJe(e,r,n){return r=$Je(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function $Je(e){var r=DJe(e,"string");return y2(r)=="symbol"?r:String(r)}function DJe(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 IJe(e,r){if(e==null)return{};var n=BJe(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function BJe(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var zP=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=IJe(e,PJe);return c.jsxs("svg",$E($E({fill:"currentColor",fillRule:"evenodd",height:n,style:$E({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:of}),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 v2(e){"@babel/helpers - typeof";return v2=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},v2(e)}function oW(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 zJe(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?oW(Object(n),!0).forEach(function(i){FJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function FJe(e,r,n){return r=HJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function HJe(e){var r=WJe(e,"string");return v2(r)=="symbol"?r:String(r)}function WJe(e,r){if(v2(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(v2(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function UJe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var VJe=y.memo(function(e){var r=Object.assign({},(UJe(e),e));return c.jsx(fc,zJe({Icon:zP,"aria-label":of,background:OJe,color:MJe,iconMultiple:RJe},r))});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 qJe=["size","style"];function lW(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?lW(Object(n),!0).forEach(function(i){GJe(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lW(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function GJe(e,r,n){return r=KJe(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function KJe(e){var r=YJe(e,"string");return x2(r)=="symbol"?r:String(r)}function YJe(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 XJe(e,r){return eZe(e)||QJe(e,r)||ZJe(e,r)||JJe()}function JJe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -1471,7 +1471,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
1471
1471
  float alpha = line * uMix;
1472
1472
 
1473
1473
  fragColor = vec4(color * uMix, alpha);
1474
- }`;function lhe({color:e="#1FD5F9",colorShift:r=.05,lineWidth:n=2,blur:i=.5,uniformsRef:s,ref:a,className:o,...l}){const d=y.useMemo(()=>ohe(e),[e]);return y.useEffect(()=>{const u=s.current;u&&(u.uLineWidth.value=n,u.uSmoothing.value=i,u.uColor.value=d??[0,.7,1],u.uColorShift.value=r)},[s,d,r,n,i]),c.jsx("div",{ref:a,className:o,...l,children:c.jsx(lgt,{fs:_1t,devicePixelRatio:Math.min(globalThis.devicePixelRatio??1,1.5),uniforms:s.current,style:{width:"100%",height:"100%"}})})}lhe.displayName="WaveShader";const w1t=mj(["aspect-square"],{variants:{size:{icon:"h-[24px]",sm:"h-[56px]",md:"h-[112px]",lg:"h-[224px]",xl:"h-[448px]"}},defaultVariants:{size:"lg"}});function S1t({size:e="lg",state:r="speaking",color:n,colorShift:i=.05,lineWidth:s,blur:a,className:o,ref:l,...d}){const u=y.useMemo(()=>{if(s!==void 0)return s;switch(e){case"icon":case"sm":return 2;default:return 1}},[s,e]),{speed:f,amplitude:p,frequency:g,opacity:v}=b1t({state:r}),b=y.useRef({uSpeed:{type:"1f",value:f.get()},uAmplitude:{type:"1f",value:p.get()},uFrequency:{type:"1f",value:g.get()},uMix:{type:"1f",value:v.get()},uLineWidth:{type:"1f",value:u},uSmoothing:{type:"1f",value:.5},uColor:{type:"3fv",value:[0,.7,1]},uColorShift:{type:"1f",value:i}});return y.useEffect(()=>{const _=[f.on("change",k=>{b.current.uSpeed.value=k}),p.on("change",k=>{b.current.uAmplitude.value=k}),g.on("change",k=>{b.current.uFrequency.value=k}),v.on("change",k=>{b.current.uMix.value=k})];return()=>{for(const k of _)k()}},[f,p,g,v]),c.jsx(lhe,{ref:l,"data-lk-state":r,color:n,colorShift:i,lineWidth:u,blur:a,uniformsRef:b,className:Te(w1t({size:e}),"mask-[linear-gradient(90deg,transparent_0%,black_20%,black_80%,transparent_100%)]",o),...d})}function k1t(e,r){return`${e??""}::${r??""}`}function C1t({viewMode:e,sendTarget:r,workspaceId:n,workspaceRepoId:i,repositories:s,lastAppliedKey:a}){if(e!=="developer"||r!=="thread")return null;const o=k1t(n,i);return a===o?null:i?s.some(l=>l.id===i)?{nextAppliedKey:o,repoId:i}:null:{nextAppliedKey:o,repoId:null}}const che=16,j1t=280,N1t=200;function dj(e,r,n){return Math.min(Math.max(e,r),n)}function j3({size:e,viewport:r,margin:n=che}){const i=Math.max(220,r.width-n*2),s=Math.max(160,r.height-n*2),a=Math.min(j1t,i),o=Math.min(N1t,s);return{w:dj(e.w,a,i),h:dj(e.h,o,s)}}function W_({position:e,size:r,viewport:n}){return{x:dj(e.x,0,Math.max(0,n.width-r.w)),y:dj(e.y,0,Math.max(0,n.height-r.h))}}function T1t({size:e,viewport:r,margin:n=che}){return W_({position:{x:r.width-e.w-n,y:r.height-e.h-n},size:e,viewport:r})}function zL(e){return e.status==="running"}function E1t(e){return{disableSendTargetSelector:e.isLoadingHistory,showTodoList:!e.developerChatHydrating&&e.todoCount>0}}function A1t(e){return e.viewMode!=="developer"||e.currentView!=="chat"||e.requiresAuthGate?!1:e.authLoading||e.workspacesLoading?!0:e.activeSessionId?e.isLoadingHistory||e.loadingChatMode||e.loadingProviderRuntimeMode||e.loadingCliModels||e.loadingChatView:!1}const uhe=new Set(["ssh.run","run.ssh","ssh.session.start"]),O1t=new Set([...uhe,"elevated.run","terminal.run","jait.terminal","execute"]);function MG(e){return uhe.has(e)}function RG(e){const r=e.replace(/^functions\./,""),n=r.match(/^[^/]+\/(.+)$/);if(n!=null&&n[1])return Xu(n[1]);const i=r.match(/^mcp\.[^.]+\.(.+)$/);if(i!=null&&i[1])return Xu(i[1]);const s=r.match(/^mcp__[^.]+\.(.+)$/);if(s!=null&&s[1])return Xu(s[1]);const a=r.match(/^mcp__[^_]+__(.+)$/);return a!=null&&a[1]?Xu(a[1].replace(/^\./,"")):null}function gw(e){return e?O1t.has(e.requestedBy??"")||e.title==="SSH password"||e.title==="Administrator password"||e.title==="Terminal input required":!1}function M1t(e){return!!(e&&!gw(e))}function R1t(e,r,n){if(!gw(e))return!1;const i=Xu(r),s=RG(r);if(e!=null&&e.requestedBy&&(e.requestedBy===r||e.requestedBy===i||e.requestedBy===s))return!0;if((r==="mcp-tool"||i.startsWith("mcp."))&&n){const o=ON(Qc(r,n)),l=o.title?RG(o.title)??Xu(o.title):"";if(e!=null&&e.requestedBy&&e.requestedBy===l)return!0;if((e==null?void 0:e.title)==="SSH password")return MG(l);if((e==null?void 0:e.title)==="Terminal input required")return l==="terminal.run"||l==="jait.terminal"||l==="execute"}const a=s??i;return(e==null?void 0:e.title)==="SSH password"?MG(a):(e==null?void 0:e.title)==="Administrator password"?a==="elevated.run":(e==null?void 0:e.title)==="Terminal input required"?a==="terminal.run"||a==="jait.terminal"||a==="execute":!1}function dhe(e){return Array.isArray(e)?e:[]}function P1t(e,r){const n=dhe(r);return e.length>0&&n.length===0?e:n}function L1t(e){return e.length>0?e:null}function PG(e,r){return r?e.tree?{tree:!0,editor:!1}:e.editor?j0("editor"):bS():!e.tree&&!e.editor?{tree:!1,editor:!0}:e}function bS(){return{tree:!1,editor:!1}}function j0(e){return e==="tree"?{tree:!0,editor:!1}:{tree:!1,editor:!0}}function $1t(e="background"){return e==="editor"?j0("editor"):bS()}function LG(e,r){const n=r==="tree"?e.tree:e.editor,i=r==="tree"?e.editor:e.tree;return n&&!i?bS():j0(r)}function hhe(e){return e.showTerminal?"terminal":e.showWorkspace?e.showWorkspaceEditor?"editor":e.showWorkspaceTree?e.treeTab:null:null}function Mm(e,r){return hhe(e)===r}function $G(e){return!!e&&/[\p{L}\p{N}]/u.test(e)}function D1t(e){return e==="'"||e==="’"}function I1t(e){var r;return((r=e.match(/[\p{L}\p{N}'’]+$/u))==null?void 0:r[0])??""}function qM(e){return e.replace(/\s+/g," ").trim()}function B1t(e,r,n){if(n>=3)return!0;const i=e[e.length-n-1],s=r[n];if(n===2&&$G(i)&&s&&!$G(s)&&!/\s/.test(s))return!0;const a=I1t(e);return n===1&&a.length===1&&D1t(s)}function z1t(e,r){const n=Math.min(e.length,r.length,240);for(let i=n;i>0;i--)if(B1t(e,r,i)&&e.endsWith(r.slice(0,i)))return i;return 0}function F1t(e,r){const n=qM(e),i=qM(r);if(!i)return n;if(!n)return i;if(n.endsWith(i))return n;if(i.startsWith(n))return i;const s=z1t(n,i);return s>0?`${n}${i.slice(s)}`.trim():`${n} ${i}`}const Oi=Zn(),H1t=uy(),fhe=28,GM=.05,phe="jait.viewMode";function lv(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function W1t(e,r){const n=lv(e);if(!r)return n;const i=lv(r);return n.startsWith(`${i}/`)?n.slice(i.length+1):n}function U1t(e,r){const n=new Map;if(!e)return n;const i=(s,a,o)=>{const l=lv(s),d=n.get(l)??{insertions:0,deletions:0};n.set(l,{insertions:d.insertions+a,deletions:d.deletions+o})};for(const s of[...e.index.files,...e.workingTree.files])i(s.path,s.insertions,s.deletions),r&&i(`${lv(r)}/${lv(s.path)}`,s.insertions,s.deletions);return n}function V1t(e,r,n){const i=U1t(r,n);return i.size===0?e:e.map(s=>{const a=lv(s.path),o=W1t(s.path,n),l=i.get(a)??i.get(o);return l?{...s,...l}:s})}function q1t(e,r){return e.length!==r.length?!1:e.every((n,i)=>{const s=r[i];return s&&n.path===s.path&&n.name===s.name&&n.kind===s.kind})}function G1t(e,r){return(e==null?void 0:e.surfaceId)===(r==null?void 0:r.surfaceId)&&(e==null?void 0:e.workspaceRoot)===(r==null?void 0:r.workspaceRoot)&&((e==null?void 0:e.nodeId)??"gateway")===((r==null?void 0:r.nodeId)??"gateway")}function K1t(e,r){const n=r.panel?{open:r.panel.open,remotePath:r.panel.remotePath,nodeId:r.panel.nodeId}:null;return JSON.stringify({workspaceId:e,panel:n,tabs:r.tabs,layout:r.layout,terminal:r.terminal,preview:r.preview})}function DG(e,r){return JSON.stringify(e??null)===JSON.stringify(r??null)}function IG(){return typeof window>"u"?"developer":window.localStorage.getItem(phe)==="manager"?"manager":"developer"}function Y1t({token:e,sessionId:r}){const[n,i]=y.useState([]),[s,a]=y.useState(""),[o,l]=y.useState(!1),[d,u]=y.useState(!1),f=n[0]??null,p=gw(f),g=y.useCallback((C=!1)=>{const j={};return e&&(j.Authorization=`Bearer ${e}`),C&&(j["Content-Type"]="application/json"),j},[e]),v=y.useCallback(async()=>{if(e)try{const C=await fetch(`${Oi}/api/secrets/requests`,{headers:g(),credentials:"include"});if(!C.ok)return;const j=await C.json();i(j.requests.filter(A=>!r||A.sessionId===r||gw(A)))}catch{}},[g,r,e]);y.useEffect(()=>{if(!e)return;v();const C=new WebSocket(`${H1t}?token=${encodeURIComponent(e)}`);return C.onmessage=j=>{try{const A=JSON.parse(j.data);if(A.type==="secret.requested"){const N=A.payload;(!r||N.sessionId===r||gw(N))&&i(E=>[N,...E.filter(P=>P.id!==N.id)])}if(A.type==="secret.resolved"){const N=A.payload;N.id&&(i(E=>E.filter(P=>P.id!==N.id)),a(""))}}catch{}},()=>C.close()},[v,r,e]);const b=y.useCallback(async()=>{if(!(!f||!s)){l(!0);try{if(!(await fetch(`${Oi}/api/secrets/requests/${f.id}/submit`,{method:"POST",headers:g(!0),credentials:"include",body:JSON.stringify({value:s})})).ok)throw new Error("Failed to submit secret");i(j=>j.filter(A=>A.id!==f.id)),a("")}catch(C){zn.error(C instanceof Error?C.message:"Failed to submit secret")}finally{l(!1)}}},[f,g,s]),_=y.useCallback(async()=>{if(f){l(!0);try{await fetch(`${Oi}/api/secrets/requests/${f.id}/cancel`,{method:"POST",headers:g(),credentials:"include"}),i(C=>C.filter(j=>j.id!==f.id)),a("")}finally{l(!1)}}},[f,g]),k=f?c.jsx(X1t,{request:f,value:s,onValueChange:a,submitting:o,showPassword:d,onShowPasswordChange:u,onSubmit:b,onCancel:_,showTitle:p}):null,w=M1t(f)?c.jsx(iu,{open:!0,onOpenChange:C=>{C||_()},children:c.jsxs(uc,{children:[c.jsxs(nd,{children:[c.jsx(dc,{children:f.title}),c.jsx(nf,{children:"Enter the secret to continue."})]}),k]})}):null;return{activeRequest:f,renderInline:p,form:k,dialog:w}}function X1t({request:e,value:r,onValueChange:n,submitting:i,showPassword:s,onShowPasswordChange:a,onSubmit:o,onCancel:l,showTitle:d=!1}){return c.jsxs("div",{className:"space-y-3",children:[d&&c.jsxs("div",{className:"space-y-0.5",children:[c.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:"This prompt is attached to the running tool call."})]}),c.jsx("div",{className:"space-y-1",children:c.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.prompt??"Enter the secret to continue."," The value goes directly to the local gateway and is not sent to the model."]})}),c.jsxs("div",{className:"relative",children:[c.jsx(mi,{htmlFor:`secret-input-${e.id}`,children:"Secret"}),c.jsx(qn,{id:`secret-input-${e.id}`,type:s?"text":"password",autoComplete:"current-password",placeholder:"Password",value:r,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&o()},className:"pr-9",autoFocus:!0}),c.jsx("button",{type:"button",tabIndex:-1,className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onMouseDown:u=>u.preventDefault(),onClick:()=>a(u=>!u),children:s?c.jsx(Pd,{className:"h-4 w-4"}):c.jsx(qh,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(we,{variant:"outline",onClick:()=>void l(),disabled:i,children:"Cancel"}),c.jsx(we,{onClick:()=>void o(),disabled:i||!r,children:"Submit"})]})]})}function J1t(e){const r=(e==null?void 0:e.trim())??"";return!r||r==="New Chat"||r.startsWith("Session ")}function X8(e){const r=e.replace(/\r/g,`
1474
+ }`;function lhe({color:e="#1FD5F9",colorShift:r=.05,lineWidth:n=2,blur:i=.5,uniformsRef:s,ref:a,className:o,...l}){const d=y.useMemo(()=>ohe(e),[e]);return y.useEffect(()=>{const u=s.current;u&&(u.uLineWidth.value=n,u.uSmoothing.value=i,u.uColor.value=d??[0,.7,1],u.uColorShift.value=r)},[s,d,r,n,i]),c.jsx("div",{ref:a,className:o,...l,children:c.jsx(lgt,{fs:_1t,devicePixelRatio:Math.min(globalThis.devicePixelRatio??1,1.5),uniforms:s.current,style:{width:"100%",height:"100%"}})})}lhe.displayName="WaveShader";const w1t=mj(["aspect-square"],{variants:{size:{icon:"h-[24px]",sm:"h-[56px]",md:"h-[112px]",lg:"h-[224px]",xl:"h-[448px]"}},defaultVariants:{size:"lg"}});function S1t({size:e="lg",state:r="speaking",color:n,colorShift:i=.05,lineWidth:s,blur:a,className:o,ref:l,...d}){const u=y.useMemo(()=>{if(s!==void 0)return s;switch(e){case"icon":case"sm":return 2;default:return 1}},[s,e]),{speed:f,amplitude:p,frequency:g,opacity:v}=b1t({state:r}),b=y.useRef({uSpeed:{type:"1f",value:f.get()},uAmplitude:{type:"1f",value:p.get()},uFrequency:{type:"1f",value:g.get()},uMix:{type:"1f",value:v.get()},uLineWidth:{type:"1f",value:u},uSmoothing:{type:"1f",value:.5},uColor:{type:"3fv",value:[0,.7,1]},uColorShift:{type:"1f",value:i}});return y.useEffect(()=>{const _=[f.on("change",k=>{b.current.uSpeed.value=k}),p.on("change",k=>{b.current.uAmplitude.value=k}),g.on("change",k=>{b.current.uFrequency.value=k}),v.on("change",k=>{b.current.uMix.value=k})];return()=>{for(const k of _)k()}},[f,p,g,v]),c.jsx(lhe,{ref:l,"data-lk-state":r,color:n,colorShift:i,lineWidth:u,blur:a,uniformsRef:b,className:Te(w1t({size:e}),"mask-[linear-gradient(90deg,transparent_0%,black_20%,black_80%,transparent_100%)]",o),...d})}function k1t(e,r){return`${e??""}::${r??""}`}function C1t({viewMode:e,sendTarget:r,workspaceId:n,workspaceRepoId:i,repositories:s,lastAppliedKey:a}){if(e!=="developer"||r!=="thread")return null;const o=k1t(n,i);return a===o?null:i?s.some(l=>l.id===i)?{nextAppliedKey:o,repoId:i}:null:{nextAppliedKey:o,repoId:null}}const che=16,j1t=280,N1t=200;function dj(e,r,n){return Math.min(Math.max(e,r),n)}function j3({size:e,viewport:r,margin:n=che}){const i=Math.max(220,r.width-n*2),s=Math.max(160,r.height-n*2),a=Math.min(j1t,i),o=Math.min(N1t,s);return{w:dj(e.w,a,i),h:dj(e.h,o,s)}}function W_({position:e,size:r,viewport:n}){return{x:dj(e.x,0,Math.max(0,n.width-r.w)),y:dj(e.y,0,Math.max(0,n.height-r.h))}}function T1t({size:e,viewport:r,margin:n=che}){return W_({position:{x:r.width-e.w-n,y:r.height-e.h-n},size:e,viewport:r})}function zL(e){return e.status==="running"}function E1t(e){return{disableSendTargetSelector:e.isLoadingHistory,showTodoList:!e.developerChatHydrating&&e.todoCount>0}}function A1t(e){return e.viewMode!=="developer"||e.currentView!=="chat"||e.requiresAuthGate?!1:e.authLoading||e.workspacesLoading?!0:e.activeSessionId?e.isLoadingHistory||e.loadingChatMode||e.loadingProviderRuntimeMode||e.loadingCliModels||e.loadingChatView:!1}const uhe=new Set(["ssh.run","run.ssh","ssh.session.start"]),O1t=new Set([...uhe,"elevated.run","terminal.run","jait.terminal","execute"]);function MG(e){return uhe.has(e)}function RG(e){const r=e.replace(/^functions\./,""),n=r.match(/^[^/]+\/(.+)$/);if(n!=null&&n[1])return Xu(n[1]);const i=r.match(/^mcp\.[^.]+\.(.+)$/);if(i!=null&&i[1])return Xu(i[1]);const s=r.match(/^mcp__[^.]+\.(.+)$/);if(s!=null&&s[1])return Xu(s[1]);const a=r.match(/^mcp__[^_]+__(.+)$/);return a!=null&&a[1]?Xu(a[1].replace(/^\./,"")):null}function gw(e){return e?O1t.has(e.requestedBy??"")||e.title==="SSH password"||e.title==="Administrator password"||e.title==="Terminal input required":!1}function M1t(e){return!!(e&&!gw(e))}function R1t(e,r,n){if(!gw(e))return!1;const i=Xu(r),s=RG(r);if(e!=null&&e.requestedBy&&(e.requestedBy===r||e.requestedBy===i||e.requestedBy===s))return!0;if((r==="mcp-tool"||i.startsWith("mcp."))&&n){const o=ON(Qc(r,n)),l=o.title?RG(o.title)??Xu(o.title):"";if(e!=null&&e.requestedBy&&e.requestedBy===l)return!0;if((e==null?void 0:e.title)==="SSH password")return MG(l);if((e==null?void 0:e.title)==="Terminal input required")return l==="terminal.run"||l==="jait.terminal"||l==="execute"}const a=s??i;return(e==null?void 0:e.title)==="SSH password"?MG(a):(e==null?void 0:e.title)==="Administrator password"?a==="elevated.run":(e==null?void 0:e.title)==="Terminal input required"?a==="terminal.run"||a==="jait.terminal"||a==="execute":!1}function dhe(e){return Array.isArray(e)?e:[]}function P1t(e,r){const n=dhe(r);return e.length>0&&n.length===0?e:n}function L1t(e){return e.length>0?e:null}function PG(e,r){return r?e.tree?{tree:!0,editor:!1}:e.editor?j0("editor"):bS():!e.tree&&!e.editor?{tree:!1,editor:!0}:e}function bS(){return{tree:!1,editor:!1}}function j0(e){return e==="tree"?{tree:!0,editor:!1}:{tree:!1,editor:!0}}function $1t(e="background"){return e==="editor"?j0("editor"):bS()}function LG(e,r){const n=r==="tree"?e.tree:e.editor,i=r==="tree"?e.editor:e.tree;return n&&!i?bS():j0(r)}function hhe(e){return e.showTerminal?"terminal":e.showWorkspace?e.showWorkspaceEditor?"editor":e.showWorkspaceTree?e.treeTab:null:null}function Mm(e,r){return hhe(e)===r}function $G(e){return!!e&&/[\p{L}\p{N}]/u.test(e)}function D1t(e){return e==="'"||e==="’"}function I1t(e){var r;return((r=e.match(/[\p{L}\p{N}'’]+$/u))==null?void 0:r[0])??""}function qM(e){return e.replace(/\s+/g," ").trim()}function B1t(e,r,n){if(n>=3)return!0;const i=e[e.length-n-1],s=r[n];if(n===2&&$G(i)&&s&&!$G(s)&&!/\s/.test(s))return!0;const a=I1t(e);return n===1&&a.length===1&&D1t(s)}function z1t(e,r){const n=Math.min(e.length,r.length,240);for(let i=n;i>0;i--)if(B1t(e,r,i)&&e.endsWith(r.slice(0,i)))return i;return 0}function F1t(e,r){const n=qM(e),i=qM(r);if(!i)return n;if(!n)return i;if(n.endsWith(i))return n;if(i.startsWith(n))return i;const s=z1t(n,i);return s>0?`${n}${i.slice(s)}`.trim():`${n} ${i}`}const Oi=Zn(),H1t=uy(),fhe=28,GM=.05,phe="jait.viewMode";function lv(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function W1t(e,r){const n=lv(e);if(!r)return n;const i=lv(r);return n.startsWith(`${i}/`)?n.slice(i.length+1):n}function U1t(e,r){const n=new Map;if(!e)return n;const i=(s,a,o)=>{const l=lv(s),d=n.get(l)??{insertions:0,deletions:0};n.set(l,{insertions:d.insertions+a,deletions:d.deletions+o})};for(const s of[...e.index.files,...e.workingTree.files])i(s.path,s.insertions,s.deletions),r&&i(`${lv(r)}/${lv(s.path)}`,s.insertions,s.deletions);return n}function V1t(e,r,n){const i=U1t(r,n);return i.size===0?e:e.map(s=>{const a=lv(s.path),o=W1t(s.path,n),l=i.get(a)??i.get(o);return l?{...s,...l}:s})}function q1t(e,r){return e.length!==r.length?!1:e.every((n,i)=>{const s=r[i];return s&&n.path===s.path&&n.name===s.name&&n.kind===s.kind})}function G1t(e,r){return(e==null?void 0:e.surfaceId)===(r==null?void 0:r.surfaceId)&&(e==null?void 0:e.workspaceRoot)===(r==null?void 0:r.workspaceRoot)&&((e==null?void 0:e.nodeId)??"gateway")===((r==null?void 0:r.nodeId)??"gateway")}function K1t(e,r){const n=r.panel?{open:r.panel.open,remotePath:r.panel.remotePath,nodeId:r.panel.nodeId}:null;return JSON.stringify({workspaceId:e,panel:n,tabs:r.tabs,layout:r.layout,terminal:r.terminal,preview:r.preview})}function DG(e,r){return JSON.stringify(e??null)===JSON.stringify(r??null)}function IG(){return typeof window>"u"?"developer":window.localStorage.getItem(phe)==="manager"?"manager":"developer"}function Y1t({token:e,sessionId:r}){const[n,i]=y.useState([]),[s,a]=y.useState(""),[o,l]=y.useState(!1),[d,u]=y.useState(!1),f=n[0]??null,p=gw(f),g=y.useCallback((C=!1)=>{const j={};return e&&(j.Authorization=`Bearer ${e}`),C&&(j["Content-Type"]="application/json"),j},[e]),v=y.useCallback(async()=>{if(e)try{const C=await fetch(`${Oi}/api/secrets/requests`,{headers:g(),credentials:"include"});if(!C.ok)return;const j=await C.json();i(j.requests.filter(A=>!r||A.sessionId===r||gw(A)))}catch{}},[g,r,e]);y.useEffect(()=>{if(!e)return;v();const C=new WebSocket(`${H1t}?token=${encodeURIComponent(e)}`);return C.onmessage=j=>{try{const A=JSON.parse(j.data);if(A.type==="secret.requested"){const N=A.payload;(!r||N.sessionId===r||gw(N))&&i(E=>[N,...E.filter(P=>P.id!==N.id)])}if(A.type==="secret.resolved"){const N=A.payload;N.id&&(i(E=>E.filter(P=>P.id!==N.id)),a(""))}}catch{}},()=>C.close()},[v,r,e]);const b=y.useCallback(async()=>{if(!(!f||!s)){l(!0);try{if(!(await fetch(`${Oi}/api/secrets/requests/${f.id}/submit`,{method:"POST",headers:g(!0),credentials:"include",body:JSON.stringify({value:s})})).ok)throw new Error("Failed to submit secret");i(j=>j.filter(A=>A.id!==f.id)),a("")}catch(C){zn.error(C instanceof Error?C.message:"Failed to submit secret")}finally{l(!1)}}},[f,g,s]),_=y.useCallback(async()=>{if(f){l(!0);try{await fetch(`${Oi}/api/secrets/requests/${f.id}/cancel`,{method:"POST",headers:g(),credentials:"include"}),i(C=>C.filter(j=>j.id!==f.id)),a("")}finally{l(!1)}}},[f,g]),k=f?c.jsx(X1t,{request:f,value:s,onValueChange:a,submitting:o,showPassword:d,onShowPasswordChange:u,onSubmit:b,onCancel:_,showTitle:p}):null,w=M1t(f)?c.jsx(iu,{open:!0,onOpenChange:C=>{C||_()},children:c.jsxs(uc,{children:[c.jsxs(nd,{children:[c.jsx(dc,{children:f.title}),c.jsx(nf,{children:"Enter the secret to continue."})]}),k]})}):null;return{activeRequest:f,renderInline:p,form:k,dialog:w}}function X1t({request:e,value:r,onValueChange:n,submitting:i,showPassword:s,onShowPasswordChange:a,onSubmit:o,onCancel:l,showTitle:d=!1}){return c.jsxs("div",{className:"space-y-2.5",children:[d&&c.jsxs("div",{className:"space-y-0.5",children:[c.jsx("p",{className:"text-[13px] font-medium leading-4 text-foreground",children:e.title}),c.jsx("p",{className:"text-[11px] leading-4 text-muted-foreground",children:"This prompt is attached to the running tool call."})]}),c.jsx("div",{children:c.jsxs("p",{className:"text-xs leading-5 text-muted-foreground",children:[e.prompt??"Enter the secret to continue."," ",c.jsx("span",{className:"hidden sm:inline",children:"The value goes directly to the local gateway and is not sent to the model."})]})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(mi,{className:"text-xs",htmlFor:`secret-input-${e.id}`,children:"Secret"}),c.jsxs("div",{className:"relative",children:[c.jsx(qn,{id:`secret-input-${e.id}`,type:s?"text":"password",autoComplete:"current-password",placeholder:"Password",value:r,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&o()},className:"h-9 pr-10 text-sm",autoFocus:!0}),c.jsx("button",{type:"button",tabIndex:-1,className:"absolute inset-y-0 right-0 flex w-9 items-center justify-center text-muted-foreground transition-colors hover:text-foreground",onMouseDown:u=>u.preventDefault(),onClick:()=>a(u=>!u),children:s?c.jsx(Pd,{className:"h-4 w-4"}):c.jsx(qh,{className:"h-4 w-4"})})]})]}),c.jsxs("div",{className:"flex justify-end gap-1.5",children:[c.jsx(we,{className:"h-8 px-3 text-xs",variant:"ghost",onClick:()=>void l(),disabled:i,children:"Cancel"}),c.jsx(we,{className:"h-8 px-3 text-xs",onClick:()=>void o(),disabled:i||!r,children:"Submit"})]})]})}function J1t(e){const r=(e==null?void 0:e.trim())??"";return!r||r==="New Chat"||r.startsWith("Session ")}function X8(e){const r=e.replace(/\r/g,`
1475
1475
  `).split(`
1476
1476
  `).map(i=>i.trim()).find(Boolean)??"";if(!r)return"";const n=r.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77).trimEnd()}...`:n}function N3(e,r){const n=[...e??[]];for(const i of r??[])i.mimeType.startsWith("image/")&&n.push({type:"image",name:i.name,mimeType:i.mimeType,data:i.data});return n.length>0?n:void 0}function J8(){return Array.from({length:fhe},()=>GM)}function Z1t(e,r=220){var s,a;const n=e.replace(/```[\s\S]*?```/g," code omitted ").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[#>*_~-]+/g," ").replace(/\s+/g," ").trim();if(!n)return"";const i=((a=(s=n.match(/[^.!?]+[.!?]/))==null?void 0:s[0])==null?void 0:a.trim())??n;return i.length<=r?i:`${i.slice(0,r-1).trimEnd()}…`}function Z8(e){const r=(e==null?void 0:e.trim())||"";return r&&r!=="__preview__"?r:null}function T3(e,r){return typeof e!="string"?r:e.trim()||r}function Q1t(e,r,n){return[{type:"file",path:e.path,name:e.name,...e.kind?{kind:e.kind}:{},lineRange:{startLine:r,endLine:n}}]}function evt(e,r,n,i){const s=Math.max(1,r.split(/\r?\n/).length),a=n&&i&&i>=n?{startLine:n,endLine:i}:{startLine:1,endLine:s};return[{type:"terminal",terminalId:e.terminalId,name:e.name,...e.workspaceRoot?{workspaceRoot:e.workspaceRoot}:{},lineRange:a,selectedText:r.trim()}]}function tvt(e){var s,a,o;const r=((s=e.name)==null?void 0:s.trim())||((a=e.text)==null?void 0:a.trim())||((o=e.placeholder)==null?void 0:o.trim())||"unnamed element";return[{type:"text",text:`${[`Selected preview element: ${e.role??e.tagName??"element"} "${r}"`,e.selector?`Selector: ${e.selector}`:null,e.placeholder?`Placeholder: ${e.placeholder}`:null,e.value?`Value: ${e.value}`:null].filter(Boolean).join(`
1477
1477
  `)}