@jait/gateway 0.1.353 → 0.1.354
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.
- package/package.json +1 -1
- package/web-dist/assets/{_basePickBy-POHbZ1ag.js → _basePickBy-D0F2dGI7.js} +1 -1
- package/web-dist/assets/{_baseUniq-DpxpFrwB.js → _baseUniq-C5hNdQ9X.js} +1 -1
- package/web-dist/assets/{arc-BOrqyTlC.js → arc-8ANhfASf.js} +1 -1
- package/web-dist/assets/{architectureDiagram-2XIMDMQ5-BFpZut20.js → architectureDiagram-2XIMDMQ5-DTsU5ZkM.js} +1 -1
- package/web-dist/assets/{blockDiagram-WCTKOSBZ-CnKHgC-5.js → blockDiagram-WCTKOSBZ-B6iz7q3q.js} +1 -1
- package/web-dist/assets/{c4Diagram-IC4MRINW-DUxvhade.js → c4Diagram-IC4MRINW-DQk6kYtH.js} +1 -1
- package/web-dist/assets/channel-BUP-1917.js +1 -0
- package/web-dist/assets/{chunk-4BX2VUAB-DRHjS-j5.js → chunk-4BX2VUAB-C3olgW9x.js} +1 -1
- package/web-dist/assets/{chunk-55IACEB6-DSu1qaIA.js → chunk-55IACEB6-DIDpp1jl.js} +1 -1
- package/web-dist/assets/{chunk-FMBD7UC4-Cnh18x2_.js → chunk-FMBD7UC4-CRDlEQpO.js} +1 -1
- package/web-dist/assets/{chunk-JSJVCQXG-vGbwKwxM.js → chunk-JSJVCQXG-BHsIn7KV.js} +1 -1
- package/web-dist/assets/{chunk-KX2RTZJC-CcGml_BM.js → chunk-KX2RTZJC-BTydTGq5.js} +1 -1
- package/web-dist/assets/{chunk-NQ4KR5QH-D_DstXfN.js → chunk-NQ4KR5QH-BKRCmh-Q.js} +1 -1
- package/web-dist/assets/{chunk-QZHKN3VN-DBcCAfIE.js → chunk-QZHKN3VN-yjQ3fMh1.js} +1 -1
- package/web-dist/assets/{chunk-WL4C6EOR-DzUr2yZo.js → chunk-WL4C6EOR-R20es2MJ.js} +1 -1
- package/web-dist/assets/classDiagram-VBA2DB6C-ZCRD1TZZ.js +1 -0
- package/web-dist/assets/classDiagram-v2-RAHNMMFH-ZCRD1TZZ.js +1 -0
- package/web-dist/assets/clone-BJAJPQst.js +1 -0
- package/web-dist/assets/{cose-bilkent-S5V4N54A-ysASFVad.js → cose-bilkent-S5V4N54A-CdGpH0O-.js} +1 -1
- package/web-dist/assets/{dagre-KLK3FWXG-CZEUMai9.js → dagre-KLK3FWXG-D5U0JIKM.js} +1 -1
- package/web-dist/assets/{diagram-E7M64L7V-B82qawln.js → diagram-E7M64L7V-BbngFreA.js} +1 -1
- package/web-dist/assets/{diagram-IFDJBPK2-DET8iL5a.js → diagram-IFDJBPK2-CCcZfbGv.js} +1 -1
- package/web-dist/assets/{diagram-P4PSJMXO-DRJ3od8D.js → diagram-P4PSJMXO-DwetvxM6.js} +1 -1
- package/web-dist/assets/{erDiagram-INFDFZHY-Co9TB_0J.js → erDiagram-INFDFZHY-CRUH9aPJ.js} +1 -1
- package/web-dist/assets/{flowDiagram-PKNHOUZH-Dbk6pkMR.js → flowDiagram-PKNHOUZH-5sYhCyoq.js} +1 -1
- package/web-dist/assets/{ganttDiagram-A5KZAMGK-o_qCDCtq.js → ganttDiagram-A5KZAMGK-COXdQy2E.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-XHmwT9f_.js → gitGraphDiagram-K3NZZRJ6-C_qqhs3E.js} +1 -1
- package/web-dist/assets/{graph-vEgh9wsW.js → graph-YoNG-pEO.js} +1 -1
- package/web-dist/assets/{index-B6-vluSL.js → index-5_9YfBOO.js} +4 -4
- package/web-dist/assets/{index-CLos54op.css → index-DS-II9kS.css} +1 -1
- package/web-dist/assets/{infoDiagram-LFFYTUFH-VKarTtIe.js → infoDiagram-LFFYTUFH-DN6ENTv8.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-PHBUUO56-D9VTrCX5.js → ishikawaDiagram-PHBUUO56-Docrrx5N.js} +1 -1
- package/web-dist/assets/{journeyDiagram-4ABVD52K-sIhJZWCY.js → journeyDiagram-4ABVD52K-CrJ5RL6x.js} +1 -1
- package/web-dist/assets/{kanban-definition-K7BYSVSG-CTHow0CL.js → kanban-definition-K7BYSVSG-wBQ0EmHD.js} +1 -1
- package/web-dist/assets/{layout-Bl4u68vu.js → layout-DSLa2WS-.js} +1 -1
- package/web-dist/assets/{linear-CDtiB-Gq.js → linear-GQEir5So.js} +1 -1
- package/web-dist/assets/{mindmap-definition-YRQLILUH-Ben22_85.js → mindmap-definition-YRQLILUH-CpHAsATt.js} +1 -1
- package/web-dist/assets/{pieDiagram-SKSYHLDU-DkkPWQ27.js → pieDiagram-SKSYHLDU-DImZk6oJ.js} +1 -1
- package/web-dist/assets/{quadrantDiagram-337W2JSQ-BhrCZDsN.js → quadrantDiagram-337W2JSQ-C7r4ZT67.js} +1 -1
- package/web-dist/assets/{requirementDiagram-Z7DCOOCP-BE5A1RLF.js → requirementDiagram-Z7DCOOCP-BHof87ez.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-BKBAg9Vp.js → sankeyDiagram-WA2Y5GQK-bhqRy0dQ.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-2WXFIKYE-DXtG53yl.js → sequenceDiagram-2WXFIKYE-BFNuQqM1.js} +1 -1
- package/web-dist/assets/{stateDiagram-RAJIS63D-Dzp8dJgM.js → stateDiagram-RAJIS63D-e1-TrNX-.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-FVOUBMTO-BPiBB0Cs.js +1 -0
- package/web-dist/assets/{timeline-definition-YZTLITO2-DUmw3Xs3.js → timeline-definition-YZTLITO2-BgBSCjnf.js} +1 -1
- package/web-dist/assets/{treemap-KZPCXAKY-DWK5QpsO.js → treemap-KZPCXAKY-BQsCe-_Y.js} +1 -1
- package/web-dist/assets/{vennDiagram-LZ73GAT5-CG6erngU.js → vennDiagram-LZ73GAT5-DOYtkete.js} +1 -1
- package/web-dist/assets/{xychartDiagram-JWTSCODW-C0XNX-ro.js → xychartDiagram-JWTSCODW-CZ0v3Gv6.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/channel-ySjipwdD.js +0 -1
- package/web-dist/assets/classDiagram-VBA2DB6C-BtEAkoQg.js +0 -1
- package/web-dist/assets/classDiagram-v2-RAHNMMFH-BtEAkoQg.js +0 -1
- package/web-dist/assets/clone-B3z_y2GY.js +0 -1
- package/web-dist/assets/stateDiagram-v2-FVOUBMTO-7xNoXgkR.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-
|
|
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-D5U0JIKM.js","./graph-YoNG-pEO.js","./_baseUniq-C5hNdQ9X.js","./layout-DSLa2WS-.js","./_basePickBy-D0F2dGI7.js","./clone-BJAJPQst.js","./cose-bilkent-S5V4N54A-CdGpH0O-.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-DQk6kYtH.js","./chunk-JSJVCQXG-BHsIn7KV.js","./flowDiagram-PKNHOUZH-5sYhCyoq.js","./chunk-FMBD7UC4-CRDlEQpO.js","./chunk-55IACEB6-DIDpp1jl.js","./chunk-KX2RTZJC-BTydTGq5.js","./channel-BUP-1917.js","./erDiagram-INFDFZHY-CRUH9aPJ.js","./gitGraphDiagram-K3NZZRJ6-C_qqhs3E.js","./chunk-4BX2VUAB-C3olgW9x.js","./chunk-QZHKN3VN-yjQ3fMh1.js","./treemap-KZPCXAKY-BQsCe-_Y.js","./ganttDiagram-A5KZAMGK-COXdQy2E.js","./linear-GQEir5So.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-DN6ENTv8.js","./pieDiagram-SKSYHLDU-DImZk6oJ.js","./arc-8ANhfASf.js","./quadrantDiagram-337W2JSQ-C7r4ZT67.js","./xychartDiagram-JWTSCODW-CZ0v3Gv6.js","./requirementDiagram-Z7DCOOCP-BHof87ez.js","./sequenceDiagram-2WXFIKYE-BFNuQqM1.js","./classDiagram-VBA2DB6C-ZCRD1TZZ.js","./chunk-WL4C6EOR-R20es2MJ.js","./classDiagram-v2-RAHNMMFH-ZCRD1TZZ.js","./stateDiagram-RAJIS63D-e1-TrNX-.js","./chunk-NQ4KR5QH-BKRCmh-Q.js","./stateDiagram-v2-FVOUBMTO-BPiBB0Cs.js","./journeyDiagram-4ABVD52K-CrJ5RL6x.js","./timeline-definition-YZTLITO2-BgBSCjnf.js","./mindmap-definition-YRQLILUH-CpHAsATt.js","./kanban-definition-K7BYSVSG-wBQ0EmHD.js","./diagram-P4PSJMXO-DwetvxM6.js","./diagram-IFDJBPK2-CCcZfbGv.js","./blockDiagram-WCTKOSBZ-B6iz7q3q.js","./architectureDiagram-2XIMDMQ5-DTsU5ZkM.js","./diagram-E7M64L7V-BbngFreA.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var dhe=Object.defineProperty;var hhe=(e,r,n)=>r in e?dhe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Fe=(e,r,n)=>hhe(e,typeof r!="symbol"?r+"":r,n);function fhe(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 T0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o1t(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 Q6={exports:{}},Vx={};/**
|
|
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 u=e.height/2,c=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)*u){let p=n.y<r.y?r.y-u-s:s-u-r.y;l=h*p/c;const g={x:n.x<r.x?n.x+l:n.x-h+l,y:n.y<r.y?n.y+c-p:n.y-c+p};return l===0&&(g.x=r.x,g.y=r.y),h===0&&(g.x=r.x),c===0&&(g.y=r.y),_t.debug(`abc89 top/bottom calc, Q ${c}, 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=c*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 ${c}, q ${p}, R ${h}, r ${l}`,{_x:g,_y:v}),l===0&&(g=r.x,v=r.y),h===0&&(g=r.x),c===0&&(v=r.y),{x:g,y:v}}},"intersection"),bF=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),!YUe(r,o)&&!s){const a=XUe(r,i,o);_t.debug("abc88 inside",o,i,a),_t.debug("abc88 intersection",a,r);let l=!1;n.forEach(u=>{l=l||u.x===a.x&&u.y===a.y}),n.some(u=>u.x===a.x&&u.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 use(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(use,"extractCornerPoints");var _F=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"),ZUe=X(function(e){const{cornerPointPositions:r}=use(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=_F(s,a,5),u=_F(o,a,5),c=u.x-l.x,h=u.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:c<0?l.x-v+p:l.x+v-p,y:h<0?l.y-p:l.y+p}:g={x:c<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,u)}else n.push(e[i]);return n},"fixCorners"),JUe=X((e,r,n)=>{const i=e-r-n,s=2,o=2,a=s+o,l=Math.floor(i/a),u=Array(l).fill(`${s} ${o}`).join(" ");return`0 ${r} ${u} ${n}`},"generateDashArray"),QUe=X(function(e,r,n,i,s,o,a,l=!1){var L;const{handDrawnSeed:u}=ri();let c=r.points,h=!1;const p=s;var g=o;const v=[];for(const B in r.cssCompiledStyles)une(B)||v.push(r.cssCompiledStyles[B]);_t.debug("UIO intersect check",r.points,g.x,p.x),g.intersect&&p.intersect&&!l&&(c=c.slice(1,r.points.length-1),c.unshift(p.intersect(c[0])),_t.debug("Last point UIO",r.start,"-->",r.end,c[c.length-1],g,g.intersect(c[c.length-1])),c.push(g.intersect(c[c.length-1])));const b=btoa(JSON.stringify(c));r.toCluster&&(_t.info("to cluster abc88",n.get(r.toCluster)),c=bF(r.points,n.get(r.toCluster).node),h=!0),r.fromCluster&&(_t.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(c,null,2)),c=bF(c.reverse(),n.get(r.fromCluster).node).reverse(),h=!0);let _=c.filter(B=>!Number.isNaN(B.y));const k=qUe(r.curve);k!=="rounded"&&(_=ZUe(_));let w=k_;switch(k){case"linear":w=k_;break;case"basis":w=NA;break;case"cardinal":w=Uee;break;case"bumpX":w=Bee;break;case"bumpY":w=zee;break;case"catmullRom":w=qee;break;case"monotoneX":w=Jee;break;case"monotoneY":w=Qee;break;case"natural":w=tte;break;case"step":w=rte;break;case"stepAfter":w=ite;break;case"stepBefore":w=nte;break;case"rounded":w=k_;break;default:w=NA}const{x:C,y:j}=YBe(r),T=CIe().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"?dse(hse(_,r),5):T(_);const P=Array.isArray(r.style)?r.style:[r.style];let H=P.find(B=>B==null?void 0:B.startsWith("stroke:")),$="";r.animate&&($="edge-animation-fast"),r.animation&&($="edge-animation-"+r.animation);let U=!1;if(r.look==="handDrawn"){const B=xr.svg(e);Object.assign([],_);const W=B.path(R,{roughness:.3,seed:u});A+=" transition",E=$r(W).select("path").attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",P?P.reduce((F,V)=>F+";"+V,""):"");let Y=E.attr("d");E.attr("d",Y),e.node().appendChild(E.node())}else{const B=v.join(";"),W=P?P.reduce((ee,ne)=>ee+ne+";",""):"",Y=(B?B+";"+W+";":W)+";"+(P?P.reduce((ee,ne)=>ee+";"+ne,""):"");E=e.append("path").attr("d",R).attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+($?" "+$:"")).attr("style",Y),H=(L=Y.match(/stroke:([^;]+)/))==null?void 0:L[1],U=r.animate===!0||!!r.animation||B.includes("animation");const F=E.node(),V=typeof F.getTotalLength=="function"?F.getTotalLength():0,J=$z[r.arrowTypeStart]||0,q=$z[r.arrowTypeEnd]||0;if(r.look==="neo"&&!U){const ne=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?JUe(V,J,q):`0 ${J} ${V-J-q} ${q}`}; stroke-dashoffset: 0;`;E.attr("style",ne+E.attr("style"))}}E.attr("data-edge",!0),E.attr("data-et","edge"),E.attr("data-id",r.id),E.attr("data-points",b),r.showPoints&&_.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let I="";(ri().flowchart.arrowMarkerAbsolute||ri().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),UUe(E,r,I,a,i,H);const K=Math.floor(c.length/2),M=c[K];rd.isLabelCoordinateInPath(M,E.attr("d"))||(h=!0);let z={};return h&&(z.updatedPath=c),z.originalPath=r.points,z},"insertEdge");function dse(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],u=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 c=a.x-l.x,h=a.y-l.y,p=u.x-a.x,g=u.y-a.y,v=Math.hypot(c,h),b=Math.hypot(p,g);if(v<s||b<s){n+=`L${a.x},${a.y}`;continue}const _=c/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(dse,"generateRoundedPath");function rO(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(rO,"calculateDeltaAndAngle");function hse(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&ka[r.arrowTypeStart]){const s=ka[r.arrowTypeStart],o=e[0],a=e[1],{angle:l}=rO(o,a),u=s*Math.cos(l),c=s*Math.sin(l);n[0].x=o.x+u,n[0].y=o.y+c}const i=e.length;if(i>=2&&ka[r.arrowTypeEnd]){const s=ka[r.arrowTypeEnd],o=e[i-1],a=e[i-2],{angle:l}=rO(a,o),u=s*Math.cos(l),c=s*Math.sin(l);n[i-1].x=o.x-u,n[i-1].y=o.y-c}return n}X(hse,"applyMarkerOffsetsToPoints");var eVe=X((e,r,n,i)=>{r.forEach(s=>{gVe[s](e,n,i)})},"insertMarkers"),tVe=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"),rVe=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"),nVe=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"),iVe=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"),sVe=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"),oVe=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"),aVe=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"),lVe=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"),cVe=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"),uVe=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"),dVe=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"),hVe=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"),fVe=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"),pVe=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"),mVe=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"),gVe={extension:tVe,composition:rVe,aggregation:nVe,dependency:iVe,lollipop:sVe,point:oVe,circle:aVe,cross:lVe,barb:cVe,only_one:uVe,zero_or_one:dVe,one_or_more:hVe,zero_or_more:fVe,requirement_arrow:pVe,requirement_contains:mVe},yVe=eVe,vVe={common:hS,getConfig:Oa,insertCluster:kUe,insertEdge:QUe,insertEdgeLabel:GUe,insertMarkers:yVe,insertNode:cse,interpolateToCurve:gM,labelHelper:Fr,log:_t,positionEdgeLabel:KUe},$2={},fse=X(e=>{for(const r of e)$2[r.name]=r},"registerLayoutLoaders"),xVe=X(()=>{fse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-
|
|
1120
|
-
`);const i=FIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),see(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"),Ose={draw:qqe},Gqe=Ose,Kqe={db:{},renderer:Ose,parser:{parse:X(()=>{},"parse")}},Yqe=Kqe,Rse="flowchart-elk",Xqe=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"),Zqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-
|
|
1119
|
+
L0,20`)},"requirement_arrow"),mVe=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"),gVe={extension:tVe,composition:rVe,aggregation:nVe,dependency:iVe,lollipop:sVe,point:oVe,circle:aVe,cross:lVe,barb:cVe,only_one:uVe,zero_or_one:dVe,one_or_more:hVe,zero_or_more:fVe,requirement_arrow:pVe,requirement_contains:mVe},yVe=eVe,vVe={common:hS,getConfig:Oa,insertCluster:kUe,insertEdge:QUe,insertEdgeLabel:GUe,insertMarkers:yVe,insertNode:cse,interpolateToCurve:gM,labelHelper:Fr,log:_t,positionEdgeLabel:KUe},$2={},fse=X(e=>{for(const r of e)$2[r.name]=r},"registerLayoutLoaders"),xVe=X(()=>{fse([{name:"dagre",loader:X(async()=>await Ge(()=>import("./dagre-KLK3FWXG-D5U0JIKM.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-CdGpH0O-.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");xVe();var G1t=X(async(e,r)=>{if(!(e.layoutAlgorithm in $2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=$2[e.layoutAlgorithm];return(await n.loader()).render(e,r,vVe,{algorithm:n.algorithm})},"render"),K1t=X((e="",{fallback:r="dagre"}={})=>{if(e in $2)return e;if(r in $2)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"),bVe=Wre(Object.keys,Object),_Ve=Object.prototype,wVe=_Ve.hasOwnProperty;function SVe(e){if(!zj(e))return bVe(e);var r=[];for(var n in Object(e))wVe.call(e,n)&&n!="constructor"&&r.push(n);return r}var nO=D0(wd,"DataView"),iO=D0(wd,"Promise"),sO=D0(wd,"Set"),oO=D0(wd,"WeakMap"),wF="[object Map]",kVe="[object Object]",SF="[object Promise]",kF="[object Set]",CF="[object WeakMap]",jF="[object DataView]",CVe=$0(nO),jVe=$0(P2),TVe=$0(iO),NVe=$0(sO),EVe=$0(oO),Lg=L0;(nO&&Lg(new nO(new ArrayBuffer(1)))!=jF||P2&&Lg(new P2)!=wF||iO&&Lg(iO.resolve())!=SF||sO&&Lg(new sO)!=kF||oO&&Lg(new oO)!=CF)&&(Lg=function(e){var r=L0(e),n=r==kVe?e.constructor:void 0,i=n?$0(n):"";if(i)switch(i){case CVe:return jF;case jVe:return wF;case TVe:return SF;case NVe:return kF;case EVe:return CF}return r});var AVe="[object Map]",OVe="[object Set]",RVe=Object.prototype,MVe=RVe.hasOwnProperty;function TF(e){if(e==null)return!0;if(Fj(e)&&(M5(e)||typeof e=="string"||typeof e.splice=="function"||pM(e)||mM(e)||R5(e)))return!e.length;var r=Lg(e);if(r==AVe||r==OVe)return!e.size;if(zj(e))return!SVe(e).length;for(var n in e)if(MVe.call(e,n))return!1;return!0}var pse="c4",PVe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),LVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-DQk6kYtH.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:pse,diagram:e}},"loader"),$Ve={id:pse,detector:PVe,loader:LVe},DVe=$Ve,mse="flowchart",IVe=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"),BVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-5sYhCyoq.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:mse,diagram:e}},"loader"),zVe={id:mse,detector:IVe,loader:BVe},FVe=zVe,gse="flowchart-v2",HVe=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"),WVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-5sYhCyoq.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:gse,diagram:e}},"loader"),UVe={id:gse,detector:HVe,loader:WVe},VVe=UVe,yse="er",qVe=X(e=>/^\s*erDiagram/.test(e),"detector"),GVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-CRUH9aPJ.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:yse,diagram:e}},"loader"),KVe={id:yse,detector:qVe,loader:GVe},YVe=KVe,vse="gitGraph",XVe=X(e=>/^\s*gitGraph/.test(e),"detector"),ZVe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-C_qqhs3E.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:vse,diagram:e}},"loader"),JVe={id:vse,detector:XVe,loader:ZVe},QVe=JVe,xse="gantt",eqe=X(e=>/^\s*gantt/.test(e),"detector"),tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-COXdQy2E.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:xse,diagram:e}},"loader"),rqe={id:xse,detector:eqe,loader:tqe},nqe=rqe,bse="info",iqe=X(e=>/^\s*info/.test(e),"detector"),sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-DN6ENTv8.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:bse,diagram:e}},"loader"),oqe={id:bse,detector:iqe,loader:sqe},_se="pie",aqe=X(e=>/^\s*pie/.test(e),"detector"),lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-DImZk6oJ.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:_se,diagram:e}},"loader"),cqe={id:_se,detector:aqe,loader:lqe},wse="quadrantChart",uqe=X(e=>/^\s*quadrantChart/.test(e),"detector"),dqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-C7r4ZT67.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:wse,diagram:e}},"loader"),hqe={id:wse,detector:uqe,loader:dqe},fqe=hqe,Sse="xychart",pqe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),mqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-CZ0v3Gv6.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Sse,diagram:e}},"loader"),gqe={id:Sse,detector:pqe,loader:mqe},yqe=gqe,kse="requirement",vqe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),xqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-BHof87ez.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:kse,diagram:e}},"loader"),bqe={id:kse,detector:vqe,loader:xqe},_qe=bqe,Cse="sequence",wqe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),Sqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-BFNuQqM1.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:Cse,diagram:e}},"loader"),kqe={id:Cse,detector:wqe,loader:Sqe},Cqe=kqe,jse="class",jqe=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"),Tqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-ZCRD1TZZ.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:jse,diagram:e}},"loader"),Nqe={id:jse,detector:jqe,loader:Tqe},Eqe=Nqe,Tse="classDiagram",Aqe=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"),Oqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-ZCRD1TZZ.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:Tse,diagram:e}},"loader"),Rqe={id:Tse,detector:Aqe,loader:Oqe},Mqe=Rqe,Nse="state",Pqe=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"),Lqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-e1-TrNX-.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:Nse,diagram:e}},"loader"),$qe={id:Nse,detector:Pqe,loader:Lqe},Dqe=$qe,Ese="stateDiagram",Iqe=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"),Bqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-BPiBB0Cs.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:Ese,diagram:e}},"loader"),zqe={id:Ese,detector:Iqe,loader:Bqe},Fqe=zqe,Ase="journey",Hqe=X(e=>/^\s*journey/.test(e),"detector"),Wqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-CrJ5RL6x.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:Ase,diagram:e}},"loader"),Uqe={id:Ase,detector:Hqe,loader:Wqe},Vqe=Uqe,qqe=X((e,r,n)=>{_t.debug(`rendering svg for syntax error
|
|
1120
|
+
`);const i=FIe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),see(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"),Ose={draw:qqe},Gqe=Ose,Kqe={db:{},renderer:Ose,parser:{parse:X(()=>{},"parse")}},Yqe=Kqe,Rse="flowchart-elk",Xqe=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"),Zqe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-5sYhCyoq.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Rse,diagram:e}},"loader"),Jqe={id:Rse,detector:Xqe,loader:Zqe},Qqe=Jqe,Mse="timeline",eGe=X(e=>/^\s*timeline/.test(e),"detector"),tGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-BgBSCjnf.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:Mse,diagram:e}},"loader"),rGe={id:Mse,detector:eGe,loader:tGe},nGe=rGe,Pse="mindmap",iGe=X(e=>/^\s*mindmap/.test(e),"detector"),sGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-CpHAsATt.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:Pse,diagram:e}},"loader"),oGe={id:Pse,detector:iGe,loader:sGe},aGe=oGe,Lse="kanban",lGe=X(e=>/^\s*kanban/.test(e),"detector"),cGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-wBQ0EmHD.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:Lse,diagram:e}},"loader"),uGe={id:Lse,detector:lGe,loader:cGe},dGe=uGe,$se="sankey",hGe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),fGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-bhqRy0dQ.js");return{diagram:r}},[],import.meta.url);return{id:$se,diagram:e}},"loader"),pGe={id:$se,detector:hGe,loader:fGe},mGe=pGe,Dse="packet",gGe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),yGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-DwetvxM6.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:Dse,diagram:e}},"loader"),vGe={id:Dse,detector:gGe,loader:yGe},Ise="radar",xGe=X(e=>/^\s*radar-beta/.test(e),"detector"),bGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-CCcZfbGv.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:Ise,diagram:e}},"loader"),_Ge={id:Ise,detector:xGe,loader:bGe},Bse="block",wGe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),SGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-B6iz7q3q.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:Bse,diagram:e}},"loader"),kGe={id:Bse,detector:wGe,loader:SGe},CGe=kGe,zse="architecture",jGe=X(e=>/^\s*architecture/.test(e),"detector"),TGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-DTsU5ZkM.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:zse,diagram:e}},"loader"),NGe={id:zse,detector:jGe,loader:TGe},EGe=NGe,Fse="ishikawa",AGe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),OGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-Docrrx5N.js");return{diagram:r}},[],import.meta.url);return{id:Fse,diagram:e}},"loader"),RGe={id:Fse,detector:AGe,loader:OGe},Hse="venn",MGe=X(e=>/^\s*venn-beta/.test(e),"detector"),PGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-DOYtkete.js");return{diagram:r}},[],import.meta.url);return{id:Hse,diagram:e}},"loader"),LGe={id:Hse,detector:MGe,loader:PGe},$Ge=LGe,Wse="treemap",DGe=X(e=>/^\s*treemap/.test(e),"detector"),IGe=X(async()=>{const{diagram:e}=await Ge(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-BbngFreA.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:Wse,diagram:e}},"loader"),BGe={id:Wse,detector:DGe,loader:IGe},NF=!1,Yj=X(()=>{NF||(NF=!0,p5("error",Yqe,e=>e.toLowerCase().trim()==="error"),p5("---",{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("---")),fA(Qqe,aGe,EGe),fA(DVe,dGe,Mqe,Eqe,YVe,nqe,oqe,cqe,_qe,Cqe,VVe,FVe,nGe,QVe,Fqe,Dqe,Vqe,fqe,mGe,vGe,yqe,CGe,_Ge,RGe,BGe,$Ge))},"addDiagrams"),zGe=X(async()=>{_t.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(f0).map(async([n,{detector:i,loader:s}])=>{if(s)try{yA(n)}catch{try{const{diagram:o,id:a}=await s();p5(a,o,i)}catch(o){throw _t.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete f0[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"),FGe="graphics-document document";function Use(e,r){e.attr("role",FGe),r!==""&&e.attr("aria-roledescription",r)}X(Use,"setA11yDiagramInfo");function Vse(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(Vse,"addSVGa11yTitleDescription");var n0,aO=(n0=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 c,h;const i=Oa(),s=DR(r,i);r=UHe(r)+`
|
|
1121
1121
|
`;try{yA(s)}catch{const p=RMe(s);if(!p)throw new VQ(`Diagram ${s} not found.`);const{id:g,diagram:v}=await p();p5(g,v)}const{db:o,parser:a,renderer:l,init:u}=yA(s);return a.parser&&(a.parser.yy=o),(c=o.clear)==null||c.call(o),u==null||u(i),n.title&&((h=o.setDiagramTitle)==null||h.call(o,n.title)),await a.parse(r),new n0(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(n0,"Diagram"),n0),EF=[],HGe=X(()=>{EF.forEach(e=>{e()}),EF=[]},"attachFunctions"),WGe=X(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function qse(e){const r=e.match(UQ);if(!r)return{text:e,metadata:{}};let n=KBe(r[1],{schema:GBe})??{};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(qse,"extractFrontMatter");var UGe=X(e=>e.replace(/\r\n?/g,`
|
|
1122
1122
|
`).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),VGe=X(e=>{const{text:r,metadata:n}=qse(e),{displayMode:i,title:s,config:o={}}=n;return i&&(o.gantt||(o.gantt={}),o.gantt.displayMode=i),{title:s,config:o,text:r}},"processFrontmatter"),qGe=X(e=>{const r=rd.detectInit(e)??{},n=rd.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:OHe(e),directive:r}},"processDirectives");function DM(e){const r=UGe(e),n=VGe(r),i=qGe(n.text),s=_M(n.config,i.directive);return e=WGe(i.text),{code:e,title:n.title,config:s}}X(DM,"preprocessDiagram");function Gse(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}X(Gse,"toBase64");var GGe=5e4,KGe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",YGe="sandbox",XGe="loose",ZGe="http://www.w3.org/2000/svg",JGe="http://www.w3.org/1999/xlink",QGe="http://www.w3.org/1999/xhtml",eKe="100%",tKe="100%",rKe="border:0;margin:0;",nKe="margin:0",iKe="allow-top-navigation-by-user-activation allow-popups",sKe='The "iframe" tag is not supported by your browser.',oKe=["foreignobject"],aKe=["dominant-baseline"];function IM(e){const r=DM(e);return h5(),KMe(r.config??{}),r}X(IM,"processAndSetConfigs");async function Kse(e,r){Yj();try{const{code:n,config:i}=IM(e);return{diagramType:(await Xse(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}X(Kse,"parse");var AF=X((e,r,n=[])=>`
|
|
1123
1123
|
.${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),lKe=X((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -1446,4 +1446,4 @@ ${yn.content.slice(0,2e3)}
|
|
|
1446
1446
|
|
|
1447
1447
|
`:""}${Ur.join(`
|
|
1448
1448
|
|
|
1449
|
-
`)}`:me,displayContent:me,referencedFiles:Pe.length>0?Pe:void 0,displaySegments:ce,attachments:dr.size>0?[...dr]:void 0}},[Ns]),hx=y.useCallback(async(D,Q,he)=>{const ce=await Bu(e.current,D,he);if(!ce)return;const me=zk(ce.displaySegments,Q);Bo({content:ce.promptWithReferences,displayContent:ce.displayContent||ce.promptWithReferences,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:Q}),i(""),a(void 0)},[Wr,Mt,ut,nn,Vt,Bo,Bu,i]),py=y.useCallback(async(D,Q)=>{if(!Hyt(ca==null?void 0:ca.name))return;const he=m8(Q);!he||he==="New Chat"||await Jm(D,he)},[ca==null?void 0:ca.name,Jm]),Tp=async(D,Q,he)=>{if(ir==="manager"||Bt==="thread")return WS(D,Q,he);const ce=await Bu(e.current,D,he);if(!ce&&(!Q||Q.length===0))return;if(!dt){u(!0);return}const me=(ce==null?void 0:ce.promptWithReferences)??e.current.trim(),Pe=zk(ce==null?void 0:ce.displaySegments,Q),mt=m8((ce==null?void 0:ce.displayContent)||me);let bt=rt;if(!bt){const Wt=await aa(void 0,mt);bt=(Wt==null?void 0:Wt.id)??null}if(bt){if(await py(bt,(ce==null?void 0:ce.displayContent)||me),Si||qs.length>0){Bo({content:me,displayContent:(ce==null?void 0:ce.displayContent)||me,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,referencedFiles:ce==null?void 0:ce.referencedFiles,displaySegments:Pe,attachments:Q}),i(""),a(void 0);return}Ec(me,{token:dt,sessionId:bt,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,onLoginRequired:()=>u(!0),attachments:Q,...ce!=null&&ce.displayContent?{displayContent:ce.displayContent||me}:{},...ce!=null&&ce.referencedFiles?{referencedFiles:ce.referencedFiles}:{},...Pe!=null&&Pe.length?{displaySegments:Pe}:{}}),i(""),a(void 0)}},WS=async(D,Q,he)=>{var mt;const ce=await Bu(e.current,D,he);if(!ce||mp)return;const me=zk(ce.displaySegments,Q),Pe=xe.selectedThread?((mt=Ks[xe.selectedThread.id])==null?void 0:mt.length)??0:0;if(xe.selectedThread&&(xe.selectedThread.status==="running"||Pe>0)){nf(xe.selectedThread.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:ce.displayContent||ce.promptWithReferences,displayContent:ce.displayContent||ce.promptWithReferences,fullContent:ce.promptWithReferences,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:ce.attachments,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()}),i(""),a(void 0);return}i(""),a(void 0),await xe.handleSend(ce.promptWithReferences,Mt,Mt!=="jait"?ut:void 0,Vt??void 0,{displayContent:ce.displayContent||ce.promptWithReferences,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:ce.attachments})},my=y.useRef(!1);y.useEffect(()=>{var Q,he,ce;if(ir==="manager"||Bt==="thread"||!dt||!rt||Si||As||my.current)return;const[D]=qs;D&&(my.current=!0,ku(D.id),Promise.resolve(Ec(D.content,{token:dt,sessionId:rt,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,onLoginRequired:()=>u(!0),...(Q=D.attachments)!=null&&Q.length?{attachments:D.attachments}:{},...D.displayContent?{displayContent:D.displayContent}:{},...(he=D.referencedFiles)!=null&&he.length?{referencedFiles:D.referencedFiles}:{},...(ce=D.displaySegments)!=null&&ce.length?{displaySegments:D.displaySegments}:{}})).catch(me=>{Bo({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}),pi.error(Pq(me instanceof Error?me.message:null,"Failed to send queued message"))}).finally(()=>{my.current=!1}))},[rt,ku,Bo,Si,As,qs,Ec,Bt,dt,ir]);const nf=y.useCallback((D,Q)=>{yo(he=>({...he,[D]:[...he[D]??[],Q]}))},[]),gy=y.useCallback((D,Q)=>{yo(he=>{const ce=he[D]??[],me=ce.filter(Pe=>Pe.id!==Q);if(me.length===ce.length)return he;if(me.length===0){const{[D]:Pe,...mt}=he;return mt}return{...he,[D]:me}})},[]),US=y.useCallback((D,Q,he)=>{const ce=he.trim();ce&&yo(me=>{const Pe=me[D]??[];return Pe.length===0?me:{...me,[D]:Pe.map(mt=>mt.id===Q?{...mt,content:ce,displayContent:ce,fullContent:ce,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:mt)}})},[]),m6=y.useCallback((D,Q,he,ce)=>{yo(me=>{const Pe=me[D]??[];if(Pe.length===0)return me;const mt=Pe.findIndex(dr=>dr.id===Q);if(mt<0)return me;const bt=[...Pe],[Wt]=bt.splice(mt,1);if(!Wt)return me;if(he==null)bt.push(Wt);else{const dr=bt.findIndex(Ur=>Ur.id===he);if(dr<0)return me;bt.splice(dr+(ce==="after"?1:0),0,Wt)}return bt===Pe?me:{...me,[D]:bt}})},[]),fx=y.useCallback(D=>{var me;const Q=xe.selectedThread,he=xe.selectedRepo;if(!Q||!he)return;const ce=(me=Ks[Q.id])==null?void 0:me.find(Pe=>Pe.id===D);ce&&(gy(Q.id,D),(async()=>{const Pe=`jait/${Math.random().toString(16).slice(2,10)}`;let mt;try{mt=(await io.createWorktree(he.localPath,he.defaultBranch,Pe)).path}catch{try{await io.createBranch(he.localPath,Pe,he.defaultBranch)}catch{}}const bt=await Qr.createThread({title:`[${he.name}] Generating title…`,providerId:ce.providerId,runtimeMode:ce.runtimeMode,...ce.model?{model:ce.model}:{},kind:"delivery",workingDirectory:mt??he.localPath,branch:Pe});await Qr.startThread(bt.id,{message:ce.fullContent,titlePrefix:`[${he.name}] `,...ce.displayContent?{displayContent:ce.displayContent}:{},...ce.referencedFiles?{referencedFiles:ce.referencedFiles}:{},...ce.displaySegments?{displaySegments:ce.displaySegments}:{},...ce.attachments?{attachments:ce.attachments}:{}})})())},[xe.selectedThread,xe.selectedRepo,Ks,gy]),VS=y.useCallback(async(D,Q,he)=>{const ce=xe.selectedThread;if(!ce)return;const me=await Bu(e.current,D,he);if(!me)return;const Pe=zk(me.displaySegments,Q);nf(ce.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:Pe,attachments:me.attachments,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()}),i(""),a(void 0)},[xe.selectedThread,Mt,ut,Vt,nf,Bu,i]);y.useEffect(()=>{if(!rt)for(const[D,Q]of Object.entries(Ks)){if(Q.length===0||Wa.current.has(D))continue;const he=xe.threads.find(me=>me.id===D);if(!he){yo(me=>{if(!(D in me))return me;const{[D]:Pe,...mt}=me;return mt});continue}if(he.status==="running")continue;const[ce]=Q;ce&&(Wa.current.add(D),yo(me=>{const Pe=me[D]??[],[,...mt]=Pe;if(mt.length===0){const{[D]:bt,...Wt}=me;return Wt}return{...me,[D]:mt}}),xe.handleSendToThread(D,ce.fullContent,ce.providerId,ce.runtimeMode,ce.model,{displayContent:ce.displayContent??ce.content,referencedFiles:ce.referencedFiles,displaySegments:ce.displaySegments,attachments:ce.attachments}).catch(me=>{yo(Pe=>({...Pe,[D]:[ce,...Pe[D]??[]]})),xe.setError(me instanceof Error?me.message:"Failed to process queued thread message")}).finally(()=>{Wa.current.delete(D)}))}},[rt,xe.handleSendToThread,xe.setError,xe.threads,Ks]);const fg=y.useCallback(async()=>{const D=xe.selectedRepo;if(D)try{await Qr.updateRepo(D.id,{deviceId:""}),await xe.refresh()}catch{xe.setError("Failed to move repository to gateway")}},[xe.selectedRepo,xe.refresh,xe.setError]),pg=async D=>{if(!dt){u(!0);return}let Q=rt;if(!Q){const he=await aa();Q=(he==null?void 0:he.id)??null}if(Q){if(D==="Generate architecture diagram"){Le(!0),vt(!0),Ec("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:dt,sessionId:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)});return}Ec(D,{token:dt,sessionId:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)})}},qS=y.useCallback(async(D,Q,he,ce,me)=>{if(!rt||!dt)return;const Pe=await Bu(Q,me==null?void 0:me.referencedFiles,me==null?void 0:me.displaySegments);Pe&&await hp(D,Pe.promptWithReferences,he,ce,{token:dt,sessionId:rt,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,displayContent:Pe.displayContent,referencedFiles:Pe.referencedFiles,displaySegments:Pe.displaySegments,onLoginRequired:()=>u(!0)})},[rt,hp,dt,Wr,Mt,ut,Vt,Bu]),px=async D=>{if(D.preventDefault(),!wt){h(null),qt(!0);try{await Ym(be,Zt),u(!1),zt(""),g("chat")}catch(Q){h(Q instanceof Error?Q.message:"Login failed")}finally{qt(!1)}}},GS=async D=>{if(D.preventDefault(),!wt){if(h(null),!Te||!Ct){h("Username and password are required");return}if(Ct!==tr){h("Passwords do not match");return}qt(!0);try{await Y0(Te,Ct),u(!1),ur(""),Ir(""),g("chat")}catch(Q){h(Q instanceof Error?Q.message:"Registration failed")}finally{qt(!1)}}},KS=y.useCallback(async D=>{D.preventDefault();const Q=Ia.trim();if(!Q){Ts("Please enter a gateway URL");return}Dn(!0),Ts(null);try{const he=Q.replace(/\/+$/,""),ce=await fetch(`${he}/health`,{signal:AbortSignal.timeout(5e3)});if(!ce.ok)throw new Error(`Server returned ${ce.status}`);const me=Mn();if(bQ(he),he!==me){window.location.reload();return}Wi("auth")}catch(he){Ts(he instanceof Error?he.name==="TimeoutError"||he.name==="AbortError"?"Connection timed out":he.message:"Failed to connect")}finally{Dn(!1)}},[Ia]),mx=()=>{np(),Ha(),g("chat"),u(!0)},mg=y.useCallback(()=>{Ha(),aa()},[Ha,aa]),gx=async D=>{const Q=Object.fromEntries(Object.entries(D).map(([he,ce])=>[he,ce.trim()]).filter(([,he])=>he.length>0));await Lo({api_keys:Q})},yy=async()=>{const D=await jd();return await Uh(),D.removed},YS=async()=>{const D=await Zm();return await Uh(),D},XS=async D=>{const Q=await Vi(D);return Q&&await Uh(),Q},gg=y.useCallback(async()=>{if(rt)try{await fetch(`${Ki}/api/consent/pending/${rt}/approve-all`,{method:"DELETE"}),un(!1)}catch{}},[rt]),ZS=y.useCallback(async D=>{var me;const Q=dde(D);if(!Q)return;if(ir==="manager"||Bt==="thread"){const Pe=xe.selectedThread,mt=Pe?((me=Ks[Pe.id])==null?void 0:me.length)??0:0;if(Pe&&(Pe.status==="running"||mt>0)){nf(Pe.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Q,displayContent:Q,fullContent:Q,referencedFiles:void 0,attachments:void 0,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()});return}await xe.handleSend(Q,Mt,Mt!=="jait"?ut:void 0,Vt??void 0);return}const he=m8(Q);let ce=rt;if(!ce){const Pe=await aa(void 0,he);ce=(Pe==null?void 0:Pe.id)??null}if(!(!ce||!dt)){if(await py(ce,Q),Si||qs.length>0){Bo({content:Q,displayContent:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0});return}Ec(Q,{token:dt,sessionId:ce,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)})}},[rt,xe.handleSend,xe.selectedThread,Wr,Mt,ut,Vt,aa,nf,Bo,py,Si,Ks,qs.length,Ec,Bt,dt,ir]),[zu,yx]=y.useState(!1),[Vd,vy]=y.useState(!1),[sf,vx]=y.useState(()=>g8()),zc=y.useRef(null),yg=y.useRef([]),of=y.useRef(null),Np=y.useRef(g8()),Ep=y.useRef(null),xy=y.useRef(null),vg=y.useRef(null),by=y.useRef(null),xg=y.useRef(null),_y=y.useCallback(()=>{const D=g8();Np.current=D,vx(D)},[]),Fu=y.useCallback(()=>{var Q;xg.current!==null&&(cancelAnimationFrame(xg.current),xg.current=null),(Q=xy.current)==null||Q.disconnect(),xy.current=null,vg.current=null,by.current=null;const D=Ep.current;Ep.current=null,D&&D.state!=="closed"&&D.close().catch(()=>{}),_y()},[_y]),ns=y.useCallback(D=>{Fu();try{const Q=new AudioContext,he=Q.createAnalyser();he.fftSize=256,he.smoothingTimeConstant=.58;const ce=Q.createMediaStreamSource(D);ce.connect(he);const me=new Uint8Array(new ArrayBuffer(he.frequencyBinCount));Ep.current=Q,xy.current=ce,vg.current=he,by.current=me;const Pe=()=>{const mt=vg.current,bt=by.current;if(!mt||!bt)return;mt.getByteTimeDomainData(bt);let Wt=0;for(let yn=0;yn<bt.length;yn++)Wt+=Math.abs((bt[yn]-128)/128);const dr=bt.length>0?Wt/bt.length:0,Ur=Math.pow(Math.min(1,dr*6.8),.78),an=Math.min(1,Math.max(n9,Ur)),ui=(Np.current[Np.current.length-1]??n9)*.2+an*.8,Vr=[...Np.current.slice(-(ude-1)),ui];Np.current=Vr,vx(Vr),xg.current=requestAnimationFrame(Pe)};Pe()}catch(Q){console.warn("Voice visualizer unavailable:",Q),_y()}},[_y,Fu]),Ms=y.useCallback(D=>{const he=D.sampleRate,ce=D.getChannelData(0),me=new ArrayBuffer(44+ce.length*2),Pe=new DataView(me),mt=(Wt,dr)=>{for(let Ur=0;Ur<dr.length;Ur++)Pe.setUint8(Wt+Ur,dr.charCodeAt(Ur))};mt(0,"RIFF"),Pe.setUint32(4,36+ce.length*2,!0),mt(8,"WAVE"),mt(12,"fmt "),Pe.setUint32(16,16,!0),Pe.setUint16(20,1,!0),Pe.setUint16(22,1,!0),Pe.setUint32(24,he,!0),Pe.setUint32(28,he*1*2,!0),Pe.setUint16(32,2,!0),Pe.setUint16(34,16,!0),mt(36,"data"),Pe.setUint32(40,ce.length*2,!0);let bt=44;for(let Wt=0;Wt<ce.length;Wt++){const dr=Math.max(-1,Math.min(1,ce[Wt]));Pe.setInt16(bt,dr<0?dr*32768:dr*32767,!0),bt+=2}return new Blob([me],{type:"audio/wav"})},[]),af=y.useCallback(async()=>{var he,ce;yx(!1),Fu();const D=zc.current;if(!D||D.state==="inactive"){(he=of.current)==null||he.getTracks().forEach(me=>me.stop()),of.current=null,zc.current=null;return}const Q=await new Promise(me=>{D.ondataavailable=Pe=>{Pe.data.size>0&&yg.current.push(Pe.data)},D.onstop=()=>{me(new Blob(yg.current,{type:D.mimeType}))},D.stop()});if((ce=of.current)==null||ce.getTracks().forEach(me=>me.stop()),of.current=null,zc.current=null,Q.size!==0&&(Ui.stt_provider==="wyoming"||Ui.stt_provider==="whisper")){vy(!0);try{const me=await Q.arrayBuffer(),Pe=new AudioContext({sampleRate:16e3}),mt=await Pe.decodeAudioData(me),bt=Ms(mt);await Pe.close();const Wt=await bt.arrayBuffer(),dr=new Uint8Array(Wt);let Ur="";for(let Vr=0;Vr<dr.length;Vr++)Ur+=String.fromCharCode(dr[Vr]);const an=btoa(Ur),ui=await(await fetch(`${Ki}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dt}`},body:JSON.stringify({audioBase64:an,sessionId:rt??"voice-input",provider:Ui.stt_provider})})).json();ui.text?i(Vr=>Wyt(Vr,ui.text??"")):console.warn("Transcription failed:",ui.details??ui.error)}catch(me){console.error("Transcription error:",me)}finally{vy(!1)}}},[rt,Ms,Ui.stt_provider,dt]),lf=y.useCallback(async()=>{if(!dt){u(!0);return}try{const D=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});of.current=D,yg.current=[],ns(D);const Q=new MediaRecorder(D);zc.current=Q,Q.ondataavailable=he=>{he.data.size>0&&yg.current.push(he.data)},Q.start(),yx(!0)}catch(D){Fu(),console.error("Microphone access denied:",D),window.alert("Microphone access is required for push-to-talk.")}},[rt,Ui.stt_provider,ns,Fu,ZS,dt]),[Hu,JS]=y.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Ap=y.useCallback(()=>{JS(D=>{const Q=!D;try{localStorage.setItem("jait:wake-word",String(Q))}catch{}return Q})},[]),xx=y.useCallback(()=>{ii(!0),Ni.connect()},[Ni]),Jl=emt({enabled:Hu&&Es&&!zu&&!Nr,lang:navigator.language,onCommand:()=>{xx()},onWakeWordDetected:()=>{xx()}});y.useEffect(()=>()=>{var D;Fu(),(D=of.current)==null||D.getTracks().forEach(Q=>Q.stop())},[Fu]);const bx=yl==="limit_reached",bg=!Fa&&!Es,wy=ir==="developer"&&p==="chat"&&!bg&&(Fa||jc||!!rt&&(As||Q0||xp||_p||Ru)),_x=ua.length>0||As,Sy=y.useMemo(()=>cde({showWorkspace:$,showTerminal:w,showWorkspaceTree:ae,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,ae]),wx=Nt&&qm&&Sy!==null&&Sy!=="terminal",Sx=Nt&&p==="chat"&&ir==="developer"&&Sy==="terminal",Fc=y.useMemo(()=>({showWorkspace:$,showTerminal:w,showWorkspaceTree:ae,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,ae]),kx=_||li!==null,ky=((t3=(Ty=Po==null?void 0:Po.username)==null?void 0:Ty[0])==null?void 0:t3.toUpperCase())??"?",Cx=y.useCallback(()=>{af()},[af]),jx=y.useCallback(()=>{xe.setFolderPickerOpen(!0)},[xe.setFolderPickerOpen]),Cy=Bt==="thread"?d.jsx(Dq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:jx}):null,Tx=ir==="manager"&&xe.selectedThread,QS=Nt&&p==="chat"?d.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:[!Tx&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:!$&&!w&&!_?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{$&&Dc(),w&&Vn(),_&&k(!1),K(!1)},"aria-label":"Chat",children:d.jsx(um,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Chat"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:kx?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>k(D=>!D),"aria-label":"Workspaces",children:_?d.jsx(mT,{className:"h-5 w-5 rotate-90"}):d.jsx(gT,{className:"h-5 w-5 rotate-90"})})}),d.jsx(xn,{side:"left",children:"Workspaces"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"terminal")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("terminal")},"aria-label":"Terminal",children:d.jsx(Xo,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Terminal"})]})]}),li&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"files")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("files")},"aria-label":"Files",children:d.jsx(ph,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Files"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Sf(Fc,"git")?"secondary":"ghost",size:"sm",className:"relative h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("git")},"aria-label":"Changes",children:[d.jsx(Xg,{className:"h-5 w-5"}),us.length>0&&d.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:us.length>99?"99+":us.length})]})}),d.jsx(xn,{side:"left",children:"Changes"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"editor")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("editor")},"aria-label":"Editor",children:d.jsx(Uk,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Editor"})]})]})]}):null,jy=ir==="developer"?d.jsx("div",{className:`overflow-x-auto ${Nt?"px-0.5":"px-1"}`,children:d.jsxs("div",{className:`grid min-w-max grid-cols-[1fr_auto_1fr] items-center whitespace-nowrap ${Nt?"gap-2":"gap-3"}`,children:[d.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Bt==="thread"?Cy:d.jsx(NXe,{sessions:up,activeSessionId:rt,workspaceTitle:(sn==null?void 0:sn.title)??"Personal chat",onSelectSession:D=>{go(li,D)},onNewSession:()=>{aa()},onOpenChange:DS,showTitle:!1,triggerLabel:"History"}),Cr&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"truncate text-xs text-green-600 dark:text-green-400",children:"Approved all commands for this session"}),d.jsx("button",{type:"button",onClick:gg,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"Clear approve all"})]})]}),d.jsx("div",{className:"justify-self-center",children:d.jsx(MJ,{target:Bt,onChange:jr,disabled:Si})}),d.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[Bt!=="thread"&&d.jsx("button",{type:"button",onClick:mg,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"New chat"}),Vl!==null&&d.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Vl," remaining"]})]})]})}):null,e3=y.useMemo(()=>({onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:Cx,mode:Wr,onModeChange:Ln,provider:Mt,onProviderChange:$c,responseStyle:nn,onResponseStyleChange:Zl,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),[lf,zu,sf,Vd,Cx,Wr,Ln,Mt,$c,nn,Zl,ut,Sp,Vt,ci,ia,jp,$,Od,re==null?void 0:re.nodeId]),Wu=[...ua.slice(-10).map(D=>gV({id:`msg-${D.id}`,source:"chat",title:`Message: ${D.role}`,detail:D.content.slice(0,120)||"(empty message)"})),...Fo.map(D=>gV({id:`term-${D.id}`,source:"terminal",title:"Terminal session",detail:`${D.id} (${D.state})`}))];return Sd?d.jsx(Oft,{detachedTabId:Sd}):uo?d.jsx(Lft,{detachedId:uo}):vs===!1?d.jsx(Dft,{onRetry:()=>{wc.current=!1,yu(null),ho()}}):d.jsx(oX,{children:d.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!bg&&d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:Nt?"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:Hl==="darwin"?70:void 0,paddingRight:Hl==="win32"?140:void 0}:void 0,children:[d.jsxs("div",{className:`flex items-center gap-1 shrink-0 ${Nt?"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:[d.jsx(gae,{size:20,className:"shrink-0"}),Jl.isSupported&&d.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${Nr?"text-green-400 bg-green-500/10":Hu?Jl.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:Nr?()=>{Ni.disconnect(),ii(!1)}:Ap,"aria-label":Nr?"Disconnect voice":Hu?"Disable wake word":"Enable wake word",children:Nr?d.jsx(o1,{className:"h-4 w-4 animate-pulse"}):Hu?d.jsx(o1,{className:`h-4 w-4 ${Jl.isListening?"animate-pulse":""}`}):d.jsx(qk,{className:"h-4 w-4"})})]}),d.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:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(um,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Chat"})]})}),d.jsx(xn,{side:"bottom",children:"Chat"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(p_,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Jobs"})]})}),d.jsx(xn,{side:"bottom",children:"Jobs"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(S1,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Network"})]})}),d.jsx(xn,{side:"bottom",children:"Network"})]}),ir==="developer"&&!Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:fe?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>fe?ug():oy(),"aria-label":"Screen sharing",children:[d.jsx(Ig,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Screen Share"})]})}),d.jsx(xn,{side:"bottom",children:"Screen sharing"})]})]}),Nr?d.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 ${Nt?"pointer-events-auto":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[d.jsx("button",{onClick:Ni.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${Ni.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":Ni.micActive?"Mute":"Unmute",children:Ni.micActive?d.jsx(o1,{className:"h-3.5 w-3.5"}):d.jsx(qk,{className:"h-3.5 w-3.5"})}),d.jsx(Lyt,{state:Ni.assistantSpeaking?"speaking":Ni.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),d.jsx("button",{onClick:()=>{Ni.disconnect(),ii(!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:d.jsx(aye,{className:"h-3.5 w-3.5"})})]}):p==="chat"?d.jsx("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 ${Nt?"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:d.jsx(Zpt,{mode:ir,onChange:Oo,compact:Nt})}):null,d.jsx("div",{className:"flex-1 min-w-0"}),d.jsxs("div",{className:`flex items-center gap-1 sm:gap-1.5 shrink-0 ${Nt?"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:[p==="chat"&&Ho.length>0&&d.jsx(r1t,{threads:Ho,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),jr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)}),d.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[ng.isActive&&d.jsxs("span",{className:"ui-pill shrink-0",children:[d.jsx(Ig,{className:"h-3 w-3 text-green-500 animate-pulse"}),d.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Jl.isSupported&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs("button",{onClick:Nr?()=>{Ni.disconnect(),ii(!1)}:Ap,className:`ui-pill shrink-0 cursor-pointer transition-colors ${Nr?"text-green-400 animate-pulse":Hu?Jl.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[Nr?d.jsx(o1,{className:"h-3 w-3 animate-pulse"}):Hu?d.jsx(o1,{className:`h-3 w-3 ${Jl.isListening?"animate-pulse":""}`}):d.jsx(qk,{className:"h-3 w-3"}),d.jsx("span",{className:"hidden sm:inline text-xs",children:Nr?"Voice active":Jl.isListening?"Listening...":Hu?"Hey Jait":"Wake word"})]})}),d.jsx(xn,{side:"bottom",children:Nr?"Voice assistant active — click to disconnect":Hu?Jl.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),d.jsx(UXe,{usage:qh}),(()=>{const D=Vt??rg,Q=Mt==="codex"?"openai":Mt==="claude-code"?"anthropic":tg??"ollama",he=Mt==="codex"?Vt??"Codex":Mt==="claude-code"?Vt??"Claude Code":D?Ltt(D):null,ce=Mt==="codex"?`OpenAI Codex CLI${Vt?` · ${Vt}`:""}`:Mt==="claude-code"?`Anthropic Claude Code CLI${Vt?` · ${Vt}`:""}`:D??"";return he?d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[d.jsx(X5,{provider:Q,model:Mt==="codex"?"codex":Mt==="claude-code"?"claude-3":D??void 0,size:16}),d.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:he})]})}),d.jsx(xn,{side:"bottom",children:ce})]}):null})(),Vl!==null&&Vl<=5&&d.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[Vl," remaining"]})]}),(Un==null?void 0:Un.hasUpdate)&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{onClick:async()=>{if(Hi==="web")!mi&&!ra&&await Cc();else if(Hi==="electron"){const D=window.jaitDesktop;pi.info("Downloading update...");const Q=await D.downloadUpdate();Q!=null&&Q.ok?(pi.success("Update downloaded. Restarting..."),await D.installUpdate()):pi.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",disabled:Hi==="web"&&(mi||ra),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:[Hi==="web"&&(mi||ra)?d.jsx(rr,{className:"h-3.5 w-3.5 animate-spin"}):d.jsx(qG,{className:"h-3.5 w-3.5"}),d.jsx("span",{className:"hidden sm:inline",children:Hi==="web"&&(mi||ra)?"Updating...":`v${Un.latestVersion}`})]})}),d.jsx(xn,{side:"bottom",children:Hi==="web"&&(mi||ra)?"Updating and refreshing...":`Update available — v${Un.latestVersion}`})]}),Nt?d.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.jsx(ke,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0 rounded-lg",children:d.jsx(MC,{className:"h-4 w-4"})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:"Navigate"}),d.jsxs(Fi,{onSelect:()=>g("chat"),children:[d.jsx(um,{className:"h-4 w-4 mr-2"}),"Chat"]}),d.jsxs(Fi,{onSelect:()=>g("jobs"),children:[d.jsx(p_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),d.jsxs(Fi,{onSelect:()=>g("network"),children:[d.jsx(S1,{className:"h-4 w-4 mr-2"}),"Network"]}),ir==="developer"&&d.jsxs(Fi,{onSelect:()=>fe?ug():oy(),children:[d.jsx(Ig,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]}),Es?d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.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:d.jsx(C8,{className:"h-8 w-8",children:d.jsx(j8,{className:"text-sm font-medium",children:ky})})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:Po==null?void 0:Po.username}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]}),d.jsx(Zu,{}),d.jsxs("div",{className:"px-2 py-1.5",children:[d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),d.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nD],["system",Aa],["dark",Q$]].map(([D,Q])=>d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx("button",{onClick:()=>{dy(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:d.jsx(Q,{className:"h-3.5 w-3.5"})})}),d.jsx(xn,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:mx,children:[d.jsx(J$,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):d.jsx(ke,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>u(!0),children:"Sign in"})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"md:hidden shrink-0",children:d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.jsx(ke,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:d.jsx(MC,{className:"h-4 w-4"})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:"Navigate"}),d.jsxs(Fi,{onSelect:()=>g("chat"),children:[d.jsx(um,{className:"h-4 w-4 mr-2"}),"Chat"]}),d.jsxs(Fi,{onSelect:()=>g("jobs"),children:[d.jsx(p_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),d.jsxs(Fi,{onSelect:()=>g("network"),children:[d.jsx(S1,{className:"h-4 w-4 mr-2"}),"Network"]}),ir==="developer"&&d.jsxs(Fi,{onSelect:()=>fe?ug():oy(),children:[d.jsx(Ig,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),Es?d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.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:d.jsx(C8,{className:"h-7 w-7",children:d.jsx(j8,{className:"text-xs",children:ky})})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:Po==null?void 0:Po.username}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]}),d.jsx(Zu,{}),d.jsxs("div",{className:"px-2 py-1.5",children:[d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),d.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nD],["system",Aa],["dark",Q$]].map(([D,Q])=>d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx("button",{onClick:()=>{dy(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:d.jsx(Q,{className:"h-3.5 w-3.5"})})}),d.jsx(xn,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:mx,children:[d.jsx(J$,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):d.jsx(ke,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>u(!0),children:"Sign in"})]}),Lt&&Hl==="linux"&&d.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[d.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:d.jsx(Gk,{className:"h-4 w-4"})}),d.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:Fs?d.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:d.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):d.jsx(U1,{className:"h-3 w-3"})}),d.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:d.jsx(ti,{className:"h-4 w-4"})})]})]})]}),p==="chat"&&d.jsxs("div",{className:`border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${Nt&&!Gh?"hidden":"flex"} ${Gh?"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:[ir==="developer"&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:_?"secondary":"ghost",size:"sm",className:Nt?"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:[_?d.jsx(mT,{className:`h-3 w-3${Nt?" rotate-90":" mr-1"}`}):d.jsx(gT,{className:`h-3 w-3${Nt?" rotate-90":" mr-1"}`}),!Nt&&"Workspaces"]})}),d.jsx(xn,{side:"bottom",children:"Toggle workspaces sidebar"})]}),ir==="developer"&&!Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:w?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{FS()},children:[d.jsx(Xo,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),d.jsx(xn,{side:"bottom",children:"Toggle terminal panel"})]}),ir==="developer"&&Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 shrink-0 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Du("terminal")},children:d.jsx(Xo,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Terminal"})]}),ir==="manager"&&xe.selectedThread&&!Nt&&d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:[d.jsx(K$,{className:"h-3 w-3 mr-1"}),"Back"]}),li&&(ir==="developer"||ir==="manager"&&xe.selectedThread)&&!(Nt&&ir==="manager")&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:`flex items-center shrink-0 ${Nt?"gap-1":""}`,children:Nt?d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Du("files")},children:d.jsx(ph,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Files"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Sf(Fc,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Du("git")},children:[d.jsx(Xg,{className:"h-4 w-4"}),us.length>0&&d.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:us.length>99?"99+":us.length})]})}),d.jsx(xn,{side:"bottom",children:"Changes"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Du("editor")},children:d.jsx(Uk,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Editor"})]})]}):d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:$?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{uy()},children:[d.jsx(Uk,{className:"h-3 w-3 mr-1"}),"Editor",$&&d.jsx(ti,{className:"h-3 w-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:$?"Hide editor":"Show editor"})]})}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Hd?"secondary":"ghost",size:"sm",className:Nt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":Hd?"Close preview":"Open preview",onClick:()=>{var D;if(Hd)f6();else{const Q=ne.target??(V==null?void 0:V.trim())??((D=Xh==null?void 0:Xh.target)==null?void 0:D.trim())??null;if(za(Q,(re==null?void 0:re.workspaceRoot)??null))return;cy()}},children:[d.jsx(Ci,{className:`h-3 w-3${Nt?"":" mr-1"}`}),!Nt&&"Preview",!Nt&&Hd&&d.jsx(ti,{className:"h-3 wer-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:Hd?"Close preview":"Open dev preview"})]})]}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:St?"secondary":"ghost",size:"sm",className:Nt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":St?"Close architecture":"Open architecture",onClick:()=>{var D;St?((D=cs.current)==null||D.closeArchitectureTab(),Be(null),vt(!1)):(vt(!0),Cd())},children:[d.jsx(RC,{className:`h-3 w-3${Nt?"":" mr-1"}`}),!Nt&&"Architecture",!Nt&&St&&d.jsx(ti,{className:"h-3 w-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:"Software architecture diagram"})]}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:we?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Ke(D=>!D),children:d.jsx(VG,{className:"h-3 w-3"})})}),d.jsx(xn,{side:"bottom",children:"SSE debug stream"})]}),ir==="manager"&&d.jsxs(d.Fragment,{children:[xe.selectedThread?null:d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:j?"secondary":"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>T(D=>!D),children:[j?d.jsx(mT,{className:`h-3 w-3 mr-1${Nt?" rotate-90":""}`}):d.jsx(gT,{className:`h-3 w-3 mr-1${Nt?" rotate-90":""}`}),"Repositories"]})}),d.jsx(xn,{side:"bottom",children:"Toggle repositories panel"})]}),xe.selectedRepo&&xe.selectedRepo.source==="local"&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>E(xe.selectedRepo),children:[d.jsx(tK,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),d.jsx(xn,{side:"bottom",children:"Open repository strategy"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>P(xe.selectedRepo),children:[d.jsx(QG,{className:"h-3 w-3 mr-1"}),"Todos"]})}),d.jsx(xn,{side:"bottom",children:"Open todo plan"})]})]})]}),!(Nt&&xe.selectedThread)&&d.jsx("div",{className:"flex-1"}),xe.selectedThread?d.jsxs("div",{className:Nt?"flex min-w-0 flex-1 items-center gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[Nt&&d.jsx(ke,{variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:d.jsx(K$,{className:"h-3.5 w-3.5"})}),d.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[d.jsx(KP,{status:xe.selectedThread.status}),Nt?d.jsxs("div",{className:"min-w-0 flex-1",children:[k4(xe.selectedThread.title)?d.jsx(i9,{className:"text-xs h-3.5 w-28"}):d.jsx("span",{className:"block truncate text-2xs leading-tight text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),d.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&&d.jsxs("span",{className:"min-w-0 truncate",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]}),d.jsx(s9,{kind:xe.selectedThread.kind}),xe.selectedThread.branch&&d.jsx("span",{className:"shrink min-w-0 truncate font-mono",children:xe.selectedThread.branch})]})]}):d.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[k4(xe.selectedThread.title)?d.jsx(i9,{className:"text-xs h-3.5 w-28"}):d.jsx("span",{className:"max-w-[200px] truncate text-2xs text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),d.jsx(s9,{kind:xe.selectedThread.kind}),xe.selectedRepo&&d.jsxs("span",{className:"max-w-[160px] truncate text-2xs text-muted-foreground",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]})]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[d.jsx(Hrt,{token:dt,threadId:xe.selectedThread.id,selectedSkillIds:xe.selectedThread.skillIds}),!Nt&&xe.selectedThread.branch&&d.jsx(tn,{variant:"outline",className:"text-2xs px-1 py-0 font-mono",children:xe.selectedThread.branch}),GP(xe.selectedThread)&&d.jsx(ke,{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:d.jsx(U1,{className:"h-2.5 w-2.5"})}),xe.showGitActions&&xe.selectedRepo&&d.jsx("div",{className:Nt?"shrink-0":"ml-2 shrink-0",children:d.jsx(eP,{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:!Nt})})]})]}):null]})]}),p==="jobs"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(Art,{})}):p==="network"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(vft,{token:dt,sessionId:rt??"default"})}):p==="settings"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(aot,{username:(Po==null?void 0:Po.username)??"",token:dt,apiKeys:Ui.api_keys,onSaveApiKeys:gx,sttProvider:Ui.stt_provider,onSttProviderChange:async D=>{await Lo({stt_provider:D})},jaitBackend:Ui.jait_backend??"openai",onJaitBackendChange:async D=>{await Lo({jait_backend:D})},onClearArchive:yy,onClearArchivedWorkspaces:YS,onFetchArchivedWorkspaces:Wh,onRestoreWorkspace:XS,activityEvents:Wu,updateInfo:Un,updateChecking:Sc,onCheckUpdate:()=>{Td()},onApplyUpdate:()=>{Cc()},updateApplying:mi,platform:Hi})}):d.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${Nt?"flex-col relative":""}`,children:[d.jsxs("div",{className:Nt?"contents":`relative flex min-h-0 ${z?"flex-1 min-w-0":"shrink-0"}`,children:[ir==="developer"&&_&&Nt&&d.jsx("div",{className:"fixed inset-0 z-20",onClick:()=>k(!1)}),ir==="developer"&&_&&d.jsx("aside",{ref:H,tabIndex:-1,onBlur:ny,className:`overflow-hidden outline-none ${Nt?"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:d.jsx(jXe,{workspaces:mo,personalSessions:Pr,activeWorkspaceId:li,activeSessionId:rt,loading:jc,hasMoreWorkspaces:X0,showFewerWorkspaces:mo.length>Z0,onSelectWorkspace:ix,onSelectPersonalSession:D=>{Nt&&k(!1),go(null,D)},onNewPersonalSession:()=>{Nt&&k(!1),aa(null)},onCreateWorkspace:$S,onRemoveWorkspace:D=>{Ed(D)},onChangeDirectory:Qm,onShowMore:op,onShowFewer:ap,sessionInfo:Od,nodes:U0})}),(ir==="developer"&&p==="chat"&&!Nt&&(Ws||w)||ir==="manager"&&xe.selectedThread&&Ws)&&d.jsxs("div",{className:`relative flex min-h-0 flex-col ${!Ws&&w||z?"flex-1 min-w-0":"shrink-0"}`,style:!Ws&&w?{width:Et,maxWidth:"70vw"}:void 0,children:[!Ws&&w&&d.jsx("div",{onMouseDown:p6,className:"absolute inset-y-0 right-0 w-1.5 cursor-col-resize hover:bg-primary/30 transition-colors z-10"}),(ir==="developer"||ir==="manager"&&xe.selectedThread)&&Ws&&d.jsx("div",{className:"flex min-h-0 flex-1",children:d.jsx(JF,{ref:cs,autoOpenRemotePath:(re==null?void 0:re.workspaceRoot)??null,surfaceId:(re==null?void 0:re.surfaceId)??null,files:Ns,activeFileId:Pt,onActiveFileChange:bs,onFileDrop:D=>{dx(D)},onReferenceFile:ax,onReferenceSelection:lx,onReferencePreviewElement:zS,onAvailableFilesChange:kc,showTree:ae,showEditor:le,onToggleTree:Cp,onToggleEditor:dg,changedPaths:sx,fsWatcherVersion:Bh,sourceControlRefreshSignal:bl,savedTabsState:Pu,stateReady:wp,previewRequest:q,onTabsStateChange:Lu,onPreviewOpenChange:ay,previewSessionId:rt,previewToken:dt,previewWorkspaceRoot:(re==null?void 0:re.workspaceRoot)??null,previewInitialTarget:V,architectureDiagram:Rt,architectureGenerating:Ee,architectureRequest:je,onArchitectureOpenChange:vt,onArchitectureRenderResult:nx,onGenerateArchitecture:()=>{Le(!0),pg("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:HS,provider:Mt,cliModel:Vt,onCollapsedChange:Y,onMaxCollapsedChange:L,restoreRef:B})}),ir==="developer"&&w&&!Nt&&p==="chat"&&d.jsxs("div",{className:`flex min-h-0 flex-col bg-background ${It?"absolute inset-0 z-20 border-r":`relative border-r border-t ${Ws?"shrink-0":"flex-1"}`}`,style:It||!Ws?void 0:{height:st},children:[!It&&d.jsx("div",{onMouseDown:IS,className:"absolute inset-x-0 top-0 h-1.5 cursor-row-resize hover:bg-primary/30 transition-colors z-10"}),d.jsxs("div",{className:"relative shrink-0",children:[d.jsx(dV,{terminals:Wd,activeTerminalId:ni,onSelect:es,onCreate:D=>Rn(rt??"default",rs??void 0,D),onKill:tf,onDetach:ux,availableShells:Ua}),d.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:[Ws&&d.jsx("button",{onClick:()=>{It?(Xe(!1),ot(Qe.current)):(Qe.current=st,Xe(!0))},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":It?"Exit fullscreen":"Fullscreen terminal",children:It?d.jsx(y9,{className:"h-4 w-4"}):d.jsx(g9,{className:"h-4 w-4"})}),d.jsx("button",{onClick:()=>{ni&&ux(ni)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Open terminal in new window",children:d.jsx(wm,{className:"h-4 w-4"})}),d.jsx("button",{onClick:Vn,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:d.jsx(ti,{className:"h-4 w-4"})})]})]}),ni?d.jsx(d4,{ref:pp,terminalId:ni,className:"flex-1 min-h-0",token:dt,workspaceRoot:rs??void 0,onReferenceSelection:cx}):d.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:d.jsx("button",{onClick:()=>Rn(rt??"default",rs??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),Sx&&d.jsxs("section",{className:"flex flex-1 min-h-0 flex-col overflow-hidden border-b bg-background pt-16",children:[d.jsxs("div",{className:"relative shrink-0 border-b",children:[d.jsx(dV,{terminals:Wd,activeTerminalId:ni,onSelect:es,onCreate:D=>Rn(rt??"default",rs??void 0,D),onKill:tf,availableShells:Ua}),d.jsx("button",{onClick:Vn,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:d.jsx(ti,{className:"h-4 w-4"})})]}),ni?d.jsx(d4,{ref:pp,terminalId:ni,className:"flex-1 min-h-0",token:dt,workspaceRoot:rs??void 0,onReferenceSelection:cx}):d.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:d.jsx("button",{onClick:()=>Rn(rt??"default",rs??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(ir==="developer"||ir==="manager"&&xe.selectedThread)&&wx&&d.jsx("section",{className:`flex-1 min-h-0 overflow-hidden border-b bg-background ${ir==="manager"?"":"pt-16"}`,children:d.jsx(JF,{ref:cs,autoOpenRemotePath:(re==null?void 0:re.workspaceRoot)??null,surfaceId:(re==null?void 0:re.surfaceId)??null,files:Ns,activeFileId:Pt,onActiveFileChange:bs,onFileDrop:D=>{dx(D)},onReferenceFile:ax,onReferenceSelection:lx,onReferencePreviewElement:zS,onAvailableFilesChange:kc,showTree:ae,showEditor:le,onToggleTree:Cp,onToggleEditor:dg,treeTab:Ze,onTreeTabChange:De,changedPaths:sx,sourceControlRefreshSignal:bl,isMobile:!0,savedTabsState:Pu,stateReady:wp,previewRequest:q,onTabsStateChange:Lu,onPreviewOpenChange:ay,previewSessionId:rt,previewToken:dt,previewWorkspaceRoot:(re==null?void 0:re.workspaceRoot)??null,previewInitialTarget:V,architectureDiagram:Rt,architectureGenerating:Ee,architectureRequest:je,onArchitectureOpenChange:vt,onArchitectureRenderResult:nx,onGenerateArchitecture:()=>{Le(!0),pg("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:HS,provider:Mt,cliModel:Vt})}),!wx&&!Sx&&(ir==="manager"?d.jsx("div",{className:`flex-1 min-w-0 flex flex-col min-h-0 ${Nt&&!xe.selectedThread?"pt-12":""}`,children:xe.selectedThread?d.jsxs(d.Fragment,{children:[d.jsxs(NT,{className:"min-h-0 flex-1 border-b",loading:xe.loadingActivities,loadingLabel:"Loading activity",messageContents:In.map(D=>D.content),children:[In.length===0&&!xe.loadingActivities&&d.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),In.map((D,Q)=>{var he,ce;return d.jsx(CO,{messageId:D.id,messageIndex:Q,messageFromEnd:In.length-1-Q,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"&&Q===In.length-1,compact:!0,preferLlmUi:!1,provider:(ce=xe.selectedThread)==null?void 0:ce.providerId,onOpenPath:fy,onOpenDiff:hy},D.id)})]},((Nx=xe.selectedThread)==null?void 0:Nx.id)??"manager-empty"),d.jsx("div",{className:"shrink-0 py-3 px-4",children:d.jsxs("div",{className:"mx-auto max-w-3xl",children:[xe.error&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),Pd.length>0&&xe.selectedThread&&d.jsx(dH,{items:Pd,onRemove:D=>gy(xe.selectedThread.id,D),onEdit:(D,Q)=>US(xe.selectedThread.id,D,Q),onReorder:(D,Q,he)=>m6(xe.selectedThread.id,D,Q,he),onSendToParallelThread:fx,className:"mb-2"}),xe.selectedThreadTodos.length>0&&d.jsx(uH,{items:xe.selectedThreadTodos,className:"mb-2"}),d.jsx(Ub,{ref:po,draftStateKey:`manager:${((Hc=xe.selectedThread)==null?void 0:Hc.id)??"new-thread"}`,value:e.current,syncKey:r,onChange:s,onSubmit:Tp,onQueue:VS,onStop:()=>{xe.selectedThread&&xe.handleStop(xe.selectedThread.id)},isLoading:((Ny=xe.selectedThread)==null?void 0:Ny.status)==="running",disabled:xe.creating,placeholder:(Ex=xe.selectedThread)!=null&&Ex.providerSessionId||((_g=xe.selectedThread)==null?void 0:_g.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},responseStyle:nn,onResponseStyleChange:Zl,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Md,onMoveToGateway:fg,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$}),d.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Md&&d.jsx(C4,{runtime:Md}),xe.selectedThread&&xe.selectedThread.status!=="running"&&!xe.selectedThread.providerSessionId&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):d.jsxs("div",{className:`flex flex-1 min-h-0 ${Nt?"flex-col":""}`,children:[j&&d.jsx("div",{className:`overflow-hidden ${Nt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:d.jsx(Jyt,{repositories:xe.repositories,selectedRepoId:((Op=xe.selectedRepo)==null?void 0:Op.id)??null,isMobile:Nt,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0),onRemoveRepository:D=>{xe.removeRepository(D)},onOpenStrategy:D=>E(D),onOpenPlan:D=>P(D)})}),d.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-y-auto ${Nt?"pt-12":""}`,children:[d.jsx("div",{className:"relative z-10 flex flex-col items-center px-3 pb-1.5 pt-3 sm:px-4 sm:pb-2 sm:pt-4",children:d.jsxs("div",{className:"w-full max-w-3xl",children:[d.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&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),d.jsx(Ub,{ref:po,draftStateKey:`manager:${((gi=xe.selectedRepo)==null?void 0:gi.id)??"repo-draft"}`,value:e.current,syncKey:r,onChange:s,onSubmit:Tp,disabled:mp,controlsDisabled:xe.creating||ql,placeholder:Eu,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},responseStyle:nn,onResponseStyleChange:Zl,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Rs,onMoveToGateway:fg}),d.jsx("div",{className:"overflow-x-auto px-1 pt-1",children:d.jsxs("div",{className:"flex min-w-max items-center gap-2 whitespace-nowrap",children:[d.jsx(Dq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0)}),Rs&&d.jsx(C4,{runtime:Rs})]})})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[d.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("span",{className:"text-sm font-medium",children:"Threads"}),d.jsx(tn,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-2xs",children:Yr.length})]}),d.jsx(ke,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void xe.refresh(),children:d.jsx(ja,{className:`h-3.5 w-3.5 ${xe.loading?"animate-spin":""}`})})]}),Yr.length===0?d.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):d.jsxs("div",{className:"flex flex-col",children:[Yr.map(D=>{const Q=xe.getRepositoryForThread(D),he=(Q==null?void 0:Q.name)??d6(D)??"Unknown repo",ce=hde(D,D.id in xe.threadPrStates?xe.threadPrStates[D.id]:void 0);return d.jsx(t1t,{thread:D,repo:Q,repoName:he,prState:ce,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&&d.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?d.jsx(rr,{className:"h-3 w-3 animate-spin"}):null,"Show more threads"]}),Yr.length>xe.threadListLimit&&d.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"})]})]})})]})]})}):wy?d.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&&d.jsx(NT,{className:"min-h-0 flex-1 border-b",compact:Ws,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},rt??"developer-loading")}):_x?d.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&&d.jsxs(d.Fragment,{children:[d.jsxs(NT,{className:"min-h-0 flex-1 border-b",compact:Ws,loading:As,loadingLabel:"Loading chat",messageContents:eg,children:[ua.map((D,Q)=>d.jsx(CO,{messageId:D.id,messageIndex:Q,messageFromEnd:ua.length-1-Q,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:Si&&D===ua[ua.length-1],compact:$||fe||Hd,preferLlmUi:!0,provider:Mt,onOpenTerminal:BS,onEditMessage:qS,editComposer:e3,onOpenPath:fy,onOpenDiff:hy},D.id)),qs.length>0&&d.jsx(dH,{items:qs,onRemove:ku,onEdit:Rd,onReorder:Oc})]},rt??"developer-empty"),d.jsx("div",{className:`shrink-0 ${Nt?"px-2 py-2":`py-3 ${Ws?"px-3":"px-4"}`}`,children:d.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[Nc.length>0&&d.jsx(uH,{items:Nc}),yl&&yl!=="login_required"&&yl!=="limit_reached"&&!Si&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:yl})]}),vl&&!Si&&d.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[d.jsxs("button",{onClick:()=>Io({token:dt,sessionId:rt}),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:[d.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:d.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),d.jsx("span",{className:"text-xs text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),d.jsx(ZXe,{compact:!0,sessionId:rt,onApproveAllEnabled:()=>un(!0)}),dp&&d.jsx(LXe,{plan:dp,onApprove:Ac,onReject:fp,isExecuting:Si}),bx&&d.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),us.length>0&&d.jsx(zXe,{files:us,onAccept:Cu,onReject:ju,onAcceptAll:J0,onRejectAll:Gs,onFileClick:hy}),d.jsx(Ub,{ref:po,draftStateKey:`developer:${rt??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:Tp,onStop:ig,onQueue:hx,isLoading:Si,disabled:bx,placeholder:Kh,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},mode:Wr,onModeChange:Ln,responseStyle:nn,onResponseStyleChange:Zl,sendTarget:Bt,onSendTargetChange:jr,showSendTargetSelector:!1,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Bt==="thread"?Rs:null,onMoveToGateway:Bt==="thread"?fg:void 0,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,workspaceName:ox,workspacePath:rs,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),jy]})})]})}):d.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${z?"":"px-4"} ${Nt?"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:[" ",d.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[d.jsxs("div",{className:"text-center",children:[d.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),d.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!jc&&mo.length===0?d.jsxs("div",{className:"text-center space-y-3",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),d.jsxs(ke,{variant:"default",size:"lg",onClick:()=>{_u("workspace"),xu(!0)},children:[d.jsx(ph,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):d.jsx(EXe,{suggestions:$&&re?Yyt:Kyt,onSelect:pg}),d.jsx(Ub,{ref:po,draftStateKey:`developer:${rt??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:Tp,onStop:ig,onQueue:hx,isLoading:Si,placeholder:Kh,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},mode:Wr,onModeChange:Ln,responseStyle:nn,onResponseStyleChange:Zl,sendTarget:Bt,onSendTargetChange:jr,showSendTargetSelector:!1,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Bt==="thread"?Rs:null,onMoveToGateway:Bt==="thread"?fg:void 0,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,workspaceName:ox,workspacePath:rs,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),jy]})]}))]}),ir==="developer"&&we&&d.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:d.jsx(rZe,{onClose:()=>Ke(!1)})}),Nt&&(ir==="developer"||ir==="manager"&&xe.selectedThread)&&p==="chat"&&d.jsxs(d.Fragment,{children:[I&&d.jsx("div",{className:"fixed inset-0 z-[39]",onClick:()=>K(!1),"aria-hidden":"true"}),d.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:[d.jsx("div",{className:`transition-all duration-200 ${I?"translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"}`,children:QS}),d.jsx(ke,{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:()=>K(D=>!D),"aria-expanded":I,"aria-label":I?"Hide mobile toolbar":"Show mobile toolbar",title:I?"Hide mobile toolbar":"Show mobile toolbar",children:I?d.jsx(No,{className:"h-4 w-4"}):d.jsx(h9,{className:"h-4 w-4"})})]})]})]}),bg&&Lt&&d.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),bg&&d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:d.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Mo==="url"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[d.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[d.jsx(ro,{className:"h-5 w-5"}),"Connect to Gateway"]}),d.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),d.jsxs("form",{onSubmit:KS,className:"space-y-4 pt-2",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),d.jsx(Bn,{id:"gateway-url",placeholder:"https://jait.example.com",value:Ia,onChange:D=>{as(D.target.value),Ts(null)},autoFocus:!0})]}),Hs&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[d.jsx(wh,{className:"h-4 w-4 shrink-0"}),Hs]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:vu,children:vu?d.jsxs(d.Fragment,{children:[d.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[d.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:co===!1?"Welcome to Jait":"Account"}),d.jsx("div",{className:"text-sm text-muted-foreground",children:Li?d.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[d.jsx(ro,{className:"h-3 w-3 text-green-500"}),d.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Ki}),d.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Wi("url"),children:"Change"})]}):co===!1?d.jsx("p",{children:"Create your account to get started."}):d.jsx("p",{children:"Sign in with a username and password."})})]}),d.jsxs(q1,{value:Qt,onValueChange:D=>Kr(D),children:[d.jsxs(a0,{className:"grid grid-cols-2 w-full",children:[d.jsx(Zo,{value:"login",children:"Login"}),d.jsx(Zo,{value:"register",children:"Register"})]}),d.jsx(Jo,{value:"login",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:px,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-username",children:"Username"}),d.jsx(Bn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"login-password",type:Jt?"text":"password",value:Zt,onChange:D=>zt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>fn(!Jt),tabIndex:-1,children:Jt?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Signing in…":"Login"})]})}),d.jsx(Jo,{value:"register",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:GS,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-username",children:"Username"}),d.jsx(Bn,{id:"register-username",value:Te,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password",type:Me?"text":"password",value:Ct,onChange:D=>ur(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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(!Me),tabIndex:-1,children:Me?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password-confirm",type:zs?"text":"password",value:tr,onChange:D=>Ir(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>_c(!zs),tabIndex:-1,children:zs?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Creating account…":co===!1?"Get Started":"Create account"})]})})]}),c&&d.jsx("p",{className:"text-sm text-destructive",children:c})]})})}),d.jsx(Yf,{open:l&&!bg,onOpenChange:D=>{u(D)},children:d.jsx(Oh,{className:"sm:max-w-md",children:Mo==="url"?d.jsxs(d.Fragment,{children:[d.jsxs(Sh,{children:[d.jsxs(kh,{className:"flex items-center gap-2",children:[d.jsx(ro,{className:"h-5 w-5"}),"Connect to Gateway"]}),d.jsx(s0,{children:"Enter your Jait gateway URL to get started."})]}),d.jsxs("form",{onSubmit:KS,className:"space-y-4 pt-2",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),d.jsx(Bn,{id:"gateway-url",placeholder:"https://jait.example.com",value:Ia,onChange:D=>{as(D.target.value),Ts(null)},autoFocus:!0})]}),Hs&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[d.jsx(wh,{className:"h-4 w-4 shrink-0"}),Hs]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:vu,children:vu?d.jsxs(d.Fragment,{children:[d.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs(Sh,{children:[d.jsx(kh,{children:co===!1?"Welcome to Jait":"Account"}),d.jsx(s0,{asChild:!0,children:Li?d.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[d.jsx(ro,{className:"h-3 w-3 text-green-500"}),d.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Ki}),d.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Wi("url"),children:"Change"})]}):co===!1?d.jsx("p",{children:"Create your account to get started."}):d.jsx("p",{children:"Sign in with a username and password."})})]}),d.jsxs(q1,{value:Qt,onValueChange:D=>Kr(D),children:[d.jsxs(a0,{className:"grid grid-cols-2 w-full",children:[d.jsx(Zo,{value:"login",children:"Login"}),d.jsx(Zo,{value:"register",children:"Register"})]}),d.jsx(Jo,{value:"login",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:px,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-username",children:"Username"}),d.jsx(Bn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"login-password",type:Jt?"text":"password",value:Zt,onChange:D=>zt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>fn(!Jt),tabIndex:-1,children:Jt?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Signing in…":"Login"})]})}),d.jsx(Jo,{value:"register",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:GS,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-username",children:"Username"}),d.jsx(Bn,{id:"register-username",value:Te,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password",type:Me?"text":"password",value:Ct,onChange:D=>ur(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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(!Me),tabIndex:-1,children:Me?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password-confirm",type:zs?"text":"password",value:tr,onChange:D=>Ir(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>_c(!zs),tabIndex:-1,children:zs?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Creating account…":co===!1?"Get Started":"Create account"})]})})]}),c&&d.jsx("p",{className:"text-sm text-destructive",children:c})]})})}),d.jsx(mV,{open:Vm,onOpenChange:D=>{xu(D),D||ml(null)},initialPath:Ui.workspace_picker_path,initialNodeId:Ui.workspace_picker_node_id,onSelect:(D,Q)=>{hg(D,Q).catch(he=>{console.error("Failed to select workspace:",he),pi.error(`Failed to select workspace: ${he instanceof Error?he.message:"Unknown error"}`)})}}),d.jsx(mV,{open:xe.folderPickerOpen,onOpenChange:xe.setFolderPickerOpen,onSelect:(D,Q)=>{xe.handleFolderSelected(D,Q)}}),d.jsx(Fyt,{token:dt,sessionId:rt}),A&&d.jsx(Wrt,{open:!!A,onOpenChange:D=>{D||E(null)},repoId:A.id,repoName:A.name}),R&&d.jsx(qrt,{open:!!R,onOpenChange:D=>{D||P(null)},repoId:R.id,repoName:R.name,defaultBranch:R.defaultBranch,repoLocalPath:R.localPath,provider:Mt,model:Vt,onStartThread:(D,Q,he)=>{(async()=>{const ce=R,me=`jait/${Math.random().toString(16).slice(2,10)}`;let Pe;try{Pe=(await io.createWorktree(ce.localPath,ce.defaultBranch,me)).path}catch{try{await io.createBranch(ce.localPath,me,ce.defaultBranch)}catch{}}const mt=await Qr.createThread({title:`[${ce.name}] ${D.title}`,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,kind:"delivery",workingDirectory:Pe??ce.localPath,branch:me});await Qr.startThread(mt.id,{message:D.description||D.title,titleTask:D.title,titlePrefix:`[${ce.name}] `});const bt=Q.tasks.map(Wt=>Wt.id===D.id?{...Wt,status:"running",threadId:mt.id}:Wt);await Qr.updatePlan(Q.id,{tasks:bt})})()}}),fe&&d.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:Ue.x<0?void 0:Ue.x,top:Ue.y<0?void 0:Ue.y,right:Ue.x<0?16:void 0,bottom:Ue.y<0?16:void 0,width:Oe.w,height:Oe.h},children:[d.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:K0,style:{touchAction:"none"},children:[d.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[d.jsx(Ig,{className:"h-3 w-3"})," Screen Share"]}),d.jsx(ke,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:D=>D.stopPropagation(),onClick:ug,children:d.jsx(ti,{className:"h-3 w-3"})})]}),d.jsx(_ft,{screenShare:ng}),d.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:Km,style:{touchAction:"none"},children:d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:d.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function i1t(){const[e,r]=jt.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");jt.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 d.jsx(Xhe,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}She.createRoot(document.getElementById("root")).render(d.jsx(jt.StrictMode,{children:d.jsx(c1e,{children:d.jsxs(l1e,{children:[d.jsx(n1t,{}),d.jsx(i1t,{})]})})}));export{C1t as $,pPe as A,m1t as B,__ as C,jh as D,rMe as E,wPe as F,_M as G,YQ as H,Oa as I,GBe as J,$He as K,FIe as L,_Ie as M,Nz as N,Tz as O,k1t as P,x1t as Q,w1t as R,_1t as S,y1t as T,Gr as U,JR as V,S1t as W,v1t as X,Zy as Y,j1t as Z,X as _,gPe as a,Xre as a$,b1t as a0,IMe as a1,S2 as a2,f1t as a3,Hj as a4,THe as a5,rPe as a6,iee as a7,tz as a8,CIe as a9,q1t as aA,H1t as aB,kr as aC,W1t as aD,QUe as aE,KUe as aF,GUe as aG,$ee as aH,vIe as aI,QWe as aJ,BQ as aK,wIe as aL,h1t as aM,T0 as aN,xS as aO,ZWe as aP,XWe as aQ,xIe as aR,PW as aS,kHe as aT,Zre as aU,Dj as aV,Fj as aW,M5 as aX,Not as aY,Qre as aZ,xd as a_,NA as aa,LHe as ab,uPe as ac,uS as ad,mr as ae,Mr as af,oee as ag,kUe as ah,cse as ai,V1t as aj,YBe as ak,Pa as al,Qf as am,hb as an,wM as ao,sne as ap,Rv as aq,cne as ar,xr as as,SHe as at,mFe as au,gHe as av,hM as aw,TF as ax,yVe as ay,U1t as az,mPe as b,eHe as b0,qR as b1,im as b2,T2 as b3,vz as b4,M$e as b5,wr as b6,une as b7,Dl as b8,j$e as b9,aFe as bA,pM as bB,iFe as bC,uFe as bD,Av as bE,Fm as bF,Uz as bG,mM as bH,qre as bI,sO as bJ,CHe as bK,zj as bL,L0 as bM,o1t as bN,Ge as bO,VR as ba,_ee as bb,mS as bc,kee as bd,g1t as be,az as bf,oz as bg,s8e as bh,wHe as bi,mHe as bj,rFe as bk,fM as bl,XFe as bm,jHe as bn,A5 as bo,aHe as bp,SVe as bq,yS as br,R5 as bs,tHe as bt,Ure as bu,sFe as bv,oFe as bw,Ov as bx,Lg as by,Yz as bz,ri as c,$r as d,see as e,so as f,vPe as g,Vf as h,vd as i,JBe as j,hS as k,_t as l,ane as m,dS as n,p1t as o,K1t as p,xPe as q,G1t as r,yPe as s,bPe as t,rd as u,KBe as v,BHe as w,WUe as x,T1t as y,nv as z};
|
|
1449
|
+
`)}`:me,displayContent:me,referencedFiles:Pe.length>0?Pe:void 0,displaySegments:ce,attachments:dr.size>0?[...dr]:void 0}},[Ns]),hx=y.useCallback(async(D,Q,he)=>{const ce=await Bu(e.current,D,he);if(!ce)return;const me=zk(ce.displaySegments,Q);Bo({content:ce.promptWithReferences,displayContent:ce.displayContent||ce.promptWithReferences,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:Q}),i(""),a(void 0)},[Wr,Mt,ut,nn,Vt,Bo,Bu,i]),py=y.useCallback(async(D,Q)=>{if(!Hyt(ca==null?void 0:ca.name))return;const he=m8(Q);!he||he==="New Chat"||await Jm(D,he)},[ca==null?void 0:ca.name,Jm]),Tp=async(D,Q,he)=>{if(ir==="manager"||Bt==="thread")return WS(D,Q,he);const ce=await Bu(e.current,D,he);if(!ce&&(!Q||Q.length===0))return;if(!dt){u(!0);return}const me=(ce==null?void 0:ce.promptWithReferences)??e.current.trim(),Pe=zk(ce==null?void 0:ce.displaySegments,Q),mt=m8((ce==null?void 0:ce.displayContent)||me);let bt=rt;if(!bt){const Wt=await aa(void 0,mt);bt=(Wt==null?void 0:Wt.id)??null}if(bt){if(await py(bt,(ce==null?void 0:ce.displayContent)||me),Si||qs.length>0){Bo({content:me,displayContent:(ce==null?void 0:ce.displayContent)||me,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,referencedFiles:ce==null?void 0:ce.referencedFiles,displaySegments:Pe,attachments:Q}),i(""),a(void 0);return}Ec(me,{token:dt,sessionId:bt,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,responseStyle:nn,model:Vt??void 0,onLoginRequired:()=>u(!0),attachments:Q,...ce!=null&&ce.displayContent?{displayContent:ce.displayContent||me}:{},...ce!=null&&ce.referencedFiles?{referencedFiles:ce.referencedFiles}:{},...Pe!=null&&Pe.length?{displaySegments:Pe}:{}}),i(""),a(void 0)}},WS=async(D,Q,he)=>{var mt;const ce=await Bu(e.current,D,he);if(!ce||mp)return;const me=zk(ce.displaySegments,Q),Pe=xe.selectedThread?((mt=Ks[xe.selectedThread.id])==null?void 0:mt.length)??0:0;if(xe.selectedThread&&(xe.selectedThread.status==="running"||Pe>0)){nf(xe.selectedThread.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:ce.displayContent||ce.promptWithReferences,displayContent:ce.displayContent||ce.promptWithReferences,fullContent:ce.promptWithReferences,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:ce.attachments,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()}),i(""),a(void 0);return}i(""),a(void 0),await xe.handleSend(ce.promptWithReferences,Mt,Mt!=="jait"?ut:void 0,Vt??void 0,{displayContent:ce.displayContent||ce.promptWithReferences,referencedFiles:ce.referencedFiles,displaySegments:me,attachments:ce.attachments})},my=y.useRef(!1);y.useEffect(()=>{var Q,he,ce;if(ir==="manager"||Bt==="thread"||!dt||!rt||Si||As||my.current)return;const[D]=qs;D&&(my.current=!0,ku(D.id),Promise.resolve(Ec(D.content,{token:dt,sessionId:rt,mode:D.mode,provider:D.provider,runtimeMode:D.runtimeMode,responseStyle:D.responseStyle,model:D.model,onLoginRequired:()=>u(!0),...(Q=D.attachments)!=null&&Q.length?{attachments:D.attachments}:{},...D.displayContent?{displayContent:D.displayContent}:{},...(he=D.referencedFiles)!=null&&he.length?{referencedFiles:D.referencedFiles}:{},...(ce=D.displaySegments)!=null&&ce.length?{displaySegments:D.displaySegments}:{}})).catch(me=>{Bo({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}),pi.error(Pq(me instanceof Error?me.message:null,"Failed to send queued message"))}).finally(()=>{my.current=!1}))},[rt,ku,Bo,Si,As,qs,Ec,Bt,dt,ir]);const nf=y.useCallback((D,Q)=>{yo(he=>({...he,[D]:[...he[D]??[],Q]}))},[]),gy=y.useCallback((D,Q)=>{yo(he=>{const ce=he[D]??[],me=ce.filter(Pe=>Pe.id!==Q);if(me.length===ce.length)return he;if(me.length===0){const{[D]:Pe,...mt}=he;return mt}return{...he,[D]:me}})},[]),US=y.useCallback((D,Q,he)=>{const ce=he.trim();ce&&yo(me=>{const Pe=me[D]??[];return Pe.length===0?me:{...me,[D]:Pe.map(mt=>mt.id===Q?{...mt,content:ce,displayContent:ce,fullContent:ce,referencedFiles:void 0,displaySegments:void 0,attachments:void 0}:mt)}})},[]),m6=y.useCallback((D,Q,he,ce)=>{yo(me=>{const Pe=me[D]??[];if(Pe.length===0)return me;const mt=Pe.findIndex(dr=>dr.id===Q);if(mt<0)return me;const bt=[...Pe],[Wt]=bt.splice(mt,1);if(!Wt)return me;if(he==null)bt.push(Wt);else{const dr=bt.findIndex(Ur=>Ur.id===he);if(dr<0)return me;bt.splice(dr+(ce==="after"?1:0),0,Wt)}return bt===Pe?me:{...me,[D]:bt}})},[]),fx=y.useCallback(D=>{var me;const Q=xe.selectedThread,he=xe.selectedRepo;if(!Q||!he)return;const ce=(me=Ks[Q.id])==null?void 0:me.find(Pe=>Pe.id===D);ce&&(gy(Q.id,D),(async()=>{const Pe=`jait/${Math.random().toString(16).slice(2,10)}`;let mt;try{mt=(await io.createWorktree(he.localPath,he.defaultBranch,Pe)).path}catch{try{await io.createBranch(he.localPath,Pe,he.defaultBranch)}catch{}}const bt=await Qr.createThread({title:`[${he.name}] Generating title…`,providerId:ce.providerId,runtimeMode:ce.runtimeMode,...ce.model?{model:ce.model}:{},kind:"delivery",workingDirectory:mt??he.localPath,branch:Pe});await Qr.startThread(bt.id,{message:ce.fullContent,titlePrefix:`[${he.name}] `,...ce.displayContent?{displayContent:ce.displayContent}:{},...ce.referencedFiles?{referencedFiles:ce.referencedFiles}:{},...ce.displaySegments?{displaySegments:ce.displaySegments}:{},...ce.attachments?{attachments:ce.attachments}:{}})})())},[xe.selectedThread,xe.selectedRepo,Ks,gy]),VS=y.useCallback(async(D,Q,he)=>{const ce=xe.selectedThread;if(!ce)return;const me=await Bu(e.current,D,he);if(!me)return;const Pe=zk(me.displaySegments,Q);nf(ce.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:Pe,attachments:me.attachments,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()}),i(""),a(void 0)},[xe.selectedThread,Mt,ut,Vt,nf,Bu,i]);y.useEffect(()=>{if(!rt)for(const[D,Q]of Object.entries(Ks)){if(Q.length===0||Wa.current.has(D))continue;const he=xe.threads.find(me=>me.id===D);if(!he){yo(me=>{if(!(D in me))return me;const{[D]:Pe,...mt}=me;return mt});continue}if(he.status==="running")continue;const[ce]=Q;ce&&(Wa.current.add(D),yo(me=>{const Pe=me[D]??[],[,...mt]=Pe;if(mt.length===0){const{[D]:bt,...Wt}=me;return Wt}return{...me,[D]:mt}}),xe.handleSendToThread(D,ce.fullContent,ce.providerId,ce.runtimeMode,ce.model,{displayContent:ce.displayContent??ce.content,referencedFiles:ce.referencedFiles,displaySegments:ce.displaySegments,attachments:ce.attachments}).catch(me=>{yo(Pe=>({...Pe,[D]:[ce,...Pe[D]??[]]})),xe.setError(me instanceof Error?me.message:"Failed to process queued thread message")}).finally(()=>{Wa.current.delete(D)}))}},[rt,xe.handleSendToThread,xe.setError,xe.threads,Ks]);const fg=y.useCallback(async()=>{const D=xe.selectedRepo;if(D)try{await Qr.updateRepo(D.id,{deviceId:""}),await xe.refresh()}catch{xe.setError("Failed to move repository to gateway")}},[xe.selectedRepo,xe.refresh,xe.setError]),pg=async D=>{if(!dt){u(!0);return}let Q=rt;if(!Q){const he=await aa();Q=(he==null?void 0:he.id)??null}if(Q){if(D==="Generate architecture diagram"){Le(!0),vt(!0),Ec("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:dt,sessionId:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)});return}Ec(D,{token:dt,sessionId:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)})}},qS=y.useCallback(async(D,Q,he,ce,me)=>{if(!rt||!dt)return;const Pe=await Bu(Q,me==null?void 0:me.referencedFiles,me==null?void 0:me.displaySegments);Pe&&await hp(D,Pe.promptWithReferences,he,ce,{token:dt,sessionId:rt,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,displayContent:Pe.displayContent,referencedFiles:Pe.referencedFiles,displaySegments:Pe.displaySegments,onLoginRequired:()=>u(!0)})},[rt,hp,dt,Wr,Mt,ut,Vt,Bu]),px=async D=>{if(D.preventDefault(),!wt){h(null),qt(!0);try{await Ym(be,Zt),u(!1),zt(""),g("chat")}catch(Q){h(Q instanceof Error?Q.message:"Login failed")}finally{qt(!1)}}},GS=async D=>{if(D.preventDefault(),!wt){if(h(null),!Te||!Ct){h("Username and password are required");return}if(Ct!==tr){h("Passwords do not match");return}qt(!0);try{await Y0(Te,Ct),u(!1),ur(""),Ir(""),g("chat")}catch(Q){h(Q instanceof Error?Q.message:"Registration failed")}finally{qt(!1)}}},KS=y.useCallback(async D=>{D.preventDefault();const Q=Ia.trim();if(!Q){Ts("Please enter a gateway URL");return}Dn(!0),Ts(null);try{const he=Q.replace(/\/+$/,""),ce=await fetch(`${he}/health`,{signal:AbortSignal.timeout(5e3)});if(!ce.ok)throw new Error(`Server returned ${ce.status}`);const me=Mn();if(bQ(he),he!==me){window.location.reload();return}Wi("auth")}catch(he){Ts(he instanceof Error?he.name==="TimeoutError"||he.name==="AbortError"?"Connection timed out":he.message:"Failed to connect")}finally{Dn(!1)}},[Ia]),mx=()=>{np(),Ha(),g("chat"),u(!0)},mg=y.useCallback(()=>{Ha(),aa()},[Ha,aa]),gx=async D=>{const Q=Object.fromEntries(Object.entries(D).map(([he,ce])=>[he,ce.trim()]).filter(([,he])=>he.length>0));await Lo({api_keys:Q})},yy=async()=>{const D=await jd();return await Uh(),D.removed},YS=async()=>{const D=await Zm();return await Uh(),D},XS=async D=>{const Q=await Vi(D);return Q&&await Uh(),Q},gg=y.useCallback(async()=>{if(rt)try{await fetch(`${Ki}/api/consent/pending/${rt}/approve-all`,{method:"DELETE"}),un(!1)}catch{}},[rt]),ZS=y.useCallback(async D=>{var me;const Q=dde(D);if(!Q)return;if(ir==="manager"||Bt==="thread"){const Pe=xe.selectedThread,mt=Pe?((me=Ks[Pe.id])==null?void 0:me.length)??0:0;if(Pe&&(Pe.status==="running"||mt>0)){nf(Pe.id,{id:`mq-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:Q,displayContent:Q,fullContent:Q,referencedFiles:void 0,attachments:void 0,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,queuedAt:Date.now()});return}await xe.handleSend(Q,Mt,Mt!=="jait"?ut:void 0,Vt??void 0);return}const he=m8(Q);let ce=rt;if(!ce){const Pe=await aa(void 0,he);ce=(Pe==null?void 0:Pe.id)??null}if(!(!ce||!dt)){if(await py(ce,Q),Si||qs.length>0){Bo({content:Q,displayContent:Q,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0});return}Ec(Q,{token:dt,sessionId:ce,mode:Wr,provider:Mt,runtimeMode:Mt!=="jait"?ut:void 0,model:Vt??void 0,onLoginRequired:()=>u(!0)})}},[rt,xe.handleSend,xe.selectedThread,Wr,Mt,ut,Vt,aa,nf,Bo,py,Si,Ks,qs.length,Ec,Bt,dt,ir]),[zu,yx]=y.useState(!1),[Vd,vy]=y.useState(!1),[sf,vx]=y.useState(()=>g8()),zc=y.useRef(null),yg=y.useRef([]),of=y.useRef(null),Np=y.useRef(g8()),Ep=y.useRef(null),xy=y.useRef(null),vg=y.useRef(null),by=y.useRef(null),xg=y.useRef(null),_y=y.useCallback(()=>{const D=g8();Np.current=D,vx(D)},[]),Fu=y.useCallback(()=>{var Q;xg.current!==null&&(cancelAnimationFrame(xg.current),xg.current=null),(Q=xy.current)==null||Q.disconnect(),xy.current=null,vg.current=null,by.current=null;const D=Ep.current;Ep.current=null,D&&D.state!=="closed"&&D.close().catch(()=>{}),_y()},[_y]),ns=y.useCallback(D=>{Fu();try{const Q=new AudioContext,he=Q.createAnalyser();he.fftSize=256,he.smoothingTimeConstant=.58;const ce=Q.createMediaStreamSource(D);ce.connect(he);const me=new Uint8Array(new ArrayBuffer(he.frequencyBinCount));Ep.current=Q,xy.current=ce,vg.current=he,by.current=me;const Pe=()=>{const mt=vg.current,bt=by.current;if(!mt||!bt)return;mt.getByteTimeDomainData(bt);let Wt=0;for(let yn=0;yn<bt.length;yn++)Wt+=Math.abs((bt[yn]-128)/128);const dr=bt.length>0?Wt/bt.length:0,Ur=Math.pow(Math.min(1,dr*6.8),.78),an=Math.min(1,Math.max(n9,Ur)),ui=(Np.current[Np.current.length-1]??n9)*.2+an*.8,Vr=[...Np.current.slice(-(ude-1)),ui];Np.current=Vr,vx(Vr),xg.current=requestAnimationFrame(Pe)};Pe()}catch(Q){console.warn("Voice visualizer unavailable:",Q),_y()}},[_y,Fu]),Ms=y.useCallback(D=>{const he=D.sampleRate,ce=D.getChannelData(0),me=new ArrayBuffer(44+ce.length*2),Pe=new DataView(me),mt=(Wt,dr)=>{for(let Ur=0;Ur<dr.length;Ur++)Pe.setUint8(Wt+Ur,dr.charCodeAt(Ur))};mt(0,"RIFF"),Pe.setUint32(4,36+ce.length*2,!0),mt(8,"WAVE"),mt(12,"fmt "),Pe.setUint32(16,16,!0),Pe.setUint16(20,1,!0),Pe.setUint16(22,1,!0),Pe.setUint32(24,he,!0),Pe.setUint32(28,he*1*2,!0),Pe.setUint16(32,2,!0),Pe.setUint16(34,16,!0),mt(36,"data"),Pe.setUint32(40,ce.length*2,!0);let bt=44;for(let Wt=0;Wt<ce.length;Wt++){const dr=Math.max(-1,Math.min(1,ce[Wt]));Pe.setInt16(bt,dr<0?dr*32768:dr*32767,!0),bt+=2}return new Blob([me],{type:"audio/wav"})},[]),af=y.useCallback(async()=>{var he,ce;yx(!1),Fu();const D=zc.current;if(!D||D.state==="inactive"){(he=of.current)==null||he.getTracks().forEach(me=>me.stop()),of.current=null,zc.current=null;return}const Q=await new Promise(me=>{D.ondataavailable=Pe=>{Pe.data.size>0&&yg.current.push(Pe.data)},D.onstop=()=>{me(new Blob(yg.current,{type:D.mimeType}))},D.stop()});if((ce=of.current)==null||ce.getTracks().forEach(me=>me.stop()),of.current=null,zc.current=null,Q.size!==0&&(Ui.stt_provider==="wyoming"||Ui.stt_provider==="whisper")){vy(!0);try{const me=await Q.arrayBuffer(),Pe=new AudioContext({sampleRate:16e3}),mt=await Pe.decodeAudioData(me),bt=Ms(mt);await Pe.close();const Wt=await bt.arrayBuffer(),dr=new Uint8Array(Wt);let Ur="";for(let Vr=0;Vr<dr.length;Vr++)Ur+=String.fromCharCode(dr[Vr]);const an=btoa(Ur),ui=await(await fetch(`${Ki}/api/voice/transcribe-audio`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dt}`},body:JSON.stringify({audioBase64:an,sessionId:rt??"voice-input",provider:Ui.stt_provider})})).json();ui.text?i(Vr=>Wyt(Vr,ui.text??"")):console.warn("Transcription failed:",ui.details??ui.error)}catch(me){console.error("Transcription error:",me)}finally{vy(!1)}}},[rt,Ms,Ui.stt_provider,dt]),lf=y.useCallback(async()=>{if(!dt){u(!0);return}try{const D=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});of.current=D,yg.current=[],ns(D);const Q=new MediaRecorder(D);zc.current=Q,Q.ondataavailable=he=>{he.data.size>0&&yg.current.push(he.data)},Q.start(),yx(!0)}catch(D){Fu(),console.error("Microphone access denied:",D),window.alert("Microphone access is required for push-to-talk.")}},[rt,Ui.stt_provider,ns,Fu,ZS,dt]),[Hu,JS]=y.useState(()=>{try{return localStorage.getItem("jait:wake-word")==="true"}catch{return!1}}),Ap=y.useCallback(()=>{JS(D=>{const Q=!D;try{localStorage.setItem("jait:wake-word",String(Q))}catch{}return Q})},[]),xx=y.useCallback(()=>{ii(!0),Ni.connect()},[Ni]),Jl=emt({enabled:Hu&&Es&&!zu&&!Nr,lang:navigator.language,onCommand:()=>{xx()},onWakeWordDetected:()=>{xx()}});y.useEffect(()=>()=>{var D;Fu(),(D=of.current)==null||D.getTracks().forEach(Q=>Q.stop())},[Fu]);const bx=yl==="limit_reached",bg=!Fa&&!Es,wy=ir==="developer"&&p==="chat"&&!bg&&(Fa||jc||!!rt&&(As||Q0||xp||_p||Ru)),_x=ua.length>0||As,Sy=y.useMemo(()=>cde({showWorkspace:$,showTerminal:w,showWorkspaceTree:ae,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,ae]),wx=Nt&&qm&&Sy!==null&&Sy!=="terminal",Sx=Nt&&p==="chat"&&ir==="developer"&&Sy==="terminal",Fc=y.useMemo(()=>({showWorkspace:$,showTerminal:w,showWorkspaceTree:ae,showWorkspaceEditor:le,treeTab:Ze}),[Ze,w,$,le,ae]),kx=_||li!==null,ky=((t3=(Ty=Po==null?void 0:Po.username)==null?void 0:Ty[0])==null?void 0:t3.toUpperCase())??"?",Cx=y.useCallback(()=>{af()},[af]),jx=y.useCallback(()=>{xe.setFolderPickerOpen(!0)},[xe.setFolderPickerOpen]),Cy=Bt==="thread"?d.jsx(Dq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:jx}):null,Tx=ir==="manager"&&xe.selectedThread,QS=Nt&&p==="chat"?d.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:[!Tx&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:!$&&!w&&!_?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{$&&Dc(),w&&Vn(),_&&k(!1),K(!1)},"aria-label":"Chat",children:d.jsx(um,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Chat"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:kx?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>k(D=>!D),"aria-label":"Workspaces",children:_?d.jsx(mT,{className:"h-5 w-5 rotate-90"}):d.jsx(gT,{className:"h-5 w-5 rotate-90"})})}),d.jsx(xn,{side:"left",children:"Workspaces"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"terminal")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("terminal")},"aria-label":"Terminal",children:d.jsx(Xo,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Terminal"})]})]}),li&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"files")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("files")},"aria-label":"Files",children:d.jsx(ph,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Files"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Sf(Fc,"git")?"secondary":"ghost",size:"sm",className:"relative h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("git")},"aria-label":"Changes",children:[d.jsx(Xg,{className:"h-5 w-5"}),us.length>0&&d.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:us.length>99?"99+":us.length})]})}),d.jsx(xn,{side:"left",children:"Changes"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"editor")?"secondary":"ghost",size:"sm",className:"h-10 w-10 shrink-0 rounded-lg p-0",onClick:()=>{Du("editor")},"aria-label":"Editor",children:d.jsx(Uk,{className:"h-5 w-5"})})}),d.jsx(xn,{side:"left",children:"Editor"})]})]})]}):null,jy=ir==="developer"?d.jsx("div",{className:`overflow-x-auto ${Nt?"px-0.5":"px-1"}`,children:d.jsxs("div",{className:`grid min-w-max grid-cols-[1fr_auto_1fr] items-center whitespace-nowrap ${Nt?"gap-2":"gap-3"}`,children:[d.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Bt==="thread"?Cy:d.jsx(NXe,{sessions:up,activeSessionId:rt,workspaceTitle:(sn==null?void 0:sn.title)??"Personal chat",onSelectSession:D=>{go(li,D)},onNewSession:()=>{aa()},onOpenChange:DS,showTitle:!1,triggerLabel:"History"}),Cr&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"truncate text-xs text-green-600 dark:text-green-400",children:"Approved all commands for this session"}),d.jsx("button",{type:"button",onClick:gg,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"Clear approve all"})]})]}),d.jsx("div",{className:"justify-self-center",children:d.jsx(MJ,{target:Bt,onChange:jr,disabled:Si})}),d.jsxs("div",{className:"flex shrink-0 items-center justify-self-end gap-2",children:[Bt!=="thread"&&d.jsx("button",{type:"button",onClick:mg,className:"shrink-0 text-xs text-muted-foreground transition-colors hover:text-foreground",children:"New chat"}),Vl!==null&&d.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Vl," remaining"]})]})]})}):null,e3=y.useMemo(()=>({onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:Cx,mode:Wr,onModeChange:Ln,provider:Mt,onProviderChange:$c,responseStyle:nn,onResponseStyleChange:Zl,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),[lf,zu,sf,Vd,Cx,Wr,Ln,Mt,$c,nn,Zl,ut,Sp,Vt,ci,ia,jp,$,Od,re==null?void 0:re.nodeId]),Wu=[...ua.slice(-10).map(D=>gV({id:`msg-${D.id}`,source:"chat",title:`Message: ${D.role}`,detail:D.content.slice(0,120)||"(empty message)"})),...Fo.map(D=>gV({id:`term-${D.id}`,source:"terminal",title:"Terminal session",detail:`${D.id} (${D.state})`}))];return Sd?d.jsx(Oft,{detachedTabId:Sd}):uo?d.jsx(Lft,{detachedId:uo}):vs===!1?d.jsx(Dft,{onRetry:()=>{wc.current=!1,yu(null),ho()}}):d.jsx(oX,{children:d.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[!bg&&d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:Nt?"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:Hl==="darwin"?70:void 0,paddingRight:Hl==="win32"?140:void 0}:void 0,children:[d.jsxs("div",{className:`flex items-center gap-1 shrink-0 ${Nt?"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:[d.jsx(gae,{size:20,className:"shrink-0"}),Jl.isSupported&&d.jsx("button",{className:`md:hidden flex items-center justify-center h-8 w-8 rounded-lg shrink-0 transition-colors ${Nr?"text-green-400 bg-green-500/10":Hu?Jl.isListening?"text-green-400 bg-green-500/10":"text-blue-400 bg-blue-500/10":"text-muted-foreground hover:bg-accent"}`,onClick:Nr?()=>{Ni.disconnect(),ii(!1)}:Ap,"aria-label":Nr?"Disconnect voice":Hu?"Disable wake word":"Enable wake word",children:Nr?d.jsx(o1,{className:"h-4 w-4 animate-pulse"}):Hu?d.jsx(o1,{className:`h-4 w-4 ${Jl.isListening?"animate-pulse":""}`}):d.jsx(qk,{className:"h-4 w-4"})})]}),d.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:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(um,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Chat"})]})}),d.jsx(xn,{side:"bottom",children:"Chat"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(p_,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Jobs"})]})}),d.jsx(xn,{side:"bottom",children:"Jobs"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{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:[d.jsx(S1,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Network"})]})}),d.jsx(xn,{side:"bottom",children:"Network"})]}),ir==="developer"&&!Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:fe?"secondary":"ghost",size:"sm",className:"h-8 shrink-0 rounded-lg gap-1.5 px-2 text-xs",onClick:()=>fe?ug():oy(),"aria-label":"Screen sharing",children:[d.jsx(Ig,{className:"h-3.5 w-3.5"}),d.jsx("span",{children:"Screen Share"})]})}),d.jsx(xn,{side:"bottom",children:"Screen sharing"})]})]}),Nr?d.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 ${Nt?"pointer-events-auto":""}`,style:Lt?{WebkitAppRegion:"no-drag"}:void 0,children:[d.jsx("button",{onClick:Ni.toggleMic,className:`flex items-center justify-center h-7 w-7 rounded-full transition-colors ${Ni.micActive?"bg-muted hover:bg-muted/80 text-foreground":"bg-destructive/15 text-destructive hover:bg-destructive/25"}`,"aria-label":Ni.micActive?"Mute":"Unmute",children:Ni.micActive?d.jsx(o1,{className:"h-3.5 w-3.5"}):d.jsx(qk,{className:"h-3.5 w-3.5"})}),d.jsx(Lyt,{state:Ni.assistantSpeaking?"speaking":Ni.status,size:"sm",lineWidth:2,className:"!aspect-auto !h-7 w-24 sm:w-36"}),d.jsx("button",{onClick:()=>{Ni.disconnect(),ii(!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:d.jsx(aye,{className:"h-3.5 w-3.5"})})]}):p==="chat"?d.jsx("div",{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 ${Nt?"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:d.jsx(Zpt,{mode:ir,onChange:Oo,compact:Nt})}):null,d.jsx("div",{className:"flex-1 min-w-0"}),d.jsxs("div",{className:`flex items-center gap-1 sm:gap-1.5 shrink-0 ${Nt?"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:[p==="chat"&&Ho.length>0&&d.jsx(r1t,{threads:Ho,getRepositoryForThread:xe.getRepositoryForThread,threadPrStates:xe.threadPrStates,ghAvailable:xe.ghAvailable,onOpenThread:D=>{g("chat"),xe.setSelectedThreadId(D),jr("thread"),U(!1),Je(!1)},onStopThread:D=>xe.handleStop(D)}),d.jsxs("div",{className:"hidden md:flex items-center gap-1 sm:gap-1.5",children:[ng.isActive&&d.jsxs("span",{className:"ui-pill shrink-0",children:[d.jsx(Ig,{className:"h-3 w-3 text-green-500 animate-pulse"}),d.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),Jl.isSupported&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs("button",{onClick:Nr?()=>{Ni.disconnect(),ii(!1)}:Ap,className:`ui-pill shrink-0 cursor-pointer transition-colors ${Nr?"text-green-400 animate-pulse":Hu?Jl.isListening?"text-green-400":"text-blue-400":"text-muted-foreground opacity-50"}`,children:[Nr?d.jsx(o1,{className:"h-3 w-3 animate-pulse"}):Hu?d.jsx(o1,{className:`h-3 w-3 ${Jl.isListening?"animate-pulse":""}`}):d.jsx(qk,{className:"h-3 w-3"}),d.jsx("span",{className:"hidden sm:inline text-xs",children:Nr?"Voice active":Jl.isListening?"Listening...":Hu?"Hey Jait":"Wake word"})]})}),d.jsx(xn,{side:"bottom",children:Nr?"Voice assistant active — click to disconnect":Hu?Jl.isListening?"Listening for your command...":'Say "Hey Jait" to start voice assistant — click to disable':'Click to enable always-on "Hey Jait" wake word'})]}),d.jsx(UXe,{usage:qh}),(()=>{const D=Vt??rg,Q=Mt==="codex"?"openai":Mt==="claude-code"?"anthropic":tg??"ollama",he=Mt==="codex"?Vt??"Codex":Mt==="claude-code"?Vt??"Claude Code":D?Ltt(D):null,ce=Mt==="codex"?`OpenAI Codex CLI${Vt?` · ${Vt}`:""}`:Mt==="claude-code"?`Anthropic Claude Code CLI${Vt?` · ${Vt}`:""}`:D??"";return he?d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs("div",{className:"ui-pill cursor-default sm:mr-2",children:[d.jsx(X5,{provider:Q,model:Mt==="codex"?"codex":Mt==="claude-code"?"claude-3":D??void 0,size:16}),d.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:he})]})}),d.jsx(xn,{side:"bottom",children:ce})]}):null})(),Vl!==null&&Vl<=5&&d.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[Vl," remaining"]})]}),(Un==null?void 0:Un.hasUpdate)&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{onClick:async()=>{if(Hi==="web")!mi&&!ra&&await Cc();else if(Hi==="electron"){const D=window.jaitDesktop;pi.info("Downloading update...");const Q=await D.downloadUpdate();Q!=null&&Q.ok?(pi.success("Update downloaded. Restarting..."),await D.installUpdate()):pi.error("Download failed")}else window.open("https://github.com/Widev-e-U/Jait/releases/latest","_blank")},variant:"outline",size:"sm",disabled:Hi==="web"&&(mi||ra),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:[Hi==="web"&&(mi||ra)?d.jsx(rr,{className:"h-3.5 w-3.5 animate-spin"}):d.jsx(qG,{className:"h-3.5 w-3.5"}),d.jsx("span",{className:"hidden sm:inline",children:Hi==="web"&&(mi||ra)?"Updating...":`v${Un.latestVersion}`})]})}),d.jsx(xn,{side:"bottom",children:Hi==="web"&&(mi||ra)?"Updating and refreshing...":`Update available — v${Un.latestVersion}`})]}),Nt?d.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.jsx(ke,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0 rounded-lg",children:d.jsx(MC,{className:"h-4 w-4"})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:"Navigate"}),d.jsxs(Fi,{onSelect:()=>g("chat"),children:[d.jsx(um,{className:"h-4 w-4 mr-2"}),"Chat"]}),d.jsxs(Fi,{onSelect:()=>g("jobs"),children:[d.jsx(p_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),d.jsxs(Fi,{onSelect:()=>g("network"),children:[d.jsx(S1,{className:"h-4 w-4 mr-2"}),"Network"]}),ir==="developer"&&d.jsxs(Fi,{onSelect:()=>fe?ug():oy(),children:[d.jsx(Ig,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]}),Es?d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.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:d.jsx(C8,{className:"h-8 w-8",children:d.jsx(j8,{className:"text-sm font-medium",children:ky})})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:Po==null?void 0:Po.username}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]}),d.jsx(Zu,{}),d.jsxs("div",{className:"px-2 py-1.5",children:[d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),d.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nD],["system",Aa],["dark",Q$]].map(([D,Q])=>d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx("button",{onClick:()=>{dy(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:d.jsx(Q,{className:"h-3.5 w-3.5"})})}),d.jsx(xn,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:mx,children:[d.jsx(J$,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):d.jsx(ke,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>u(!0),children:"Sign in"})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"md:hidden shrink-0",children:d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.jsx(ke,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 shrink-0",children:d.jsx(MC,{className:"h-4 w-4"})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:"Navigate"}),d.jsxs(Fi,{onSelect:()=>g("chat"),children:[d.jsx(um,{className:"h-4 w-4 mr-2"}),"Chat"]}),d.jsxs(Fi,{onSelect:()=>g("jobs"),children:[d.jsx(p_,{className:"h-4 w-4 mr-2"}),"Jobs"]}),d.jsxs(Fi,{onSelect:()=>g("network"),children:[d.jsx(S1,{className:"h-4 w-4 mr-2"}),"Network"]}),ir==="developer"&&d.jsxs(Fi,{onSelect:()=>fe?ug():oy(),children:[d.jsx(Ig,{className:"h-4 w-4 mr-2"}),fe?"Hide Share":"Screen Share"]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]})]})]})}),Es?d.jsxs(au,{children:[d.jsx(lu,{asChild:!0,children:d.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:d.jsx(C8,{className:"h-7 w-7",children:d.jsx(j8,{className:"text-xs",children:ky})})})}),d.jsxs(hc,{align:"end",children:[d.jsx(Fg,{children:Po==null?void 0:Po.username}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:()=>g("settings"),children:[d.jsx(D3,{className:"h-4 w-4 mr-2"}),"Settings"]}),d.jsx(Zu,{}),d.jsxs("div",{className:"px-2 py-1.5",children:[d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),d.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",nD],["system",Aa],["dark",Q$]].map(([D,Q])=>d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx("button",{onClick:()=>{dy(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:d.jsx(Q,{className:"h-3.5 w-3.5"})})}),d.jsx(xn,{side:"bottom",children:D.charAt(0).toUpperCase()+D.slice(1)})]},D))})]}),d.jsx(Zu,{}),d.jsxs(Fi,{onSelect:mx,children:[d.jsx(J$,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):d.jsx(ke,{variant:"ghost",size:"sm",className:"h-8 rounded-lg text-xs",onClick:()=>u(!0),children:"Sign in"})]}),Lt&&Hl==="linux"&&d.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[d.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:d.jsx(Gk,{className:"h-4 w-4"})}),d.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex h-[35px] w-11 items-center justify-center hover:bg-muted/80 transition-colors",children:Fs?d.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:d.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):d.jsx(U1,{className:"h-3 w-3"})}),d.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:d.jsx(ti,{className:"h-4 w-4"})})]})]})]}),p==="chat"&&d.jsxs("div",{className:`border-b bg-muted/30 px-2 sm:px-5 shrink-0 ${Nt&&!Gh?"hidden":"flex"} ${Gh?"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:[ir==="developer"&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:_?"secondary":"ghost",size:"sm",className:Nt?"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:[_?d.jsx(mT,{className:`h-3 w-3${Nt?" rotate-90":" mr-1"}`}):d.jsx(gT,{className:`h-3 w-3${Nt?" rotate-90":" mr-1"}`}),!Nt&&"Workspaces"]})}),d.jsx(xn,{side:"bottom",children:"Toggle workspaces sidebar"})]}),ir==="developer"&&!Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:w?"secondary":"ghost",size:"sm",className:"h-7 shrink-0 rounded-md px-2 text-xs",onClick:()=>{FS()},children:[d.jsx(Xo,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),d.jsx(xn,{side:"bottom",children:"Toggle terminal panel"})]}),ir==="developer"&&Nt&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"terminal")?"secondary":"ghost",size:"sm",className:"h-9 w-9 shrink-0 rounded-md p-0","aria-label":"Terminal",onClick:()=>{Du("terminal")},children:d.jsx(Xo,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Terminal"})]}),ir==="manager"&&xe.selectedThread&&!Nt&&d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:[d.jsx(K$,{className:"h-3 w-3 mr-1"}),"Back"]}),li&&(ir==="developer"||ir==="manager"&&xe.selectedThread)&&!(Nt&&ir==="manager")&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:`flex items-center shrink-0 ${Nt?"gap-1":""}`,children:Nt?d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"files")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Files",onClick:()=>{Du("files")},children:d.jsx(ph,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Files"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Sf(Fc,"git")?"secondary":"ghost",size:"sm",className:"relative h-9 w-9 rounded-md p-0","aria-label":"Changes",onClick:()=>{Du("git")},children:[d.jsx(Xg,{className:"h-4 w-4"}),us.length>0&&d.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:us.length>99?"99+":us.length})]})}),d.jsx(xn,{side:"bottom",children:"Changes"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:Sf(Fc,"editor")?"secondary":"ghost",size:"sm",className:"h-9 w-9 rounded-md p-0","aria-label":"Editor",onClick:()=>{Du("editor")},children:d.jsx(Uk,{className:"h-4 w-4"})})}),d.jsx(xn,{side:"bottom",children:"Editor"})]})]}):d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:$?"secondary":"ghost",size:"sm",className:"h-7 rounded-md px-2 text-xs",onClick:()=>{uy()},children:[d.jsx(Uk,{className:"h-3 w-3 mr-1"}),"Editor",$&&d.jsx(ti,{className:"h-3 w-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:$?"Hide editor":"Show editor"})]})}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:Hd?"secondary":"ghost",size:"sm",className:Nt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":Hd?"Close preview":"Open preview",onClick:()=>{var D;if(Hd)f6();else{const Q=ne.target??(V==null?void 0:V.trim())??((D=Xh==null?void 0:Xh.target)==null?void 0:D.trim())??null;if(za(Q,(re==null?void 0:re.workspaceRoot)??null))return;cy()}},children:[d.jsx(Ci,{className:`h-3 w-3${Nt?"":" mr-1"}`}),!Nt&&"Preview",!Nt&&Hd&&d.jsx(ti,{className:"h-3 wer-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:Hd?"Close preview":"Open dev preview"})]})]}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:St?"secondary":"ghost",size:"sm",className:Nt?"h-9 w-9 shrink-0 rounded-md p-0":"h-7 shrink-0 rounded-md px-2 text-xs","aria-label":St?"Close architecture":"Open architecture",onClick:()=>{var D;St?((D=cs.current)==null||D.closeArchitectureTab(),Be(null),vt(!1)):(vt(!0),Cd())},children:[d.jsx(RC,{className:`h-3 w-3${Nt?"":" mr-1"}`}),!Nt&&"Architecture",!Nt&&St&&d.jsx(ti,{className:"h-3 w-3 ml-1"})]})}),d.jsx(xn,{side:"bottom",children:"Software architecture diagram"})]}),ir==="developer"&&$&&re&&d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsx(ke,{variant:we?"secondary":"ghost",size:"sm",className:"ml-auto h-6 w-6 shrink-0 p-0",onClick:()=>Ke(D=>!D),children:d.jsx(VG,{className:"h-3 w-3"})})}),d.jsx(xn,{side:"bottom",children:"SSE debug stream"})]}),ir==="manager"&&d.jsxs(d.Fragment,{children:[xe.selectedThread?null:d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:j?"secondary":"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>T(D=>!D),children:[j?d.jsx(mT,{className:`h-3 w-3 mr-1${Nt?" rotate-90":""}`}):d.jsx(gT,{className:`h-3 w-3 mr-1${Nt?" rotate-90":""}`}),"Repositories"]})}),d.jsx(xn,{side:"bottom",children:"Toggle repositories panel"})]}),xe.selectedRepo&&xe.selectedRepo.source==="local"&&d.jsxs(d.Fragment,{children:[d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>E(xe.selectedRepo),children:[d.jsx(tK,{className:"h-3 w-3 mr-1"}),"Strategy"]})}),d.jsx(xn,{side:"bottom",children:"Open repository strategy"})]}),d.jsxs(Cn,{children:[d.jsx(jn,{asChild:!0,children:d.jsxs(ke,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 shrink-0",onClick:()=>P(xe.selectedRepo),children:[d.jsx(QG,{className:"h-3 w-3 mr-1"}),"Todos"]})}),d.jsx(xn,{side:"bottom",children:"Open todo plan"})]})]})]}),!(Nt&&xe.selectedThread)&&d.jsx("div",{className:"flex-1"}),xe.selectedThread?d.jsxs("div",{className:Nt?"flex min-w-0 flex-1 items-center gap-1.5":"flex min-w-0 items-center gap-2 shrink-0",children:[Nt&&d.jsx(ke,{variant:"ghost",size:"sm",className:"h-7 w-7 shrink-0 p-0",onClick:()=>{xe.setSelectedThreadId(null),i("")},children:d.jsx(K$,{className:"h-3.5 w-3.5"})}),d.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[d.jsx(KP,{status:xe.selectedThread.status}),Nt?d.jsxs("div",{className:"min-w-0 flex-1",children:[k4(xe.selectedThread.title)?d.jsx(i9,{className:"text-xs h-3.5 w-28"}):d.jsx("span",{className:"block truncate text-2xs leading-tight text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),d.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&&d.jsxs("span",{className:"min-w-0 truncate",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]}),d.jsx(s9,{kind:xe.selectedThread.kind}),xe.selectedThread.branch&&d.jsx("span",{className:"shrink min-w-0 truncate font-mono",children:xe.selectedThread.branch})]})]}):d.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[k4(xe.selectedThread.title)?d.jsx(i9,{className:"text-xs h-3.5 w-28"}):d.jsx("span",{className:"max-w-[200px] truncate text-2xs text-muted-foreground sm:text-xs",children:xe.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),d.jsx(s9,{kind:xe.selectedThread.kind}),xe.selectedRepo&&d.jsxs("span",{className:"max-w-[160px] truncate text-2xs text-muted-foreground",children:[xe.selectedRepo.name," · ",xe.selectedRepo.defaultBranch]})]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[d.jsx(Hrt,{token:dt,threadId:xe.selectedThread.id,selectedSkillIds:xe.selectedThread.skillIds}),!Nt&&xe.selectedThread.branch&&d.jsx(tn,{variant:"outline",className:"text-2xs px-1 py-0 font-mono",children:xe.selectedThread.branch}),GP(xe.selectedThread)&&d.jsx(ke,{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:d.jsx(U1,{className:"h-2.5 w-2.5"})}),xe.showGitActions&&xe.selectedRepo&&d.jsx("div",{className:Nt?"shrink-0":"ml-2 shrink-0",children:d.jsx(eP,{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:!Nt})})]})]}):null]})]}),p==="jobs"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(Art,{})}):p==="network"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(vft,{token:dt,sessionId:rt??"default"})}):p==="settings"?d.jsx("div",{className:`flex-1 overflow-y-auto ${Nt?"pt-12":""}`,children:d.jsx(aot,{username:(Po==null?void 0:Po.username)??"",token:dt,apiKeys:Ui.api_keys,onSaveApiKeys:gx,sttProvider:Ui.stt_provider,onSttProviderChange:async D=>{await Lo({stt_provider:D})},jaitBackend:Ui.jait_backend??"openai",onJaitBackendChange:async D=>{await Lo({jait_backend:D})},onClearArchive:yy,onClearArchivedWorkspaces:YS,onFetchArchivedWorkspaces:Wh,onRestoreWorkspace:XS,activityEvents:Wu,updateInfo:Un,updateChecking:Sc,onCheckUpdate:()=>{Td()},onApplyUpdate:()=>{Cc()},updateApplying:mi,platform:Hi})}):d.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${Nt?"flex-col relative":""}`,children:[d.jsxs("div",{className:Nt?"contents":`relative flex min-h-0 ${z?"flex-1 min-w-0":"shrink-0"}`,children:[ir==="developer"&&_&&Nt&&d.jsx("div",{className:"fixed inset-0 z-20",onClick:()=>k(!1)}),ir==="developer"&&_&&d.jsx("aside",{ref:H,tabIndex:-1,onBlur:ny,className:`overflow-hidden outline-none ${Nt?"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:d.jsx(jXe,{workspaces:mo,personalSessions:Pr,activeWorkspaceId:li,activeSessionId:rt,loading:jc,hasMoreWorkspaces:X0,showFewerWorkspaces:mo.length>Z0,onSelectWorkspace:ix,onSelectPersonalSession:D=>{Nt&&k(!1),go(null,D)},onNewPersonalSession:()=>{Nt&&k(!1),aa(null)},onCreateWorkspace:$S,onRemoveWorkspace:D=>{Ed(D)},onChangeDirectory:Qm,onShowMore:op,onShowFewer:ap,sessionInfo:Od,nodes:U0})}),(ir==="developer"&&p==="chat"&&!Nt&&(Ws||w)||ir==="manager"&&xe.selectedThread&&Ws)&&d.jsxs("div",{className:`relative flex min-h-0 flex-col ${!Ws&&w||z?"flex-1 min-w-0":"shrink-0"}`,style:!Ws&&w?{width:Et,maxWidth:"70vw"}:void 0,children:[!Ws&&w&&d.jsx("div",{onMouseDown:p6,className:"absolute inset-y-0 right-0 w-1.5 cursor-col-resize hover:bg-primary/30 transition-colors z-10"}),(ir==="developer"||ir==="manager"&&xe.selectedThread)&&Ws&&d.jsx("div",{className:"flex min-h-0 flex-1",children:d.jsx(JF,{ref:cs,autoOpenRemotePath:(re==null?void 0:re.workspaceRoot)??null,surfaceId:(re==null?void 0:re.surfaceId)??null,files:Ns,activeFileId:Pt,onActiveFileChange:bs,onFileDrop:D=>{dx(D)},onReferenceFile:ax,onReferenceSelection:lx,onReferencePreviewElement:zS,onAvailableFilesChange:kc,showTree:ae,showEditor:le,onToggleTree:Cp,onToggleEditor:dg,changedPaths:sx,fsWatcherVersion:Bh,sourceControlRefreshSignal:bl,savedTabsState:Pu,stateReady:wp,previewRequest:q,onTabsStateChange:Lu,onPreviewOpenChange:ay,previewSessionId:rt,previewToken:dt,previewWorkspaceRoot:(re==null?void 0:re.workspaceRoot)??null,previewInitialTarget:V,architectureDiagram:Rt,architectureGenerating:Ee,architectureRequest:je,onArchitectureOpenChange:vt,onArchitectureRenderResult:nx,onGenerateArchitecture:()=>{Le(!0),pg("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:HS,provider:Mt,cliModel:Vt,onCollapsedChange:Y,onMaxCollapsedChange:L,restoreRef:B})}),ir==="developer"&&w&&!Nt&&p==="chat"&&d.jsxs("div",{className:`flex min-h-0 flex-col bg-background ${It?"absolute inset-0 z-20 border-r":`relative border-r border-t ${Ws?"shrink-0":"flex-1"}`}`,style:It||!Ws?void 0:{height:st},children:[!It&&d.jsx("div",{onMouseDown:IS,className:"absolute inset-x-0 top-0 h-1.5 cursor-row-resize hover:bg-primary/30 transition-colors z-10"}),d.jsxs("div",{className:"relative shrink-0",children:[d.jsx(dV,{terminals:Wd,activeTerminalId:ni,onSelect:es,onCreate:D=>Rn(rt??"default",rs??void 0,D),onKill:tf,onDetach:ux,availableShells:Ua}),d.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:[Ws&&d.jsx("button",{onClick:()=>{It?(Xe(!1),ot(Qe.current)):(Qe.current=st,Xe(!0))},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":It?"Exit fullscreen":"Fullscreen terminal",children:It?d.jsx(y9,{className:"h-4 w-4"}):d.jsx(g9,{className:"h-4 w-4"})}),d.jsx("button",{onClick:()=>{ni&&ux(ni)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Open terminal in new window",children:d.jsx(wm,{className:"h-4 w-4"})}),d.jsx("button",{onClick:Vn,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:d.jsx(ti,{className:"h-4 w-4"})})]})]}),ni?d.jsx(d4,{ref:pp,terminalId:ni,className:"flex-1 min-h-0",token:dt,workspaceRoot:rs??void 0,onReferenceSelection:cx}):d.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:d.jsx("button",{onClick:()=>Rn(rt??"default",rs??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]})]})]}),Sx&&d.jsxs("section",{className:"flex flex-1 min-h-0 flex-col overflow-hidden border-b bg-background pt-16",children:[d.jsxs("div",{className:"relative shrink-0 border-b",children:[d.jsx(dV,{terminals:Wd,activeTerminalId:ni,onSelect:es,onCreate:D=>Rn(rt??"default",rs??void 0,D),onKill:tf,availableShells:Ua}),d.jsx("button",{onClick:Vn,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:d.jsx(ti,{className:"h-4 w-4"})})]}),ni?d.jsx(d4,{ref:pp,terminalId:ni,className:"flex-1 min-h-0",token:dt,workspaceRoot:rs??void 0,onReferenceSelection:cx}):d.jsx("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:d.jsx("button",{onClick:()=>Rn(rt??"default",rs??void 0),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),(ir==="developer"||ir==="manager"&&xe.selectedThread)&&wx&&d.jsx("section",{className:`flex-1 min-h-0 overflow-hidden border-b bg-background ${ir==="manager"?"":"pt-16"}`,children:d.jsx(JF,{ref:cs,autoOpenRemotePath:(re==null?void 0:re.workspaceRoot)??null,surfaceId:(re==null?void 0:re.surfaceId)??null,files:Ns,activeFileId:Pt,onActiveFileChange:bs,onFileDrop:D=>{dx(D)},onReferenceFile:ax,onReferenceSelection:lx,onReferencePreviewElement:zS,onAvailableFilesChange:kc,showTree:ae,showEditor:le,onToggleTree:Cp,onToggleEditor:dg,treeTab:Ze,onTreeTabChange:De,changedPaths:sx,sourceControlRefreshSignal:bl,isMobile:!0,savedTabsState:Pu,stateReady:wp,previewRequest:q,onTabsStateChange:Lu,onPreviewOpenChange:ay,previewSessionId:rt,previewToken:dt,previewWorkspaceRoot:(re==null?void 0:re.workspaceRoot)??null,previewInitialTarget:V,architectureDiagram:Rt,architectureGenerating:Ee,architectureRequest:je,onArchitectureOpenChange:vt,onArchitectureRenderResult:nx,onGenerateArchitecture:()=>{Le(!0),pg("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:HS,provider:Mt,cliModel:Vt})}),!wx&&!Sx&&(ir==="manager"?d.jsx("div",{className:`flex-1 min-w-0 flex flex-col min-h-0 ${Nt&&!xe.selectedThread?"pt-12":""}`,children:xe.selectedThread?d.jsxs(d.Fragment,{children:[d.jsxs(NT,{className:"min-h-0 flex-1 border-b",loading:xe.loadingActivities,loadingLabel:"Loading activity",messageContents:In.map(D=>D.content),children:[In.length===0&&!xe.loadingActivities&&d.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),In.map((D,Q)=>{var he,ce;return d.jsx(CO,{messageId:D.id,messageIndex:Q,messageFromEnd:In.length-1-Q,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"&&Q===In.length-1,compact:!0,preferLlmUi:!1,provider:(ce=xe.selectedThread)==null?void 0:ce.providerId,onOpenPath:fy,onOpenDiff:hy},D.id)})]},((Nx=xe.selectedThread)==null?void 0:Nx.id)??"manager-empty"),d.jsx("div",{className:"shrink-0 py-3 px-4",children:d.jsxs("div",{className:"mx-auto max-w-3xl",children:[xe.error&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),Pd.length>0&&xe.selectedThread&&d.jsx(dH,{items:Pd,onRemove:D=>gy(xe.selectedThread.id,D),onEdit:(D,Q)=>US(xe.selectedThread.id,D,Q),onReorder:(D,Q,he)=>m6(xe.selectedThread.id,D,Q,he),onSendToParallelThread:fx,className:"mb-2"}),xe.selectedThreadTodos.length>0&&d.jsx(uH,{items:xe.selectedThreadTodos,className:"mb-2"}),d.jsx(Ub,{ref:po,draftStateKey:`manager:${((Hc=xe.selectedThread)==null?void 0:Hc.id)??"new-thread"}`,value:e.current,syncKey:r,onChange:s,onSubmit:Tp,onQueue:VS,onStop:()=>{xe.selectedThread&&xe.handleStop(xe.selectedThread.id)},isLoading:((Ny=xe.selectedThread)==null?void 0:Ny.status)==="running",disabled:xe.creating,placeholder:(Ex=xe.selectedThread)!=null&&Ex.providerSessionId||((_g=xe.selectedThread)==null?void 0:_g.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},responseStyle:nn,onResponseStyleChange:Zl,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Md,onMoveToGateway:fg,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$}),d.jsxs("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:[Md&&d.jsx(C4,{runtime:Md}),xe.selectedThread&&xe.selectedThread.status!=="running"&&!xe.selectedThread.providerSessionId&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Thread finished — start a new one"})]})]})})]}):d.jsxs("div",{className:`flex flex-1 min-h-0 ${Nt?"flex-col":""}`,children:[j&&d.jsx("div",{className:`overflow-hidden ${Nt?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:d.jsx(Jyt,{repositories:xe.repositories,selectedRepoId:((Op=xe.selectedRepo)==null?void 0:Op.id)??null,isMobile:Nt,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0),onRemoveRepository:D=>{xe.removeRepository(D)},onOpenStrategy:D=>E(D),onOpenPlan:D=>P(D)})}),d.jsxs("div",{className:`flex-1 flex flex-col min-w-0 overflow-y-auto ${Nt?"pt-8":""}`,children:[d.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:d.jsxs("div",{className:"w-full max-w-3xl",children:[d.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&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:xe.error})]}),d.jsx(Ub,{ref:po,draftStateKey:`manager:${((gi=xe.selectedRepo)==null?void 0:gi.id)??"repo-draft"}`,value:e.current,syncKey:r,onChange:s,onSubmit:Tp,disabled:mp,controlsDisabled:xe.creating||ql,placeholder:Eu,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},responseStyle:nn,onResponseStyleChange:Zl,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Rs,onMoveToGateway:fg}),d.jsx("div",{className:"overflow-x-auto px-1 pt-1",children:d.jsxs("div",{className:"flex min-w-max items-center gap-2 whitespace-nowrap",children:[d.jsx(Dq,{repositories:xe.repositories,selectedRepo:xe.selectedRepo,disabled:xe.creating,getRuntimeInfo:xe.getRuntimeInfoForRepository,onSelect:xe.setSelectedRepoId,onAddRepository:()=>xe.setFolderPickerOpen(!0)}),Rs&&d.jsx(C4,{runtime:Rs})]})})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[d.jsxs("div",{className:"flex h-[35px] items-center justify-between border-b px-2.5 sm:px-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("span",{className:"text-sm font-medium",children:"Threads"}),d.jsx(tn,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-2xs",children:Yr.length})]}),d.jsx(ke,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void xe.refresh(),children:d.jsx(ja,{className:`h-3.5 w-3.5 ${xe.loading?"animate-spin":""}`})})]}),Yr.length===0?d.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground sm:py-12",children:"No threads yet"}):d.jsxs("div",{className:"flex flex-col",children:[Yr.map(D=>{const Q=xe.getRepositoryForThread(D),he=(Q==null?void 0:Q.name)??d6(D)??"Unknown repo",ce=hde(D,D.id in xe.threadPrStates?xe.threadPrStates[D.id]:void 0);return d.jsx(t1t,{thread:D,repo:Q,repoName:he,prState:ce,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&&d.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?d.jsx(rr,{className:"h-3 w-3 animate-spin"}):null,"Show more threads"]}),Yr.length>xe.threadListLimit&&d.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"})]})]})})]})]})}):wy?d.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&&d.jsx(NT,{className:"min-h-0 flex-1 border-b",compact:Ws,loading:!0,loadingLabel:"Loading chat",messageContents:[],children:null},rt??"developer-loading")}):_x?d.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&&d.jsxs(d.Fragment,{children:[d.jsxs(NT,{className:"min-h-0 flex-1 border-b",compact:Ws,loading:As,loadingLabel:"Loading chat",messageContents:eg,children:[ua.map((D,Q)=>d.jsx(CO,{messageId:D.id,messageIndex:Q,messageFromEnd:ua.length-1-Q,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:Si&&D===ua[ua.length-1],compact:$||fe||Hd,preferLlmUi:!0,provider:Mt,onOpenTerminal:BS,onEditMessage:qS,editComposer:e3,onOpenPath:fy,onOpenDiff:hy},D.id)),qs.length>0&&d.jsx(dH,{items:qs,onRemove:ku,onEdit:Rd,onReorder:Oc})]},rt??"developer-empty"),d.jsx("div",{className:`shrink-0 ${Nt?"px-2 py-2":`py-3 ${Ws?"px-3":"px-4"}`}`,children:d.jsxs("div",{className:"mx-auto w-full max-w-3xl space-y-1.5",children:[Nc.length>0&&d.jsx(uH,{items:Nc}),yl&&yl!=="login_required"&&yl!=="limit_reached"&&!Si&&d.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:[d.jsx(Kk,{className:"h-4 w-4 shrink-0"}),d.jsx("span",{className:"min-w-0 break-words",children:yl})]}),vl&&!Si&&d.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[d.jsxs("button",{onClick:()=>Io({token:dt,sessionId:rt}),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:[d.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:d.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),d.jsx("span",{className:"text-xs text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),d.jsx(ZXe,{compact:!0,sessionId:rt,onApproveAllEnabled:()=>un(!0)}),dp&&d.jsx(LXe,{plan:dp,onApprove:Ac,onReject:fp,isExecuting:Si}),bx&&d.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),us.length>0&&d.jsx(zXe,{files:us,onAccept:Cu,onReject:ju,onAcceptAll:J0,onRejectAll:Gs,onFileClick:hy}),d.jsx(Ub,{ref:po,draftStateKey:`developer:${rt??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:Tp,onStop:ig,onQueue:hx,isLoading:Si,disabled:bx,placeholder:Kh,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},mode:Wr,onModeChange:Ln,responseStyle:nn,onResponseStyleChange:Zl,sendTarget:Bt,onSendTargetChange:jr,showSendTargetSelector:!1,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Bt==="thread"?Rs:null,onMoveToGateway:Bt==="thread"?fg:void 0,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,workspaceName:ox,workspacePath:rs,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),jy]})})]})}):d.jsxs("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center overflow-hidden ${z?"":"px-4"} ${Nt?"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:[" ",d.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[d.jsxs("div",{className:"text-center",children:[d.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),d.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),!jc&&mo.length===0?d.jsxs("div",{className:"text-center space-y-3",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a workspace folder to start chatting with your code."}),d.jsxs(ke,{variant:"default",size:"lg",onClick:()=>{_u("workspace"),xu(!0)},children:[d.jsx(ph,{className:"h-4 w-4 mr-2"}),"Add Workspace"]})]}):d.jsx(EXe,{suggestions:$&&re?Yyt:Kyt,onSelect:pg}),d.jsx(Ub,{ref:po,draftStateKey:`developer:${rt??"new-chat"}`,value:e.current,syncKey:r,segments:o,onChange:s,onSubmit:Tp,onStop:ig,onQueue:hx,isLoading:Si,placeholder:Kh,onVoiceInput:lf,voiceRecording:zu,voiceLevels:sf,voiceTranscribing:Vd,onVoiceStop:()=>{af()},mode:Wr,onModeChange:Ln,responseStyle:nn,onResponseStyleChange:Zl,sendTarget:Bt,onSendTargetChange:jr,showSendTargetSelector:!1,provider:Mt,onProviderChange:$c,providerRuntimeMode:ut,onProviderRuntimeModeChange:Sp,cliModel:Vt,onCliModelChange:ci,repoRuntime:Bt==="thread"?Rs:null,onMoveToGateway:Bt==="thread"?fg:void 0,availableFiles:ia,onSearchFiles:jp,workspaceOpen:$,workspaceName:ox,workspacePath:rs,sessionInfo:Od,workspaceNodeId:re==null?void 0:re.nodeId}),jy]})]}))]}),ir==="developer"&&we&&d.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:d.jsx(rZe,{onClose:()=>Ke(!1)})}),Nt&&(ir==="developer"||ir==="manager"&&xe.selectedThread)&&p==="chat"&&d.jsxs(d.Fragment,{children:[I&&d.jsx("div",{className:"fixed inset-0 z-[39]",onClick:()=>K(!1),"aria-hidden":"true"}),d.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:[d.jsx("div",{className:`transition-all duration-200 ${I?"translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"}`,children:QS}),d.jsx(ke,{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:()=>K(D=>!D),"aria-expanded":I,"aria-label":I?"Hide mobile toolbar":"Show mobile toolbar",title:I?"Hide mobile toolbar":"Show mobile toolbar",children:I?d.jsx(No,{className:"h-4 w-4"}):d.jsx(h9,{className:"h-4 w-4"})})]})]})]}),bg&&Lt&&d.jsx("div",{className:"fixed top-0 left-0 right-0 h-10 z-[60]",style:{WebkitAppRegion:"drag"}}),bg&&d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(220,17%,10%)]",children:d.jsx("div",{className:"w-full max-w-md border bg-background p-6 shadow-sm rounded-lg",children:Mo==="url"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[d.jsxs("h2",{className:"text-lg font-semibold leading-none tracking-tight flex items-center gap-2",children:[d.jsx(ro,{className:"h-5 w-5"}),"Connect to Gateway"]}),d.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Jait gateway URL to get started."})]}),d.jsxs("form",{onSubmit:KS,className:"space-y-4 pt-2",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),d.jsx(Bn,{id:"gateway-url",placeholder:"https://jait.example.com",value:Ia,onChange:D=>{as(D.target.value),Ts(null)},autoFocus:!0})]}),Hs&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[d.jsx(wh,{className:"h-4 w-4 shrink-0"}),Hs]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:vu,children:vu?d.jsxs(d.Fragment,{children:[d.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col space-y-1.5 text-center sm:text-left",children:[d.jsx("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:co===!1?"Welcome to Jait":"Account"}),d.jsx("div",{className:"text-sm text-muted-foreground",children:Li?d.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[d.jsx(ro,{className:"h-3 w-3 text-green-500"}),d.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Ki}),d.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Wi("url"),children:"Change"})]}):co===!1?d.jsx("p",{children:"Create your account to get started."}):d.jsx("p",{children:"Sign in with a username and password."})})]}),d.jsxs(q1,{value:Qt,onValueChange:D=>Kr(D),children:[d.jsxs(a0,{className:"grid grid-cols-2 w-full",children:[d.jsx(Zo,{value:"login",children:"Login"}),d.jsx(Zo,{value:"register",children:"Register"})]}),d.jsx(Jo,{value:"login",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:px,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-username",children:"Username"}),d.jsx(Bn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"login-password",type:Jt?"text":"password",value:Zt,onChange:D=>zt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>fn(!Jt),tabIndex:-1,children:Jt?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Signing in…":"Login"})]})}),d.jsx(Jo,{value:"register",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:GS,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-username",children:"Username"}),d.jsx(Bn,{id:"register-username",value:Te,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password",type:Me?"text":"password",value:Ct,onChange:D=>ur(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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(!Me),tabIndex:-1,children:Me?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password-confirm",type:zs?"text":"password",value:tr,onChange:D=>Ir(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>_c(!zs),tabIndex:-1,children:zs?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Creating account…":co===!1?"Get Started":"Create account"})]})})]}),c&&d.jsx("p",{className:"text-sm text-destructive",children:c})]})})}),d.jsx(Yf,{open:l&&!bg,onOpenChange:D=>{u(D)},children:d.jsx(Oh,{className:"sm:max-w-md",children:Mo==="url"?d.jsxs(d.Fragment,{children:[d.jsxs(Sh,{children:[d.jsxs(kh,{className:"flex items-center gap-2",children:[d.jsx(ro,{className:"h-5 w-5"}),"Connect to Gateway"]}),d.jsx(s0,{children:"Enter your Jait gateway URL to get started."})]}),d.jsxs("form",{onSubmit:KS,className:"space-y-4 pt-2",children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"gateway-url",children:"Gateway URL"}),d.jsx(Bn,{id:"gateway-url",placeholder:"https://jait.example.com",value:Ia,onChange:D=>{as(D.target.value),Ts(null)},autoFocus:!0})]}),Hs&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[d.jsx(wh,{className:"h-4 w-4 shrink-0"}),Hs]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:vu,children:vu?d.jsxs(d.Fragment,{children:[d.jsx(rr,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs(Sh,{children:[d.jsx(kh,{children:co===!1?"Welcome to Jait":"Account"}),d.jsx(s0,{asChild:!0,children:Li?d.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[d.jsx(ro,{className:"h-3 w-3 text-green-500"}),d.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:Ki}),d.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>Wi("url"),children:"Change"})]}):co===!1?d.jsx("p",{children:"Create your account to get started."}):d.jsx("p",{children:"Sign in with a username and password."})})]}),d.jsxs(q1,{value:Qt,onValueChange:D=>Kr(D),children:[d.jsxs(a0,{className:"grid grid-cols-2 w-full",children:[d.jsx(Zo,{value:"login",children:"Login"}),d.jsx(Zo,{value:"register",children:"Register"})]}),d.jsx(Jo,{value:"login",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:px,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-username",children:"Username"}),d.jsx(Bn,{id:"login-username",value:be,onChange:D=>xt(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"login-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"login-password",type:Jt?"text":"password",value:Zt,onChange:D=>zt(D.target.value),autoComplete:"current-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>fn(!Jt),tabIndex:-1,children:Jt?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Signing in…":"Login"})]})}),d.jsx(Jo,{value:"register",className:"pt-4",children:d.jsxs("form",{className:"space-y-4",onSubmit:GS,children:[d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-username",children:"Username"}),d.jsx(Bn,{id:"register-username",value:Te,onChange:D=>ze(D.target.value),autoComplete:"username",required:!0})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password",children:"Password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password",type:Me?"text":"password",value:Ct,onChange:D=>ur(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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(!Me),tabIndex:-1,children:Me?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsx(_i,{htmlFor:"register-password-confirm",children:"Confirm password"}),d.jsxs("div",{className:"group/pw relative",children:[d.jsx(Bn,{id:"register-password-confirm",type:zs?"text":"password",value:tr,onChange:D=>Ir(D.target.value),autoComplete:"new-password",required:!0,className:"pr-10"}),d.jsx(ke,{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:()=>_c(!zs),tabIndex:-1,children:zs?d.jsx(ah,{className:"h-4 w-4 text-muted-foreground"}):d.jsx(jf,{className:"h-4 w-4 text-muted-foreground"})})]})]}),d.jsx(ke,{type:"submit",className:"w-full",disabled:wt,children:wt?"Creating account…":co===!1?"Get Started":"Create account"})]})})]}),c&&d.jsx("p",{className:"text-sm text-destructive",children:c})]})})}),d.jsx(mV,{open:Vm,onOpenChange:D=>{xu(D),D||ml(null)},initialPath:Ui.workspace_picker_path,initialNodeId:Ui.workspace_picker_node_id,onSelect:(D,Q)=>{hg(D,Q).catch(he=>{console.error("Failed to select workspace:",he),pi.error(`Failed to select workspace: ${he instanceof Error?he.message:"Unknown error"}`)})}}),d.jsx(mV,{open:xe.folderPickerOpen,onOpenChange:xe.setFolderPickerOpen,onSelect:(D,Q)=>{xe.handleFolderSelected(D,Q)}}),d.jsx(Fyt,{token:dt,sessionId:rt}),A&&d.jsx(Wrt,{open:!!A,onOpenChange:D=>{D||E(null)},repoId:A.id,repoName:A.name}),R&&d.jsx(qrt,{open:!!R,onOpenChange:D=>{D||P(null)},repoId:R.id,repoName:R.name,defaultBranch:R.defaultBranch,repoLocalPath:R.localPath,provider:Mt,model:Vt,onStartThread:(D,Q,he)=>{(async()=>{const ce=R,me=`jait/${Math.random().toString(16).slice(2,10)}`;let Pe;try{Pe=(await io.createWorktree(ce.localPath,ce.defaultBranch,me)).path}catch{try{await io.createBranch(ce.localPath,me,ce.defaultBranch)}catch{}}const mt=await Qr.createThread({title:`[${ce.name}] ${D.title}`,providerId:Mt,runtimeMode:Mt!=="jait"?ut:void 0,kind:"delivery",workingDirectory:Pe??ce.localPath,branch:me});await Qr.startThread(mt.id,{message:D.description||D.title,titleTask:D.title,titlePrefix:`[${ce.name}] `});const bt=Q.tasks.map(Wt=>Wt.id===D.id?{...Wt,status:"running",threadId:mt.id}:Wt);await Qr.updatePlan(Q.id,{tasks:bt})})()}}),fe&&d.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:Ue.x<0?void 0:Ue.x,top:Ue.y<0?void 0:Ue.y,right:Ue.x<0?16:void 0,bottom:Ue.y<0?16:void 0,width:Oe.w,height:Oe.h},children:[d.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onPointerDown:K0,style:{touchAction:"none"},children:[d.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[d.jsx(Ig,{className:"h-3 w-3"})," Screen Share"]}),d.jsx(ke,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onPointerDown:D=>D.stopPropagation(),onClick:ug,children:d.jsx(ti,{className:"h-3 w-3"})})]}),d.jsx(_ft,{screenShare:ng}),d.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onPointerDown:Km,style:{touchAction:"none"},children:d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:d.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function i1t(){const[e,r]=jt.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");jt.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 d.jsx(Xhe,{position:"top-right",theme:e,closeButton:!0,gap:8,visibleToasts:4,offset:n?44:void 0})}She.createRoot(document.getElementById("root")).render(d.jsx(jt.StrictMode,{children:d.jsx(c1e,{children:d.jsxs(l1e,{children:[d.jsx(n1t,{}),d.jsx(i1t,{})]})})}));export{C1t as $,pPe as A,m1t as B,__ as C,jh as D,rMe as E,wPe as F,_M as G,YQ as H,Oa as I,GBe as J,$He as K,FIe as L,_Ie as M,Nz as N,Tz as O,k1t as P,x1t as Q,w1t as R,_1t as S,y1t as T,Gr as U,JR as V,S1t as W,v1t as X,Zy as Y,j1t as Z,X as _,gPe as a,Xre as a$,b1t as a0,IMe as a1,S2 as a2,f1t as a3,Hj as a4,THe as a5,rPe as a6,iee as a7,tz as a8,CIe as a9,q1t as aA,H1t as aB,kr as aC,W1t as aD,QUe as aE,KUe as aF,GUe as aG,$ee as aH,vIe as aI,QWe as aJ,BQ as aK,wIe as aL,h1t as aM,T0 as aN,xS as aO,ZWe as aP,XWe as aQ,xIe as aR,PW as aS,kHe as aT,Zre as aU,Dj as aV,Fj as aW,M5 as aX,Not as aY,Qre as aZ,xd as a_,NA as aa,LHe as ab,uPe as ac,uS as ad,mr as ae,Mr as af,oee as ag,kUe as ah,cse as ai,V1t as aj,YBe as ak,Pa as al,Qf as am,hb as an,wM as ao,sne as ap,Rv as aq,cne as ar,xr as as,SHe as at,mFe as au,gHe as av,hM as aw,TF as ax,yVe as ay,U1t as az,mPe as b,eHe as b0,qR as b1,im as b2,T2 as b3,vz as b4,M$e as b5,wr as b6,une as b7,Dl as b8,j$e as b9,aFe as bA,pM as bB,iFe as bC,uFe as bD,Av as bE,Fm as bF,Uz as bG,mM as bH,qre as bI,sO as bJ,CHe as bK,zj as bL,L0 as bM,o1t as bN,Ge as bO,VR as ba,_ee as bb,mS as bc,kee as bd,g1t as be,az as bf,oz as bg,s8e as bh,wHe as bi,mHe as bj,rFe as bk,fM as bl,XFe as bm,jHe as bn,A5 as bo,aHe as bp,SVe as bq,yS as br,R5 as bs,tHe as bt,Ure as bu,sFe as bv,oFe as bw,Ov as bx,Lg as by,Yz as bz,ri as c,$r as d,see as e,so as f,vPe as g,Vf as h,vd as i,JBe as j,hS as k,_t as l,ane as m,dS as n,p1t as o,K1t as p,xPe as q,G1t as r,yPe as s,bPe as t,rd as u,KBe as v,BHe as w,WUe as x,T1t as y,nv as z};
|