@rashidee/co2 1.3.20 → 1.3.21
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/dist/.co2-dat/app.db-shm +0 -0
- package/dist/index.js +36 -4
- package/package.json +1 -1
- package/static/assets/{abnfDiagram-VRR7QNED-cQAiKjYG.js → abnfDiagram-VRR7QNED-B_fP8Vz_.js} +1 -1
- package/static/assets/{arc-C4ZlEQ3S.js → arc-jQ2jhD3o.js} +1 -1
- package/static/assets/{architectureDiagram-ZJ3FMSHR-C_31NGnA.js → architectureDiagram-ZJ3FMSHR-CEunclu9.js} +1 -1
- package/static/assets/{blockDiagram-677ZJIJ3-DDQQ2PAJ.js → blockDiagram-677ZJIJ3-DpbPXGGb.js} +1 -1
- package/static/assets/{c4Diagram-LMCZKHZV-BPbCZxQJ.js → c4Diagram-LMCZKHZV-BMJArETU.js} +1 -1
- package/static/assets/channel-D07NVaUc.js +1 -0
- package/static/assets/{chunk-2Q5K7J3B-B3LoONkc.js → chunk-2Q5K7J3B-DWwnQ9gu.js} +1 -1
- package/static/assets/{chunk-32BRIVSS-Buim75a9.js → chunk-32BRIVSS-mIi65b4i.js} +1 -1
- package/static/assets/{chunk-5VM5RSS4-BjHqxxbw.js → chunk-5VM5RSS4-BDyMPvwt.js} +1 -1
- package/static/assets/{chunk-EX3LRPZG-Dn0_qUTW.js → chunk-EX3LRPZG-Cfspbnh5.js} +1 -1
- package/static/assets/{chunk-JWPE2WC7-DpYEF0BV.js → chunk-JWPE2WC7-277KBuwS.js} +1 -1
- package/static/assets/{chunk-MOJQB5TN-CbNDWijQ.js → chunk-MOJQB5TN-ctV9LaAX.js} +1 -1
- package/static/assets/{chunk-RYQCIY6F-DOhXYkGG.js → chunk-RYQCIY6F-CK9NdxUZ.js} +1 -1
- package/static/assets/{chunk-V7JOEXUC-CfASUuSJ.js → chunk-V7JOEXUC-CurUrryl.js} +1 -1
- package/static/assets/{chunk-VR4S4FIN-vgVNnFtp.js → chunk-VR4S4FIN-C6HOhkwt.js} +1 -1
- package/static/assets/{chunk-XXDRQBXY-CVjoYUTB.js → chunk-XXDRQBXY-C09MJsiF.js} +1 -1
- package/static/assets/classDiagram-OUVF2IWQ-CVG8E0VE.js +1 -0
- package/static/assets/classDiagram-v2-EOCWNBFH-CVG8E0VE.js +1 -0
- package/static/assets/{cose-bilkent-JH36ORCC-EqjuuBpY.js → cose-bilkent-JH36ORCC-ET_pJkh9.js} +1 -1
- package/static/assets/{cynefin-VYW2F7L2-DioyO_Cm.js → cynefin-VYW2F7L2-B6Oy4mbg.js} +1 -1
- package/static/assets/{cynefinDiagram-TSTJHNR4-CuPa5A8w.js → cynefinDiagram-TSTJHNR4-Br7gbIt6.js} +1 -1
- package/static/assets/{dagre-VKFMJZFB-MIf1Dtbk.js → dagre-VKFMJZFB-CGRMVLrv.js} +1 -1
- package/static/assets/{diagram-FQU43EPY-5OBJqg6R.js → diagram-FQU43EPY-Dasgaqiu.js} +1 -1
- package/static/assets/{diagram-G47NLZAW-B2ZGPKp3.js → diagram-G47NLZAW-DZqXpbK0.js} +1 -1
- package/static/assets/{diagram-NH7WQ7WH-B5YEN-B-.js → diagram-NH7WQ7WH-Cjp8mQVX.js} +1 -1
- package/static/assets/{diagram-OA4YK3LP-BXg_CQ2m.js → diagram-OA4YK3LP-BHpTOief.js} +1 -1
- package/static/assets/{diagram-WEI45ONY-DVbqehF6.js → diagram-WEI45ONY-BdjsSjwC.js} +1 -1
- package/static/assets/{ebnfDiagram-CCIWWBDH-hmnXWJuZ.js → ebnfDiagram-CCIWWBDH-D3GJit-t.js} +1 -1
- package/static/assets/{erDiagram-Q63AITRT-CLYATrvi.js → erDiagram-Q63AITRT-CbreGRUM.js} +1 -1
- package/static/assets/{flowDiagram-23GEKE2U-cs1YvuVH.js → flowDiagram-23GEKE2U-Bov8ggVs.js} +1 -1
- package/static/assets/{ganttDiagram-NO4QXBWP-CH5rfioY.js → ganttDiagram-NO4QXBWP-DI2TRBdA.js} +1 -1
- package/static/assets/{gitGraphDiagram-IHSO6WYX-DjAOB5L7.js → gitGraphDiagram-IHSO6WYX-CB0I9Jzz.js} +1 -1
- package/static/assets/{index-B4Y8oBUt.js → index-DHqZVy2E.js} +4 -4
- package/static/assets/{infoDiagram-FWYZ7A6U-De2-PVxo.js → infoDiagram-FWYZ7A6U-DrF8yTwW.js} +1 -1
- package/static/assets/{ishikawaDiagram-FXEZZL3T-CDikxFR6.js → ishikawaDiagram-FXEZZL3T-DUB8-IzB.js} +1 -1
- package/static/assets/{journeyDiagram-5HDEW3XC-Bo6isp1w.js → journeyDiagram-5HDEW3XC-BRfaIEic.js} +1 -1
- package/static/assets/{kanban-definition-HUTT4EX6-jM1azdC7.js → kanban-definition-HUTT4EX6-BSSDB9_O.js} +1 -1
- package/static/assets/{linear-CUk0_yzf.js → linear-oOGNCaPt.js} +1 -1
- package/static/assets/{mindmap-definition-LN4V7U3C-l-cgg6PS.js → mindmap-definition-LN4V7U3C-D7f8ON4e.js} +1 -1
- package/static/assets/{pegDiagram-2B236MQR-B-8nGU3G.js → pegDiagram-2B236MQR-BWLmrzb8.js} +1 -1
- package/static/assets/{pieDiagram-ENE6RG2P-Di1V86Ag.js → pieDiagram-ENE6RG2P-DcXwgn9I.js} +1 -1
- package/static/assets/{quadrantDiagram-ABIIQ3AL-BknVxapP.js → quadrantDiagram-ABIIQ3AL-BzeoX11K.js} +1 -1
- package/static/assets/{railroadDiagram-RFXS5EU6-D7Vohrlg.js → railroadDiagram-RFXS5EU6-DPa8V-DS.js} +1 -1
- package/static/assets/{requirementDiagram-TGXJPOKE-BlFXj6Li.js → requirementDiagram-TGXJPOKE-Bvv4E9CW.js} +1 -1
- package/static/assets/{sankeyDiagram-HTMAVEWB-Ck_A1wxA.js → sankeyDiagram-HTMAVEWB-0MJhpRfa.js} +1 -1
- package/static/assets/{sequenceDiagram-DBY2YBRQ-D4mu07Ol.js → sequenceDiagram-DBY2YBRQ-DigLSZlS.js} +1 -1
- package/static/assets/{sizeCapture-X5ZJPWSS-BwempBoZ.js → sizeCapture-X5ZJPWSS-6mCHKLvi.js} +1 -1
- package/static/assets/{stateDiagram-2N3HPSRC-DSh1YMwZ.js → stateDiagram-2N3HPSRC-BaIapwPh.js} +1 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-DZNVilCm.js +1 -0
- package/static/assets/{swimlanes-5IMT3BWC-4EE1KLA5.js → swimlanes-5IMT3BWC-Doushgb5.js} +2 -2
- package/static/assets/swimlanesDiagram-G3AALYLV-Dye5Ycrr.js +8 -0
- package/static/assets/{timeline-definition-FHXFAJF6-DVZepywq.js → timeline-definition-FHXFAJF6-DQXoUYQ4.js} +1 -1
- package/static/assets/{vennDiagram-L72KCM5P-YqnYvNJT.js → vennDiagram-L72KCM5P-DqoXPumC.js} +1 -1
- package/static/assets/{wardleyDiagram-EHGQE667-Dc6PvPZE.js → wardleyDiagram-EHGQE667-CjaK_50N.js} +1 -1
- package/static/assets/{xychartDiagram-FW5EYKEG-DLbY5Kg1.js → xychartDiagram-FW5EYKEG-DUrmfVTr.js} +1 -1
- package/static/index.html +1 -1
- package/static/assets/channel-CufY_jLp.js +0 -1
- package/static/assets/classDiagram-OUVF2IWQ-CVQD_QZa.js +0 -1
- package/static/assets/classDiagram-v2-EOCWNBFH-CVQD_QZa.js +0 -1
- package/static/assets/stateDiagram-v2-6OUMAXLB-DrMkFhr2.js +0 -1
- package/static/assets/swimlanesDiagram-G3AALYLV-DoZQ3XaY.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-VKFMJZFB-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-VKFMJZFB-CGRMVLrv.js","assets/chunk-RYQCIY6F-CK9NdxUZ.js","assets/graph-C9eacEi8.js","assets/map-Czzmt4hB.js","assets/layout-DEXfKzaS.js","assets/swimlanes-5IMT3BWC-Doushgb5.js","assets/cose-bilkent-JH36ORCC-ET_pJkh9.js","assets/cytoscape.esm-DTSO7Bv0.js","assets/c4Diagram-LMCZKHZV-BMJArETU.js","assets/chunk-32BRIVSS-mIi65b4i.js","assets/flowDiagram-23GEKE2U-Bov8ggVs.js","assets/chunk-5VM5RSS4-BDyMPvwt.js","assets/chunk-XXDRQBXY-C09MJsiF.js","assets/chunk-VR4S4FIN-C6HOhkwt.js","assets/channel-D07NVaUc.js","assets/swimlanesDiagram-G3AALYLV-Dye5Ycrr.js","assets/erDiagram-Q63AITRT-CbreGRUM.js","assets/gitGraphDiagram-IHSO6WYX-CB0I9Jzz.js","assets/chunk-2Q5K7J3B-DWwnQ9gu.js","assets/chunk-JWPE2WC7-277KBuwS.js","assets/cynefin-VYW2F7L2-B6Oy4mbg.js","assets/ganttDiagram-NO4QXBWP-DI2TRBdA.js","assets/linear-oOGNCaPt.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-FWYZ7A6U-DrF8yTwW.js","assets/pieDiagram-ENE6RG2P-DcXwgn9I.js","assets/arc-jQ2jhD3o.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-ABIIQ3AL-BzeoX11K.js","assets/xychartDiagram-FW5EYKEG-DUrmfVTr.js","assets/requirementDiagram-TGXJPOKE-Bvv4E9CW.js","assets/sequenceDiagram-DBY2YBRQ-DigLSZlS.js","assets/classDiagram-OUVF2IWQ-CVG8E0VE.js","assets/chunk-V7JOEXUC-CurUrryl.js","assets/classDiagram-v2-EOCWNBFH-CVG8E0VE.js","assets/stateDiagram-2N3HPSRC-BaIapwPh.js","assets/chunk-EX3LRPZG-Cfspbnh5.js","assets/stateDiagram-v2-6OUMAXLB-DZNVilCm.js","assets/journeyDiagram-5HDEW3XC-BRfaIEic.js","assets/timeline-definition-FHXFAJF6-DQXoUYQ4.js","assets/mindmap-definition-LN4V7U3C-D7f8ON4e.js","assets/kanban-definition-HUTT4EX6-BSSDB9_O.js","assets/sankeyDiagram-HTMAVEWB-0MJhpRfa.js","assets/diagram-NH7WQ7WH-Cjp8mQVX.js","assets/diagram-WEI45ONY-BdjsSjwC.js","assets/blockDiagram-677ZJIJ3-DpbPXGGb.js","assets/diagram-OA4YK3LP-BHpTOief.js","assets/architectureDiagram-ZJ3FMSHR-CEunclu9.js","assets/diagram-FQU43EPY-Dasgaqiu.js","assets/diagram-G47NLZAW-DZqXpbK0.js","assets/wardleyDiagram-EHGQE667-CjaK_50N.js","assets/cynefinDiagram-TSTJHNR4-Br7gbIt6.js","assets/railroadDiagram-RFXS5EU6-DPa8V-DS.js","assets/chunk-MOJQB5TN-ctV9LaAX.js","assets/ebnfDiagram-CCIWWBDH-D3GJit-t.js","assets/abnfDiagram-VRR7QNED-B_fP8Vz_.js","assets/pegDiagram-2B236MQR-BWLmrzb8.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var FU=Object.defineProperty;var PU=(e,t,r)=>t in e?FU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Xr=(e,t,r)=>PU(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function r(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(n){if(n.ep)return;n.ep=!0;const a=r(n);fetch(n.href,a)}})();function Cc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fx={exports:{}},xh={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -457,8 +457,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error
|
|
|
457
457
|
L0,20`)},"requirement_arrow"),wme=M((e,t,r)=>{const i=_i(),{themeVariables:n}=i,{strokeWidth:a}=n;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
|
|
458
458
|
L20,10
|
|
459
459
|
M20,10
|
|
460
|
-
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),kme=M((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-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"),Ame=M((e,t,r)=>{const i=_i(),{themeVariables:n}=i,{strokeWidth:a}=n,l=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");l.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),l.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),l.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),l.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Nme={extension:ome,composition:lme,aggregation:cme,dependency:ume,lollipop:dme,point:hme,circle:fme,cross:pme,barb:mme,barbNeo:gme,only_one:bme,zero_or_one:yme,one_or_more:xme,zero_or_more:_me,only_one_neo:Eme,zero_or_one_neo:Cme,one_or_more_neo:vme,zero_or_more_neo:Sme,requirement_arrow:Tme,requirement_contains:kme,requirement_arrow_neo:wme,requirement_contains_neo:Ame},Rme=sme,Lme={common:lp,getConfig:_i,insertCluster:wpe,insertEdge:ame,insertEdgeLabel:Qpe,insertMarkers:Rme,insertNode:s7,interpolateToCurve:Gw,labelHelper:Ot,log:$e,positionEdgeLabel:Jpe},jf={},u7=M(e=>{for(const t of e)jf[t.name]=t},"registerLayoutLoaders"),Ime=M(()=>{u7([{name:"dagre",loader:M(async()=>await Jt(()=>import("./dagre-VKFMJZFB-MIf1Dtbk.js"),__vite__mapDeps([0,1,2,3,4])),"loader")},{name:"swimlane",loader:M(async()=>await Jt(()=>import("./swimlanes-5IMT3BWC-4EE1KLA5.js"),__vite__mapDeps([5,1,2,3])),"loader")},{name:"cose-bilkent",loader:M(async()=>await Jt(()=>import("./cose-bilkent-JH36ORCC-EqjuuBpY.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");Ime();var u1e=M(async(e,t,r)=>{if(!(e.layoutAlgorithm in jf))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const f of e.nodes){const b=f.domId||f.id;f.domId=`${e.diagramId}-${b}`}const i=jf[e.layoutAlgorithm],n=await i.loader(),{theme:a,themeVariables:l}=e.config,{useGradient:s,gradientStart:c,gradientStop:u}=l,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a!=null&&a.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a!=null&&a.includes("dark")?"#FFFFFF":"#000000"}`),s){const f=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");f.append("svg:stop").attr("offset","0%").attr("stop-color",c).attr("stop-opacity",1),f.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return n.render(e,t,Lme,{algorithm:i.algorithm},r)},"render"),d1e=M((e="",{fallback:t="dagre"}={})=>{if(e in jf)return e;if(t in jf)return $e.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),hk="comm",d7="rule",h7="decl",Dme="@media",Ome="@import",Bme="@supports",Mme="@namespace",OE="@keyframes",f7="@layer",Fme="@scope",Pme=Math.abs,_f=String.fromCharCode;function p7(e){return e.trim()}function BE(e,t,r){return e.replace(t,r)}function Bu(e,t){return e.charCodeAt(t)|0}function ud(e,t,r){return e.slice(t,r)}function Ns(e){return e.length}function m7(e){return e.length}function Jm(e,t){return t.push(e),e}var O0=1,dd=1,g7=0,Ha=0,ji=0,Nd="";function fk(e,t,r,i,n,a,l,s){return{value:e,root:t,parent:r,type:i,props:n,children:a,line:O0,column:dd,length:l,return:"",siblings:s}}function jme(){return ji}function Ume(){return ji=Ha>0?Bu(Nd,--Ha):0,dd--,ji===10&&(dd=1,O0--),ji}function ns(){return ji=Ha<g7?Bu(Nd,Ha++):0,dd++,ji===10&&(dd=1,O0++),ji}function ll(){return Bu(Nd,Ha)}function Rg(){return Ha}function B0(e,t){return ud(Nd,e,t)}function Uf(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $me(e){return O0=dd=1,g7=Ns(Nd=e),Ha=0,[]}function Hme(e){return Nd="",e}function V_(e){return p7(B0(Ha-1,ME(e===91?e+2:e===40?e+1:e)))}function zme(e){for(;(ji=ll())&&ji<33;)ns();return Uf(e)>2||Uf(ji)>3?"":" "}function qme(e,t){for(;--t&&ns()&&!(ji<48||ji>102||ji>57&&ji<65||ji>70&&ji<97););return B0(e,Rg()+(t<6&&ll()==32&&ns()==32))}function ME(e){for(;ns();)switch(ji){case e:return Ha;case 34:case 39:e!==34&&e!==39&&ME(ji);break;case 40:e===41&&ME(e);break;case 92:ns();break}return Ha}function Gme(e,t){for(;ns()&&e+ji!==57;)if(e+ji===84&&ll()===47)break;return"/*"+B0(t,Ha-1)+"*"+_f(e===47?e:ns())}function Wme(e){for(;!Uf(ll());)ns();return B0(e,Ha)}function Yme(e){return Hme(Lg("",null,null,null,[""],e=$me(e),0,[0],e))}function Lg(e,t,r,i,n,a,l,s,c){for(var u=0,h=0,f=l,b=0,g=0,v=0,C=1,y=1,x=1,E=0,S=0,T="",A=n,k=a,L=i,N=T;y;)switch(v=S,S=ns()){case 40:v!=108&&Bu(N,f-1)==58?(E++,N+="("):N+=V_(S);break;case 41:E--,N+=")";break;case 34:case 39:case 91:N+=V_(S);break;case 9:case 10:case 13:case 32:if(E>0){N+=_f(S);break}N+=zme(v);break;case 92:N+=qme(Rg()-1,7);continue;case 47:switch(ll()){case 42:case 47:Jm(Vme(Gme(ns(),Rg()),t,r,c),c),(Uf(v||1)==5||Uf(ll()||1)==5)&&Ns(N)&&ud(N,-1,void 0)!==" "&&(N+=" ");break;default:N+="/"}break;case 123*C:s[u++]=Ns(N)*x;case 125*C:case 59:case 0:if(E>0&&S){N+=_f(S);break}switch(S){case 0:case 125:y=0;case 59+h:x==-1&&(N=BE(N,/\f/g,"")),g>0&&(Ns(N)-f||C===0)&&Jm(g>32?K3(N+";",i,r,f-1,c):K3(BE(N," ","")+";",i,r,f-2,c),c);break;case 59:N+=";";default:if(Jm(L=X3(N,t,r,u,h,n,s,T,A=[],k=[],f,a),a),S===123)if(h===0)Lg(N,t,L,L,A,a,f,s,k);else{switch(b){case 99:if(Bu(N,3)===110)break;case 108:if(Bu(N,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Lg(e,L,L,i&&Jm(X3(e,L,L,0,0,n,s,T,n,A=[],f,k),k),n,k,f,s,i?A:k):Lg(N,L,L,L,[""],k,0,s,k)}}u=h=g=0,C=x=1,T=N="",f=l;break;case 58:f=1+Ns(N),g=v;default:if(C<1){if(S==123)--C;else if(S==125&&C++==0&&Ume()==125)continue}switch(N+=_f(S),S*C){case 38:x=h>0?1:(N+="\f",-1);break;case 44:if(E>0)break;s[u++]=(Ns(N)-1)*x,x=1;break;case 64:ll()===45&&(N+=V_(ns())),b=ll(),h=f=Ns(T=N+=Wme(Rg())),S++;break;case 45:v===45&&Ns(N)==2&&(C=0)}}return a}function X3(e,t,r,i,n,a,l,s,c,u,h,f){for(var b=n-1,g=n===0?a:[""],v=m7(g),C=0,y=0,x=0;C<i;++C)for(var E=0,S=ud(e,b+1,b=Pme(y=l[C])),T=e;E<v;++E)(T=p7(y>0?g[E]+" "+S:BE(S,/&\f/g,g[E])))&&(c[x++]=T);return fk(e,t,r,n===0?d7:s,c,u,h,f)}function Vme(e,t,r,i){return fk(e,t,r,hk,_f(jme()),ud(e,2,-2),0,i)}function K3(e,t,r,i,n){return fk(e,t,r,h7,ud(e,0,i),ud(e,i+1,-1),i,n)}function FE(e,t){for(var r="",i=0;i<e.length;i++)r+=t(e[i],i,e,t)||"";return r}function Xme(e,t,r,i){switch(e.type){case f7:if(e.children.length)break;case Ome:case Mme:case h7:return e.return=e.return||e.value;case hk:return"";case OE:return e.return=e.value+"{"+FE(e.children,i)+"}";case d7:if(!Ns(e.value=e.props.join(",")))return""}return Ns(r=FE(e.children,i))?e.return=e.value+"{"+r+"}":""}function Kme(e){var t=m7(e);return function(r,i,n,a){for(var l="",s=0;s<t;s++)l+=e[s](r,i,n,a)||"";return l}}var b7="c4",Zme=M(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Qme=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-BPbCZxQJ.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:b7,diagram:e}},"loader"),Jme={id:b7,detector:Zme,loader:Qme},ege=Jme,y7="flowchart",tge=M((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),rge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-cs1YvuVH.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:y7,diagram:e}},"loader"),ige={id:y7,detector:tge,loader:rge},nge=ige,x7="flowchart-v2",age=M((e,t)=>{var r,i,n;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),sge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-cs1YvuVH.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:x7,diagram:e}},"loader"),oge={id:x7,detector:age,loader:sge},lge=oge,_7="swimlane",cge=M(e=>/^\s*swimlane-beta\b/.test(e),"detector"),uge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-DoZQ3XaY.js");return{diagram:t}},__vite__mapDeps([15,10,11,12,13,9,14]));return{id:_7,diagram:e}},"loader"),dge={id:_7,detector:cge,loader:uge},hge=dge,E7="er",fge=M(e=>/^\s*erDiagram/.test(e),"detector"),pge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-CLYATrvi.js");return{diagram:t}},__vite__mapDeps([16,12,13,14]));return{id:E7,diagram:e}},"loader"),mge={id:E7,detector:fge,loader:pge},gge=mge,C7="gitGraph",bge=M(e=>/^\s*gitGraph/.test(e),"detector"),yge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-DjAOB5L7.js");return{diagram:t}},__vite__mapDeps([17,18,19,20]));return{id:C7,diagram:e}},"loader"),xge={id:C7,detector:bge,loader:yge},_ge=xge,v7="gantt",Ege=M(e=>/^\s*gantt/.test(e),"detector"),Cge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-CH5rfioY.js");return{diagram:t}},__vite__mapDeps([21,22,23,24]));return{id:v7,diagram:e}},"loader"),vge={id:v7,detector:Ege,loader:Cge},Sge=vge,S7="info",Tge=M(e=>/^\s*info/.test(e),"detector"),wge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-De2-PVxo.js");return{diagram:t}},__vite__mapDeps([25,20]));return{id:S7,diagram:e}},"loader"),kge={id:S7,detector:Tge,loader:wge},T7="pie",Age=M(e=>/^\s*pie/.test(e),"detector"),Nge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-Di1V86Ag.js");return{diagram:t}},__vite__mapDeps([26,19,20,27,28,23]));return{id:T7,diagram:e}},"loader"),Rge={id:T7,detector:Age,loader:Nge},w7="quadrantChart",Lge=M(e=>/^\s*quadrantChart/.test(e),"detector"),Ige=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-BknVxapP.js");return{diagram:t}},__vite__mapDeps([29,22,23,24]));return{id:w7,diagram:e}},"loader"),Dge={id:w7,detector:Lge,loader:Ige},Oge=Dge,k7="xychart",Bge=M(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Mge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-DLbY5Kg1.js");return{diagram:t}},__vite__mapDeps([30,23,28,22,24]));return{id:k7,diagram:e}},"loader"),Fge={id:k7,detector:Bge,loader:Mge},Pge=Fge,A7="requirement",jge=M(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Uge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-BlFXj6Li.js");return{diagram:t}},__vite__mapDeps([31,12,13]));return{id:A7,diagram:e}},"loader"),$ge={id:A7,detector:jge,loader:Uge},Hge=$ge,N7="sequence",zge=M(e=>/^\s*sequenceDiagram/.test(e),"detector"),qge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-D4mu07Ol.js");return{diagram:t}},__vite__mapDeps([32,18,9]));return{id:N7,diagram:e}},"loader"),Gge={id:N7,detector:zge,loader:qge},Wge=Gge,R7="class",Yge=M((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),Vge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-CVQD_QZa.js");return{diagram:t}},__vite__mapDeps([33,34,11,12,13,9]));return{id:R7,diagram:e}},"loader"),Xge={id:R7,detector:Yge,loader:Vge},Kge=Xge,L7="classDiagram",Zge=M((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Qge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-CVQD_QZa.js");return{diagram:t}},__vite__mapDeps([35,34,11,12,13,9]));return{id:L7,diagram:e}},"loader"),Jge={id:L7,detector:Zge,loader:Qge},ebe=Jge,I7="state",tbe=M((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),rbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-DSh1YMwZ.js");return{diagram:t}},__vite__mapDeps([36,37,12,13,9,2,4,3]));return{id:I7,diagram:e}},"loader"),ibe={id:I7,detector:tbe,loader:rbe},nbe=ibe,D7="stateDiagram",abe=M((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),sbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB-DrMkFhr2.js");return{diagram:t}},__vite__mapDeps([38,37,12,13,9]));return{id:D7,diagram:e}},"loader"),obe={id:D7,detector:abe,loader:sbe},lbe=obe,O7="journey",cbe=M(e=>/^\s*journey/.test(e),"detector"),ube=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-Bo6isp1w.js");return{diagram:t}},__vite__mapDeps([39,11,9,27]));return{id:O7,diagram:e}},"loader"),dbe={id:O7,detector:cbe,loader:ube},hbe=dbe,fbe=M((e,t,r)=>{$e.debug(`rendering svg for syntax error
|
|
461
|
-
`);const i=Hue(t),n=i.append("g");i.attr("viewBox","0 0 2412 512"),d6(i,100,512,!0),n.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"),n.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"),n.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"),n.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"),n.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"),n.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"),n.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"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),B7={draw:fbe},pbe=B7,mbe={db:{},renderer:B7,parser:{parse:M(()=>{},"parse")}},gbe=mbe,M7="flowchart-elk",bbe=M((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),ybe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-cs1YvuVH.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:M7,diagram:e}},"loader"),xbe={id:M7,detector:bbe,loader:ybe},_be=xbe,F7="timeline",Ebe=M(e=>/^\s*timeline/.test(e),"detector"),Cbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-DVZepywq.js");return{diagram:t}},__vite__mapDeps([40,27]));return{id:F7,diagram:e}},"loader"),vbe={id:F7,detector:Ebe,loader:Cbe},Sbe=vbe,P7="mindmap",Tbe=M(e=>/^\s*mindmap/.test(e),"detector"),wbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-l-cgg6PS.js");return{diagram:t}},__vite__mapDeps([41,12,13]));return{id:P7,diagram:e}},"loader"),kbe={id:P7,detector:Tbe,loader:wbe},Abe=kbe,j7="kanban",Nbe=M(e=>/^\s*kanban/.test(e),"detector"),Rbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-jM1azdC7.js");return{diagram:t}},__vite__mapDeps([42,11]));return{id:j7,diagram:e}},"loader"),Lbe={id:j7,detector:Nbe,loader:Rbe},Ibe=Lbe,U7="sankey",Dbe=M(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Obe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-Ck_A1wxA.js");return{diagram:t}},__vite__mapDeps([43,28,23]));return{id:U7,diagram:e}},"loader"),Bbe={id:U7,detector:Dbe,loader:Obe},Mbe=Bbe,$7="packet",Fbe=M(e=>/^\s*packet(-beta)?/.test(e),"detector"),Pbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-B5YEN-B-.js");return{diagram:t}},__vite__mapDeps([44,19,20]));return{id:$7,diagram:e}},"loader"),jbe={id:$7,detector:Fbe,loader:Pbe},H7="radar",Ube=M(e=>/^\s*radar-beta/.test(e),"detector"),$be=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-DVbqehF6.js");return{diagram:t}},__vite__mapDeps([45,19,20]));return{id:H7,diagram:e}},"loader"),Hbe={id:H7,detector:Ube,loader:$be},z7="block",zbe=M(e=>/^\s*block(-beta)?/.test(e),"detector"),qbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-DDQQ2PAJ.js");return{diagram:t}},__vite__mapDeps([46,11,2,14]));return{id:z7,diagram:e}},"loader"),Gbe={id:z7,detector:zbe,loader:qbe},Wbe=Gbe,q7="treeView",Ybe=M(e=>/^\s*treeView-beta/.test(e),"detector"),Vbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP-BXg_CQ2m.js");return{diagram:t}},__vite__mapDeps([47,18,19,20]));return{id:q7,diagram:e}},"loader"),Xbe={id:q7,detector:Ybe,loader:Vbe},Kbe=Xbe,G7="architecture",Zbe=M(e=>/^\s*architecture/.test(e),"detector"),Qbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-C_31NGnA.js");return{diagram:t}},__vite__mapDeps([48,19,20,7]));return{id:G7,diagram:e}},"loader"),Jbe={id:G7,detector:Zbe,loader:Qbe},e0e=Jbe,W7="eventmodeling",t0e=M(e=>/^\s*eventmodeling/.test(e),"detector"),r0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-5OBJqg6R.js");return{diagram:t}},__vite__mapDeps([49,19,20]));return{id:W7,diagram:e}},"loader"),i0e={id:W7,detector:t0e,loader:r0e},n0e=i0e,Y7="ishikawa",a0e=M(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),s0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-CDikxFR6.js");return{diagram:t}},[]);return{id:Y7,diagram:e}},"loader"),o0e={id:Y7,detector:a0e,loader:s0e},V7="venn",l0e=M(e=>/^\s*venn-beta/.test(e),"detector"),c0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-YqnYvNJT.js");return{diagram:t}},[]);return{id:V7,diagram:e}},"loader"),u0e={id:V7,detector:l0e,loader:c0e},d0e=u0e,X7="treemap",h0e=M(e=>/^\s*treemap/.test(e),"detector"),f0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-B2ZGPKp3.js");return{diagram:t}},__vite__mapDeps([50,19,13,20,24,28,23]));return{id:X7,diagram:e}},"loader"),p0e={id:X7,detector:h0e,loader:f0e},K7="wardley",m0e=M(e=>/^\s*wardley-beta/i.test(e),"detector"),g0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-Dc6PvPZE.js");return{diagram:t}},__vite__mapDeps([51,19,20]));return{id:K7,diagram:e}},"loader"),b0e={id:K7,detector:m0e,loader:g0e},y0e=b0e,Z7="cynefin",x0e=M(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),_0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-CuPa5A8w.js");return{diagram:t}},__vite__mapDeps([52,19,20]));return{id:Z7,diagram:e}},"loader"),E0e={id:Z7,detector:x0e,loader:_0e},Q7="railroad",C0e=M(e=>/^\s*railroad-beta/i.test(e),"detector"),v0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-D7Vohrlg.js");return{diagram:t}},__vite__mapDeps([53,54,19,20]));return{id:Q7,diagram:e}},"loader"),S0e={id:Q7,detector:C0e,loader:v0e},J7="railroadEbnf",T0e=M(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),w0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-hmnXWJuZ.js");return{diagram:t}},__vite__mapDeps([55,54,19,20]));return{id:J7,diagram:e}},"loader"),k0e={id:J7,detector:T0e,loader:w0e},e9="railroadAbnf",A0e=M(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),N0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-cQAiKjYG.js");return{diagram:t}},__vite__mapDeps([56,54,19,20]));return{id:e9,diagram:e}},"loader"),R0e={id:e9,detector:A0e,loader:N0e},t9="railroadPeg",L0e=M(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),I0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-B-8nGU3G.js");return{diagram:t}},__vite__mapDeps([57,54,19,20]));return{id:t9,diagram:e}},"loader"),D0e={id:t9,detector:L0e,loader:I0e},Z3=!1,M0=M(()=>{Z3||(Z3=!0,nb("error",gbe,e=>e.toLowerCase().trim()==="error"),nb("---",{db:{clear:M(()=>{},"clear")},styles:{},renderer:{draw:M(()=>{},"draw")},parser:{parse:M(()=>{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:M(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),z1(_be,Abe,e0e),z1(ege,Ibe,ebe,Kge,gge,Sge,kge,Rge,Hge,Wge,hge,lge,nge,Sbe,_ge,lbe,nbe,hbe,Oge,Mbe,jbe,Pge,Wbe,n0e,Kbe,Hbe,o0e,p0e,S0e,k0e,R0e,D0e,d0e,y0e,E0e))},"addDiagrams"),O0e=M(async()=>{$e.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(gc).map(async([r,{detector:i,loader:n}])=>{if(n)try{Y1(r)}catch{try{const{diagram:a,id:l}=await n();nb(l,a,i)}catch(a){throw $e.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete gc[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){$e.error(`Failed to load ${t.length} external diagrams`);for(const r of t)$e.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),B0e="graphics-document document";function r9(e,t){e.attr("role",B0e),t!==""&&e.attr("aria-roledescription",t)}M(r9,"setA11yDiagramInfo");function i9(e,t,r,i){if(e.insert!==void 0){if(r){const n=`chart-desc-${i}`;e.attr("aria-describedby",n),e.insert("desc",":first-child").attr("id",n).text(r)}if(t){const n=`chart-title-${i}`;e.attr("aria-labelledby",n),e.insert("title",":first-child").attr("id",n).text(t)}}}M(i9,"addSVGa11yTitleDescription");var lc,PE=(lc=class{constructor(t,r,i,n,a){this.type=t,this.text=r,this.db=i,this.parser=n,this.renderer=a}static async fromText(t,r={}){var u,h;const i=_i(),n=mw(t,i);t=Vhe(t)+`
|
|
460
|
+
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),kme=M((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-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"),Ame=M((e,t,r)=>{const i=_i(),{themeVariables:n}=i,{strokeWidth:a}=n,l=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");l.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),l.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),l.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),l.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Nme={extension:ome,composition:lme,aggregation:cme,dependency:ume,lollipop:dme,point:hme,circle:fme,cross:pme,barb:mme,barbNeo:gme,only_one:bme,zero_or_one:yme,one_or_more:xme,zero_or_more:_me,only_one_neo:Eme,zero_or_one_neo:Cme,one_or_more_neo:vme,zero_or_more_neo:Sme,requirement_arrow:Tme,requirement_contains:kme,requirement_arrow_neo:wme,requirement_contains_neo:Ame},Rme=sme,Lme={common:lp,getConfig:_i,insertCluster:wpe,insertEdge:ame,insertEdgeLabel:Qpe,insertMarkers:Rme,insertNode:s7,interpolateToCurve:Gw,labelHelper:Ot,log:$e,positionEdgeLabel:Jpe},jf={},u7=M(e=>{for(const t of e)jf[t.name]=t},"registerLayoutLoaders"),Ime=M(()=>{u7([{name:"dagre",loader:M(async()=>await Jt(()=>import("./dagre-VKFMJZFB-CGRMVLrv.js"),__vite__mapDeps([0,1,2,3,4])),"loader")},{name:"swimlane",loader:M(async()=>await Jt(()=>import("./swimlanes-5IMT3BWC-Doushgb5.js"),__vite__mapDeps([5,1,2,3])),"loader")},{name:"cose-bilkent",loader:M(async()=>await Jt(()=>import("./cose-bilkent-JH36ORCC-ET_pJkh9.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");Ime();var u1e=M(async(e,t,r)=>{if(!(e.layoutAlgorithm in jf))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const f of e.nodes){const b=f.domId||f.id;f.domId=`${e.diagramId}-${b}`}const i=jf[e.layoutAlgorithm],n=await i.loader(),{theme:a,themeVariables:l}=e.config,{useGradient:s,gradientStart:c,gradientStop:u}=l,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a!=null&&a.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a!=null&&a.includes("dark")?"#FFFFFF":"#000000"}`),s){const f=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");f.append("svg:stop").attr("offset","0%").attr("stop-color",c).attr("stop-opacity",1),f.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return n.render(e,t,Lme,{algorithm:i.algorithm},r)},"render"),d1e=M((e="",{fallback:t="dagre"}={})=>{if(e in jf)return e;if(t in jf)return $e.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),hk="comm",d7="rule",h7="decl",Dme="@media",Ome="@import",Bme="@supports",Mme="@namespace",OE="@keyframes",f7="@layer",Fme="@scope",Pme=Math.abs,_f=String.fromCharCode;function p7(e){return e.trim()}function BE(e,t,r){return e.replace(t,r)}function Bu(e,t){return e.charCodeAt(t)|0}function ud(e,t,r){return e.slice(t,r)}function Ns(e){return e.length}function m7(e){return e.length}function Jm(e,t){return t.push(e),e}var O0=1,dd=1,g7=0,Ha=0,ji=0,Nd="";function fk(e,t,r,i,n,a,l,s){return{value:e,root:t,parent:r,type:i,props:n,children:a,line:O0,column:dd,length:l,return:"",siblings:s}}function jme(){return ji}function Ume(){return ji=Ha>0?Bu(Nd,--Ha):0,dd--,ji===10&&(dd=1,O0--),ji}function ns(){return ji=Ha<g7?Bu(Nd,Ha++):0,dd++,ji===10&&(dd=1,O0++),ji}function ll(){return Bu(Nd,Ha)}function Rg(){return Ha}function B0(e,t){return ud(Nd,e,t)}function Uf(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $me(e){return O0=dd=1,g7=Ns(Nd=e),Ha=0,[]}function Hme(e){return Nd="",e}function V_(e){return p7(B0(Ha-1,ME(e===91?e+2:e===40?e+1:e)))}function zme(e){for(;(ji=ll())&&ji<33;)ns();return Uf(e)>2||Uf(ji)>3?"":" "}function qme(e,t){for(;--t&&ns()&&!(ji<48||ji>102||ji>57&&ji<65||ji>70&&ji<97););return B0(e,Rg()+(t<6&&ll()==32&&ns()==32))}function ME(e){for(;ns();)switch(ji){case e:return Ha;case 34:case 39:e!==34&&e!==39&&ME(ji);break;case 40:e===41&&ME(e);break;case 92:ns();break}return Ha}function Gme(e,t){for(;ns()&&e+ji!==57;)if(e+ji===84&&ll()===47)break;return"/*"+B0(t,Ha-1)+"*"+_f(e===47?e:ns())}function Wme(e){for(;!Uf(ll());)ns();return B0(e,Ha)}function Yme(e){return Hme(Lg("",null,null,null,[""],e=$me(e),0,[0],e))}function Lg(e,t,r,i,n,a,l,s,c){for(var u=0,h=0,f=l,b=0,g=0,v=0,C=1,y=1,x=1,E=0,S=0,T="",A=n,k=a,L=i,N=T;y;)switch(v=S,S=ns()){case 40:v!=108&&Bu(N,f-1)==58?(E++,N+="("):N+=V_(S);break;case 41:E--,N+=")";break;case 34:case 39:case 91:N+=V_(S);break;case 9:case 10:case 13:case 32:if(E>0){N+=_f(S);break}N+=zme(v);break;case 92:N+=qme(Rg()-1,7);continue;case 47:switch(ll()){case 42:case 47:Jm(Vme(Gme(ns(),Rg()),t,r,c),c),(Uf(v||1)==5||Uf(ll()||1)==5)&&Ns(N)&&ud(N,-1,void 0)!==" "&&(N+=" ");break;default:N+="/"}break;case 123*C:s[u++]=Ns(N)*x;case 125*C:case 59:case 0:if(E>0&&S){N+=_f(S);break}switch(S){case 0:case 125:y=0;case 59+h:x==-1&&(N=BE(N,/\f/g,"")),g>0&&(Ns(N)-f||C===0)&&Jm(g>32?K3(N+";",i,r,f-1,c):K3(BE(N," ","")+";",i,r,f-2,c),c);break;case 59:N+=";";default:if(Jm(L=X3(N,t,r,u,h,n,s,T,A=[],k=[],f,a),a),S===123)if(h===0)Lg(N,t,L,L,A,a,f,s,k);else{switch(b){case 99:if(Bu(N,3)===110)break;case 108:if(Bu(N,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Lg(e,L,L,i&&Jm(X3(e,L,L,0,0,n,s,T,n,A=[],f,k),k),n,k,f,s,i?A:k):Lg(N,L,L,L,[""],k,0,s,k)}}u=h=g=0,C=x=1,T=N="",f=l;break;case 58:f=1+Ns(N),g=v;default:if(C<1){if(S==123)--C;else if(S==125&&C++==0&&Ume()==125)continue}switch(N+=_f(S),S*C){case 38:x=h>0?1:(N+="\f",-1);break;case 44:if(E>0)break;s[u++]=(Ns(N)-1)*x,x=1;break;case 64:ll()===45&&(N+=V_(ns())),b=ll(),h=f=Ns(T=N+=Wme(Rg())),S++;break;case 45:v===45&&Ns(N)==2&&(C=0)}}return a}function X3(e,t,r,i,n,a,l,s,c,u,h,f){for(var b=n-1,g=n===0?a:[""],v=m7(g),C=0,y=0,x=0;C<i;++C)for(var E=0,S=ud(e,b+1,b=Pme(y=l[C])),T=e;E<v;++E)(T=p7(y>0?g[E]+" "+S:BE(S,/&\f/g,g[E])))&&(c[x++]=T);return fk(e,t,r,n===0?d7:s,c,u,h,f)}function Vme(e,t,r,i){return fk(e,t,r,hk,_f(jme()),ud(e,2,-2),0,i)}function K3(e,t,r,i,n){return fk(e,t,r,h7,ud(e,0,i),ud(e,i+1,-1),i,n)}function FE(e,t){for(var r="",i=0;i<e.length;i++)r+=t(e[i],i,e,t)||"";return r}function Xme(e,t,r,i){switch(e.type){case f7:if(e.children.length)break;case Ome:case Mme:case h7:return e.return=e.return||e.value;case hk:return"";case OE:return e.return=e.value+"{"+FE(e.children,i)+"}";case d7:if(!Ns(e.value=e.props.join(",")))return""}return Ns(r=FE(e.children,i))?e.return=e.value+"{"+r+"}":""}function Kme(e){var t=m7(e);return function(r,i,n,a){for(var l="",s=0;s<t;s++)l+=e[s](r,i,n,a)||"";return l}}var b7="c4",Zme=M(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Qme=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-BMJArETU.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:b7,diagram:e}},"loader"),Jme={id:b7,detector:Zme,loader:Qme},ege=Jme,y7="flowchart",tge=M((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),rge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-Bov8ggVs.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:y7,diagram:e}},"loader"),ige={id:y7,detector:tge,loader:rge},nge=ige,x7="flowchart-v2",age=M((e,t)=>{var r,i,n;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),sge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-Bov8ggVs.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:x7,diagram:e}},"loader"),oge={id:x7,detector:age,loader:sge},lge=oge,_7="swimlane",cge=M(e=>/^\s*swimlane-beta\b/.test(e),"detector"),uge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-Dye5Ycrr.js");return{diagram:t}},__vite__mapDeps([15,10,11,12,13,9,14]));return{id:_7,diagram:e}},"loader"),dge={id:_7,detector:cge,loader:uge},hge=dge,E7="er",fge=M(e=>/^\s*erDiagram/.test(e),"detector"),pge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-CbreGRUM.js");return{diagram:t}},__vite__mapDeps([16,12,13,14]));return{id:E7,diagram:e}},"loader"),mge={id:E7,detector:fge,loader:pge},gge=mge,C7="gitGraph",bge=M(e=>/^\s*gitGraph/.test(e),"detector"),yge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-CB0I9Jzz.js");return{diagram:t}},__vite__mapDeps([17,18,19,20]));return{id:C7,diagram:e}},"loader"),xge={id:C7,detector:bge,loader:yge},_ge=xge,v7="gantt",Ege=M(e=>/^\s*gantt/.test(e),"detector"),Cge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-DI2TRBdA.js");return{diagram:t}},__vite__mapDeps([21,22,23,24]));return{id:v7,diagram:e}},"loader"),vge={id:v7,detector:Ege,loader:Cge},Sge=vge,S7="info",Tge=M(e=>/^\s*info/.test(e),"detector"),wge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-DrF8yTwW.js");return{diagram:t}},__vite__mapDeps([25,20]));return{id:S7,diagram:e}},"loader"),kge={id:S7,detector:Tge,loader:wge},T7="pie",Age=M(e=>/^\s*pie/.test(e),"detector"),Nge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-DcXwgn9I.js");return{diagram:t}},__vite__mapDeps([26,19,20,27,28,23]));return{id:T7,diagram:e}},"loader"),Rge={id:T7,detector:Age,loader:Nge},w7="quadrantChart",Lge=M(e=>/^\s*quadrantChart/.test(e),"detector"),Ige=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-BzeoX11K.js");return{diagram:t}},__vite__mapDeps([29,22,23,24]));return{id:w7,diagram:e}},"loader"),Dge={id:w7,detector:Lge,loader:Ige},Oge=Dge,k7="xychart",Bge=M(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Mge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-DUrmfVTr.js");return{diagram:t}},__vite__mapDeps([30,23,28,22,24]));return{id:k7,diagram:e}},"loader"),Fge={id:k7,detector:Bge,loader:Mge},Pge=Fge,A7="requirement",jge=M(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Uge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-Bvv4E9CW.js");return{diagram:t}},__vite__mapDeps([31,12,13]));return{id:A7,diagram:e}},"loader"),$ge={id:A7,detector:jge,loader:Uge},Hge=$ge,N7="sequence",zge=M(e=>/^\s*sequenceDiagram/.test(e),"detector"),qge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-DigLSZlS.js");return{diagram:t}},__vite__mapDeps([32,18,9]));return{id:N7,diagram:e}},"loader"),Gge={id:N7,detector:zge,loader:qge},Wge=Gge,R7="class",Yge=M((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),Vge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-CVG8E0VE.js");return{diagram:t}},__vite__mapDeps([33,34,11,12,13,9]));return{id:R7,diagram:e}},"loader"),Xge={id:R7,detector:Yge,loader:Vge},Kge=Xge,L7="classDiagram",Zge=M((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Qge=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-CVG8E0VE.js");return{diagram:t}},__vite__mapDeps([35,34,11,12,13,9]));return{id:L7,diagram:e}},"loader"),Jge={id:L7,detector:Zge,loader:Qge},ebe=Jge,I7="state",tbe=M((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),rbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-BaIapwPh.js");return{diagram:t}},__vite__mapDeps([36,37,12,13,9,2,4,3]));return{id:I7,diagram:e}},"loader"),ibe={id:I7,detector:tbe,loader:rbe},nbe=ibe,D7="stateDiagram",abe=M((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),sbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB-DZNVilCm.js");return{diagram:t}},__vite__mapDeps([38,37,12,13,9]));return{id:D7,diagram:e}},"loader"),obe={id:D7,detector:abe,loader:sbe},lbe=obe,O7="journey",cbe=M(e=>/^\s*journey/.test(e),"detector"),ube=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-BRfaIEic.js");return{diagram:t}},__vite__mapDeps([39,11,9,27]));return{id:O7,diagram:e}},"loader"),dbe={id:O7,detector:cbe,loader:ube},hbe=dbe,fbe=M((e,t,r)=>{$e.debug(`rendering svg for syntax error
|
|
461
|
+
`);const i=Hue(t),n=i.append("g");i.attr("viewBox","0 0 2412 512"),d6(i,100,512,!0),n.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"),n.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"),n.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"),n.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"),n.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"),n.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"),n.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"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),B7={draw:fbe},pbe=B7,mbe={db:{},renderer:B7,parser:{parse:M(()=>{},"parse")}},gbe=mbe,M7="flowchart-elk",bbe=M((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),ybe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-Bov8ggVs.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([10,11,12,13,9,14]));return{id:M7,diagram:e}},"loader"),xbe={id:M7,detector:bbe,loader:ybe},_be=xbe,F7="timeline",Ebe=M(e=>/^\s*timeline/.test(e),"detector"),Cbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-DQXoUYQ4.js");return{diagram:t}},__vite__mapDeps([40,27]));return{id:F7,diagram:e}},"loader"),vbe={id:F7,detector:Ebe,loader:Cbe},Sbe=vbe,P7="mindmap",Tbe=M(e=>/^\s*mindmap/.test(e),"detector"),wbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-D7f8ON4e.js");return{diagram:t}},__vite__mapDeps([41,12,13]));return{id:P7,diagram:e}},"loader"),kbe={id:P7,detector:Tbe,loader:wbe},Abe=kbe,j7="kanban",Nbe=M(e=>/^\s*kanban/.test(e),"detector"),Rbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-BSSDB9_O.js");return{diagram:t}},__vite__mapDeps([42,11]));return{id:j7,diagram:e}},"loader"),Lbe={id:j7,detector:Nbe,loader:Rbe},Ibe=Lbe,U7="sankey",Dbe=M(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Obe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-0MJhpRfa.js");return{diagram:t}},__vite__mapDeps([43,28,23]));return{id:U7,diagram:e}},"loader"),Bbe={id:U7,detector:Dbe,loader:Obe},Mbe=Bbe,$7="packet",Fbe=M(e=>/^\s*packet(-beta)?/.test(e),"detector"),Pbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-Cjp8mQVX.js");return{diagram:t}},__vite__mapDeps([44,19,20]));return{id:$7,diagram:e}},"loader"),jbe={id:$7,detector:Fbe,loader:Pbe},H7="radar",Ube=M(e=>/^\s*radar-beta/.test(e),"detector"),$be=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-BdjsSjwC.js");return{diagram:t}},__vite__mapDeps([45,19,20]));return{id:H7,diagram:e}},"loader"),Hbe={id:H7,detector:Ube,loader:$be},z7="block",zbe=M(e=>/^\s*block(-beta)?/.test(e),"detector"),qbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-DpbPXGGb.js");return{diagram:t}},__vite__mapDeps([46,11,2,14]));return{id:z7,diagram:e}},"loader"),Gbe={id:z7,detector:zbe,loader:qbe},Wbe=Gbe,q7="treeView",Ybe=M(e=>/^\s*treeView-beta/.test(e),"detector"),Vbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP-BHpTOief.js");return{diagram:t}},__vite__mapDeps([47,18,19,20]));return{id:q7,diagram:e}},"loader"),Xbe={id:q7,detector:Ybe,loader:Vbe},Kbe=Xbe,G7="architecture",Zbe=M(e=>/^\s*architecture/.test(e),"detector"),Qbe=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-CEunclu9.js");return{diagram:t}},__vite__mapDeps([48,19,20,7]));return{id:G7,diagram:e}},"loader"),Jbe={id:G7,detector:Zbe,loader:Qbe},e0e=Jbe,W7="eventmodeling",t0e=M(e=>/^\s*eventmodeling/.test(e),"detector"),r0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-Dasgaqiu.js");return{diagram:t}},__vite__mapDeps([49,19,20]));return{id:W7,diagram:e}},"loader"),i0e={id:W7,detector:t0e,loader:r0e},n0e=i0e,Y7="ishikawa",a0e=M(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),s0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-DUB8-IzB.js");return{diagram:t}},[]);return{id:Y7,diagram:e}},"loader"),o0e={id:Y7,detector:a0e,loader:s0e},V7="venn",l0e=M(e=>/^\s*venn-beta/.test(e),"detector"),c0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-DqoXPumC.js");return{diagram:t}},[]);return{id:V7,diagram:e}},"loader"),u0e={id:V7,detector:l0e,loader:c0e},d0e=u0e,X7="treemap",h0e=M(e=>/^\s*treemap/.test(e),"detector"),f0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-DZqXpbK0.js");return{diagram:t}},__vite__mapDeps([50,19,13,20,24,28,23]));return{id:X7,diagram:e}},"loader"),p0e={id:X7,detector:h0e,loader:f0e},K7="wardley",m0e=M(e=>/^\s*wardley-beta/i.test(e),"detector"),g0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-CjaK_50N.js");return{diagram:t}},__vite__mapDeps([51,19,20]));return{id:K7,diagram:e}},"loader"),b0e={id:K7,detector:m0e,loader:g0e},y0e=b0e,Z7="cynefin",x0e=M(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),_0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-Br7gbIt6.js");return{diagram:t}},__vite__mapDeps([52,19,20]));return{id:Z7,diagram:e}},"loader"),E0e={id:Z7,detector:x0e,loader:_0e},Q7="railroad",C0e=M(e=>/^\s*railroad-beta/i.test(e),"detector"),v0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-DPa8V-DS.js");return{diagram:t}},__vite__mapDeps([53,54,19,20]));return{id:Q7,diagram:e}},"loader"),S0e={id:Q7,detector:C0e,loader:v0e},J7="railroadEbnf",T0e=M(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),w0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-D3GJit-t.js");return{diagram:t}},__vite__mapDeps([55,54,19,20]));return{id:J7,diagram:e}},"loader"),k0e={id:J7,detector:T0e,loader:w0e},e9="railroadAbnf",A0e=M(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),N0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-B_fP8Vz_.js");return{diagram:t}},__vite__mapDeps([56,54,19,20]));return{id:e9,diagram:e}},"loader"),R0e={id:e9,detector:A0e,loader:N0e},t9="railroadPeg",L0e=M(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),I0e=M(async()=>{const{diagram:e}=await Jt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-BWLmrzb8.js");return{diagram:t}},__vite__mapDeps([57,54,19,20]));return{id:t9,diagram:e}},"loader"),D0e={id:t9,detector:L0e,loader:I0e},Z3=!1,M0=M(()=>{Z3||(Z3=!0,nb("error",gbe,e=>e.toLowerCase().trim()==="error"),nb("---",{db:{clear:M(()=>{},"clear")},styles:{},renderer:{draw:M(()=>{},"draw")},parser:{parse:M(()=>{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:M(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),z1(_be,Abe,e0e),z1(ege,Ibe,ebe,Kge,gge,Sge,kge,Rge,Hge,Wge,hge,lge,nge,Sbe,_ge,lbe,nbe,hbe,Oge,Mbe,jbe,Pge,Wbe,n0e,Kbe,Hbe,o0e,p0e,S0e,k0e,R0e,D0e,d0e,y0e,E0e))},"addDiagrams"),O0e=M(async()=>{$e.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(gc).map(async([r,{detector:i,loader:n}])=>{if(n)try{Y1(r)}catch{try{const{diagram:a,id:l}=await n();nb(l,a,i)}catch(a){throw $e.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete gc[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){$e.error(`Failed to load ${t.length} external diagrams`);for(const r of t)$e.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),B0e="graphics-document document";function r9(e,t){e.attr("role",B0e),t!==""&&e.attr("aria-roledescription",t)}M(r9,"setA11yDiagramInfo");function i9(e,t,r,i){if(e.insert!==void 0){if(r){const n=`chart-desc-${i}`;e.attr("aria-describedby",n),e.insert("desc",":first-child").attr("id",n).text(r)}if(t){const n=`chart-title-${i}`;e.attr("aria-labelledby",n),e.insert("title",":first-child").attr("id",n).text(t)}}}M(i9,"addSVGa11yTitleDescription");var lc,PE=(lc=class{constructor(t,r,i,n,a){this.type=t,this.text=r,this.db=i,this.parser=n,this.renderer=a}static async fromText(t,r={}){var u,h;const i=_i(),n=mw(t,i);t=Vhe(t)+`
|
|
462
462
|
`;try{Y1(n)}catch{const f=Mse(n);if(!f)throw new a6(`Diagram ${n} not found.`);const{id:b,diagram:g}=await f();nb(b,g)}const{db:a,parser:l,renderer:s,init:c}=Y1(n);return l.parser&&(l.parser.yy=a),(u=a.clear)==null||u.call(a),c==null||c(i),r.title&&((h=a.setDiagramTitle)==null||h.call(a,r.title)),await l.parse(t),new lc(n,t,a,l,s)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},M(lc,"Diagram"),lc),Q3=[],M0e=M(()=>{Q3.forEach(e=>{e()}),Q3=[]},"attachFunctions"),F0e=M(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function n9(e){const t=e.match(n6);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(`
|
|
463
463
|
`).map(l=>l.startsWith(r)?l.slice(r.length):l).join(`
|
|
464
464
|
`):t[2];let n=Xde(i,{schema:Vde})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const a={};return n.displayMode&&(a.displayMode=n.displayMode.toString()),n.title&&(a.title=n.title.toString()),n.config&&(a.config=n.config),{text:e.slice(t[0].length),metadata:a}}M(n9,"extractFrontMatter");var P0e=M(e=>e.replace(/\r\n?/g,`
|
|
@@ -493,4 +493,4 @@ ${k}
|
|
|
493
493
|
`),i("generated")},S=()=>{i("input"),a(""),g(void 0)};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"flex h-full flex-col space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ib,{d:Uxe,className:"h-4 w-4 text-primary"}),p.jsx("h1",{className:"text-lg font-semibold",children:"PRD Wizard"})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Describe a high-level change request in plain language. The wizard generates a",p.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5 text-xs",children:"prd_updates"}),"markdown and a Claude Code skill hand-off — paste it in the Terminal below to apply."]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm",children:"Change Request"})}),p.jsxs(St,{className:"space-y-2 px-4 pb-4",children:[p.jsx("textarea",{rows:4,value:n,onChange:T=>a(T.target.value),placeholder:"e.g. Add drag-resize to the sidebar so users can allocate more screen space to the content panel.",className:"w-full resize-y rounded-md border border-input bg-background p-2 font-mono text-xs","data-testid":"wizard-change-request"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx(Ie,{className:"h-8 gap-1 px-3 text-sm",disabled:r==="generating"||!y||x,onClick:E,"data-testid":"wizard-generate",children:r==="generating"?"Generating…":"Generate PRD updates"}),p.jsx(Ie,{variant:"outline",className:"h-8 px-2 text-xs",onClick:()=>C(!0),"data-testid":"wizard-shared-context",children:"Shared Context"}),b&&p.jsx("p",{className:"text-xs text-destructive","data-testid":"wizard-error",children:b}),x&&p.jsxs("p",{className:"text-xs text-amber-600","data-testid":"wizard-version-locked",children:[y==null?void 0:y.semver," is a read-only prior version — switch to the current version in the topbar to generate PRD updates."]})]})]})]}),r==="generated"&&p.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto","data-testid":"wizard-generated",children:[p.jsxs(Et,{children:[p.jsxs(Qt,{className:"px-4 pb-2 pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ib,{d:$xe,className:"h-4 w-4 text-primary"}),p.jsx(nr,{className:"text-sm",children:"Generated: prd_updates.md"})]}),p.jsx(gO,{text:l,testid:"wizard-copy-markdown"})]}),p.jsx("p",{className:"pt-1 font-mono text-[10px] text-muted-foreground",children:c})]}),p.jsx(St,{className:"px-4 pb-4",children:p.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-[11px] leading-relaxed",children:l})})]}),p.jsxs(Et,{className:"border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-950/20",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm text-blue-800 dark:text-blue-300",children:"Next step"})}),p.jsxs(St,{className:"space-y-3 px-4 pb-4",children:[p.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-400",children:"Paste this command in the Terminal to apply updates to PRD.md:"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("code",{className:"flex-1 rounded bg-zinc-900 px-2 py-1.5 font-mono text-xs text-green-400","data-testid":"wizard-skill-command",children:h}),p.jsx(gO,{text:h,testid:"wizard-copy-command"})]}),p.jsxs("div",{className:"space-y-0.5 rounded-md bg-blue-100/60 p-2 text-[10px] text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",children:[p.jsx("p",{className:"font-medium",children:"This will:"}),p.jsx("p",{children:"✓ Apply the PRD updates to PRD.md"}),p.jsx("p",{children:"✓ Tag new items with immutable IDs"}),p.jsx("p",{children:"✓ Append the run to CHANGELOG.md"})]})]})]}),p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:S,"data-testid":"wizard-new-request",children:"Start new request"})]})]}),p.jsx(bk,{projectId:t,open:v,onOpenChange:C,onPick:T=>{const A=gk(T);a(k=>k?`${k}
|
|
494
494
|
${A}`:A),C(!1)}})]})}function sg({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const Gxe="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4",Wxe="M5 12h14M12 5v14",bO="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3ZM12 9v4M12 17h.01",Yxe={open:"border-transparent bg-muted text-muted-foreground",in_fix:"border-transparent bg-blue-100 text-blue-700",fixed:"border-transparent bg-green-100 text-green-700",verified:"border-transparent bg-green-100 text-green-700",closed:"border-transparent bg-primary text-primary-foreground"},Vxe="h-8 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring";function Xxe(){const{id:e}=an(),t=Number(e),r=nn(),[i,n]=U.useState(null),[a,l]=U.useState(null),[s,c]=U.useState([]),[u,h]=U.useState(0),[f,b]=U.useState(0),[g,v]=U.useState(!0),[C,y]=U.useState(""),[x,E]=U.useState("all"),{application:S,version:T}=cs(),A=(S==null?void 0:S.id)??null,k=(T==null?void 0:T.id)??null,L=rn().search;U.useEffect(()=>{we.projects.get(t).then(B=>n(B.data??null)),we.quality.canReport(t).then(B=>{var $;return l((($=B.data)==null?void 0:$.canReport)??!1)})},[t]),U.useEffect(()=>{b(0)},[A,k]);const N=()=>{v(!0),we.quality.list(t,{applicationId:A??void 0,prdVersionId:k??void 0,status:x==="all"?void 0:x,search:C||void 0},Vl,f*Vl).then(B=>{var $,Y;c((($=B.data)==null?void 0:$.items)??[]),h(((Y=B.data)==null?void 0:Y.total)??0)}).finally(()=>v(!1))};U.useEffect(N,[t,f,C,x,A,k]);const O=Math.max(1,Math.ceil(u/Vl));return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(sg,{d:Gxe,className:"h-4 w-4 text-muted-foreground"}),p.jsx("h1",{className:"text-lg font-semibold",children:"Quality"}),i&&p.jsx(ir,{variant:"secondary",children:i.name}),S&&T&&p.jsxs("span",{className:"text-xs text-muted-foreground","data-testid":"quality-scope-label",children:[S.name," · ",T.semver]})]}),a&&p.jsx(ri,{to:`/projects/${t}/quality/new${L}`,children:p.jsxs(Ie,{size:"sm",className:"h-8 gap-1 text-xs","data-testid":"quality-report-issue",children:[p.jsx(sg,{d:Wxe,className:"h-3.5 w-3.5"}),"Report Issue"]})})]}),a===!1&&p.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200","data-testid":"quality-gate-notice",children:[p.jsx(sg,{d:bO,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),p.jsx("span",{children:"Quality is available once conductor-develop has COMPLETED for this application. Reporting unlocks after the first develop run."})]}),a&&p.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-800 dark:border-blue-900 dark:bg-blue-950 dark:text-blue-200","data-testid":"quality-banner",children:[p.jsx(sg,{d:bO,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),p.jsxs("span",{children:["Quality is available per-application once conductor-develop has COMPLETED. Issues reported here generate ",p.jsx("code",{children:"BUG.md"})," for each application, which drives the conductor-defect (quality) phase."]})]}),p.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.jsx(Xt,{placeholder:"Search issues…",value:C,onChange:B=>{y(B.target.value),b(0)},className:"h-8 w-48 text-xs","data-testid":"quality-search"}),p.jsxs("select",{className:Vxe,value:x,onChange:B=>{E(B.target.value),b(0)},"aria-label":"Status","data-testid":"quality-filter-status",children:[p.jsx("option",{value:"all",children:"All statuses"}),p.jsx("option",{value:"open",children:"Open"}),p.jsx("option",{value:"in_fix",children:"In Fix"}),p.jsx("option",{value:"fixed",children:"Fixed"}),p.jsx("option",{value:"verified",children:"Verified"}),p.jsx("option",{value:"closed",children:"Closed"})]})]}),p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:p.jsxs(gp,{"data-testid":"quality-table",children:[p.jsx(bp,{children:p.jsxs(Ua,{children:[p.jsx(pi,{className:"text-xs",children:"ID"}),p.jsx(pi,{className:"text-xs",children:"Title"}),p.jsx(pi,{className:"text-xs",children:"Status"}),p.jsx(pi,{className:"text-xs",children:"Related"}),p.jsx(pi,{className:"text-xs",children:"Reported"})]})}),p.jsx(yp,{children:g?p.jsx(Ua,{children:p.jsx(ti,{colSpan:5,className:"py-6 text-center text-xs text-muted-foreground",children:"Loading…"})}):s.length===0?p.jsx(Ua,{children:p.jsx(ti,{colSpan:5,className:"py-6 text-center text-xs text-muted-foreground","data-testid":"quality-empty",children:"No issues match the current application, version and filters."})}):s.map(B=>p.jsxs(Ua,{"data-testid":`quality-row-${B.id}`,className:"cursor-pointer",onClick:()=>r(`/projects/${t}/quality/${B.id}${L}`),children:[p.jsxs(ti,{className:"font-mono text-xs text-muted-foreground",children:["#",B.id]}),p.jsx(ti,{className:"max-w-xs truncate text-xs",title:B.title,children:B.title}),p.jsx(ti,{children:p.jsx(ir,{className:`text-[10px] capitalize ${Yxe[B.status]}`,children:B.status.replace("_"," ")})}),p.jsx(ti,{className:"font-mono text-xs",children:B.relatedRequirementId??"—"}),p.jsxs(ti,{className:"text-xs text-muted-foreground",children:[B.reporterName??`user #${B.reportedBy}`," ·"," ",B.createdAt.slice(0,10)]})]},B.id))})]})})}),u>Vl&&p.jsxs("div",{className:"flex items-center justify-between pt-1",children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",f*Vl+1,"–",Math.min((f+1)*Vl,u)," of ",u]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm","data-testid":"quality-page-prev",onClick:()=>b(B=>Math.max(0,B-1)),disabled:f===0,children:"Previous"}),p.jsxs("span",{className:"text-xs text-muted-foreground","data-testid":"quality-page-indicator",children:["Page ",f+1," of ",O]}),p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm","data-testid":"quality-page-next",onClick:()=>b(B=>Math.min(O-1,B+1)),disabled:f>=O-1,children:"Next"})]})]})]})})}function yO({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const Kxe="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4",Zxe="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3ZM12 9v4M12 17h.01",Qxe={open:"border-transparent bg-muted text-muted-foreground",in_fix:"border-transparent bg-blue-100 text-blue-700",fixed:"border-transparent bg-green-100 text-green-700",verified:"border-transparent bg-green-100 text-green-700",closed:"border-transparent bg-primary text-primary-foreground"},Jxe="h-8 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring";function e_e(){var D,j;const{id:e,bugId:t}=an(),r=Number(e),i=Number(t),n=rn().search,[a,l]=U.useState(null),[s,c]=U.useState(!1),[u,h]=U.useState(null),[f,b]=U.useState([]),[g,v]=U.useState(""),[C,y]=U.useState(""),[x,E]=U.useState(""),[S,T]=U.useState(!1),[A,k]=U.useState(null),[L,N]=U.useState(),[O,B]=U.useState(!1),[$,Y]=U.useState(!1),H=()=>{we.quality.get(i).then(K=>{if(!K.ok||!K.data||K.data.projectId!==r){c(!0);return}l(K.data),v(K.data.title),y(K.data.description??""),E(K.data.relatedRequirementId??"")})};U.useEffect(()=>{H(),we.projects.get(r).then(K=>h(K.data??null)),we.versions.list(r).then(K=>b(K.data??[]))},[r,i]);const W=a!==null&&uz.includes(a.status),z=W&&g.trim().length>0&&!S,F=a?((D=u==null?void 0:u.applications.find(K=>K.id===a.applicationId))==null?void 0:D.name)??`#${a.applicationId}`:"",X=((j=f.find(K=>K.id===(a==null?void 0:a.prdVersionId)))==null?void 0:j.semver)??"—",G=async()=>{if(!z)return;N(void 0),T(!0);const K=await we.quality.update(i,{title:g.trim(),description:C.trim()||void 0,relatedRequirementId:x.trim()||void 0});T(!1),K.ok?(k(new Date().toISOString()),H()):N("Saving failed. The issue may no longer be editable — reload and try again.")},P=async K=>{N(void 0),(await we.quality.updateStatus(i,K)).ok?H():N("Status change failed.")};return p.jsx(Cr,{children:p.jsxs("div",{className:"flex h-full flex-col space-y-4 p-4",children:[p.jsxs("nav",{className:"flex items-center gap-1.5 text-xs text-muted-foreground","aria-label":"Breadcrumb",children:[p.jsx(ri,{to:"/projects",className:"hover:text-foreground",children:"Home"}),p.jsx("span",{"aria-hidden":!0,children:"/"}),p.jsx(ri,{to:`/projects/${r}/quality${n}`,className:"hover:text-foreground",children:"Quality"}),p.jsx("span",{"aria-hidden":!0,children:"/"}),p.jsxs("span",{className:"text-foreground",children:["Issue #",i]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(yO,{d:Kxe,className:"h-4 w-4 text-muted-foreground"}),p.jsxs("h1",{className:"text-lg font-semibold",children:["Quality Issue #",i]}),u&&p.jsx(ir,{variant:"secondary",children:u.name}),a&&p.jsx(ir,{className:`text-[10px] capitalize ${Qxe[a.status]}`,"data-testid":"quality-detail-status-badge",children:a.status.replace("_"," ")})]}),s&&p.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"quality-detail-not-found",children:"This issue does not exist in this project."}),a&&p.jsxs(Et,{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Issue Details"}),p.jsxs(en,{className:"text-xs",children:[F," · ",X," · ",a.module??"Common"," · reported by"," ",a.reporterName??`user #${a.reportedBy}`," on ",a.createdAt.slice(0,10)]})]}),p.jsxs(St,{className:"flex min-h-0 flex-1 flex-col space-y-4 overflow-y-auto",children:[!W&&p.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200","data-testid":"quality-detail-readonly-notice",children:[p.jsx(yO,{d:Zxe,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),p.jsxs("span",{children:["This issue is"," ",p.jsx("strong",{className:"capitalize",children:a.status.replace("_"," ")})," and can no longer be edited — the report stays as the fix was built against it. Only the lifecycle status can still change."]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-detail-title",className:"text-xs",children:"Issue Title"}),p.jsx(Xt,{id:"quality-detail-title",className:"text-sm",value:g,readOnly:!W,onChange:K=>v(K.target.value),"data-testid":"quality-detail-title"})]}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-1.5",children:[p.jsx(jt,{className:"text-xs",children:"Description"}),p.jsx("div",{className:"min-h-[220px] flex-1",children:p.jsx(ss,{value:C,onChange:y,height:"100%",className:"h-full rounded-md border border-border",readOnly:!W,previewOnly:!W,placeholder:"Steps to reproduce, expected vs actual behaviour, environment details…",testId:"quality-detail-description"})})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-detail-status",className:"text-xs",children:"Status"}),p.jsxs("select",{id:"quality-detail-status",className:`${Jxe} w-full`,value:a.status,onChange:K=>P(K.target.value),"data-testid":"quality-detail-status",children:[p.jsx("option",{value:"open",children:"Open"}),p.jsx("option",{value:"in_fix",children:"In Fix"}),p.jsx("option",{value:"fixed",children:"Fixed"}),p.jsx("option",{value:"verified",children:"Verified"}),p.jsx("option",{value:"closed",children:"Closed"})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-detail-related",className:"text-xs",children:"Related User Story (optional)"}),p.jsx(Xt,{id:"quality-detail-related",className:"font-mono text-xs",value:x,readOnly:!W,onChange:K=>E(K.target.value),"data-testid":"quality-detail-related"})]})]}),L&&p.jsx("p",{className:"text-xs text-destructive",children:L}),A&&!L&&p.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"quality-detail-saved",children:"Saved."}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[W&&p.jsx(Ie,{size:"sm",className:"h-8 text-xs",disabled:!z,onClick:G,"data-testid":"quality-detail-save",children:S?"Saving…":"Save Changes"}),p.jsx(ri,{to:`/projects/${r}/quality${n}`,children:p.jsx(Ie,{variant:"outline",size:"sm",className:"h-8 text-xs",children:"Back to Quality"})})]})]})]})]})})}function xO({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const t_e="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4",r_e="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3ZM12 9v4M12 17h.01",_O="h-8 w-full rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring";function i_e(){const{id:e}=an(),t=Number(e),r=nn(),i=rn().search,{application:n}=cs(),[a,l]=U.useState(null),[s,c]=U.useState(""),[u,h]=U.useState(""),[f,b]=U.useState(""),[g,v]=U.useState("open"),[C,y]=U.useState(""),[x,E]=U.useState([]),[S,T]=U.useState(""),[A,k]=U.useState(null),[L,N]=U.useState(!1),[O,B]=U.useState();U.useEffect(()=>{we.projects.get(t).then(z=>l(z.data??null)),we.versions.list(t).then(z=>{const F=(z.data??[]).find(X=>X.isCurrent);F&&c(X=>X||String(F.id))})},[t]);const $=(n==null?void 0:n.id)??null;U.useEffect(()=>{k(null),E([]),T(""),$!==null&&(we.quality.canReportApp($).then(z=>k(z.data??null)),we.context.registry(t).then(z=>{var X;const F=(X=z.data)==null?void 0:X.applications.find(G=>G.id===$);E((F==null?void 0:F.modules)??[])}))},[t,$]);const Y=A!==null&&!A.canReport,H=!Y&&$!==null&&u.trim().length>0&&!L,W=async()=>{if(!H||$===null)return;B(void 0),N(!0);const z=await we.quality.create({projectId:t,applicationId:$,title:u.trim(),description:f.trim()||void 0,status:g,module:S||void 0,prdVersionId:s?Number(s):void 0,relatedRequirementId:C.trim()||void 0});if(N(!1),z.ok&&z.data){const F=new URLSearchParams;F.set("app",String($)),s&&F.set("ver",s),r(`/projects/${t}/quality?${F.toString()}`)}else B("Reporting failed. Check the form values and try again.")};return p.jsx(Cr,{children:p.jsxs("div",{className:"flex h-full flex-col space-y-4 p-4",children:[p.jsxs("nav",{className:"flex items-center gap-1.5 text-xs text-muted-foreground","aria-label":"Breadcrumb",children:[p.jsx(ri,{to:"/projects",className:"hover:text-foreground",children:"Home"}),p.jsx("span",{"aria-hidden":!0,children:"/"}),p.jsx(ri,{to:`/projects/${t}/quality${i}`,className:"hover:text-foreground",children:"Quality"}),p.jsx("span",{"aria-hidden":!0,children:"/"}),p.jsx("span",{className:"text-foreground",children:"Report Issue"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(xO,{d:t_e,className:"h-4 w-4 text-muted-foreground"}),p.jsx("h1",{className:"text-lg font-semibold",children:"Report Quality Issue"}),a&&p.jsx(ir,{variant:"secondary",children:a.name})]}),p.jsxs(Et,{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Issue Details"}),p.jsx(en,{className:"text-xs",children:"Quality issues are tracked per application and version. Once saved, this feeds into BUG.md generation and the conductor-defect (quality) phase."})]}),p.jsxs(St,{className:"flex min-h-0 flex-1 flex-col space-y-4 overflow-y-auto",children:[Y&&p.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200","data-testid":"quality-new-gate-notice",children:[p.jsx(xO,{d:r_e,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),p.jsx("span",{children:"Quality is available once conductor-develop has COMPLETED for this application."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{className:"text-xs",children:"Application"}),p.jsx("div",{className:"flex h-8 w-full items-center rounded-md border border-border bg-muted/40 px-2 text-xs","data-testid":"quality-new-application",children:n?p.jsx("span",{className:"font-mono",children:n.name}):p.jsx("span",{className:"text-muted-foreground",children:"Loading application scope…"})}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"The issue is reported against the application selected in the topbar."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-title",className:"text-xs",children:"Issue Title"}),p.jsx(Xt,{id:"quality-title",placeholder:"Short description of the quality issue…",className:"text-sm",value:u,onChange:z=>h(z.target.value),"data-testid":"quality-new-title"})]}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-1.5",children:[p.jsx(jt,{className:"text-xs",children:"Description"}),p.jsx("div",{className:"min-h-[220px] flex-1",children:p.jsx(ss,{value:f,onChange:b,height:"100%",className:"h-full rounded-md border border-border",placeholder:"Steps to reproduce, expected vs actual behaviour, environment details…",testId:"quality-new-description"})})]}),p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-module",className:"text-xs",children:"Module"}),p.jsxs("select",{id:"quality-module",className:_O,value:S,onChange:z=>T(z.target.value),"data-testid":"quality-new-module",children:[p.jsx("option",{value:"",children:"Common (no module)"}),x.map(z=>p.jsx("option",{value:z.name,children:z.name},z.id))]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-status",className:"text-xs",children:"Initial Status"}),p.jsxs("select",{id:"quality-status",className:_O,value:g,onChange:z=>v(z.target.value),"data-testid":"quality-new-status",children:[p.jsx("option",{value:"open",children:"Open"}),p.jsx("option",{value:"in_fix",children:"In Fix (known, assigned)"})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"quality-related",className:"text-xs",children:"Related User Story (optional)"}),p.jsx(Xt,{id:"quality-related",placeholder:"e.g. USCO200093",className:"font-mono text-xs",value:C,onChange:z=>y(z.target.value),"data-testid":"quality-new-related"})]})]}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Linking a User Story ties this issue to a specific requirement for traceability."}),O&&p.jsx("p",{className:"text-xs text-destructive",children:O}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[p.jsx(Ie,{size:"sm",className:"h-8 text-xs",disabled:!H,onClick:W,"data-testid":"quality-new-submit",children:L?"Reporting…":"Report Issue"}),p.jsx(ri,{to:`/projects/${t}/quality${i}`,children:p.jsx(Ie,{variant:"outline",size:"sm",className:"h-8 text-xs",children:"Cancel"})})]})]})]})]})})}function n_e(e){const t=[];let r=[],i="",n=!1;for(let a=0;a<e.length;a++){const l=e[a];n?l==='"'?e[a+1]==='"'?(i+='"',a++):n=!1:i+=l:l==='"'?n=!0:l===","?(r.push(i),i=""):l===`
|
|
495
495
|
`||l==="\r"?(l==="\r"&&e[a+1]===`
|
|
496
|
-
`&&a++,r.push(i),i="",t.push(r),r=[]):i+=l}return(i.length>0||r.length>0)&&(r.push(i),t.push(r)),t.filter(a=>!(a.length===1&&a[0]===""))}function a_e(e){const t=e.mimeType??"";return t==="text/csv"?"csv":t==="application/pdf"?"pdf":t.startsWith("image/")?"image":t==="text/markdown"?"markdown":"other"}function L9(e,t){for(const r of e){if(r.path===t)return r;if(r.children){const i=L9(r.children,t);if(i)return i}}return null}function I9({nodes:e,depth:t,selectedPath:r,expanded:i,onToggleFolder:n,onSelect:a}){return p.jsx("div",{children:e.map(l=>p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{a(l),l.type==="folder"&&n(l.path)},style:{paddingLeft:`${8+t*14}px`},className:`flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-xs transition-colors ${r===l.path?"bg-primary text-primary-foreground":"hover:bg-accent"}`,"data-testid":`shared-node-${l.path}`,children:[p.jsx("span",{className:"shrink-0",children:l.type==="folder"?i.has(l.path)?"📂":"📁":"📄"}),p.jsx("span",{className:"truncate",children:l.name})]}),l.type==="folder"&&i.has(l.path)&&l.children&&p.jsx(I9,{nodes:l.children,depth:t+1,selectedPath:r,expanded:i,onToggleFolder:n,onSelect:a})]},l.path))})}function s_e({url:e}){const[t,r]=U.useState(null);if(U.useEffect(()=>{r(null),fetch(e).then(a=>a.text()).then(a=>r(n_e(a))).catch(()=>r([]))},[e]),t==null)return p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Loading…"});const[i,...n]=t;return i?p.jsx("div",{className:"overflow-auto","data-testid":"csv-grid",children:p.jsxs("table",{className:"w-full border-collapse text-xs",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.map((a,l)=>p.jsx("th",{className:"sticky top-0 border bg-muted px-2 py-1 text-left font-medium",children:a},l))})}),p.jsx("tbody",{children:n.map((a,l)=>p.jsx("tr",{className:"odd:bg-muted/30",children:a.map((s,c)=>p.jsx("td",{className:"border px-2 py-1",children:s},c))},l))})]})}):p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Empty CSV."})}function o_e({projectId:e,path:t}){const[r,i]=U.useState(null),[n,a]=U.useState(!1),[l,s]=U.useState();return U.useEffect(()=>{i(null),a(!1),s(void 0),fetch(we.sharedContext.contentUrl(e,t)).then(c=>c.ok?c.text():Promise.reject(new Error(String(c.status)))).then(i).catch(()=>s("Failed to load file"))},[e,t]),l?p.jsx("p",{className:"p-4 text-xs text-destructive",children:l}):r==null?p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Loading…"}):p.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2 p-3",children:[p.jsx("div",{className:"min-h-[320px] min-w-0 flex-1",children:p.jsx(ss,{value:r,onChange:c=>{i(c),a(!1)},testId:"shared-md",height:"100%",className:"h-full rounded-md border border-border"})}),p.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[n&&p.jsx("span",{className:"text-xs text-green-600","data-testid":"shared-md-saved",children:"Saved"}),p.jsx(Ie,{className:"h-8 px-3 text-sm","data-testid":"shared-md-save",onClick:async()=>{(await we.sharedContext.saveMarkdown(e,t,r)).ok?a(!0):s("Save failed")},children:"Save"})]})]})}function l_e({projectId:e,node:t}){const r=a_e(t),i=we.sharedContext.contentUrl(e,t.path);switch(r){case"csv":return p.jsx(s_e,{url:i});case"image":return p.jsx("div",{className:"flex justify-center p-4",children:p.jsx("img",{src:i,alt:t.name,className:"max-w-full","data-testid":"image-preview"})});case"pdf":return p.jsx("iframe",{src:i,title:t.name,className:"h-full min-h-[70vh] w-full","data-testid":"pdf-preview"});case"markdown":return p.jsx(o_e,{projectId:e,path:t.path});default:return p.jsx("iframe",{src:i,title:t.name,className:"h-full min-h-[60vh] w-full","data-testid":"file-preview"})}}function c_e(){const{id:e}=an(),t=Number(e),[r,i]=Fb(),[n,a]=U.useState([]),[l,s]=U.useState(new Set),[c,u]=U.useState(null),[h,f]=U.useState(!1),[b,g]=U.useState(""),[v,C]=U.useState(),y=U.useRef(null),x=U.useCallback(async()=>{var N,O;const L=await we.sharedContext.tree(t);return a(((N=L.data)==null?void 0:N.tree)??[]),((O=L.data)==null?void 0:O.tree)??[]},[t]);U.useEffect(()=>{x().then(L=>{const N=r.get("file");if(!N)return;const O=L9(L,N);if(O){u(O);const B=N.split("/"),$=B.slice(0,-1).map((Y,H)=>B.slice(0,H+1).join("/"));s(new Set($))}})},[t]);const E=L=>{u(L),C(void 0),L.type==="file"&&i({file:L.path},{replace:!0})},S=L=>s(N=>{const O=new Set(N);return O.has(L)?O.delete(L):O.add(L),O}),T=c?c.type==="folder"?c.path:c.path.includes("/")?c.path.slice(0,c.path.lastIndexOf("/")):"":"",A=async()=>{const L=b.trim();if(!L)return;const N=T?`${T}/${L}`:L;if(!(await we.sharedContext.createFolder(t,N)).ok){C("Folder creation failed");return}f(!1),g(""),T&&s(B=>new Set(B).add(T)),await x()},k=async L=>{const N=L.target.files;if(!(!N||N.length===0)){C(void 0);for(const O of Array.from(N)){const B=await we.sharedContext.upload(t,T,O);B.ok||C(B.code==="FILE_TOO_LARGE"?`${O.name} exceeds the 25 MB limit`:`Upload of ${O.name} failed`)}L.target.value="",T&&s(O=>new Set(O).add(T)),await x()}};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"flex h-full",children:[p.jsxs("div",{className:"flex w-64 shrink-0 flex-col overflow-y-auto border-r bg-muted/20",children:[p.jsxs("div",{className:"flex items-center justify-between border-b p-2",children:[p.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Shared Context"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ie,{variant:"outline",className:"h-6 px-1.5 text-[11px]",onClick:()=>f(!0),"data-testid":"new-folder",title:`New folder in ${T||"shared_context/"}`,children:"+ Folder"}),p.jsx(Ie,{variant:"outline",className:"h-6 px-1.5 text-[11px]",onClick:()=>{var L;return(L=y.current)==null?void 0:L.click()},"data-testid":"upload-file",title:`Upload into ${T||"shared_context/"}`,children:"↥ Upload"}),p.jsx("input",{ref:y,type:"file",multiple:!0,accept:".md,.markdown,.csv,.pdf,.png,.jpg,.jpeg,.gif,.webp,.svg,.txt,.json",className:"hidden",onChange:k,"data-testid":"upload-input"})]})]}),p.jsx("div",{className:"flex-1 py-1",children:n.length===0?p.jsx("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No files yet — create a folder or upload references (images, CSV, PDF, markdown)."}):p.jsx(I9,{nodes:n,depth:0,selectedPath:(c==null?void 0:c.path)??null,expanded:l,onToggleFolder:S,onSelect:E})}),v&&p.jsx("div",{className:"m-2 rounded-md border border-destructive/30 bg-destructive/10 px-2 py-1.5 text-xs text-destructive","data-testid":"shared-error",children:v})]}),p.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between border-b p-3",children:[p.jsx("span",{className:"text-sm font-medium",children:(c==null?void 0:c.type)==="file"?c.path:"Shared Context"}),(c==null?void 0:c.type)==="file"&&p.jsx("a",{href:we.sharedContext.contentUrl(t,c.path),target:"_blank",rel:"noreferrer",className:"text-xs text-muted-foreground underline hover:text-foreground","data-testid":"open-raw",children:"Open raw"})]}),p.jsx("div",{className:"min-h-0 flex-1",children:(c==null?void 0:c.type)==="file"?p.jsx(l_e,{projectId:t,node:c}):p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Select a file on the left to preview it — CSV renders as a grid, PDF and images in their viewers, markdown in the editor with live preview."})})]})]}),p.jsx(ta,{open:h,onOpenChange:f,children:p.jsxs(bl,{className:"max-w-sm",children:[p.jsx(ra,{children:p.jsx(ia,{children:"New Folder"})}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created under ",p.jsx("code",{className:"font-mono",children:T||"shared_context/"})]}),p.jsx(Xt,{value:b,onChange:L=>g(L.target.value),placeholder:"folder-name","data-testid":"new-folder-name",onKeyDown:L=>{L.key==="Enter"&&A()}})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>f(!1),children:"Cancel"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:A,"data-testid":"new-folder-create",children:"Create"})]})]})})]})}const u_e=[{label:"Brainstorm",command:"/brainstorm-loop"},{label:"Run a conductor",command:"Execute co2-cli/execution/<path>.md"},{label:"PRD Wizard hand-off",command:'/util-updprd "<change request>"'}];function d_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(null);U.useEffect(()=>{we.projects.get(t).then(a=>i(a.data))},[t]);const n=(r==null?void 0:r.workspaceFolderName)??`project-${t}`;return p.jsx(Cr,{children:p.jsxs("div",{className:"mx-auto flex max-w-5xl flex-col gap-4 p-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Workspace Terminal"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["The shared, per-project Claude Code terminal. Claim it to open a session in"," ",p.jsxs("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:[n,"/"]}),". Only one user drives Claude Code on a project at a time."]})]}),p.jsxs(Et,{children:[p.jsx(Qt,{children:p.jsx(nr,{className:"text-sm",children:"co2-cli hand-off commands"})}),p.jsxs(St,{className:"space-y-1.5",children:[u_e.map(a=>p.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[p.jsx("span",{className:"w-40 shrink-0 text-muted-foreground",children:a.label}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:a.command})]},a.label)),p.jsx("p",{className:"pt-1 text-xs text-muted-foreground",children:"co2-cli surfaces these for you to paste — it never auto-runs Claude Code (CONSCO2069)."})]})]}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-zinc-800",children:p.jsx(JO,{projectId:t,projectName:n})})]})})}function D9({className:e,...t}){return p.jsx("div",{role:"separator",className:ci("h-px w-full bg-border",e),...t})}const h_e=[{type:"major",label:"Major",hint:"breaking overall change"},{type:"minor",label:"Minor",hint:"new features"},{type:"patch",label:"Patch",hint:"typo / formatting"}];function r1({done:e}){return e?p.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-3 w-3","aria-hidden":"true",children:p.jsx("path",{d:"M20 6 9 17l-5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),p.jsx("span",{className:"text-[10px]",children:"done"})]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-3 w-3","aria-hidden":"true",children:p.jsx("circle",{cx:"12",cy:"12",r:"9"})}),p.jsx("span",{className:"text-[10px]",children:"pending"})]})}function f_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState([]),[n,a]=U.useState(!1),[l,s]=U.useState(!0),[c,u]=U.useState(!1),[h,f]=U.useState("minor"),[b,g]=U.useState(),v=()=>{Promise.all([we.versions.list(t),we.versions.canAdd(t)]).then(([S,T])=>{var A;i(S.data??[]),a(((A=T.data)==null?void 0:A.canAdd)??!1),s(!1)})};U.useEffect(v,[t]);const C=async()=>{g(void 0);const S=await we.versions.add(t,h);if(!S.ok){g(S.code==="VERSION_NOT_READY"?"All applications must reach Quality first.":S.code==="GIT_OPERATION_FAILED"?`Git operation failed — no version was cut. ${S.message??""}`.trim():"Cut failed.");return}u(!1),v()};if(l)return p.jsx(Cr,{children:p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"})});const y=r.find(S=>S.isCurrent),x=(y==null?void 0:y.apps.filter(S=>S.qualityCompleted).length)??0,E=(y==null?void 0:y.apps.length)??0;return p.jsxs(Cr,{children:[p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Versions"}),p.jsx(Ie,{className:"h-8 gap-1 px-3 text-sm",disabled:!n,onClick:()=>u(!0),"data-testid":"add-version",children:"+ Add Version"})]}),!n&&y&&p.jsxs("div",{className:"rounded-md border border-yellow-200 bg-yellow-50 px-3 py-2 text-xs text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950/20 dark:text-yellow-400",children:["A new version can only be added after a conductor run completes for ",y.semver,". Quality reached:"," ",p.jsxs("strong",{children:[x,"/",E]})," ","applications."]}),p.jsx("div",{className:"space-y-3","data-testid":"version-list",children:r.map(S=>{const T=S.apps.filter(N=>N.prepareCompleted).length,A=S.apps.filter(N=>N.developCompleted).length,k=S.apps.filter(N=>N.qualityCompleted).length,L=S.apps.length;return p.jsxs(Et,{className:S.isCurrent?"border-primary/40":"",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-mono text-sm font-semibold",children:S.semver}),S.isCurrent?p.jsx(ir,{variant:"default",className:"text-xs",children:"current"}):p.jsx(ir,{variant:"outline",className:"text-xs",children:"read-only"}),p.jsx(ir,{variant:"outline",className:"text-xs capitalize",children:S.versionType}),p.jsx(ir,{variant:"secondary",className:"font-mono text-[10px]",children:S.gitBranch})]}),p.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[p.jsxs("span",{children:["Prepare"," ",p.jsxs("strong",{children:[T,"/",L]})]}),p.jsxs("span",{children:["Develop"," ",p.jsxs("strong",{children:[A,"/",L]})]}),p.jsxs("span",{children:["Quality"," ",p.jsxs("strong",{className:L>0&&k===L?"text-green-600":"",children:[k,"/",L]})]})]})]})}),p.jsxs(St,{className:"px-4 pb-4",children:[S.apps.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No applications yet — import them by rescanning CLAUDE.md after the brainstorm."}):p.jsxs("table",{className:"w-full text-xs",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b text-muted-foreground",children:[p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Application"}),p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Prepare"}),p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Develop"}),p.jsx("th",{className:"py-1 text-left font-medium",children:"Quality"})]})}),p.jsx("tbody",{children:S.apps.map(N=>p.jsxs("tr",{className:"border-b last:border-0",children:[p.jsx("td",{className:"py-1.5 pr-4 font-mono text-[11px]",children:N.name}),p.jsx("td",{className:"py-1.5 pr-4",children:p.jsx(r1,{done:N.prepareCompleted})}),p.jsx("td",{className:"py-1.5 pr-4",children:p.jsx(r1,{done:N.developCompleted})}),p.jsx("td",{className:"py-1.5",children:p.jsx(r1,{done:N.qualityCompleted})})]},N.applicationId))})]}),!S.isCurrent&&p.jsxs(p.Fragment,{children:[p.jsx(D9,{className:"my-3"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Prior version is read-only. Content is frozen at the snapshot taken when it was cut."})]})]})]},S.id)})})]}),p.jsxs(ta,{open:c,onOpenChange:u,children:[p.jsxs(ra,{children:[p.jsx(ia,{children:"Add New Version"}),p.jsx(oc,{children:"Snapshot every application's PRD.md / BUG.md at the new version and make it current."})]}),p.jsxs("div",{className:"space-y-3 py-2",children:[p.jsx("div",{className:"grid grid-cols-3 gap-2",children:h_e.map(S=>p.jsxs("button",{type:"button",onClick:()=>f(S.type),className:`rounded-md border px-3 py-2 text-left text-xs transition-colors ${h===S.type?"border-primary bg-primary/10":"hover:bg-muted"}`,"data-testid":`bump-${S.type}`,children:[p.jsx("div",{className:"font-medium",children:S.label}),p.jsx("div",{className:"text-muted-foreground",children:S.hint})]},S.type))}),b&&p.jsx("p",{className:"text-xs text-destructive",children:b})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>u(!1),children:"Cancel"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:C,"data-testid":"confirm-add-version",children:"Create Version"})]})]})]})}const p_e=5e3,EO=[{value:"prepare",label:"Prepare (conductor-feature-prepare)"},{value:"develop",label:"Develop (conductor-feature-develop)"},{value:"quality",label:"Quality (conductor-defect)"}],Yl={prepare:"Prepare",develop:"Develop",quality:"Quality (conductor-defect)"},CO={from:"",to:"",conductor:"",apps:[],version:""};function m_e(e,t){return e.filter(r=>{const i=r.createdAt.slice(0,10);return t.from&&i<t.from||t.to&&i>t.to||t.conductor&&r.conductorType!==t.conductor||t.apps.length>0&&!r.applicationNames.some(n=>t.apps.includes(n))?!1:t.version==="__none__"?!r.versionLabel:!(t.version&&r.versionLabel!==t.version)})}function g_e(e,t){const r=u=>u.replace(/^v/,"").split(".").map(Number),[i=0,n=0,a=0]=r(e),[l=0,s=0,c=0]=r(t);return l-i||s-n||c-a}function UE({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const b_e="M6 3l14 9-14 9V3z",y_e="M9 9V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-4M3 11a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",x_e="M20 6 9 17l-5-5";function __e({text:e,testid:t}){const[r,i]=U.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e)}catch{}i(!0),setTimeout(()=>i(!1),1500)};return p.jsxs(Ie,{size:"sm",variant:"outline",className:"h-7 gap-1 px-2 text-xs",onClick:n,"data-testid":t,children:[r?p.jsx(UE,{d:x_e,className:"h-3 w-3 text-green-500"}):p.jsx(UE,{d:y_e,className:"h-3 w-3"}),r?"Copied!":"Copy"]})}function i1({label:e,status:t}){const r=t==="completed"?"border-green-600 text-green-600":t==="in_progress"?"border-yellow-600 text-yellow-600":"border-border text-muted-foreground";return p.jsxs(ir,{variant:"outline",className:`h-4 px-1 text-[10px] ${r}`,children:[e,": ",t==="in_progress"?"in progress":t]})}function n1({status:e}){const t={pending:"bg-muted text-muted-foreground",in_progress:"bg-yellow-100 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400",completed:"bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-400",failed:"bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400",force_stopped:"bg-muted text-muted-foreground"};return p.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-[10px] font-medium uppercase ${t[e]}`,"data-testid":"run-status-chip",children:e.replace("_"," ")})}function E_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(""),[n,a]=U.useState([]),[l,s]=U.useState(!1),[c,u]=U.useState(),[h,f]=U.useState(!1),[b,g]=U.useState(!1),[v,C]=U.useState(),[y,x]=U.useState(0),[E,S]=U.useState([]),[T,A]=U.useState(null),[k,L]=U.useState([]),[N,O]=U.useState(),[B,$]=U.useState(null),[Y,H]=U.useState(null),W=U.useCallback(async(oe,se)=>{const xe=await we.workflow.changelogContent(oe,se);xe.ok&&xe.data?($({filePath:xe.data.filePath,content:xe.data.content}),H(null)):O(xe.code==="CHANGELOG_NOT_FOUND"?`No CHANGELOG.md yet for ${se} — it appears once the conductor has run.`:"Could not load the CHANGELOG.md.")},[]),[z,F]=U.useState(CO),X=U.useRef(null),G=U.useMemo(()=>m_e(k,z),[k,z]),P=U.useMemo(()=>[...new Set(k.flatMap(oe=>oe.applicationNames))].sort(),[k]),D=U.useMemo(()=>[...new Set(k.map(oe=>oe.versionLabel).filter(oe=>!!oe))].sort(g_e),[k]),j=U.useMemo(()=>k.some(oe=>!oe.versionLabel),[k]),K=z.from!==""||z.to!==""||z.conductor!==""||z.apps.length>0||z.version!=="",V=oe=>{F(se=>({...se,apps:se.apps.includes(oe)?se.apps.filter(xe=>xe!==oe):[...se.apps,oe]}))},{version:ie}=cs(),ye=(ie==null?void 0:ie.isLocked)??!1,pe=(T==null?void 0:T.status)==="pending"||(T==null?void 0:T.status)==="in_progress",te=U.useCallback(()=>{we.workflow.listRuns(t).then(oe=>L(oe.data??[]))},[t]);U.useEffect(()=>{we.context.registry(t).then(oe=>{var se;return x(((se=oe.data)==null?void 0:se.applications.length)??0)}),te(),we.workflow.activeRun(t).then(oe=>{oe.data&&A(oe.data)})},[t,te]),U.useEffect(()=>{if(S([]),s(!1),u(void 0),!r){a([]);return}Promise.all([we.workflow.pendingApps(t,r,ie==null?void 0:ie.id),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id)]).then(([oe,se])=>{a(oe.data??[]),se.data&&u(se.data),s(!0)})},[t,r,ie==null?void 0:ie.id]),U.useEffect(()=>{if(X.current&&clearInterval(X.current),!!T&&!(T.status==="completed"||T.status==="failed"))return X.current=setInterval(()=>{we.workflow.getRun(T.id).then(oe=>{oe.data&&(A(oe.data),(oe.data.status==="completed"||oe.data.status==="failed")&&(te(),r&&we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[]))))})},p_e),()=>{X.current&&clearInterval(X.current)}},[T,te,r,t,ie==null?void 0:ie.id]);const Z=async()=>{if(!T)return;await we.workflow.forceStop(T.id);const oe=await we.workflow.getRun(T.id);A(oe.data??null),te(),r&&we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[]))},he=async()=>{if(!(!T||h)){f(!0);try{const oe=await we.workflow.rescan(T.id);oe.data&&A(oe.data),te(),r&&(we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[])),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id).then(se=>se.data&&u(se.data)))}finally{f(!1)}}},ce=async()=>{if(!b){g(!0),C(void 0);try{const oe=await we.workflow.rescanAll(t);if(oe.ok&&oe.data){const xe=oe.data.discoveredRuns;C(xe>0?`Rescan complete — ${xe} terminal-executed run${xe===1?"":"s"} discovered.`:"Rescan complete — all statuses are up to date.")}else C("Rescan failed.");te();const se=await we.workflow.activeRun(t);if(se.data)A(se.data);else if(T){const xe=await we.workflow.getRun(T.id);A(xe.data??null)}r&&(we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(xe=>a(xe.data??[])),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id).then(xe=>xe.data&&u(xe.data)))}finally{g(!1)}}},me=oe=>{S(se=>se.includes(oe)?se.filter(xe=>xe!==oe):[...se,oe])},be=async()=>{if(!r||E.length===0||ye||pe)return;O(void 0);const oe=await we.workflow.createRun(t,E,r,ie==null?void 0:ie.id);if(!oe.ok||!oe.data){O(oe.code==="ACTIVE_RUN_EXISTS"?"An execution is already in progress — only one runs at a time. Wait for it to complete or force-stop it.":oe.code==="APPS_NOT_PENDING"?"One or more selected applications are no longer pending this phase.":"Failed to generate the workflow markdown.");return}const se=await we.workflow.getRun(oe.data.id);A(se.data??null),te(),we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(xe=>a(xe.data??[])),S([])};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(UE,{d:b_e,className:"h-4 w-4 text-primary"}),p.jsx("h1",{className:"text-lg font-semibold",children:"Workflow Execution"})]}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a conductor, pick the applications still pending that phase, then paste the generated prompt into the Terminal. co2-cli monitors the tracking file automatically and runs git once the conductor completes — it never runs Claude Code itself."}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm",children:"1. Select Conductor"})}),p.jsxs(St,{className:"space-y-4 px-4 pb-4",children:[p.jsxs("select",{value:r,onChange:oe=>i(oe.target.value),className:"h-8 w-full max-w-sm rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-conductor-select",children:[p.jsx("option",{value:"",children:"Select a conductor…"}),EO.map(oe=>p.jsx("option",{value:oe.value,children:oe.label},oe.value))]}),r&&l&&p.jsxs("div",{className:"space-y-2","data-testid":"wf-pending-apps",children:[n.length===0?c&&c.total===0&&y>0?p.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-500","data-testid":"wf-none-affected",children:["No applications are affected by version ",(ie==null?void 0:ie.semver)??"this version"," — none has a User Story, NFR, Constraint, Reference or Test change tagged to it. Switch to a version with requirement changes in the topbar, or add requirements to this version first."]}):c&&c.total>0&&c.completed===c.total?p.jsxs("div",{className:"rounded-md border border-green-200 bg-green-50 px-3 py-2 text-xs text-green-700 dark:border-green-900 dark:bg-green-950/20 dark:text-green-400","data-testid":"wf-all-completed",children:["All applications have completed the ",Yl[r]," phase. No runs needed."]}):p.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-500","data-testid":"wf-none-eligible",children:["No applications are eligible for the ",Yl[r]," phase yet (",(c==null?void 0:c.completed)??0," of ",(c==null?void 0:c.total)??0," ","completed). An application becomes eligible once its prior phase has completed — if a conductor just finished, use ",p.jsx("strong",{children:"Rescan status"})," on the active run below to pick it up."]}):p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Applications pending ",Yl[r],":"," ",p.jsxs("strong",{children:[n.length," of"," ",Math.max((c==null?void 0:c.total)??y,n.length)]})," ","apps"]}),p.jsx("div",{className:"divide-y rounded-md border",children:n.map(oe=>p.jsxs("label",{className:"flex cursor-pointer items-center justify-between px-3 py-2 hover:bg-muted/50","data-testid":`wf-app-${oe.applicationName}`,children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"checkbox",checked:E.includes(oe.applicationId),onChange:()=>me(oe.applicationId),className:"h-3.5 w-3.5"}),p.jsx("span",{className:"font-mono text-xs",children:oe.applicationName})]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(i1,{label:"Prepare",status:oe.prepareStatus}),p.jsx(i1,{label:"Develop",status:oe.developStatus}),p.jsx(i1,{label:"Quality",status:oe.qualityStatus})]})]},oe.applicationId))}),ye&&p.jsxs("p",{className:"text-xs text-amber-600","data-testid":"wf-version-locked",children:[ie==null?void 0:ie.semver," is a read-only prior version — switch to the current version in the topbar to execute a conductor."]}),pe&&p.jsx("p",{className:"text-xs text-amber-600","data-testid":"wf-run-active-note",children:"An execution is already in progress — only one runs at a time. Wait for it to complete (it keeps running in the background) or force-stop it below."}),p.jsx(Ie,{className:"h-8 px-3 text-sm",disabled:E.length===0||ye||pe,onClick:be,"data-testid":"wf-prepare-to-execute",children:"Prepare to Execute"})]}),N&&p.jsx("p",{className:"text-xs text-destructive","data-testid":"wf-error",children:N})]})]})]}),T&&p.jsxs("div",{className:"grid grid-cols-5 items-start gap-4","data-testid":"wf-generated",children:[p.jsxs(Et,{className:T.executeCommand?"col-span-3":"col-span-5",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(nr,{className:"text-sm",children:"Workflow Run"}),p.jsx(n1,{status:T.status})]})}),p.jsxs(St,{className:"space-y-2 px-4 pb-4 text-xs",children:[p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Conductor:"})," ",Yl[T.conductorType]]}),T.applications&&T.applications.length>0?p.jsxs("div",{className:"space-y-1","data-testid":"wf-app-breakdown",children:[p.jsx("span",{className:"text-muted-foreground",children:"Applications:"}),T.applications.map(oe=>p.jsxs("div",{className:"ml-2 space-y-0.5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-mono",children:oe.applicationName}),p.jsx(n1,{status:oe.status})]}),oe.status==="pending"&&!oe.trackingFileExists&&p.jsxs("p",{className:"text-[10px] text-amber-600","data-testid":"wf-app-no-tracking",children:["No tracking file found at"," ",p.jsx("code",{className:"font-mono",children:oe.trackingFilePath})," — this application's conductor has not started or reported yet. Paste the Execute prompt again to (re)run it (completed applications are skipped), or force-stop the execution."]})]},oe.applicationName))]}):p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Applications:"})," ",p.jsx("span",{className:"font-mono",children:T.applicationNames.join(", ")})]}),p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Version:"})," ",T.versionLabel??"—"]}),p.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:T.filePath}),T.gitOperationStatus!=="not_started"&&p.jsxs("p",{"data-testid":"wf-git-chip",children:[p.jsx("span",{className:"text-muted-foreground",children:"Git:"})," ",p.jsxs(ir,{variant:"outline",className:"h-4 px-1 text-[10px]",children:[T.gitOperationStatus,T.gitCommitHash?` · ${T.gitCommitHash} / ${T.gitBranchCreated}`:""]})]}),pe&&p.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Monitoring continues in the background — you can navigate to other pages and come back; this card will still be here until the run completes."}),p.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs",onClick:he,disabled:h,"data-testid":"wf-rescan",children:h?"Rescanning…":"Rescan status"}),p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs text-destructive",onClick:Z,"data-testid":"wf-force-stop",children:"Force stop"})]})]})]})]}),T.executeCommand&&p.jsxs(Et,{className:"col-span-2 border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-950/20",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm text-blue-800 dark:text-blue-300",children:"Run in Terminal"})}),p.jsxs(St,{className:"space-y-3 px-4 pb-4",children:[p.jsx("code",{className:"block whitespace-pre-wrap break-all rounded bg-zinc-900 px-2 py-1.5 font-mono text-[11px] text-green-400","data-testid":"wf-execute-command",children:T.executeCommand}),p.jsx(__e,{text:T.executeCommand,testid:"wf-copy-command"}),p.jsx("p",{className:"text-[10px] text-blue-700 dark:text-blue-400",children:"Claim the Workspace Terminal docked at the bottom of the screen (same as the Brainstorm step) and paste this prompt there. Monitoring runs automatically — the status chip updates as the conductor's tracking file changes."})]})]})]}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"px-4 pb-2 pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(nr,{className:"text-sm",children:"Run History"}),p.jsxs("div",{className:"flex items-center gap-2",children:[k.length>0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground","data-testid":"wf-history-count",children:["Showing ",G.length," of ",k.length," run",k.length===1?"":"s"]}),p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs",onClick:ce,disabled:b,"data-testid":"wf-rescan-all",children:b?"Rescanning…":"Rescan all statuses"})]})]}),v&&p.jsx("p",{className:"text-[10px] text-muted-foreground","data-testid":"wf-rescan-all-msg",children:v})]}),p.jsx(St,{className:"px-4 pb-4",children:k.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No workflow runs yet."}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mb-3 space-y-2","data-testid":"wf-history-filters",children:[p.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["From",p.jsx("input",{type:"date",value:z.from,onChange:oe=>F(se=>({...se,from:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-from"})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["To",p.jsx("input",{type:"date",value:z.to,onChange:oe=>F(se=>({...se,to:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-to"})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["Conductor",p.jsxs("select",{value:z.conductor,onChange:oe=>F(se=>({...se,conductor:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-conductor",children:[p.jsx("option",{value:"",children:"All conductors"}),EO.map(oe=>p.jsx("option",{value:oe.value,children:Yl[oe.value]},oe.value))]})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["Version",p.jsxs("select",{value:z.version,onChange:oe=>F(se=>({...se,version:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-version",children:[p.jsx("option",{value:"",children:"All versions"}),D.map(oe=>p.jsx("option",{value:oe,children:oe},oe)),j&&p.jsx("option",{value:"__none__",children:"No version"})]})]}),K&&p.jsx(Ie,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs",onClick:()=>F(CO),"data-testid":"wf-filter-clear",children:"Clear filters"})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Applications:"}),P.map(oe=>p.jsxs("label",{className:`flex cursor-pointer items-center gap-1 rounded-md border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${z.apps.includes(oe)?"border-primary bg-primary/10":"border-input hover:bg-muted/50"}`,"data-testid":`wf-filter-app-${oe}`,children:[p.jsx("input",{type:"checkbox",checked:z.apps.includes(oe),onChange:()=>V(oe),className:"h-3 w-3"}),oe]},oe))]})]}),G.length===0?p.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"wf-history-no-match",children:"No runs match the current filters."}):p.jsxs("table",{className:"w-full text-xs","data-testid":"wf-history",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b text-muted-foreground",children:[p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Date"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Conductor"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Applications"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Version"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Path"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"CHANGELOG"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Status"}),p.jsx("th",{className:"py-1 text-left font-medium",children:"Git"})]})}),p.jsx("tbody",{children:G.map(oe=>p.jsxs("tr",{className:"border-b last:border-0",children:[p.jsx("td",{className:"py-1.5 pr-3 whitespace-nowrap",children:oe.createdAt.slice(0,10)}),p.jsx("td",{className:"py-1.5 pr-3",children:Yl[oe.conductorType]}),p.jsx("td",{className:"py-1.5 pr-3 font-mono text-[11px]",children:oe.applicationNames.join(", ")}),p.jsx("td",{className:"py-1.5 pr-3",children:oe.versionLabel??"—"}),p.jsx("td",{className:"py-1.5 pr-3 font-mono text-[10px] text-muted-foreground",children:p.jsx("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>we.workflow.runFileContent(oe.id).then(se=>{se.data&&$(se.data)}),"data-testid":`wf-history-path-${oe.id}`,children:oe.filePath})}),p.jsx("td",{className:"py-1.5 pr-3 text-[11px]",children:(()=>{const se=oe.applicationNames.filter(Boolean);return se.length===0?p.jsx("span",{className:"text-muted-foreground",children:"—"}):se.length===1?p.jsx("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>W(oe.id,se[0]),"data-testid":`wf-history-changelog-${oe.id}`,children:"CHANGELOG.md"}):p.jsxs("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>H({runId:oe.id,title:`${Yl[oe.conductorType]} · ${oe.versionLabel??""}`.trim(),apps:se}),"data-testid":`wf-history-changelog-${oe.id}`,children:["CHANGELOG.md (",se.length,")"]})})()}),p.jsx("td",{className:"py-1.5 pr-3",children:p.jsx(n1,{status:oe.status})}),p.jsx("td",{className:"py-1.5 text-[10px]",children:oe.gitCommitHash?`${oe.gitCommitHash} / ${oe.gitBranchCreated}`:oe.gitOperationStatus})]},oe.id))})]})]})})]})]}),p.jsx(ta,{open:Y!==null,onOpenChange:oe=>!oe&&H(null),className:"max-w-md",children:p.jsxs(bl,{children:[p.jsx(ra,{children:p.jsxs(ia,{className:"text-sm",children:["CHANGELOG.md — ",Y==null?void 0:Y.title]})}),p.jsx("div",{className:"flex flex-col gap-1 py-1","data-testid":"wf-changelog-chooser",children:Y==null?void 0:Y.apps.map(oe=>p.jsxs("button",{type:"button",className:"flex items-center justify-between rounded-md border border-border px-3 py-2 text-left text-xs hover:bg-muted",onClick:()=>void W(Y.runId,oe),"data-testid":`wf-changelog-app-${oe}`,children:[p.jsx("span",{className:"font-mono",children:oe}),p.jsx("span",{className:"text-blue-600 underline underline-offset-2 dark:text-blue-400",children:"CHANGELOG.md"})]},oe))})]})}),p.jsx(ta,{open:B!==null,onOpenChange:oe=>!oe&&$(null),className:"max-w-4xl",children:p.jsxs(bl,{children:[p.jsx(ra,{children:p.jsx(ia,{className:"font-mono text-sm",children:B==null?void 0:B.filePath})}),p.jsx("div",{"data-testid":"wf-history-preview",children:B&&p.jsx(ss,{value:B.content,onChange:()=>{},previewOnly:!0,height:"70vh"})})]})})]})}function a1({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const C_e="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",vO="M12 6v6l4 2M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",v_e={conductor_complete:"bg-green-500",conductor_progress:"bg-yellow-500",brainstorm_advance:"bg-purple-500",artifact_ready:"bg-blue-500"};function S_e(e){return(e.split(/[\s_-]+/).filter(Boolean).map(r=>r[0]).join("")||e.slice(0,2)).slice(0,2).toUpperCase()}function T_e(){const{user:e}=aa(),t=nn(),[r,i]=U.useState([]),[n,a]=U.useState([]),[l,s]=U.useState([]),[c,u]=U.useState(!0);U.useEffect(()=>{Promise.all([we.dashboard.list(!1),we.dashboard.list(!0),we.notifications.list("all",5)]).then(([b,g,v])=>{var C;i(b.data??[]),a(g.data??[]),s(((C=v.data)==null?void 0:C.items)??[])}).finally(()=>u(!1))},[]);const h=[{label:"Projects",value:String(r.length),icon:C_e,extra:null}],f=({p:b})=>p.jsxs(ri,{to:b.creationStatus==="brainstorm_ready"?`/projects/new?step=brainstorm&projectId=${b.id}`:`/projects/${b.id}`,"data-testid":`project-row-${b.name}`,className:"flex items-center justify-between px-4 py-3 hover:bg-muted/50",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-xs font-bold text-primary",children:b.code||S_e(b.name)}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-medium",children:b.name}),b.creationStatus!=="fully_created"&&p.jsx("div",{className:"mt-0.5 flex items-center gap-1",children:p.jsx(ir,{variant:"secondary",className:"text-xs",children:b.creationStatus==="initializing"?"Initializing…":"Brainstorm"})})]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[b.creationStatus==="brainstorm_ready"&&p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 text-xs","data-testid":`continue-brainstorm-${b.id}`,onClick:g=>{g.preventDefault(),g.stopPropagation(),t(`/projects/new?step=brainstorm&projectId=${b.id}`)},children:"Continue Brainstorm →"}),p.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p.jsx(a1,{d:vO,className:"h-3 w-3"}),b.lastActivityAt.slice(0,10)]}),b.creationStatus!=="brainstorm_ready"&&p.jsx("span",{className:"text-xs text-muted-foreground",children:"Open →"})]})]});return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Dashboard"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["Welcome, ",e==null?void 0:e.displayName,"."," ",(e==null?void 0:e.role)==="admin"?"All projects":"Your assigned projects"," and their CO2 workflow progress."]})]}),(e==null?void 0:e.role)==="admin"&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>t("/projects/import"),"data-testid":"import-project",children:"Import Project"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:()=>t("/projects/new"),children:"New Project"})]})]}),p.jsx("div",{className:"grid grid-cols-4 gap-3","data-testid":"dashboard-stats",children:h.map(b=>p.jsx(Et,{className:"p-3",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:b.label}),p.jsx("p",{className:"mt-1 text-2xl font-bold",children:c?"—":b.value}),b.extra&&p.jsx("p",{className:"text-xs text-muted-foreground",children:b.extra})]}),p.jsx(a1,{d:b.icon,className:"h-6 w-6 text-muted-foreground/50"})]})},b.label))}),c?p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):p.jsxs(zf,{defaultValue:"active",children:[p.jsxs(qf,{children:[p.jsxs(Fn,{value:"active",children:["Active (",r.length,")"]}),p.jsxs(Fn,{value:"archived",children:["Archived (",n.length,")"]})]}),p.jsx(ya,{value:"active",className:"mt-3",children:p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:r.length===0?p.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground","data-testid":"projects-empty",children:"No projects yet."}):p.jsx("div",{className:"divide-y",children:r.map(b=>p.jsx(f,{p:b},b.id))})})})}),p.jsx(ya,{value:"archived",className:"mt-3",children:p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:n.length===0?p.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground",children:"No archived projects."}):p.jsx("div",{className:"divide-y",children:n.map(b=>p.jsxs("div",{"data-testid":`archived-row-${b.name}`,className:"flex items-center justify-between px-4 py-3 opacity-60",children:[p.jsx("div",{children:p.jsx("p",{className:"text-sm font-medium",children:b.name})}),p.jsx(ir,{variant:"outline",className:"text-xs",children:"archived"})]},b.id))})})})})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm",children:"Recent Activity"})}),p.jsx(St,{className:"px-4 pb-4","data-testid":"dashboard-activity",children:l.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No recent activity."}):p.jsx("div",{className:"space-y-2 text-xs text-muted-foreground",children:l.map(b=>p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${v_e[b.type]}`,"aria-hidden":!0}),p.jsxs("div",{className:"flex-1",children:[p.jsx("span",{children:b.title}),b.body&&p.jsxs("span",{className:"text-muted-foreground/70",children:[" — ",b.body]})]}),p.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[p.jsx(a1,{d:vO,className:"h-3 w-3"}),b.createdAt.slice(0,16).replace("T"," ")]})]},b.id))})})]})]})})}function w_e(){const e=nn(),[t,r]=U.useState(),[i,n]=U.useState(!1),a=async l=>{var f;l.preventDefault(),r(void 0);const s=new FormData(l.currentTarget),c={displayName:String(s.get("displayName")??""),username:String(s.get("username")??""),password:String(s.get("password")??""),role:String(s.get("role")??"user"),gitName:String(s.get("gitName")??"")||void 0,gitEmail:String(s.get("gitEmail")??"")||void 0,gitPat:String(s.get("gitPat")??"")||void 0},u=Xq.safeParse(c);if(!u.success){r(((f=u.error.errors[0])==null?void 0:f.message)??"Invalid input");return}n(!0);const h=await we.users.create(u.data);if(n(!1),h.ok){e("/users");return}if(h.code==="USERNAME_TAKEN"){r("That username is already taken (case-insensitive).");return}r("Failed to create user. Please check the fields and try again.")};return p.jsx(Cr,{children:p.jsxs("form",{onSubmit:a,className:"max-w-lg space-y-4 p-4",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("h1",{className:"text-lg font-semibold",children:"Create Team Member"})}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Account Details"}),p.jsx(en,{className:"text-xs",children:"The new member will be forced to change their password on first login. Their username cannot be changed after creation."})]}),p.jsxs(St,{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"displayName",children:"Full Name"}),p.jsx(Xt,{id:"displayName",name:"displayName",placeholder:"Jane Smith",required:!0})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"username",children:"Username"}),p.jsx(Xt,{id:"username",name:"username",placeholder:"jsmith",className:"font-mono",required:!0}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Lowercase letters, digits, underscores. Cannot be changed."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"password",children:"Initial Password"}),p.jsx(Xt,{id:"password",name:"password",type:"password",placeholder:"Assign a temporary password…",required:!0}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Min 8 chars, 1 number, 1 special character. User must change it on first login."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"role",children:"Role"}),p.jsxs("select",{id:"role",name:"role",defaultValue:"user",className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[p.jsx("option",{value:"user",children:"Team Member"}),p.jsx("option",{value:"admin",children:"Team Admin"})]})]}),p.jsx(D9,{}),p.jsxs("div",{children:[p.jsx("p",{className:"mb-2 text-xs font-medium",children:"Git Identity (optional)"}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitName",className:"text-xs",children:"Git Name"}),p.jsx(Xt,{id:"gitName",name:"gitName",placeholder:"Jane Smith",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitEmail",className:"text-xs",children:"Git Email"}),p.jsx(Xt,{id:"gitEmail",name:"gitEmail",type:"email",placeholder:"jsmith@example.com",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitPat",className:"text-xs",children:"Git Personal Access Token"}),p.jsx(Xt,{id:"gitPat",name:"gitPat",type:"password",placeholder:"ghp_…",className:"font-mono text-xs"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Used by the Source Control module for push operations."})]})]})]}),t&&p.jsx("p",{className:"text-xs text-destructive",children:t}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[p.jsx(Ie,{type:"submit",disabled:i,children:i?"Creating…":"Create User"}),p.jsx(ri,{to:"/users",children:p.jsx(Ie,{type:"button",variant:"outline",children:"Cancel"})})]})]})]})]})})}function k_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(null),[n,a]=U.useState([]),[l,s]=U.useState([]),[c,u]=U.useState(!1),[h,f]=U.useState(null),[b,g]=U.useState(),[v,C]=U.useState(),[y,x]=U.useState(""),E=U.useCallback(async()=>{const H=await we.users.get(t);if(H.ok&&H.data)if(i(H.data),H.data.role==="user"&&H.data.isDeleted===0){const W=await we.users.assignments(t);W.ok&&W.data&&a(W.data);const z=await we.projects.list(!1);z.ok&&z.data&&s(z.data)}else a([]),s([]);else H.status===404&&u(!0)},[t]);if(U.useEffect(()=>{E()},[E]),c)return p.jsx(Cr,{children:p.jsxs("div",{className:"p-4 text-sm text-muted-foreground",children:["User not found."," ",p.jsx(ri,{to:"/users",className:"text-primary hover:underline",children:"Back to Users"})]})});if(!r)return p.jsx(Cr,{children:p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"})});const S=r.isDeleted===0,T=r.role==="admin"?"Team Admin":"Team Member",A=new Set(n.map(H=>H.projectId)),k=l.filter(H=>!A.has(H.id)),L=async H=>{H.preventDefault(),g(void 0);const W=new FormData(H.currentTarget);(await we.users.updateProfile(t,{displayName:String(W.get("displayName")??"")||void 0,gitName:String(W.get("gitName")??"")||void 0,gitEmail:String(W.get("gitEmail")??"")||void 0,gitPat:String(W.get("gitPat")??"")||void 0})).ok?(g("Saved."),await E()):g("Failed to save.")},N=async()=>{await we.users.promote(t),f(null),await E()},O=async()=>{const H=await we.users.deactivate(t);f(null),!H.ok&&H.code==="LAST_ADMIN_CONSTRAINT"&&g("Cannot deactivate the last remaining Team Admin."),await E()},B=async()=>{await we.users.reactivate(t),f(null),await E()},$=async()=>{C(void 0);const H=Number(y);if(!Number.isInteger(H)||H<=0){C("Enter a valid project id.");return}const W=await we.users.assign(t,H);W.ok?(x(""),await E()):W.code==="ALREADY_ASSIGNED"?C("That project is already assigned."):C("Failed to assign project.")},Y=async H=>{await we.users.unassign(t,H),await E()};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"max-w-lg space-y-4 p-4",children:[p.jsxs("div",{className:"text-xs text-muted-foreground",children:[p.jsx(ri,{to:"/users",className:"hover:underline",children:"Users"})," ","/ ",r.displayName]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h1",{className:"text-lg font-semibold",children:r.displayName}),p.jsx(ir,{variant:r.role==="admin"?"default":"outline",children:T}),p.jsx(ir,{variant:S?"success":"secondary",children:S?"active":"inactive"})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Account"})}),p.jsxs(St,{className:"space-y-2 text-sm",children:[p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Username"}),p.jsx("code",{className:"font-mono text-xs",children:r.username})]}),p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Member Since"}),p.jsx("span",{className:"text-xs",children:r.createdAt.slice(0,10)})]}),r.reactivatedAt&&p.jsxs("div",{className:"flex justify-between","data-testid":"reactivated-row",children:[p.jsx("span",{className:"text-muted-foreground",children:"Reactivated"}),p.jsxs("span",{className:"text-xs",children:[r.reactivatedAt.slice(0,19).replace("T"," ")," ",p.jsx("span",{className:"text-muted-foreground",children:"by"})," ",r.reactivatedByName??"admin"]})]})]})]}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Profile"}),p.jsx(en,{className:"text-xs",children:"Editable by Team Admin on behalf of the member. Does not change the password."})]}),p.jsx(St,{children:p.jsxs("form",{onSubmit:L,className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"displayName",className:"text-xs",children:"Display Name"}),p.jsx(Xt,{id:"displayName",name:"displayName",defaultValue:r.displayName,className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitName",className:"text-xs",children:"Git Name"}),p.jsx(Xt,{id:"gitName",name:"gitName",defaultValue:r.gitName??"",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitEmail",className:"text-xs",children:"Git Email"}),p.jsx(Xt,{id:"gitEmail",name:"gitEmail",type:"email",defaultValue:r.gitEmail??"",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitPat",className:"text-xs",children:"Personal Access Token"}),p.jsx(Xt,{id:"gitPat",name:"gitPat",defaultValue:r.gitPat??"",className:"font-mono text-xs"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ie,{type:"submit",children:"Save"}),b&&p.jsx("span",{className:"text-xs text-muted-foreground",children:b})]})]})})]}),r.role==="user"&&S&&p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Project Assignments"}),p.jsx(en,{className:"text-xs",children:"Team Members only see and work on their assigned projects."})]}),p.jsxs(St,{className:"space-y-2",children:[n.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No projects assigned. This user will not see any projects in their dashboard."}):p.jsx("div",{className:"space-y-1",children:n.map(H=>p.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-1.5",children:[p.jsx("span",{className:"text-xs",children:H.projectName}),p.jsx(Ie,{variant:"ghost",className:"h-6 px-2 text-xs text-muted-foreground hover:text-destructive",onClick:()=>Y(H.projectId),children:"Remove"})]},H.id))}),p.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[p.jsxs("select",{value:y,onChange:H=>x(H.target.value),"data-testid":"assign-project-select",disabled:k.length===0,className:"h-8 flex-1 rounded-md border border-input bg-transparent px-2 text-xs shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:[p.jsx("option",{value:"",children:k.length===0?"All projects already assigned":"Select a project…"}),k.map(H=>p.jsx("option",{value:H.id,children:H.name},H.id))]}),p.jsx(Ie,{className:"h-8",onClick:$,disabled:!y,children:"Assign"}),v&&p.jsx("span",{className:"text-xs text-destructive",children:v})]})]})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Admin Actions"})}),p.jsxs(St,{className:"space-y-2",children:[r.role==="user"&&S&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start",onClick:()=>f("promote"),children:"Promote to Team Admin"}),S&&r.username!=="admin"&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start border-destructive/30 text-destructive",onClick:()=>f("deactivate"),children:"Deactivate Account"}),!S&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start border-green-300 text-green-700",onClick:()=>f("reactivate"),children:"Reactivate Account"})]})]})]}),p.jsxs(ta,{open:h==="promote",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Promote ",r.displayName," to Team Admin?"]}),p.jsx(oc,{children:"Team Admins can create users, promote other members, and deactivate accounts. All other capabilities are identical to Team Member."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{onClick:N,children:"Promote"})]})]}),p.jsxs(ta,{open:h==="deactivate",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Deactivate ",r.displayName,"?"]}),p.jsx(oc,{children:"The account will be blocked from logging in. No data is deleted — deactivation is soft and reversible."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{variant:"destructive",onClick:O,children:"Deactivate"})]})]}),p.jsxs(ta,{open:h==="reactivate",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Reactivate ",r.displayName,"?"]}),p.jsx(oc,{children:"The account will be restored and the user will be able to log in again. They must log in fresh — existing sessions are not restored."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{onClick:B,children:"Reactivate"})]})]})]})}function A_e(e){return e==="admin"?"Team Admin":"Team Member"}function N_e(){const e=nn(),[t,r]=U.useState([]),[i,n]=U.useState(""),[a,l]=U.useState(!0);U.useEffect(()=>{we.users.list().then(c=>{c.ok&&c.data&&r(c.data),l(!1)})},[]);const s=U.useMemo(()=>{const c=i.toLowerCase();return t.filter(u=>u.displayName.toLowerCase().includes(c)||u.username.toLowerCase().includes(c))},[t,i]);return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Users"}),p.jsxs(ir,{variant:"secondary",children:[t.length," total"]})]}),p.jsx(Ie,{onClick:()=>e("/users/new"),children:"Create User"})]}),p.jsx(Xt,{placeholder:"Search by name or username…",value:i,onChange:c=>n(c.target.value),className:"h-8 w-64 text-xs"}),p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:p.jsxs(gp,{children:[p.jsx(bp,{children:p.jsxs(Ua,{children:[p.jsx(pi,{children:"Name"}),p.jsx(pi,{children:"Username"}),p.jsx(pi,{children:"Role"}),p.jsx(pi,{children:"Status"}),p.jsx(pi,{children:"Actions"})]})}),p.jsx(yp,{children:a?p.jsx(Ua,{children:p.jsx(ti,{colSpan:5,className:"text-center text-sm text-muted-foreground",children:"Loading…"})}):s.map(c=>{const u=c.isDeleted===0;return p.jsxs(Ua,{"data-testid":`user-row-${c.username}`,children:[p.jsx(ti,{className:"text-sm font-medium",children:p.jsx(ri,{to:`/users/${c.id}`,className:"hover:underline",children:c.displayName})}),p.jsx(ti,{className:"font-mono text-xs text-muted-foreground",children:c.username}),p.jsx(ti,{children:p.jsx(ir,{variant:c.role==="admin"?"default":"outline",children:A_e(c.role)})}),p.jsx(ti,{children:p.jsx(ir,{variant:u?"success":"secondary",children:u?"active":"inactive"})}),p.jsx(ti,{children:p.jsx(ri,{to:`/users/${c.id}`,className:"text-xs text-primary hover:underline",children:"View"})})]},c.id)})})]})})})]})})}function R_e(){return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-6",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Workspace"}),p.jsxs(zf,{defaultValue:"instance",children:[p.jsxs(qf,{children:[p.jsx(Fn,{value:"instance",children:"Instance Settings"}),p.jsx(Fn,{value:"prereqs",children:"Prerequisites"})]}),p.jsx(ya,{value:"instance",className:"mt-4 space-y-4",children:p.jsx(L_e,{})}),p.jsx(ya,{value:"prereqs",className:"mt-4",children:p.jsx(I_e,{})})]})]})})}function L_e(){const[e,t]=U.useState(null);U.useEffect(()=>{we.workspace.settings().then(i=>t(i.data))},[]);const r=e?[{key:"workspacePath",label:"Workspace Path",value:e.workspacePath},{key:"port",label:"Listen Port",value:String(e.port)},{key:"host",label:"Listen Host",value:e.host},{key:"provisioningState",label:"Provisioning State",value:e.provisioningState}]:[];return p.jsxs("div",{className:"space-y-4","data-testid":"ws-instance",children:[p.jsxs("div",{className:"rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-700","data-testid":"ws-readonly-note",children:["Instance settings are read-only in the app. To change the port or workspace path, update"," ",p.jsx("code",{children:".co2/settings.json"})," via the CLI and restart co2-cli (DevOps/System Admin only)."]}),p.jsx(Et,{children:p.jsxs(St,{className:"divide-y pt-4",children:[r.map(i=>p.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0 last:pb-0",children:[p.jsx("p",{className:"text-sm font-medium",children:i.label}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 text-sm","data-testid":`ws-setting-${i.key}`,children:i.value})]},i.key)),!e&&p.jsx("p",{className:"py-2 text-sm text-muted-foreground",children:"Loading…"})]})}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Plugin Status"})}),p.jsx(St,{children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm",children:"rashidee/co2-skills"}),p.jsx(ir,{variant:(e==null?void 0:e.pluginState)==="installed"?"success":"outline",children:(e==null?void 0:e.pluginState)??"—"})]})})]})]})}function I_e(){const[e,t]=U.useState([]),[r,i]=U.useState(!0),n=()=>{i(!0),we.workspace.prereqs().then(a=>{t(a.data??[]),i(!1)})};return U.useEffect(()=>n(),[]),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Host Prerequisites"}),p.jsx(en,{className:"text-xs",children:"Checked on demand. Node.js is always present (co2-cli is running). Claude Code CLI and co2-skills are auto-installed on first startup."})]}),p.jsxs(St,{className:"space-y-2","data-testid":"ws-prereqs",children:[e.map(a=>p.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2","data-testid":`ws-prereq-${a.status}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{"aria-hidden":!0,className:a.status==="ok"?"text-green-600":a.status==="missing"?"text-red-600":"text-yellow-600",children:a.status==="ok"?"●":a.status==="missing"?"✕":"?"}),p.jsx("span",{className:"text-sm",children:a.name})]}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 text-xs",children:a.version??a.status})]},a.name)),r&&p.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking…"}),p.jsx(Ie,{variant:"outline",className:"mt-2","data-testid":"ws-recheck",onClick:n,children:"Recheck Prerequisites"})]})]})}function xp(){return p.jsx("div",{className:"flex h-screen items-center justify-center text-sm text-muted-foreground",children:"Loading…"})}function Ti({children:e}){const{user:t,loading:r}=aa();return r?p.jsx(xp,{}):t?t.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):p.jsx(p.Fragment,{children:e}):p.jsx(xa,{to:"/login",replace:!0})}function qh({children:e}){const{user:t,loading:r}=aa();return r?p.jsx(xp,{}):t?t.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):t.role!=="admin"?p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(p.Fragment,{children:e}):p.jsx(xa,{to:"/login",replace:!0})}function D_e(){const{user:e,loading:t}=aa();return t?p.jsx(xp,{}):e?e.mustChangePassword?p.jsx(eG,{}):p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(xa,{to:"/login",replace:!0})}function O_e(){var i;const{user:e,loading:t}=aa();if(t)return p.jsx(xp,{});if(!e)return p.jsx(xa,{to:"/login",replace:!0});const r=(i=window.location.pathname.match(/^\/projects\/(\d+)/))==null?void 0:i[1];return p.jsx(xa,{to:`/projects/${r}/quality`,replace:!0})}function B_e(){const{user:e,loading:t}=aa();return t?p.jsx(xp,{}):e?e.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(xa,{to:"/login",replace:!0})}function M_e(){return p.jsx(dz,{children:p.jsx(yH,{children:p.jsxs(Lz,{children:[p.jsxs(Y$,{children:[p.jsx(Ar,{path:"/",element:p.jsx(B_e,{})}),p.jsx(Ar,{path:"/login",element:p.jsx(tG,{})}),p.jsx(Ar,{path:"/force-change-password",element:p.jsx(D_e,{})}),p.jsx(Ar,{path:"/projects",element:p.jsx(Ti,{children:p.jsx(T_e,{})})}),p.jsx(Ar,{path:"/projects/new",element:p.jsx(qh,{children:p.jsx(jxe,{})})}),p.jsx(Ar,{path:"/projects/import",element:p.jsx(qh,{children:p.jsx(Gye,{})})}),p.jsx(Ar,{path:"/projects/:id",element:p.jsx(Ti,{children:p.jsx(Oye,{})})}),p.jsx(Ar,{path:"/projects/:id/git",element:p.jsx(Ti,{children:p.jsx(Fye,{})})}),p.jsx(Ar,{path:"/projects/:id/terminal",element:p.jsx(Ti,{children:p.jsx(d_e,{})})}),p.jsx(Ar,{path:"/projects/:id/brainstorm",element:p.jsx(Ti,{children:p.jsx(_ye,{})})}),p.jsx(Ar,{path:"/projects/:id/brainstorm/:sessionId",element:p.jsx(Ti,{children:p.jsx(Tye,{})})}),p.jsx(Ar,{path:"/projects/:id/versions",element:p.jsx(Ti,{children:p.jsx(f_e,{})})}),p.jsx(Ar,{path:"/projects/:id/prd-wizard",element:p.jsx(Ti,{children:p.jsx(qxe,{})})}),p.jsx(Ar,{path:"/projects/:id/cicd",element:p.jsx(Ti,{children:p.jsx(Rye,{})})}),p.jsx(Ar,{path:"/projects/:id/shared-context",element:p.jsx(Ti,{children:p.jsx(c_e,{})})}),p.jsx(Ar,{path:"/projects/:id/context",element:p.jsx(Ti,{children:p.jsx(Iye,{})})}),p.jsx(Ar,{path:"/projects/:id/workflow",element:p.jsx(Ti,{children:p.jsx(E_e,{})})}),p.jsx(Ar,{path:"/projects/:id/artifacts",element:p.jsx(Ti,{children:p.jsx(yye,{})})}),p.jsx(Ar,{path:"/projects/:id/mockup",element:p.jsx(Ti,{children:p.jsx(Kye,{})})}),p.jsx(Ar,{path:"/projects/:id/source-code",element:p.jsx(Ti,{children:p.jsx(Lxe,{})})}),p.jsx(Ar,{path:"/projects/:id/quality",element:p.jsx(Ti,{children:p.jsx(Xxe,{})})}),p.jsx(Ar,{path:"/projects/:id/quality/new",element:p.jsx(Ti,{children:p.jsx(i_e,{})})}),p.jsx(Ar,{path:"/projects/:id/quality/:bugId",element:p.jsx(Ti,{children:p.jsx(e_e,{})})}),p.jsx(Ar,{path:"/projects/:id/defects",element:p.jsx(O_e,{})}),p.jsx(Ar,{path:"/users",element:p.jsx(qh,{children:p.jsx(N_e,{})})}),p.jsx(Ar,{path:"/users/new",element:p.jsx(qh,{children:p.jsx(w_e,{})})}),p.jsx(Ar,{path:"/users/:id",element:p.jsx(qh,{children:p.jsx(k_e,{})})}),p.jsx(Ar,{path:"/workspace",element:p.jsx(Ti,{children:p.jsx(R_e,{})})}),p.jsx(Ar,{path:"/notifications",element:p.jsx(Ti,{children:p.jsx(nG,{})})}),p.jsx(Ar,{path:"/settings/profile",element:p.jsx(Ti,{children:p.jsx(aG,{})})}),p.jsx(Ar,{path:"/settings/account",element:p.jsx(Ti,{children:p.jsx(Jq,{})})}),p.jsx(Ar,{path:"*",element:p.jsx(xa,{to:"/",replace:!0})})]}),p.jsx(Pz,{})]})})})}const O9=document.getElementById("root");if(!O9)throw new Error("#root not found");VU.createRoot(O9).render(p.jsx(U.StrictMode,{children:p.jsx(M_e,{})}));export{t3 as $,Kw as A,Z4 as B,Uhe as C,Hue as D,use as E,U_e as F,Xde as G,Nf as H,j_e as I,Vde as J,k0 as K,zse as L,u6 as M,nd as N,BD as O,Due as P,iE as Q,jhe as R,op as S,fs as T,Ne as U,Re as V,Zse as W,h6 as X,Nue as Y,Lhe as Z,M as _,ioe as a,Hn as a$,e3 as a0,K_e as a1,G_e as a2,V_e as a3,Y_e as a4,z_e as a5,Aw as a6,X_e as a7,q_e as a8,fu as a9,epe as aA,zw as aB,$w as aC,wg as aD,mhe as aE,phe as aF,fhe as aG,hhe as aH,nhe as aI,GF as aJ,ohe as aK,ihe as aL,uhe as aM,WF as aN,she as aO,yhe as aP,bhe as aQ,ghe as aR,_he as aS,xhe as aT,ahe as aU,YF as aV,dhe as aW,che as aX,lhe as aY,VF as aZ,Ype as a_,Q_e as aa,Z_e as ab,W_e as ac,wpe as ad,s7 as ae,l1e as af,Pt as ag,Bs as ah,fp as ai,mfe as aj,Vw as ak,ut as al,Rme as am,o1e as an,c1e as ao,a1e as ap,bt as aq,s1e as ar,Zw as as,ame as at,Jpe as au,Qpe as av,Jt as aw,Nb as ax,gn as ay,kn as az,roe as b,qs as b0,$h as b1,t8 as b2,xc as b3,a8 as b4,G4 as b5,Rue as b6,P_e as b7,Cc as b8,pfe as b9,$_e as ba,Sw as bb,nl as bc,If as bd,VD as be,cce as bf,mt as bg,zF as bh,ea as bi,rce as bj,vw as bk,w6 as bl,up as bm,N6 as bn,H_e as bo,yae as bp,Wpe as bq,Nr as c,rr as d,d6 as e,qi as f,aoe as g,Co as h,os as i,the as j,lp as k,$e as l,i8 as m,soe as n,ooe as o,toe as p,J_e as q,ul as r,noe as s,pae as t,d1e as u,u1e as v,zhe as w,es as x,_i as y,coe as z};
|
|
496
|
+
`&&a++,r.push(i),i="",t.push(r),r=[]):i+=l}return(i.length>0||r.length>0)&&(r.push(i),t.push(r)),t.filter(a=>!(a.length===1&&a[0]===""))}function a_e(e){const t=e.mimeType??"";return t==="text/csv"?"csv":t==="application/pdf"?"pdf":t.startsWith("image/")?"image":t==="text/markdown"?"markdown":"other"}function L9(e,t){for(const r of e){if(r.path===t)return r;if(r.children){const i=L9(r.children,t);if(i)return i}}return null}function I9({nodes:e,depth:t,selectedPath:r,expanded:i,onToggleFolder:n,onSelect:a}){return p.jsx("div",{children:e.map(l=>p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{a(l),l.type==="folder"&&n(l.path)},style:{paddingLeft:`${8+t*14}px`},className:`flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-xs transition-colors ${r===l.path?"bg-primary text-primary-foreground":"hover:bg-accent"}`,"data-testid":`shared-node-${l.path}`,children:[p.jsx("span",{className:"shrink-0",children:l.type==="folder"?i.has(l.path)?"📂":"📁":"📄"}),p.jsx("span",{className:"truncate",children:l.name})]}),l.type==="folder"&&i.has(l.path)&&l.children&&p.jsx(I9,{nodes:l.children,depth:t+1,selectedPath:r,expanded:i,onToggleFolder:n,onSelect:a})]},l.path))})}function s_e({url:e}){const[t,r]=U.useState(null);if(U.useEffect(()=>{r(null),fetch(e).then(a=>a.text()).then(a=>r(n_e(a))).catch(()=>r([]))},[e]),t==null)return p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Loading…"});const[i,...n]=t;return i?p.jsx("div",{className:"overflow-auto","data-testid":"csv-grid",children:p.jsxs("table",{className:"w-full border-collapse text-xs",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.map((a,l)=>p.jsx("th",{className:"sticky top-0 border bg-muted px-2 py-1 text-left font-medium",children:a},l))})}),p.jsx("tbody",{children:n.map((a,l)=>p.jsx("tr",{className:"odd:bg-muted/30",children:a.map((s,c)=>p.jsx("td",{className:"border px-2 py-1",children:s},c))},l))})]})}):p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Empty CSV."})}function o_e({projectId:e,path:t}){const[r,i]=U.useState(null),[n,a]=U.useState(!1),[l,s]=U.useState();return U.useEffect(()=>{i(null),a(!1),s(void 0),fetch(we.sharedContext.contentUrl(e,t)).then(c=>c.ok?c.text():Promise.reject(new Error(String(c.status)))).then(i).catch(()=>s("Failed to load file"))},[e,t]),l?p.jsx("p",{className:"p-4 text-xs text-destructive",children:l}):r==null?p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Loading…"}):p.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2 p-3",children:[p.jsx("div",{className:"min-h-[320px] min-w-0 flex-1",children:p.jsx(ss,{value:r,onChange:c=>{i(c),a(!1)},testId:"shared-md",height:"100%",className:"h-full rounded-md border border-border"})}),p.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[n&&p.jsx("span",{className:"text-xs text-green-600","data-testid":"shared-md-saved",children:"Saved"}),p.jsx(Ie,{className:"h-8 px-3 text-sm","data-testid":"shared-md-save",onClick:async()=>{(await we.sharedContext.saveMarkdown(e,t,r)).ok?a(!0):s("Save failed")},children:"Save"})]})]})}function l_e({projectId:e,node:t}){const r=a_e(t),i=we.sharedContext.contentUrl(e,t.path);switch(r){case"csv":return p.jsx(s_e,{url:i});case"image":return p.jsx("div",{className:"flex justify-center p-4",children:p.jsx("img",{src:i,alt:t.name,className:"max-w-full","data-testid":"image-preview"})});case"pdf":return p.jsx("iframe",{src:i,title:t.name,className:"h-full min-h-[70vh] w-full","data-testid":"pdf-preview"});case"markdown":return p.jsx(o_e,{projectId:e,path:t.path});default:return p.jsx("iframe",{src:i,title:t.name,className:"h-full min-h-[60vh] w-full","data-testid":"file-preview"})}}function c_e(){const{id:e}=an(),t=Number(e),[r,i]=Fb(),[n,a]=U.useState([]),[l,s]=U.useState(new Set),[c,u]=U.useState(null),[h,f]=U.useState(!1),[b,g]=U.useState(""),[v,C]=U.useState(),y=U.useRef(null),x=U.useCallback(async()=>{var N,O;const L=await we.sharedContext.tree(t);return a(((N=L.data)==null?void 0:N.tree)??[]),((O=L.data)==null?void 0:O.tree)??[]},[t]);U.useEffect(()=>{x().then(L=>{const N=r.get("file");if(!N)return;const O=L9(L,N);if(O){u(O);const B=N.split("/"),$=B.slice(0,-1).map((Y,H)=>B.slice(0,H+1).join("/"));s(new Set($))}})},[t]);const E=L=>{u(L),C(void 0),L.type==="file"&&i({file:L.path},{replace:!0})},S=L=>s(N=>{const O=new Set(N);return O.has(L)?O.delete(L):O.add(L),O}),T=c?c.type==="folder"?c.path:c.path.includes("/")?c.path.slice(0,c.path.lastIndexOf("/")):"":"",A=async()=>{const L=b.trim();if(!L)return;const N=T?`${T}/${L}`:L;if(!(await we.sharedContext.createFolder(t,N)).ok){C("Folder creation failed");return}f(!1),g(""),T&&s(B=>new Set(B).add(T)),await x()},k=async L=>{const N=L.target.files;if(!(!N||N.length===0)){C(void 0);for(const O of Array.from(N)){const B=await we.sharedContext.upload(t,T,O);B.ok||C(B.code==="FILE_TOO_LARGE"?`${O.name} exceeds the 25 MB limit`:`Upload of ${O.name} failed`)}L.target.value="",T&&s(O=>new Set(O).add(T)),await x()}};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"flex h-full",children:[p.jsxs("div",{className:"flex w-64 shrink-0 flex-col overflow-y-auto border-r bg-muted/20",children:[p.jsxs("div",{className:"flex items-center justify-between border-b p-2",children:[p.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Shared Context"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Ie,{variant:"outline",className:"h-6 px-1.5 text-[11px]",onClick:()=>f(!0),"data-testid":"new-folder",title:`New folder in ${T||"shared_context/"}`,children:"+ Folder"}),p.jsx(Ie,{variant:"outline",className:"h-6 px-1.5 text-[11px]",onClick:()=>{var L;return(L=y.current)==null?void 0:L.click()},"data-testid":"upload-file",title:`Upload into ${T||"shared_context/"}`,children:"↥ Upload"}),p.jsx("input",{ref:y,type:"file",multiple:!0,accept:".md,.markdown,.csv,.pdf,.png,.jpg,.jpeg,.gif,.webp,.svg,.txt,.json",className:"hidden",onChange:k,"data-testid":"upload-input"})]})]}),p.jsx("div",{className:"flex-1 py-1",children:n.length===0?p.jsx("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No files yet — create a folder or upload references (images, CSV, PDF, markdown)."}):p.jsx(I9,{nodes:n,depth:0,selectedPath:(c==null?void 0:c.path)??null,expanded:l,onToggleFolder:S,onSelect:E})}),v&&p.jsx("div",{className:"m-2 rounded-md border border-destructive/30 bg-destructive/10 px-2 py-1.5 text-xs text-destructive","data-testid":"shared-error",children:v})]}),p.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between border-b p-3",children:[p.jsx("span",{className:"text-sm font-medium",children:(c==null?void 0:c.type)==="file"?c.path:"Shared Context"}),(c==null?void 0:c.type)==="file"&&p.jsx("a",{href:we.sharedContext.contentUrl(t,c.path),target:"_blank",rel:"noreferrer",className:"text-xs text-muted-foreground underline hover:text-foreground","data-testid":"open-raw",children:"Open raw"})]}),p.jsx("div",{className:"min-h-0 flex-1",children:(c==null?void 0:c.type)==="file"?p.jsx(l_e,{projectId:t,node:c}):p.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:"Select a file on the left to preview it — CSV renders as a grid, PDF and images in their viewers, markdown in the editor with live preview."})})]})]}),p.jsx(ta,{open:h,onOpenChange:f,children:p.jsxs(bl,{className:"max-w-sm",children:[p.jsx(ra,{children:p.jsx(ia,{children:"New Folder"})}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created under ",p.jsx("code",{className:"font-mono",children:T||"shared_context/"})]}),p.jsx(Xt,{value:b,onChange:L=>g(L.target.value),placeholder:"folder-name","data-testid":"new-folder-name",onKeyDown:L=>{L.key==="Enter"&&A()}})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>f(!1),children:"Cancel"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:A,"data-testid":"new-folder-create",children:"Create"})]})]})})]})}const u_e=[{label:"Brainstorm",command:"/brainstorm-loop"},{label:"Run a conductor",command:"Execute co2-cli/execution/<path>.md"},{label:"PRD Wizard hand-off",command:'/util-updprd "<change request>"'}];function d_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(null);U.useEffect(()=>{we.projects.get(t).then(a=>i(a.data))},[t]);const n=(r==null?void 0:r.workspaceFolderName)??`project-${t}`;return p.jsx(Cr,{children:p.jsxs("div",{className:"mx-auto flex max-w-5xl flex-col gap-4 p-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Workspace Terminal"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["The shared, per-project Claude Code terminal. Claim it to open a session in"," ",p.jsxs("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:[n,"/"]}),". Only one user drives Claude Code on a project at a time."]})]}),p.jsxs(Et,{children:[p.jsx(Qt,{children:p.jsx(nr,{className:"text-sm",children:"co2-cli hand-off commands"})}),p.jsxs(St,{className:"space-y-1.5",children:[u_e.map(a=>p.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[p.jsx("span",{className:"w-40 shrink-0 text-muted-foreground",children:a.label}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:a.command})]},a.label)),p.jsx("p",{className:"pt-1 text-xs text-muted-foreground",children:"co2-cli surfaces these for you to paste — it never auto-runs Claude Code (CONSCO2069)."})]})]}),p.jsx("div",{className:"overflow-hidden rounded-lg border border-zinc-800",children:p.jsx(JO,{projectId:t,projectName:n})})]})})}function D9({className:e,...t}){return p.jsx("div",{role:"separator",className:ci("h-px w-full bg-border",e),...t})}const h_e=[{type:"major",label:"Major",hint:"breaking overall change"},{type:"minor",label:"Minor",hint:"new features"},{type:"patch",label:"Patch",hint:"typo / formatting"}];function r1({done:e}){return e?p.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-3 w-3","aria-hidden":"true",children:p.jsx("path",{d:"M20 6 9 17l-5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),p.jsx("span",{className:"text-[10px]",children:"done"})]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-3 w-3","aria-hidden":"true",children:p.jsx("circle",{cx:"12",cy:"12",r:"9"})}),p.jsx("span",{className:"text-[10px]",children:"pending"})]})}function f_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState([]),[n,a]=U.useState(!1),[l,s]=U.useState(!0),[c,u]=U.useState(!1),[h,f]=U.useState("minor"),[b,g]=U.useState(),v=()=>{Promise.all([we.versions.list(t),we.versions.canAdd(t)]).then(([S,T])=>{var A;i(S.data??[]),a(((A=T.data)==null?void 0:A.canAdd)??!1),s(!1)})};U.useEffect(v,[t]);const C=async()=>{g(void 0);const S=await we.versions.add(t,h);if(!S.ok){g(S.code==="VERSION_NOT_READY"?"All applications must reach Quality first.":S.code==="GIT_OPERATION_FAILED"?`Git operation failed — no version was cut. ${S.message??""}`.trim():"Cut failed.");return}u(!1),v()};if(l)return p.jsx(Cr,{children:p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"})});const y=r.find(S=>S.isCurrent),x=(y==null?void 0:y.apps.filter(S=>S.qualityCompleted).length)??0,E=(y==null?void 0:y.apps.length)??0;return p.jsxs(Cr,{children:[p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Versions"}),p.jsx(Ie,{className:"h-8 gap-1 px-3 text-sm",disabled:!n,onClick:()=>u(!0),"data-testid":"add-version",children:"+ Add Version"})]}),!n&&y&&p.jsxs("div",{className:"rounded-md border border-yellow-200 bg-yellow-50 px-3 py-2 text-xs text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950/20 dark:text-yellow-400",children:["A new version can only be added after a conductor run completes for ",y.semver,". Quality reached:"," ",p.jsxs("strong",{children:[x,"/",E]})," ","applications."]}),p.jsx("div",{className:"space-y-3","data-testid":"version-list",children:r.map(S=>{const T=S.apps.filter(N=>N.prepareCompleted).length,A=S.apps.filter(N=>N.developCompleted).length,k=S.apps.filter(N=>N.qualityCompleted).length,L=S.apps.length;return p.jsxs(Et,{className:S.isCurrent?"border-primary/40":"",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-mono text-sm font-semibold",children:S.semver}),S.isCurrent?p.jsx(ir,{variant:"default",className:"text-xs",children:"current"}):p.jsx(ir,{variant:"outline",className:"text-xs",children:"read-only"}),p.jsx(ir,{variant:"outline",className:"text-xs capitalize",children:S.versionType}),p.jsx(ir,{variant:"secondary",className:"font-mono text-[10px]",children:S.gitBranch})]}),p.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[p.jsxs("span",{children:["Prepare"," ",p.jsxs("strong",{children:[T,"/",L]})]}),p.jsxs("span",{children:["Develop"," ",p.jsxs("strong",{children:[A,"/",L]})]}),p.jsxs("span",{children:["Quality"," ",p.jsxs("strong",{className:L>0&&k===L?"text-green-600":"",children:[k,"/",L]})]})]})]})}),p.jsxs(St,{className:"px-4 pb-4",children:[S.apps.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No applications yet — import them by rescanning CLAUDE.md after the brainstorm."}):p.jsxs("table",{className:"w-full text-xs",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b text-muted-foreground",children:[p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Application"}),p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Prepare"}),p.jsx("th",{className:"py-1 pr-4 text-left font-medium",children:"Develop"}),p.jsx("th",{className:"py-1 text-left font-medium",children:"Quality"})]})}),p.jsx("tbody",{children:S.apps.map(N=>p.jsxs("tr",{className:"border-b last:border-0",children:[p.jsx("td",{className:"py-1.5 pr-4 font-mono text-[11px]",children:N.name}),p.jsx("td",{className:"py-1.5 pr-4",children:p.jsx(r1,{done:N.prepareCompleted})}),p.jsx("td",{className:"py-1.5 pr-4",children:p.jsx(r1,{done:N.developCompleted})}),p.jsx("td",{className:"py-1.5",children:p.jsx(r1,{done:N.qualityCompleted})})]},N.applicationId))})]}),!S.isCurrent&&p.jsxs(p.Fragment,{children:[p.jsx(D9,{className:"my-3"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Prior version is read-only. Content is frozen at the snapshot taken when it was cut."})]})]})]},S.id)})})]}),p.jsxs(ta,{open:c,onOpenChange:u,children:[p.jsxs(ra,{children:[p.jsx(ia,{children:"Add New Version"}),p.jsx(oc,{children:"Snapshot every application's PRD.md / BUG.md at the new version and make it current."})]}),p.jsxs("div",{className:"space-y-3 py-2",children:[p.jsx("div",{className:"grid grid-cols-3 gap-2",children:h_e.map(S=>p.jsxs("button",{type:"button",onClick:()=>f(S.type),className:`rounded-md border px-3 py-2 text-left text-xs transition-colors ${h===S.type?"border-primary bg-primary/10":"hover:bg-muted"}`,"data-testid":`bump-${S.type}`,children:[p.jsx("div",{className:"font-medium",children:S.label}),p.jsx("div",{className:"text-muted-foreground",children:S.hint})]},S.type))}),b&&p.jsx("p",{className:"text-xs text-destructive",children:b})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>u(!1),children:"Cancel"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:C,"data-testid":"confirm-add-version",children:"Create Version"})]})]})]})}const p_e=5e3,EO=[{value:"prepare",label:"Prepare (conductor-feature-prepare)"},{value:"develop",label:"Develop (conductor-feature-develop)"},{value:"quality",label:"Quality (conductor-defect)"}],Yl={prepare:"Prepare",develop:"Develop",quality:"Quality (conductor-defect)"},CO={from:"",to:"",conductor:"",apps:[],version:""};function m_e(e,t){return e.filter(r=>{const i=r.createdAt.slice(0,10);return t.from&&i<t.from||t.to&&i>t.to||t.conductor&&r.conductorType!==t.conductor||t.apps.length>0&&!r.applicationNames.some(n=>t.apps.includes(n))?!1:t.version==="__none__"?!r.versionLabel:!(t.version&&r.versionLabel!==t.version)})}function g_e(e,t){const r=u=>u.replace(/^v/,"").split(".").map(Number),[i=0,n=0,a=0]=r(e),[l=0,s=0,c=0]=r(t);return l-i||s-n||c-a}function UE({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const b_e="M6 3l14 9-14 9V3z",y_e="M9 9V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-4M3 11a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",x_e="M20 6 9 17l-5-5";function __e({text:e,testid:t}){const[r,i]=U.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e)}catch{}i(!0),setTimeout(()=>i(!1),1500)};return p.jsxs(Ie,{size:"sm",variant:"outline",className:"h-7 gap-1 px-2 text-xs",onClick:n,"data-testid":t,children:[r?p.jsx(UE,{d:x_e,className:"h-3 w-3 text-green-500"}):p.jsx(UE,{d:y_e,className:"h-3 w-3"}),r?"Copied!":"Copy"]})}function i1({label:e,status:t}){const r=t==="completed"?"border-green-600 text-green-600":t==="in_progress"?"border-yellow-600 text-yellow-600":"border-border text-muted-foreground";return p.jsxs(ir,{variant:"outline",className:`h-4 px-1 text-[10px] ${r}`,children:[e,": ",t==="in_progress"?"in progress":t]})}function n1({status:e}){const t={pending:"bg-muted text-muted-foreground",in_progress:"bg-yellow-100 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400",completed:"bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-400",failed:"bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400",force_stopped:"bg-muted text-muted-foreground"};return p.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-[10px] font-medium uppercase ${t[e]}`,"data-testid":"run-status-chip",children:e.replace("_"," ")})}function E_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(""),[n,a]=U.useState([]),[l,s]=U.useState(!1),[c,u]=U.useState(),[h,f]=U.useState(!1),[b,g]=U.useState(!1),[v,C]=U.useState(),[y,x]=U.useState(0),[E,S]=U.useState([]),[T,A]=U.useState(null),[k,L]=U.useState([]),[N,O]=U.useState(),[B,$]=U.useState(null),[Y,H]=U.useState(null),W=U.useCallback(async(oe,se)=>{const xe=await we.workflow.changelogContent(oe,se);xe.ok&&xe.data?($({filePath:xe.data.filePath,content:xe.data.content}),H(null)):O(xe.code==="CHANGELOG_NOT_FOUND"?`No CHANGELOG.md yet for ${se} — it appears once the conductor has run.`:"Could not load the CHANGELOG.md.")},[]),[z,F]=U.useState(CO),X=U.useRef(null),G=U.useMemo(()=>m_e(k,z),[k,z]),P=U.useMemo(()=>[...new Set(k.flatMap(oe=>oe.applicationNames))].sort(),[k]),D=U.useMemo(()=>[...new Set(k.map(oe=>oe.versionLabel).filter(oe=>!!oe))].sort(g_e),[k]),j=U.useMemo(()=>k.some(oe=>!oe.versionLabel),[k]),K=z.from!==""||z.to!==""||z.conductor!==""||z.apps.length>0||z.version!=="",V=oe=>{F(se=>({...se,apps:se.apps.includes(oe)?se.apps.filter(xe=>xe!==oe):[...se.apps,oe]}))},{version:ie}=cs(),ye=(ie==null?void 0:ie.isLocked)??!1,pe=(T==null?void 0:T.status)==="pending"||(T==null?void 0:T.status)==="in_progress",te=U.useCallback(()=>{we.workflow.listRuns(t).then(oe=>L(oe.data??[]))},[t]);U.useEffect(()=>{we.context.registry(t).then(oe=>{var se;return x(((se=oe.data)==null?void 0:se.applications.length)??0)}),te(),we.workflow.activeRun(t).then(oe=>{oe.data&&A(oe.data)})},[t,te]),U.useEffect(()=>{if(S([]),s(!1),u(void 0),!r){a([]);return}Promise.all([we.workflow.pendingApps(t,r,ie==null?void 0:ie.id),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id)]).then(([oe,se])=>{a(oe.data??[]),se.data&&u(se.data),s(!0)})},[t,r,ie==null?void 0:ie.id]),U.useEffect(()=>{if(X.current&&clearInterval(X.current),!!T&&!(T.status==="completed"||T.status==="failed"))return X.current=setInterval(()=>{we.workflow.getRun(T.id).then(oe=>{oe.data&&(A(oe.data),(oe.data.status==="completed"||oe.data.status==="failed")&&(te(),r&&we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[]))))})},p_e),()=>{X.current&&clearInterval(X.current)}},[T,te,r,t,ie==null?void 0:ie.id]);const Z=async()=>{if(!T)return;await we.workflow.forceStop(T.id);const oe=await we.workflow.getRun(T.id);A(oe.data??null),te(),r&&we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[]))},he=async()=>{if(!(!T||h)){f(!0);try{const oe=await we.workflow.rescan(T.id);oe.data&&A(oe.data),te(),r&&(we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(se=>a(se.data??[])),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id).then(se=>se.data&&u(se.data)))}finally{f(!1)}}},ce=async()=>{if(!b){g(!0),C(void 0);try{const oe=await we.workflow.rescanAll(t);if(oe.ok&&oe.data){const xe=oe.data.discoveredRuns;C(xe>0?`Rescan complete — ${xe} terminal-executed run${xe===1?"":"s"} discovered.`:"Rescan complete — all statuses are up to date.")}else C("Rescan failed.");te();const se=await we.workflow.activeRun(t);if(se.data)A(se.data);else if(T){const xe=await we.workflow.getRun(T.id);A(xe.data??null)}r&&(we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(xe=>a(xe.data??[])),we.workflow.phaseCompletion(t,r,ie==null?void 0:ie.id).then(xe=>xe.data&&u(xe.data)))}finally{g(!1)}}},me=oe=>{S(se=>se.includes(oe)?se.filter(xe=>xe!==oe):[...se,oe])},be=async()=>{if(!r||E.length===0||ye||pe)return;O(void 0);const oe=await we.workflow.createRun(t,E,r,ie==null?void 0:ie.id);if(!oe.ok||!oe.data){O(oe.code==="ACTIVE_RUN_EXISTS"?"An execution is already in progress — only one runs at a time. Wait for it to complete or force-stop it.":oe.code==="APPS_NOT_PENDING"?"One or more selected applications are no longer pending this phase.":"Failed to generate the workflow markdown.");return}const se=await we.workflow.getRun(oe.data.id);A(se.data??null),te(),we.workflow.pendingApps(t,r,ie==null?void 0:ie.id).then(xe=>a(xe.data??[])),S([])};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(UE,{d:b_e,className:"h-4 w-4 text-primary"}),p.jsx("h1",{className:"text-lg font-semibold",children:"Workflow Execution"})]}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a conductor, pick the applications still pending that phase, then paste the generated prompt into the Terminal. co2-cli monitors the tracking file automatically and runs git once the conductor completes — it never runs Claude Code itself."}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm",children:"1. Select Conductor"})}),p.jsxs(St,{className:"space-y-4 px-4 pb-4",children:[p.jsxs("select",{value:r,onChange:oe=>i(oe.target.value),className:"h-8 w-full max-w-sm rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-conductor-select",children:[p.jsx("option",{value:"",children:"Select a conductor…"}),EO.map(oe=>p.jsx("option",{value:oe.value,children:oe.label},oe.value))]}),r&&l&&p.jsxs("div",{className:"space-y-2","data-testid":"wf-pending-apps",children:[n.length===0?r==="quality"?p.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-500","data-testid":"wf-quality-empty",children:c&&c.total===0?"No application has completed the Develop phase yet — run Develop before QA.":`No defects reported for ${(ie==null?void 0:ie.semver)??"this version"} yet — report a bug in QA Mode, then click Rescan status.`}):c&&c.total===0&&y>0?p.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-500","data-testid":"wf-none-affected",children:["No applications are affected by version ",(ie==null?void 0:ie.semver)??"this version"," — none has a User Story, NFR, Constraint, Reference or Test change tagged to it. Switch to a version with requirement changes in the topbar, or add requirements to this version first."]}):c&&c.total>0&&c.completed===c.total?p.jsxs("div",{className:"rounded-md border border-green-200 bg-green-50 px-3 py-2 text-xs text-green-700 dark:border-green-900 dark:bg-green-950/20 dark:text-green-400","data-testid":"wf-all-completed",children:["All applications have completed the ",Yl[r]," phase. No runs needed."]}):p.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-500","data-testid":"wf-none-eligible",children:["No applications are eligible for the ",Yl[r]," phase yet (",(c==null?void 0:c.completed)??0," of ",(c==null?void 0:c.total)??0," ","completed). An application becomes eligible once its prior phase has completed — if a conductor just finished, use ",p.jsx("strong",{children:"Rescan status"})," on the active run below to pick it up."]}):p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Applications pending ",Yl[r],":"," ",p.jsxs("strong",{children:[n.length," of"," ",Math.max((c==null?void 0:c.total)??y,n.length)]})," ","apps"]}),p.jsx("div",{className:"divide-y rounded-md border",children:n.map(oe=>p.jsxs("label",{className:"flex cursor-pointer items-center justify-between px-3 py-2 hover:bg-muted/50","data-testid":`wf-app-${oe.applicationName}`,children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"checkbox",checked:E.includes(oe.applicationId),onChange:()=>me(oe.applicationId),className:"h-3.5 w-3.5"}),p.jsx("span",{className:"font-mono text-xs",children:oe.applicationName})]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(i1,{label:"Prepare",status:oe.prepareStatus}),p.jsx(i1,{label:"Develop",status:oe.developStatus}),p.jsx(i1,{label:"Quality",status:oe.qualityStatus})]})]},oe.applicationId))}),ye&&p.jsxs("p",{className:"text-xs text-amber-600","data-testid":"wf-version-locked",children:[ie==null?void 0:ie.semver," is a read-only prior version — switch to the current version in the topbar to execute a conductor."]}),pe&&p.jsx("p",{className:"text-xs text-amber-600","data-testid":"wf-run-active-note",children:"An execution is already in progress — only one runs at a time. Wait for it to complete (it keeps running in the background) or force-stop it below."}),p.jsx(Ie,{className:"h-8 px-3 text-sm",disabled:E.length===0||ye||pe,onClick:be,"data-testid":"wf-prepare-to-execute",children:"Prepare to Execute"})]}),N&&p.jsx("p",{className:"text-xs text-destructive","data-testid":"wf-error",children:N})]})]})]}),T&&p.jsxs("div",{className:"grid grid-cols-5 items-start gap-4","data-testid":"wf-generated",children:[p.jsxs(Et,{className:T.executeCommand?"col-span-3":"col-span-5",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(nr,{className:"text-sm",children:"Workflow Run"}),p.jsx(n1,{status:T.status})]})}),p.jsxs(St,{className:"space-y-2 px-4 pb-4 text-xs",children:[p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Conductor:"})," ",Yl[T.conductorType]]}),T.applications&&T.applications.length>0?p.jsxs("div",{className:"space-y-1","data-testid":"wf-app-breakdown",children:[p.jsx("span",{className:"text-muted-foreground",children:"Applications:"}),T.applications.map(oe=>p.jsxs("div",{className:"ml-2 space-y-0.5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"font-mono",children:oe.applicationName}),p.jsx(n1,{status:oe.status})]}),oe.status==="pending"&&!oe.trackingFileExists&&p.jsxs("p",{className:"text-[10px] text-amber-600","data-testid":"wf-app-no-tracking",children:["No tracking file found at"," ",p.jsx("code",{className:"font-mono",children:oe.trackingFilePath})," — this application's conductor has not started or reported yet. Paste the Execute prompt again to (re)run it (completed applications are skipped), or force-stop the execution."]})]},oe.applicationName))]}):p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Applications:"})," ",p.jsx("span",{className:"font-mono",children:T.applicationNames.join(", ")})]}),p.jsxs("p",{children:[p.jsx("span",{className:"text-muted-foreground",children:"Version:"})," ",T.versionLabel??"—"]}),p.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:T.filePath}),T.gitOperationStatus!=="not_started"&&p.jsxs("p",{"data-testid":"wf-git-chip",children:[p.jsx("span",{className:"text-muted-foreground",children:"Git:"})," ",p.jsxs(ir,{variant:"outline",className:"h-4 px-1 text-[10px]",children:[T.gitOperationStatus,T.gitCommitHash?` · ${T.gitCommitHash} / ${T.gitBranchCreated}`:""]})]}),pe&&p.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Monitoring continues in the background — you can navigate to other pages and come back; this card will still be here until the run completes."}),p.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs",onClick:he,disabled:h,"data-testid":"wf-rescan",children:h?"Rescanning…":"Rescan status"}),p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs text-destructive",onClick:Z,"data-testid":"wf-force-stop",children:"Force stop"})]})]})]})]}),T.executeCommand&&p.jsxs(Et,{className:"col-span-2 border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-950/20",children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm text-blue-800 dark:text-blue-300",children:"Run in Terminal"})}),p.jsxs(St,{className:"space-y-3 px-4 pb-4",children:[p.jsx("code",{className:"block whitespace-pre-wrap break-all rounded bg-zinc-900 px-2 py-1.5 font-mono text-[11px] text-green-400","data-testid":"wf-execute-command",children:T.executeCommand}),p.jsx(__e,{text:T.executeCommand,testid:"wf-copy-command"}),p.jsx("p",{className:"text-[10px] text-blue-700 dark:text-blue-400",children:"Claim the Workspace Terminal docked at the bottom of the screen (same as the Brainstorm step) and paste this prompt there. Monitoring runs automatically — the status chip updates as the conductor's tracking file changes."})]})]})]}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"px-4 pb-2 pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(nr,{className:"text-sm",children:"Run History"}),p.jsxs("div",{className:"flex items-center gap-2",children:[k.length>0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground","data-testid":"wf-history-count",children:["Showing ",G.length," of ",k.length," run",k.length===1?"":"s"]}),p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs",onClick:ce,disabled:b,"data-testid":"wf-rescan-all",children:b?"Rescanning…":"Rescan all statuses"})]})]}),v&&p.jsx("p",{className:"text-[10px] text-muted-foreground","data-testid":"wf-rescan-all-msg",children:v})]}),p.jsx(St,{className:"px-4 pb-4",children:k.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No workflow runs yet."}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mb-3 space-y-2","data-testid":"wf-history-filters",children:[p.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["From",p.jsx("input",{type:"date",value:z.from,onChange:oe=>F(se=>({...se,from:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-from"})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["To",p.jsx("input",{type:"date",value:z.to,onChange:oe=>F(se=>({...se,to:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-to"})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["Conductor",p.jsxs("select",{value:z.conductor,onChange:oe=>F(se=>({...se,conductor:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-conductor",children:[p.jsx("option",{value:"",children:"All conductors"}),EO.map(oe=>p.jsx("option",{value:oe.value,children:Yl[oe.value]},oe.value))]})]}),p.jsxs("label",{className:"flex flex-col gap-0.5 text-[10px] text-muted-foreground",children:["Version",p.jsxs("select",{value:z.version,onChange:oe=>F(se=>({...se,version:oe.target.value})),className:"h-8 rounded-md border border-input bg-background px-2 text-xs","data-testid":"wf-filter-version",children:[p.jsx("option",{value:"",children:"All versions"}),D.map(oe=>p.jsx("option",{value:oe,children:oe},oe)),j&&p.jsx("option",{value:"__none__",children:"No version"})]})]}),K&&p.jsx(Ie,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs",onClick:()=>F(CO),"data-testid":"wf-filter-clear",children:"Clear filters"})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Applications:"}),P.map(oe=>p.jsxs("label",{className:`flex cursor-pointer items-center gap-1 rounded-md border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${z.apps.includes(oe)?"border-primary bg-primary/10":"border-input hover:bg-muted/50"}`,"data-testid":`wf-filter-app-${oe}`,children:[p.jsx("input",{type:"checkbox",checked:z.apps.includes(oe),onChange:()=>V(oe),className:"h-3 w-3"}),oe]},oe))]})]}),G.length===0?p.jsx("p",{className:"text-xs text-muted-foreground","data-testid":"wf-history-no-match",children:"No runs match the current filters."}):p.jsxs("table",{className:"w-full text-xs","data-testid":"wf-history",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b text-muted-foreground",children:[p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Date"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Conductor"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Applications"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Version"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Path"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"CHANGELOG"}),p.jsx("th",{className:"py-1 pr-3 text-left font-medium",children:"Status"}),p.jsx("th",{className:"py-1 text-left font-medium",children:"Git"})]})}),p.jsx("tbody",{children:G.map(oe=>p.jsxs("tr",{className:"border-b last:border-0",children:[p.jsx("td",{className:"py-1.5 pr-3 whitespace-nowrap",children:oe.createdAt.slice(0,10)}),p.jsx("td",{className:"py-1.5 pr-3",children:Yl[oe.conductorType]}),p.jsx("td",{className:"py-1.5 pr-3 font-mono text-[11px]",children:oe.applicationNames.join(", ")}),p.jsx("td",{className:"py-1.5 pr-3",children:oe.versionLabel??"—"}),p.jsx("td",{className:"py-1.5 pr-3 font-mono text-[10px] text-muted-foreground",children:p.jsx("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>we.workflow.runFileContent(oe.id).then(se=>{se.data&&$(se.data)}),"data-testid":`wf-history-path-${oe.id}`,children:oe.filePath})}),p.jsx("td",{className:"py-1.5 pr-3 text-[11px]",children:(()=>{const se=oe.applicationNames.filter(Boolean);return se.length===0?p.jsx("span",{className:"text-muted-foreground",children:"—"}):se.length===1?p.jsx("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>W(oe.id,se[0]),"data-testid":`wf-history-changelog-${oe.id}`,children:"CHANGELOG.md"}):p.jsxs("button",{type:"button",className:"text-left text-blue-600 underline underline-offset-2 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>H({runId:oe.id,title:`${Yl[oe.conductorType]} · ${oe.versionLabel??""}`.trim(),apps:se}),"data-testid":`wf-history-changelog-${oe.id}`,children:["CHANGELOG.md (",se.length,")"]})})()}),p.jsx("td",{className:"py-1.5 pr-3",children:p.jsx(n1,{status:oe.status})}),p.jsx("td",{className:"py-1.5 text-[10px]",children:oe.gitCommitHash?`${oe.gitCommitHash} / ${oe.gitBranchCreated}`:oe.gitOperationStatus})]},oe.id))})]})]})})]})]}),p.jsx(ta,{open:Y!==null,onOpenChange:oe=>!oe&&H(null),className:"max-w-md",children:p.jsxs(bl,{children:[p.jsx(ra,{children:p.jsxs(ia,{className:"text-sm",children:["CHANGELOG.md — ",Y==null?void 0:Y.title]})}),p.jsx("div",{className:"flex flex-col gap-1 py-1","data-testid":"wf-changelog-chooser",children:Y==null?void 0:Y.apps.map(oe=>p.jsxs("button",{type:"button",className:"flex items-center justify-between rounded-md border border-border px-3 py-2 text-left text-xs hover:bg-muted",onClick:()=>void W(Y.runId,oe),"data-testid":`wf-changelog-app-${oe}`,children:[p.jsx("span",{className:"font-mono",children:oe}),p.jsx("span",{className:"text-blue-600 underline underline-offset-2 dark:text-blue-400",children:"CHANGELOG.md"})]},oe))})]})}),p.jsx(ta,{open:B!==null,onOpenChange:oe=>!oe&&$(null),className:"max-w-4xl",children:p.jsxs(bl,{children:[p.jsx(ra,{children:p.jsx(ia,{className:"font-mono text-sm",children:B==null?void 0:B.filePath})}),p.jsx("div",{"data-testid":"wf-history-preview",children:B&&p.jsx(ss,{value:B.content,onChange:()=>{},previewOnly:!0,height:"70vh"})})]})})]})}function a1({d:e,className:t}){return p.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t??"h-4 w-4","aria-hidden":"true",children:p.jsx("path",{d:e})})}const C_e="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",vO="M12 6v6l4 2M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",v_e={conductor_complete:"bg-green-500",conductor_progress:"bg-yellow-500",brainstorm_advance:"bg-purple-500",artifact_ready:"bg-blue-500"};function S_e(e){return(e.split(/[\s_-]+/).filter(Boolean).map(r=>r[0]).join("")||e.slice(0,2)).slice(0,2).toUpperCase()}function T_e(){const{user:e}=aa(),t=nn(),[r,i]=U.useState([]),[n,a]=U.useState([]),[l,s]=U.useState([]),[c,u]=U.useState(!0);U.useEffect(()=>{Promise.all([we.dashboard.list(!1),we.dashboard.list(!0),we.notifications.list("all",5)]).then(([b,g,v])=>{var C;i(b.data??[]),a(g.data??[]),s(((C=v.data)==null?void 0:C.items)??[])}).finally(()=>u(!1))},[]);const h=[{label:"Projects",value:String(r.length),icon:C_e,extra:null}],f=({p:b})=>p.jsxs(ri,{to:b.creationStatus==="brainstorm_ready"?`/projects/new?step=brainstorm&projectId=${b.id}`:`/projects/${b.id}`,"data-testid":`project-row-${b.name}`,className:"flex items-center justify-between px-4 py-3 hover:bg-muted/50",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-xs font-bold text-primary",children:b.code||S_e(b.name)}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-medium",children:b.name}),b.creationStatus!=="fully_created"&&p.jsx("div",{className:"mt-0.5 flex items-center gap-1",children:p.jsx(ir,{variant:"secondary",className:"text-xs",children:b.creationStatus==="initializing"?"Initializing…":"Brainstorm"})})]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[b.creationStatus==="brainstorm_ready"&&p.jsx(Ie,{size:"sm",variant:"outline",className:"h-7 text-xs","data-testid":`continue-brainstorm-${b.id}`,onClick:g=>{g.preventDefault(),g.stopPropagation(),t(`/projects/new?step=brainstorm&projectId=${b.id}`)},children:"Continue Brainstorm →"}),p.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p.jsx(a1,{d:vO,className:"h-3 w-3"}),b.lastActivityAt.slice(0,10)]}),b.creationStatus!=="brainstorm_ready"&&p.jsx("span",{className:"text-xs text-muted-foreground",children:"Open →"})]})]});return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Dashboard"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["Welcome, ",e==null?void 0:e.displayName,"."," ",(e==null?void 0:e.role)==="admin"?"All projects":"Your assigned projects"," and their CO2 workflow progress."]})]}),(e==null?void 0:e.role)==="admin"&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ie,{variant:"outline",className:"h-8 px-3 text-sm",onClick:()=>t("/projects/import"),"data-testid":"import-project",children:"Import Project"}),p.jsx(Ie,{className:"h-8 px-3 text-sm",onClick:()=>t("/projects/new"),children:"New Project"})]})]}),p.jsx("div",{className:"grid grid-cols-4 gap-3","data-testid":"dashboard-stats",children:h.map(b=>p.jsx(Et,{className:"p-3",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:b.label}),p.jsx("p",{className:"mt-1 text-2xl font-bold",children:c?"—":b.value}),b.extra&&p.jsx("p",{className:"text-xs text-muted-foreground",children:b.extra})]}),p.jsx(a1,{d:b.icon,className:"h-6 w-6 text-muted-foreground/50"})]})},b.label))}),c?p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):p.jsxs(zf,{defaultValue:"active",children:[p.jsxs(qf,{children:[p.jsxs(Fn,{value:"active",children:["Active (",r.length,")"]}),p.jsxs(Fn,{value:"archived",children:["Archived (",n.length,")"]})]}),p.jsx(ya,{value:"active",className:"mt-3",children:p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:r.length===0?p.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground","data-testid":"projects-empty",children:"No projects yet."}):p.jsx("div",{className:"divide-y",children:r.map(b=>p.jsx(f,{p:b},b.id))})})})}),p.jsx(ya,{value:"archived",className:"mt-3",children:p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:n.length===0?p.jsx("p",{className:"p-6 text-center text-sm text-muted-foreground",children:"No archived projects."}):p.jsx("div",{className:"divide-y",children:n.map(b=>p.jsxs("div",{"data-testid":`archived-row-${b.name}`,className:"flex items-center justify-between px-4 py-3 opacity-60",children:[p.jsx("div",{children:p.jsx("p",{className:"text-sm font-medium",children:b.name})}),p.jsx(ir,{variant:"outline",className:"text-xs",children:"archived"})]},b.id))})})})})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"px-4 pb-2 pt-4",children:p.jsx(nr,{className:"text-sm",children:"Recent Activity"})}),p.jsx(St,{className:"px-4 pb-4","data-testid":"dashboard-activity",children:l.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No recent activity."}):p.jsx("div",{className:"space-y-2 text-xs text-muted-foreground",children:l.map(b=>p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${v_e[b.type]}`,"aria-hidden":!0}),p.jsxs("div",{className:"flex-1",children:[p.jsx("span",{children:b.title}),b.body&&p.jsxs("span",{className:"text-muted-foreground/70",children:[" — ",b.body]})]}),p.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[p.jsx(a1,{d:vO,className:"h-3 w-3"}),b.createdAt.slice(0,16).replace("T"," ")]})]},b.id))})})]})]})})}function w_e(){const e=nn(),[t,r]=U.useState(),[i,n]=U.useState(!1),a=async l=>{var f;l.preventDefault(),r(void 0);const s=new FormData(l.currentTarget),c={displayName:String(s.get("displayName")??""),username:String(s.get("username")??""),password:String(s.get("password")??""),role:String(s.get("role")??"user"),gitName:String(s.get("gitName")??"")||void 0,gitEmail:String(s.get("gitEmail")??"")||void 0,gitPat:String(s.get("gitPat")??"")||void 0},u=Xq.safeParse(c);if(!u.success){r(((f=u.error.errors[0])==null?void 0:f.message)??"Invalid input");return}n(!0);const h=await we.users.create(u.data);if(n(!1),h.ok){e("/users");return}if(h.code==="USERNAME_TAKEN"){r("That username is already taken (case-insensitive).");return}r("Failed to create user. Please check the fields and try again.")};return p.jsx(Cr,{children:p.jsxs("form",{onSubmit:a,className:"max-w-lg space-y-4 p-4",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("h1",{className:"text-lg font-semibold",children:"Create Team Member"})}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Account Details"}),p.jsx(en,{className:"text-xs",children:"The new member will be forced to change their password on first login. Their username cannot be changed after creation."})]}),p.jsxs(St,{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"displayName",children:"Full Name"}),p.jsx(Xt,{id:"displayName",name:"displayName",placeholder:"Jane Smith",required:!0})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"username",children:"Username"}),p.jsx(Xt,{id:"username",name:"username",placeholder:"jsmith",className:"font-mono",required:!0}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Lowercase letters, digits, underscores. Cannot be changed."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"password",children:"Initial Password"}),p.jsx(Xt,{id:"password",name:"password",type:"password",placeholder:"Assign a temporary password…",required:!0}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Min 8 chars, 1 number, 1 special character. User must change it on first login."})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"role",children:"Role"}),p.jsxs("select",{id:"role",name:"role",defaultValue:"user",className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[p.jsx("option",{value:"user",children:"Team Member"}),p.jsx("option",{value:"admin",children:"Team Admin"})]})]}),p.jsx(D9,{}),p.jsxs("div",{children:[p.jsx("p",{className:"mb-2 text-xs font-medium",children:"Git Identity (optional)"}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitName",className:"text-xs",children:"Git Name"}),p.jsx(Xt,{id:"gitName",name:"gitName",placeholder:"Jane Smith",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitEmail",className:"text-xs",children:"Git Email"}),p.jsx(Xt,{id:"gitEmail",name:"gitEmail",type:"email",placeholder:"jsmith@example.com",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitPat",className:"text-xs",children:"Git Personal Access Token"}),p.jsx(Xt,{id:"gitPat",name:"gitPat",type:"password",placeholder:"ghp_…",className:"font-mono text-xs"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Used by the Source Control module for push operations."})]})]})]}),t&&p.jsx("p",{className:"text-xs text-destructive",children:t}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[p.jsx(Ie,{type:"submit",disabled:i,children:i?"Creating…":"Create User"}),p.jsx(ri,{to:"/users",children:p.jsx(Ie,{type:"button",variant:"outline",children:"Cancel"})})]})]})]})]})})}function k_e(){const{id:e}=an(),t=Number(e),[r,i]=U.useState(null),[n,a]=U.useState([]),[l,s]=U.useState([]),[c,u]=U.useState(!1),[h,f]=U.useState(null),[b,g]=U.useState(),[v,C]=U.useState(),[y,x]=U.useState(""),E=U.useCallback(async()=>{const H=await we.users.get(t);if(H.ok&&H.data)if(i(H.data),H.data.role==="user"&&H.data.isDeleted===0){const W=await we.users.assignments(t);W.ok&&W.data&&a(W.data);const z=await we.projects.list(!1);z.ok&&z.data&&s(z.data)}else a([]),s([]);else H.status===404&&u(!0)},[t]);if(U.useEffect(()=>{E()},[E]),c)return p.jsx(Cr,{children:p.jsxs("div",{className:"p-4 text-sm text-muted-foreground",children:["User not found."," ",p.jsx(ri,{to:"/users",className:"text-primary hover:underline",children:"Back to Users"})]})});if(!r)return p.jsx(Cr,{children:p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading…"})});const S=r.isDeleted===0,T=r.role==="admin"?"Team Admin":"Team Member",A=new Set(n.map(H=>H.projectId)),k=l.filter(H=>!A.has(H.id)),L=async H=>{H.preventDefault(),g(void 0);const W=new FormData(H.currentTarget);(await we.users.updateProfile(t,{displayName:String(W.get("displayName")??"")||void 0,gitName:String(W.get("gitName")??"")||void 0,gitEmail:String(W.get("gitEmail")??"")||void 0,gitPat:String(W.get("gitPat")??"")||void 0})).ok?(g("Saved."),await E()):g("Failed to save.")},N=async()=>{await we.users.promote(t),f(null),await E()},O=async()=>{const H=await we.users.deactivate(t);f(null),!H.ok&&H.code==="LAST_ADMIN_CONSTRAINT"&&g("Cannot deactivate the last remaining Team Admin."),await E()},B=async()=>{await we.users.reactivate(t),f(null),await E()},$=async()=>{C(void 0);const H=Number(y);if(!Number.isInteger(H)||H<=0){C("Enter a valid project id.");return}const W=await we.users.assign(t,H);W.ok?(x(""),await E()):W.code==="ALREADY_ASSIGNED"?C("That project is already assigned."):C("Failed to assign project.")},Y=async H=>{await we.users.unassign(t,H),await E()};return p.jsxs(Cr,{children:[p.jsxs("div",{className:"max-w-lg space-y-4 p-4",children:[p.jsxs("div",{className:"text-xs text-muted-foreground",children:[p.jsx(ri,{to:"/users",className:"hover:underline",children:"Users"})," ","/ ",r.displayName]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h1",{className:"text-lg font-semibold",children:r.displayName}),p.jsx(ir,{variant:r.role==="admin"?"default":"outline",children:T}),p.jsx(ir,{variant:S?"success":"secondary",children:S?"active":"inactive"})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Account"})}),p.jsxs(St,{className:"space-y-2 text-sm",children:[p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Username"}),p.jsx("code",{className:"font-mono text-xs",children:r.username})]}),p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:"Member Since"}),p.jsx("span",{className:"text-xs",children:r.createdAt.slice(0,10)})]}),r.reactivatedAt&&p.jsxs("div",{className:"flex justify-between","data-testid":"reactivated-row",children:[p.jsx("span",{className:"text-muted-foreground",children:"Reactivated"}),p.jsxs("span",{className:"text-xs",children:[r.reactivatedAt.slice(0,19).replace("T"," ")," ",p.jsx("span",{className:"text-muted-foreground",children:"by"})," ",r.reactivatedByName??"admin"]})]})]})]}),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Profile"}),p.jsx(en,{className:"text-xs",children:"Editable by Team Admin on behalf of the member. Does not change the password."})]}),p.jsx(St,{children:p.jsxs("form",{onSubmit:L,className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"displayName",className:"text-xs",children:"Display Name"}),p.jsx(Xt,{id:"displayName",name:"displayName",defaultValue:r.displayName,className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitName",className:"text-xs",children:"Git Name"}),p.jsx(Xt,{id:"gitName",name:"gitName",defaultValue:r.gitName??"",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitEmail",className:"text-xs",children:"Git Email"}),p.jsx(Xt,{id:"gitEmail",name:"gitEmail",type:"email",defaultValue:r.gitEmail??"",className:"text-xs"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(jt,{htmlFor:"gitPat",className:"text-xs",children:"Personal Access Token"}),p.jsx(Xt,{id:"gitPat",name:"gitPat",defaultValue:r.gitPat??"",className:"font-mono text-xs"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ie,{type:"submit",children:"Save"}),b&&p.jsx("span",{className:"text-xs text-muted-foreground",children:b})]})]})})]}),r.role==="user"&&S&&p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Project Assignments"}),p.jsx(en,{className:"text-xs",children:"Team Members only see and work on their assigned projects."})]}),p.jsxs(St,{className:"space-y-2",children:[n.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"No projects assigned. This user will not see any projects in their dashboard."}):p.jsx("div",{className:"space-y-1",children:n.map(H=>p.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-1.5",children:[p.jsx("span",{className:"text-xs",children:H.projectName}),p.jsx(Ie,{variant:"ghost",className:"h-6 px-2 text-xs text-muted-foreground hover:text-destructive",onClick:()=>Y(H.projectId),children:"Remove"})]},H.id))}),p.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[p.jsxs("select",{value:y,onChange:H=>x(H.target.value),"data-testid":"assign-project-select",disabled:k.length===0,className:"h-8 flex-1 rounded-md border border-input bg-transparent px-2 text-xs shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:[p.jsx("option",{value:"",children:k.length===0?"All projects already assigned":"Select a project…"}),k.map(H=>p.jsx("option",{value:H.id,children:H.name},H.id))]}),p.jsx(Ie,{className:"h-8",onClick:$,disabled:!y,children:"Assign"}),v&&p.jsx("span",{className:"text-xs text-destructive",children:v})]})]})]}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Admin Actions"})}),p.jsxs(St,{className:"space-y-2",children:[r.role==="user"&&S&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start",onClick:()=>f("promote"),children:"Promote to Team Admin"}),S&&r.username!=="admin"&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start border-destructive/30 text-destructive",onClick:()=>f("deactivate"),children:"Deactivate Account"}),!S&&p.jsx(Ie,{variant:"outline",className:"w-full justify-start border-green-300 text-green-700",onClick:()=>f("reactivate"),children:"Reactivate Account"})]})]})]}),p.jsxs(ta,{open:h==="promote",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Promote ",r.displayName," to Team Admin?"]}),p.jsx(oc,{children:"Team Admins can create users, promote other members, and deactivate accounts. All other capabilities are identical to Team Member."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{onClick:N,children:"Promote"})]})]}),p.jsxs(ta,{open:h==="deactivate",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Deactivate ",r.displayName,"?"]}),p.jsx(oc,{children:"The account will be blocked from logging in. No data is deleted — deactivation is soft and reversible."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{variant:"destructive",onClick:O,children:"Deactivate"})]})]}),p.jsxs(ta,{open:h==="reactivate",onOpenChange:H=>!H&&f(null),children:[p.jsxs(ra,{children:[p.jsxs(ia,{children:["Reactivate ",r.displayName,"?"]}),p.jsx(oc,{children:"The account will be restored and the user will be able to log in again. They must log in fresh — existing sessions are not restored."})]}),p.jsxs(as,{children:[p.jsx(Ie,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),p.jsx(Ie,{onClick:B,children:"Reactivate"})]})]})]})}function A_e(e){return e==="admin"?"Team Admin":"Team Member"}function N_e(){const e=nn(),[t,r]=U.useState([]),[i,n]=U.useState(""),[a,l]=U.useState(!0);U.useEffect(()=>{we.users.list().then(c=>{c.ok&&c.data&&r(c.data),l(!1)})},[]);const s=U.useMemo(()=>{const c=i.toLowerCase();return t.filter(u=>u.displayName.toLowerCase().includes(c)||u.username.toLowerCase().includes(c))},[t,i]);return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Users"}),p.jsxs(ir,{variant:"secondary",children:[t.length," total"]})]}),p.jsx(Ie,{onClick:()=>e("/users/new"),children:"Create User"})]}),p.jsx(Xt,{placeholder:"Search by name or username…",value:i,onChange:c=>n(c.target.value),className:"h-8 w-64 text-xs"}),p.jsx(Et,{children:p.jsx(St,{className:"p-0",children:p.jsxs(gp,{children:[p.jsx(bp,{children:p.jsxs(Ua,{children:[p.jsx(pi,{children:"Name"}),p.jsx(pi,{children:"Username"}),p.jsx(pi,{children:"Role"}),p.jsx(pi,{children:"Status"}),p.jsx(pi,{children:"Actions"})]})}),p.jsx(yp,{children:a?p.jsx(Ua,{children:p.jsx(ti,{colSpan:5,className:"text-center text-sm text-muted-foreground",children:"Loading…"})}):s.map(c=>{const u=c.isDeleted===0;return p.jsxs(Ua,{"data-testid":`user-row-${c.username}`,children:[p.jsx(ti,{className:"text-sm font-medium",children:p.jsx(ri,{to:`/users/${c.id}`,className:"hover:underline",children:c.displayName})}),p.jsx(ti,{className:"font-mono text-xs text-muted-foreground",children:c.username}),p.jsx(ti,{children:p.jsx(ir,{variant:c.role==="admin"?"default":"outline",children:A_e(c.role)})}),p.jsx(ti,{children:p.jsx(ir,{variant:u?"success":"secondary",children:u?"active":"inactive"})}),p.jsx(ti,{children:p.jsx(ri,{to:`/users/${c.id}`,className:"text-xs text-primary hover:underline",children:"View"})})]},c.id)})})]})})})]})})}function R_e(){return p.jsx(Cr,{children:p.jsxs("div",{className:"space-y-4 p-6",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Workspace"}),p.jsxs(zf,{defaultValue:"instance",children:[p.jsxs(qf,{children:[p.jsx(Fn,{value:"instance",children:"Instance Settings"}),p.jsx(Fn,{value:"prereqs",children:"Prerequisites"})]}),p.jsx(ya,{value:"instance",className:"mt-4 space-y-4",children:p.jsx(L_e,{})}),p.jsx(ya,{value:"prereqs",className:"mt-4",children:p.jsx(I_e,{})})]})]})})}function L_e(){const[e,t]=U.useState(null);U.useEffect(()=>{we.workspace.settings().then(i=>t(i.data))},[]);const r=e?[{key:"workspacePath",label:"Workspace Path",value:e.workspacePath},{key:"port",label:"Listen Port",value:String(e.port)},{key:"host",label:"Listen Host",value:e.host},{key:"provisioningState",label:"Provisioning State",value:e.provisioningState}]:[];return p.jsxs("div",{className:"space-y-4","data-testid":"ws-instance",children:[p.jsxs("div",{className:"rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-700","data-testid":"ws-readonly-note",children:["Instance settings are read-only in the app. To change the port or workspace path, update"," ",p.jsx("code",{children:".co2/settings.json"})," via the CLI and restart co2-cli (DevOps/System Admin only)."]}),p.jsx(Et,{children:p.jsxs(St,{className:"divide-y pt-4",children:[r.map(i=>p.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0 last:pb-0",children:[p.jsx("p",{className:"text-sm font-medium",children:i.label}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 text-sm","data-testid":`ws-setting-${i.key}`,children:i.value})]},i.key)),!e&&p.jsx("p",{className:"py-2 text-sm text-muted-foreground",children:"Loading…"})]})}),p.jsxs(Et,{children:[p.jsx(Qt,{className:"pb-2",children:p.jsx(nr,{className:"text-sm",children:"Plugin Status"})}),p.jsx(St,{children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm",children:"rashidee/co2-skills"}),p.jsx(ir,{variant:(e==null?void 0:e.pluginState)==="installed"?"success":"outline",children:(e==null?void 0:e.pluginState)??"—"})]})})]})]})}function I_e(){const[e,t]=U.useState([]),[r,i]=U.useState(!0),n=()=>{i(!0),we.workspace.prereqs().then(a=>{t(a.data??[]),i(!1)})};return U.useEffect(()=>n(),[]),p.jsxs(Et,{children:[p.jsxs(Qt,{className:"pb-2",children:[p.jsx(nr,{className:"text-sm",children:"Host Prerequisites"}),p.jsx(en,{className:"text-xs",children:"Checked on demand. Node.js is always present (co2-cli is running). Claude Code CLI and co2-skills are auto-installed on first startup."})]}),p.jsxs(St,{className:"space-y-2","data-testid":"ws-prereqs",children:[e.map(a=>p.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2","data-testid":`ws-prereq-${a.status}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{"aria-hidden":!0,className:a.status==="ok"?"text-green-600":a.status==="missing"?"text-red-600":"text-yellow-600",children:a.status==="ok"?"●":a.status==="missing"?"✕":"?"}),p.jsx("span",{className:"text-sm",children:a.name})]}),p.jsx("code",{className:"rounded bg-muted px-2 py-0.5 text-xs",children:a.version??a.status})]},a.name)),r&&p.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking…"}),p.jsx(Ie,{variant:"outline",className:"mt-2","data-testid":"ws-recheck",onClick:n,children:"Recheck Prerequisites"})]})]})}function xp(){return p.jsx("div",{className:"flex h-screen items-center justify-center text-sm text-muted-foreground",children:"Loading…"})}function Ti({children:e}){const{user:t,loading:r}=aa();return r?p.jsx(xp,{}):t?t.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):p.jsx(p.Fragment,{children:e}):p.jsx(xa,{to:"/login",replace:!0})}function qh({children:e}){const{user:t,loading:r}=aa();return r?p.jsx(xp,{}):t?t.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):t.role!=="admin"?p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(p.Fragment,{children:e}):p.jsx(xa,{to:"/login",replace:!0})}function D_e(){const{user:e,loading:t}=aa();return t?p.jsx(xp,{}):e?e.mustChangePassword?p.jsx(eG,{}):p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(xa,{to:"/login",replace:!0})}function O_e(){var i;const{user:e,loading:t}=aa();if(t)return p.jsx(xp,{});if(!e)return p.jsx(xa,{to:"/login",replace:!0});const r=(i=window.location.pathname.match(/^\/projects\/(\d+)/))==null?void 0:i[1];return p.jsx(xa,{to:`/projects/${r}/quality`,replace:!0})}function B_e(){const{user:e,loading:t}=aa();return t?p.jsx(xp,{}):e?e.mustChangePassword?p.jsx(xa,{to:"/force-change-password",replace:!0}):p.jsx(xa,{to:"/projects",replace:!0}):p.jsx(xa,{to:"/login",replace:!0})}function M_e(){return p.jsx(dz,{children:p.jsx(yH,{children:p.jsxs(Lz,{children:[p.jsxs(Y$,{children:[p.jsx(Ar,{path:"/",element:p.jsx(B_e,{})}),p.jsx(Ar,{path:"/login",element:p.jsx(tG,{})}),p.jsx(Ar,{path:"/force-change-password",element:p.jsx(D_e,{})}),p.jsx(Ar,{path:"/projects",element:p.jsx(Ti,{children:p.jsx(T_e,{})})}),p.jsx(Ar,{path:"/projects/new",element:p.jsx(qh,{children:p.jsx(jxe,{})})}),p.jsx(Ar,{path:"/projects/import",element:p.jsx(qh,{children:p.jsx(Gye,{})})}),p.jsx(Ar,{path:"/projects/:id",element:p.jsx(Ti,{children:p.jsx(Oye,{})})}),p.jsx(Ar,{path:"/projects/:id/git",element:p.jsx(Ti,{children:p.jsx(Fye,{})})}),p.jsx(Ar,{path:"/projects/:id/terminal",element:p.jsx(Ti,{children:p.jsx(d_e,{})})}),p.jsx(Ar,{path:"/projects/:id/brainstorm",element:p.jsx(Ti,{children:p.jsx(_ye,{})})}),p.jsx(Ar,{path:"/projects/:id/brainstorm/:sessionId",element:p.jsx(Ti,{children:p.jsx(Tye,{})})}),p.jsx(Ar,{path:"/projects/:id/versions",element:p.jsx(Ti,{children:p.jsx(f_e,{})})}),p.jsx(Ar,{path:"/projects/:id/prd-wizard",element:p.jsx(Ti,{children:p.jsx(qxe,{})})}),p.jsx(Ar,{path:"/projects/:id/cicd",element:p.jsx(Ti,{children:p.jsx(Rye,{})})}),p.jsx(Ar,{path:"/projects/:id/shared-context",element:p.jsx(Ti,{children:p.jsx(c_e,{})})}),p.jsx(Ar,{path:"/projects/:id/context",element:p.jsx(Ti,{children:p.jsx(Iye,{})})}),p.jsx(Ar,{path:"/projects/:id/workflow",element:p.jsx(Ti,{children:p.jsx(E_e,{})})}),p.jsx(Ar,{path:"/projects/:id/artifacts",element:p.jsx(Ti,{children:p.jsx(yye,{})})}),p.jsx(Ar,{path:"/projects/:id/mockup",element:p.jsx(Ti,{children:p.jsx(Kye,{})})}),p.jsx(Ar,{path:"/projects/:id/source-code",element:p.jsx(Ti,{children:p.jsx(Lxe,{})})}),p.jsx(Ar,{path:"/projects/:id/quality",element:p.jsx(Ti,{children:p.jsx(Xxe,{})})}),p.jsx(Ar,{path:"/projects/:id/quality/new",element:p.jsx(Ti,{children:p.jsx(i_e,{})})}),p.jsx(Ar,{path:"/projects/:id/quality/:bugId",element:p.jsx(Ti,{children:p.jsx(e_e,{})})}),p.jsx(Ar,{path:"/projects/:id/defects",element:p.jsx(O_e,{})}),p.jsx(Ar,{path:"/users",element:p.jsx(qh,{children:p.jsx(N_e,{})})}),p.jsx(Ar,{path:"/users/new",element:p.jsx(qh,{children:p.jsx(w_e,{})})}),p.jsx(Ar,{path:"/users/:id",element:p.jsx(qh,{children:p.jsx(k_e,{})})}),p.jsx(Ar,{path:"/workspace",element:p.jsx(Ti,{children:p.jsx(R_e,{})})}),p.jsx(Ar,{path:"/notifications",element:p.jsx(Ti,{children:p.jsx(nG,{})})}),p.jsx(Ar,{path:"/settings/profile",element:p.jsx(Ti,{children:p.jsx(aG,{})})}),p.jsx(Ar,{path:"/settings/account",element:p.jsx(Ti,{children:p.jsx(Jq,{})})}),p.jsx(Ar,{path:"*",element:p.jsx(xa,{to:"/",replace:!0})})]}),p.jsx(Pz,{})]})})})}const O9=document.getElementById("root");if(!O9)throw new Error("#root not found");VU.createRoot(O9).render(p.jsx(U.StrictMode,{children:p.jsx(M_e,{})}));export{t3 as $,Kw as A,Z4 as B,Uhe as C,Hue as D,use as E,U_e as F,Xde as G,Nf as H,j_e as I,Vde as J,k0 as K,zse as L,u6 as M,nd as N,BD as O,Due as P,iE as Q,jhe as R,op as S,fs as T,Ne as U,Re as V,Zse as W,h6 as X,Nue as Y,Lhe as Z,M as _,ioe as a,Hn as a$,e3 as a0,K_e as a1,G_e as a2,V_e as a3,Y_e as a4,z_e as a5,Aw as a6,X_e as a7,q_e as a8,fu as a9,epe as aA,zw as aB,$w as aC,wg as aD,mhe as aE,phe as aF,fhe as aG,hhe as aH,nhe as aI,GF as aJ,ohe as aK,ihe as aL,uhe as aM,WF as aN,she as aO,yhe as aP,bhe as aQ,ghe as aR,_he as aS,xhe as aT,ahe as aU,YF as aV,dhe as aW,che as aX,lhe as aY,VF as aZ,Ype as a_,Q_e as aa,Z_e as ab,W_e as ac,wpe as ad,s7 as ae,l1e as af,Pt as ag,Bs as ah,fp as ai,mfe as aj,Vw as ak,ut as al,Rme as am,o1e as an,c1e as ao,a1e as ap,bt as aq,s1e as ar,Zw as as,ame as at,Jpe as au,Qpe as av,Jt as aw,Nb as ax,gn as ay,kn as az,roe as b,qs as b0,$h as b1,t8 as b2,xc as b3,a8 as b4,G4 as b5,Rue as b6,P_e as b7,Cc as b8,pfe as b9,$_e as ba,Sw as bb,nl as bc,If as bd,VD as be,cce as bf,mt as bg,zF as bh,ea as bi,rce as bj,vw as bk,w6 as bl,up as bm,N6 as bn,H_e as bo,yae as bp,Wpe as bq,Nr as c,rr as d,d6 as e,qi as f,aoe as g,Co as h,os as i,the as j,lp as k,$e as l,i8 as m,soe as n,ooe as o,toe as p,J_e as q,ul as r,noe as s,pae as t,d1e as u,u1e as v,zhe as w,es as x,_i as y,coe as z};
|