@jait/gateway 0.1.363 → 0.1.364

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 (54) hide show
  1. package/package.json +1 -1
  2. package/web-dist/assets/{_basePickBy-BVnnNxms.js → _basePickBy-BnQSSl-2.js} +1 -1
  3. package/web-dist/assets/{_baseUniq-DHfMhK0B.js → _baseUniq-CmghQVfx.js} +1 -1
  4. package/web-dist/assets/{arc-ClIovu8_.js → arc-Drj86r-C.js} +1 -1
  5. package/web-dist/assets/{architectureDiagram-2XIMDMQ5-BrXt9ZTR.js → architectureDiagram-2XIMDMQ5-CY99qKNe.js} +1 -1
  6. package/web-dist/assets/{blockDiagram-WCTKOSBZ-BoNpL7BZ.js → blockDiagram-WCTKOSBZ-DvUj70fF.js} +1 -1
  7. package/web-dist/assets/{c4Diagram-IC4MRINW-DrM7dUBi.js → c4Diagram-IC4MRINW-BwBlLyjg.js} +1 -1
  8. package/web-dist/assets/channel-BKOCK4zC.js +1 -0
  9. package/web-dist/assets/{chunk-4BX2VUAB-DAcmBV55.js → chunk-4BX2VUAB-CgQPshBa.js} +1 -1
  10. package/web-dist/assets/{chunk-55IACEB6-BD7okW8P.js → chunk-55IACEB6-CyF8STmH.js} +1 -1
  11. package/web-dist/assets/{chunk-FMBD7UC4-CVUylkwH.js → chunk-FMBD7UC4-B3TJNG7E.js} +1 -1
  12. package/web-dist/assets/{chunk-JSJVCQXG-CpzpHyYI.js → chunk-JSJVCQXG-B3DvG0Rg.js} +1 -1
  13. package/web-dist/assets/{chunk-KX2RTZJC-3nQU2I3Z.js → chunk-KX2RTZJC-CKlarQZc.js} +1 -1
  14. package/web-dist/assets/{chunk-NQ4KR5QH-BVrdVP-a.js → chunk-NQ4KR5QH-CJMFf6il.js} +1 -1
  15. package/web-dist/assets/{chunk-QZHKN3VN-D6Xe4p-H.js → chunk-QZHKN3VN-CgWpAImR.js} +1 -1
  16. package/web-dist/assets/{chunk-WL4C6EOR-Bowdkvz4.js → chunk-WL4C6EOR-Bf5wttYA.js} +1 -1
  17. package/web-dist/assets/classDiagram-VBA2DB6C-DNItKY-M.js +1 -0
  18. package/web-dist/assets/classDiagram-v2-RAHNMMFH-DNItKY-M.js +1 -0
  19. package/web-dist/assets/clone-vDhNOeVp.js +1 -0
  20. package/web-dist/assets/{cose-bilkent-S5V4N54A-CjTr52Qa.js → cose-bilkent-S5V4N54A-CJkhUxb_.js} +1 -1
  21. package/web-dist/assets/{dagre-KLK3FWXG-DxcHj3cT.js → dagre-KLK3FWXG-BqFk2thM.js} +1 -1
  22. package/web-dist/assets/{diagram-E7M64L7V-DVtwzZFE.js → diagram-E7M64L7V-PlG4RFpY.js} +1 -1
  23. package/web-dist/assets/{diagram-IFDJBPK2-BPcNixny.js → diagram-IFDJBPK2-DIH9SGPR.js} +1 -1
  24. package/web-dist/assets/{diagram-P4PSJMXO-ZVxa9Zv9.js → diagram-P4PSJMXO-DFPzW-Yk.js} +1 -1
  25. package/web-dist/assets/{erDiagram-INFDFZHY-hCjVXBF3.js → erDiagram-INFDFZHY-hcPKpSdA.js} +1 -1
  26. package/web-dist/assets/{flowDiagram-PKNHOUZH-CVY77oa4.js → flowDiagram-PKNHOUZH-Dx_JetEF.js} +1 -1
  27. package/web-dist/assets/{ganttDiagram-A5KZAMGK-DzwIOJW0.js → ganttDiagram-A5KZAMGK-Bk8hmhU0.js} +1 -1
  28. package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-SWKYEcg9.js → gitGraphDiagram-K3NZZRJ6-DQrX1J2A.js} +1 -1
  29. package/web-dist/assets/{graph-C_3EYUr_.js → graph-NhCWBngP.js} +1 -1
  30. package/web-dist/assets/{index-P4TxhPgq.js → index-KZLjqX7H.js} +4 -4
  31. package/web-dist/assets/{infoDiagram-LFFYTUFH-B439uASH.js → infoDiagram-LFFYTUFH-Dtd-9vtP.js} +1 -1
  32. package/web-dist/assets/{ishikawaDiagram-PHBUUO56-DmVBLQ_7.js → ishikawaDiagram-PHBUUO56-Crkaba7p.js} +1 -1
  33. package/web-dist/assets/{journeyDiagram-4ABVD52K-DFKOzyNO.js → journeyDiagram-4ABVD52K-CxffY7iH.js} +1 -1
  34. package/web-dist/assets/{kanban-definition-K7BYSVSG-Cj4NEMMW.js → kanban-definition-K7BYSVSG-CP7DTmQZ.js} +1 -1
  35. package/web-dist/assets/{layout-DjOJnxsj.js → layout-CSKkO6LH.js} +1 -1
  36. package/web-dist/assets/{linear-ClWGoFB0.js → linear-CKPXvOyt.js} +1 -1
  37. package/web-dist/assets/{mindmap-definition-YRQLILUH-BIqXXGa5.js → mindmap-definition-YRQLILUH-DjVIH7uQ.js} +1 -1
  38. package/web-dist/assets/{pieDiagram-SKSYHLDU-DFS-RY8U.js → pieDiagram-SKSYHLDU-MKsbY7Yq.js} +1 -1
  39. package/web-dist/assets/{quadrantDiagram-337W2JSQ-N917JbRl.js → quadrantDiagram-337W2JSQ-DxNL7OJL.js} +1 -1
  40. package/web-dist/assets/{requirementDiagram-Z7DCOOCP-llsXfLyW.js → requirementDiagram-Z7DCOOCP-BD02UvYv.js} +1 -1
  41. package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-BGByBKcG.js → sankeyDiagram-WA2Y5GQK-DjfNwyeb.js} +1 -1
  42. package/web-dist/assets/{sequenceDiagram-2WXFIKYE-wonh9px7.js → sequenceDiagram-2WXFIKYE-rip1O_fj.js} +1 -1
  43. package/web-dist/assets/{stateDiagram-RAJIS63D-BYRdANev.js → stateDiagram-RAJIS63D-CSSWfCDd.js} +1 -1
  44. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-D9DmVnnW.js +1 -0
  45. package/web-dist/assets/{timeline-definition-YZTLITO2-Bx1-xTSg.js → timeline-definition-YZTLITO2-8H2XLII3.js} +1 -1
  46. package/web-dist/assets/{treemap-KZPCXAKY-DC3JzCn2.js → treemap-KZPCXAKY-CXHIPV1w.js} +1 -1
  47. package/web-dist/assets/{vennDiagram-LZ73GAT5-QVosgTmj.js → vennDiagram-LZ73GAT5-CZ3zFNwo.js} +1 -1
  48. package/web-dist/assets/{xychartDiagram-JWTSCODW-BNcJMlHs.js → xychartDiagram-JWTSCODW-BpncthKC.js} +1 -1
  49. package/web-dist/index.html +1 -1
  50. package/web-dist/assets/channel-C_fVClUB.js +0 -1
  51. package/web-dist/assets/classDiagram-VBA2DB6C-CliLcvbA.js +0 -1
  52. package/web-dist/assets/classDiagram-v2-RAHNMMFH-CliLcvbA.js +0 -1
  53. package/web-dist/assets/clone-DFp_Q9gp.js +0 -1
  54. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-p-DbZa8A.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-DxcHj3cT.js","./graph-C_3EYUr_.js","./_baseUniq-DHfMhK0B.js","./layout-DjOJnxsj.js","./_basePickBy-BVnnNxms.js","./clone-DFp_Q9gp.js","./cose-bilkent-S5V4N54A-CjTr52Qa.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-DrM7dUBi.js","./chunk-JSJVCQXG-CpzpHyYI.js","./flowDiagram-PKNHOUZH-CVY77oa4.js","./chunk-FMBD7UC4-CVUylkwH.js","./chunk-55IACEB6-BD7okW8P.js","./chunk-KX2RTZJC-3nQU2I3Z.js","./channel-C_fVClUB.js","./erDiagram-INFDFZHY-hCjVXBF3.js","./gitGraphDiagram-K3NZZRJ6-SWKYEcg9.js","./chunk-4BX2VUAB-DAcmBV55.js","./chunk-QZHKN3VN-D6Xe4p-H.js","./treemap-KZPCXAKY-DC3JzCn2.js","./ganttDiagram-A5KZAMGK-DzwIOJW0.js","./linear-ClWGoFB0.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-B439uASH.js","./pieDiagram-SKSYHLDU-DFS-RY8U.js","./arc-ClIovu8_.js","./quadrantDiagram-337W2JSQ-N917JbRl.js","./xychartDiagram-JWTSCODW-BNcJMlHs.js","./requirementDiagram-Z7DCOOCP-llsXfLyW.js","./sequenceDiagram-2WXFIKYE-wonh9px7.js","./classDiagram-VBA2DB6C-CliLcvbA.js","./chunk-WL4C6EOR-Bowdkvz4.js","./classDiagram-v2-RAHNMMFH-CliLcvbA.js","./stateDiagram-RAJIS63D-BYRdANev.js","./chunk-NQ4KR5QH-BVrdVP-a.js","./stateDiagram-v2-FVOUBMTO-p-DbZa8A.js","./journeyDiagram-4ABVD52K-DFKOzyNO.js","./timeline-definition-YZTLITO2-Bx1-xTSg.js","./mindmap-definition-YRQLILUH-BIqXXGa5.js","./kanban-definition-K7BYSVSG-Cj4NEMMW.js","./diagram-P4PSJMXO-ZVxa9Zv9.js","./diagram-IFDJBPK2-BPcNixny.js","./blockDiagram-WCTKOSBZ-BoNpL7BZ.js","./architectureDiagram-2XIMDMQ5-BrXt9ZTR.js","./diagram-E7M64L7V-DVtwzZFE.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-BqFk2thM.js","./graph-NhCWBngP.js","./_baseUniq-CmghQVfx.js","./layout-CSKkO6LH.js","./_basePickBy-BnQSSl-2.js","./clone-vDhNOeVp.js","./cose-bilkent-S5V4N54A-CJkhUxb_.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-BwBlLyjg.js","./chunk-JSJVCQXG-B3DvG0Rg.js","./flowDiagram-PKNHOUZH-Dx_JetEF.js","./chunk-FMBD7UC4-B3TJNG7E.js","./chunk-55IACEB6-CyF8STmH.js","./chunk-KX2RTZJC-CKlarQZc.js","./channel-BKOCK4zC.js","./erDiagram-INFDFZHY-hcPKpSdA.js","./gitGraphDiagram-K3NZZRJ6-DQrX1J2A.js","./chunk-4BX2VUAB-CgQPshBa.js","./chunk-QZHKN3VN-CgWpAImR.js","./treemap-KZPCXAKY-CXHIPV1w.js","./ganttDiagram-A5KZAMGK-Bk8hmhU0.js","./linear-CKPXvOyt.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-Dtd-9vtP.js","./pieDiagram-SKSYHLDU-MKsbY7Yq.js","./arc-Drj86r-C.js","./quadrantDiagram-337W2JSQ-DxNL7OJL.js","./xychartDiagram-JWTSCODW-BpncthKC.js","./requirementDiagram-Z7DCOOCP-BD02UvYv.js","./sequenceDiagram-2WXFIKYE-rip1O_fj.js","./classDiagram-VBA2DB6C-DNItKY-M.js","./chunk-WL4C6EOR-Bf5wttYA.js","./classDiagram-v2-RAHNMMFH-DNItKY-M.js","./stateDiagram-RAJIS63D-CSSWfCDd.js","./chunk-NQ4KR5QH-CJMFf6il.js","./stateDiagram-v2-FVOUBMTO-D9DmVnnW.js","./journeyDiagram-4ABVD52K-CxffY7iH.js","./timeline-definition-YZTLITO2-8H2XLII3.js","./mindmap-definition-YRQLILUH-DjVIH7uQ.js","./kanban-definition-K7BYSVSG-CP7DTmQZ.js","./diagram-P4PSJMXO-DFPzW-Yk.js","./diagram-IFDJBPK2-DIH9SGPR.js","./blockDiagram-WCTKOSBZ-DvUj70fF.js","./architectureDiagram-2XIMDMQ5-CY99qKNe.js","./diagram-E7M64L7V-PlG4RFpY.js"])))=>i.map(i=>d[i]);
2
2
  var yhe=Object.defineProperty;var vhe=(e,r,n)=>r in e?yhe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Fe=(e,r,n)=>vhe(e,typeof r!="symbol"?r+"":r,n);function xhe(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function B0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g1t(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var n=function i(){return this instanceof i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),n}var sT={exports:{}},Jx={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -1116,8 +1116,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
1116
1116
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,o=Math.abs(i-n.x),a=e.width/2;let l=n.x<r.x?a-o:a+o;const d=e.height/2,u=Math.abs(r.y-n.y),h=Math.abs(r.x-n.x);if(Math.abs(s-r.y)*a>Math.abs(i-r.x)*d){let p=n.y<r.y?r.y-d-s:s-d-r.y;l=h*p/u;const g={x:n.x<r.x?n.x+l:n.x-h+l,y:n.y<r.y?n.y+u-p:n.y-u+p};return l===0&&(g.x=r.x,g.y=r.y),h===0&&(g.x=r.x),u===0&&(g.y=r.y),_t.debug(`abc89 top/bottom calc, Q ${u}, q ${p}, R ${h}, r ${l}`,g),g}else{n.x<r.x?l=r.x-a-i:l=i-a-r.x;let p=u*l/h,g=n.x<r.x?n.x+h-l:n.x-h+l,v=n.y<r.y?n.y+p:n.y-p;return _t.debug(`sides calc abc89, Q ${u}, q ${p}, R ${h}, r ${l}`,{_x:g,_y:v}),l===0&&(g=r.x,v=r.y),h===0&&(g=r.x),u===0&&(v=r.y),{x:g,y:v}}},"intersection"),TF=X((e,r)=>{_t.warn("abc88 cutPathAtIntersect",e,r);let n=[],i=e[0],s=!1;return e.forEach(o=>{if(_t.info("abc88 checking point",o,r),!nVe(r,o)&&!s){const a=iVe(r,i,o);_t.debug("abc88 inside",o,i,a),_t.debug("abc88 intersection",a,r);let l=!1;n.forEach(d=>{l=l||d.x===a.x&&d.y===a.y}),n.some(d=>d.x===a.x&&d.y===a.y)?_t.warn("abc88 no intersect",a,n):n.push(a),s=!0}else _t.warn("abc88 outside",o,i),i=o,s||n.push(o)}),_t.debug("returning points",n),n},"cutPathAtIntersect");function gse(e){const r=[],n=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],o=e[i],a=e[i+1];(s.x===o.x&&o.y===a.y&&Math.abs(o.x-a.x)>5&&Math.abs(o.y-s.y)>5||s.y===o.y&&o.x===a.x&&Math.abs(o.x-s.x)>5&&Math.abs(o.y-a.y)>5)&&(r.push(o),n.push(i))}return{cornerPoints:r,cornerPointPositions:n}}X(gse,"extractCornerPoints");var NF=X(function(e,r,n){const i=r.x-e.x,s=r.y-e.y,o=Math.sqrt(i*i+s*s),a=n/o;return{x:r.x-a*i,y:r.y-a*s}},"findAdjacentPoint"),sVe=X(function(e){const{cornerPointPositions:r}=gse(e),n=[];for(let i=0;i<e.length;i++)if(r.includes(i)){const s=e[i-1],o=e[i+1],a=e[i],l=NF(s,a,5),d=NF(o,a,5),u=d.x-l.x,h=d.y-l.y;n.push(l);const p=Math.sqrt(2)*2;let g={x:a.x,y:a.y};if(Math.abs(o.x-s.x)>10&&Math.abs(o.y-s.y)>=10){_t.debug("Corner point fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));const v=5;a.x===l.x?g={x:u<0?l.x-v+p:l.x+v-p,y:h<0?l.y-p:l.y+p}:g={x:u<0?l.x-p:l.x+p,y:h<0?l.y-v+p:l.y+v-p}}else _t.debug("Corner point skipping fixing",Math.abs(o.x-s.x),Math.abs(o.y-s.y));n.push(g,d)}else n.push(e[i]);return n},"fixCorners"),oVe=X((e,r,n)=>{const i=e-r-n,s=2,o=2,a=s+o,l=Math.floor(i/a),d=Array(l).fill(`${s} ${o}`).join(" ");return`0 ${r} ${d} ${n}`},"generateDashArray"),aVe=X(function(e,r,n,i,s,o,a,l=!1){var L;const{handDrawnSeed:d}=ii();let u=r.points,h=!1;const p=s;var g=o;const v=[];for(const B in r.cssCompiledStyles)gne(B)||v.push(r.cssCompiledStyles[B]);_t.debug("UIO intersect check",r.points,g.x,p.x),g.intersect&&p.intersect&&!l&&(u=u.slice(1,r.points.length-1),u.unshift(p.intersect(u[0])),_t.debug("Last point UIO",r.start,"-->",r.end,u[u.length-1],g,g.intersect(u[u.length-1])),u.push(g.intersect(u[u.length-1])));const b=btoa(JSON.stringify(u));r.toCluster&&(_t.info("to cluster abc88",n.get(r.toCluster)),u=TF(r.points,n.get(r.toCluster).node),h=!0),r.fromCluster&&(_t.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(u,null,2)),u=TF(u.reverse(),n.get(r.fromCluster).node).reverse(),h=!0);let _=u.filter(B=>!Number.isNaN(B.y));const k=eVe(r.curve);k!=="rounded"&&(_=sVe(_));let w=R_;switch(k){case"linear":w=R_;break;case"basis":w=PA;break;case"cardinal":w=Xee;break;case"bumpX":w=Vee;break;case"bumpY":w=qee;break;case"catmullRom":w=Jee;break;case"monotoneX":w=ite;break;case"monotoneY":w=ste;break;case"natural":w=ate;break;case"step":w=lte;break;case"stepAfter":w=ute;break;case"stepBefore":w=cte;break;case"rounded":w=R_;break;default:w=PA}const{x:C,y:j}=nze(r),T=MIe().x(C).y(j).curve(w);let A;switch(r.thickness){case"normal":A="edge-thickness-normal";break;case"thick":A="edge-thickness-thick";break;case"invisible":A="edge-thickness-invisible";break;default:A="edge-thickness-normal"}switch(r.pattern){case"solid":A+=" edge-pattern-solid";break;case"dotted":A+=" edge-pattern-dotted";break;case"dashed":A+=" edge-pattern-dashed";break;default:A+=" edge-pattern-solid"}let E,R=k==="rounded"?yse(vse(_,r),5):T(_);const P=Array.isArray(r.style)?r.style:[r.style];let H=P.find(B=>B==null?void 0:B.startsWith("stroke:")),$="";r.animate&&($="edge-animation-fast"),r.animation&&($="edge-animation-"+r.animation);let U=!1;if(r.look==="handDrawn"){const B=br.svg(e);Object.assign([],_);const W=B.path(R,{roughness:.3,seed:d});A+=" transition",E=Dr(W).select("path").attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",P?P.reduce((F,V)=>F+";"+V,""):"");let K=E.attr("d");E.attr("d",K),e.node().appendChild(E.node())}else{const B=v.join(";"),W=P?P.reduce((ee,re)=>ee+re+";",""):"",K=(B?B+";"+W+";":W)+";"+(P?P.reduce((ee,re)=>ee+";"+re,""):"");E=e.append("path").attr("d",R).attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",K),H=(L=K.match(/stroke:([^;]+)/))==null?void 0:L[1],U=r.animate===!0||!!r.animation||B.includes("animation");const F=E.node(),V=typeof F.getTotalLength=="function"?F.getTotalLength():0,Q=Wz[r.arrowTypeStart]||0,q=Wz[r.arrowTypeEnd]||0;if(r.look==="neo"&&!U){const re=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?oVe(V,Q,q):`0 ${Q} ${V-Q-q} ${q}`}; stroke-dashoffset: 0;`;E.attr("style",re+E.attr("style"))}}E.attr("data-edge",!0),E.attr("data-et","edge"),E.attr("data-id",r.id),E.attr("data-points",b),r.showPoints&&_.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let I="";(ii().flowchart.arrowMarkerAbsolute||ii().state.arrowMarkerAbsolute)&&(I=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,I=I.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),_t.info("arrowTypeStart",r.arrowTypeStart),_t.info("arrowTypeEnd",r.arrowTypeEnd),JUe(E,r,I,a,i,H);const Y=Math.floor(u.length/2),M=u[Y];sd.isLabelCoordinateInPath(M,E.attr("d"))||(h=!0);let z={};return h&&(z.updatedPath=u),z.originalPath=r.points,z},"insertEdge");function yse(e,r){if(e.length<2)return"";let n="";const i=e.length,s=1e-5;for(let o=0;o<i;o++){const a=e[o],l=e[o-1],d=e[o+1];if(o===0)n+=`M${a.x},${a.y}`;else if(o===i-1)n+=`L${a.x},${a.y}`;else{const u=a.x-l.x,h=a.y-l.y,p=d.x-a.x,g=d.y-a.y,v=Math.hypot(u,h),b=Math.hypot(p,g);if(v<s||b<s){n+=`L${a.x},${a.y}`;continue}const _=u/v,k=h/v,w=p/b,C=g/b,j=_*w+k*C,T=Math.max(-1,Math.min(1,j)),A=Math.acos(T);if(A<s||Math.abs(Math.PI-A)<s){n+=`L${a.x},${a.y}`;continue}const E=Math.min(r/Math.sin(A/2),v/2,b/2),R=a.x-_*E,P=a.y-k*E,H=a.x+w*E,$=a.y+C*E;n+=`L${R},${P}`,n+=`Q${a.x},${a.y} ${H},${$}`}}return n}X(yse,"generateRoundedPath");function lO(e,r){if(!e||!r)return{angle:0,deltaX:0,deltaY:0};const n=r.x-e.x,i=r.y-e.y;return{angle:Math.atan2(i,n),deltaX:n,deltaY:i}}X(lO,"calculateDeltaAndAngle");function vse(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&ja[r.arrowTypeStart]){const s=ja[r.arrowTypeStart],o=e[0],a=e[1],{angle:l}=lO(o,a),d=s*Math.cos(l),u=s*Math.sin(l);n[0].x=o.x+d,n[0].y=o.y+u}const i=e.length;if(i>=2&&ja[r.arrowTypeEnd]){const s=ja[r.arrowTypeEnd],o=e[i-1],a=e[i-2],{angle:l}=lO(a,o),d=s*Math.cos(l),u=s*Math.sin(l);n[i-1].x=o.x-d,n[i-1].y=o.y-u}return n}X(vse,"applyMarkerOffsetsToPoints");var lVe=X((e,r,n,i)=>{r.forEach(s=>{kVe[s](e,n,i)})},"insertMarkers"),cVe=X((e,r,n)=>{_t.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionStart").attr("class","marker extension "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionEnd").attr("class","marker extension "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),uVe=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"),dVe=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"),hVe=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"),fVe=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"),pVe=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"),mVe=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"),gVe=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"),yVe=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"),vVe=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"),xVe=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"),bVe=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"),_Ve=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"),wVe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
1117
1117
  L20,10
1118
1118
  M20,10
1119
- L0,20`)},"requirement_arrow"),SVe=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"),kVe={extension:cVe,composition:uVe,aggregation:dVe,dependency:hVe,lollipop:fVe,point:pVe,circle:mVe,cross:gVe,barb:yVe,only_one:vVe,zero_or_one:xVe,one_or_more:bVe,zero_or_more:_Ve,requirement_arrow:wVe,requirement_contains:SVe},CVe=lVe,jVe={common:_S,getConfig:Ma,insertCluster:RUe,insertEdge:aVe,insertEdgeLabel:tVe,insertMarkers:CVe,insertNode:mse,interpolateToCurve:jM,labelHelper:Hr,log:_t,positionEdgeLabel:rVe},V2={},xse=X(e=>{for(const r of e)V2[r.name]=r},"registerLayoutLoaders"),TVe=X(()=>{xse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-DxcHj3cT.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ge(()=>import("./cose-bilkent-S5V4N54A-CjTr52Qa.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");TVe();var nvt=X(async(e,r)=>{if(!(e.layoutAlgorithm in V2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=V2[e.layoutAlgorithm];return(await n.loader()).render(e,r,jVe,{algorithm:n.algorithm})},"render"),ivt=X((e="",{fallback:r="dagre"}={})=>{if(e in V2)return e;if(r in V2)return _t.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),NVe=Yre(Object.keys,Object),EVe=Object.prototype,AVe=EVe.hasOwnProperty;function OVe(e){if(!Vj(e))return NVe(e);var r=[];for(var n in Object(e))AVe.call(e,n)&&n!="constructor"&&r.push(n);return r}var cO=Y0(Td,"DataView"),uO=Y0(Td,"Promise"),dO=Y0(Td,"Set"),hO=Y0(Td,"WeakMap"),EF="[object Map]",RVe="[object Object]",AF="[object Promise]",OF="[object Set]",RF="[object WeakMap]",MF="[object DataView]",MVe=K0(cO),PVe=K0(W2),LVe=K0(uO),$Ve=K0(dO),DVe=K0(hO),Gg=G0;(cO&&Gg(new cO(new ArrayBuffer(1)))!=MF||W2&&Gg(new W2)!=EF||uO&&Gg(uO.resolve())!=AF||dO&&Gg(new dO)!=OF||hO&&Gg(new hO)!=RF)&&(Gg=function(e){var r=G0(e),n=r==RVe?e.constructor:void 0,i=n?K0(n):"";if(i)switch(i){case MVe:return MF;case PVe:return EF;case LVe:return AF;case $Ve:return OF;case DVe:return RF}return r});var IVe="[object Map]",BVe="[object Set]",zVe=Object.prototype,FVe=zVe.hasOwnProperty;function PF(e){if(e==null)return!0;if(qj(e)&&(I5(e)||typeof e=="string"||typeof e.splice=="function"||kM(e)||CM(e)||D5(e)))return!e.length;var r=Gg(e);if(r==IVe||r==BVe)return!e.size;if(Vj(e))return!OVe(e).length;for(var n in e)if(FVe.call(e,n))return!1;return!0}var bse="c4",HVe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),WVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-DrM7dUBi.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:bse,diagram:e}},"loader"),UVe={id:bse,detector:HVe,loader:WVe},VVe=UVe,_se="flowchart",qVe=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"),GVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CVY77oa4.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:_se,diagram:e}},"loader"),KVe={id:_se,detector:qVe,loader:GVe},YVe=KVe,wse="flowchart-v2",XVe=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"),ZVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CVY77oa4.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:wse,diagram:e}},"loader"),JVe={id:wse,detector:XVe,loader:ZVe},QVe=JVe,Sse="er",eqe=X(e=>/^\s*erDiagram/.test(e),"detector"),tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-hCjVXBF3.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Sse,diagram:e}},"loader"),rqe={id:Sse,detector:eqe,loader:tqe},nqe=rqe,kse="gitGraph",iqe=X(e=>/^\s*gitGraph/.test(e),"detector"),sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-SWKYEcg9.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:kse,diagram:e}},"loader"),oqe={id:kse,detector:iqe,loader:sqe},aqe=oqe,Cse="gantt",lqe=X(e=>/^\s*gantt/.test(e),"detector"),cqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-DzwIOJW0.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:Cse,diagram:e}},"loader"),uqe={id:Cse,detector:lqe,loader:cqe},dqe=uqe,jse="info",hqe=X(e=>/^\s*info/.test(e),"detector"),fqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-B439uASH.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:jse,diagram:e}},"loader"),pqe={id:jse,detector:hqe,loader:fqe},Tse="pie",mqe=X(e=>/^\s*pie/.test(e),"detector"),gqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-DFS-RY8U.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:Tse,diagram:e}},"loader"),yqe={id:Tse,detector:mqe,loader:gqe},Nse="quadrantChart",vqe=X(e=>/^\s*quadrantChart/.test(e),"detector"),xqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-N917JbRl.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Nse,diagram:e}},"loader"),bqe={id:Nse,detector:vqe,loader:xqe},_qe=bqe,Ese="xychart",wqe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-BNcJMlHs.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Ese,diagram:e}},"loader"),kqe={id:Ese,detector:wqe,loader:Sqe},Cqe=kqe,Ase="requirement",jqe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-llsXfLyW.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:Ase,diagram:e}},"loader"),Nqe={id:Ase,detector:jqe,loader:Tqe},Eqe=Nqe,Ose="sequence",Aqe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),Oqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-wonh9px7.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Ose,diagram:e}},"loader"),Rqe={id:Ose,detector:Aqe,loader:Oqe},Mqe=Rqe,Rse="class",Pqe=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"),Lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-CliLcvbA.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:Rse,diagram:e}},"loader"),$qe={id:Rse,detector:Pqe,loader:Lqe},Dqe=$qe,Mse="classDiagram",Iqe=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"),Bqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-CliLcvbA.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Mse,diagram:e}},"loader"),zqe={id:Mse,detector:Iqe,loader:Bqe},Fqe=zqe,Pse="state",Hqe=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"),Wqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-BYRdANev.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Pse,diagram:e}},"loader"),Uqe={id:Pse,detector:Hqe,loader:Wqe},Vqe=Uqe,Lse="stateDiagram",qqe=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"),Gqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-p-DbZa8A.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Lse,diagram:e}},"loader"),Kqe={id:Lse,detector:qqe,loader:Gqe},Yqe=Kqe,$se="journey",Xqe=X(e=>/^\s*journey/.test(e),"detector"),Zqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-DFKOzyNO.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:$se,diagram:e}},"loader"),Jqe={id:$se,detector:Xqe,loader:Zqe},Qqe=Jqe,eGe=X((e,r,n)=>{_t.debug(`rendering svg for syntax error
1120
- `);const i=YIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),dee(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"),Dse={draw:eGe},tGe=Dse,rGe={db:{},renderer:Dse,parser:{parse:X(()=>{},"parse")}},nGe=rGe,Ise="flowchart-elk",iGe=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"),sGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CVY77oa4.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Ise,diagram:e}},"loader"),oGe={id:Ise,detector:iGe,loader:sGe},aGe=oGe,Bse="timeline",lGe=X(e=>/^\s*timeline/.test(e),"detector"),cGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-Bx1-xTSg.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:Bse,diagram:e}},"loader"),uGe={id:Bse,detector:lGe,loader:cGe},dGe=uGe,zse="mindmap",hGe=X(e=>/^\s*mindmap/.test(e),"detector"),fGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-BIqXXGa5.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:zse,diagram:e}},"loader"),pGe={id:zse,detector:hGe,loader:fGe},mGe=pGe,Fse="kanban",gGe=X(e=>/^\s*kanban/.test(e),"detector"),yGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-Cj4NEMMW.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:Fse,diagram:e}},"loader"),vGe={id:Fse,detector:gGe,loader:yGe},xGe=vGe,Hse="sankey",bGe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),_Ge=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-BGByBKcG.js");return{diagram:r}},[],import.meta.url);return{id:Hse,diagram:e}},"loader"),wGe={id:Hse,detector:bGe,loader:_Ge},SGe=wGe,Wse="packet",kGe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),CGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-ZVxa9Zv9.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Wse,diagram:e}},"loader"),jGe={id:Wse,detector:kGe,loader:CGe},Use="radar",TGe=X(e=>/^\s*radar-beta/.test(e),"detector"),NGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-BPcNixny.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:Use,diagram:e}},"loader"),EGe={id:Use,detector:TGe,loader:NGe},Vse="block",AGe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),OGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-BoNpL7BZ.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Vse,diagram:e}},"loader"),RGe={id:Vse,detector:AGe,loader:OGe},MGe=RGe,qse="architecture",PGe=X(e=>/^\s*architecture/.test(e),"detector"),LGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-BrXt9ZTR.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:qse,diagram:e}},"loader"),$Ge={id:qse,detector:PGe,loader:LGe},DGe=$Ge,Gse="ishikawa",IGe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),BGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-DmVBLQ_7.js");return{diagram:r}},[],import.meta.url);return{id:Gse,diagram:e}},"loader"),zGe={id:Gse,detector:IGe,loader:BGe},Kse="venn",FGe=X(e=>/^\s*venn-beta/.test(e),"detector"),HGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-QVosgTmj.js");return{diagram:r}},[],import.meta.url);return{id:Kse,diagram:e}},"loader"),WGe={id:Kse,detector:FGe,loader:HGe},UGe=WGe,Yse="treemap",VGe=X(e=>/^\s*treemap/.test(e),"detector"),qGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-DVtwzZFE.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Yse,diagram:e}},"loader"),GGe={id:Yse,detector:VGe,loader:qGe},LF=!1,e6=X(()=>{LF||(LF=!0,x5("error",nGe,e=>e.toLowerCase().trim()==="error"),x5("---",{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(aGe,mGe,DGe),xA(VVe,xGe,Fqe,Dqe,nqe,dqe,pqe,yqe,Eqe,Mqe,QVe,YVe,dGe,aqe,Yqe,Vqe,Qqe,_qe,SGe,jGe,Cqe,MGe,EGe,zGe,GGe,UGe))},"addDiagrams"),KGe=X(async()=>{_t.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(C0).map(async([n,{detector:i,loader:s}])=>{if(s)try{SA(n)}catch{try{const{diagram:o,id:a}=await s();x5(a,o,i)}catch(o){throw _t.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete C0[n],o}}}))).filter(n=>n.status==="rejected");if(r.length>0){_t.error(`Failed to load ${r.length} external diagrams`);for(const n of r)_t.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),YGe="graphics-document document";function Xse(e,r){e.attr("role",YGe),r!==""&&e.attr("aria-roledescription",r)}X(Xse,"setA11yDiagramInfo");function Zse(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(Zse,"addSVGa11yTitleDescription");var m0,fO=(m0=class{constructor(r,n,i,s,o){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=o}static async fromText(r,n={}){var u,h;const i=Ma(),s=GR(r,i);r=JHe(r)+`
1119
+ L0,20`)},"requirement_arrow"),SVe=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"),kVe={extension:cVe,composition:uVe,aggregation:dVe,dependency:hVe,lollipop:fVe,point:pVe,circle:mVe,cross:gVe,barb:yVe,only_one:vVe,zero_or_one:xVe,one_or_more:bVe,zero_or_more:_Ve,requirement_arrow:wVe,requirement_contains:SVe},CVe=lVe,jVe={common:_S,getConfig:Ma,insertCluster:RUe,insertEdge:aVe,insertEdgeLabel:tVe,insertMarkers:CVe,insertNode:mse,interpolateToCurve:jM,labelHelper:Hr,log:_t,positionEdgeLabel:rVe},V2={},xse=X(e=>{for(const r of e)V2[r.name]=r},"registerLayoutLoaders"),TVe=X(()=>{xse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-BqFk2thM.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await Ge(()=>import("./cose-bilkent-S5V4N54A-CJkhUxb_.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");TVe();var nvt=X(async(e,r)=>{if(!(e.layoutAlgorithm in V2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=V2[e.layoutAlgorithm];return(await n.loader()).render(e,r,jVe,{algorithm:n.algorithm})},"render"),ivt=X((e="",{fallback:r="dagre"}={})=>{if(e in V2)return e;if(r in V2)return _t.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),NVe=Yre(Object.keys,Object),EVe=Object.prototype,AVe=EVe.hasOwnProperty;function OVe(e){if(!Vj(e))return NVe(e);var r=[];for(var n in Object(e))AVe.call(e,n)&&n!="constructor"&&r.push(n);return r}var cO=Y0(Td,"DataView"),uO=Y0(Td,"Promise"),dO=Y0(Td,"Set"),hO=Y0(Td,"WeakMap"),EF="[object Map]",RVe="[object Object]",AF="[object Promise]",OF="[object Set]",RF="[object WeakMap]",MF="[object DataView]",MVe=K0(cO),PVe=K0(W2),LVe=K0(uO),$Ve=K0(dO),DVe=K0(hO),Gg=G0;(cO&&Gg(new cO(new ArrayBuffer(1)))!=MF||W2&&Gg(new W2)!=EF||uO&&Gg(uO.resolve())!=AF||dO&&Gg(new dO)!=OF||hO&&Gg(new hO)!=RF)&&(Gg=function(e){var r=G0(e),n=r==RVe?e.constructor:void 0,i=n?K0(n):"";if(i)switch(i){case MVe:return MF;case PVe:return EF;case LVe:return AF;case $Ve:return OF;case DVe:return RF}return r});var IVe="[object Map]",BVe="[object Set]",zVe=Object.prototype,FVe=zVe.hasOwnProperty;function PF(e){if(e==null)return!0;if(qj(e)&&(I5(e)||typeof e=="string"||typeof e.splice=="function"||kM(e)||CM(e)||D5(e)))return!e.length;var r=Gg(e);if(r==IVe||r==BVe)return!e.size;if(Vj(e))return!OVe(e).length;for(var n in e)if(FVe.call(e,n))return!1;return!0}var bse="c4",HVe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),WVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-BwBlLyjg.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:bse,diagram:e}},"loader"),UVe={id:bse,detector:HVe,loader:WVe},VVe=UVe,_se="flowchart",qVe=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"),GVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dx_JetEF.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:_se,diagram:e}},"loader"),KVe={id:_se,detector:qVe,loader:GVe},YVe=KVe,wse="flowchart-v2",XVe=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"),ZVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dx_JetEF.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:wse,diagram:e}},"loader"),JVe={id:wse,detector:XVe,loader:ZVe},QVe=JVe,Sse="er",eqe=X(e=>/^\s*erDiagram/.test(e),"detector"),tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-hcPKpSdA.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Sse,diagram:e}},"loader"),rqe={id:Sse,detector:eqe,loader:tqe},nqe=rqe,kse="gitGraph",iqe=X(e=>/^\s*gitGraph/.test(e),"detector"),sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-DQrX1J2A.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:kse,diagram:e}},"loader"),oqe={id:kse,detector:iqe,loader:sqe},aqe=oqe,Cse="gantt",lqe=X(e=>/^\s*gantt/.test(e),"detector"),cqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-Bk8hmhU0.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:Cse,diagram:e}},"loader"),uqe={id:Cse,detector:lqe,loader:cqe},dqe=uqe,jse="info",hqe=X(e=>/^\s*info/.test(e),"detector"),fqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-Dtd-9vtP.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:jse,diagram:e}},"loader"),pqe={id:jse,detector:hqe,loader:fqe},Tse="pie",mqe=X(e=>/^\s*pie/.test(e),"detector"),gqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-MKsbY7Yq.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:Tse,diagram:e}},"loader"),yqe={id:Tse,detector:mqe,loader:gqe},Nse="quadrantChart",vqe=X(e=>/^\s*quadrantChart/.test(e),"detector"),xqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-DxNL7OJL.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Nse,diagram:e}},"loader"),bqe={id:Nse,detector:vqe,loader:xqe},_qe=bqe,Ese="xychart",wqe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-BpncthKC.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Ese,diagram:e}},"loader"),kqe={id:Ese,detector:wqe,loader:Sqe},Cqe=kqe,Ase="requirement",jqe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-BD02UvYv.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:Ase,diagram:e}},"loader"),Nqe={id:Ase,detector:jqe,loader:Tqe},Eqe=Nqe,Ose="sequence",Aqe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),Oqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-rip1O_fj.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Ose,diagram:e}},"loader"),Rqe={id:Ose,detector:Aqe,loader:Oqe},Mqe=Rqe,Rse="class",Pqe=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"),Lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-DNItKY-M.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:Rse,diagram:e}},"loader"),$qe={id:Rse,detector:Pqe,loader:Lqe},Dqe=$qe,Mse="classDiagram",Iqe=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"),Bqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-DNItKY-M.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Mse,diagram:e}},"loader"),zqe={id:Mse,detector:Iqe,loader:Bqe},Fqe=zqe,Pse="state",Hqe=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"),Wqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-CSSWfCDd.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Pse,diagram:e}},"loader"),Uqe={id:Pse,detector:Hqe,loader:Wqe},Vqe=Uqe,Lse="stateDiagram",qqe=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"),Gqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-D9DmVnnW.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Lse,diagram:e}},"loader"),Kqe={id:Lse,detector:qqe,loader:Gqe},Yqe=Kqe,$se="journey",Xqe=X(e=>/^\s*journey/.test(e),"detector"),Zqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-CxffY7iH.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:$se,diagram:e}},"loader"),Jqe={id:$se,detector:Xqe,loader:Zqe},Qqe=Jqe,eGe=X((e,r,n)=>{_t.debug(`rendering svg for syntax error
1120
+ `);const i=YIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),dee(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"),Dse={draw:eGe},tGe=Dse,rGe={db:{},renderer:Dse,parser:{parse:X(()=>{},"parse")}},nGe=rGe,Ise="flowchart-elk",iGe=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"),sGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dx_JetEF.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Ise,diagram:e}},"loader"),oGe={id:Ise,detector:iGe,loader:sGe},aGe=oGe,Bse="timeline",lGe=X(e=>/^\s*timeline/.test(e),"detector"),cGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-8H2XLII3.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:Bse,diagram:e}},"loader"),uGe={id:Bse,detector:lGe,loader:cGe},dGe=uGe,zse="mindmap",hGe=X(e=>/^\s*mindmap/.test(e),"detector"),fGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-DjVIH7uQ.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:zse,diagram:e}},"loader"),pGe={id:zse,detector:hGe,loader:fGe},mGe=pGe,Fse="kanban",gGe=X(e=>/^\s*kanban/.test(e),"detector"),yGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-CP7DTmQZ.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:Fse,diagram:e}},"loader"),vGe={id:Fse,detector:gGe,loader:yGe},xGe=vGe,Hse="sankey",bGe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),_Ge=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-DjfNwyeb.js");return{diagram:r}},[],import.meta.url);return{id:Hse,diagram:e}},"loader"),wGe={id:Hse,detector:bGe,loader:_Ge},SGe=wGe,Wse="packet",kGe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),CGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-DFPzW-Yk.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Wse,diagram:e}},"loader"),jGe={id:Wse,detector:kGe,loader:CGe},Use="radar",TGe=X(e=>/^\s*radar-beta/.test(e),"detector"),NGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-DIH9SGPR.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:Use,diagram:e}},"loader"),EGe={id:Use,detector:TGe,loader:NGe},Vse="block",AGe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),OGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-DvUj70fF.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Vse,diagram:e}},"loader"),RGe={id:Vse,detector:AGe,loader:OGe},MGe=RGe,qse="architecture",PGe=X(e=>/^\s*architecture/.test(e),"detector"),LGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-CY99qKNe.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:qse,diagram:e}},"loader"),$Ge={id:qse,detector:PGe,loader:LGe},DGe=$Ge,Gse="ishikawa",IGe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),BGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-Crkaba7p.js");return{diagram:r}},[],import.meta.url);return{id:Gse,diagram:e}},"loader"),zGe={id:Gse,detector:IGe,loader:BGe},Kse="venn",FGe=X(e=>/^\s*venn-beta/.test(e),"detector"),HGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-CZ3zFNwo.js");return{diagram:r}},[],import.meta.url);return{id:Kse,diagram:e}},"loader"),WGe={id:Kse,detector:FGe,loader:HGe},UGe=WGe,Yse="treemap",VGe=X(e=>/^\s*treemap/.test(e),"detector"),qGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-PlG4RFpY.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Yse,diagram:e}},"loader"),GGe={id:Yse,detector:VGe,loader:qGe},LF=!1,e6=X(()=>{LF||(LF=!0,x5("error",nGe,e=>e.toLowerCase().trim()==="error"),x5("---",{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(aGe,mGe,DGe),xA(VVe,xGe,Fqe,Dqe,nqe,dqe,pqe,yqe,Eqe,Mqe,QVe,YVe,dGe,aqe,Yqe,Vqe,Qqe,_qe,SGe,jGe,Cqe,MGe,EGe,zGe,GGe,UGe))},"addDiagrams"),KGe=X(async()=>{_t.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(C0).map(async([n,{detector:i,loader:s}])=>{if(s)try{SA(n)}catch{try{const{diagram:o,id:a}=await s();x5(a,o,i)}catch(o){throw _t.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete C0[n],o}}}))).filter(n=>n.status==="rejected");if(r.length>0){_t.error(`Failed to load ${r.length} external diagrams`);for(const n of r)_t.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),YGe="graphics-document document";function Xse(e,r){e.attr("role",YGe),r!==""&&e.attr("aria-roledescription",r)}X(Xse,"setA11yDiagramInfo");function Zse(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(Zse,"addSVGa11yTitleDescription");var m0,fO=(m0=class{constructor(r,n,i,s,o){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=o}static async fromText(r,n={}){var u,h;const i=Ma(),s=GR(r,i);r=JHe(r)+`
1121
1121
  `;try{SA(s)}catch{const p=zMe(s);if(!p)throw new ZQ(`Diagram ${s} not found.`);const{id:g,diagram:v}=await p();x5(g,v)}const{db:o,parser:a,renderer:l,init:d}=SA(s);return a.parser&&(a.parser.yy=o),(u=o.clear)==null||u.call(o),d==null||d(i),n.title&&((h=o.setDiagramTitle)==null||h.call(o,n.title)),await a.parse(r),new m0(s,r,o,a,l)}async render(r,n){await this.renderer.draw(this.text,r,n,this)}getParser(){return this.parser}getType(){return this.type}},X(m0,"Diagram"),m0),$F=[],XGe=X(()=>{$F.forEach(e=>{e()}),$F=[]},"attachFunctions"),ZGe=X(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Jse(e){const r=e.match(XQ);if(!r)return{text:e,metadata:{}};let n=rze(r[1],{schema:tze})??{};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(Jse,"extractFrontMatter");var JGe=X(e=>e.replace(/\r\n?/g,`
1122
1122
  `).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),QGe=X(e=>{const{text:r,metadata:n}=Jse(e),{displayMode:i,title:s,config:o={}}=n;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:s,config:o,text:r}},"processFrontmatter"),eKe=X(e=>{const r=sd.detectInit(e)??{},n=sd.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:BHe(e),directive:r}},"processDirectives");function GM(e){const r=JGe(e),n=QGe(r),i=eKe(n.text),s=OM(n.config,i.directive);return e=ZGe(i.text),{code:e,title:n.title,config:s}}X(GM,"preprocessDiagram");function Qse(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}X(Qse,"toBase64");var tKe=5e4,rKe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",nKe="sandbox",iKe="loose",sKe="http://www.w3.org/2000/svg",oKe="http://www.w3.org/1999/xlink",aKe="http://www.w3.org/1999/xhtml",lKe="100%",cKe="100%",uKe="border:0;margin:0;",dKe="margin:0",hKe="allow-top-navigation-by-user-activation allow-popups",fKe='The "iframe" tag is not supported by your browser.',pKe=["foreignobject"],mKe=["dominant-baseline"];function KM(e){const r=GM(e);return y5(),rPe(r.config??{}),r}X(KM,"processAndSetConfigs");async function eoe(e,r){e6();try{const{code:n,config:i}=KM(e);return{diagramType:(await roe(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}X(eoe,"parse");var DF=X((e,r,n=[])=>`
1123
1123
  .${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),gKe=X((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
@@ -1446,4 +1446,4 @@ ${En.content.slice(0,2e3)}
1446
1446
 
1447
1447
  `:""}${gr.join(`
1448
1448
 
1449
- `)}`:me,displayContent:me,referencedFiles:Ae.length>0?Ae:void 0,displaySegments:ue,attachments:Gt.size>0?[...Gt]:void 0}},[Ps]),gx=y.useCallback(async(D,J,he)=>{const ue=await qc(e.current,D,he);if(!ue)return;const me=Gk(ue.displaySegments,J);Wa({content:ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:J}),i(""),a(void 0)},[Ur,Pt,dt,sn,Ut,Wa,qc,i]),by=y.useCallback(async(D,J)=>{if(!Qyt(da==null?void 0:da.name))return;const he=b8(J);!he||he==="New Chat"||await ig(D,he)},[da==null?void 0:da.name,ig]),_y=async(D,J,he)=>{if(nr==="manager"||It==="thread")return yx(D,J,he);const ue=await qc(e.current,D,he);if(!ue&&(!J||J.length===0))return;if(!ut){d(!0);return}const me=(ue==null?void 0:ue.promptWithReferences)??e.current.trim(),Ae=Gk(ue==null?void 0:ue.displaySegments,J),ht=b8((ue==null?void 0:ue.displayContent)||me);let bt=Qe;if(!bt){const Vt=await ua(void 0,ht);bt=(Vt==null?void 0:Vt.id)??null}if(bt){if(await by(bt,(ue==null?void 0:ue.displayContent)||me),Ti||Ys.length>0){Wa({content:me,displayContent:(ue==null?void 0:ue.displayContent)||me,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,referencedFiles:ue==null?void 0:ue.referencedFiles,displaySegments:Ae,attachments:J}),i(""),a(void 0);return}Bc(me,{token:ut,sessionId:bt,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,onLoginRequired:()=>d(!0),attachments:J,...ue!=null&&ue.displayContent?{displayContent:ue.displayContent||me}:{},...ue!=null&&ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...Ae!=null&&Ae.length?{displaySegments:Ae}:{}}),i(""),a(void 0)}},yx=async(D,J,he)=>{var ht;const ue=await qc(e.current,D,he);if(!ue||hp)return;const me=Gk(ue.displaySegments,J),Ae=xe.selectedThread?((ht=Xs[xe.selectedThread.id])==null?void 0:ht.length)??0:0;if(xe.selectedThread&&(xe.selectedThread.status==="running"||Ae>0)){Op(xe.selectedThread.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:ue.displayContent||ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,fullContent:ue.promptWithReferences,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:ue.attachments,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()}),i(""),a(void 0);return}i(""),a(void 0),await xe.handleSend(ue.promptWithReferences,Pt,Pt!=="jait"?dt:void 0,Ut??void 0,{displayContent:ue.displayContent||ue.promptWithReferences,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:ue.attachments})},wy=y.useRef(!1);y.useEffect(()=>{var J,he,ue;if(nr==="manager"||It==="thread"||!ut||!Qe||Ti||ws||wy.current)return;const[D]=Ys;D&&(wy.current=!0,Ql(D.id),Promise.resolve(Bc(D.content,{token:ut,sessionId:Qe,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,onLoginRequired:()=>d(!0),...(J=D.attachments)!=null&&J.length?{attachments:D.attachments}:{},...D.displayContent?{displayContent:D.displayContent}:{},...(he=D.referencedFiles)!=null&&he.length?{referencedFiles:D.referencedFiles}:{},...(ue=D.displaySegments)!=null&&ue.length?{displaySegments:D.displaySegments}:{}})).catch(me=>{Wa({content:D.content,displayContent:D.displayContent,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,referencedFiles:D.referencedFiles,displaySegments:D.displaySegments,attachments:D.attachments}),fi.error(Hq(me instanceof Error?me.message:null,"Failed to send queued message"))}).finally(()=>{wy.current=!1}))},[Qe,Ql,Wa,Ti,ws,Ys,Bc,It,ut,nr]);const Op=y.useCallback((D,J)=>{Vo(he=>({...he,[D]:[...he[D]??[],J]}))},[]),kg=y.useCallback((D,J)=>{Vo(he=>{const ue=he[D]??[],me=ue.filter(Ae=>Ae.id!==J);if(me.length===ue.length)return he;if(me.length===0){const{[D]:Ae,...ht}=he;return ht}return{...he,[D]:me}})},[]),JS=y.useCallback((D,J,he)=>{const ue=he.trim();ue&&Vo(me=>{const Ae=me[D]??[];return Ae.length===0?me:{...me,[D]:Ae.map(ht=>ht.id===J?{...ht,content:ue,displayContent:ue,fullContent:ue,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:ht)}})},[]),QS=y.useCallback((D,J,he,ue)=>{Vo(me=>{const Ae=me[D]??[];if(Ae.length===0)return me;const ht=Ae.findIndex(Gt=>Gt.id===J);if(ht<0)return me;const bt=[...Ae],[Vt]=bt.splice(ht,1);if(!Vt)return me;if(he==null)bt.push(Vt);else{const Gt=bt.findIndex(gr=>gr.id===he);if(Gt<0)return me;bt.splice(Gt+(ue==="after"?1:0),0,Vt)}return bt===Ae?me:{...me,[D]:bt}})},[]),x6=y.useCallback(D=>{var me;const J=xe.selectedThread,he=xe.selectedRepo;if(!J||!he)return;const ue=(me=Xs[J.id])==null?void 0:me.find(Ae=>Ae.id===D);ue&&(kg(J.id,D),(async()=>{const Ae=`jait/${Math.random().toString(16).slice(2,10)}`;let ht;try{ht=(await so.createWorktree(he.localPath,he.defaultBranch,Ae)).path}catch{try{await so.createBranch(he.localPath,Ae,he.defaultBranch)}catch{}}const bt=await en.createThread({title:`[${he.name}] Generating title…`,providerId:ue.providerId,runtimeMode:ue.runtimeMode,...ue.model?{model:ue.model}:{},kind:"delivery",workingDirectory:ht??he.localPath,branch:Ae});await en.startThread(bt.id,{message:ue.fullContent,titlePrefix:`[${he.name}] `,...ue.displayContent?{displayContent:ue.displayContent}:{},...ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...ue.displaySegments?{displaySegments:ue.displaySegments}:{},...ue.attachments?{attachments:ue.attachments}:{}})})())},[xe.selectedThread,xe.selectedRepo,Xs,kg]),b6=y.useCallback(async(D,J,he)=>{const ue=xe.selectedThread;if(!ue)return;const me=await qc(e.current,D,he);if(!me)return;const Ae=Gk(me.displaySegments,J);Op(ue.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:me.displayContent||me.promptWithReferences,displayContent:me.displayContent||me.promptWithReferences,fullContent:me.promptWithReferences,referencedFiles:me.referencedFiles,displaySegments:Ae,attachments:me.attachments,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()}),i(""),a(void 0)},[xe.selectedThread,Pt,dt,Ut,Op,qc,i]);y.useEffect(()=>{if(!Qe)for(const[D,J]of Object.entries(Xs)){if(J.length===0||Ls.current.has(D))continue;const he=xe.threads.find(me=>me.id===D);if(!he){Vo(me=>{if(!(D in me))return me;const{[D]:Ae,...ht}=me;return ht});continue}if(he.status==="running")continue;const[ue]=J;ue&&(Ls.current.add(D),Vo(me=>{const Ae=me[D]??[],[,...ht]=Ae;if(ht.length===0){const{[D]:bt,...Vt}=me;return Vt}return{...me,[D]:ht}}),xe.handleSendToThread(D,ue.fullContent,ue.providerId,ue.runtimeMode,ue.model,{displayContent:ue.displayContent??ue.content,referencedFiles:ue.referencedFiles,displaySegments:ue.displaySegments,attachments:ue.attachments}).catch(me=>{Vo(Ae=>({...Ae,[D]:[ue,...Ae[D]??[]]})),xe.setError(me instanceof Error?me.message:"Failed to process queued thread message")}).finally(()=>{Ls.current.delete(D)}))}},[Qe,xe.handleSendToThread,xe.setError,xe.threads,Xs]);const Cg=y.useCallback(async()=>{const D=xe.selectedRepo;if(D)try{await en.updateRepo(D.id,{deviceId:""}),await xe.refresh()}catch{xe.setError("Failed to move repository to gateway")}},[xe.selectedRepo,xe.refresh,xe.setError]),nf=async D=>{if(!ut){d(!0);return}let J=Qe;if(!J){const he=await ua();J=(he==null?void 0:he.id)??null}if(J){if(D==="Generate architecture diagram"){$e(!0),mt(!0),Bc("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.",{token:ut,sessionId:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)});return}Bc(D,{token:ut,sessionId:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)})}},vx=y.useCallback(async(D,J,he,ue,me)=>{if(!Qe||!ut)return;const Ae=await qc(J,me==null?void 0:me.referencedFiles,me==null?void 0:me.displaySegments);Ae&&await up(D,Ae.promptWithReferences,he,ue,{token:ut,sessionId:Qe,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,displayContent:Ae.displayContent,referencedFiles:Ae.referencedFiles,displaySegments:Ae.displaySegments,onLoginRequired:()=>d(!0)})},[Qe,up,ut,Ur,Pt,dt,Ut,qc]),jg=async D=>{if(D.preventDefault(),!St){h(null),qt(!0);try{await tg(be,Jt),d(!1),Bt(""),g("chat")}catch(J){h(J instanceof Error?J.message:"Login failed")}finally{qt(!1)}}},xx=async D=>{if(D.preventDefault(),!St){if(h(null),!je||!jt){h("Username and password are required");return}if(jt!==ir){h("Passwords do not match");return}qt(!0);try{await ay(je,jt),d(!1),fr(""),Br(""),g("chat")}catch(J){h(J instanceof Error?J.message:"Registration failed")}finally{qt(!1)}}},bx=y.useCallback(async D=>{D.preventDefault();const J=za.trim();if(!J){Ms("Please enter a gateway URL");return}Dn(!0),Ms(null);try{const he=J.replace(/\/+$/,""),ue=await fetch(`${he}/health`,{signal:AbortSignal.timeout(5e3)});if(!ue.ok)throw new Error(`Server returned ${ue.status}`);const me=Mn();if(jQ(he),he!==me){window.location.reload();return}Fi("auth")}catch(he){Ms(he instanceof Error?he.name==="TimeoutError"||he.name==="AbortError"?"Connection timed out":he.message:"Failed to connect")}finally{Dn(!1)}},[za]),Rp=()=>{rp(),Eu(),g("chat"),d(!0)},e3=y.useCallback(()=>{Eu(),ua()},[Eu,ua]),_x=async D=>{const J=Object.fromEntries(Object.entries(D).map(([he,ue])=>[he,ue.trim()]).filter(([,he])=>he.length>0));await Ho({api_keys:J})},t3=async()=>{const D=await Ad();return await Uh(),D.removed},wx=async()=>{const D=await ng();return await Uh(),D},Sx=async D=>{const J=await Wi(D);return J&&await Uh(),J},r3=y.useCallback(async()=>{if(Qe)try{await fetch(`${Xi}/api/consent/pending/${Qe}/approve-all`,{method:"DELETE"}),hn(!1)}catch{}},[Qe]),n3=y.useCallback(async D=>{var me;const J=vde(D);if(!J)return;if(nr==="manager"||It==="thread"){const Ae=xe.selectedThread,ht=Ae?((me=Xs[Ae.id])==null?void 0:me.length)??0:0;if(Ae&&(Ae.status==="running"||ht>0)){Op(Ae.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:J,displayContent:J,fullContent:J,referencedFiles:void 0,attachments:void 0,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()});return}await xe.handleSend(J,Pt,Pt!=="jait"?dt:void 0,Ut??void 0);return}const he=b8(J);let ue=Qe;if(!ue){const Ae=await ua(void 0,he);ue=(Ae==null?void 0:Ae.id)??null}if(!(!ue||!ut)){if(await by(ue,J),Ti||Ys.length>0){Wa({content:J,displayContent:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0});return}Bc(J,{token:ut,sessionId:ue,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)})}},[Qe,xe.handleSend,xe.selectedThread,Ur,Pt,dt,Ut,ua,Op,Wa,by,Ti,Xs,Ys.length,Bc,It,ut,nr]),[Ja,kx]=y.useState(!1),[sf,Cx]=y.useState(!1),[Fu,jx]=y.useState(()=>_8()),Mp=y.useRef(null),Tg=y.useRef([]),of=y.useRef(null),Ng=y.useRef(_8()),Eg=y.useRef(null),Vi=y.useRef(null),js=y.useRef(null),Sy=y.useRef(null),Ag=y.useRef(null),Og=y.useCallback(()=>{const D=_8();Ng.current=D,jx(D)},[]),Vd=y.useCallback(()=>{var J;Ag.current!==null&&(cancelAnimationFrame(Ag.current),Ag.current=null),(J=Vi.current)==null||J.disconnect(),Vi.current=null,js.current=null,Sy.current=null;const D=Eg.current;Eg.current=null,D&&D.state!=="closed"&&D.close().catch(()=>{}),Og()},[Og]),Pp=y.useCallback(D=>{Vd();try{const J=new AudioContext,he=J.createAnalyser();he.fftSize=256,he.smoothingTimeConstant=.58;const ue=J.createMediaStreamSource(D);ue.connect(he);const me=new Uint8Array(new ArrayBuffer(he.frequencyBinCount));Eg.current=J,Vi.current=ue,js.current=he,Sy.current=me;const Ae=()=>{const ht=js.current,bt=Sy.current;if(!ht||!bt)return;ht.getByteTimeDomainData(bt);let Vt=0;for(let En=0;En<bt.length;En++)Vt+=Math.abs((bt[En]-128)/128);const Gt=bt.length>0?Vt/bt.length:0,gr=Math.pow(Math.min(1,Gt*6.8),.78),Zr=Math.min(1,Math.max(u9,gr)),Rr=(Ng.current[Ng.current.length-1]??u9)*.2+Zr*.8,qn=[...Ng.current.slice(-(yde-1)),Rr];Ng.current=qn,jx(qn),Ag.current=requestAnimationFrame(Ae)};Ae()}catch(J){console.warn("Voice visualizer unavailable:",J),Og()}},[Og,Vd]),Tx=y.useCallback(D=>{const he=D.sampleRate,ue=D.getChannelData(0),me=new ArrayBuffer(44+ue.length*2),Ae=new DataView(me),ht=(Vt,Gt)=>{for(let gr=0;gr<Gt.length;gr++)Ae.setUint8(Vt+gr,Gt.charCodeAt(gr))};ht(0,"RIFF"),Ae.setUint32(4,36+ue.length*2,!0),ht(8,"WAVE"),ht(12,"fmt "),Ae.setUint32(16,16,!0),Ae.setUint16(20,1,!0),Ae.setUint16(22,1,!0),Ae.setUint32(24,he,!0),Ae.setUint32(28,he*1*2,!0),Ae.setUint16(32,2,!0),Ae.setUint16(34,16,!0),ht(36,"data"),Ae.setUint32(40,ue.length*2,!0);let bt=44;for(let Vt=0;Vt<ue.length;Vt++){const Gt=Math.max(-1,Math.min(1,ue[Vt]));Ae.setInt16(bt,Gt<0?Gt*32768:Gt*32767,!0),bt+=2}return new Blob([me],{type:"audio/wav"})},[]),Hu=y.useCallback(async()=>{var he,ue;kx(!1),Vd();const D=Mp.current;if(!D||D.state==="inactive"){(he=of.current)==null||he.getTracks().forEach(me=>me.stop()),of.current=null,Mp.current=null;return}const J=await new Promise(me=>{D.ondataavailable=Ae=>{Ae.data.size>0&&Tg.current.push(Ae.data)},D.onstop=()=>{me(new Blob(Tg.current,{type:D.mimeType}))},D.stop()});if((ue=of.current)==null||ue.getTracks().forEach(me=>me.stop()),of.current=null,Mp.current=null,J.size!==0&&(Hi.stt_provider==="wyoming"||Hi.stt_provider==="whisper")){Cx(!0);try{const me=await J.arrayBuffer(),Ae=new AudioContext({sampleRate:16e3}),ht=await Ae.decodeAudioData(me),bt=Tx(ht);await Ae.close();const Vt=await bt.arrayBuffer(),Gt=new Uint8Array(Vt);let gr="";for(let qn=0;qn<Gt.length;qn++)gr+=String.fromCharCode(Gt[qn]);const Zr=btoa(gr),Rr=await(await fetch(`${Xi}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ut}`},body:JSON.stringify({audioBase64:Zr,sessionId:Qe??"voice-input",provider:Hi.stt_provider})})).json();Rr.text?i(qn=>e1t(qn,Rr.text??"")):console.warn("Transcription failed:",Rr.details??Rr.error)}catch(me){console.error("Transcription error:",me)}finally{Cx(!1)}}},[Qe,Tx,Hi.stt_provider,ut]),af=y.useCallback(async()=>{if(!ut){d(!0);return}try{const D=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});of.current=D,Tg.current=[],Pp(D);const J=new MediaRecorder(D);Mp.current=J,J.ondataavailable=he=>{he.data.size>0&&Tg.current.push(he.data)},J.start(),kx(!0)}catch(D){Vd(),console.error("Microphone access denied:",D),window.alert("Microphone access is required for push-to-talk.")}},[Qe,Hi.stt_provider,Pp,Vd,n3,ut]),[qd,ky]=y.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Cy=y.useCallback(()=>{ky(D=>{const J=!D;try{localStorage.setItem("jait:wake-word",String(J))}catch{}return J})},[]),Nx=y.useCallback(()=>{Vr(!0),xn.connect()},[xn]),Wu=cmt({enabled:qd&&ei&&!Ja&&!rr,lang:navigator.language,onCommand:()=>{Nx()},onWakeWordDetected:()=>{Nx()}});y.useEffect(()=>()=>{var D;Vd(),(D=of.current)==null||D.getTracks().forEach(J=>J.stop())},[Vd]);const Ex=Sl==="limit_reached",lf=!Fo&&!ei,jy=nr==="developer"&&p==="chat"&&!lf&&(Fo||_l||!!Qe&&(ws||dy||mp||yp||Lu)),Ax=fa.length>0||ws,Ty=Kyt({developerChatHydrating:jy,isLoadingHistory:ws,todoCount:Ha.length}),Rg=y.useMemo(()=>gde({showWorkspace:$,showTerminal:w,showWorkspaceTree:se,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,se]),Mg=Tt&&Jm&&Rg!==null&&Rg!=="terminal",Ny=Tt&&p==="chat"&&nr==="developer"&&Rg==="terminal",Uu=y.useMemo(()=>({showWorkspace:$,showTerminal:w,showWorkspaceTree:se,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,se]),Ox=_||ai!==null,Rx=((mi=(Lp=zo==null?void 0:zo.username)==null?void 0:Lp[0])==null?void 0:mi.toUpperCase())??"?",Gc=y.useCallback(()=>{Hu()},[Hu]),Mx=y.useCallback(()=>{xe.setFolderPickerOpen(!0)},[xe.setFolderPickerOpen]),_6=It==="thread"?c.jsx(Vq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:Mx}):null,i3=nr==="manager"&&xe.selectedThread,Vu=Tt&&p==="chat"?c.jsxs("div",{className:"flex flex-col items-center gap-1 rounded-lg border bg-background/85 px-1.5 py-1.5 shadow-lg backdrop-blur-lg",draggable:!1,onDragStart:D=>D.preventDefault(),children:[!i3&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:!$&&!w&&!_?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{$&&Uc(),w&&xa(),_&&k(!1),Y(!1)},"aria-label":"Chat",children:c.jsx(mm,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Chat"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Ox?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>k(D=>!D),"aria-label":"Workspaces",children:_?c.jsx(H3,{className:"h-5 w-5 rotate-90"}):c.jsx(W3,{className:"h-5 w-5 rotate-90"})})}),c.jsx(Qr,{side:"left",children:"Workspaces"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"terminal")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("terminal")},"aria-label":"Terminal",children:c.jsx(Oo,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Terminal"})]})]}),ai&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"files")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("files")},"aria-label":"Files",children:c.jsx(mh,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Files"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:Sf(Uu,"git")?"secondary":"ghost",size:"sm",className:"relative h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("git")},"aria-label":"Changes",children:[c.jsx(l0,{className:"h-5 w-5"}),ds.length>0&&c.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-2xs font-bold leading-[14px] text-primary-foreground",children:ds.length>99?"99+":ds.length})]})}),c.jsx(Qr,{side:"left",children:"Changes"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"editor")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("editor")},"aria-label":"Editor",children:c.jsx(Kb,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Editor"})]})]})]}):null,Ey=nr==="developer"?c.jsx("div",{className:`overflow-x-auto ${Tt?"px-0.5":"px-1"}`,children:c.jsxs("div",{className:`grid min-w-max grid-cols-[1fr_auto_1fr] items-center whitespace-nowrap ${Tt?"gap-2":"gap-3"}`,children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[It==="thread"?_6:c.jsx(DXe,{sessions:lp,activeSessionId:Qe,workspaceTitle:(on==null?void 0:on.title)??"Personal chat",onSelectSession:D=>{yo(ai,D)},onNewSession:()=>{ua()},onOpenChange:GS,showTitle:!1,triggerLabel:"History"}),Tr&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-green-500/10 px-2 py-0.5 text-xs text-green-600 dark:text-green-400",children:["Auto-approved",c.jsx("button",{type:"button",onClick:r3,className:"rounded-full p-0.5 hover:bg-green-500/20 transition-colors",title:"Clear approve all",children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),c.jsx("div",{className:"justify-self-center",children:c.jsx(eQ,{target:It,onChange:kr,disabled:Ty.disableSendTargetSelector})}),c.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[It!=="thread"&&c.jsx("button",{type:"button",onClick:e3,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"New chat"}),Zl!==null&&c.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Zl," remaining"]})]})]})}):null,s3=y.useMemo(()=>({onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:Gc,mode:Ur,onModeChange:Ln,provider:Pt,onProviderChange:Cp,responseStyle:sn,onResponseStyleChange:ci,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),[af,Ja,Fu,sf,Gc,Ur,Ln,Pt,Cp,sn,ci,dt,Hd,Ut,Wd,aa,Ap,$,Jl,ne==null?void 0:ne.nodeId]),Ay=[...fa.slice(-10).map(D=>SV({id:`msg-${D.id}`,source:"chat",title:`Message: ${D.role}`,detail:D.content.slice(0,120)||"(empty message)"})),...qo.map(D=>SV({id:`term-${D.id}`,source:"terminal",title:"Terminal session",detail:`${D.id} (${D.state})`}))];return Nd?c.jsx(zft,{detachedTabId:Nd}):ho?c.jsx(Uft,{detachedId:ho}):vs===!1?c.jsx(qft,{onRetry:()=>{Mc.current=!1,wu(null),fo()}}):c.jsx(TX,{children:c.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!lf&&c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:Tt?"fixed top-2 left-2 right-2 z-40 flex items-center gap-1 pointer-events-none h-10":`relative flex items-center gap-1 shrink-0 border-b bg-background px-2 sm:gap-2 sm:px-5 ${Lt?"h-10 !pl-[0.8rem]":"h-14"}`,style:Lt?{WebkitAppRegion:"drag",paddingLeft:Yl==="darwin"?70:void 0,paddingRight:Yl==="win32"?140:void 0}:void 0,children:[c.jsxs("div",{className:`flex items-center gap-1 shrink-0 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-2 h-10":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsx(Sae,{size:20,className:"shrink-0"}),Wu.isSupported&&c.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${rr?"text-green-400 bg-green-500/10":qd?Wu.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:rr?()=>{xn.disconnect(),Vr(!1)}:Cy,"aria-label":rr?"Disconnect voice":qd?"Disable wake word":"Enable wake word",children:rr?c.jsx(l1,{className:"h-4 w-4 animate-pulse"}):qd?c.jsx(l1,{className:`h-4 w-4 ${Wu.isListening?"animate-pulse":""}`}):c.jsx(Jk,{className:"h-4 w-4"})}),Tt&&p==="chat"&&ma.length>0&&c.jsx(qq,{threads:ma,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),kr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)})]}),c.jsxs("nav",{className:"hidden md:flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="chat"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("chat"),"aria-label":"Chat",children:[c.jsx(mm,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Chat"})]})}),c.jsx(Qr,{side:"bottom",children:"Chat"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("jobs"),"aria-label":"Jobs",children:[c.jsx(w_,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Jobs"})]})}),c.jsx(Qr,{side:"bottom",children:"Jobs"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="network"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("network"),"aria-label":"Network",children:[c.jsx(C1,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Network"})]})}),c.jsx(Qr,{side:"bottom",children:"Network"})]}),nr==="developer"&&!Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:fe?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>fe?jp():sx(),"aria-label":"Screen sharing",children:[c.jsx(Xg,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Screen Share"})]})}),c.jsx(Qr,{side:"bottom",children:"Screen sharing"})]})]}),rr?c.jsxs("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center gap-1.5 rounded-full border border-border/60 bg-background/80 backdrop-blur-sm px-1.5 py-1 ${Tt?"pointer-events-auto":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsx("button",{onClick:xn.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${xn.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":xn.micActive?"Mute":"Unmute",children:xn.micActive?c.jsx(l1,{className:"h-3.5 w-3.5"}):c.jsx(Jk,{className:"h-3.5 w-3.5"})}),c.jsx(Uyt,{state:xn.assistantSpeaking?"speaking":xn.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),c.jsx("button",{onClick:()=>{xn.disconnect(),Vr(!1)},className:"flex items-center justify-center h-7 w-7 rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors","aria-label":"End call",children:c.jsx(fye,{className:"h-3.5 w-3.5"})})]}):p==="chat"?c.jsx("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-1.5 h-10 flex items-center":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:c.jsx(omt,{mode:nr,onChange:$o,compact:Tt})}):null,c.jsx("div",{className:"flex-1 min-w-0"}),c.jsxs("div",{className:`flex items-center gap-1 sm:gap-1.5 shrink-0 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-1 py-0.5 h-10":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[cg.isActive&&c.jsxs("span",{className:"ui-pill shrink-0",children:[c.jsx(Xg,{className:"h-3 w-3 text-green-500 animate-pulse"}),c.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Wu.isSupported&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs("button",{onClick:rr?()=>{xn.disconnect(),Vr(!1)}:Cy,className:`ui-pill shrink-0 cursor-pointer transition-colors ${rr?"text-green-400 animate-pulse":qd?Wu.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[rr?c.jsx(l1,{className:"h-3 w-3 animate-pulse"}):qd?c.jsx(l1,{className:`h-3 w-3 ${Wu.isListening?"animate-pulse":""}`}):c.jsx(Jk,{className:"h-3 w-3"}),c.jsx("span",{className:"hidden sm:inline text-xs",children:rr?"Voice active":Wu.isListening?"Listening...":qd?"Hey Jait":"Wake word"})]})}),c.jsx(Qr,{side:"bottom",children:rr?"Voice assistant active — click to disconnect":qd?Wu.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),p==="chat"&&ma.length>0&&c.jsx(qq,{threads:ma,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),kr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)}),c.jsx(QXe,{usage:Vh}),(()=>{const D=Ut??lg,J=Pt==="codex"?"openai":Pt==="claude-code"?"anthropic":ag??"ollama",he=Pt==="codex"?Ut??"Codex":Pt==="claude-code"?Ut??"Claude Code":D?Utt(D):null,ue=Pt==="codex"?`OpenAI Codex CLI${Ut?` · ${Ut}`:""}`:Pt==="claude-code"?`Anthropic Claude Code CLI${Ut?` · ${Ut}`:""}`:D??"";return he?c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[c.jsx(t4,{provider:J,model:Pt==="codex"?"codex":Pt==="claude-code"?"claude-3":D??void 0,size:16}),c.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:he})]})}),c.jsx(Qr,{side:"bottom",children:ue})]}):null})(),Zl!==null&&Zl<=5&&c.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[Zl," remaining"]})]}),(Vn==null?void 0:Vn.hasUpdate)&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{onClick:async()=>{if(zi==="web")!pi&&!sa&&await Dc();else if(zi==="electron"){const D=window.jaitDesktop;fi.info("Downloading update...");const J=await D.downloadUpdate();J!=null&&J.ok?(fi.success("Update downloaded. Restarting..."),await D.installUpdate()):fi.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",disabled:zi==="web"&&(pi||sa),className:"h-8 shrink-0 border-amber-500/30 bg-amber-500/10 px-2 text-amber-700 hover:bg-amber-500/15 hover:text-amber-800 dark:text-amber-300",children:[zi==="web"&&(pi||sa)?c.jsx(sr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tK,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:zi==="web"&&(pi||sa)?"Updating...":`v${Vn.latestVersion}`})]})}),c.jsx(Qr,{side:"bottom",children:zi==="web"&&(pi||sa)?"Updating and refreshing...":`Update available — v${Vn.latestVersion}`})]}),Tt?c.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0 rounded-lg",children:c.jsx(IC,{className:"h-4 w-4"})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:"Navigate"}),c.jsxs(Bi,{onSelect:()=>g("chat"),children:[c.jsx(mm,{className:"h-4 w-4 mr-2"}),"Chat"]}),c.jsxs(Bi,{onSelect:()=>g("jobs"),children:[c.jsx(w_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),c.jsxs(Bi,{onSelect:()=>g("network"),children:[c.jsx(C1,{className:"h-4 w-4 mr-2"}),"Network"]}),nr==="developer"&&c.jsxs(Bi,{onSelect:()=>fe?jp():sx(),children:[c.jsx(Xg,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]}),ei?c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(O8,{className:"h-8 w-8",children:c.jsx(R8,{className:"text-sm font-medium",children:Rx})})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:zo==null?void 0:zo.username}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(ed,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",uD],["system",Ra],["dark",oD]].map(([D,J])=>c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx("button",{onClick:()=>{ax(D)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${v===D?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(J,{className:"h-3.5 w-3.5"})})}),c.jsx(Qr,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:Rp,children:[c.jsx(sD,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(we,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>d(!0),children:"Sign in"})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"md:hidden shrink-0",children:c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:c.jsx(IC,{className:"h-4 w-4"})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:"Navigate"}),c.jsxs(Bi,{onSelect:()=>g("chat"),children:[c.jsx(mm,{className:"h-4 w-4 mr-2"}),"Chat"]}),c.jsxs(Bi,{onSelect:()=>g("jobs"),children:[c.jsx(w_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),c.jsxs(Bi,{onSelect:()=>g("network"),children:[c.jsx(C1,{className:"h-4 w-4 mr-2"}),"Network"]}),nr==="developer"&&c.jsxs(Bi,{onSelect:()=>fe?jp():sx(),children:[c.jsx(Xg,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),ei?c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(O8,{className:"h-7 w-7",children:c.jsx(R8,{className:"text-xs",children:Rx})})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:zo==null?void 0:zo.username}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(ed,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",uD],["system",Ra],["dark",oD]].map(([D,J])=>c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx("button",{onClick:()=>{ax(D)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${v===D?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(J,{className:"h-3.5 w-3.5"})})}),c.jsx(Qr,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:Rp,children:[c.jsx(sD,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(we,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>d(!0),children:"Sign in"})]}),Lt&&Yl==="linux"&&c.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[c.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:c.jsx(Qk,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:Vs?c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:c.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):c.jsx(V1,{className:"h-3 w-3"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowClose(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-red-600 hover:text-white transition-colors",children:c.jsx(Xn,{className:"h-4 w-4"})})]})]})]}),p==="chat"&&(Tt||nr==="manager")&&c.jsxs("div",{className:`border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${Tt&&!Ru?"hidden":"flex"} ${Ru?"min-h-[35px] items-center gap-1.5 pt-14 py-2":"h-11 md:h-[35px] items-center gap-1 overflow-x-auto overflow-y-visible scrollbar-none"}`,children:[nr==="developer"&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:_?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>k(D=>!D),"aria-label":"Toggle workspaces sidebar",children:[_?c.jsx(H3,{className:`h-3 w-3${Tt?" rotate-90":" mr-1"}`}):c.jsx(W3,{className:`h-3 w-3${Tt?" rotate-90":" mr-1"}`}),!Tt&&"Workspaces"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle workspaces sidebar"})]}),nr==="developer"&&!Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:w?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{yy()},children:[c.jsx(Oo,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle terminal panel"})]}),nr==="developer"&&Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 shrink-0 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Za("terminal")},children:c.jsx(Oo,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Terminal"})]}),nr==="manager"&&xe.selectedThread&&!Tt&&c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:[c.jsx(tD,{className:"h-3 w-3 mr-1"}),"Back"]}),ai&&(nr==="developer"||nr==="manager"&&xe.selectedThread)&&!(Tt&&nr==="manager")&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`flex items-center shrink-0 ${Tt?"gap-1":""}`,children:Tt?c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Za("files")},children:c.jsx(mh,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Files"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:Sf(Uu,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Za("git")},children:[c.jsx(l0,{className:"h-4 w-4"}),ds.length>0&&c.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-2xs font-bold leading-[14px] text-primary-foreground",children:ds.length>99?"99+":ds.length})]})}),c.jsx(Qr,{side:"bottom",children:"Changes"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Za("editor")},children:c.jsx(Kb,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Editor"})]})]}):c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:$?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{bg()},children:[c.jsx(Kb,{className:"h-3 w-3 mr-1"}),"Editor",$&&c.jsx(Xn,{className:"h-3 w-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:$?"Hide editor":"Show editor"})]})}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:ri?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":ri?"Close preview":"Open preview",onClick:()=>{var D;if(ri)gg();else{const J=re.target??(V==null?void 0:V.trim())??((D=_o==null?void 0:_o.target)==null?void 0:D.trim())??null;if(Bo(J,(ne==null?void 0:ne.workspaceRoot)??null))return;vg()}},children:[c.jsx(bi,{className:`h-3 w-3${Tt?"":" mr-1"}`}),!Tt&&"Preview",!Tt&&ri&&c.jsx(Xn,{className:"h-3 wer-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:ri?"Close preview":"Open dev preview"})]})]}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:wt?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":wt?"Close architecture":"Open architecture",onClick:()=>{var D;wt?((D=rs.current)==null||D.closeArchitectureTab(),Be(null),mt(!1)):(mt(!0),$c())},children:[c.jsx(G_,{className:`h-3 w-3${Tt?"":" mr-1"}`}),!Tt&&"Architecture",!Tt&&wt&&c.jsx(Xn,{className:"h-3 w-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:"Software architecture diagram"})]}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Se?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Ke(D=>!D),children:c.jsx(j8,{className:"h-3 w-3"})})}),c.jsx(Qr,{side:"bottom",children:"SSE debug stream"})]}),nr==="manager"&&c.jsxs(c.Fragment,{children:[xe.selectedThread?null:c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:j?"secondary":"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>T(D=>!D),children:[j?c.jsx(H3,{className:`h-3 w-3 mr-1${Tt?" rotate-90":""}`}):c.jsx(W3,{className:`h-3 w-3 mr-1${Tt?" rotate-90":""}`}),"Repositories"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle repositories panel"})]}),xe.selectedRepo&&xe.selectedRepo.source==="local"&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>E(xe.selectedRepo),children:[c.jsx(uK,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),c.jsx(Qr,{side:"bottom",children:"Open repository strategy"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>P(xe.selectedRepo),children:[c.jsx(lK,{className:"h-3 w-3 mr-1"}),"Todos"]})}),c.jsx(Qr,{side:"bottom",children:"Open todo plan"})]})]})]}),!(Tt&&xe.selectedThread)&&c.jsx("div",{className:"flex-1"}),xe.selectedThread?c.jsxs("div",{className:Tt?"flex min-w-0 flex-1 items-center gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[Tt&&c.jsx(we,{variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:c.jsx(tD,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[c.jsx(iL,{status:xe.selectedThread.status}),Tt?c.jsxs("div",{className:"min-w-0 flex-1",children:[E4(xe.selectedThread.title)?c.jsx(d9,{className:"text-xs h-3.5 w-28"}):c.jsx("span",{className:"block truncate text-2xs leading-tight text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),c.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 overflow-hidden text-2xs leading-tight text-muted-foreground",children:[xe.selectedRepo&&c.jsxs("span",{className:"min-w-0 truncate",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]}),c.jsx(h9,{kind:xe.selectedThread.kind}),xe.selectedThread.branch&&c.jsx("span",{className:"shrink min-w-0 truncate font-mono",children:xe.selectedThread.branch})]})]}):c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[E4(xe.selectedThread.title)?c.jsx(d9,{className:"text-xs h-3.5 w-28"}):c.jsx("span",{className:"max-w-[200px] truncate text-2xs text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),c.jsx(h9,{kind:xe.selectedThread.kind}),xe.selectedRepo&&c.jsxs("span",{className:"max-w-[160px] truncate text-2xs text-muted-foreground",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[c.jsx(Zrt,{token:ut,threadId:xe.selectedThread.id,selectedSkillIds:xe.selectedThread.skillIds}),!Tt&&xe.selectedThread.branch&&c.jsx(rn,{variant:"outline",className:"text-2xs px-1 py-0 font-mono",children:xe.selectedThread.branch}),nL(xe.selectedThread)&&c.jsx(we,{variant:"ghost",size:"icon",className:"h-[18px] w-[18px] sm:h-5 sm:w-5",onClick:()=>void xe.handleStop(xe.selectedThread.id),title:xe.selectedThread.kind==="delegation"?"End helper thread":"Stop thread",children:c.jsx(V1,{className:"h-2.5 w-2.5"})}),xe.showGitActions&&xe.selectedRepo&&c.jsx("div",{className:Tt?"shrink-0":"ml-2 shrink-0",children:c.jsx(uP,{threadId:xe.selectedThread.id,cwd:xe.selectedThread.workingDirectory??xe.selectedRepo.localPath,branch:xe.selectedThread.branch,baseBranch:xe.selectedRepo.defaultBranch,threadTitle:xe.selectedThread.title,threadStatus:xe.selectedThread.status,threadKind:xe.selectedThread.kind,prUrl:xe.selectedThread.prUrl,prState:xe.selectedThread.id in xe.threadPrStates?xe.threadPrStates[xe.selectedThread.id]:xe.selectedThread.prState,ghAvailable:xe.ghAvailable,showStatusBadge:!Tt})})]})]}):null]})]}),p==="jobs"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(Brt,{})}):p==="network"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(Tft,{token:ut,sessionId:Qe??"default"})}):p==="settings"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(got,{username:(zo==null?void 0:zo.username)??"",token:ut,apiKeys:Hi.api_keys,onSaveApiKeys:_x,sttProvider:Hi.stt_provider,onSttProviderChange:async D=>{await Ho({stt_provider:D})},jaitBackend:Hi.jait_backend??"openai",onJaitBackendChange:async D=>{await Ho({jait_backend:D})},onClearArchive:t3,onClearArchivedWorkspaces:wx,onFetchArchivedWorkspaces:Wh,onRestoreWorkspace:Sx,activityEvents:Ay,updateInfo:Vn,updateChecking:Pc,onCheckUpdate:()=>{Od()},onApplyUpdate:()=>{Dc()},updateApplying:pi,platform:zi})}):c.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${Tt?"flex-col relative":""}`,children:[c.jsxs("div",{className:Tt?"contents":`relative flex min-h-0 ${z?"flex-1 min-w-0":"shrink-0"}`,children:[nr==="developer"&&_&&Tt&&c.jsx("div",{className:"fixed inset-0 z-20",onClick:()=>k(!1)}),nr==="developer"&&!Tt&&c.jsxs("aside",{className:"flex w-12 shrink-0 flex-col items-center gap-2 border-r bg-background px-1 py-2",children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:_?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>k(D=>!D),"aria-label":"Toggle workspaces panel",children:_?c.jsx(H3,{className:"h-4 w-4"}):c.jsx(W3,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Workspaces"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:w?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>{yy()},"aria-label":"Terminal",children:c.jsx(Oo,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Terminal"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:$?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>{bg()},"aria-label":"Editor",children:c.jsx(Kb,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Editor"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:ri?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Preview",disabled:Fo||_l,onClick:()=>{KS()},children:c.jsx(bi,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Preview"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:wt?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",disabled:Fo||_l,"aria-label":"Architecture",onClick:()=>{v6()},children:c.jsx(G_,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Architecture"})]}),c.jsx("div",{className:"flex-1"}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Se?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",disabled:!$||!ne,"aria-label":"Debug",onClick:()=>Ke(D=>!D),children:c.jsx(j8,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Debug"})]})]}),nr==="developer"&&(_||Tt)&&c.jsx("aside",{ref:H,tabIndex:-1,onBlur:kp,className:`overflow-hidden outline-none ${Tt?"fixed right-[3.25rem] top-1/2 z-50 h-[min(28rem,80vh)] w-[min(20rem,calc(100vw-5rem))] -translate-y-1/2 rounded-xl border bg-background shadow-2xl":"w-64 border-r shrink-0"}`,children:c.jsx(LXe,{workspaces:go,personalSessions:Lr,activeWorkspaceId:ai,activeSessionId:Qe,loading:_l,hasMoreWorkspaces:ly,showFewerWorkspaces:go.length>cy,onSelectWorkspace:VS,onSelectPersonalSession:D=>{Tt&&k(!1),yo(null,D)},onNewPersonalSession:()=>{Tt&&k(!1),ua(null)},onCreateWorkspace:qS,onRemoveWorkspace:D=>{Ld(D)},onChangeDirectory:sg,onShowMore:sp,onShowFewer:op,sessionInfo:Jl,nodes:ry})}),(nr==="developer"&&p==="chat"&&!Tt&&(Gs||w)||nr==="manager"&&xe.selectedThread&&Gs)&&c.jsxs("div",{className:`relative flex min-h-0 flex-col ${!Gs&&w||z?"flex-1 min-w-0":"shrink-0"}`,style:!Gs&&w?{width:Ot,maxWidth:"70vw"}:void 0,children:[!Gs&&w&&c.jsx("div",{onMouseDown:YS,className:"absolute inset-y-0 right-0 w-1.5 cursor-col-resize hover:bg-primary/30 transition-colors z-10"}),(nr==="developer"||nr==="manager"&&xe.selectedThread)&&Gs&&c.jsx("div",{className:"flex min-h-0 flex-1",children:c.jsx(sH,{ref:rs,autoOpenRemotePath:(ne==null?void 0:ne.workspaceRoot)??null,surfaceId:(ne==null?void 0:ne.surfaceId)??null,files:Ps,activeFileId:Ct,onActiveFileChange:bs,onFileDrop:D=>{mx(D)},onReferenceFile:dx,onReferenceSelection:_g,onReferencePreviewElement:hx,onAvailableFilesChange:Lc,showTree:se,showEditor:le,onToggleTree:my,onToggleEditor:Vc,changedPaths:ox,fsWatcherVersion:Bh,sourceControlRefreshSignal:Tl,savedTabsState:vp,stateReady:bp,previewRequest:q,onTabsStateChange:va,onPreviewOpenChange:wo,previewSessionId:Qe,previewToken:ut,previewWorkspaceRoot:cx,previewInitialTarget:V,architectureDiagram:Mt,architectureGenerating:Ee,architectureRequest:ke,onArchitectureOpenChange:mt,onArchitectureRenderResult:Iu,onGenerateArchitecture:()=>{$e(!0),nf("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:xy,provider:Pt,cliModel:Ut,onCollapsedChange:K,onMaxCollapsedChange:L,restoreRef:B})}),nr==="developer"&&w&&!Tt&&p==="chat"&&c.jsxs("div",{className:`flex min-h-0 flex-col bg-background ${Dt?"absolute inset-0 z-20 border-r":`relative border-r border-t ${Gs?"shrink-0":"flex-1"}`}`,style:Dt||!Gs?void 0:{height:st},children:[!Dt&&c.jsx("div",{onMouseDown:lx,className:"absolute inset-x-0 top-0 h-1.5 cursor-row-resize hover:bg-primary/30 transition-colors z-10"}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx(vV,{terminals:Ud,activeTerminalId:In,onSelect:ns,onCreate:D=>xo(Qe??"default",ss??void 0,D),onKill:ZS,onDetach:fx,availableShells:Va}),c.jsxs("div",{className:"absolute right-0 top-0 bottom-0 flex items-center gap-1 pr-2 pl-3 bg-gradient-to-l from-background via-background to-transparent z-10",children:[Gs&&c.jsx("button",{onClick:()=>{Dt?(Xe(!1),ot(et.current)):(et.current=st,Xe(!0))},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":Dt?"Exit fullscreen":"Fullscreen terminal",children:Dt?c.jsx(k9,{className:"h-4 w-4"}):c.jsx(S9,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>{In&&fx(In)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Open terminal in new window",children:c.jsx(Nm,{className:"h-4 w-4"})}),c.jsx("button",{onClick:xa,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Xn,{className:"h-4 w-4"})})]})]}),In?c.jsx(g4,{ref:Gh,terminalId:In,className:"flex-1 min-h-0",token:ut,workspaceRoot:ss??void 0,onReferenceSelection:wg}):c.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>xo(Qe??"default",ss??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),Ny&&c.jsxs("section",{className:"flex flex-1 min-h-0 flex-col overflow-hidden border-b bg-background pt-16",children:[c.jsxs("div",{className:"relative shrink-0 border-b",children:[c.jsx(vV,{terminals:Ud,activeTerminalId:In,onSelect:ns,onCreate:D=>xo(Qe??"default",ss??void 0,D),onKill:ZS,availableShells:Va}),c.jsx("button",{onClick:xa,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Xn,{className:"h-4 w-4"})})]}),In?c.jsx(g4,{ref:Gh,terminalId:In,className:"flex-1 min-h-0",token:ut,workspaceRoot:ss??void 0,onReferenceSelection:wg}):c.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>xo(Qe??"default",ss??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(nr==="developer"||nr==="manager"&&xe.selectedThread)&&Mg&&c.jsx("section",{className:`flex-1 min-h-0 overflow-hidden border-b bg-background ${nr==="manager"?"":"pt-16"}`,children:c.jsx(sH,{ref:rs,autoOpenRemotePath:(ne==null?void 0:ne.workspaceRoot)??null,surfaceId:(ne==null?void 0:ne.surfaceId)??null,files:Ps,activeFileId:Ct,onActiveFileChange:bs,onFileDrop:D=>{mx(D)},onReferenceFile:dx,onReferenceSelection:_g,onReferencePreviewElement:hx,onAvailableFilesChange:Lc,showTree:se,showEditor:le,onToggleTree:my,onToggleEditor:Vc,treeTab:Ze,onTreeTabChange:Ie,changedPaths:ox,sourceControlRefreshSignal:Tl,isMobile:!0,savedTabsState:vp,stateReady:bp,previewRequest:q,onTabsStateChange:va,onPreviewOpenChange:wo,previewSessionId:Qe,previewToken:ut,previewWorkspaceRoot:cx,previewInitialTarget:V,architectureDiagram:Mt,architectureGenerating:Ee,architectureRequest:ke,onArchitectureOpenChange:mt,onArchitectureRenderResult:Iu,onGenerateArchitecture:()=>{$e(!0),nf("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:xy,provider:Pt,cliModel:Ut})}),!Mg&&!Ny&&(nr==="manager"?c.jsx("div",{className:`flex-1 min-w-0 flex flex-col min-h-0 ${Tt&&!xe.selectedThread?"pt-12":""}`,children:xe.selectedThread?c.jsxs(c.Fragment,{children:[c.jsxs(RT,{className:"min-h-0 flex-1 border-b",loading:xe.loadingActivities,loadingLabel:"Loading activity",messageContents:kn.map(D=>D.content),children:[kn.length===0&&!xe.loadingActivities&&c.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),kn.map((D,J)=>{var he,ue;return c.jsx(OO,{messageId:D.id,messageIndex:J,messageFromEnd:kn.length-1-J,role:D.role,content:D.content,contextFlow:D.contextFlow,toolCalls:D.toolCalls,segments:D.segments,isStreaming:((he=xe.selectedThread)==null?void 0:he.status)==="running"&&J===kn.length-1,compact:!0,preferLlmUi:!1,provider:(ue=xe.selectedThread)==null?void 0:ue.providerId,onOpenPath:px,onOpenDiff:vy},D.id)})]},((o3=xe.selectedThread)==null?void 0:o3.id)??"manager-empty"),c.jsx("div",{className:"shrink-0 py-3 px-4",children:c.jsxs("div",{className:"mx-auto max-w-3xl",children:[xe.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),Kh.length>0&&xe.selectedThread&&c.jsx(yH,{items:Kh,onRemove:D=>kg(xe.selectedThread.id,D),onEdit:(D,J)=>JS(xe.selectedThread.id,D,J),onReorder:(D,J,he)=>QS(xe.selectedThread.id,D,J,he),onSendToParallelThread:x6,className:"mb-2"}),xe.selectedThreadTodos.length>0&&c.jsx(sE,{items:xe.selectedThreadTodos,className:"mb-2"}),c.jsx(Jb,{ref:mo,draftStateKey:`manager:${((a3=xe.selectedThread)==null?void 0:a3.id)??"new-thread"}`,value:e.current,syncKey:r,onChange:s,onSubmit:_y,onQueue:b6,onStop:()=>{xe.selectedThread&&xe.handleStop(xe.selectedThread.id)},isLoading:((Px=xe.selectedThread)==null?void 0:Px.status)==="running",disabled:xe.creating,placeholder:($p=xe.selectedThread)!=null&&$p.providerSessionId||((qu=xe.selectedThread)==null?void 0:qu.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},responseStyle:sn,onResponseStyleChange:ci,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:Hc,onMoveToGateway:Cg,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$}),c.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Hc&&c.jsx(A4,{runtime:Hc}),xe.selectedThread&&xe.selectedThread.status!=="running"&&!xe.selectedThread.providerSessionId&&c.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):c.jsxs("div",{className:`flex flex-1 min-h-0 ${Tt?"flex-col":""}`,children:[j&&c.jsx("div",{className:`overflow-hidden ${Tt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:c.jsx(c1t,{repositories:xe.repositories,selectedRepoId:((Lx=xe.selectedRepo)==null?void 0:Lx.id)??null,isMobile:Tt,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0),onRemoveRepository:D=>{xe.removeRepository(D)},onOpenStrategy:D=>E(D),onOpenPlan:D=>P(D)})}),c.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-y-auto ${Tt?"pt-8":""}`,children:[c.jsx("div",{className:"relative z-10 flex flex-col items-center px-3 pb-8 pt-8 sm:px-4 sm:pb-2 sm:pt-4",children:c.jsxs("div",{className:"w-full max-w-3xl",children:[c.jsx("h1",{className:"mb-3 text-center text-xl font-semibold tracking-tight sm:mb-4 sm:text-2xl",children:"What do you want to build?"}),xe.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),c.jsx(Jb,{ref:mo,draftStateKey:`manager:${(($x=xe.selectedRepo)==null?void 0:$x.id)??"repo-draft"}`,value:e.current,syncKey:r,onChange:s,onSubmit:_y,disabled:hp,controlsDisabled:xe.creating||ic,placeholder:Id,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},responseStyle:sn,onResponseStyleChange:ci,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:$s,onMoveToGateway:Cg}),c.jsx("div",{className:"overflow-x-auto px-1 pt-3",children:c.jsxs("div",{className:"flex min-w-max items-center gap-2 whitespace-nowrap",children:[c.jsx(Vq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0)}),$s&&c.jsx(A4,{runtime:$s})]})})]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[c.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:"Threads"}),c.jsx(rn,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-2xs",children:Yr.length})]}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void xe.refresh(),children:c.jsx(Na,{className:`h-3.5 w-3.5 ${xe.loading?"animate-spin":""}`})})]}),Yr.length===0?c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):c.jsxs("div",{className:"flex flex-col",children:[Yr.map(D=>{const J=xe.getRepositoryForThread(D),he=(J==null?void 0:J.name)??g6(D)??"Unknown repo",ue=xde(D,D.id in xe.threadPrStates?xe.threadPrStates[D.id]:void 0);return c.jsx(h1t,{thread:D,repo:J,repoName:he,prState:ue,ghAvailable:xe.ghAvailable,onOpen:()=>{xe.setSelectedThreadId(D.id),U(!1),Je(!1)},onStop:()=>{xe.handleStop(D.id)},onDelete:()=>xe.handleDelete(D.id)},D.id)}),xe.hasMoreThreads&&c.jsxs("button",{className:"inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70 sm:px-4 sm:py-2",disabled:xe.loading,onClick:xe.showMoreThreads,children:[xe.loading?c.jsx(sr,{className:"h-3 w-3 animate-spin"}):null,"Show more threads"]}),Yr.length>xe.threadListLimit&&c.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:xe.showFewerThreads,children:"Show less"})]})]})})]})]})}):jy?c.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:z?"0 0 0px":"1 1 0%",width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:!z&&c.jsx(RT,{className:"min-h-0 flex-1 border-b",compact:Gs,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},Qe??"developer-loading")}):Ax?c.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:z?"0 0 0px":"1 1 0%",width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:!z&&c.jsxs(c.Fragment,{children:[c.jsxs(RT,{className:"min-h-0 flex-1 border-b",compact:Gs,loading:ws,loadingLabel:"Loading chat",messageContents:og,children:[fa.map((D,J)=>c.jsx(OO,{messageId:D.id,messageIndex:J,messageFromEnd:fa.length-1-J,role:D.role,content:D.content,contextFlow:D.contextFlow,displayContent:D.displayContent,referencedFiles:D.referencedFiles,displaySegments:D.displaySegments,attachments:D.attachments,thinking:D.thinking,thinkingDuration:D.thinkingDuration,toolCalls:D.toolCalls,segments:D.segments,isStreaming:Ti&&D===fa[fa.length-1],compact:$||fe||ri,preferLlmUi:!0,provider:Pt,onOpenTerminal:XS,onEditMessage:vx,editComposer:s3,onOpenPath:px,onOpenDiff:vy},D.id)),Ys.length>0&&c.jsx(yH,{items:Ys,onRemove:Ql,onEdit:dp,onReorder:Cl})]},Qe??"developer-empty"),c.jsx("div",{className:`shrink-0 ${Tt?"px-2 py-2":`py-3 ${Gs?"px-3":"px-4"}`}`,children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[c.jsxs("div",{className:"space-y-1.5 max-h-[40vh] overflow-y-auto",children:[Ty.showTodoList&&c.jsx(sE,{items:Ha,onClear:()=>jl([])}),Sl&&Sl!=="login_required"&&Sl!=="limit_reached"&&!Ti&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Sl})]}),kl&&!Ti&&c.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[c.jsxs("button",{onClick:()=>Ss({token:ut,sessionId:Qe}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),c.jsx(oZe,{compact:!0,sessionId:Qe,onApproveAllEnabled:()=>hn(!0)}),cp&&c.jsx(UXe,{plan:cp,onApprove:Au,onReject:qh,isExecuting:Ti}),Ex&&c.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),ds.length>0&&c.jsx(YXe,{files:ds,onAccept:ec,onReject:Ou,onAcceptAll:uy,onRejectAll:vo,onFileClick:vy})]}),c.jsx(Jb,{ref:mo,draftStateKey:`developer:${Qe??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:_y,onStop:Ga,onQueue:gx,isLoading:Ti,disabled:Ex,placeholder:Yh,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},mode:Ur,onModeChange:Ln,responseStyle:sn,onResponseStyleChange:ci,sendTarget:It,onSendTargetChange:kr,showSendTargetSelector:!1,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:It==="thread"?$s:null,onMoveToGateway:It==="thread"?Cg:void 0,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,workspaceName:ux,workspacePath:ss,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),Ey]})})]})}):c.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${z?"":"px-4"} ${Tt?"pt-12":""}`,style:{flex:z?"0 0 0px":void 0,width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:[" ",c.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),c.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!_l&&go.length===0?c.jsxs("div",{className:"text-center space-y-3",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),c.jsxs(we,{variant:"default",size:"lg",onClick:()=>{ju("workspace"),ku(!0)},children:[c.jsx(mh,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):c.jsx(IXe,{suggestions:$&&ne?o1t:s1t,onSelect:nf}),Ty.showTodoList&&c.jsx(sE,{items:Ha,onClear:()=>jl([])}),c.jsx(Jb,{ref:mo,draftStateKey:`developer:${Qe??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:_y,onStop:Ga,onQueue:gx,isLoading:Ti,placeholder:Yh,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},mode:Ur,onModeChange:Ln,responseStyle:sn,onResponseStyleChange:ci,sendTarget:It,onSendTargetChange:kr,showSendTargetSelector:!1,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:It==="thread"?$s:null,onMoveToGateway:It==="thread"?Cg:void 0,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,workspaceName:ux,workspacePath:ss,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),Ey]})]}))]}),nr==="developer"&&Se&&c.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:c.jsx(dZe,{onClose:()=>Ke(!1)})}),Tt&&(nr==="developer"||nr==="manager"&&xe.selectedThread)&&p==="chat"&&c.jsxs(c.Fragment,{children:[I&&c.jsx("div",{className:"fixed inset-0 z-[39]",onClick:()=>Y(!1),"aria-hidden":"true"}),c.jsxs("div",{className:"fixed right-0 top-1/2 z-40 flex -translate-y-1/2 items-center gap-1",draggable:!1,onDragStart:D=>D.preventDefault(),children:[c.jsx("div",{className:`transition-all duration-200 ${I?"translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"}`,children:Vu}),c.jsx(we,{type:"button",variant:"secondary",size:"icon",className:"h-14 w-7 rounded-l-lg rounded-r-none border-y border-l border-r-0 bg-background/90 shadow-lg backdrop-blur-lg",onClick:()=>Y(D=>!D),"aria-expanded":I,"aria-label":I?"Hide mobile toolbar":"Show mobile toolbar",title:I?"Hide mobile toolbar":"Show mobile toolbar",children:I?c.jsx(Mo,{className:"h-4 w-4"}):c.jsx(x9,{className:"h-4 w-4"})})]})]})]}),lf&&Lt&&c.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),lf&&c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:c.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Io==="url"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[c.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[c.jsx(no,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:bx,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(zn,{id:"gateway-url",placeholder:"https://jait.example.com",value:za,onChange:D=>{cs(D.target.value),Ms(null)},autoFocus:!0})]}),qs&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(Sh,{className:"h-4 w-4 shrink-0"}),qs]}),c.jsx(we,{type:"submit",className:"w-full",disabled:Su,children:Su?c.jsxs(c.Fragment,{children:[c.jsx(sr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[c.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:uo===!1?"Welcome to Jait":"Account"}),c.jsx("div",{className:"text-sm text-muted-foreground",children:Mi?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(no,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Xi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Fi("url"),children:"Change"})]}):uo===!1?c.jsx("p",{children:"Create your account to get started."}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(K1,{value:er,onValueChange:D=>Kr(D),children:[c.jsxs(x0,{className:"grid grid-cols-2 w-full",children:[c.jsx(ea,{value:"login",children:"Login"}),c.jsx(ea,{value:"register",children:"Register"})]}),c.jsx(ta,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:jg,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-username",children:"Username"}),c.jsx(zn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"login-password",type:Qt?"text":"password",value:Jt,onChange:D=>Bt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>mn(!Qt),tabIndex:-1,children:Qt?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Signing in…":"Login"})]})}),c.jsx(ta,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:xx,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-username",children:"Username"}),c.jsx(zn,{id:"register-username",value:je,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password",type:Pe?"text":"password",value:jt,onChange:D=>fr(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>$n(!Pe),tabIndex:-1,children:Pe?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password-confirm",type:Us?"text":"password",value:ir,onChange:D=>Br(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Rc(!Us),tabIndex:-1,children:Us?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Creating account…":uo===!1?"Get Started":"Create account"})]})})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u})]})})}),c.jsx(Oh,{open:l&&!lf,onOpenChange:D=>{d(D)},children:c.jsx(Cd,{className:"sm:max-w-md",children:Io==="url"?c.jsxs(c.Fragment,{children:[c.jsxs(kh,{children:[c.jsxs(xd,{className:"flex items-center gap-2",children:[c.jsx(no,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx(y0,{children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:bx,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(zn,{id:"gateway-url",placeholder:"https://jait.example.com",value:za,onChange:D=>{cs(D.target.value),Ms(null)},autoFocus:!0})]}),qs&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(Sh,{className:"h-4 w-4 shrink-0"}),qs]}),c.jsx(we,{type:"submit",className:"w-full",disabled:Su,children:Su?c.jsxs(c.Fragment,{children:[c.jsx(sr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs(kh,{children:[c.jsx(xd,{children:uo===!1?"Welcome to Jait":"Account"}),c.jsx(y0,{asChild:!0,children:Mi?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(no,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Xi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Fi("url"),children:"Change"})]}):uo===!1?c.jsx("p",{children:"Create your account to get started."}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(K1,{value:er,onValueChange:D=>Kr(D),children:[c.jsxs(x0,{className:"grid grid-cols-2 w-full",children:[c.jsx(ea,{value:"login",children:"Login"}),c.jsx(ea,{value:"register",children:"Register"})]}),c.jsx(ta,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:jg,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-username",children:"Username"}),c.jsx(zn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"login-password",type:Qt?"text":"password",value:Jt,onChange:D=>Bt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>mn(!Qt),tabIndex:-1,children:Qt?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Signing in…":"Login"})]})}),c.jsx(ta,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:xx,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-username",children:"Username"}),c.jsx(zn,{id:"register-username",value:je,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password",type:Pe?"text":"password",value:jt,onChange:D=>fr(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>$n(!Pe),tabIndex:-1,children:Pe?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password-confirm",type:Us?"text":"password",value:ir,onChange:D=>Br(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Rc(!Us),tabIndex:-1,children:Us?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Creating account…":uo===!1?"Get Started":"Create account"})]})})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u})]})})}),c.jsx(wV,{open:Zm,onOpenChange:D=>{ku(D),D||bl(null)},initialPath:Hi.workspace_picker_path,initialNodeId:Hi.workspace_picker_node_id,onSelect:(D,J)=>{xg(D,J).catch(he=>{console.error("Failed to select workspace:",he),fi.error(`Failed to select workspace: ${he instanceof Error?he.message:"Unknown error"}`)})}}),c.jsx(wV,{open:xe.folderPickerOpen,onOpenChange:xe.setFolderPickerOpen,onSelect:(D,J)=>{xe.handleFolderSelected(D,J)}}),c.jsx(Jyt,{token:ut,sessionId:Qe}),A&&c.jsx(Jrt,{open:!!A,onOpenChange:D=>{D||E(null)},repoId:A.id,repoName:A.name}),R&&c.jsx(tnt,{open:!!R,onOpenChange:D=>{D||P(null)},repoId:R.id,repoName:R.name,defaultBranch:R.defaultBranch,repoLocalPath:R.localPath,provider:Pt,model:Ut,onStartThread:(D,J,he)=>{(async()=>{const ue=R,me=`jait/${Math.random().toString(16).slice(2,10)}`;let Ae;try{Ae=(await so.createWorktree(ue.localPath,ue.defaultBranch,me)).path}catch{try{await so.createBranch(ue.localPath,me,ue.defaultBranch)}catch{}}const ht=await en.createThread({title:`[${ue.name}] ${D.title}`,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,kind:"delivery",workingDirectory:Ae??ue.localPath,branch:me});await en.startThread(ht.id,{message:D.description||D.title,titleTask:D.title,titlePrefix:`[${ue.name}] `});const bt=J.tasks.map(Vt=>Vt.id===D.id?{...Vt,status:"running",threadId:ht.id}:Vt);await en.updatePlan(J.id,{tasks:bt})})()}}),fe&&c.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:qe.x<0?void 0:qe.x,top:qe.y<0?void 0:qe.y,right:qe.x<0?16:void 0,bottom:qe.y<0?16:void 0,width:Re.w,height:Re.h},children:[c.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:oy,style:{touchAction:"none"},children:[c.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[c.jsx(Xg,{className:"h-3 w-3"})," Screen Share"]}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:D=>D.stopPropagation(),onClick:jp,children:c.jsx(Xn,{className:"h-3 w-3"})})]}),c.jsx(Aft,{screenShare:cg}),c.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:eg,style:{touchAction:"none"},children:c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:c.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function p1t(){const[e,r]=Et.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");Et.useEffect(()=>{const i=document.documentElement,s=()=>r(i.classList.contains("dark")?"dark":"light");s();const o=new MutationObserver(s);return o.observe(i,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},[]);const n=!!window.jaitDesktop&&navigator.userAgent.includes("Windows");return c.jsx(rfe,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}Ehe.createRoot(document.getElementById("root")).render(c.jsx(Et.StrictMode,{children:c.jsx(g1e,{children:c.jsxs(m1e,{children:[c.jsx(f1t,{}),c.jsx(p1t,{})]})})}));export{L1t as $,wPe as A,C1t as B,E_ as C,jh as D,uMe as E,APe as F,OM as G,tee as H,Ma as I,tze as J,UHe as K,YIe as L,EIe as M,Lz as N,Pz as O,P1t as P,E1t as Q,R1t as R,O1t as S,T1t as T,Gr as U,lM as V,M1t as W,N1t as X,Qy as Y,$1t as Z,X as _,kPe as a,rne as a$,A1t as a0,qMe as a1,R2 as a2,S1t as a3,Gj as a4,LHe as a5,uPe as a6,uee as a7,lz as a8,MIe as a9,rvt as aA,J1t as aB,jr as aC,Q1t as aD,aVe as aE,rVe as aF,tVe as aG,Hee as aH,jIe as aI,aUe as aJ,VQ as aK,AIe as aL,w1t as aM,B0 as aN,NS as aO,sUe as aP,iUe as aQ,TIe as aR,FW as aS,RHe as aT,nne as aU,Hj as aV,qj as aW,I5 as aX,Dot as aY,sne as aZ,Sd as a_,PA as aa,WHe as ab,vPe as ac,xS as ad,mr as ae,Pr as af,hee as ag,RUe as ah,mse as ai,tvt as aj,nze as ak,$a as al,Jf as am,xb as an,RM as ao,dne as ap,Mv as aq,mne as ar,br as as,OHe as at,SFe as au,kHe as av,wM as aw,PF as ax,CVe as ay,evt as az,SPe as b,lHe as b0,rM as b1,cm as b2,$2 as b3,Cz as b4,F$e as b5,Sr as b6,gne as b7,Ul as b8,P$e as b9,mFe as bA,kM as bB,hFe as bC,vFe as bD,Ov as bE,Gm as bF,Zz as bG,CM as bH,Jre as bI,dO as bJ,MHe as bK,Vj as bL,G0 as bM,g1t as bN,Ge as bO,tM as ba,Tee as bb,kS as bc,Aee as bd,j1t as be,pz as bf,fz as bg,L8e as bh,AHe as bi,SHe as bj,uFe as bk,SM as bl,iHe as bm,PHe as bn,L5 as bo,mHe as bp,OVe as bq,jS as br,D5 as bs,cHe as bt,Xre as bu,fFe as bv,pFe as bw,Rv as bx,Gg as by,rF as bz,ii as c,Dr as d,dee as e,oo as f,jPe as g,Vf as h,wd as i,oze as j,_S as k,_t as l,fne as m,bS as n,k1t as o,ivt as p,TPe as q,nvt as r,CPe as s,NPe as t,sd as u,rze as v,GHe as w,ZUe as x,D1t as y,iv as z};
1449
+ `)}`:me,displayContent:me,referencedFiles:Ae.length>0?Ae:void 0,displaySegments:ue,attachments:Gt.size>0?[...Gt]:void 0}},[Ps]),gx=y.useCallback(async(D,J,he)=>{const ue=await qc(e.current,D,he);if(!ue)return;const me=Gk(ue.displaySegments,J);Wa({content:ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:J}),i(""),a(void 0)},[Ur,Pt,dt,sn,Ut,Wa,qc,i]),by=y.useCallback(async(D,J)=>{if(!Qyt(da==null?void 0:da.name))return;const he=b8(J);!he||he==="New Chat"||await ig(D,he)},[da==null?void 0:da.name,ig]),_y=async(D,J,he)=>{if(nr==="manager"||It==="thread")return yx(D,J,he);const ue=await qc(e.current,D,he);if(!ue&&(!J||J.length===0))return;if(!ut){d(!0);return}const me=(ue==null?void 0:ue.promptWithReferences)??e.current.trim(),Ae=Gk(ue==null?void 0:ue.displaySegments,J),ht=b8((ue==null?void 0:ue.displayContent)||me);let bt=Qe;if(!bt){const Vt=await ua(void 0,ht);bt=(Vt==null?void 0:Vt.id)??null}if(bt){if(await by(bt,(ue==null?void 0:ue.displayContent)||me),Ti||Ys.length>0){Wa({content:me,displayContent:(ue==null?void 0:ue.displayContent)||me,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,referencedFiles:ue==null?void 0:ue.referencedFiles,displaySegments:Ae,attachments:J}),i(""),a(void 0);return}Bc(me,{token:ut,sessionId:bt,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,responseStyle:sn,model:Ut??void 0,onLoginRequired:()=>d(!0),attachments:J,...ue!=null&&ue.displayContent?{displayContent:ue.displayContent||me}:{},...ue!=null&&ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...Ae!=null&&Ae.length?{displaySegments:Ae}:{}}),i(""),a(void 0)}},yx=async(D,J,he)=>{var ht;const ue=await qc(e.current,D,he);if(!ue||hp)return;const me=Gk(ue.displaySegments,J),Ae=xe.selectedThread?((ht=Xs[xe.selectedThread.id])==null?void 0:ht.length)??0:0;if(xe.selectedThread&&(xe.selectedThread.status==="running"||Ae>0)){Op(xe.selectedThread.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:ue.displayContent||ue.promptWithReferences,displayContent:ue.displayContent||ue.promptWithReferences,fullContent:ue.promptWithReferences,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:ue.attachments,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()}),i(""),a(void 0);return}i(""),a(void 0),await xe.handleSend(ue.promptWithReferences,Pt,Pt!=="jait"?dt:void 0,Ut??void 0,{displayContent:ue.displayContent||ue.promptWithReferences,referencedFiles:ue.referencedFiles,displaySegments:me,attachments:ue.attachments})},wy=y.useRef(!1);y.useEffect(()=>{var J,he,ue;if(nr==="manager"||It==="thread"||!ut||!Qe||Ti||ws||wy.current)return;const[D]=Ys;D&&(wy.current=!0,Ql(D.id),Promise.resolve(Bc(D.content,{token:ut,sessionId:Qe,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,onLoginRequired:()=>d(!0),...(J=D.attachments)!=null&&J.length?{attachments:D.attachments}:{},...D.displayContent?{displayContent:D.displayContent}:{},...(he=D.referencedFiles)!=null&&he.length?{referencedFiles:D.referencedFiles}:{},...(ue=D.displaySegments)!=null&&ue.length?{displaySegments:D.displaySegments}:{}})).catch(me=>{Wa({content:D.content,displayContent:D.displayContent,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,referencedFiles:D.referencedFiles,displaySegments:D.displaySegments,attachments:D.attachments}),fi.error(Hq(me instanceof Error?me.message:null,"Failed to send queued message"))}).finally(()=>{wy.current=!1}))},[Qe,Ql,Wa,Ti,ws,Ys,Bc,It,ut,nr]);const Op=y.useCallback((D,J)=>{Vo(he=>({...he,[D]:[...he[D]??[],J]}))},[]),kg=y.useCallback((D,J)=>{Vo(he=>{const ue=he[D]??[],me=ue.filter(Ae=>Ae.id!==J);if(me.length===ue.length)return he;if(me.length===0){const{[D]:Ae,...ht}=he;return ht}return{...he,[D]:me}})},[]),JS=y.useCallback((D,J,he)=>{const ue=he.trim();ue&&Vo(me=>{const Ae=me[D]??[];return Ae.length===0?me:{...me,[D]:Ae.map(ht=>ht.id===J?{...ht,content:ue,displayContent:ue,fullContent:ue,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:ht)}})},[]),QS=y.useCallback((D,J,he,ue)=>{Vo(me=>{const Ae=me[D]??[];if(Ae.length===0)return me;const ht=Ae.findIndex(Gt=>Gt.id===J);if(ht<0)return me;const bt=[...Ae],[Vt]=bt.splice(ht,1);if(!Vt)return me;if(he==null)bt.push(Vt);else{const Gt=bt.findIndex(gr=>gr.id===he);if(Gt<0)return me;bt.splice(Gt+(ue==="after"?1:0),0,Vt)}return bt===Ae?me:{...me,[D]:bt}})},[]),x6=y.useCallback(D=>{var me;const J=xe.selectedThread,he=xe.selectedRepo;if(!J||!he)return;const ue=(me=Xs[J.id])==null?void 0:me.find(Ae=>Ae.id===D);ue&&(kg(J.id,D),(async()=>{const Ae=`jait/${Math.random().toString(16).slice(2,10)}`;let ht;try{ht=(await so.createWorktree(he.localPath,he.defaultBranch,Ae)).path}catch{try{await so.createBranch(he.localPath,Ae,he.defaultBranch)}catch{}}const bt=await en.createThread({title:`[${he.name}] Generating title…`,providerId:ue.providerId,runtimeMode:ue.runtimeMode,...ue.model?{model:ue.model}:{},kind:"delivery",workingDirectory:ht??he.localPath,branch:Ae});await en.startThread(bt.id,{message:ue.fullContent,titlePrefix:`[${he.name}] `,...ue.displayContent?{displayContent:ue.displayContent}:{},...ue.referencedFiles?{referencedFiles:ue.referencedFiles}:{},...ue.displaySegments?{displaySegments:ue.displaySegments}:{},...ue.attachments?{attachments:ue.attachments}:{}})})())},[xe.selectedThread,xe.selectedRepo,Xs,kg]),b6=y.useCallback(async(D,J,he)=>{const ue=xe.selectedThread;if(!ue)return;const me=await qc(e.current,D,he);if(!me)return;const Ae=Gk(me.displaySegments,J);Op(ue.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:me.displayContent||me.promptWithReferences,displayContent:me.displayContent||me.promptWithReferences,fullContent:me.promptWithReferences,referencedFiles:me.referencedFiles,displaySegments:Ae,attachments:me.attachments,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()}),i(""),a(void 0)},[xe.selectedThread,Pt,dt,Ut,Op,qc,i]);y.useEffect(()=>{if(!Qe)for(const[D,J]of Object.entries(Xs)){if(J.length===0||Ls.current.has(D))continue;const he=xe.threads.find(me=>me.id===D);if(!he){Vo(me=>{if(!(D in me))return me;const{[D]:Ae,...ht}=me;return ht});continue}if(he.status==="running")continue;const[ue]=J;ue&&(Ls.current.add(D),Vo(me=>{const Ae=me[D]??[],[,...ht]=Ae;if(ht.length===0){const{[D]:bt,...Vt}=me;return Vt}return{...me,[D]:ht}}),xe.handleSendToThread(D,ue.fullContent,ue.providerId,ue.runtimeMode,ue.model,{displayContent:ue.displayContent??ue.content,referencedFiles:ue.referencedFiles,displaySegments:ue.displaySegments,attachments:ue.attachments}).catch(me=>{Vo(Ae=>({...Ae,[D]:[ue,...Ae[D]??[]]})),xe.setError(me instanceof Error?me.message:"Failed to process queued thread message")}).finally(()=>{Ls.current.delete(D)}))}},[Qe,xe.handleSendToThread,xe.setError,xe.threads,Xs]);const Cg=y.useCallback(async()=>{const D=xe.selectedRepo;if(D)try{await en.updateRepo(D.id,{deviceId:""}),await xe.refresh()}catch{xe.setError("Failed to move repository to gateway")}},[xe.selectedRepo,xe.refresh,xe.setError]),nf=async D=>{if(!ut){d(!0);return}let J=Qe;if(!J){const he=await ua();J=(he==null?void 0:he.id)??null}if(J){if(D==="Generate architecture diagram"){$e(!0),mt(!0),Bc("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.",{token:ut,sessionId:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)});return}Bc(D,{token:ut,sessionId:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)})}},vx=y.useCallback(async(D,J,he,ue,me)=>{if(!Qe||!ut)return;const Ae=await qc(J,me==null?void 0:me.referencedFiles,me==null?void 0:me.displaySegments);Ae&&await up(D,Ae.promptWithReferences,he,ue,{token:ut,sessionId:Qe,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,displayContent:Ae.displayContent,referencedFiles:Ae.referencedFiles,displaySegments:Ae.displaySegments,onLoginRequired:()=>d(!0)})},[Qe,up,ut,Ur,Pt,dt,Ut,qc]),jg=async D=>{if(D.preventDefault(),!St){h(null),qt(!0);try{await tg(be,Jt),d(!1),Bt(""),g("chat")}catch(J){h(J instanceof Error?J.message:"Login failed")}finally{qt(!1)}}},xx=async D=>{if(D.preventDefault(),!St){if(h(null),!je||!jt){h("Username and password are required");return}if(jt!==ir){h("Passwords do not match");return}qt(!0);try{await ay(je,jt),d(!1),fr(""),Br(""),g("chat")}catch(J){h(J instanceof Error?J.message:"Registration failed")}finally{qt(!1)}}},bx=y.useCallback(async D=>{D.preventDefault();const J=za.trim();if(!J){Ms("Please enter a gateway URL");return}Dn(!0),Ms(null);try{const he=J.replace(/\/+$/,""),ue=await fetch(`${he}/health`,{signal:AbortSignal.timeout(5e3)});if(!ue.ok)throw new Error(`Server returned ${ue.status}`);const me=Mn();if(jQ(he),he!==me){window.location.reload();return}Fi("auth")}catch(he){Ms(he instanceof Error?he.name==="TimeoutError"||he.name==="AbortError"?"Connection timed out":he.message:"Failed to connect")}finally{Dn(!1)}},[za]),Rp=()=>{rp(),Eu(),g("chat"),d(!0)},e3=y.useCallback(()=>{Eu(),ua()},[Eu,ua]),_x=async D=>{const J=Object.fromEntries(Object.entries(D).map(([he,ue])=>[he,ue.trim()]).filter(([,he])=>he.length>0));await Ho({api_keys:J})},t3=async()=>{const D=await Ad();return await Uh(),D.removed},wx=async()=>{const D=await ng();return await Uh(),D},Sx=async D=>{const J=await Wi(D);return J&&await Uh(),J},r3=y.useCallback(async()=>{if(Qe)try{await fetch(`${Xi}/api/consent/pending/${Qe}/approve-all`,{method:"DELETE"}),hn(!1)}catch{}},[Qe]),n3=y.useCallback(async D=>{var me;const J=vde(D);if(!J)return;if(nr==="manager"||It==="thread"){const Ae=xe.selectedThread,ht=Ae?((me=Xs[Ae.id])==null?void 0:me.length)??0:0;if(Ae&&(Ae.status==="running"||ht>0)){Op(Ae.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:J,displayContent:J,fullContent:J,referencedFiles:void 0,attachments:void 0,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,queuedAt:Date.now()});return}await xe.handleSend(J,Pt,Pt!=="jait"?dt:void 0,Ut??void 0);return}const he=b8(J);let ue=Qe;if(!ue){const Ae=await ua(void 0,he);ue=(Ae==null?void 0:Ae.id)??null}if(!(!ue||!ut)){if(await by(ue,J),Ti||Ys.length>0){Wa({content:J,displayContent:J,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0});return}Bc(J,{token:ut,sessionId:ue,mode:Ur,provider:Pt,runtimeMode:Pt!=="jait"?dt:void 0,model:Ut??void 0,onLoginRequired:()=>d(!0)})}},[Qe,xe.handleSend,xe.selectedThread,Ur,Pt,dt,Ut,ua,Op,Wa,by,Ti,Xs,Ys.length,Bc,It,ut,nr]),[Ja,kx]=y.useState(!1),[sf,Cx]=y.useState(!1),[Fu,jx]=y.useState(()=>_8()),Mp=y.useRef(null),Tg=y.useRef([]),of=y.useRef(null),Ng=y.useRef(_8()),Eg=y.useRef(null),Vi=y.useRef(null),js=y.useRef(null),Sy=y.useRef(null),Ag=y.useRef(null),Og=y.useCallback(()=>{const D=_8();Ng.current=D,jx(D)},[]),Vd=y.useCallback(()=>{var J;Ag.current!==null&&(cancelAnimationFrame(Ag.current),Ag.current=null),(J=Vi.current)==null||J.disconnect(),Vi.current=null,js.current=null,Sy.current=null;const D=Eg.current;Eg.current=null,D&&D.state!=="closed"&&D.close().catch(()=>{}),Og()},[Og]),Pp=y.useCallback(D=>{Vd();try{const J=new AudioContext,he=J.createAnalyser();he.fftSize=256,he.smoothingTimeConstant=.58;const ue=J.createMediaStreamSource(D);ue.connect(he);const me=new Uint8Array(new ArrayBuffer(he.frequencyBinCount));Eg.current=J,Vi.current=ue,js.current=he,Sy.current=me;const Ae=()=>{const ht=js.current,bt=Sy.current;if(!ht||!bt)return;ht.getByteTimeDomainData(bt);let Vt=0;for(let En=0;En<bt.length;En++)Vt+=Math.abs((bt[En]-128)/128);const Gt=bt.length>0?Vt/bt.length:0,gr=Math.pow(Math.min(1,Gt*6.8),.78),Zr=Math.min(1,Math.max(u9,gr)),Rr=(Ng.current[Ng.current.length-1]??u9)*.2+Zr*.8,qn=[...Ng.current.slice(-(yde-1)),Rr];Ng.current=qn,jx(qn),Ag.current=requestAnimationFrame(Ae)};Ae()}catch(J){console.warn("Voice visualizer unavailable:",J),Og()}},[Og,Vd]),Tx=y.useCallback(D=>{const he=D.sampleRate,ue=D.getChannelData(0),me=new ArrayBuffer(44+ue.length*2),Ae=new DataView(me),ht=(Vt,Gt)=>{for(let gr=0;gr<Gt.length;gr++)Ae.setUint8(Vt+gr,Gt.charCodeAt(gr))};ht(0,"RIFF"),Ae.setUint32(4,36+ue.length*2,!0),ht(8,"WAVE"),ht(12,"fmt "),Ae.setUint32(16,16,!0),Ae.setUint16(20,1,!0),Ae.setUint16(22,1,!0),Ae.setUint32(24,he,!0),Ae.setUint32(28,he*1*2,!0),Ae.setUint16(32,2,!0),Ae.setUint16(34,16,!0),ht(36,"data"),Ae.setUint32(40,ue.length*2,!0);let bt=44;for(let Vt=0;Vt<ue.length;Vt++){const Gt=Math.max(-1,Math.min(1,ue[Vt]));Ae.setInt16(bt,Gt<0?Gt*32768:Gt*32767,!0),bt+=2}return new Blob([me],{type:"audio/wav"})},[]),Hu=y.useCallback(async()=>{var he,ue;kx(!1),Vd();const D=Mp.current;if(!D||D.state==="inactive"){(he=of.current)==null||he.getTracks().forEach(me=>me.stop()),of.current=null,Mp.current=null;return}const J=await new Promise(me=>{D.ondataavailable=Ae=>{Ae.data.size>0&&Tg.current.push(Ae.data)},D.onstop=()=>{me(new Blob(Tg.current,{type:D.mimeType}))},D.stop()});if((ue=of.current)==null||ue.getTracks().forEach(me=>me.stop()),of.current=null,Mp.current=null,J.size!==0&&(Hi.stt_provider==="wyoming"||Hi.stt_provider==="whisper")){Cx(!0);try{const me=await J.arrayBuffer(),Ae=new AudioContext({sampleRate:16e3}),ht=await Ae.decodeAudioData(me),bt=Tx(ht);await Ae.close();const Vt=await bt.arrayBuffer(),Gt=new Uint8Array(Vt);let gr="";for(let qn=0;qn<Gt.length;qn++)gr+=String.fromCharCode(Gt[qn]);const Zr=btoa(gr),Rr=await(await fetch(`${Xi}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ut}`},body:JSON.stringify({audioBase64:Zr,sessionId:Qe??"voice-input",provider:Hi.stt_provider})})).json();Rr.text?i(qn=>e1t(qn,Rr.text??"")):console.warn("Transcription failed:",Rr.details??Rr.error)}catch(me){console.error("Transcription error:",me)}finally{Cx(!1)}}},[Qe,Tx,Hi.stt_provider,ut]),af=y.useCallback(async()=>{if(!ut){d(!0);return}try{const D=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});of.current=D,Tg.current=[],Pp(D);const J=new MediaRecorder(D);Mp.current=J,J.ondataavailable=he=>{he.data.size>0&&Tg.current.push(he.data)},J.start(),kx(!0)}catch(D){Vd(),console.error("Microphone access denied:",D),window.alert("Microphone access is required for push-to-talk.")}},[Qe,Hi.stt_provider,Pp,Vd,n3,ut]),[qd,ky]=y.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Cy=y.useCallback(()=>{ky(D=>{const J=!D;try{localStorage.setItem("jait:wake-word",String(J))}catch{}return J})},[]),Nx=y.useCallback(()=>{Vr(!0),xn.connect()},[xn]),Wu=cmt({enabled:qd&&ei&&!Ja&&!rr,lang:navigator.language,onCommand:()=>{Nx()},onWakeWordDetected:()=>{Nx()}});y.useEffect(()=>()=>{var D;Vd(),(D=of.current)==null||D.getTracks().forEach(J=>J.stop())},[Vd]);const Ex=Sl==="limit_reached",lf=!Fo&&!ei,jy=nr==="developer"&&p==="chat"&&!lf&&(Fo||_l||!!Qe&&(ws||dy||mp||yp||Lu)),Ax=fa.length>0||ws,Ty=Kyt({developerChatHydrating:jy,isLoadingHistory:ws,todoCount:Ha.length}),Rg=y.useMemo(()=>gde({showWorkspace:$,showTerminal:w,showWorkspaceTree:se,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,se]),Mg=Tt&&Jm&&Rg!==null&&Rg!=="terminal",Ny=Tt&&p==="chat"&&nr==="developer"&&Rg==="terminal",Uu=y.useMemo(()=>({showWorkspace:$,showTerminal:w,showWorkspaceTree:se,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,se]),Ox=_||ai!==null,Rx=((mi=(Lp=zo==null?void 0:zo.username)==null?void 0:Lp[0])==null?void 0:mi.toUpperCase())??"?",Gc=y.useCallback(()=>{Hu()},[Hu]),Mx=y.useCallback(()=>{xe.setFolderPickerOpen(!0)},[xe.setFolderPickerOpen]),_6=It==="thread"?c.jsx(Vq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:Mx}):null,i3=nr==="manager"&&xe.selectedThread,Vu=Tt&&p==="chat"?c.jsxs("div",{className:"flex flex-col items-center gap-1 rounded-lg border bg-background/85 px-1.5 py-1.5 shadow-lg backdrop-blur-lg",draggable:!1,onDragStart:D=>D.preventDefault(),children:[!i3&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:!$&&!w&&!_?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{$&&Uc(),w&&xa(),_&&k(!1),Y(!1)},"aria-label":"Chat",children:c.jsx(mm,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Chat"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Ox?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>k(D=>!D),"aria-label":"Workspaces",children:_?c.jsx(H3,{className:"h-5 w-5 rotate-90"}):c.jsx(W3,{className:"h-5 w-5 rotate-90"})})}),c.jsx(Qr,{side:"left",children:"Workspaces"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"terminal")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("terminal")},"aria-label":"Terminal",children:c.jsx(Oo,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Terminal"})]})]}),ai&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"files")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("files")},"aria-label":"Files",children:c.jsx(mh,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Files"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:Sf(Uu,"git")?"secondary":"ghost",size:"sm",className:"relative h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("git")},"aria-label":"Changes",children:[c.jsx(l0,{className:"h-5 w-5"}),ds.length>0&&c.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-2xs font-bold leading-[14px] text-primary-foreground",children:ds.length>99?"99+":ds.length})]})}),c.jsx(Qr,{side:"left",children:"Changes"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"editor")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Za("editor")},"aria-label":"Editor",children:c.jsx(Kb,{className:"h-5 w-5"})})}),c.jsx(Qr,{side:"left",children:"Editor"})]})]})]}):null,Ey=nr==="developer"?c.jsx("div",{className:`overflow-x-auto ${Tt?"px-0.5":"px-1"}`,children:c.jsxs("div",{className:`grid min-w-max grid-cols-[1fr_auto_1fr] items-center whitespace-nowrap ${Tt?"gap-2":"gap-3"}`,children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[It==="thread"?_6:c.jsx(DXe,{sessions:lp,activeSessionId:Qe,workspaceTitle:(on==null?void 0:on.title)??"Personal chat",onSelectSession:D=>{yo(ai,D)},onNewSession:()=>{ua()},onOpenChange:GS,showTitle:!1,triggerLabel:"History"}),Tr&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-green-500/10 px-2 py-0.5 text-xs text-green-600 dark:text-green-400",children:["Auto-approved",c.jsx("button",{type:"button",onClick:r3,className:"rounded-full p-0.5 hover:bg-green-500/20 transition-colors",title:"Clear approve all",children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),c.jsx("div",{className:"justify-self-center",children:c.jsx(eQ,{target:It,onChange:kr,disabled:Ty.disableSendTargetSelector})}),c.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[It!=="thread"&&c.jsx("button",{type:"button",onClick:e3,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"New chat"}),Zl!==null&&c.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Zl," remaining"]})]})]})}):null,s3=y.useMemo(()=>({onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:Gc,mode:Ur,onModeChange:Ln,provider:Pt,onProviderChange:Cp,responseStyle:sn,onResponseStyleChange:ci,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),[af,Ja,Fu,sf,Gc,Ur,Ln,Pt,Cp,sn,ci,dt,Hd,Ut,Wd,aa,Ap,$,Jl,ne==null?void 0:ne.nodeId]),Ay=[...fa.slice(-10).map(D=>SV({id:`msg-${D.id}`,source:"chat",title:`Message: ${D.role}`,detail:D.content.slice(0,120)||"(empty message)"})),...qo.map(D=>SV({id:`term-${D.id}`,source:"terminal",title:"Terminal session",detail:`${D.id} (${D.state})`}))];return Nd?c.jsx(zft,{detachedTabId:Nd}):ho?c.jsx(Uft,{detachedId:ho}):vs===!1?c.jsx(qft,{onRetry:()=>{Mc.current=!1,wu(null),fo()}}):c.jsx(TX,{children:c.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!lf&&c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:Tt?"fixed top-2 left-2 right-2 z-40 flex items-center gap-1 pointer-events-none h-10":`relative flex items-center gap-1 shrink-0 border-b bg-background px-2 sm:gap-2 sm:px-5 ${Lt?"h-10 !pl-[0.8rem]":"h-14"}`,style:Lt?{WebkitAppRegion:"drag",paddingLeft:Yl==="darwin"?70:void 0,paddingRight:Yl==="win32"?140:void 0}:void 0,children:[c.jsxs("div",{className:`flex items-center gap-1 shrink-0 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-2 h-10":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsx(Sae,{size:20,className:"shrink-0"}),Wu.isSupported&&c.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${rr?"text-green-400 bg-green-500/10":qd?Wu.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:rr?()=>{xn.disconnect(),Vr(!1)}:Cy,"aria-label":rr?"Disconnect voice":qd?"Disable wake word":"Enable wake word",children:rr?c.jsx(l1,{className:"h-4 w-4 animate-pulse"}):qd?c.jsx(l1,{className:`h-4 w-4 ${Wu.isListening?"animate-pulse":""}`}):c.jsx(Jk,{className:"h-4 w-4"})}),Tt&&p==="chat"&&ma.length>0&&c.jsx(qq,{threads:ma,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),kr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)})]}),c.jsxs("nav",{className:"hidden md:flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="chat"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("chat"),"aria-label":"Chat",children:[c.jsx(mm,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Chat"})]})}),c.jsx(Qr,{side:"bottom",children:"Chat"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("jobs"),"aria-label":"Jobs",children:[c.jsx(w_,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Jobs"})]})}),c.jsx(Qr,{side:"bottom",children:"Jobs"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:p==="network"?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>g("network"),"aria-label":"Network",children:[c.jsx(C1,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Network"})]})}),c.jsx(Qr,{side:"bottom",children:"Network"})]}),nr==="developer"&&!Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:fe?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>fe?jp():sx(),"aria-label":"Screen sharing",children:[c.jsx(Xg,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Screen Share"})]})}),c.jsx(Qr,{side:"bottom",children:"Screen sharing"})]})]}),rr?c.jsxs("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center gap-1.5 rounded-full border border-border/60 bg-background/80 backdrop-blur-sm px-1.5 py-1 ${Tt?"pointer-events-auto":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsx("button",{onClick:xn.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${xn.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":xn.micActive?"Mute":"Unmute",children:xn.micActive?c.jsx(l1,{className:"h-3.5 w-3.5"}):c.jsx(Jk,{className:"h-3.5 w-3.5"})}),c.jsx(Uyt,{state:xn.assistantSpeaking?"speaking":xn.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),c.jsx("button",{onClick:()=>{xn.disconnect(),Vr(!1)},className:"flex items-center justify-center h-7 w-7 rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors","aria-label":"End call",children:c.jsx(fye,{className:"h-3.5 w-3.5"})})]}):p==="chat"?c.jsx("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-1.5 h-10 flex items-center":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:c.jsx(omt,{mode:nr,onChange:$o,compact:Tt})}):null,c.jsx("div",{className:"flex-1 min-w-0"}),c.jsxs("div",{className:`flex items-center gap-1 sm:gap-1.5 shrink-0 ${Tt?"pointer-events-auto rounded-2xl bg-background/70 backdrop-blur-lg shadow-lg border px-1 py-0.5 h-10":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[cg.isActive&&c.jsxs("span",{className:"ui-pill shrink-0",children:[c.jsx(Xg,{className:"h-3 w-3 text-green-500 animate-pulse"}),c.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Wu.isSupported&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs("button",{onClick:rr?()=>{xn.disconnect(),Vr(!1)}:Cy,className:`ui-pill shrink-0 cursor-pointer transition-colors ${rr?"text-green-400 animate-pulse":qd?Wu.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[rr?c.jsx(l1,{className:"h-3 w-3 animate-pulse"}):qd?c.jsx(l1,{className:`h-3 w-3 ${Wu.isListening?"animate-pulse":""}`}):c.jsx(Jk,{className:"h-3 w-3"}),c.jsx("span",{className:"hidden sm:inline text-xs",children:rr?"Voice active":Wu.isListening?"Listening...":qd?"Hey Jait":"Wake word"})]})}),c.jsx(Qr,{side:"bottom",children:rr?"Voice assistant active — click to disconnect":qd?Wu.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),p==="chat"&&ma.length>0&&c.jsx(qq,{threads:ma,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),kr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)}),c.jsx(QXe,{usage:Vh}),(()=>{const D=Ut??lg,J=Pt==="codex"?"openai":Pt==="claude-code"?"anthropic":ag??"ollama",he=Pt==="codex"?Ut??"Codex":Pt==="claude-code"?Ut??"Claude Code":D?Utt(D):null,ue=Pt==="codex"?`OpenAI Codex CLI${Ut?` · ${Ut}`:""}`:Pt==="claude-code"?`Anthropic Claude Code CLI${Ut?` · ${Ut}`:""}`:D??"";return he?c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[c.jsx(t4,{provider:J,model:Pt==="codex"?"codex":Pt==="claude-code"?"claude-3":D??void 0,size:16}),c.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:he})]})}),c.jsx(Qr,{side:"bottom",children:ue})]}):null})(),Zl!==null&&Zl<=5&&c.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[Zl," remaining"]})]}),(Vn==null?void 0:Vn.hasUpdate)&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{onClick:async()=>{if(zi==="web")!pi&&!sa&&await Dc();else if(zi==="electron"){const D=window.jaitDesktop;fi.info("Downloading update...");const J=await D.downloadUpdate();J!=null&&J.ok?(fi.success("Update downloaded. Restarting..."),await D.installUpdate()):fi.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",disabled:zi==="web"&&(pi||sa),className:"h-8 shrink-0 border-amber-500/30 bg-amber-500/10 px-2 text-amber-700 hover:bg-amber-500/15 hover:text-amber-800 dark:text-amber-300",children:[zi==="web"&&(pi||sa)?c.jsx(sr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tK,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:zi==="web"&&(pi||sa)?"Updating...":`v${Vn.latestVersion}`})]})}),c.jsx(Qr,{side:"bottom",children:zi==="web"&&(pi||sa)?"Updating and refreshing...":`Update available — v${Vn.latestVersion}`})]}),Tt?c.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0 rounded-lg",children:c.jsx(IC,{className:"h-4 w-4"})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:"Navigate"}),c.jsxs(Bi,{onSelect:()=>g("chat"),children:[c.jsx(mm,{className:"h-4 w-4 mr-2"}),"Chat"]}),c.jsxs(Bi,{onSelect:()=>g("jobs"),children:[c.jsx(w_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),c.jsxs(Bi,{onSelect:()=>g("network"),children:[c.jsx(C1,{className:"h-4 w-4 mr-2"}),"Network"]}),nr==="developer"&&c.jsxs(Bi,{onSelect:()=>fe?jp():sx(),children:[c.jsx(Xg,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]}),ei?c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(O8,{className:"h-8 w-8",children:c.jsx(R8,{className:"text-sm font-medium",children:Rx})})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:zo==null?void 0:zo.username}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(ed,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",uD],["system",Ra],["dark",oD]].map(([D,J])=>c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx("button",{onClick:()=>{ax(D)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${v===D?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(J,{className:"h-3.5 w-3.5"})})}),c.jsx(Qr,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:Rp,children:[c.jsx(sD,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(we,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>d(!0),children:"Sign in"})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"md:hidden shrink-0",children:c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx(we,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:c.jsx(IC,{className:"h-4 w-4"})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:"Navigate"}),c.jsxs(Bi,{onSelect:()=>g("chat"),children:[c.jsx(mm,{className:"h-4 w-4 mr-2"}),"Chat"]}),c.jsxs(Bi,{onSelect:()=>g("jobs"),children:[c.jsx(w_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),c.jsxs(Bi,{onSelect:()=>g("network"),children:[c.jsx(C1,{className:"h-4 w-4 mr-2"}),"Network"]}),nr==="developer"&&c.jsxs(Bi,{onSelect:()=>fe?jp():sx(),children:[c.jsx(Xg,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),ei?c.jsxs(hu,{children:[c.jsx(fu,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(O8,{className:"h-7 w-7",children:c.jsx(R8,{className:"text-xs",children:Rx})})})}),c.jsxs(Sc,{align:"end",children:[c.jsx(Qg,{children:zo==null?void 0:zo.username}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:()=>g("settings"),children:[c.jsx(U3,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(ed,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",uD],["system",Ra],["dark",oD]].map(([D,J])=>c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx("button",{onClick:()=>{ax(D)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${v===D?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(J,{className:"h-3.5 w-3.5"})})}),c.jsx(Qr,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),c.jsx(ed,{}),c.jsxs(Bi,{onSelect:Rp,children:[c.jsx(sD,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(we,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>d(!0),children:"Sign in"})]}),Lt&&Yl==="linux"&&c.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[c.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:c.jsx(Qk,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:Vs?c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:c.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):c.jsx(V1,{className:"h-3 w-3"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowClose(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-red-600 hover:text-white transition-colors",children:c.jsx(Xn,{className:"h-4 w-4"})})]})]})]}),p==="chat"&&(Tt||nr==="manager")&&c.jsxs("div",{className:`border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${Tt&&!Ru?"hidden":"flex"} ${Ru?"min-h-[35px] items-center gap-1.5 pt-14 py-2":"h-11 md:h-[35px] items-center gap-1 overflow-x-auto overflow-y-visible scrollbar-none"}`,children:[nr==="developer"&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:_?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>k(D=>!D),"aria-label":"Toggle workspaces sidebar",children:[_?c.jsx(H3,{className:`h-3 w-3${Tt?" rotate-90":" mr-1"}`}):c.jsx(W3,{className:`h-3 w-3${Tt?" rotate-90":" mr-1"}`}),!Tt&&"Workspaces"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle workspaces sidebar"})]}),nr==="developer"&&!Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:w?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{yy()},children:[c.jsx(Oo,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle terminal panel"})]}),nr==="developer"&&Tt&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 shrink-0 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Za("terminal")},children:c.jsx(Oo,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Terminal"})]}),nr==="manager"&&xe.selectedThread&&!Tt&&c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:[c.jsx(tD,{className:"h-3 w-3 mr-1"}),"Back"]}),ai&&(nr==="developer"||nr==="manager"&&xe.selectedThread)&&!(Tt&&nr==="manager")&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`flex items-center shrink-0 ${Tt?"gap-1":""}`,children:Tt?c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Za("files")},children:c.jsx(mh,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Files"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:Sf(Uu,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Za("git")},children:[c.jsx(l0,{className:"h-4 w-4"}),ds.length>0&&c.jsx("span",{className:"absolute -right-1 -top-1 z-10 min-w-[14px] rounded-full bg-primary px-1 text-2xs font-bold leading-[14px] text-primary-foreground",children:ds.length>99?"99+":ds.length})]})}),c.jsx(Qr,{side:"bottom",children:"Changes"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Sf(Uu,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Za("editor")},children:c.jsx(Kb,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"bottom",children:"Editor"})]})]}):c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:$?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{bg()},children:[c.jsx(Kb,{className:"h-3 w-3 mr-1"}),"Editor",$&&c.jsx(Xn,{className:"h-3 w-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:$?"Hide editor":"Show editor"})]})}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:ri?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":ri?"Close preview":"Open preview",onClick:()=>{var D;if(ri)gg();else{const J=re.target??(V==null?void 0:V.trim())??((D=_o==null?void 0:_o.target)==null?void 0:D.trim())??null;if(Bo(J,(ne==null?void 0:ne.workspaceRoot)??null))return;vg()}},children:[c.jsx(bi,{className:`h-3 w-3${Tt?"":" mr-1"}`}),!Tt&&"Preview",!Tt&&ri&&c.jsx(Xn,{className:"h-3 wer-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:ri?"Close preview":"Open dev preview"})]})]}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:wt?"secondary":"ghost",size:"sm",className:Tt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":wt?"Close architecture":"Open architecture",onClick:()=>{var D;wt?((D=rs.current)==null||D.closeArchitectureTab(),Be(null),mt(!1)):(mt(!0),$c())},children:[c.jsx(G_,{className:`h-3 w-3${Tt?"":" mr-1"}`}),!Tt&&"Architecture",!Tt&&wt&&c.jsx(Xn,{className:"h-3 w-3 ml-1"})]})}),c.jsx(Qr,{side:"bottom",children:"Software architecture diagram"})]}),nr==="developer"&&$&&ne&&c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Se?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Ke(D=>!D),children:c.jsx(j8,{className:"h-3 w-3"})})}),c.jsx(Qr,{side:"bottom",children:"SSE debug stream"})]}),nr==="manager"&&c.jsxs(c.Fragment,{children:[xe.selectedThread?null:c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:j?"secondary":"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>T(D=>!D),children:[j?c.jsx(H3,{className:`h-3 w-3 mr-1${Tt?" rotate-90":""}`}):c.jsx(W3,{className:`h-3 w-3 mr-1${Tt?" rotate-90":""}`}),"Repositories"]})}),c.jsx(Qr,{side:"bottom",children:"Toggle repositories panel"})]}),xe.selectedRepo&&xe.selectedRepo.source==="local"&&c.jsxs(c.Fragment,{children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>E(xe.selectedRepo),children:[c.jsx(uK,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),c.jsx(Qr,{side:"bottom",children:"Open repository strategy"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>P(xe.selectedRepo),children:[c.jsx(lK,{className:"h-3 w-3 mr-1"}),"Todos"]})}),c.jsx(Qr,{side:"bottom",children:"Open todo plan"})]})]})]}),!(Tt&&xe.selectedThread)&&c.jsx("div",{className:"flex-1"}),xe.selectedThread?c.jsxs("div",{className:Tt?"flex min-w-0 flex-1 items-center gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[Tt&&c.jsx(we,{variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:c.jsx(tD,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[c.jsx(iL,{status:xe.selectedThread.status}),Tt?c.jsxs("div",{className:"min-w-0 flex-1",children:[E4(xe.selectedThread.title)?c.jsx(d9,{className:"text-xs h-3.5 w-28"}):c.jsx("span",{className:"block truncate text-2xs leading-tight text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),c.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 overflow-hidden text-2xs leading-tight text-muted-foreground",children:[xe.selectedRepo&&c.jsxs("span",{className:"min-w-0 truncate",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]}),c.jsx(h9,{kind:xe.selectedThread.kind}),xe.selectedThread.branch&&c.jsx("span",{className:"shrink min-w-0 truncate font-mono",children:xe.selectedThread.branch})]})]}):c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[E4(xe.selectedThread.title)?c.jsx(d9,{className:"text-xs h-3.5 w-28"}):c.jsx("span",{className:"max-w-[200px] truncate text-2xs text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),c.jsx(h9,{kind:xe.selectedThread.kind}),xe.selectedRepo&&c.jsxs("span",{className:"max-w-[160px] truncate text-2xs text-muted-foreground",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[c.jsx(Zrt,{token:ut,threadId:xe.selectedThread.id,selectedSkillIds:xe.selectedThread.skillIds}),!Tt&&xe.selectedThread.branch&&c.jsx(rn,{variant:"outline",className:"text-2xs px-1 py-0 font-mono",children:xe.selectedThread.branch}),nL(xe.selectedThread)&&c.jsx(we,{variant:"ghost",size:"icon",className:"h-[18px] w-[18px] sm:h-5 sm:w-5",onClick:()=>void xe.handleStop(xe.selectedThread.id),title:xe.selectedThread.kind==="delegation"?"End helper thread":"Stop thread",children:c.jsx(V1,{className:"h-2.5 w-2.5"})}),xe.showGitActions&&xe.selectedRepo&&c.jsx("div",{className:Tt?"shrink-0":"ml-2 shrink-0",children:c.jsx(uP,{threadId:xe.selectedThread.id,cwd:xe.selectedThread.workingDirectory??xe.selectedRepo.localPath,branch:xe.selectedThread.branch,baseBranch:xe.selectedRepo.defaultBranch,threadTitle:xe.selectedThread.title,threadStatus:xe.selectedThread.status,threadKind:xe.selectedThread.kind,prUrl:xe.selectedThread.prUrl,prState:xe.selectedThread.id in xe.threadPrStates?xe.threadPrStates[xe.selectedThread.id]:xe.selectedThread.prState,ghAvailable:xe.ghAvailable,showStatusBadge:!Tt})})]})]}):null]})]}),p==="jobs"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(Brt,{})}):p==="network"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(Tft,{token:ut,sessionId:Qe??"default"})}):p==="settings"?c.jsx("div",{className:`flex-1 overflow-y-auto ${Tt?"pt-12":""}`,children:c.jsx(got,{username:(zo==null?void 0:zo.username)??"",token:ut,apiKeys:Hi.api_keys,onSaveApiKeys:_x,sttProvider:Hi.stt_provider,onSttProviderChange:async D=>{await Ho({stt_provider:D})},jaitBackend:Hi.jait_backend??"openai",onJaitBackendChange:async D=>{await Ho({jait_backend:D})},onClearArchive:t3,onClearArchivedWorkspaces:wx,onFetchArchivedWorkspaces:Wh,onRestoreWorkspace:Sx,activityEvents:Ay,updateInfo:Vn,updateChecking:Pc,onCheckUpdate:()=>{Od()},onApplyUpdate:()=>{Dc()},updateApplying:pi,platform:zi})}):c.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${Tt?"flex-col relative":""}`,children:[c.jsxs("div",{className:Tt?"contents":`relative flex min-h-0 ${z?"flex-1 min-w-0":"shrink-0"}`,children:[nr==="developer"&&_&&Tt&&c.jsx("div",{className:"fixed inset-0 z-20",onClick:()=>k(!1)}),nr==="developer"&&!Tt&&c.jsxs("aside",{className:"flex w-12 shrink-0 flex-col items-center gap-2 border-r bg-background px-1 py-2",children:[c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:_?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>k(D=>!D),"aria-label":"Toggle workspaces panel",children:_?c.jsx(H3,{className:"h-4 w-4"}):c.jsx(W3,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Workspaces"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:w?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>{yy()},"aria-label":"Terminal",children:c.jsx(Oo,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Terminal"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:$?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",onClick:()=>{bg()},"aria-label":"Editor",children:c.jsx(Kb,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Editor"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:ri?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Preview",disabled:Fo||_l,onClick:()=>{KS()},children:c.jsx(bi,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Preview"})]}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:wt?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",disabled:Fo||_l,"aria-label":"Architecture",onClick:()=>{v6()},children:c.jsx(G_,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Architecture"})]}),c.jsx("div",{className:"flex-1"}),c.jsxs(an,{children:[c.jsx(ln,{asChild:!0,children:c.jsx(we,{variant:Se?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0",disabled:!$||!ne,"aria-label":"Debug",onClick:()=>Ke(D=>!D),children:c.jsx(j8,{className:"h-4 w-4"})})}),c.jsx(Qr,{side:"right",children:"Debug"})]})]}),nr==="developer"&&_&&c.jsx("aside",{ref:H,tabIndex:-1,onBlur:kp,className:`overflow-hidden outline-none ${Tt?"fixed right-[3.25rem] top-1/2 z-50 h-[min(28rem,80vh)] w-[min(20rem,calc(100vw-5rem))] -translate-y-1/2 rounded-xl border bg-background shadow-2xl":"w-64 border-r shrink-0"}`,children:c.jsx(LXe,{workspaces:go,personalSessions:Lr,activeWorkspaceId:ai,activeSessionId:Qe,loading:_l,hasMoreWorkspaces:ly,showFewerWorkspaces:go.length>cy,onSelectWorkspace:VS,onSelectPersonalSession:D=>{Tt&&k(!1),yo(null,D)},onNewPersonalSession:()=>{Tt&&k(!1),ua(null)},onCreateWorkspace:qS,onRemoveWorkspace:D=>{Ld(D)},onChangeDirectory:sg,onShowMore:sp,onShowFewer:op,sessionInfo:Jl,nodes:ry})}),(nr==="developer"&&p==="chat"&&!Tt&&(Gs||w)||nr==="manager"&&xe.selectedThread&&Gs)&&c.jsxs("div",{className:`relative flex min-h-0 flex-col ${!Gs&&w||z?"flex-1 min-w-0":"shrink-0"}`,style:!Gs&&w?{width:Ot,maxWidth:"70vw"}:void 0,children:[!Gs&&w&&c.jsx("div",{onMouseDown:YS,className:"absolute inset-y-0 right-0 w-1.5 cursor-col-resize hover:bg-primary/30 transition-colors z-10"}),(nr==="developer"||nr==="manager"&&xe.selectedThread)&&Gs&&c.jsx("div",{className:"flex min-h-0 flex-1",children:c.jsx(sH,{ref:rs,autoOpenRemotePath:(ne==null?void 0:ne.workspaceRoot)??null,surfaceId:(ne==null?void 0:ne.surfaceId)??null,files:Ps,activeFileId:Ct,onActiveFileChange:bs,onFileDrop:D=>{mx(D)},onReferenceFile:dx,onReferenceSelection:_g,onReferencePreviewElement:hx,onAvailableFilesChange:Lc,showTree:se,showEditor:le,onToggleTree:my,onToggleEditor:Vc,changedPaths:ox,fsWatcherVersion:Bh,sourceControlRefreshSignal:Tl,savedTabsState:vp,stateReady:bp,previewRequest:q,onTabsStateChange:va,onPreviewOpenChange:wo,previewSessionId:Qe,previewToken:ut,previewWorkspaceRoot:cx,previewInitialTarget:V,architectureDiagram:Mt,architectureGenerating:Ee,architectureRequest:ke,onArchitectureOpenChange:mt,onArchitectureRenderResult:Iu,onGenerateArchitecture:()=>{$e(!0),nf("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:xy,provider:Pt,cliModel:Ut,onCollapsedChange:K,onMaxCollapsedChange:L,restoreRef:B})}),nr==="developer"&&w&&!Tt&&p==="chat"&&c.jsxs("div",{className:`flex min-h-0 flex-col bg-background ${Dt?"absolute inset-0 z-20 border-r":`relative border-r border-t ${Gs?"shrink-0":"flex-1"}`}`,style:Dt||!Gs?void 0:{height:st},children:[!Dt&&c.jsx("div",{onMouseDown:lx,className:"absolute inset-x-0 top-0 h-1.5 cursor-row-resize hover:bg-primary/30 transition-colors z-10"}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx(vV,{terminals:Ud,activeTerminalId:In,onSelect:ns,onCreate:D=>xo(Qe??"default",ss??void 0,D),onKill:ZS,onDetach:fx,availableShells:Va}),c.jsxs("div",{className:"absolute right-0 top-0 bottom-0 flex items-center gap-1 pr-2 pl-3 bg-gradient-to-l from-background via-background to-transparent z-10",children:[Gs&&c.jsx("button",{onClick:()=>{Dt?(Xe(!1),ot(et.current)):(et.current=st,Xe(!0))},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":Dt?"Exit fullscreen":"Fullscreen terminal",children:Dt?c.jsx(k9,{className:"h-4 w-4"}):c.jsx(S9,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>{In&&fx(In)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Open terminal in new window",children:c.jsx(Nm,{className:"h-4 w-4"})}),c.jsx("button",{onClick:xa,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Xn,{className:"h-4 w-4"})})]})]}),In?c.jsx(g4,{ref:Gh,terminalId:In,className:"flex-1 min-h-0",token:ut,workspaceRoot:ss??void 0,onReferenceSelection:wg}):c.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>xo(Qe??"default",ss??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),Ny&&c.jsxs("section",{className:"flex flex-1 min-h-0 flex-col overflow-hidden border-b bg-background pt-16",children:[c.jsxs("div",{className:"relative shrink-0 border-b",children:[c.jsx(vV,{terminals:Ud,activeTerminalId:In,onSelect:ns,onCreate:D=>xo(Qe??"default",ss??void 0,D),onKill:ZS,availableShells:Va}),c.jsx("button",{onClick:xa,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Xn,{className:"h-4 w-4"})})]}),In?c.jsx(g4,{ref:Gh,terminalId:In,className:"flex-1 min-h-0",token:ut,workspaceRoot:ss??void 0,onReferenceSelection:wg}):c.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>xo(Qe??"default",ss??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(nr==="developer"||nr==="manager"&&xe.selectedThread)&&Mg&&c.jsx("section",{className:`flex-1 min-h-0 overflow-hidden border-b bg-background ${nr==="manager"?"":"pt-16"}`,children:c.jsx(sH,{ref:rs,autoOpenRemotePath:(ne==null?void 0:ne.workspaceRoot)??null,surfaceId:(ne==null?void 0:ne.surfaceId)??null,files:Ps,activeFileId:Ct,onActiveFileChange:bs,onFileDrop:D=>{mx(D)},onReferenceFile:dx,onReferenceSelection:_g,onReferencePreviewElement:hx,onAvailableFilesChange:Lc,showTree:se,showEditor:le,onToggleTree:my,onToggleEditor:Vc,treeTab:Ze,onTreeTabChange:Ie,changedPaths:ox,sourceControlRefreshSignal:Tl,isMobile:!0,savedTabsState:vp,stateReady:bp,previewRequest:q,onTabsStateChange:va,onPreviewOpenChange:wo,previewSessionId:Qe,previewToken:ut,previewWorkspaceRoot:cx,previewInitialTarget:V,architectureDiagram:Mt,architectureGenerating:Ee,architectureRequest:ke,onArchitectureOpenChange:mt,onArchitectureRenderResult:Iu,onGenerateArchitecture:()=>{$e(!0),nf("Analyze the workspace architecture and generate a mermaid diagram using the architecture.generate tool. Include all major modules, their relationships, data flow, and external dependencies.")},onApplyDiff:xy,provider:Pt,cliModel:Ut})}),!Mg&&!Ny&&(nr==="manager"?c.jsx("div",{className:`flex-1 min-w-0 flex flex-col min-h-0 ${Tt&&!xe.selectedThread?"pt-12":""}`,children:xe.selectedThread?c.jsxs(c.Fragment,{children:[c.jsxs(RT,{className:"min-h-0 flex-1 border-b",loading:xe.loadingActivities,loadingLabel:"Loading activity",messageContents:kn.map(D=>D.content),children:[kn.length===0&&!xe.loadingActivities&&c.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),kn.map((D,J)=>{var he,ue;return c.jsx(OO,{messageId:D.id,messageIndex:J,messageFromEnd:kn.length-1-J,role:D.role,content:D.content,contextFlow:D.contextFlow,toolCalls:D.toolCalls,segments:D.segments,isStreaming:((he=xe.selectedThread)==null?void 0:he.status)==="running"&&J===kn.length-1,compact:!0,preferLlmUi:!1,provider:(ue=xe.selectedThread)==null?void 0:ue.providerId,onOpenPath:px,onOpenDiff:vy},D.id)})]},((o3=xe.selectedThread)==null?void 0:o3.id)??"manager-empty"),c.jsx("div",{className:"shrink-0 py-3 px-4",children:c.jsxs("div",{className:"mx-auto max-w-3xl",children:[xe.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),Kh.length>0&&xe.selectedThread&&c.jsx(yH,{items:Kh,onRemove:D=>kg(xe.selectedThread.id,D),onEdit:(D,J)=>JS(xe.selectedThread.id,D,J),onReorder:(D,J,he)=>QS(xe.selectedThread.id,D,J,he),onSendToParallelThread:x6,className:"mb-2"}),xe.selectedThreadTodos.length>0&&c.jsx(sE,{items:xe.selectedThreadTodos,className:"mb-2"}),c.jsx(Jb,{ref:mo,draftStateKey:`manager:${((a3=xe.selectedThread)==null?void 0:a3.id)??"new-thread"}`,value:e.current,syncKey:r,onChange:s,onSubmit:_y,onQueue:b6,onStop:()=>{xe.selectedThread&&xe.handleStop(xe.selectedThread.id)},isLoading:((Px=xe.selectedThread)==null?void 0:Px.status)==="running",disabled:xe.creating,placeholder:($p=xe.selectedThread)!=null&&$p.providerSessionId||((qu=xe.selectedThread)==null?void 0:qu.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},responseStyle:sn,onResponseStyleChange:ci,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:Hc,onMoveToGateway:Cg,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$}),c.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Hc&&c.jsx(A4,{runtime:Hc}),xe.selectedThread&&xe.selectedThread.status!=="running"&&!xe.selectedThread.providerSessionId&&c.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):c.jsxs("div",{className:`flex flex-1 min-h-0 ${Tt?"flex-col":""}`,children:[j&&c.jsx("div",{className:`overflow-hidden ${Tt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:c.jsx(c1t,{repositories:xe.repositories,selectedRepoId:((Lx=xe.selectedRepo)==null?void 0:Lx.id)??null,isMobile:Tt,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0),onRemoveRepository:D=>{xe.removeRepository(D)},onOpenStrategy:D=>E(D),onOpenPlan:D=>P(D)})}),c.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-y-auto ${Tt?"pt-8":""}`,children:[c.jsx("div",{className:"relative z-10 flex flex-col items-center px-3 pb-8 pt-8 sm:px-4 sm:pb-2 sm:pt-4",children:c.jsxs("div",{className:"w-full max-w-3xl",children:[c.jsx("h1",{className:"mb-3 text-center text-xl font-semibold tracking-tight sm:mb-4 sm:text-2xl",children:"What do you want to build?"}),xe.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),c.jsx(Jb,{ref:mo,draftStateKey:`manager:${(($x=xe.selectedRepo)==null?void 0:$x.id)??"repo-draft"}`,value:e.current,syncKey:r,onChange:s,onSubmit:_y,disabled:hp,controlsDisabled:xe.creating||ic,placeholder:Id,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},responseStyle:sn,onResponseStyleChange:ci,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:$s,onMoveToGateway:Cg}),c.jsx("div",{className:"overflow-x-auto px-1 pt-3",children:c.jsxs("div",{className:"flex min-w-max items-center gap-2 whitespace-nowrap",children:[c.jsx(Vq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0)}),$s&&c.jsx(A4,{runtime:$s})]})})]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[c.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:"Threads"}),c.jsx(rn,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-2xs",children:Yr.length})]}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void xe.refresh(),children:c.jsx(Na,{className:`h-3.5 w-3.5 ${xe.loading?"animate-spin":""}`})})]}),Yr.length===0?c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):c.jsxs("div",{className:"flex flex-col",children:[Yr.map(D=>{const J=xe.getRepositoryForThread(D),he=(J==null?void 0:J.name)??g6(D)??"Unknown repo",ue=xde(D,D.id in xe.threadPrStates?xe.threadPrStates[D.id]:void 0);return c.jsx(h1t,{thread:D,repo:J,repoName:he,prState:ue,ghAvailable:xe.ghAvailable,onOpen:()=>{xe.setSelectedThreadId(D.id),U(!1),Je(!1)},onStop:()=>{xe.handleStop(D.id)},onDelete:()=>xe.handleDelete(D.id)},D.id)}),xe.hasMoreThreads&&c.jsxs("button",{className:"inline-flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-70 sm:px-4 sm:py-2",disabled:xe.loading,onClick:xe.showMoreThreads,children:[xe.loading?c.jsx(sr,{className:"h-3 w-3 animate-spin"}):null,"Show more threads"]}),Yr.length>xe.threadListLimit&&c.jsx("button",{className:"px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground sm:px-4 sm:py-2",onClick:xe.showFewerThreads,children:"Show less"})]})]})})]})]})}):jy?c.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:z?"0 0 0px":"1 1 0%",width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:!z&&c.jsx(RT,{className:"min-h-0 flex-1 border-b",compact:Gs,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},Qe??"developer-loading")}):Ax?c.jsx("div",{className:"flex flex-col min-h-0 min-w-0 overflow-hidden",style:{flex:z?"0 0 0px":"1 1 0%",width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:!z&&c.jsxs(c.Fragment,{children:[c.jsxs(RT,{className:"min-h-0 flex-1 border-b",compact:Gs,loading:ws,loadingLabel:"Loading chat",messageContents:og,children:[fa.map((D,J)=>c.jsx(OO,{messageId:D.id,messageIndex:J,messageFromEnd:fa.length-1-J,role:D.role,content:D.content,contextFlow:D.contextFlow,displayContent:D.displayContent,referencedFiles:D.referencedFiles,displaySegments:D.displaySegments,attachments:D.attachments,thinking:D.thinking,thinkingDuration:D.thinkingDuration,toolCalls:D.toolCalls,segments:D.segments,isStreaming:Ti&&D===fa[fa.length-1],compact:$||fe||ri,preferLlmUi:!0,provider:Pt,onOpenTerminal:XS,onEditMessage:vx,editComposer:s3,onOpenPath:px,onOpenDiff:vy},D.id)),Ys.length>0&&c.jsx(yH,{items:Ys,onRemove:Ql,onEdit:dp,onReorder:Cl})]},Qe??"developer-empty"),c.jsx("div",{className:`shrink-0 ${Tt?"px-2 py-2":`py-3 ${Gs?"px-3":"px-4"}`}`,children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[c.jsxs("div",{className:"space-y-1.5 max-h-[40vh] overflow-y-auto",children:[Ty.showTodoList&&c.jsx(sE,{items:Ha,onClear:()=>jl([])}),Sl&&Sl!=="login_required"&&Sl!=="limit_reached"&&!Ti&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[c.jsx(eC,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Sl})]}),kl&&!Ti&&c.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[c.jsxs("button",{onClick:()=>Ss({token:ut,sessionId:Qe}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),c.jsx("span",{className:"text-xs text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),c.jsx(oZe,{compact:!0,sessionId:Qe,onApproveAllEnabled:()=>hn(!0)}),cp&&c.jsx(UXe,{plan:cp,onApprove:Au,onReject:qh,isExecuting:Ti}),Ex&&c.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),ds.length>0&&c.jsx(YXe,{files:ds,onAccept:ec,onReject:Ou,onAcceptAll:uy,onRejectAll:vo,onFileClick:vy})]}),c.jsx(Jb,{ref:mo,draftStateKey:`developer:${Qe??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:_y,onStop:Ga,onQueue:gx,isLoading:Ti,disabled:Ex,placeholder:Yh,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},mode:Ur,onModeChange:Ln,responseStyle:sn,onResponseStyleChange:ci,sendTarget:It,onSendTargetChange:kr,showSendTargetSelector:!1,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:It==="thread"?$s:null,onMoveToGateway:It==="thread"?Cg:void 0,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,workspaceName:ux,workspacePath:ss,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),Ey]})})]})}):c.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${z?"":"px-4"} ${Tt?"pt-12":""}`,style:{flex:z?"0 0 0px":void 0,width:z?0:void 0,minWidth:z?0:void 0,visibility:z?"hidden":void 0},children:[" ",c.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),c.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!_l&&go.length===0?c.jsxs("div",{className:"text-center space-y-3",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),c.jsxs(we,{variant:"default",size:"lg",onClick:()=>{ju("workspace"),ku(!0)},children:[c.jsx(mh,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):c.jsx(IXe,{suggestions:$&&ne?o1t:s1t,onSelect:nf}),Ty.showTodoList&&c.jsx(sE,{items:Ha,onClear:()=>jl([])}),c.jsx(Jb,{ref:mo,draftStateKey:`developer:${Qe??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:_y,onStop:Ga,onQueue:gx,isLoading:Ti,placeholder:Yh,onVoiceInput:af,voiceRecording:Ja,voiceLevels:Fu,voiceTranscribing:sf,onVoiceStop:()=>{Hu()},mode:Ur,onModeChange:Ln,responseStyle:sn,onResponseStyleChange:ci,sendTarget:It,onSendTargetChange:kr,showSendTargetSelector:!1,provider:Pt,onProviderChange:Cp,providerRuntimeMode:dt,onProviderRuntimeModeChange:Hd,cliModel:Ut,onCliModelChange:Wd,repoRuntime:It==="thread"?$s:null,onMoveToGateway:It==="thread"?Cg:void 0,availableFiles:aa,onSearchFiles:Ap,workspaceOpen:$,workspaceName:ux,workspacePath:ss,sessionInfo:Jl,workspaceNodeId:ne==null?void 0:ne.nodeId}),Ey]})]}))]}),nr==="developer"&&Se&&c.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:c.jsx(dZe,{onClose:()=>Ke(!1)})}),Tt&&(nr==="developer"||nr==="manager"&&xe.selectedThread)&&p==="chat"&&c.jsxs(c.Fragment,{children:[I&&c.jsx("div",{className:"fixed inset-0 z-[39]",onClick:()=>Y(!1),"aria-hidden":"true"}),c.jsxs("div",{className:"fixed right-0 top-1/2 z-40 flex -translate-y-1/2 items-center gap-1",draggable:!1,onDragStart:D=>D.preventDefault(),children:[c.jsx("div",{className:`transition-all duration-200 ${I?"translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"}`,children:Vu}),c.jsx(we,{type:"button",variant:"secondary",size:"icon",className:"h-14 w-7 rounded-l-lg rounded-r-none border-y border-l border-r-0 bg-background/90 shadow-lg backdrop-blur-lg",onClick:()=>Y(D=>!D),"aria-expanded":I,"aria-label":I?"Hide mobile toolbar":"Show mobile toolbar",title:I?"Hide mobile toolbar":"Show mobile toolbar",children:I?c.jsx(Mo,{className:"h-4 w-4"}):c.jsx(x9,{className:"h-4 w-4"})})]})]})]}),lf&&Lt&&c.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),lf&&c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:c.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Io==="url"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[c.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[c.jsx(no,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:bx,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(zn,{id:"gateway-url",placeholder:"https://jait.example.com",value:za,onChange:D=>{cs(D.target.value),Ms(null)},autoFocus:!0})]}),qs&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(Sh,{className:"h-4 w-4 shrink-0"}),qs]}),c.jsx(we,{type:"submit",className:"w-full",disabled:Su,children:Su?c.jsxs(c.Fragment,{children:[c.jsx(sr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[c.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:uo===!1?"Welcome to Jait":"Account"}),c.jsx("div",{className:"text-sm text-muted-foreground",children:Mi?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(no,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Xi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Fi("url"),children:"Change"})]}):uo===!1?c.jsx("p",{children:"Create your account to get started."}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(K1,{value:er,onValueChange:D=>Kr(D),children:[c.jsxs(x0,{className:"grid grid-cols-2 w-full",children:[c.jsx(ea,{value:"login",children:"Login"}),c.jsx(ea,{value:"register",children:"Register"})]}),c.jsx(ta,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:jg,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-username",children:"Username"}),c.jsx(zn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"login-password",type:Qt?"text":"password",value:Jt,onChange:D=>Bt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>mn(!Qt),tabIndex:-1,children:Qt?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Signing in…":"Login"})]})}),c.jsx(ta,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:xx,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-username",children:"Username"}),c.jsx(zn,{id:"register-username",value:je,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password",type:Pe?"text":"password",value:jt,onChange:D=>fr(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>$n(!Pe),tabIndex:-1,children:Pe?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password-confirm",type:Us?"text":"password",value:ir,onChange:D=>Br(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Rc(!Us),tabIndex:-1,children:Us?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Creating account…":uo===!1?"Get Started":"Create account"})]})})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u})]})})}),c.jsx(Oh,{open:l&&!lf,onOpenChange:D=>{d(D)},children:c.jsx(Cd,{className:"sm:max-w-md",children:Io==="url"?c.jsxs(c.Fragment,{children:[c.jsxs(kh,{children:[c.jsxs(xd,{className:"flex items-center gap-2",children:[c.jsx(no,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx(y0,{children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:bx,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(zn,{id:"gateway-url",placeholder:"https://jait.example.com",value:za,onChange:D=>{cs(D.target.value),Ms(null)},autoFocus:!0})]}),qs&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(Sh,{className:"h-4 w-4 shrink-0"}),qs]}),c.jsx(we,{type:"submit",className:"w-full",disabled:Su,children:Su?c.jsxs(c.Fragment,{children:[c.jsx(sr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs(kh,{children:[c.jsx(xd,{children:uo===!1?"Welcome to Jait":"Account"}),c.jsx(y0,{asChild:!0,children:Mi?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(no,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Xi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Fi("url"),children:"Change"})]}):uo===!1?c.jsx("p",{children:"Create your account to get started."}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(K1,{value:er,onValueChange:D=>Kr(D),children:[c.jsxs(x0,{className:"grid grid-cols-2 w-full",children:[c.jsx(ea,{value:"login",children:"Login"}),c.jsx(ea,{value:"register",children:"Register"})]}),c.jsx(ta,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:jg,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-username",children:"Username"}),c.jsx(zn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"login-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"login-password",type:Qt?"text":"password",value:Jt,onChange:D=>Bt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>mn(!Qt),tabIndex:-1,children:Qt?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Signing in…":"Login"})]})}),c.jsx(ta,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:xx,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-username",children:"Username"}),c.jsx(zn,{id:"register-username",value:je,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password",children:"Password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password",type:Pe?"text":"password",value:jt,onChange:D=>fr(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>$n(!Pe),tabIndex:-1,children:Pe?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsxs("div",{className:"group/pw relative",children:[c.jsx(zn,{id:"register-password-confirm",type:Us?"text":"password",value:ir,onChange:D=>Br(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent opacity-0 group-focus-within/pw:opacity-100 transition-opacity",onClick:()=>Rc(!Us),tabIndex:-1,children:Us?c.jsx(lh,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),c.jsx(we,{type:"submit",className:"w-full",disabled:St,children:St?"Creating account…":uo===!1?"Get Started":"Create account"})]})})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u})]})})}),c.jsx(wV,{open:Zm,onOpenChange:D=>{ku(D),D||bl(null)},initialPath:Hi.workspace_picker_path,initialNodeId:Hi.workspace_picker_node_id,onSelect:(D,J)=>{xg(D,J).catch(he=>{console.error("Failed to select workspace:",he),fi.error(`Failed to select workspace: ${he instanceof Error?he.message:"Unknown error"}`)})}}),c.jsx(wV,{open:xe.folderPickerOpen,onOpenChange:xe.setFolderPickerOpen,onSelect:(D,J)=>{xe.handleFolderSelected(D,J)}}),c.jsx(Jyt,{token:ut,sessionId:Qe}),A&&c.jsx(Jrt,{open:!!A,onOpenChange:D=>{D||E(null)},repoId:A.id,repoName:A.name}),R&&c.jsx(tnt,{open:!!R,onOpenChange:D=>{D||P(null)},repoId:R.id,repoName:R.name,defaultBranch:R.defaultBranch,repoLocalPath:R.localPath,provider:Pt,model:Ut,onStartThread:(D,J,he)=>{(async()=>{const ue=R,me=`jait/${Math.random().toString(16).slice(2,10)}`;let Ae;try{Ae=(await so.createWorktree(ue.localPath,ue.defaultBranch,me)).path}catch{try{await so.createBranch(ue.localPath,me,ue.defaultBranch)}catch{}}const ht=await en.createThread({title:`[${ue.name}] ${D.title}`,providerId:Pt,runtimeMode:Pt!=="jait"?dt:void 0,kind:"delivery",workingDirectory:Ae??ue.localPath,branch:me});await en.startThread(ht.id,{message:D.description||D.title,titleTask:D.title,titlePrefix:`[${ue.name}] `});const bt=J.tasks.map(Vt=>Vt.id===D.id?{...Vt,status:"running",threadId:ht.id}:Vt);await en.updatePlan(J.id,{tasks:bt})})()}}),fe&&c.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:qe.x<0?void 0:qe.x,top:qe.y<0?void 0:qe.y,right:qe.x<0?16:void 0,bottom:qe.y<0?16:void 0,width:Re.w,height:Re.h},children:[c.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:oy,style:{touchAction:"none"},children:[c.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[c.jsx(Xg,{className:"h-3 w-3"})," Screen Share"]}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:D=>D.stopPropagation(),onClick:jp,children:c.jsx(Xn,{className:"h-3 w-3"})})]}),c.jsx(Aft,{screenShare:cg}),c.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:eg,style:{touchAction:"none"},children:c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:c.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function p1t(){const[e,r]=Et.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");Et.useEffect(()=>{const i=document.documentElement,s=()=>r(i.classList.contains("dark")?"dark":"light");s();const o=new MutationObserver(s);return o.observe(i,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},[]);const n=!!window.jaitDesktop&&navigator.userAgent.includes("Windows");return c.jsx(rfe,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}Ehe.createRoot(document.getElementById("root")).render(c.jsx(Et.StrictMode,{children:c.jsx(g1e,{children:c.jsxs(m1e,{children:[c.jsx(f1t,{}),c.jsx(p1t,{})]})})}));export{L1t as $,wPe as A,C1t as B,E_ as C,jh as D,uMe as E,APe as F,OM as G,tee as H,Ma as I,tze as J,UHe as K,YIe as L,EIe as M,Lz as N,Pz as O,P1t as P,E1t as Q,R1t as R,O1t as S,T1t as T,Gr as U,lM as V,M1t as W,N1t as X,Qy as Y,$1t as Z,X as _,kPe as a,rne as a$,A1t as a0,qMe as a1,R2 as a2,S1t as a3,Gj as a4,LHe as a5,uPe as a6,uee as a7,lz as a8,MIe as a9,rvt as aA,J1t as aB,jr as aC,Q1t as aD,aVe as aE,rVe as aF,tVe as aG,Hee as aH,jIe as aI,aUe as aJ,VQ as aK,AIe as aL,w1t as aM,B0 as aN,NS as aO,sUe as aP,iUe as aQ,TIe as aR,FW as aS,RHe as aT,nne as aU,Hj as aV,qj as aW,I5 as aX,Dot as aY,sne as aZ,Sd as a_,PA as aa,WHe as ab,vPe as ac,xS as ad,mr as ae,Pr as af,hee as ag,RUe as ah,mse as ai,tvt as aj,nze as ak,$a as al,Jf as am,xb as an,RM as ao,dne as ap,Mv as aq,mne as ar,br as as,OHe as at,SFe as au,kHe as av,wM as aw,PF as ax,CVe as ay,evt as az,SPe as b,lHe as b0,rM as b1,cm as b2,$2 as b3,Cz as b4,F$e as b5,Sr as b6,gne as b7,Ul as b8,P$e as b9,mFe as bA,kM as bB,hFe as bC,vFe as bD,Ov as bE,Gm as bF,Zz as bG,CM as bH,Jre as bI,dO as bJ,MHe as bK,Vj as bL,G0 as bM,g1t as bN,Ge as bO,tM as ba,Tee as bb,kS as bc,Aee as bd,j1t as be,pz as bf,fz as bg,L8e as bh,AHe as bi,SHe as bj,uFe as bk,SM as bl,iHe as bm,PHe as bn,L5 as bo,mHe as bp,OVe as bq,jS as br,D5 as bs,cHe as bt,Xre as bu,fFe as bv,pFe as bw,Rv as bx,Gg as by,rF as bz,ii as c,Dr as d,dee as e,oo as f,jPe as g,Vf as h,wd as i,oze as j,_S as k,_t as l,fne as m,bS as n,k1t as o,ivt as p,TPe as q,nvt as r,CPe as s,NPe as t,sd as u,rze as v,GHe as w,ZUe as x,D1t as y,iv as z};