cogpit 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/cli-runtime.js +57254 -0
  3. package/dist/cli.js +5 -44857
  4. package/dist/instance-worker.js +19943 -0
  5. package/dist/web/assets/CogpitBlock-DngXfAds.js +35 -0
  6. package/dist/web/assets/CommandPaletteHost-qBLfTYUI.js +1 -0
  7. package/dist/web/assets/{ConfigBrowser-DOdqaQra.js → ConfigBrowser-CX8VxPCF.js} +1 -1
  8. package/dist/web/assets/CrewPanel-BQinfJ8Y.js +1 -0
  9. package/dist/web/assets/{HighlightedEditor-D75svkum.js → HighlightedEditor-Cz0PCIaA.js} +1 -1
  10. package/dist/web/assets/{KeyboardShortcutsDialog-DeIXxXmj.js → KeyboardShortcutsDialog-B7cVkxlZ.js} +1 -1
  11. package/dist/web/assets/MissionHome-CCYLRIPz.js +1 -0
  12. package/dist/web/assets/{MobileFileChanges-Dze0jsvc.js → MobileFileChanges-FHYv1Fc1.js} +1 -1
  13. package/dist/web/assets/{PluginsDialog-qcJTbfeg.js → PluginsDialog-Bwf8bQH-.js} +1 -1
  14. package/dist/web/assets/{PreviewPanel-DChL85Uq.js → PreviewPanel-DC6gaBWX.js} +1 -1
  15. package/dist/web/assets/{ProjectFilesPanel-DJ-_Lb_R.js → ProjectFilesPanel-BEVS1EcM.js} +1 -1
  16. package/dist/web/assets/{ProjectSwitcherModal-BUV_fZ5V.js → ProjectSwitcherModal-ByUN7aFG.js} +1 -1
  17. package/dist/web/assets/{TerminalOutput-BCG6Ppu3.js → TerminalOutput-DcUf6lUO.js} +1 -1
  18. package/dist/web/assets/{ThemeSelectorModal-t2P0tZVJ.js → ThemeSelectorModal-rD4ZYmvZ.js} +1 -1
  19. package/dist/web/assets/WorkflowsPanel-BbzofKqG.js +1 -0
  20. package/dist/web/assets/WorktreePanel-CAVc-e2v.js +1 -0
  21. package/dist/web/assets/edition-ui-D3yHMSJq.js +2 -0
  22. package/dist/web/assets/index-CYJLZdyZ.js +482 -0
  23. package/dist/web/assets/{index-BtmLHL6v.js → index-Ca9i-hcz.js} +4 -4
  24. package/dist/web/assets/index-D6mWk1bF.css +1 -0
  25. package/dist/web/assets/{index-bXbR7jwp.js → index-DO4zq6Qr.js} +1 -1
  26. package/dist/web/assets/{index-CRUYvx2l.js → index-DRHHijwL.js} +1 -1
  27. package/dist/web/assets/session-parser.worker-D3SBmcaP.js +30 -0
  28. package/dist/web/assets/vendor-ui-Dxtv9P3W.js +987 -0
  29. package/dist/web/index.html +3 -3
  30. package/package.json +5 -3
  31. package/dist/web/assets/CommandPaletteHost-B-n0sXM6.js +0 -1
  32. package/dist/web/assets/WorkflowsPanel-Bv2RwtYI.js +0 -1
  33. package/dist/web/assets/WorktreePanel-F9QlbnAH.js +0 -1
  34. package/dist/web/assets/edition-ui-C0x29noh.js +0 -2
  35. package/dist/web/assets/index-BO-Nd-ib.css +0 -1
  36. package/dist/web/assets/index-C4W7tiDS.js +0 -1
  37. package/dist/web/assets/index-CW9tjG1S.js +0 -472
  38. package/dist/web/assets/session-parser.worker-CkTPpg3t.js +0 -29
  39. package/dist/web/assets/vendor-ui-Br3ZTAXZ.js +0 -957
@@ -0,0 +1,35 @@
1
+ import{c as qe,j as O,r as ge}from"./vendor-react-gGw_S5I_.js";import{aL as si,aM as fi,aN as ai,aO as pi,R as di,J as xe,B as Ue}from"./index-CYJLZdyZ.js";import{I as Kn,V as hi}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function mi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var U={},Fe={},te={},gn;function ke(){if(gn)return te;gn=1;function t(s){return typeof s>"u"||s===null}function i(s){return typeof s=="object"&&s!==null}function m(s){return Array.isArray(s)?s:t(s)?[]:[s]}function y(s,c){if(c){const A=Object.keys(c);for(let r=0,f=A.length;r<f;r+=1){const C=A[r];s[C]=c[C]}}return s}function p(s,c){let A="";for(let r=0;r<c;r+=1)A+=s;return A}function h(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return te.isNothing=t,te.isObject=i,te.toArray=m,te.repeat=p,te.isNegativeZero=h,te.extend=y,te}var $e,xn;function Ee(){if(xn)return $e;xn=1;function t(m,y){let p="";const h=m.reason||"(unknown reason)";return m.mark?(m.mark.name&&(p+='in "'+m.mark.name+'" '),p+="("+(m.mark.line+1)+":"+(m.mark.column+1)+")",!y&&m.mark.snippet&&(p+=`
2
+
3
+ `+m.mark.snippet),h+" "+p):h}function i(m,y){Error.call(this),this.name="YAMLException",this.reason=m,this.mark=y,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(y){return this.name+": "+t(this,y)},$e=i,$e}var Ge,An;function gi(){if(An)return Ge;An=1;const t=ke();function i(p,h,s,c,A){let r="",f="";const C=Math.floor(A/2)-1;return c-h>C&&(r=" ... ",h=c-C+r.length),s-c>C&&(f=" ...",s=c+C-f.length),{str:r+p.slice(h,s).replace(/\t/g,"→")+f,pos:c-h+r.length}}function m(p,h){return t.repeat(" ",h-p.length)+p}function y(p,h){if(h=Object.create(h||null),!p.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const s=/\r?\n|\r|\0/g,c=[0],A=[];let r,f=-1;for(;r=s.exec(p.buffer);)A.push(r.index),c.push(r.index+r[0].length),p.position<=r.index&&f<0&&(f=c.length-2);f<0&&(f=c.length-1);let C="";const L=Math.min(p.line+h.linesAfter,A.length).toString().length,R=h.maxLength-(h.indent+L+3);for(let F=1;F<=h.linesBefore&&!(f-F<0);F++){const H=i(p.buffer,c[f-F],A[f-F],p.position-(c[f]-c[f-F]),R);C=t.repeat(" ",h.indent)+m((p.line-F+1).toString(),L)+" | "+H.str+`
4
+ `+C}const z=i(p.buffer,c[f],A[f],p.position,R);C+=t.repeat(" ",h.indent)+m((p.line+1).toString(),L)+" | "+z.str+`
5
+ `,C+=t.repeat("-",h.indent+L+3+z.pos)+`^
6
+ `;for(let F=1;F<=h.linesAfter&&!(f+F>=A.length);F++){const H=i(p.buffer,c[f+F],A[f+F],p.position-(c[f]-c[f+F]),R);C+=t.repeat(" ",h.indent)+m((p.line+F+1).toString(),L)+" | "+H.str+`
7
+ `}return C.replace(/\n$/,"")}return Ge=y,Ge}var We,yn;function G(){if(yn)return We;yn=1;const t=Ee(),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],m=["scalar","sequence","mapping"];function y(h){const s={};return h!==null&&Object.keys(h).forEach(function(c){h[c].forEach(function(A){s[String(A)]=c})}),s}function p(h,s){if(s=s||{},Object.keys(s).forEach(function(c){if(i.indexOf(c)===-1)throw new t('Unknown option "'+c+'" is met in definition of "'+h+'" YAML type.')}),this.options=s,this.tag=h,this.kind=s.kind||null,this.resolve=s.resolve||function(){return!0},this.construct=s.construct||function(c){return c},this.instanceOf=s.instanceOf||null,this.predicate=s.predicate||null,this.represent=s.represent||null,this.representName=s.representName||null,this.defaultStyle=s.defaultStyle||null,this.multi=s.multi||!1,this.styleAliases=y(s.styleAliases||null),m.indexOf(this.kind)===-1)throw new t('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}return We=p,We}var Qe,bn;function Un(){if(bn)return Qe;bn=1;const t=Ee(),i=G();function m(h,s){const c=[];return h[s].forEach(function(A){let r=c.length;c.forEach(function(f,C){f.tag===A.tag&&f.kind===A.kind&&f.multi===A.multi&&(r=C)}),c[r]=A}),c}function y(){const h={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function s(c){c.multi?(h.multi[c.kind].push(c),h.multi.fallback.push(c)):h[c.kind][c.tag]=h.fallback[c.tag]=c}for(let c=0,A=arguments.length;c<A;c+=1)arguments[c].forEach(s);return h}function p(h){return this.extend(h)}return p.prototype.extend=function(s){let c=[],A=[];if(s instanceof i)A.push(s);else if(Array.isArray(s))A=A.concat(s);else if(s&&(Array.isArray(s.implicit)||Array.isArray(s.explicit)))s.implicit&&(c=c.concat(s.implicit)),s.explicit&&(A=A.concat(s.explicit));else throw new t("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");c.forEach(function(f){if(!(f instanceof i))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new t("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),A.forEach(function(f){if(!(f instanceof i))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const r=Object.create(p.prototype);return r.implicit=(this.implicit||[]).concat(c),r.explicit=(this.explicit||[]).concat(A),r.compiledImplicit=m(r,"implicit"),r.compiledExplicit=m(r,"explicit"),r.compiledTypeMap=y(r.compiledImplicit,r.compiledExplicit),r},Qe=p,Qe}var Ve,wn;function $n(){if(wn)return Ve;wn=1;const t=G();return Ve=new t("tag:yaml.org,2002:str",{kind:"scalar",construct:function(i){return i!==null?i:""}}),Ve}var ze,Sn;function Gn(){if(Sn)return ze;Sn=1;const t=G();return ze=new t("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(i){return i!==null?i:[]}}),ze}var Xe,Cn;function Wn(){if(Cn)return Xe;Cn=1;const t=G();return Xe=new t("tag:yaml.org,2002:map",{kind:"mapping",construct:function(i){return i!==null?i:{}}}),Xe}var Je,Tn;function Qn(){if(Tn)return Je;Tn=1;const t=Un();return Je=new t({explicit:[$n(),Gn(),Wn()]}),Je}var Ze,kn;function Vn(){if(kn)return Ze;kn=1;const t=G();function i(p){if(p===null)return!0;const h=p.length;return h===1&&p==="~"||h===4&&(p==="null"||p==="Null"||p==="NULL")}function m(){return null}function y(p){return p===null}return Ze=new t("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:m,predicate:y,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),Ze}var en,En;function zn(){if(En)return en;En=1;const t=G();function i(p){if(p===null)return!1;const h=p.length;return h===4&&(p==="true"||p==="True"||p==="TRUE")||h===5&&(p==="false"||p==="False"||p==="FALSE")}function m(p){return p==="true"||p==="True"||p==="TRUE"}function y(p){return Object.prototype.toString.call(p)==="[object Boolean]"}return en=new t("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:m,predicate:y,represent:{lowercase:function(p){return p?"true":"false"},uppercase:function(p){return p?"TRUE":"FALSE"},camelcase:function(p){return p?"True":"False"}},defaultStyle:"lowercase"}),en}var nn,Nn;function Xn(){if(Nn)return nn;Nn=1;const t=ke(),i=G();function m(r){return r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102}function y(r){return r>=48&&r<=55}function p(r){return r>=48&&r<=57}function h(r){if(r===null)return!1;const f=r.length;let C=0,L=!1;if(!f)return!1;let R=r[C];if((R==="-"||R==="+")&&(R=r[++C]),R==="0"){if(C+1===f)return!0;if(R=r[++C],R==="b"){for(C++;C<f;C++){if(R=r[C],R!=="0"&&R!=="1")return!1;L=!0}return L&&isFinite(s(r))}if(R==="x"){for(C++;C<f;C++){if(!m(r.charCodeAt(C)))return!1;L=!0}return L&&isFinite(s(r))}if(R==="o"){for(C++;C<f;C++){if(!y(r.charCodeAt(C)))return!1;L=!0}return L&&isFinite(s(r))}}for(;C<f;C++){if(!p(r.charCodeAt(C)))return!1;L=!0}return L?isFinite(s(r)):!1}function s(r){let f=r,C=1,L=f[0];if((L==="-"||L==="+")&&(L==="-"&&(C=-1),f=f.slice(1),L=f[0]),f==="0")return 0;if(L==="0"){if(f[1]==="b")return C*parseInt(f.slice(2),2);if(f[1]==="x")return C*parseInt(f.slice(2),16);if(f[1]==="o")return C*parseInt(f.slice(2),8)}return C*parseInt(f,10)}function c(r){return s(r)}function A(r){return Object.prototype.toString.call(r)==="[object Number]"&&r%1===0&&!t.isNegativeZero(r)}return nn=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:h,construct:c,predicate:A,represent:{binary:function(r){return r>=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0o"+r.toString(8):"-0o"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nn}var rn,In;function Jn(){if(In)return rn;In=1;const t=ke(),i=G(),m=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),y=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function p(r){return r===null||!m.test(r)?!1:isFinite(parseFloat(r,10))?!0:y.test(r)}function h(r){let f=r.toLowerCase();const C=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?C===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:C*parseFloat(f,10)}const s=/^[-+]?[0-9]+e/;function c(r,f){if(isNaN(r))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(t.isNegativeZero(r))return"-0.0";const C=r.toString(10);return s.test(C)?C.replace("e",".e"):C}function A(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||t.isNegativeZero(r))}return rn=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:p,construct:h,predicate:A,represent:c,defaultStyle:"lowercase"}),rn}var ln,On;function Zn(){return On||(On=1,ln=Qn().extend({implicit:[Vn(),zn(),Xn(),Jn()]})),ln}var on,Ln;function ei(){return Ln||(Ln=1,on=Zn()),on}var tn,_n;function ni(){if(_n)return tn;_n=1;const t=G(),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),m=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function y(s){return s===null?!1:i.exec(s)!==null||m.exec(s)!==null}function p(s){let c=0,A=null,r=i.exec(s);if(r===null&&(r=m.exec(s)),r===null)throw new Error("Date resolve error");const f=+r[1],C=+r[2]-1,L=+r[3];if(!r[4])return new Date(Date.UTC(f,C,L));const R=+r[4],z=+r[5],F=+r[6];if(r[7]){for(c=r[7].slice(0,3);c.length<3;)c+="0";c=+c}if(r[9]){const X=+r[10],K=+(r[11]||0);A=(X*60+K)*6e4,r[9]==="-"&&(A=-A)}const H=new Date(Date.UTC(f,C,L,R,z,F,c));return A&&H.setTime(H.getTime()-A),H}function h(s){return s.toISOString()}return tn=new t("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:y,construct:p,instanceOf:Date,represent:h}),tn}var cn,vn;function ii(){if(vn)return cn;vn=1;const t=G();function i(m){return m==="<<"||m===null}return cn=new t("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i}),cn}var un,Mn;function ri(){if(Mn)return un;Mn=1;const t=G(),i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
8
+ \r`;function m(s){if(s===null)return!1;let c=0;const A=s.length,r=i;for(let f=0;f<A;f++){const C=r.indexOf(s.charAt(f));if(!(C>64)){if(C<0)return!1;c+=6}}return c%8===0}function y(s){const c=s.replace(/[\r\n=]/g,""),A=c.length,r=i;let f=0;const C=[];for(let R=0;R<A;R++)R%4===0&&R&&(C.push(f>>16&255),C.push(f>>8&255),C.push(f&255)),f=f<<6|r.indexOf(c.charAt(R));const L=A%4*6;return L===0?(C.push(f>>16&255),C.push(f>>8&255),C.push(f&255)):L===18?(C.push(f>>10&255),C.push(f>>2&255)):L===12&&C.push(f>>4&255),new Uint8Array(C)}function p(s){let c="",A=0;const r=s.length,f=i;for(let L=0;L<r;L++)L%3===0&&L&&(c+=f[A>>18&63],c+=f[A>>12&63],c+=f[A>>6&63],c+=f[A&63]),A=(A<<8)+s[L];const C=r%3;return C===0?(c+=f[A>>18&63],c+=f[A>>12&63],c+=f[A>>6&63],c+=f[A&63]):C===2?(c+=f[A>>10&63],c+=f[A>>4&63],c+=f[A<<2&63],c+=f[64]):C===1&&(c+=f[A>>2&63],c+=f[A<<4&63],c+=f[64],c+=f[64]),c}function h(s){return Object.prototype.toString.call(s)==="[object Uint8Array]"}return un=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:m,construct:y,predicate:h,represent:p}),un}var sn,Rn;function li(){if(Rn)return sn;Rn=1;const t=G(),i=Object.prototype.hasOwnProperty,m=Object.prototype.toString;function y(h){if(h===null)return!0;const s={},c=h;for(let A=0,r=c.length;A<r;A+=1){const f=c[A];let C=!1;if(m.call(f)!=="[object Object]")return!1;let L;for(L in f)if(i.call(f,L))if(!C)C=!0;else return!1;if(!C||i.call(s,L))return!1;Object.defineProperty(s,L,{value:!0})}return!0}function p(h){return h!==null?h:[]}return sn=new t("tag:yaml.org,2002:omap",{kind:"sequence",resolve:y,construct:p}),sn}var fn,jn;function oi(){if(jn)return fn;jn=1;const t=G(),i=Object.prototype.toString;function m(p){if(p===null)return!0;const h=p,s=new Array(h.length);for(let c=0,A=h.length;c<A;c+=1){const r=h[c];if(i.call(r)!=="[object Object]")return!1;const f=Object.keys(r);if(f.length!==1)return!1;s[c]=[f[0],r[f[0]]]}return!0}function y(p){if(p===null)return[];const h=p,s=new Array(h.length);for(let c=0,A=h.length;c<A;c+=1){const r=h[c],f=Object.keys(r);s[c]=[f[0],r[f[0]]]}return s}return fn=new t("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:m,construct:y}),fn}var an,Fn;function ti(){if(Fn)return an;Fn=1;const t=G(),i=Object.prototype.hasOwnProperty;function m(p){if(p===null)return!0;const h=p;for(const s in h)if(i.call(h,s)&&h[s]!==null)return!1;return!0}function y(p){return p!==null?p:{}}return an=new t("tag:yaml.org,2002:set",{kind:"mapping",resolve:m,construct:y}),an}var pn,qn;function hn(){return qn||(qn=1,pn=ei().extend({implicit:[ni(),ii()],explicit:[ri(),li(),oi(),ti()]})),pn}var Dn;function xi(){if(Dn)return Fe;Dn=1;const t=ke(),i=Ee(),m=gi(),y=hn(),p=Object.prototype.hasOwnProperty,h=1,s=2,c=3,A=4,r=1,f=2,C=3,L=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R=/[\x85\u2028\u2029]/,z=/[,\[\]{}]/,F=/^(?:!|!!|![0-9A-Za-z-]+!)$/,H=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function X(e){return Object.prototype.toString.call(e)}function K(e){return e===10||e===13}function D(e){return e===9||e===32}function q(e){return e===9||e===32||e===10||e===13}function V(e){return e===44||e===91||e===93||e===123||e===125}function se(e){if(e>=48&&e<=57)return e-48;const l=e|32;return l>=97&&l<=102?l-97+10:-1}function fe(e){return e===120?2:e===117?4:e===85?8:0}function ae(e){return e>=48&&e<=57?e-48:-1}function ne(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
9
+ `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function pe(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function _(e,l,g){l==="__proto__"?Object.defineProperty(e,l,{configurable:!0,enumerable:!0,writable:!0,value:g}):e[l]=g}const P=new Array(256),$=new Array(256);for(let e=0;e<256;e++)P[e]=ne(e)?1:0,$[e]=ne(e);function j(e,l){this.input=e,this.filename=l.filename||null,this.schema=l.schema||y,this.onWarning=l.onWarning||null,this.legacy=l.legacy||!1,this.json=l.json||!1,this.listener=l.listener||null,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:100,this.maxTotalMergeKeys=typeof l.maxTotalMergeKeys=="number"?l.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function B(e,l){const g={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return g.snippet=m(g),new i(l,g)}function k(e,l){throw B(e,l)}function de(e,l){e.onWarning&&e.onWarning.call(null,B(e,l))}function Z(e,l,g){const x=e.anchorMapTransactions;if(x.length!==0){const a=x[x.length-1];p.call(a,l)||(a[l]={existed:p.call(e.anchorMap,l),value:e.anchorMap[l]})}e.anchorMap[l]=g}function De(e){e.anchorMapTransactions.push(Object.create(null))}function ce(e){const l=e.anchorMapTransactions.pop(),g=e.anchorMapTransactions;if(g.length===0)return;const x=g[g.length-1],a=Object.keys(l);for(let n=0,o=a.length;n<o;n+=1){const u=a[n];p.call(x,u)||(x[u]=l[u])}}function Ye(e){const l=e.anchorMapTransactions.pop(),g=Object.keys(l);for(let x=g.length-1;x>=0;x-=1){const a=l[g[x]];a.existed?e.anchorMap[g[x]]=a.value:delete e.anchorMap[g[x]]}}function Ae(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function he(e,l){e.position=l.position,e.line=l.line,e.lineStart=l.lineStart,e.lineIndent=l.lineIndent,e.firstTabInLine=l.firstTabInLine,e.tag=l.tag,e.anchor=l.anchor,e.kind=l.kind,e.result=l.result}const Ne={YAML:function(l,g,x){l.version!==null&&k(l,"duplication of %YAML directive"),x.length!==1&&k(l,"YAML directive accepts exactly one argument");const a=/^([0-9]+)\.([0-9]+)$/.exec(x[0]);a===null&&k(l,"ill-formed argument of the YAML directive");const n=parseInt(a[1],10),o=parseInt(a[2],10);n!==1&&k(l,"unacceptable YAML version of the document"),l.version=x[0],l.checkLineBreaks=o<2,o!==1&&o!==2&&de(l,"unsupported YAML version of the document")},TAG:function(l,g,x){let a;x.length!==2&&k(l,"TAG directive accepts exactly two arguments");const n=x[0];a=x[1],F.test(n)||k(l,"ill-formed tag handle (first argument) of the TAG directive"),p.call(l.tagMap,n)&&k(l,'there is a previously declared suffix for "'+n+'" tag handle'),H.test(a)||k(l,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{k(l,"tag prefix is malformed: "+a)}l.tagMap[n]=a}};function W(e,l,g,x){if(l<g){const a=e.input.slice(l,g);if(x)for(let n=0,o=a.length;n<o;n+=1){const u=a.charCodeAt(n);u===9||u>=32&&u<=1114111||k(e,"expected valid JSON character")}else L.test(a)&&k(e,"the stream contains non-printable characters");e.result+=a}}function ie(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&k(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")")}function ye(e,l,g,x){t.isObject(g)||k(e,"cannot merge mappings; the provided source object is unacceptable"),ie(e);const a=Object.keys(g);for(let n=0,o=a.length;n<o;n+=1){const u=a[n];ie(e),p.call(l,u)||(_(l,u,g[u]),x[u]=!0)}}function ee(e,l,g,x,a,n,o,u,b){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let w=0,S=a.length;w<S;w+=1)Array.isArray(a[w])&&k(e,"nested arrays are not supported inside keys"),typeof a=="object"&&X(a[w])==="[object Object]"&&(a[w]="[object Object]")}if(typeof a=="object"&&X(a)==="[object Object]"&&(a="[object Object]"),a=String(a),l===null&&(l={}),x==="tag:yaml.org,2002:merge")if(Array.isArray(n)){n.length>100&&k(e,"abnormal merge sequence size");for(let w=0,S=n.length;w<S;w+=1)ye(e,l,n[w],g)}else ye(e,l,n,g);else!e.json&&!p.call(g,a)&&p.call(l,a)&&(e.line=o||e.line,e.lineStart=u||e.lineStart,e.position=b||e.position,k(e,"duplicated mapping key")),_(l,a,n),delete g[a];return l}function be(e){const l=e.input.charCodeAt(e.position);l===10?e.position++:l===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):k(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Y(e,l,g){let x=0,a=e.input.charCodeAt(e.position);for(;a!==0;){for(;D(a);)a===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),a=e.input.charCodeAt(++e.position);if(l&&a===35)do a=e.input.charCodeAt(++e.position);while(a!==10&&a!==13&&a!==0);if(K(a))for(be(e),a=e.input.charCodeAt(e.position),x++,e.lineIndent=0;a===32;)e.lineIndent++,a=e.input.charCodeAt(++e.position);else break}return g!==-1&&x!==0&&e.lineIndent<g&&de(e,"deficient indentation"),x}function J(e){let l=e.position,g=e.input.charCodeAt(l);return!!((g===45||g===46)&&g===e.input.charCodeAt(l+1)&&g===e.input.charCodeAt(l+2)&&(l+=3,g=e.input.charCodeAt(l),g===0||q(g)))}function me(e,l){l===1?e.result+=" ":l>1&&(e.result+=t.repeat(`
10
+ `,l-1))}function Ie(e,l,g){let x,a,n,o,u,b;const w=e.kind,S=e.result;let d=e.input.charCodeAt(e.position);if(q(d)||V(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96)return!1;if(d===63||d===45){const T=e.input.charCodeAt(e.position+1);if(q(T)||g&&V(T))return!1}for(e.kind="scalar",e.result="",x=a=e.position,n=!1;d!==0;){if(d===58){const T=e.input.charCodeAt(e.position+1);if(q(T)||g&&V(T))break}else if(d===35){const T=e.input.charCodeAt(e.position-1);if(q(T))break}else{if(e.position===e.lineStart&&J(e)||g&&V(d))break;if(K(d))if(o=e.line,u=e.lineStart,b=e.lineIndent,Y(e,!1,-1),e.lineIndent>=l){n=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=o,e.lineStart=u,e.lineIndent=b;break}}n&&(W(e,x,a,!1),me(e,e.line-o),x=a=e.position,n=!1),D(d)||(a=e.position+1),d=e.input.charCodeAt(++e.position)}return W(e,x,a,!1),e.result?!0:(e.kind=w,e.result=S,!1)}function we(e,l){let g,x,a=e.input.charCodeAt(e.position);if(a!==39)return!1;for(e.kind="scalar",e.result="",e.position++,g=x=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===39)if(W(e,g,e.position,!0),a=e.input.charCodeAt(++e.position),a===39)g=e.position,e.position++,x=e.position;else return!0;else K(a)?(W(e,g,x,!0),me(e,Y(e,!1,l)),g=x=e.position):e.position===e.lineStart&&J(e)?k(e,"unexpected end of the document within a single quoted scalar"):(e.position++,D(a)||(x=e.position));k(e,"unexpected end of the stream within a single quoted scalar")}function Oe(e,l){let g,x,a,n=e.input.charCodeAt(e.position);if(n!==34)return!1;for(e.kind="scalar",e.result="",e.position++,g=x=e.position;(n=e.input.charCodeAt(e.position))!==0;){if(n===34)return W(e,g,e.position,!0),e.position++,!0;if(n===92){if(W(e,g,e.position,!0),n=e.input.charCodeAt(++e.position),K(n))Y(e,!1,l);else if(n<256&&P[n])e.result+=$[n],e.position++;else if((a=fe(n))>0){let o=a,u=0;for(;o>0;o--)n=e.input.charCodeAt(++e.position),(a=se(n))>=0?u=(u<<4)+a:k(e,"expected hexadecimal character");e.result+=pe(u),e.position++}else k(e,"unknown escape sequence");g=x=e.position}else K(n)?(W(e,g,x,!0),me(e,Y(e,!1,l)),g=x=e.position):e.position===e.lineStart&&J(e)?k(e,"unexpected end of the document within a double quoted scalar"):(e.position++,D(n)||(x=e.position))}k(e,"unexpected end of the stream within a double quoted scalar")}function Le(e,l){let g=!0,x,a,n;const o=e.tag;let u;const b=e.anchor;let w,S,d,T;const E=Object.create(null);let N,I,v,M=e.input.charCodeAt(e.position);if(M===91)w=93,T=!1,u=[];else if(M===123)w=125,T=!0,u={};else return!1;for(e.anchor!==null&&Z(e,e.anchor,u),M=e.input.charCodeAt(++e.position);M!==0;){if(Y(e,!0,l),M=e.input.charCodeAt(e.position),M===w)return e.position++,e.tag=o,e.anchor=b,e.kind=T?"mapping":"sequence",e.result=u,!0;if(g?M===44&&k(e,"expected the node content, but found ','"):k(e,"missed comma between flow collection entries"),I=N=v=null,S=d=!1,M===63){const oe=e.input.charCodeAt(e.position+1);q(oe)&&(S=d=!0,e.position++,Y(e,!0,l))}x=e.line,a=e.lineStart,n=e.position,le(e,l,h,!1,!0),I=e.tag,N=e.result,Y(e,!0,l),M=e.input.charCodeAt(e.position),(d||e.line===x)&&M===58&&(S=!0,M=e.input.charCodeAt(++e.position),Y(e,!0,l),le(e,l,h,!1,!0),v=e.result),T?ee(e,u,E,I,N,v,x,a,n):S?u.push(ee(e,null,E,I,N,v,x,a,n)):u.push(N),Y(e,!0,l),M=e.input.charCodeAt(e.position),M===44?(g=!0,M=e.input.charCodeAt(++e.position)):g=!1}k(e,"unexpected end of the stream within a flow collection")}function re(e,l){let g,x=r,a=!1,n=!1,o=l,u=0,b=!1,w,S=e.input.charCodeAt(e.position);if(S===124)g=!1;else if(S===62)g=!0;else return!1;for(e.kind="scalar",e.result="";S!==0;)if(S=e.input.charCodeAt(++e.position),S===43||S===45)r===x?x=S===43?C:f:k(e,"repeat of a chomping mode identifier");else if((w=ae(S))>=0)w===0?k(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):n?k(e,"repeat of an indentation width identifier"):(o=l+w-1,n=!0);else break;if(D(S)){do S=e.input.charCodeAt(++e.position);while(D(S));if(S===35)do S=e.input.charCodeAt(++e.position);while(!K(S)&&S!==0)}for(;S!==0;){for(be(e),e.lineIndent=0,S=e.input.charCodeAt(e.position);(!n||e.lineIndent<o)&&S===32;)e.lineIndent++,S=e.input.charCodeAt(++e.position);if(!n&&e.lineIndent>o&&(o=e.lineIndent),K(S)){u++;continue}if(!n&&o===0&&k(e,"missing indentation for block scalar"),e.lineIndent<o){x===C?e.result+=t.repeat(`
11
+ `,a?1+u:u):x===r&&a&&(e.result+=`
12
+ `);break}g?D(S)?(b=!0,e.result+=t.repeat(`
13
+ `,a?1+u:u)):b?(b=!1,e.result+=t.repeat(`
14
+ `,u+1)):u===0?a&&(e.result+=" "):e.result+=t.repeat(`
15
+ `,u):e.result+=t.repeat(`
16
+ `,a?1+u:u),a=!0,n=!0,u=0;const d=e.position;for(;!K(S)&&S!==0;)S=e.input.charCodeAt(++e.position);W(e,d,e.position,!1)}return!0}function _e(e,l){const g=e.tag,x=e.anchor,a=[];let n=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&Z(e,e.anchor,a);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,k(e,"tab characters must not be used in indentation")),o===45);){const u=e.input.charCodeAt(e.position+1);if(!q(u))break;if(n=!0,e.position++,Y(e,!0,-1)&&e.lineIndent<=l){a.push(null),o=e.input.charCodeAt(e.position);continue}const b=e.line;if(le(e,l,c,!1,!0),a.push(e.result),Y(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===b||e.lineIndent>l)&&o!==0)k(e,"bad indentation of a sequence entry");else if(e.lineIndent<l)break}return n?(e.tag=g,e.anchor=x,e.kind="sequence",e.result=a,!0):!1}function ve(e,l,g){let x,a,n,o;const u=e.tag,b=e.anchor,w={},S=Object.create(null);let d=null,T=null,E=null,N=!1,I=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&Z(e,e.anchor,w);let v=e.input.charCodeAt(e.position);for(;v!==0;){!N&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,k(e,"tab characters must not be used in indentation"));const M=e.input.charCodeAt(e.position+1),oe=e.line;if((v===63||v===58)&&q(M))v===63?(N&&(ee(e,w,S,d,T,null,a,n,o),d=T=E=null),I=!0,N=!0,x=!0):N?(N=!1,x=!0):k(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=M;else{if(a=e.line,n=e.lineStart,o=e.position,!le(e,g,s,!1,!0))break;if(e.line===oe){for(v=e.input.charCodeAt(e.position);D(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),q(v)||k(e,"a whitespace character is expected after the key-value separator within a block mapping"),N&&(ee(e,w,S,d,T,null,a,n,o),d=T=E=null),I=!0,N=!1,x=!1,d=e.tag,T=e.result;else if(I)k(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=b,!0}else if(I)k(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=b,!0}if((e.line===oe||e.lineIndent>l)&&(N&&(a=e.line,n=e.lineStart,o=e.position),le(e,l,A,!0,x)&&(N?T=e.result:E=e.result),N||(ee(e,w,S,d,T,E,a,n,o),d=T=E=null),Y(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===oe||e.lineIndent>l)&&v!==0)k(e,"bad indentation of a mapping entry");else if(e.lineIndent<l)break}return N&&ee(e,w,S,d,T,null,a,n,o),I&&(e.tag=u,e.anchor=b,e.kind="mapping",e.result=w),I}function Me(e){let l=!1,g=!1,x,a,n=e.input.charCodeAt(e.position);if(n!==33)return!1;e.tag!==null&&k(e,"duplication of a tag property"),n=e.input.charCodeAt(++e.position),n===60?(l=!0,n=e.input.charCodeAt(++e.position)):n===33?(g=!0,x="!!",n=e.input.charCodeAt(++e.position)):x="!";let o=e.position;if(l){do n=e.input.charCodeAt(++e.position);while(n!==0&&n!==62);e.position<e.length?(a=e.input.slice(o,e.position),n=e.input.charCodeAt(++e.position)):k(e,"unexpected end of the stream within a verbatim tag")}else{for(;n!==0&&!q(n);)n===33&&(g?k(e,"tag suffix cannot contain exclamation marks"):(x=e.input.slice(o-1,e.position+1),F.test(x)||k(e,"named tag handle cannot contain such characters"),g=!0,o=e.position+1)),n=e.input.charCodeAt(++e.position);a=e.input.slice(o,e.position),z.test(a)&&k(e,"tag suffix cannot contain flow indicator characters")}a&&!H.test(a)&&k(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{k(e,"tag name is malformed: "+a)}return l?e.tag=a:p.call(e.tagMap,x)?e.tag=e.tagMap[x]+a:x==="!"?e.tag="!"+a:x==="!!"?e.tag="tag:yaml.org,2002:"+a:k(e,'undeclared tag handle "'+x+'"'),!0}function Re(e){let l=e.input.charCodeAt(e.position);if(l!==38)return!1;e.anchor!==null&&k(e,"duplication of an anchor property"),l=e.input.charCodeAt(++e.position);const g=e.position;for(;l!==0&&!q(l)&&!V(l);)l=e.input.charCodeAt(++e.position);return e.position===g&&k(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(g,e.position),!0}function Pe(e){let l=e.input.charCodeAt(e.position);if(l!==42)return!1;l=e.input.charCodeAt(++e.position);const g=e.position;for(;l!==0&&!q(l)&&!V(l);)l=e.input.charCodeAt(++e.position);e.position===g&&k(e,"name of an alias node must contain at least one character");const x=e.input.slice(g,e.position);return p.call(e.anchorMap,x)||k(e,'unidentified alias "'+x+'"'),e.result=e.anchorMap[x],Y(e,!0,-1),!0}function je(e,l,g,x){const a=Ae(e);return De(e),he(e,l),e.tag=null,e.anchor=null,e.kind=null,e.result=null,ve(e,g,x)&&e.kind==="mapping"?(ce(e),!0):(Ye(e),he(e,a),!1)}function le(e,l,g,x,a){let n,o,u=1,b=!1,w=!1,S=null,d,T,E;e.depth>=e.maxDepth&&k(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;const N=n=o=A===g||c===g;if(x&&Y(e,!0,-1)&&(b=!0,e.lineIndent>l?u=1:e.lineIndent===l?u=0:e.lineIndent<l&&(u=-1)),u===1)for(;;){const I=e.input.charCodeAt(e.position),v=Ae(e);if(b&&(I===33&&e.tag!==null||I===38&&e.anchor!==null)||!Me(e)&&!Re(e))break;S===null&&(S=v),Y(e,!0,-1)?(b=!0,o=N,e.lineIndent>l?u=1:e.lineIndent===l?u=0:e.lineIndent<l&&(u=-1)):o=!1}if(o&&(o=b||a),u===1||A===g)if(h===g||s===g?T=l:T=l+1,E=e.position-e.lineStart,u===1)if(o&&(_e(e,E)||ve(e,E,T))||Le(e,T))w=!0;else{const I=e.input.charCodeAt(e.position);S!==null&&N&&!o&&I!==124&&I!==62&&je(e,S,S.position-S.lineStart,T)||n&&re(e,T)||we(e,T)||Oe(e,T)?w=!0:Pe(e)?(w=!0,(e.tag!==null||e.anchor!==null)&&k(e,"alias node should not have any properties")):Ie(e,T,h===g)&&(w=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&Z(e,e.anchor,e.result)}else u===0&&(w=o&&_e(e,E));if(e.tag===null)e.anchor!==null&&Z(e,e.anchor,e.result);else if(e.tag==="?"){e.result!==null&&e.kind!=="scalar"&&k(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"');for(let I=0,v=e.implicitTypes.length;I<v;I+=1)if(d=e.implicitTypes[I],d.resolve(e.result)){e.result=d.construct(e.result),e.tag=d.tag,e.anchor!==null&&Z(e,e.anchor,e.result);break}}else if(e.tag!=="!"){if(p.call(e.typeMap[e.kind||"fallback"],e.tag))d=e.typeMap[e.kind||"fallback"][e.tag];else{d=null;const I=e.typeMap.multi[e.kind||"fallback"];for(let v=0,M=I.length;v<M;v+=1)if(e.tag.slice(0,I[v].tag.length)===I[v].tag){d=I[v];break}}d||k(e,"unknown tag !<"+e.tag+">"),e.result!==null&&d.kind!==e.kind&&k(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),e.anchor!==null&&Z(e,e.anchor,e.result)):k(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.depth-=1,e.tag!==null||e.anchor!==null||w}function Be(e){const l=e.position;let g=!1,x;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(x=e.input.charCodeAt(e.position))!==0&&(Y(e,!0,-1),x=e.input.charCodeAt(e.position),!(e.lineIndent>0||x!==37));){g=!0,x=e.input.charCodeAt(++e.position);let a=e.position;for(;x!==0&&!q(x);)x=e.input.charCodeAt(++e.position);const n=e.input.slice(a,e.position),o=[];for(n.length<1&&k(e,"directive name must not be less than one character in length");x!==0;){for(;D(x);)x=e.input.charCodeAt(++e.position);if(x===35){do x=e.input.charCodeAt(++e.position);while(x!==0&&!K(x));break}if(K(x))break;for(a=e.position;x!==0&&!q(x);)x=e.input.charCodeAt(++e.position);o.push(e.input.slice(a,e.position))}x!==0&&be(e),p.call(Ne,n)?Ne[n](e,n,o):de(e,'unknown document directive "'+n+'"')}if(Y(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Y(e,!0,-1)):g&&k(e,"directives end mark is expected"),le(e,e.lineIndent-1,A,!1,!0),Y(e,!0,-1),e.checkLineBreaks&&R.test(e.input.slice(l,e.position))&&de(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&J(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Y(e,!0,-1));return}e.position<e.length-1&&k(e,"end of the stream or a document separator is expected")}function Se(e,l){e=String(e),l=l||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
17
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));const g=new j(e,l),x=e.indexOf("\0");for(x!==-1&&(g.position=x,k(g,"null byte is not allowed in input")),g.input+="\0";g.input.charCodeAt(g.position)===32;)g.lineIndent+=1,g.position+=1;for(;g.position<g.length-1;)Be(g);return g.documents}function He(e,l,g){l!==null&&typeof l=="object"&&typeof g>"u"&&(g=l,l=null);const x=Se(e,g);if(typeof l!="function")return x;for(let a=0,n=x.length;a<n;a+=1)l(x[a])}function Ke(e,l){const g=Se(e,l);if(g.length!==0){if(g.length===1)return g[0];throw new i("expected a single document in the stream, but found more")}}return Fe.loadAll=He,Fe.load=Ke,Fe}var dn={},Yn;function Ai(){if(Yn)return dn;Yn=1;const t=ke(),i=Ee(),m=hn(),y=Object.prototype.toString,p=Object.prototype.hasOwnProperty,h=65279,s=9,c=10,A=13,r=32,f=33,C=34,L=35,R=37,z=38,F=39,H=42,X=44,K=45,D=58,q=61,V=62,se=63,fe=64,ae=91,ne=93,pe=96,_=123,P=124,$=125,j={};j[0]="\\0",j[7]="\\a",j[8]="\\b",j[9]="\\t",j[10]="\\n",j[11]="\\v",j[12]="\\f",j[13]="\\r",j[27]="\\e",j[34]='\\"',j[92]="\\\\",j[133]="\\N",j[160]="\\_",j[8232]="\\L",j[8233]="\\P";const B=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],k=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function de(n,o){if(o===null)return{};const u={},b=Object.keys(o);for(let w=0,S=b.length;w<S;w+=1){let d=b[w],T=String(o[d]);d.slice(0,2)==="!!"&&(d="tag:yaml.org,2002:"+d.slice(2));const E=n.compiledTypeMap.fallback[d];E&&p.call(E.styleAliases,T)&&(T=E.styleAliases[T]),u[d]=T}return u}function Z(n){let o,u;const b=n.toString(16).toUpperCase();if(n<=255)o="x",u=2;else if(n<=65535)o="u",u=4;else if(n<=4294967295)o="U",u=8;else throw new i("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+o+t.repeat("0",u-b.length)+b}const De=1,ce=2;function Ye(n){this.schema=n.schema||m,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=t.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=de(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?ce:De,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ae(n,o){const u=t.repeat(" ",o);let b=0,w="";const S=n.length;for(;b<S;){let d;const T=n.indexOf(`
18
+ `,b);T===-1?(d=n.slice(b),b=S):(d=n.slice(b,T+1),b=T+1),d.length&&d!==`
19
+ `&&(w+=u),w+=d}return w}function he(n,o){return`
20
+ `+t.repeat(" ",n.indent*o)}function Ne(n,o){for(let u=0,b=n.implicitTypes.length;u<b;u+=1)if(n.implicitTypes[u].resolve(o))return!0;return!1}function W(n){return n===r||n===s}function ie(n){return n>=32&&n<=126||n>=161&&n<=55295&&n!==8232&&n!==8233||n>=57344&&n<=65533&&n!==h||n>=65536&&n<=1114111}function ye(n){return ie(n)&&n!==h&&n!==A&&n!==c}function ee(n,o,u){const b=ye(n),w=b&&!W(n);return(u?b:b&&n!==X&&n!==ae&&n!==ne&&n!==_&&n!==$)&&n!==L&&!(o===D&&!w)||ye(o)&&!W(o)&&n===L||o===D&&w}function be(n){return ie(n)&&n!==h&&!W(n)&&n!==K&&n!==se&&n!==D&&n!==X&&n!==ae&&n!==ne&&n!==_&&n!==$&&n!==L&&n!==z&&n!==H&&n!==f&&n!==P&&n!==q&&n!==V&&n!==F&&n!==C&&n!==R&&n!==fe&&n!==pe}function Y(n){return!W(n)&&n!==D}function J(n,o){const u=n.charCodeAt(o);let b;return u>=55296&&u<=56319&&o+1<n.length&&(b=n.charCodeAt(o+1),b>=56320&&b<=57343)?(u-55296)*1024+b-56320+65536:u}function me(n){return/^\n* /.test(n)}const Ie=1,we=2,Oe=3,Le=4,re=5;function _e(n,o,u,b,w,S,d,T){let E,N=0,I=null,v=!1,M=!1;const oe=b!==-1;let Ce=-1,Te=be(J(n,0))&&Y(J(n,n.length-1));if(o||d)for(E=0;E<n.length;N>=65536?E+=2:E++){if(N=J(n,E),!ie(N))return re;Te=Te&&ee(N,I,T),I=N}else{for(E=0;E<n.length;N>=65536?E+=2:E++){if(N=J(n,E),N===c)v=!0,oe&&(M=M||E-Ce-1>b&&n[Ce+1]!==" ",Ce=E);else if(!ie(N))return re;Te=Te&&ee(N,I,T),I=N}M=M||oe&&E-Ce-1>b&&n[Ce+1]!==" "}return!v&&!M?Te&&!d&&!w(n)?Ie:S===ce?re:we:u>9&&me(n)?re:d?S===ce?re:we:M?Le:Oe}function ve(n,o,u,b,w){n.dump=(function(){if(o.length===0)return n.quotingType===ce?'""':"''";if(!n.noCompatMode&&(B.indexOf(o)!==-1||k.test(o)))return n.quotingType===ce?'"'+o+'"':"'"+o+"'";const S=n.indent*Math.max(1,u),d=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-S),T=b||n.flowLevel>-1&&u>=n.flowLevel;function E(N){return Ne(n,N)}switch(_e(o,T,n.indent,d,E,n.quotingType,n.forceQuotes&&!b,w)){case Ie:return o;case we:return"'"+o.replace(/'/g,"''")+"'";case Oe:return"|"+Me(o,n.indent)+Re(Ae(o,S));case Le:return">"+Me(o,n.indent)+Re(Ae(Pe(o,d),S));case re:return'"'+le(o)+'"';default:throw new i("impossible error: invalid scalar style")}})()}function Me(n,o){const u=me(n)?String(o):"",b=n[n.length-1]===`
21
+ `,S=b&&(n[n.length-2]===`
22
+ `||n===`
23
+ `)?"+":b?"":"-";return u+S+`
24
+ `}function Re(n){return n[n.length-1]===`
25
+ `?n.slice(0,-1):n}function Pe(n,o){const u=/(\n+)([^\n]*)/g;let b=(function(){let T=n.indexOf(`
26
+ `);return T=T!==-1?T:n.length,u.lastIndex=T,je(n.slice(0,T),o)})(),w=n[0]===`
27
+ `||n[0]===" ",S,d;for(;d=u.exec(n);){const T=d[1],E=d[2];S=E[0]===" ",b+=T+(!w&&!S&&E!==""?`
28
+ `:"")+je(E,o),w=S}return b}function je(n,o){if(n===""||n[0]===" ")return n;const u=/ [^ ]/g;let b,w=0,S,d=0,T=0,E="";for(;b=u.exec(n);)T=b.index,T-w>o&&(S=d>w?d:T,E+=`
29
+ `+n.slice(w,S),w=S+1),d=T;return E+=`
30
+ `,n.length-w>o&&d>w?E+=n.slice(w,d)+`
31
+ `+n.slice(d+1):E+=n.slice(w),E.slice(1)}function le(n){let o="",u=0;for(let b=0;b<n.length;u>=65536?b+=2:b++){u=J(n,b);const w=j[u];!w&&ie(u)?(o+=n[b],u>=65536&&(o+=n[b+1])):o+=w||Z(u)}return o}function Be(n,o,u){let b="";const w=n.tag;for(let S=0,d=u.length;S<d;S+=1){let T=u[S];n.replacer&&(T=n.replacer.call(u,String(S),T)),(l(n,o,T,!1,!1)||typeof T>"u"&&l(n,o,null,!1,!1))&&(b!==""&&(b+=","+(n.condenseFlow?"":" ")),b+=n.dump)}n.tag=w,n.dump="["+b+"]"}function Se(n,o,u,b){let w="";const S=n.tag;for(let d=0,T=u.length;d<T;d+=1){let E=u[d];n.replacer&&(E=n.replacer.call(u,String(d),E)),(l(n,o+1,E,!0,!0,!1,!0)||typeof E>"u"&&l(n,o+1,null,!0,!0,!1,!0))&&((!b||w!=="")&&(w+=he(n,o)),n.dump&&c===n.dump.charCodeAt(0)?w+="-":w+="- ",w+=n.dump)}n.tag=S,n.dump=w||"[]"}function He(n,o,u){let b="";const w=n.tag,S=Object.keys(u);for(let d=0,T=S.length;d<T;d+=1){let E="";b!==""&&(E+=", "),n.condenseFlow&&(E+='"');const N=S[d];let I=u[N];n.replacer&&(I=n.replacer.call(u,N,I)),l(n,o,N,!1,!1)&&(n.dump.length>1024&&(E+="? "),E+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),l(n,o,I,!1,!1)&&(E+=n.dump,b+=E))}n.tag=w,n.dump="{"+b+"}"}function Ke(n,o,u,b){let w="";const S=n.tag,d=Object.keys(u);if(n.sortKeys===!0)d.sort();else if(typeof n.sortKeys=="function")d.sort(n.sortKeys);else if(n.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let T=0,E=d.length;T<E;T+=1){let N="";(!b||w!=="")&&(N+=he(n,o));const I=d[T];let v=u[I];if(n.replacer&&(v=n.replacer.call(u,I,v)),!l(n,o+1,I,!0,!0,!0))continue;const M=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024;M&&(n.dump&&c===n.dump.charCodeAt(0)?N+="?":N+="? "),N+=n.dump,M&&(N+=he(n,o)),l(n,o+1,v,!0,M)&&(n.dump&&c===n.dump.charCodeAt(0)?N+=":":N+=": ",N+=n.dump,w+=N)}n.tag=S,n.dump=w||"{}"}function e(n,o,u){const b=u?n.explicitTypes:n.implicitTypes;for(let w=0,S=b.length;w<S;w+=1){const d=b[w];if((d.instanceOf||d.predicate)&&(!d.instanceOf||typeof o=="object"&&o instanceof d.instanceOf)&&(!d.predicate||d.predicate(o))){if(u?d.multi&&d.representName?n.tag=d.representName(o):n.tag=d.tag:n.tag="?",d.represent){const T=n.styleMap[d.tag]||d.defaultStyle;let E;if(y.call(d.represent)==="[object Function]")E=d.represent(o,T);else if(p.call(d.represent,T))E=d.represent[T](o,T);else throw new i("!<"+d.tag+'> tag resolver accepts not "'+T+'" style');n.dump=E}return!0}}return!1}function l(n,o,u,b,w,S,d){n.tag=null,n.dump=u,e(n,u,!1)||e(n,u,!0);const T=y.call(n.dump),E=b;b&&(b=n.flowLevel<0||n.flowLevel>o);const N=T==="[object Object]"||T==="[object Array]";let I,v;if(N&&(I=n.duplicates.indexOf(u),v=I!==-1),(n.tag!==null&&n.tag!=="?"||v||n.indent!==2&&o>0)&&(w=!1),v&&n.usedDuplicates[I])n.dump="*ref_"+I;else{if(N&&v&&!n.usedDuplicates[I]&&(n.usedDuplicates[I]=!0),T==="[object Object]")b&&Object.keys(n.dump).length!==0?(Ke(n,o,n.dump,w),v&&(n.dump="&ref_"+I+n.dump)):(He(n,o,n.dump),v&&(n.dump="&ref_"+I+" "+n.dump));else if(T==="[object Array]")b&&n.dump.length!==0?(n.noArrayIndent&&!d&&o>0?Se(n,o-1,n.dump,w):Se(n,o,n.dump,w),v&&(n.dump="&ref_"+I+n.dump)):(Be(n,o,n.dump),v&&(n.dump="&ref_"+I+" "+n.dump));else if(T==="[object String]")n.tag!=="?"&&ve(n,n.dump,o,S,E);else{if(T==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+T)}if(n.tag!==null&&n.tag!=="?"){let M=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21");n.tag[0]==="!"?M="!"+M:M.slice(0,18)==="tag:yaml.org,2002:"?M="!!"+M.slice(18):M="!<"+M+">",n.dump=M+" "+n.dump}}return!0}function g(n,o){const u=[],b=[];x(n,u,b);const w=b.length;for(let S=0;S<w;S+=1)o.duplicates.push(u[b[S]]);o.usedDuplicates=new Array(w)}function x(n,o,u){if(n!==null&&typeof n=="object"){const b=o.indexOf(n);if(b!==-1)u.indexOf(b)===-1&&u.push(b);else if(o.push(n),Array.isArray(n))for(let w=0,S=n.length;w<S;w+=1)x(n[w],o,u);else{const w=Object.keys(n);for(let S=0,d=w.length;S<d;S+=1)x(n[w[S]],o,u)}}}function a(n,o){o=o||{};const u=new Ye(o);u.noRefs||g(n,u);let b=n;return u.replacer&&(b=u.replacer.call({"":b},"",b)),l(u,0,b,!0,!0)?u.dump+`
32
+ `:""}return dn.dump=a,dn}var Pn;function yi(){if(Pn)return U;Pn=1;const t=xi(),i=Ai();function m(y,p){return function(){throw new Error("Function yaml."+y+" is removed in js-yaml 4. Use yaml."+p+" instead, which is now safe by default.")}}return U.Type=G(),U.Schema=Un(),U.FAILSAFE_SCHEMA=Qn(),U.JSON_SCHEMA=Zn(),U.CORE_SCHEMA=ei(),U.DEFAULT_SCHEMA=hn(),U.load=t.load,U.loadAll=t.loadAll,U.dump=i.dump,U.YAMLException=Ee(),U.types={binary:ri(),float:Jn(),map:Wn(),null:Vn(),pairs:oi(),set:ti(),timestamp:ni(),bool:zn(),int:Xn(),merge:ii(),omap:li(),seq:Gn(),str:$n()},U.safeLoad=m("safeLoad","load"),U.safeLoadAll=m("safeLoadAll","loadAll"),U.safeDump=m("safeDump","dump"),U}var bi=yi();const wi=mi(bi),{Type:Ui,Schema:$i,FAILSAFE_SCHEMA:Gi,JSON_SCHEMA:Wi,CORE_SCHEMA:Qi,DEFAULT_SCHEMA:Vi,load:Si,loadAll:zi,dump:Xi,YAMLException:Ji,types:Zi,safeLoad:er,safeLoadAll:nr,safeDump:ir}=wi,ue=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function Q(t){return typeof t=="string"?t.trim()||null:typeof t=="number"||typeof t=="boolean"?String(t):null}function Bn(t){const i=typeof t=="string"?Number(t):t;return typeof i=="number"&&Number.isFinite(i)&&i>=0?i:null}function ci(t,i){if(Array.isArray(t))return t;if(!ue(t))return null;for(const m of i)if(Array.isArray(t[m]))return t[m];return null}function mn(t){const i=ue(t)?Q(t.title):null;return i?{title:i}:{}}const Ci=new Set(["warning","danger","success"]);function Ti(t){if(!ue(t))return null;const i=ue(t.progress)?t.progress:null,m=Bn(i==null?void 0:i.done),y=Bn(i==null?void 0:i.total),p=(Array.isArray(t.values)?t.values:[]).flatMap(s=>{if(!ue(s))return[];const c=Q(s.label),A=Q(s.value);if(!c||A===null)return[];const r=Q(s.tone);return[{label:c,value:A,...r&&Ci.has(r)&&{tone:r}}]}),h={kind:"status",...mn(t),...m!==null&&y!==null&&y>0&&{progress:{done:Math.min(m,y),total:y}},values:p};return h.progress||p.length>0?h:null}function ki(t){const i=ci(t,["decisions","items"]);if(!i)return null;const m=i.flatMap((y,p)=>{if(!ue(y))return[];const h=Q(y.question),s=(Array.isArray(y.options)?y.options:[]).map(Q).filter(r=>!!r);if(!h||s.length===0)return[];const c=Q(y.recommended),A=Q(y.detail);return[{id:Q(y.id)??String(p+1),question:h,options:s,...c&&s.includes(c)&&{recommended:c},...A&&{detail:A}}]});return new Set(m.map(y=>y.id)).size!==m.length?null:m.length>0?{kind:"decisions",...mn(t),decisions:m}:null}const Ei=new Set(["todo","doing","done","blocked","skipped"]);function Ni(t){const i=ci(t,["items"]);if(!i)return null;const m=i.flatMap(y=>{const p=Q(y);if(p)return[{text:p,state:"todo"}];if(!ue(y))return[];const h=Q(y.text);if(!h)return[];const s=Q(y.state),c=Q(y.note);return[{text:h,state:s&&Ei.has(s)?s:"todo",...c&&{note:c}}]});return m.length>0?{kind:"checklist",...mn(t),items:m}:null}const Ii={status:Ti,decisions:ki,checklist:Ni};function Oi(t,i){let m;try{m=Si(i)}catch{return null}return Ii[t](m)}function Li(t,i){return["Decisions:",...t.filter(y=>i[y.id]).map(y=>`- ${y.id}: ${y.question} ${i[y.id]}`)].join(`
33
+ `)}function rr(t){const i=qe.c(13),{kind:m,source:y,occurrence:p,fallback:h}=t,s=p===void 0?"0":p;let c;i[0]!==m||i[1]!==y?(c=Oi(m,y),i[0]=m,i[1]=y,i[2]=c):c=i[2];const A=c;if(!A){let r;return i[3]!==h?(r=O.jsx(O.Fragment,{children:h}),i[3]=h,i[4]=r):r=i[4],r}switch(A.kind){case"status":{let r;return i[5]!==A?(r=O.jsx(_i,{block:A}),i[5]=A,i[6]=r):r=i[6],r}case"checklist":{let r;return i[7]!==A?(r=O.jsx(Ri,{block:A}),i[7]=A,i[8]=r):r=i[8],r}case"decisions":{let r;return i[9]!==A||i[10]!==s||i[11]!==y?(r=O.jsx(Di,{block:A,source:y,occurrence:s}),i[9]=A,i[10]=s,i[11]=y,i[12]=r):r=i[12],r}}}function ui(t){const i=qe.c(3),{label:m,children:y}=t;let p;return i[0]!==y||i[1]!==m?(p=O.jsx("section",{"aria-label":m,"data-cogpit-block":!0,className:"my-3 rounded-lg border border-border bg-card p-3 text-sm",children:y}),i[0]=y,i[1]=m,i[2]=p):p=i[2],p}const Hn={warning:"text-warning",danger:"text-destructive",success:"text-success"};function _i(t){const i=qe.c(14),{block:m}=t,{progress:y}=m;let p;i[0]!==y?(p=y?Math.round(y.done/y.total*100):null,i[0]=y,i[1]=p):p=i[1];const h=p,s=m.title??"Status";let c;i[2]!==m.title?(c=m.title&&O.jsx("h4",{className:"mb-2 text-[13.5px] font-medium",children:m.title}),i[2]=m.title,i[3]=c):c=i[3];let A;i[4]!==h||i[5]!==y?(A=y&&O.jsxs("div",{className:"mb-2.5",children:[O.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":y.total,"aria-valuenow":y.done,"aria-label":`${y.done} of ${y.total} done`,className:"h-1.5 overflow-hidden rounded-full bg-muted",children:O.jsx("div",{className:"h-full rounded-full bg-foreground",style:{width:`${h}%`}})}),O.jsxs("div",{className:"mt-1.5 flex justify-between text-xs tabular-nums text-muted-foreground",children:[O.jsxs("span",{children:[y.done," of ",y.total," done"]}),O.jsxs("span",{children:[h,"%"]})]})]}),i[4]=h,i[5]=y,i[6]=A):A=i[6];let r;i[7]!==m.values?(r=m.values.length>0&&O.jsx("dl",{className:"grid grid-cols-1 gap-x-5 sm:grid-cols-2",children:m.values.map(vi)}),i[7]=m.values,i[8]=r):r=i[8];let f;return i[9]!==s||i[10]!==c||i[11]!==A||i[12]!==r?(f=O.jsxs(ui,{label:s,children:[c,A,r]}),i[9]=s,i[10]=c,i[11]=A,i[12]=r,i[13]=f):f=i[13],f}function vi(t){return O.jsxs("div",{className:"flex justify-between gap-3 border-t border-border/70 py-1.5 text-[12.5px]",children:[O.jsx("dt",{className:xe("text-muted-foreground",t.tone&&Hn[t.tone]),children:t.label}),O.jsx("dd",{className:xe("text-right tabular-nums",t.tone&&Hn[t.tone]),children:t.value})]},t.label)}const Mi={done:{mark:O.jsx(Kn,{className:"size-2.5"}),ring:"border-success text-success",text:"text-muted-foreground line-through decoration-muted-foreground/50",label:"Done"},doing:{mark:null,ring:"border-success bg-success/25",text:"",label:"In progress"},blocked:{mark:O.jsx(hi,{className:"size-2.5"}),ring:"border-warning text-warning",text:"text-warning",label:"Blocked"},skipped:{mark:null,ring:"border-dashed border-muted-foreground/60",text:"text-muted-foreground line-through",label:"Skipped"},todo:{mark:null,ring:"border-muted-foreground/60",text:"",label:"To do"}};function Ri(t){const i=qe.c(18),{block:m}=t;let y;i[0]!==m.items?(y=m.items.filter(Fi),i[0]=m.items,i[1]=y):y=i[1];const p=y.length,h=m.title??"Checklist";let s;i[2]!==m.title?(s=m.title&&O.jsx("h4",{className:"text-[13.5px] font-medium",children:m.title}),i[2]=m.title,i[3]=s):s=i[3];let c;i[4]!==m.items.length||i[5]!==p?(c=O.jsxs("span",{className:"text-xs tabular-nums text-muted-foreground",children:[p," of ",m.items.length]}),i[4]=m.items.length,i[5]=p,i[6]=c):c=i[6];let A;i[7]!==s||i[8]!==c?(A=O.jsxs("div",{className:"mb-1.5 flex items-baseline gap-2",children:[s,c]}),i[7]=s,i[8]=c,i[9]=A):A=i[9];let r;i[10]!==m.items?(r=m.items.map(ji),i[10]=m.items,i[11]=r):r=i[11];let f;i[12]!==r?(f=O.jsx("ul",{className:"flex flex-col",children:r}),i[12]=r,i[13]=f):f=i[13];let C;return i[14]!==h||i[15]!==A||i[16]!==f?(C=O.jsxs(ui,{label:h,children:[A,f]}),i[14]=h,i[15]=A,i[16]=f,i[17]=C):C=i[17],C}function ji(t,i){const m=Mi[t.state];return O.jsxs("li",{className:"flex items-center gap-2.5 py-1 text-[13px]",children:[O.jsx("span",{className:xe("grid size-3.5 shrink-0 place-items-center rounded-full border-[1.5px]",m.ring),"aria-label":m.label,role:"img",children:m.mark}),O.jsx("span",{className:xe("min-w-0 flex-1",m.text),children:t.text}),t.note&&O.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:t.note})]},`${i}:${t.text}`)}function Fi(t){return t.state==="done"}function qi(t){let i=5381;for(let m=0;m<t.length;m++)i=(i<<5)+i+t.charCodeAt(m)|0;return(i>>>0).toString(36)}function Di({block:t,source:i,occurrence:m}){var pe;const y=si(),p=fi(),h=ge.useContext(ai),s=((pe=y==null?void 0:y.session)==null?void 0:pe.sessionId)??"none",[c,A]=pi(di(`cogpit-decisions:${s}:${qi(`${(h==null?void 0:h.messageKey)??""}
34
+ ${m}
35
+ ${i}`)}`),{answers:{},sentAt:null}),r=c??{answers:{},sentAt:null},[f,C]=ge.useState(0),[L,R]=ge.useState(new Set),[z,F]=ge.useState(!1),H=ge.useRef(!1),[X,K]=ge.useState(null),D=!!p&&(y==null?void 0:y.permissions.send)!==!1&&r.sentAt===null&&!z,q=t.decisions.filter(_=>r.answers[_.id]).length,V=(_,P)=>{if(!D||H.current)return;A({...r,answers:{...r.answers,[_]:P}}),R(j=>{const B=new Set(j);return B.delete(_),B});const $=t.decisions.findIndex((j,B)=>B>f&&!r.answers[j.id]&&j.id!==_);$>=0&&C($)},se=async()=>{if(!p||!D||q===0||H.current)return;H.current=!0,F(!0),K(null);const _=await p.chat.sendMessage(Li(t.decisions,r.answers)).catch(()=>!1);H.current=!1,F(!1),_?A({...r,sentAt:Date.now()}):K("Couldn't send the answers. Try again from the composer if this keeps happening.")},fe=_=>P=>{P.stopPropagation(),_()},ae=_=>{const P=t.decisions[f];P&&((_.metaKey||_.ctrlKey)&&_.key==="Enter"?(_.preventDefault(),se()):_.key==="ArrowDown"||_.key==="ArrowUp"?(_.preventDefault(),C($=>Math.max(0,Math.min(t.decisions.length-1,$+(_.key==="ArrowDown"?1:-1))))):_.key==="Enter"&&P.recommended&&_.target===_.currentTarget?(_.preventDefault(),V(P.id,P.recommended)):/^[1-9]$/.test(_.key)&&P.options[Number(_.key)-1]&&(_.preventDefault(),V(P.id,P.options[Number(_.key)-1])))},ne=t.title??`${t.decisions.length} ${t.decisions.length===1?"decision":"decisions"}`;return O.jsxs("section",{"aria-label":ne,"data-cogpit-block":!0,tabIndex:0,onKeyDown:ae,className:"my-3 rounded-lg border border-border bg-card p-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[O.jsxs("div",{className:"mb-1 flex flex-wrap items-baseline gap-x-2.5",children:[O.jsx("h4",{className:"text-[13.5px] font-medium",children:ne}),O.jsx("span",{className:"text-xs text-muted-foreground",children:r.sentAt?"Sent":"Answer in any order; your answers go back as one message."})]}),O.jsx("ol",{className:"flex flex-col",children:t.decisions.map((_,P)=>{const $=r.answers[_.id],j=!$||L.has(_.id);return O.jsxs("li",{"data-decision":_.id,onClick:()=>C(P),className:xe("grid grid-cols-[18px_minmax(0,1fr)] gap-x-2.5 gap-y-1 border-t border-border/70 py-2.5 first:border-t-0",P===f&&D&&"rounded-md bg-accent/40"),children:[O.jsx("span",{className:"pt-px text-right text-[11px] tabular-nums text-muted-foreground/80",children:P+1}),O.jsx("span",{className:xe("text-[13px]",j?"font-medium":"text-muted-foreground"),children:_.question}),_.detail&&j&&O.jsx("span",{className:"col-start-2 text-xs text-muted-foreground",children:_.detail}),j?O.jsx("span",{className:"col-start-2 mt-1 flex flex-wrap items-center gap-1.5",children:_.options.map((B,k)=>O.jsxs(Ue,{type:"button",size:"xs",variant:$===B?"default":"outline","aria-pressed":$===B,"aria-keyshortcuts":k<9?String(k+1):void 0,disabled:!D,onClick:fe(()=>V(_.id,B)),children:[B,B===_.recommended&&O.jsx("span",{className:"font-normal opacity-60",children:"recommended"})]},B))}):O.jsxs("span",{className:"col-start-2 flex items-center gap-2 text-[12.5px] text-success",children:[O.jsx(Kn,{className:"size-3.5","aria-hidden":"true"}),$,D&&O.jsx(Ue,{type:"button",variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:fe(()=>{R(B=>new Set(B).add(_.id)),C(P)}),children:"Change"})]})]},_.id)})}),X&&O.jsx("p",{role:"alert",className:"mt-2 text-xs text-destructive",children:X}),r.sentAt===null&&O.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 border-t border-border/70 pt-2.5 text-xs text-muted-foreground",children:[O.jsxs("span",{className:"tabular-nums",children:[q," of ",t.decisions.length," answered"]}),O.jsx("span",{className:"flex-1"}),D&&O.jsx("span",{className:"hidden sm:inline",children:"1–9 picks · Enter takes the recommended · ⌘Enter sends"}),O.jsx(Ue,{type:"button",size:"xs",disabled:!D||q===0||z,onClick:()=>void se(),children:q===t.decisions.length?"Send answers":`Send ${q} ${q===1?"answer":"answers"}`})]})]})}export{rr as default};
@@ -0,0 +1 @@
1
+ import{c as ie,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{ae as h,af as Z,ag as ue,ah as he,ai as ge,aj as fe,ak as ve,al as we,am as Ce,an as je,ao as Se,ap as be,aq as ye,ar as xe,as as ee,at as _,au as Pe,av as Te,aw as Oe,ax as ke,ay as Ne,az as Fe,aA as Ee,U as Ie}from"./index-CYJLZdyZ.js";import{P as $e,j as Ae,k as te,S as Re,L as De,H as Le,l as He,m as Me,c as ne,G as Be,F as qe,n as Ge,o as Ke,p as ze,q as Ue,r as We,s as pe,t as ae,u as _e,v as Ve,w as Xe,K as Je,E as Qe,x as Ye,y as Ze,z as oe,A as et,B as tt,D as nt}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function a(t,e,s,c,l,m,d){return{id:t,label:e,icon:c,run:l,shortcut:m,description:d,value:`${e} ${s}`}}function V(...t){return t.filter(e=>e!==!1&&e!==void 0)}function at(t){const e=ie.c(40);let s,c,l,m,d,w,C,r,j,g,b,f,y,N,x;if(e[0]!==t){const $=V(a("home","Go to Mission Control","home overview dashboard",Le,t.onGoHome),a("mission-control",t.showMission?"Exit Mission Control":"Open Mission Control","live sessions blocked waiting answer everything at once",De,t.onToggleMissionControl,h("missionControl")),...(t.extraActions??[]).map(ot),a("new-session","Start a new session","project agent chat create",$e,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Ae,t.onDuplicateSession),t.canFocusComposer&&a("focus-composer","Focus message composer","chat prompt input",te,t.onFocusComposer,h("focusComposer")),t.onFindInConversation&&a("find-in-conversation","Find in conversation","search text transcript turns matches",Re,t.onFindInConversation,h("findInConversation"))),F=(t.projects??[]).slice(0,8).map(n=>a(`project-${n.dirName}`,n.shortName,`${n.path} ${n.dirName} project workspace`,He,()=>{var i;return(i=t.onOpenProject)==null?void 0:i.call(t,n.dirName)},void 0,`${n.path} · ${n.sessionCount} session${n.sessionCount===1?"":"s"}`)),E=(t.recentSessions??[]).slice(0,10).map(n=>{const v=(n.aiTitle||n.name||n.slug||n.lastUserMessage||n.firstUserMessage||n.sessionId).replace(/\s+/g," ").trim().slice(0,160)||n.sessionId,L=[n.projectShortName,n.gitBranch].filter(Boolean).join(" · ");return a(`session-${n.dirName}-${n.fileName}`,v,`${n.projectShortName} ${n.cwd??""} ${n.gitBranch??""} ${n.sessionId} recent thread conversation`,te,()=>{var q;return(q=t.onOpenSession)==null?void 0:q.call(t,n.dirName,n.fileName)},void 0,L)}),A=t.devices??[],I=A.length>1&&t.onSwitchDevice?A.slice(0,Z.length).map((n,i)=>a(`device-${n.id}`,n.isActive?`${n.name} (current)`:`Switch to ${n.name}`,`device machine host remote ${n.id}`,n.isLocal?Me:ne,()=>{var v;return(v=t.onSwitchDevice)==null?void 0:v.call(t,n.id)},h(Z[i]))):[],o=V(a("toggle-sidebar",t.showSidebar?"Hide session sidebar":"Show session sidebar","projects navigation panel",Ue,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",ze,t.onToggleStats,h("toggleStats")),t.onToggleProjectFiles&&a("project-files",t.showProjectFiles?"Close project files":"Open project files","browse edit save workspace source code",Ke,t.onToggleProjectFiles,h("projectFiles")),t.onToggleBrowser&&a("toggle-browser",t.showBrowser?"Hide browser":"Show browser","web page live view browse panel",Ge,t.onToggleBrowser),t.hasFileChanges&&a("toggle-file-changes",t.showFileChanges?"Hide file changes":"Show file changes","diff edits review panel",qe,t.onToggleFileChanges),t.supportsWorktrees&&t.canOpenTerminal&&a("toggle-worktrees",t.showWorktrees?"Hide worktrees":"Show worktrees","git branches panel",Be,t.onToggleWorktrees)),R=V(t.onOpenProjectInEditor&&a("open-project-editor","Open project in editor","code cursor vscode zed workspace",tt,t.onOpenProjectInEditor),t.onRevealProject&&a("reveal-project","Reveal project in file manager","finder explorer folder directory",et,t.onRevealProject),t.onCopyResumeCommand&&a("copy-resume-command","Copy resume command","cli claude codex copilot terminal clipboard continue session",oe,t.onCopyResumeCommand),t.onCopyProjectPath&&a("copy-project-path","Copy project path","workspace directory clipboard",oe,t.onCopyProjectPath),t.onOpenIntegratedTerminal&&a("integrated-terminal","New integrated terminal","embedded shell command line process panel",Ze,t.onOpenIntegratedTerminal,h("newIntegratedTerminal")),t.canOpenTerminal&&a("terminal","Open in system terminal","external shell command line app",Ye,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Qe,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",Je,t.onOpenKeyboardShortcuts),t.onOpenConfig&&a("config",t.showConfig?"Close agent configuration":"Open agent configuration","skills commands claude settings files",Xe,t.onOpenConfig),a("settings","Open Cogpit settings","preferences network",Ve,t.onOpenSettings),a("theme","Change theme & chat width","appearance light dark oled width narrow wide",_e,t.onOpenTheme,h("themeSelector")),a("expand","Expand all groups","conversation details",ae,t.onExpandAll,h("expandAll")),a("expand-payloads","Expand all tool payloads","raw input result diff conversation details",ae,t.onExpandToolPayloads,h("expandToolPayloads")),a("collapse","Collapse all","conversation groups payloads details",pe,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",We,t.onKillAll),t.onOpenDevices&&a("manage-devices","Manage devices…","remote machines hub hosts edit rename remove switch",nt,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"manage")}),t.onOpenDevices&&a("add-device","Add device…","remote machine hub host connect pair new",ne,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"add")})),k=[{value:"Navigation",items:$},...E.length>0?[{value:"Recent sessions",items:E}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...I.length>0?[{value:"Devices",items:I}]:[],{value:"View",items:o},{value:"Tools",items:R}],D=function(i){t.onOpenChange(!1),i.run()};l=ve,y=t.open,N=t.onOpenChange,x="Command palette",w="Search for a Cogpit action to run.",C="max-w-xl",c=we,j="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Ce,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=b):b=e[16],e[17]!==t.loadingNavigation?(f=t.loadingNavigation&&u.jsxs("div",{className:"motion-enter flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",role:"status",children:[u.jsx(ue,{className:"size-3.5"}),"Loading projects and sessions..."]}),e[17]=t.loadingNavigation,e[18]=f):f=e[18],s=je,m="max-h-[min(26rem,60vh)]",e[19]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Se,{children:"No matching actions."}),e[19]=d):d=e[19],r=k.map(n=>u.jsx(he,{heading:n.value,children:n.items.map(i=>{const v=i.icon;return u.jsxs(ge,{value:i.value,onSelect:()=>D(i),children:[u.jsx(v,{"aria-hidden":"true"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate",children:i.label}),i.description&&u.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:i.description})]}),i.shortcut&&u.jsx(fe,{children:i.shortcut})]},i.id)})},n.value)),e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w,e[7]=C,e[8]=r,e[9]=j,e[10]=g,e[11]=b,e[12]=f,e[13]=y,e[14]=N,e[15]=x}else s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6],C=e[7],r=e[8],j=e[9],g=e[10],b=e[11],f=e[12],y=e[13],N=e[14],x=e[15];let P;e[20]!==s||e[21]!==m||e[22]!==d||e[23]!==r?(P=u.jsxs(s,{className:m,children:[d,r]}),e[20]=s,e[21]=m,e[22]=d,e[23]=r,e[24]=P):P=e[24];let T;e[25]!==c||e[26]!==P||e[27]!==j||e[28]!==g||e[29]!==b||e[30]!==f?(T=u.jsxs(c,{label:j,loop:g,children:[b,f,P]}),e[25]=c,e[26]=P,e[27]=j,e[28]=g,e[29]=b,e[30]=f,e[31]=T):T=e[31];let O;return e[32]!==l||e[33]!==w||e[34]!==C||e[35]!==T||e[36]!==y||e[37]!==N||e[38]!==x?(O=u.jsx(l,{open:y,onOpenChange:N,title:x,description:w,className:C,children:T}),e[32]=l,e[33]=w,e[34]=C,e[35]=T,e[36]=y,e[37]=N,e[38]=x,e[39]=O):O=e[39],O}function ot(t){return a(t.id,t.label,t.keywords,t.icon,t.onSelect)}async function se(t,e){const s=await Ie(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function dt(t){var X;const e=ie.c(51);let s,c,l,m,d,w;e[0]!==t?({open:l,currentProjectDirName:s,projectCwd:d,onProcessStarted:c,launchTerminalRequest:w,...m}=t,e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w):(s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6]);const C=w===void 0?0:w,r=be();let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[7]=j):j=e[7];const[g,b]=M.useState(j);let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[8]=f):f=e[8];const[y,N]=M.useState(f),[x,P]=M.useState(!1),T=M.useRef(0),O=ye();let $,F;e[9]!==O||e[10]!==l?($=()=>{if(!l)return;const S=new AbortController,B=Te();return P(!0),Promise.allSettled([se("/api/projects",S.signal),se(Oe({limit:"12",perProject:"3"},O),S.signal)]).then(me=>{const[J,Q]=me;if(S.signal.aborted)return;const Y=Q.status==="fulfilled"?Q.value:[];ke(Y,B),b(J.status==="fulfilled"?J.value:[]),N(Y),P(!1)}),()=>S.abort()},F=[l,O],e[9]=O,e[10]=l,e[11]=$,e[12]=F):($=e[11],F=e[12]),M.useEffect($,F);let E;e[13]!==g?(E=xe(g),e[13]=g,e[14]=E):E=e[14];const A=E;let I;e:{if(d){I=d;break e}if(!s){I=null;break e}let S;e[15]!==s||e[16]!==g?(S=((X=g.find(B=>B.dirName===s))==null?void 0:X.path)??null,e[15]=s,e[16]=g,e[17]=S):S=e[17],I=S}const o=I;let R;e[18]!==c||e[19]!==r||e[20]!==o?(R=()=>{if(!o)return;const S=r.spawnTerminal({cwd:o}),B=o.replace(/\/+$/,"").split("/").at(-1)||"Terminal";c({id:S,name:B,type:"terminal",status:"running",source:o})},e[18]=c,e[19]=r,e[20]=o,e[21]=R):R=e[21];const k=R;let D,n;e[22]!==k||e[23]!==C||e[24]!==r.status||e[25]!==o?(n=()=>{C<=T.current||!o||r.status!=="connected"||(T.current=C,k())},D=[k,C,r.status,o],e[22]=k,e[23]=C,e[24]=r.status,e[25]=o,e[26]=D,e[27]=n):(D=e[26],n=e[27]),M.useEffect(n,D);let i;e[28]!==s||e[29]!==o?(i={path:o,dirName:s},e[28]=s,e[29]=o,e[30]=i):i=e[30];const v=i;let L;e[31]!==v?(L=()=>Ne(v),e[31]=v,e[32]=L):L=e[32];const q=L;let G;e[33]!==v?(G=()=>Fe(v),e[33]=v,e[34]=G):G=e[34];const le=G,ce=!ee()&&_("hostFiles"),re=_("hostFiles")&&(!ee()||Pe());let K;e[35]!==o?(K=()=>{o&&Ee(o)},e[35]=o,e[36]=K):K=e[36];const de=K;let H;e[37]!==k||e[38]!==r.status||e[39]!==o?(H=o&&r.status==="connected"&&_("terminal")?k:void 0,e[37]=k,e[38]=r.status,e[39]=o,e[40]=H):H=e[40];const U=o&&re?q:void 0,W=o&&ce?le:void 0,p=o?de:void 0;let z;return e[41]!==x||e[42]!==l||e[43]!==m||e[44]!==y||e[45]!==A||e[46]!==H||e[47]!==U||e[48]!==W||e[49]!==p?(z=u.jsx(at,{...m,open:l,projects:A,recentSessions:y,loadingNavigation:x,onOpenIntegratedTerminal:H,onOpenProjectInEditor:U,onRevealProject:W,onCopyProjectPath:p}),e[41]=x,e[42]=l,e[43]=m,e[44]=y,e[45]=A,e[46]=H,e[47]=U,e[48]=W,e[49]=p,e[50]=z):z=e[50],z}export{dt as CommandPaletteHost};
@@ -1 +1 @@
1
- import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{b9 as ye,bu as Ce,J as F,z as ke,C as W,b1 as X,T as ve,H as Z,b6 as ae,B as I,U as A,bv as Ne,bw as Se,bx as we,by as De,bz as Te,bA as Ee,bB as V,bC as Re,bD as ee,bE as Oe,Z as te,a4 as le,bF as Ie,a5 as ie,a6 as re,a8 as oe,a9 as ce,aa as de,ab as ue,ac as me,ag as ze,L as Ae,M as Le,N as Be,O as $e,Q as Fe,Y as Ge,m as Me,I as ne,n as Pe,E as Ue,q as _e,bG as Ve}from"./index-CW9tjG1S.js";import{ak as He,y as Ke,g as Je,a4 as Qe,al as Ye,am as qe,an as xe,n as fe,ao as We,ap as Xe,U as H,X as K,P as Ze,aq as he,ar as et,i as tt,a1 as nt,S as st,O as at}from"./vendor-ui-Br3ZTAXZ.js";import{H as lt}from"./HighlightedEditor-D75svkum.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const it={agent:"bg-muted text-muted-foreground",skill:"bg-muted text-muted-foreground",command:"bg-muted text-muted-foreground",instructions:"bg-muted text-muted-foreground",settings:"bg-muted text-muted-foreground"},rt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},se=["instructions","agents","skills","commands","settings"],ot={instructions:{label:"Instructions",icon:Ye,color:"text-muted-foreground"},agents:{label:"Agents",icon:Qe,color:"text-muted-foreground"},skills:{label:"Skills",icon:Je,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ke,color:"text-muted-foreground"},settings:{label:"Settings",icon:He,color:"text-muted-foreground"}};function J(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...J(s.children,e,i)):s.type==="file"&&n.push({name:s.name,path:s.path,fileType:s.fileType||"unknown",description:s.description||"",scope:e,pluginName:i,readOnly:s.readOnly??e==="plugin",cli:s.cli,linkTarget:s.linkTarget});return n}function ct(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=J(i.items,i.scope,i.pluginName);for(const s of n)switch(s.fileType){case"instructions":e.instructions.push(s);break;case"agent":e.agents.push(s);break;case"skill":e.skills.push(s);break;case"command":e.commands.push(s);break;case"settings":default:e.settings.push(s)}}return e}function ge(l){const e=G.c(5),{scope:i,pluginName:n}=l;if(i==="plugin"&&n){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(qe,{"data-icon":"inline-start",className:"size-3"}),e[0]=r):r=e[0];let u;return e[1]!==n?(u=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r,n]}),e[1]=n,e[2]=u):u=e[2],u}if(i==="project"){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),"project"]}),e[3]=r):r=e[3],r}let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(fe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const dt=Object.fromEntries(ye().map(l=>[l.kind,Ce(l.kind)]));function pe(l){const e=G.c(10),{cli:i,variant:n}=l,s=n===void 0?"compact":n;if(!i)return null;if(i.length===0){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(We,{"data-icon":"inline-start",className:"size-3"}),e[0]=m):m=e[0];const c=s==="full"&&"unlinked";let d;return e[1]!==c?(d=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",title:"Present in the shared source directory but not linked into any CLI",children:[m,c]}),e[1]=c,e[2]=d):d=e[2],d}let r;if(e[3]!==i||e[4]!==s){let m;e[6]!==s?(m=c=>{const d=dt[c];return t.jsx("span",{title:d.label,className:s==="full"?"flex h-5 items-center justify-center rounded border bg-muted px-1.5 text-xs font-medium text-muted-foreground":"flex size-5 items-center justify-center rounded border bg-muted text-xs font-medium text-muted-foreground",children:s==="full"?c:d.letter},c)},e[6]=s,e[7]=m):m=e[7],r=i.map(m),e[3]=i,e[4]=s,e[5]=r}else r=e[5];let u;return e[8]!==r?(u=t.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:r}),e[8]=r,e[9]=u):u=e[9],u}function je(l){const e=G.c(10),{linkTarget:i,variant:n,className:s}=l,r=n===void 0?"compact":n;if(!i)return null;let u;e[0]!==s?(u=F("flex min-w-0 shrink-0 items-center gap-1 text-info",s),e[0]=s,e[1]=u):u=e[1];const m=`Symlink → ${i}`;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Xe,{"data-icon":"inline-start",className:"size-3 shrink-0"}),e[2]=c):c=e[2];let d;e[3]!==i||e[4]!==r?(d=r==="full"&&t.jsxs("span",{className:"truncate font-mono text-xs",children:["→ ",i]}),e[3]=i,e[4]=r,e[5]=d):d=e[5];let p;return e[6]!==u||e[7]!==m||e[8]!==d?(p=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=p):p=e[9],p}function ut({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,p]=o.useState(!1),w=o.useRef(null),y=o.useId();o.useEffect(()=>{var x;(x=w.current)==null||x.focus()},[]);const k=m==="project"&&e?e:l,b=!!l&&!!e;async function S(){if(!(!r.trim()||!k)){p(!0);try{const x=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:k,fileType:i,name:r.trim()})});if(x.ok){const g=await x.json();n(g.path,i,m)}}finally{p(!1)}}}return t.jsxs(ke,{className:"gap-3 px-3 py-2",children:[b&&t.jsxs(W,{children:[t.jsx(X,{children:"Scope"}),t.jsxs(ve,{"aria-label":"File scope",value:[m],onValueChange:x=>{const g=x[0];(g==="global"||g==="project")&&c(g)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(Z,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(Z,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(W,{children:[t.jsxs(X,{htmlFor:y,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{id:y,ref:w,type:"text",value:r,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&S(),x.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void S(),disabled:d||!r.trim()||!k,children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"data-icon":"inline-start"})})]})]})]})}function mt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:p,onRenameValueChange:w,onRenameSubmit:y,onRenameCancel:k,creatingInCategory:b,onCreated:S,onCancelCreate:x}=l,g=ot[i],C=g.icon;if(n.length===0&&!u)return null;let N;e[0]!==g.color?(N=F("size-3.5",g.color),e[0]=g.color,e[1]=N):N=e[1];let v;e[2]!==C||e[3]!==N?(v=t.jsx(C,{"data-icon":"inline-start",className:N}),e[2]=C,e[3]=N,e[4]=v):v=e[4];let T;e[5]!==g.label?(T=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:g.label}),e[5]=g.label,e[6]=T):T=e[6];let E;e[7]!==n.length?(E=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=E):E=e[8];let f;e[9]!==i||e[10]!==u?(f=u&&t.jsxs(Ne,{children:[t.jsx(Se,{render:t.jsx(I,{variant:"ghost",size:"icon-xs",className:"opacity-0 transition-opacity group-hover:opacity-100","aria-label":`New ${i.slice(0,-1)}`,onClick:u}),children:t.jsx(Ze,{"data-icon":"inline-start"})}),t.jsxs(we,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=f):f=e[11];let D;e[12]!==v||e[13]!==T||e[14]!==E||e[15]!==f?(D=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[v,T,E,f]}),e[12]=v,e[13]=T,e[14]=E,e[15]=f,e[16]=D):D=e[16];let z;if(e[17]!==n||e[18]!==m||e[19]!==k||e[20]!==c||e[21]!==y||e[22]!==w||e[23]!==r||e[24]!==p||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==k||e[30]!==c||e[31]!==y||e[32]!==w||e[33]!==r||e[34]!==p||e[35]!==d||e[36]!==s?(B=j=>{const U=s===j.path;if(d===j.path)return t.jsxs("div",{className:"flex items-center gap-1 border-l-2 border-foreground/30 bg-accent px-3 py-1",children:[t.jsx(ae,{value:p,onChange:$=>w($.target.value),onKeyDown:$=>{$.key==="Enter"&&y(),$.key==="Escape"&&k()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:y,disabled:!p.trim(),children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(K,{"data-icon":"inline-start"})})]},j.path);const M=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-sm",children:j.name}),t.jsx(je,{linkTarget:j.linkTarget}),j.readOnly&&t.jsx(he,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),j.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]}),t.jsx(pe,{cli:j.cli}),t.jsx(ge,{scope:j.scope,pluginName:j.pluginName})]}),P=F("flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left text-sm transition-colors",U?"border-foreground/30 bg-accent text-accent-foreground":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground");return!m||!c?t.jsx("button",{type:"button",className:P,onClick:()=>r(j),children:M},j.path):t.jsxs(De,{children:[t.jsx(Te,{render:t.jsx("button",{type:"button",className:P,onClick:()=>r(j)}),children:M}),t.jsx(Ee,{className:"min-w-36",children:j.readOnly?t.jsx(V,{children:t.jsx(Re,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(ee,{onClick:()=>c(j),children:"Rename"})}),t.jsx(Oe,{}),t.jsx(V,{children:t.jsx(ee,{variant:"destructive",onClick:()=>m(j),children:"Delete"})})]})})]},j.path)},e[28]=m,e[29]=k,e[30]=c,e[31]=y,e[32]=w,e[33]=r,e[34]=p,e[35]=d,e[36]=s,e[37]=B):B=e[37],z=n.map(B),e[17]=n,e[18]=m,e[19]=k,e[20]=c,e[21]=y,e[22]=w,e[23]=r,e[24]=p,e[25]=d,e[26]=s,e[27]=z}else z=e[27];let R;e[38]!==b||e[39]!==n.length?(R=n.length===0&&!b&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=b,e[39]=n.length,e[40]=R):R=e[40];let O;e[41]!==b||e[42]!==x||e[43]!==S?(O=b&&t.jsx(ut,{globalDir:b.globalDir,projectDir:b.projectDir,fileType:b.fileType,onCreated:S,onCancel:x}),e[41]=b,e[42]=x,e[43]=S,e[44]=O):O=e[44];let L;return e[45]!==D||e[46]!==z||e[47]!==R||e[48]!==O?(L=t.jsxs("section",{children:[D,z,R,O]}),e[45]=D,e[46]=z,e[47]=R,e[48]=O,e[49]=L):L=e[49],L}function xt({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,p]=o.useState(!1),[w,y]=o.useState(!1),[k,b]=o.useState(!1),[S,x]=o.useState(!1),g=n!==null&&n!==r,C=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),y(!1),b(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(f=>f.json()).then(f=>{s(f.content??""),u(f.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const N=o.useCallback(async()=>{if(!(!g||C)){p(!0);try{(await A("/api/config-browser/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l.path,content:n})})).ok&&(u(n),y(!0),setTimeout(()=>y(!1),2e3))}finally{p(!1)}}},[n,l.path,g,C]),v=o.useCallback(()=>{s(r)},[r]),T=o.useCallback(async()=>{if(!C){x(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(b(!1),e())}catch{}finally{x(!1)}}},[l.path,C,e]);o.useEffect(()=>{function f(D){!C&&(D.metaKey||D.ctrlKey)&&D.key==="s"&&(D.preventDefault(),N())}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[N,C]);function E(){return w?"Saved!":d?"Saving...":"Save"}return t.jsxs("div",{className:"flex flex-1 flex-col min-h-0 min-w-0",children:[t.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b bg-card px-4 py-2",children:[t.jsx(te,{variant:"outline",className:F("h-5 text-xs",it[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(ge,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),C&&t.jsxs(te,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(he,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),g&&t.jsx("span",{className:"size-2 shrink-0 rounded-full bg-warning",title:"Unsaved changes"}),t.jsxs("div",{className:"flex items-center gap-2 ml-auto min-w-0",children:[t.jsx(je,{linkTarget:l.linkTarget,variant:"full"}),t.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",title:l.path,children:l.path})]})]}),m?t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"Loading..."}):t.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[t.jsx(lt,{value:n??"",onChange:s,readOnly:C,filePath:l.path}),!C&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(I,{size:"xs",onClick:N,disabled:!g||d,children:[t.jsx(H,{"data-icon":"inline-start"}),E()]}),t.jsxs(I,{variant:"outline",size:"xs",onClick:v,disabled:!g,children:[t.jsx(et,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(le,{open:k,onOpenChange:b,children:[t.jsxs(Ie,{render:t.jsx(I,{variant:"outline",size:"xs"}),children:[t.jsx(tt,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",disabled:S,children:"Cancel"}),t.jsxs(me,{variant:"destructive",size:"sm",disabled:S,onClick:()=>void T(),children:[S&&t.jsx(ze,{"data-icon":"inline-start"}),S?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ft(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ae,{className:"border-0",children:t.jsxs(Le,{children:[t.jsx(Be,{variant:"icon",children:t.jsx(nt,{})}),t.jsx($e,{children:"Select a configuration file"}),t.jsx(Fe,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function ht(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function gt(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",ht(n)].some(r=>r.toLowerCase().includes(i)))}const vt=o.memo(function({projectPath:e,initialFilePath:i}){var Y,q;const n=Ge("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[p,w]=o.useState(!1),[y,k]=o.useState(null),[b,S]=o.useState(""),[x,g]=o.useState(null),[C,N]=o.useState(""),[v,T]=o.useState(null),E=o.useRef(!1),f=o.useCallback(async()=>{if(!n){r([]),d(null),m(!1);return}m(!0);try{const a=e?`/api/config-browser/tree?cwd=${encodeURIComponent(e)}`:"/api/config-browser/tree",h=await A(a);if(h.ok){const _=await h.json();r(_.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!i||u||E.current)return;const a=s.flatMap(h=>J(h.items,h.scope,h.pluginName)).find(h=>h.path===i);a&&(d(a),E.current=!0)},[i,u,s]);const D=ct(s),z=Object.fromEntries(se.map(a=>[a,gt(D[a],b)])),R=(Y=s.find(a=>a.scope==="global"))==null?void 0:Y.baseDir,O=(q=s.find(a=>a.scope==="project"))==null?void 0:q.baseDir,L=o.useCallback(a=>{d(a),w(!1),k(null)},[]),B=o.useCallback((a,h,_)=>{k(null),f(),d({path:a,name:a.split("/").pop()||"",fileType:h,readOnly:!1,scope:_,description:""})},[f]),j=o.useCallback(()=>{d(null),f()},[f]),U=o.useCallback(a=>{if(!n||!R&&!O)return;const h=rt[a];h&&k({category:a,globalDir:R?`${R}/${h.subdir}`:null,projectDir:O?`${O}/${h.subdir}`:null,fileType:h.fileType})},[n,R,O]),Q=o.useCallback(a=>{!n||a.readOnly||T(a)},[n]),M=o.useCallback(async()=>{if(!n||!v||v.readOnly)return;const a=v;T(null);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(a.path)}`,{method:"DELETE"})).ok&&((c==null?void 0:c.path)===a.path&&d(null),f())}catch{}},[n,f,v,c]),P=o.useCallback(a=>{if(!n||a.readOnly)return;const h=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");g(a),N(h)},[n]),$=o.useCallback(async()=>{if(!(!n||!x||!C.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:x.path,newName:C.trim()})});if(a.ok){const h=await a.json();g(null),N(""),await f(),h.newPath&&d({...x,path:h.newPath,name:h.newPath.split("/").pop()||x.name})}}catch{}},[n,x,C,f]),be=o.useCallback(()=>{g(null),N("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:F("min-h-0 shrink-0 flex-col border-r bg-sidebar md:flex md:w-80",c&&!p?"hidden":"flex w-full"),children:[t.jsxs("div",{className:"flex h-11 items-center gap-2 border-b px-3",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Configuration"}),e&&t.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",title:e,children:e.split("/").pop()})]}),t.jsx("div",{className:"border-b p-2",children:t.jsxs(Me,{children:[t.jsx(ne,{children:t.jsx(st,{"data-icon":"inline-start"})}),t.jsx(Pe,{value:b,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),b&&t.jsx(ne,{align:"inline-end",children:t.jsx(Ue,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(K,{"data-icon":"inline-start"})})})]})}),t.jsx(_e,{className:"flex-1",children:t.jsx("div",{className:"flex flex-col gap-1 py-2",children:u?t.jsx("div",{className:"flex flex-col gap-2 px-3 py-2","aria-label":"Loading configuration",children:Array.from({length:6},(a,h)=>t.jsx(Ve,{className:"h-8 w-full"},h))}):se.map(a=>{const h=a==="agents"||a==="skills"||a==="commands";return t.jsx(mt,{category:a,items:z[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:L,onNewFile:n&&h?()=>U(a):void 0,onDeleteItem:n?Q:void 0,onRenameItem:n?P:void 0,renamingPath:(x==null?void 0:x.path)??null,renameValue:C,onRenameValueChange:N,onRenameSubmit:$,onRenameCancel:be,creatingInCategory:n&&(y==null?void 0:y.category)===a?y:null,onCreated:B,onCancelCreate:()=>k(null)},a)})})})]}),t.jsx("div",{className:F("min-h-0 min-w-0 flex-1 flex-col md:flex",c&&!p?"flex":"hidden"),children:c?t.jsxs(t.Fragment,{children:[t.jsxs(I,{variant:"ghost",className:"min-h-11 shrink-0 justify-start md:hidden",onClick:()=>w(!0),children:[t.jsx(at,{"data-icon":"inline-start"}),"All configuration files"]}),t.jsx(xt,{file:c,onDeleted:j,readOnly:!n})]}):t.jsx(ft,{})}),t.jsx(le,{open:v!==null,onOpenChange:a=>{a||T(null)},children:t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',v==null?void 0:v.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",children:"Cancel"}),t.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void M(),children:"Delete file"})]})]})})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Server configuration is available to administrators only."})});export{vt as ConfigBrowser};
1
+ import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{bD as ye,bX as Ce,J as F,z as ke,C as X,bw as Z,T as ve,H as q,b5 as ae,B as I,U as A,bY as Ne,bZ as Se,b_ as we,b$ as De,c0 as Te,c1 as Ee,c2 as V,c3 as Re,c4 as ee,c5 as Oe,Z as te,a4 as le,c6 as Ie,a5 as ie,a6 as re,a8 as oe,a9 as ce,aa as de,ab as ue,ac as me,ag as ze,L as Ae,M as Le,N as Be,O as $e,Q as Fe,Y as Ge,m as Me,I as ne,n as Pe,E as Ue,q as _e,c7 as Ve}from"./index-CYJLZdyZ.js";import{as as He,y as Ke,g as Ye,ac as Je,at as Qe,a2 as We,au as xe,n as fe,av as Xe,aw as Ze,U as H,X as K,P as qe,ax as he,ay as et,i as tt,a9 as nt,S as st,O as at}from"./vendor-ui-Dxtv9P3W.js";import{H as lt}from"./HighlightedEditor-Cz0PCIaA.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const it={agent:"bg-muted text-muted-foreground",skill:"bg-muted text-muted-foreground",command:"bg-muted text-muted-foreground",instructions:"bg-muted text-muted-foreground",settings:"bg-muted text-muted-foreground"},rt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},se=["instructions","agents","skills","commands","settings"],ot={instructions:{label:"Instructions",icon:Qe,color:"text-muted-foreground"},agents:{label:"Agents",icon:Je,color:"text-muted-foreground"},skills:{label:"Skills",icon:Ye,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ke,color:"text-muted-foreground"},settings:{label:"Settings",icon:He,color:"text-muted-foreground"}};function Y(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...Y(s.children,e,i)):s.type==="file"&&n.push({name:s.name,path:s.path,fileType:s.fileType||"unknown",description:s.description||"",scope:e,pluginName:i,readOnly:s.readOnly??e==="plugin",cli:s.cli,linkTarget:s.linkTarget});return n}function ct(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=Y(i.items,i.scope,i.pluginName);for(const s of n)switch(s.fileType){case"instructions":e.instructions.push(s);break;case"agent":e.agents.push(s);break;case"skill":e.skills.push(s);break;case"command":e.commands.push(s);break;case"settings":default:e.settings.push(s)}}return e}function ge(l){const e=G.c(5),{scope:i,pluginName:n}=l;if(i==="plugin"&&n){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(We,{"data-icon":"inline-start",className:"size-3"}),e[0]=r):r=e[0];let u;return e[1]!==n?(u=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r,n]}),e[1]=n,e[2]=u):u=e[2],u}if(i==="project"){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),"project"]}),e[3]=r):r=e[3],r}let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(fe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const dt=Object.fromEntries(ye().map(l=>[l.kind,Ce(l.kind)]));function pe(l){const e=G.c(10),{cli:i,variant:n}=l,s=n===void 0?"compact":n;if(!i)return null;if(i.length===0){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Xe,{"data-icon":"inline-start",className:"size-3"}),e[0]=m):m=e[0];const c=s==="full"&&"unlinked";let d;return e[1]!==c?(d=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",title:"Present in the shared source directory but not linked into any CLI",children:[m,c]}),e[1]=c,e[2]=d):d=e[2],d}let r;if(e[3]!==i||e[4]!==s){let m;e[6]!==s?(m=c=>{const d=dt[c];return t.jsx("span",{title:d.label,className:s==="full"?"flex h-5 items-center justify-center rounded border bg-muted px-1.5 text-xs font-medium text-muted-foreground":"flex size-5 items-center justify-center rounded border bg-muted text-xs font-medium text-muted-foreground",children:s==="full"?c:d.letter},c)},e[6]=s,e[7]=m):m=e[7],r=i.map(m),e[3]=i,e[4]=s,e[5]=r}else r=e[5];let u;return e[8]!==r?(u=t.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:r}),e[8]=r,e[9]=u):u=e[9],u}function je(l){const e=G.c(10),{linkTarget:i,variant:n,className:s}=l,r=n===void 0?"compact":n;if(!i)return null;let u;e[0]!==s?(u=F("flex min-w-0 shrink-0 items-center gap-1 text-info",s),e[0]=s,e[1]=u):u=e[1];const m=`Symlink → ${i}`;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ze,{"data-icon":"inline-start",className:"size-3 shrink-0"}),e[2]=c):c=e[2];let d;e[3]!==i||e[4]!==r?(d=r==="full"&&t.jsxs("span",{className:"truncate font-mono text-xs",children:["→ ",i]}),e[3]=i,e[4]=r,e[5]=d):d=e[5];let p;return e[6]!==u||e[7]!==m||e[8]!==d?(p=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=p):p=e[9],p}function ut({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,p]=o.useState(!1),w=o.useRef(null),y=o.useId();o.useEffect(()=>{var x;(x=w.current)==null||x.focus()},[]);const k=m==="project"&&e?e:l,b=!!l&&!!e;async function S(){if(!(!r.trim()||!k)){p(!0);try{const x=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:k,fileType:i,name:r.trim()})});if(x.ok){const g=await x.json();n(g.path,i,m)}}finally{p(!1)}}}return t.jsxs(ke,{className:"gap-3 px-3 py-2",children:[b&&t.jsxs(X,{children:[t.jsx(Z,{children:"Scope"}),t.jsxs(ve,{"aria-label":"File scope",value:[m],onValueChange:x=>{const g=x[0];(g==="global"||g==="project")&&c(g)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(q,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(q,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(X,{children:[t.jsxs(Z,{htmlFor:y,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{id:y,ref:w,type:"text",value:r,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&S(),x.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void S(),disabled:d||!r.trim()||!k,children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"data-icon":"inline-start"})})]})]})]})}function mt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:p,onRenameValueChange:w,onRenameSubmit:y,onRenameCancel:k,creatingInCategory:b,onCreated:S,onCancelCreate:x}=l,g=ot[i],C=g.icon;if(n.length===0&&!u)return null;let N;e[0]!==g.color?(N=F("size-3.5",g.color),e[0]=g.color,e[1]=N):N=e[1];let v;e[2]!==C||e[3]!==N?(v=t.jsx(C,{"data-icon":"inline-start",className:N}),e[2]=C,e[3]=N,e[4]=v):v=e[4];let T;e[5]!==g.label?(T=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:g.label}),e[5]=g.label,e[6]=T):T=e[6];let E;e[7]!==n.length?(E=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=E):E=e[8];let f;e[9]!==i||e[10]!==u?(f=u&&t.jsxs(Ne,{children:[t.jsx(Se,{render:t.jsx(I,{variant:"ghost",size:"icon-xs",className:"opacity-0 transition-opacity group-hover:opacity-100","aria-label":`New ${i.slice(0,-1)}`,onClick:u}),children:t.jsx(qe,{"data-icon":"inline-start"})}),t.jsxs(we,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=f):f=e[11];let D;e[12]!==v||e[13]!==T||e[14]!==E||e[15]!==f?(D=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[v,T,E,f]}),e[12]=v,e[13]=T,e[14]=E,e[15]=f,e[16]=D):D=e[16];let z;if(e[17]!==n||e[18]!==m||e[19]!==k||e[20]!==c||e[21]!==y||e[22]!==w||e[23]!==r||e[24]!==p||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==k||e[30]!==c||e[31]!==y||e[32]!==w||e[33]!==r||e[34]!==p||e[35]!==d||e[36]!==s?(B=j=>{const U=s===j.path;if(d===j.path)return t.jsxs("div",{className:"flex items-center gap-1 border-l-2 border-foreground/30 bg-accent px-3 py-1",children:[t.jsx(ae,{value:p,onChange:$=>w($.target.value),onKeyDown:$=>{$.key==="Enter"&&y(),$.key==="Escape"&&k()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:y,disabled:!p.trim(),children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(K,{"data-icon":"inline-start"})})]},j.path);const M=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-sm",children:j.name}),t.jsx(je,{linkTarget:j.linkTarget}),j.readOnly&&t.jsx(he,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),j.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]}),t.jsx(pe,{cli:j.cli}),t.jsx(ge,{scope:j.scope,pluginName:j.pluginName})]}),P=F("flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left text-sm transition-colors",U?"border-foreground/30 bg-accent text-accent-foreground":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground");return!m||!c?t.jsx("button",{type:"button",className:P,onClick:()=>r(j),children:M},j.path):t.jsxs(De,{children:[t.jsx(Te,{render:t.jsx("button",{type:"button",className:P,onClick:()=>r(j)}),children:M}),t.jsx(Ee,{className:"min-w-36",children:j.readOnly?t.jsx(V,{children:t.jsx(Re,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(ee,{onClick:()=>c(j),children:"Rename"})}),t.jsx(Oe,{}),t.jsx(V,{children:t.jsx(ee,{variant:"destructive",onClick:()=>m(j),children:"Delete"})})]})})]},j.path)},e[28]=m,e[29]=k,e[30]=c,e[31]=y,e[32]=w,e[33]=r,e[34]=p,e[35]=d,e[36]=s,e[37]=B):B=e[37],z=n.map(B),e[17]=n,e[18]=m,e[19]=k,e[20]=c,e[21]=y,e[22]=w,e[23]=r,e[24]=p,e[25]=d,e[26]=s,e[27]=z}else z=e[27];let R;e[38]!==b||e[39]!==n.length?(R=n.length===0&&!b&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=b,e[39]=n.length,e[40]=R):R=e[40];let O;e[41]!==b||e[42]!==x||e[43]!==S?(O=b&&t.jsx(ut,{globalDir:b.globalDir,projectDir:b.projectDir,fileType:b.fileType,onCreated:S,onCancel:x}),e[41]=b,e[42]=x,e[43]=S,e[44]=O):O=e[44];let L;return e[45]!==D||e[46]!==z||e[47]!==R||e[48]!==O?(L=t.jsxs("section",{children:[D,z,R,O]}),e[45]=D,e[46]=z,e[47]=R,e[48]=O,e[49]=L):L=e[49],L}function xt({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,p]=o.useState(!1),[w,y]=o.useState(!1),[k,b]=o.useState(!1),[S,x]=o.useState(!1),g=n!==null&&n!==r,C=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),y(!1),b(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(f=>f.json()).then(f=>{s(f.content??""),u(f.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const N=o.useCallback(async()=>{if(!(!g||C)){p(!0);try{(await A("/api/config-browser/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l.path,content:n})})).ok&&(u(n),y(!0),setTimeout(()=>y(!1),2e3))}finally{p(!1)}}},[n,l.path,g,C]),v=o.useCallback(()=>{s(r)},[r]),T=o.useCallback(async()=>{if(!C){x(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(b(!1),e())}catch{}finally{x(!1)}}},[l.path,C,e]);o.useEffect(()=>{function f(D){!C&&(D.metaKey||D.ctrlKey)&&D.key==="s"&&(D.preventDefault(),N())}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[N,C]);function E(){return w?"Saved!":d?"Saving...":"Save"}return t.jsxs("div",{className:"flex flex-1 flex-col min-h-0 min-w-0",children:[t.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b bg-card px-4 py-2",children:[t.jsx(te,{variant:"outline",className:F("h-5 text-xs",it[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(ge,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),C&&t.jsxs(te,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(he,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),g&&t.jsx("span",{className:"size-2 shrink-0 rounded-full bg-warning",title:"Unsaved changes"}),t.jsxs("div",{className:"flex items-center gap-2 ml-auto min-w-0",children:[t.jsx(je,{linkTarget:l.linkTarget,variant:"full"}),t.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",title:l.path,children:l.path})]})]}),m?t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"Loading..."}):t.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[t.jsx(lt,{value:n??"",onChange:s,readOnly:C,filePath:l.path}),!C&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(I,{size:"xs",onClick:N,disabled:!g||d,children:[t.jsx(H,{"data-icon":"inline-start"}),E()]}),t.jsxs(I,{variant:"outline",size:"xs",onClick:v,disabled:!g,children:[t.jsx(et,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(le,{open:k,onOpenChange:b,children:[t.jsxs(Ie,{render:t.jsx(I,{variant:"outline",size:"xs"}),children:[t.jsx(tt,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",disabled:S,children:"Cancel"}),t.jsxs(me,{variant:"destructive",size:"sm",disabled:S,onClick:()=>void T(),children:[S&&t.jsx(ze,{"data-icon":"inline-start"}),S?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ft(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ae,{className:"border-0",children:t.jsxs(Le,{children:[t.jsx(Be,{variant:"icon",children:t.jsx(nt,{})}),t.jsx($e,{children:"Select a configuration file"}),t.jsx(Fe,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function ht(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function gt(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",ht(n)].some(r=>r.toLowerCase().includes(i)))}const vt=o.memo(function({projectPath:e,initialFilePath:i}){var Q,W;const n=Ge("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[p,w]=o.useState(!1),[y,k]=o.useState(null),[b,S]=o.useState(""),[x,g]=o.useState(null),[C,N]=o.useState(""),[v,T]=o.useState(null),E=o.useRef(!1),f=o.useCallback(async()=>{if(!n){r([]),d(null),m(!1);return}m(!0);try{const a=e?`/api/config-browser/tree?cwd=${encodeURIComponent(e)}`:"/api/config-browser/tree",h=await A(a);if(h.ok){const _=await h.json();r(_.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!i||u||E.current)return;const a=s.flatMap(h=>Y(h.items,h.scope,h.pluginName)).find(h=>h.path===i);a&&(d(a),E.current=!0)},[i,u,s]);const D=ct(s),z=Object.fromEntries(se.map(a=>[a,gt(D[a],b)])),R=(Q=s.find(a=>a.scope==="global"))==null?void 0:Q.baseDir,O=(W=s.find(a=>a.scope==="project"))==null?void 0:W.baseDir,L=o.useCallback(a=>{d(a),w(!1),k(null)},[]),B=o.useCallback((a,h,_)=>{k(null),f(),d({path:a,name:a.split("/").pop()||"",fileType:h,readOnly:!1,scope:_,description:""})},[f]),j=o.useCallback(()=>{d(null),f()},[f]),U=o.useCallback(a=>{if(!n||!R&&!O)return;const h=rt[a];h&&k({category:a,globalDir:R?`${R}/${h.subdir}`:null,projectDir:O?`${O}/${h.subdir}`:null,fileType:h.fileType})},[n,R,O]),J=o.useCallback(a=>{!n||a.readOnly||T(a)},[n]),M=o.useCallback(async()=>{if(!n||!v||v.readOnly)return;const a=v;T(null);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(a.path)}`,{method:"DELETE"})).ok&&((c==null?void 0:c.path)===a.path&&d(null),f())}catch{}},[n,f,v,c]),P=o.useCallback(a=>{if(!n||a.readOnly)return;const h=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");g(a),N(h)},[n]),$=o.useCallback(async()=>{if(!(!n||!x||!C.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:x.path,newName:C.trim()})});if(a.ok){const h=await a.json();g(null),N(""),await f(),h.newPath&&d({...x,path:h.newPath,name:h.newPath.split("/").pop()||x.name})}}catch{}},[n,x,C,f]),be=o.useCallback(()=>{g(null),N("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:F("min-h-0 shrink-0 flex-col border-r bg-sidebar md:flex md:w-80",c&&!p?"hidden":"flex w-full"),children:[t.jsxs("div",{className:"flex h-11 items-center gap-2 border-b px-3",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Configuration"}),e&&t.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",title:e,children:e.split("/").pop()})]}),t.jsx("div",{className:"border-b p-2",children:t.jsxs(Me,{children:[t.jsx(ne,{children:t.jsx(st,{"data-icon":"inline-start"})}),t.jsx(Pe,{value:b,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),b&&t.jsx(ne,{align:"inline-end",children:t.jsx(Ue,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(K,{"data-icon":"inline-start"})})})]})}),t.jsx(_e,{className:"flex-1",children:t.jsx("div",{className:"flex flex-col gap-1 py-2",children:u?t.jsx("div",{className:"flex flex-col gap-2 px-3 py-2","aria-label":"Loading configuration",children:Array.from({length:6},(a,h)=>t.jsx(Ve,{className:"h-8 w-full"},h))}):se.map(a=>{const h=a==="agents"||a==="skills"||a==="commands";return t.jsx(mt,{category:a,items:z[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:L,onNewFile:n&&h?()=>U(a):void 0,onDeleteItem:n?J:void 0,onRenameItem:n?P:void 0,renamingPath:(x==null?void 0:x.path)??null,renameValue:C,onRenameValueChange:N,onRenameSubmit:$,onRenameCancel:be,creatingInCategory:n&&(y==null?void 0:y.category)===a?y:null,onCreated:B,onCancelCreate:()=>k(null)},a)})})})]}),t.jsx("div",{className:F("min-h-0 min-w-0 flex-1 flex-col md:flex",c&&!p?"flex":"hidden"),children:c?t.jsxs(t.Fragment,{children:[t.jsxs(I,{variant:"ghost",className:"min-h-11 shrink-0 justify-start md:hidden",onClick:()=>w(!0),children:[t.jsx(at,{"data-icon":"inline-start"}),"All configuration files"]}),t.jsx(xt,{file:c,onDeleted:j,readOnly:!n})]}):t.jsx(ft,{})}),t.jsx(le,{open:v!==null,onOpenChange:a=>{a||T(null)},children:t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',v==null?void 0:v.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",children:"Cancel"}),t.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void M(),children:"Delete file"})]})]})})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Server configuration is available to administrators only."})});export{vt as ConfigBrowser};
@@ -0,0 +1 @@
1
+ import{r as R,c as G,j as n}from"./vendor-react-gGw_S5I_.js";import{aP as fe,U as xe,aQ as pe,aR as te,aS as me,aT as he,aU as ge,aV as we,aW as be,aX as Ne,B as Q,q as je,J as M,$ as ue,Z as ve,aY as ye,aZ as ke}from"./index-CYJLZdyZ.js";import{W as Ie,X as Se,Y as Ce,C as de,_ as Re,$ as Ae}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const $e=4e3;function Oe(t){var g;const[e,l]=R.useState(null),[r,f]=R.useState(null),[a,c]=R.useState(new Set),d=(g=fe())==null?void 0:g.refresh,x=R.useRef(t),s=R.useRef(new Set);R.useLayoutEffect(()=>(x.current=t,()=>{x.current=null}),[t]);const i=R.useCallback(async o=>{if(t)try{const u=await xe(`/api/session-crew/${encodeURIComponent(t)}`);if(!o())return;if(!u.ok){f(u.status===404?"This session is no longer available.":"Couldn't load the crew.");return}const m=await u.json();if(!o())return;l(h=>JSON.stringify(h)===JSON.stringify(m)?h:m),f(null)}catch{o()&&f("Couldn't load the crew.")}},[t]);pe(t?i:null,$e),R.useEffect(()=>{l(o=>o!=null&&o.members.some(u=>u.sessionId===t)?o:null),f(null),c(new Set)},[t]);const p=R.useCallback(async(o,u,m)=>{const h=`${t}:${o}`;if(s.current.has(h))return;const N=()=>x.current===t;s.current.add(h),c(y=>new Set(y).add(o));try{const y=await u();if(!N())return;if(!y.ok&&y.status!==404){f(m);return}d==null||d(),await i(N)}catch{N()&&f(m)}finally{s.current.delete(h),N()&&c(y=>{const k=new Set(y);return k.delete(o),k})}},[i,d,t]),w=R.useCallback((o,u,m)=>p(u,()=>te("/api/session-respond",{sessionId:o,requestId:u,...m}),"Couldn't send the answer."),[p]),j=R.useCallback((o,u)=>p(u,()=>te("/api/delegated-tasks",{sessionId:o,taskId:u,action:"ack"}),"Couldn't mark the result read."),[p]),b=R.useCallback(o=>p(o.sessionId,()=>{var u;return((u=o.result)==null?void 0:u.state)==="running"&&o.parentId?te("/api/delegated-tasks",{sessionId:o.parentId,taskId:o.result.taskId,action:"cancel"}):te("/api/stop-session",{sessionId:o.sessionId})},"Couldn't stop the session."),[p]);return{crew:e,error:r,busy:a,respond:w,markRead:j,stop:b}}function ee(t){switch(t.outcome){case"needs_input":return"needs-you";case"running":return"working";case"error":return"failed";case"unreachable":case"not_found":return"unreachable";default:return"done"}}function ce(t,e){var l,r;return{sessionId:t.sessionId,dirName:((l=t.address)==null?void 0:l.dirName)??"",fileName:((r=t.address)==null?void 0:r.fileName)??"",projectShortName:"",lastModified:t.lastActivityAt??"",lastActivityAt:t.lastActivityAt,size:0,cwd:t.cwd,customTitle:t.customTitle,aiTitle:t.aiTitle,firstUserMessage:t.firstUserMessage,...t.parentId&&{crew:{rootId:e,parentId:t.parentId,startedAt:t.startedAt??0,...t.name&&{name:t.name}}}}}function ze(t,e,l){var d;const r=((d=[...e.values()].find(x=>x.parentId===null))==null?void 0:d.sessionId)??t.sessionId,f=l[t.sessionId],a=ce(t,r);if(!t.parentId)return me(a,f);const c=e.get(t.parentId);return he(a,{customName:f,parent:c&&ce(c,r)})}function qe(t){const e=new Map;for(const a of t.members){if(!a.parentId)continue;const c=e.get(a.parentId);c?c.push(a):e.set(a.parentId,[a])}const l=[],r=new Set,f=(a,c)=>{var x;const d=[...e.get(a)??[]].sort((s,i)=>(s.startedAt??0)-(i.startedAt??0));for(const s of d)r.has(s.sessionId)||(r.add(s.sessionId),l.push({member:s,depth:c,children:((x=e.get(s.sessionId))==null?void 0:x.length)??0}),f(s.sessionId,c+1))};f(t.rootId,0);for(const a of t.members)a.parentId&&!r.has(a.sessionId)&&(r.add(a.sessionId),l.push({member:a,depth:0,children:0}));return l}function Me(t){const e=({member:l,pending:r})=>r.askedAt??(Date.parse(l.lastActivityAt??"")||0);return t.members.flatMap(l=>l.waiting.map(r=>({member:l,pending:r}))).sort((l,r)=>e(l)-e(r))}function Te(t){const e={size:0,working:0,needsYou:0,done:0,failed:0,unreachable:0,unreadResults:0};for(const l of t.members){if(!l.parentId)continue;e.size++;const r=ee(l);r==="working"?e.working++:r==="needs-you"?e.needsYou++:r==="failed"?e.failed++:r==="unreachable"?e.unreachable++:e.done++,le(l)&&e.unreadResults++}return e}function le(t){return!!(t.result&&t.result.state!=="running"&&!t.result.acknowledged)}function ne(t){const[e]=t.waiting;switch(ee(t)){case"needs-you":return(e==null?void 0:e.kind)==="permission"?`Waiting on a permission · ${e.toolName}`:(e==null?void 0:e.kind)==="question"?"Asked a question":"Plan to review";case"working":return t.status==="tool_use"&&t.toolName?t.toolName:t.status==="thinking"?"Thinking":t.status==="compacting"?"Compacting":t.status==="awaiting_agents"?"Waiting on its agents":"Working";case"failed":return t.error?`Failed · ${t.error}`:"Failed";case"unreachable":return t.device?`${t.device.name} is not answering`:"Not found";default:return le(t)?"Finished · result unread":"Finished"}}const Le=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Need you"},{id:"done",label:"Done"}],Pe={working:"bg-success shadow-[0_0_0_2px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40",failed:"bg-destructive",unreachable:"border border-muted-foreground/50"},q={working:"bg-success ring-2 ring-success/30","needs-you":"bg-warning",done:"bg-muted-foreground/50",failed:"bg-destructive",unreachable:"border border-muted-foreground/60"};function Ke(t){var A;const e=G.c(29),{context:l,closePanel:r}=t,f=((A=l.session)==null?void 0:A.sessionId)??null,{crew:a,error:c,busy:d,respond:x,markRead:s,stop:i}=Oe(f),{names:p}=ge();let w;e[0]!==(a==null?void 0:a.members)?(w=new Map(((a==null?void 0:a.members)??[]).map(Fe)),e[0]=a==null?void 0:a.members,e[1]=w):w=e[1];const j=w;let b;e[2]!==j||e[3]!==p?(b=v=>ze(v,j,p),e[2]=j,e[3]=p,e[4]=b):b=e[4];const g=b;let o;e[5]!==l?(o=v=>{v.address&&v.device?we(be(v.address.dirName,v.address.fileName,v.device.id)):v.address&&l.openSession?l.openSession(v.address.dirName,v.address.fileName):Ne(v.sessionId)},e[5]=l,e[6]=o):o=e[6];const u=o;let m,h,N;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ie,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),h=n.jsx("h2",{className:"text-sm font-medium",children:"Crew"}),N=n.jsx("div",{className:"flex-1"}),e[7]=m,e[8]=h,e[9]=N):(m=e[7],h=e[8],N=e[9]);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Se,{"data-icon":"inline-start"}),e[10]=y):y=e[10];let k;e[11]!==r?(k=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[m,h,N,n.jsx(Q,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":"Close crew",children:y})]}),e[11]=r,e[12]=k):k=e[12];let S;e[13]!==c?(S=c&&n.jsx("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive",children:c}),e[13]=c,e[14]=S):S=e[14];let I;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==s||e[19]!==g||e[20]!==u||e[21]!==x||e[22]!==f||e[23]!==i?(I=a?n.jsxs(je,{className:"min-h-0 flex-1",children:[n.jsx(Ye,{crew:a,hereId:f,nameOf:g,onOpen:u}),n.jsx(Be,{crew:a,busy:d,nameOf:g,onOpen:u,onRespond:x}),n.jsx(Ue,{crew:a,hereId:f,busy:d,nameOf:g,onOpen:u,onMarkRead:s,onStop:i})]}):!c&&n.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading the crew…"}),e[15]=d,e[16]=a,e[17]=c,e[18]=s,e[19]=g,e[20]=u,e[21]=x,e[22]=f,e[23]=i,e[24]=I):I=e[24];let $;return e[25]!==I||e[26]!==k||e[27]!==S?($=n.jsxs("aside",{"aria-label":"Crew",className:"flex size-full min-h-0 flex-col bg-canvas",children:[k,S,I]}),e[25]=I,e[26]=k,e[27]=S,e[28]=$):$=e[28],$}function Fe(t){return[t.sessionId,t]}function Ye(t){var h;const e=G.c(45),{crew:l,hereId:r,nameOf:f,onOpen:a}=t;let c,d,x,s,i;if(e[0]!==l||e[1]!==r||e[2]!==f||e[3]!==a){let N;e[9]!==l.rootId?(N=C=>C.sessionId===l.rootId,e[9]=l.rootId,e[10]=N):N=e[10];const y=l.members.find(N),k=l.members.filter(De);let S;e[11]!==l?(S=Te(l),e[11]=l,e[12]=S):S=e[12],i=S;const I=(h=k[0])==null?void 0:h.startedAt;c="Crew summary",d="border-b px-3 pb-3 pt-1";const $=y&&n.jsx("button",{type:"button",onClick:()=>a(y),"aria-current":y.sessionId===r?"true":void 0,className:"min-w-0 flex-1 truncate rounded-sm text-left text-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:f(y)}),A=i.size===1?"session":"sessions",v=I?` · since ${Ee(I)}`:"";let O;e[13]!==A||e[14]!==v||e[15]!==i.size?(O=n.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[i.size," ",A,v]}),e[13]=A,e[14]=v,e[15]=i.size,e[16]=O):O=e[16],e[17]!==O||e[18]!==$?(x=n.jsxs("div",{className:"flex items-baseline gap-2",children:[$,O]}),e[17]=O,e[18]=$,e[19]=x):x=e[19],s=k.length>0&&n.jsx("div",{"data-crew-strip":!0,className:"mt-2.5 flex gap-[3px]",role:"list","aria-label":"One cell per session, in the order they were started",children:k.map(C=>{const T=ee(C);return n.jsx("button",{type:"button",role:"listitem","data-crew-cell":T,title:`${f(C)}: ${ne(C)}`,"aria-label":`${f(C)}: ${ne(C)}`,onClick:()=>{var z;return(z=document.querySelector(`[data-crew-row="${C.sessionId}"]`))==null?void 0:z.scrollIntoView({block:"nearest",behavior:"smooth"})},className:M("h-2.5 min-w-[3px] flex-1 rounded-[2px] outline-none focus-visible:ring-2 focus-visible:ring-ring",Pe[T],C.sessionId===r&&"outline outline-[1.5px] outline-offset-2 outline-foreground")},C.sessionId)})}),e[0]=l,e[1]=r,e[2]=f,e[3]=a,e[4]=c,e[5]=d,e[6]=x,e[7]=s,e[8]=i}else c=e[4],d=e[5],x=e[6],s=e[7],i=e[8];let p;e[20]!==i.working?(p=i.working>0&&n.jsx(H,{dot:q.working,value:i.working,label:"working"}),e[20]=i.working,e[21]=p):p=e[21];let w;e[22]!==i.needsYou?(w=i.needsYou>0&&n.jsx(H,{dot:q["needs-you"],value:i.needsYou,label:i.needsYou===1?"needs you":"need you"}),e[22]=i.needsYou,e[23]=w):w=e[23];let j;e[24]!==i.done?(j=i.done>0&&n.jsx(H,{dot:q.done,value:i.done,label:"done"}),e[24]=i.done,e[25]=j):j=e[25];let b;e[26]!==i.failed?(b=i.failed>0&&n.jsx(H,{dot:q.failed,value:i.failed,label:"failed"}),e[26]=i.failed,e[27]=b):b=e[27];let g;e[28]!==i.unreachable?(g=i.unreachable>0&&n.jsx(H,{dot:q.unreachable,value:i.unreachable,label:"away"}),e[28]=i.unreachable,e[29]=g):g=e[29];let o;e[30]!==i.unreadResults?(o=i.unreadResults>0&&n.jsxs("span",{className:"ml-auto text-warning",children:[n.jsx("span",{className:"font-medium tabular-nums",children:i.unreadResults})," ",i.unreadResults===1?"result":"results"," unread"]}),e[30]=i.unreadResults,e[31]=o):o=e[31];let u;e[32]!==o||e[33]!==p||e[34]!==w||e[35]!==j||e[36]!==b||e[37]!==g?(u=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground",children:[p,w,j,b,g,o]}),e[32]=o,e[33]=p,e[34]=w,e[35]=j,e[36]=b,e[37]=g,e[38]=u):u=e[38];let m;return e[39]!==c||e[40]!==u||e[41]!==d||e[42]!==x||e[43]!==s?(m=n.jsxs("section",{"aria-label":c,className:d,children:[x,s,u]}),e[39]=c,e[40]=u,e[41]=d,e[42]=x,e[43]=s,e[44]=m):m=e[44],m}function De(t){return t.parentId!==null}function Ee(t){const e=new Date(t),l=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?l:`${e.toLocaleDateString([],{month:"short",day:"numeric"})}, ${l}`}function H(t){const e=G.c(10),{dot:l,value:r,label:f}=t;let a;e[0]!==l?(a=M("size-1.5 rounded-full",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=n.jsx("span",{className:a,"aria-hidden":"true"}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=n.jsx("span",{className:"font-medium tabular-nums text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let x;return e[6]!==f||e[7]!==c||e[8]!==d?(x=n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,d," ",f]}),e[6]=f,e[7]=c,e[8]=d,e[9]=x):x=e[9],x}function Be(t){const e=G.c(6),{crew:l,busy:r,nameOf:f,onOpen:a,onRespond:c}=t,d=Me(l),[x,s]=R.useState(0);if(d.length===0)return null;const i=Math.min(x,d.length-1),{member:p,pending:w}=d[i],j=d[i+1];let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Needs you"}),e[0]=b):b=e[0];let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"flex-1"}),e[1]=g):g=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:M("size-1.5 shrink-0 rounded-full",q["needs-you"]),"aria-hidden":"true"}),e[2]=o):o=e[2];const u=w.askedAt?`waiting ${ue(new Date(w.askedAt).toISOString())}`:"waiting";let m;e[3]!==u?(m=n.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-warning",children:u}),e[3]=u,e[4]=m):m=e[4];let h;return e[5]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(de,{"data-icon":"inline-end"}),e[5]=h):h=e[5],n.jsxs("section",{"aria-label":"Needs you",className:"border-b px-3 py-2.5",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs text-muted-foreground",children:[b,n.jsx("span",{className:"tabular-nums",children:d.length}),g,d.length>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"tabular-nums",children:[i+1," of ",d.length]}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:i===0,onClick:()=>s(i-1),children:n.jsx(Ce,{"data-icon":"inline-start"})}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:i===d.length-1,onClick:()=>s(i+1),children:n.jsx(de,{"data-icon":"inline-start"})})]})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-xs",children:[o,n.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:f(p)}),p.device&&n.jsx(ve,{variant:"outline",children:p.device.name}),m]}),n.jsx(ye,{sessionId:p.sessionId,pending:w,queued:0,responding:r.has(w.requestId),onRespond:(N,y)=>void c(p.sessionId,N,y),onOpen:()=>a(p)},w.requestId),n.jsxs(Q,{variant:"ghost",size:"xs",className:"self-end text-muted-foreground",onClick:()=>a(p),children:["Open session",h]})]}),j&&n.jsxs("p",{className:"mt-2 truncate text-xs text-muted-foreground",children:["Next: ",n.jsx("span",{className:"font-medium text-foreground",children:f(j.member)})," ",ne(j.member).toLowerCase()]})]})}function Ue(t){const e=G.c(17),{crew:l,hereId:r,busy:f,nameOf:a,onOpen:c,onMarkRead:d,onStop:x}=t,[s,i]=R.useState("all");let p;if(e[0]!==f||e[1]!==l||e[2]!==s||e[3]!==r||e[4]!==a||e[5]!==d||e[6]!==c||e[7]!==x){let w;e[9]!==s?(w=m=>{const{member:h}=m;if(s==="all")return!0;const N=ee(h);return s==="done"?N!=="working"&&N!=="needs-you":N===s},e[9]=s,e[10]=w):w=e[10];const j=qe(l).filter(w);let b,g;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium",children:"Sessions"}),g=n.jsx("span",{className:"flex-1"}),e[11]=b,e[12]=g):(b=e[11],g=e[12]);let o;e[13]!==s?(o=Le.map(m=>{const{id:h,label:N}=m;return n.jsx("button",{type:"button",role:"radio","aria-checked":s===h,onClick:()=>i(h),className:M("rounded-full px-2 py-0.5 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",s===h&&"bg-accent text-foreground"),children:N},h)}),e[13]=s,e[14]=o):o=e[14];let u;e[15]!==o?(u=n.jsxs("div",{className:"mb-1.5 flex items-center gap-2 px-1.5",children:[b,g,n.jsx("div",{role:"radiogroup","aria-label":"Show sessions",className:"flex gap-0.5",children:o})]}),e[15]=o,e[16]=u):u=e[16],p=n.jsxs("section",{"aria-label":"Sessions",className:"px-1.5 py-2.5",children:[u,j.length===0?n.jsx("p",{className:"px-1.5 py-4 text-center text-xs text-muted-foreground",children:"No sessions here."}):n.jsx("ul",{className:"flex flex-col",children:j.map(m=>n.jsx(We,{row:m,here:m.member.sessionId===r,busy:f,name:a(m.member),onOpen:c,onMarkRead:d,onStop:x},m.member.sessionId))})]}),e[0]=f,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d,e[6]=c,e[7]=x,e[8]=p}else p=e[8];return p}function We(t){var oe,re;const e=G.c(73),{row:l,here:r,busy:f,name:a,onOpen:c,onMarkRead:d,onStop:x}=t,{member:s,depth:i,children:p}=l;let w;e[0]!==s?(w=ee(s),e[0]=s,e[1]=w):w=e[1];const j=w;let b;e[2]!==s?(b=ne(s),e[2]=s,e[3]=b):b=e[3];const g=b;let o;e[4]!==s.pullRequests?(o=(oe=s.pullRequests)==null?void 0:oe.at(-1),e[4]=s.pullRequests,e[5]=o):o=e[5];const u=o;let m;e[6]!==s?(m=le(s)&&s.result&&s.parentId,e[6]=s,e[7]=m):m=e[7];const h=m,N=(j==="working"||j==="needs-you")&&(!s.device||((re=s.result)==null?void 0:re.state)==="running"&&s.parentId!==null),y=s.sessionId,k=r?"bg-accent":"hover:bg-accent/60",S=i>0&&"border-l border-border/70";let I;e[8]!==k||e[9]!==S?(I=M("group/crew relative rounded-md",k,S),e[8]=k,e[9]=S,e[10]=I):I=e[10];const $=i>0?6+(i-1)*14:0;let A;e[11]!==$?(A={marginLeft:$},e[11]=$,e[12]=A):A=e[12];let v;e[13]!==s||e[14]!==c?(v=()=>c(s),e[13]=s,e[14]=c,e[15]=v):v=e[15];const O=r?"true":void 0,C=`${a}, ${g}`,T=q[j];let z;e[16]!==T?(z=M("size-1.5 justify-self-center rounded-full",T),e[16]=T,e[17]=z):z=e[17];let L;e[18]!==z?(L=n.jsx("span",{className:z,"aria-hidden":"true"}),e[18]=z,e[19]=L):L=e[19];let P;e[20]!==a?(P=n.jsx("span",{className:"truncate",children:a}),e[20]=a,e[21]=P):P=e[21];let F;e[22]!==r?(F=r&&n.jsx("span",{className:"shrink-0 rounded-full border px-1.5 text-[10.5px] font-normal text-muted-foreground",children:"you are here"}),e[22]=r,e[23]=F):F=e[23];let Y;e[24]!==P||e[25]!==F?(Y=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium",children:[P,F]}),e[24]=P,e[25]=F,e[26]=Y):Y=e[26];let D;e[27]!==s.lastActivityAt?(D=s.lastActivityAt?ue(s.lastActivityAt):"",e[27]=s.lastActivityAt,e[28]=D):D=e[28];let E;e[29]!==D?(E=n.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:D}),e[29]=D,e[30]=E):E=e[30];const ae=(j==="needs-you"||h)&&"text-warning",ie=j==="failed"&&"text-destructive";let B;e[31]!==ae||e[32]!==ie?(B=M("min-w-0 flex-1 truncate",ae,ie),e[31]=ae,e[32]=ie,e[33]=B):B=e[33];let U;e[34]!==g||e[35]!==B?(U=n.jsx("span",{className:B,children:g}),e[34]=g,e[35]=B,e[36]=U):U=e[36];let W;e[37]!==u?(W=u&&n.jsxs("span",{className:"shrink-0 rounded-full border px-1.5 text-[11px]",children:["#",u.number]}),e[37]=u,e[38]=W):W=e[38];let _;e[39]!==s.device?(_=s.device&&n.jsx("span",{className:"shrink-0",children:s.device.name}),e[39]=s.device,e[40]=_):_=e[40];let V;e[41]!==p?(V=p>0&&n.jsxs("span",{className:"shrink-0",children:[p," ",p===1?"session":"sessions"]}),e[41]=p,e[42]=V):V=e[42];let J;e[43]!==s.model?(J=s.model&&n.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:ke(s.model)}),e[43]=s.model,e[44]=J):J=e[44];let X;e[45]!==U||e[46]!==W||e[47]!==_||e[48]!==V||e[49]!==J?(X=n.jsxs("span",{className:"col-start-2 col-end-4 flex min-w-0 items-center gap-2 text-[11.5px] text-muted-foreground",children:[U,W,_,V,J]}),e[45]=U,e[46]=W,e[47]=_,e[48]=V,e[49]=J,e[50]=X):X=e[50];let Z;e[51]!==v||e[52]!==O||e[53]!==C||e[54]!==L||e[55]!==Y||e[56]!==E||e[57]!==X?(Z=n.jsxs("button",{type:"button",onClick:v,"aria-current":O,"aria-label":C,className:"grid w-full grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[L,Y,E,X]}),e[51]=v,e[52]=O,e[53]=C,e[54]=L,e[55]=Y,e[56]=E,e[57]=X,e[58]=Z):Z=e[58];let K;e[59]!==f||e[60]!==N||e[61]!==s||e[62]!==a||e[63]!==d||e[64]!==x||e[65]!==h?(K=(h||N)&&n.jsxs("div",{className:"absolute right-1.5 top-1 hidden gap-1 group-focus-within/crew:flex group-hover/crew:flex",children:[h&&s.result&&s.parentId&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover","aria-label":`Mark ${a}'s result read`,title:"Mark the result read",disabled:f.has(s.result.taskId),onClick:()=>void d(s.parentId,s.result.taskId),children:n.jsx(Re,{"data-icon":"inline-start"})}),N&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover text-destructive","aria-label":`Stop ${a}`,title:"Stop this session",disabled:f.has(s.sessionId),onClick:()=>void x(s),children:n.jsx(Ae,{"data-icon":"inline-start"})})]}),e[59]=f,e[60]=N,e[61]=s,e[62]=a,e[63]=d,e[64]=x,e[65]=h,e[66]=K):K=e[66];let se;return e[67]!==s.sessionId||e[68]!==A||e[69]!==Z||e[70]!==K||e[71]!==I?(se=n.jsxs("li",{"data-crew-row":y,className:I,style:A,children:[Z,K]}),e[67]=s.sessionId,e[68]=A,e[69]=Z,e[70]=K,e[71]=I,e[72]=se):se=e[72],se}export{Ke as CrewPanel};
@@ -1,2 +1,2 @@
1
- import{c as G,r as H,j as i}from"./vendor-react-gGw_S5I_.js";import{V as M,W as P,J as X,X as z}from"./index-CW9tjG1S.js";const F=2e5;function W(l){const e=G.c(32),{value:t,onChange:v,readOnly:f,filePath:E,ariaLabel:L,textareaRef:u,onKeyDown:S,onSelect:_}=l,p=M(),[h,N]=H.useState(null),d=H.useRef(null),m=H.useRef(null);let x;e[0]!==E?(x=P(E)??"markdown",e[0]=E,e[1]=x):x=e[1];const g=x,b=t.length>F;let j,k;e[2]!==p||e[3]!==g||e[4]!==b||e[5]!==t?(j=()=>{if(b){N(null);return}let r=!1;const I=setTimeout(()=>{z(t,g,p).then(A=>{r||N(A)})},80);return()=>{r=!0,clearTimeout(I)}},k=[t,g,p,b],e[2]=p,e[3]=g,e[4]=b,e[5]=t,e[6]=j,e[7]=k):(j=e[6],k=e[7]),H.useEffect(j,k);let R;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{d.current&&m.current&&(m.current.scrollTop=d.current.scrollTop,m.current.scrollLeft=d.current.scrollLeft)},e[8]=R):R=e[8];const D=R;let T;e[9]!==u?(T=r=>{d.current=r,u&&(u.current=r)},e[9]=u,e[10]=T):T=e[10];const y=T;let n;e[11]!==h||e[12]!==t?(n=h?h.map(J):i.jsx("code",{className:"text-foreground",children:t}),e[11]=h,e[12]=t,e[13]=n):n=e[13];let s;e[14]!==n?(s=i.jsx("pre",{ref:m,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden font-mono text-[13px] leading-relaxed p-4 m-0 pointer-events-none whitespace-pre-wrap break-words",children:n}),e[14]=n,e[15]=s):s=e[15];let o;e[16]!==v?(o=r=>v(r.target.value),e[16]=v,e[17]=o):o=e[17];const C=f&&"cursor-default";let a;e[18]!==C?(a=X("absolute inset-0 w-full h-full resize-none bg-transparent font-mono text-[13px] leading-relaxed p-4 outline-none","text-transparent caret-foreground selection:bg-selection","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border",C),e[18]=C,e[19]=a):a=e[19];let c;e[20]!==L||e[21]!==y||e[22]!==S||e[23]!==_||e[24]!==f||e[25]!==a||e[26]!==o||e[27]!==t?(c=i.jsx("textarea",{ref:y,"aria-label":L,value:t,onChange:o,onScroll:D,onKeyDown:S,onSelect:_,readOnly:f,spellCheck:!1,className:a,placeholder:"Empty file"}),e[20]=L,e[21]=y,e[22]=S,e[23]=_,e[24]=f,e[25]=a,e[26]=o,e[27]=t,e[28]=c):c=e[28];let w;return e[29]!==c||e[30]!==s?(w=i.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[s,c]}),e[29]=c,e[30]=s,e[31]=w):w=e[31],w}function J(l,e){return i.jsxs("span",{children:[l.map(K),`
1
+ import{c as G,r as H,j as i}from"./vendor-react-gGw_S5I_.js";import{V as M,W as P,J as X,X as z}from"./index-CYJLZdyZ.js";const F=2e5;function W(l){const e=G.c(32),{value:t,onChange:v,readOnly:f,filePath:E,ariaLabel:L,textareaRef:u,onKeyDown:S,onSelect:_}=l,p=M(),[h,N]=H.useState(null),d=H.useRef(null),m=H.useRef(null);let x;e[0]!==E?(x=P(E)??"markdown",e[0]=E,e[1]=x):x=e[1];const g=x,b=t.length>F;let j,k;e[2]!==p||e[3]!==g||e[4]!==b||e[5]!==t?(j=()=>{if(b){N(null);return}let r=!1;const I=setTimeout(()=>{z(t,g,p).then(A=>{r||N(A)})},80);return()=>{r=!0,clearTimeout(I)}},k=[t,g,p,b],e[2]=p,e[3]=g,e[4]=b,e[5]=t,e[6]=j,e[7]=k):(j=e[6],k=e[7]),H.useEffect(j,k);let R;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{d.current&&m.current&&(m.current.scrollTop=d.current.scrollTop,m.current.scrollLeft=d.current.scrollLeft)},e[8]=R):R=e[8];const D=R;let T;e[9]!==u?(T=r=>{d.current=r,u&&(u.current=r)},e[9]=u,e[10]=T):T=e[10];const y=T;let n;e[11]!==h||e[12]!==t?(n=h?h.map(J):i.jsx("code",{className:"text-foreground",children:t}),e[11]=h,e[12]=t,e[13]=n):n=e[13];let s;e[14]!==n?(s=i.jsx("pre",{ref:m,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden font-mono text-[13px] leading-relaxed p-4 m-0 pointer-events-none whitespace-pre-wrap break-words",children:n}),e[14]=n,e[15]=s):s=e[15];let o;e[16]!==v?(o=r=>v(r.target.value),e[16]=v,e[17]=o):o=e[17];const C=f&&"cursor-default";let a;e[18]!==C?(a=X("absolute inset-0 w-full h-full resize-none bg-transparent font-mono text-[13px] leading-relaxed p-4 outline-none","text-transparent caret-foreground selection:bg-selection","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border",C),e[18]=C,e[19]=a):a=e[19];let c;e[20]!==L||e[21]!==y||e[22]!==S||e[23]!==_||e[24]!==f||e[25]!==a||e[26]!==o||e[27]!==t?(c=i.jsx("textarea",{ref:y,"aria-label":L,value:t,onChange:o,onScroll:D,onKeyDown:S,onSelect:_,readOnly:f,spellCheck:!1,className:a,placeholder:"Empty file"}),e[20]=L,e[21]=y,e[22]=S,e[23]=_,e[24]=f,e[25]=a,e[26]=o,e[27]=t,e[28]=c):c=e[28];let w;return e[29]!==c||e[30]!==s?(w=i.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[s,c]}),e[29]=c,e[30]=s,e[31]=w):w=e[31],w}function J(l,e){return i.jsxs("span",{children:[l.map(K),`
2
2
  `]},e)}function K(l,e){return i.jsx("span",{style:{color:l.color},children:l.content},e)}export{W as H};
@@ -1 +1 @@
1
- import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-CW9tjG1S.js";import{R as O,K as oe,S as ce}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function fe(e){const s=q.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(F,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=q.c(45),[s,f]=k.useState(""),[l,x]=k.useState(null),[a,r]=k.useState(null),[B,G]=k.useState($);let E,I;e[0]!==l?(E=()=>{if(!l)return;const D=l,A=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,D);if(p){r(`Already assigned to “${p.label}”.`);return}re(D,c),G($()),x(null),r(null)};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},I=[l],e[0]=l,e[1]=E,e[2]=I):(E=e[1],I=e[2]),k.useEffect(E,I);let g,j,d,y,b,N,S,w,m,u,h;if(e[3]!==B||e[4]!==a||e[5]!==s||e[6]!==l){const D=s.trim().toLowerCase(),A=D?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(D)):T;j=H,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(M,{className:"p-4 pb-3",children:[t.jsxs(U,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(J,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),G($()),r(null)},children:[t.jsx(O,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],g=ae,N="h-[min(28rem,60vh)]",y="flex flex-col gap-4 px-3 pb-4",b=Q.map(i=>{const L=A.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Y(B[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),G($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(O,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=B,e[4]=a,e[5]=s,e[6]=l,e[7]=g,e[8]=j,e[9]=d,e[10]=y,e[11]=b,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else g=e[7],j=e[8],d=e[9],y=e[10],b=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==y||e[30]!==b?(C=t.jsx("div",{className:y,children:b}),e[29]=y,e[30]=b,e[31]=C):C=e[31];let v;e[32]!==g||e[33]!==C||e[34]!==N?(v=t.jsx(g,{className:N,children:C}),e[32]=g,e[33]=C,e[34]=N,e[35]=v):v=e[35];let R;return e[36]!==j||e[37]!==d||e[38]!==v||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(j,{className:S,showCloseButton:w,children:[m,u,h,d,v]}),e[36]=j,e[37]=d,e[38]=v,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{fe as KeyboardShortcutsDialog};
1
+ import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-CYJLZdyZ.js";import{R as O,K as oe,S as ce}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function fe(e){const s=q.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(F,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=q.c(45),[s,f]=k.useState(""),[l,x]=k.useState(null),[a,r]=k.useState(null),[B,G]=k.useState($);let E,I;e[0]!==l?(E=()=>{if(!l)return;const D=l,A=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,D);if(p){r(`Already assigned to “${p.label}”.`);return}re(D,c),G($()),x(null),r(null)};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},I=[l],e[0]=l,e[1]=E,e[2]=I):(E=e[1],I=e[2]),k.useEffect(E,I);let g,j,d,y,b,N,S,w,m,u,h;if(e[3]!==B||e[4]!==a||e[5]!==s||e[6]!==l){const D=s.trim().toLowerCase(),A=D?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(D)):T;j=H,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(M,{className:"p-4 pb-3",children:[t.jsxs(U,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(J,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),G($()),r(null)},children:[t.jsx(O,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],g=ae,N="h-[min(28rem,60vh)]",y="flex flex-col gap-4 px-3 pb-4",b=Q.map(i=>{const L=A.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Y(B[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),G($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(O,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=B,e[4]=a,e[5]=s,e[6]=l,e[7]=g,e[8]=j,e[9]=d,e[10]=y,e[11]=b,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else g=e[7],j=e[8],d=e[9],y=e[10],b=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==y||e[30]!==b?(C=t.jsx("div",{className:y,children:b}),e[29]=y,e[30]=b,e[31]=C):C=e[31];let v;e[32]!==g||e[33]!==C||e[34]!==N?(v=t.jsx(g,{className:N,children:C}),e[32]=g,e[33]=C,e[34]=N,e[35]=v):v=e[35];let R;return e[36]!==j||e[37]!==d||e[38]!==v||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(j,{className:S,showCloseButton:w,children:[m,u,h,d,v]}),e[36]=j,e[37]=d,e[38]=v,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{fe as KeyboardShortcutsDialog};
@@ -0,0 +1 @@
1
+ import{c as B,r as V,j as t}from"./vendor-react-gGw_S5I_.js";import{B as M,b5 as me,b6 as ee,A as se,b7 as fe,b8 as J,H as xe,T as pe,b9 as ge,ba as he,bb as be,bc as je,bd as we,be as ae,bf as Ne,bg as Ie,aU as qe,bh as ke,bi as ye,bj as ve,bk as Se,aX as _e,bl as Ae,q as Ce,$ as G,L as oe,M as re,Q as ce,J as De,Z as de}from"./index-CYJLZdyZ.js";import{b as $e,a2 as Me,a3 as Pe,a4 as Oe,a5 as Re,C as ue,Y as Ee,l as Te,P as Le}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ze(m){const e={};for(const s of m)s.type==="boolean"?e[s.name]=s.defaultValue===!0:s.defaultValue!==void 0?e[s.name]=String(s.defaultValue):e[s.name]="";return e}function Be(m,e){const s={};for(const n of m){const a=e[n.name];if(typeof a=="boolean"){s[n.name]=a;continue}a!==""&&(s[n.name]=n.type==="number"||n.type==="integer"?Number(a):a)}return s}function Qe(m,e){return m.every(s=>{if(!s.required)return!0;const n=e[s.name];return typeof n=="boolean"?!0:n===""?!1:s.type==="number"||s.type==="integer"?Number.isFinite(Number(n)):!0})}function Fe(m){const e=B.c(52),{request:s,responding:n,onAnswer:a}=m;let r;e[0]!==s.fields?(r=()=>ze(s.fields),e[0]=s.fields,e[1]=r):r=e[1];const[i,o]=V.useState(r);let d;e[2]!==s.fields||e[3]!==i?(d=Qe(s.fields,i),e[2]=s.fields,e[3]=i,e[4]=d):d=e[4];const u=d,p=s.displayName||s.title||s.serverName;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(N,j)=>{o(k=>({...k,[N]:j}))},e[5]=f):f=e[5];const c=f;let l;e[6]!==a||e[7]!==s.requestId?(l=()=>a==null?void 0:a(s.requestId,{action:"decline"}),e[6]=a,e[7]=s.requestId,e[8]=l):l=e[8];const x=l;if(s.mode==="url"&&s.url){const N=s.url;let j;e[9]!==s.message?(j=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[9]=s.message,e[10]=j):j=e[10];let k;e[11]!==N?(k=t.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:N,children:N}),e[11]=N,e[12]=k):k=e[12];let y;e[13]!==x||e[14]!==a||e[15]!==s.requestId||e[16]!==n||e[17]!==N?(y=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>{window.open(N,"_blank","noopener,noreferrer"),a(s.requestId,{action:"accept"})},children:["Open link",t.jsx($e,{"data-icon":"inline-end"})]}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[13]=x,e[14]=a,e[15]=s.requestId,e[16]=n,e[17]=N,e[18]=y):y=e[18];let v;return e[19]!==p||e[20]!==j||e[21]!==k||e[22]!==y?(v=t.jsxs(te,{server:p,children:[j,k,y]}),e[19]=p,e[20]=j,e[21]=k,e[22]=y,e[23]=v):v=e[23],v}let g;e[24]!==s.message?(g=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[24]=s.message,e[25]=g):g=e[25];let h;if(e[26]!==a||e[27]!==s.fields||e[28]!==s.requestId||e[29]!==n||e[30]!==i){let N;e[32]!==a||e[33]!==s.requestId||e[34]!==n||e[35]!==i?(N=j=>t.jsx(Ue,{id:`elicit-${s.requestId}-${j.name}`,field:j,value:i[j.name],disabled:n||!a,onChange:k=>c(j.name,k)},j.name),e[32]=a,e[33]=s.requestId,e[34]=n,e[35]=i,e[36]=N):N=e[36],h=s.fields.map(N),e[26]=a,e[27]=s.fields,e[28]=s.requestId,e[29]=n,e[30]=i,e[31]=h}else h=e[31];let w;e[37]!==h?(w=t.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[37]=h,e[38]=w):w=e[38];let I;e[39]!==u||e[40]!==x||e[41]!==a||e[42]!==s.fields||e[43]!==s.requestId||e[44]!==n||e[45]!==i?(I=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(M,{size:"sm",disabled:n||!u,onClick:()=>a(s.requestId,{action:"accept",content:Be(s.fields,i)}),children:"Send"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[39]=u,e[40]=x,e[41]=a,e[42]=s.fields,e[43]=s.requestId,e[44]=n,e[45]=i,e[46]=I):I=e[46];let q;return e[47]!==p||e[48]!==g||e[49]!==w||e[50]!==I?(q=t.jsxs(te,{server:p,children:[g,w,I]}),e[47]=p,e[48]=g,e[49]=w,e[50]=I,e[51]=q):q=e[51],q}function Ue(m){const e=B.c(55),{id:s,field:n,value:a,disabled:r,onChange:i}=m;if(n.type==="boolean"){const x=a===!0;let g;e[0]!==i?(g=q=>i(q===!0),e[0]=i,e[1]=g):g=e[1];let h;e[2]!==r||e[3]!==s||e[4]!==x||e[5]!==g?(h=t.jsx(fe,{id:s,checked:x,disabled:r,onCheckedChange:g}),e[2]=r,e[3]=s,e[4]=x,e[5]=g,e[6]=h):h=e[6];let w;e[7]!==n?(w=t.jsx(Z,{field:n}),e[7]=n,e[8]=w):w=e[8];let I;return e[9]!==s||e[10]!==h||e[11]!==w?(I=t.jsxs(J,{htmlFor:s,className:"items-start gap-2 font-normal",children:[h,w]}),e[9]=s,e[10]=h,e[11]=w,e[12]=I):I=e[12],I}if(n.type==="enum"){let x;e[13]!==n?(x=t.jsx(Z,{field:n}),e[13]=n,e[14]=x):x=e[14];let g;e[15]!==s||e[16]!==x?(g=t.jsx(J,{htmlFor:s,children:x}),e[15]=s,e[16]=x,e[17]=g):g=e[17];let h;e[18]!==a?(h=typeof a=="string"&&a?[a]:[],e[18]=a,e[19]=h):h=e[19];let w;e[20]!==i?(w=y=>{y[0]&&i(y[0])},e[20]=i,e[21]=w):w=e[21];const I=n.label;let q;e[22]!==n.options?(q=n.options??[],e[22]=n.options,e[23]=q):q=e[23];let N;if(e[24]!==r||e[25]!==q){let y;e[27]!==r?(y=v=>t.jsx(xe,{value:v.value,disabled:r,className:"w-full justify-start px-3",children:v.label},v.value),e[27]=r,e[28]=y):y=e[28],N=q.map(y),e[24]=r,e[25]=q,e[26]=N}else N=e[26];let j;e[29]!==n.label||e[30]!==s||e[31]!==h||e[32]!==w||e[33]!==N?(j=t.jsx(pe,{id:s,value:h,onValueChange:w,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":I,children:N}),e[29]=n.label,e[30]=s,e[31]=h,e[32]=w,e[33]=N,e[34]=j):j=e[34];let k;return e[35]!==g||e[36]!==j?(k=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,j]}),e[35]=g,e[36]=j,e[37]=k):k=e[37],k}let o;e[38]!==n?(o=t.jsx(Z,{field:n}),e[38]=n,e[39]=o):o=e[39];let d;e[40]!==s||e[41]!==o?(d=t.jsx(J,{htmlFor:s,children:o}),e[40]=s,e[41]=o,e[42]=d):d=e[42];const u=n.type==="string"?"text":"number",p=typeof a=="string"?a:"";let f;e[43]!==i?(f=x=>i(x.target.value),e[43]=i,e[44]=f):f=e[44];let c;e[45]!==r||e[46]!==n.label||e[47]!==s||e[48]!==u||e[49]!==p||e[50]!==f?(c=t.jsx(me,{id:s,"aria-label":n.label,type:u,value:p,disabled:r,onChange:f}),e[45]=r,e[46]=n.label,e[47]=s,e[48]=u,e[49]=p,e[50]=f,e[51]=c):c=e[51];let l;return e[52]!==d||e[53]!==c?(l=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,c]}),e[52]=d,e[53]=c,e[54]=l):l=e[54],l}function Z(m){const e=B.c(8),{field:s}=m;let n;e[0]!==s.required?(n=s.required&&t.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=s.required,e[1]=n):n=e[1];let a;e[2]!==s.description?(a=s.description&&t.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:s.description}),e[2]=s.description,e[3]=a):a=e[3];let r;return e[4]!==s.label||e[5]!==n||e[6]!==a?(r=t.jsxs("span",{className:"min-w-0",children:[s.label,n,a]}),e[4]=s.label,e[5]=n,e[6]=a,e[7]=r):r=e[7],r}function te(m){const e=B.c(8),{server:s,children:n}=m;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"text-info"}),e[0]=a):a=e[0];let r;e[1]!==s?(r=t.jsxs(ee,{children:[s," needs input"]}),e[1]=s,e[2]=r):r=e[2];let i;e[3]!==n?(i=t.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=i):i=e[4];let o;return e[5]!==r||e[6]!==i?(o=t.jsxs(se,{className:"border-info/40 bg-info/5",children:[a,r,i]}),e[5]=r,e[6]=i,e[7]=o):o=e[7],o}function Ye(m){const e=B.c(15),{request:s,responding:n,onChoose:a}=m;let r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Pe,{className:"text-warning"}),i=t.jsx(ee,{children:"The agent declined this request"}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let o;e[2]!==s.originalModel?(o=t.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[s.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=s.originalModel,e[3]=o):o=e[3];let d;e[4]!==s.guidanceText?(d=s.guidanceText&&t.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:s.guidanceText}),e[4]=s.guidanceText,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.fallbackModel||e[8]!==s.requestId||e[9]!==n?(u=a&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>a(s.requestId,"retry_fallback"),children:["Retry on ",s.fallbackModel]}),t.jsx(M,{variant:"outline",size:"sm",disabled:n,onClick:()=>a(s.requestId,"edit_prompt"),children:"Edit prompt"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:()=>a(s.requestId,"cancelled"),children:"Dismiss"})]}),e[6]=a,e[7]=s.fallbackModel,e[8]=s.requestId,e[9]=n,e[10]=u):u=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u?(p=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[r,i,t.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[o,d,u]})]}),e[11]=o,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function He(m){const e=B.c(64),{request:s,input:n,canAnswer:a,onOpen:r}=m;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];const[o,d]=V.useState(i),{sessionId:u}=s;switch(s.kind){case"permission":{const p=s.request;let f;e[1]!==n.responding||e[2]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[1]=n.responding,e[2]=s.request.requestId,e[3]=f):f=e[3];let c;e[4]!==a||e[5]!==n||e[6]!==u?(c=a?(x,g)=>void n.respond(u,x,g):void 0,e[4]=a,e[5]=n,e[6]=u,e[7]=c):c=e[7];let l;return e[8]!==s.request||e[9]!==f||e[10]!==c?(l=t.jsx(he,{request:p,queued:0,responding:f,onRespond:c}),e[8]=s.request,e[9]=f,e[10]=c,e[11]=l):l=e[11],l}case"question":{const p=s.request;let f;e[12]!==n.responding||e[13]!==s.request.toolUseId?(f=n.responding.has(s.request.toolUseId),e[12]=n.responding,e[13]=s.request.toolUseId,e[14]=f):f=e[14];let c;e[15]!==o||e[16]!==s.request.toolUseId?(c=o.has(s.request.toolUseId),e[15]=o,e[16]=s.request.toolUseId,e[17]=c):c=e[17];let l;e[18]!==a||e[19]!==n||e[20]!==u?(l=a?async(g,h)=>{(await n.answerQuestion(u,g,h)).gone&&d(I=>new Set(I).add(g))}:void 0,e[18]=a,e[19]=n,e[20]=u,e[21]=l):l=e[21];let x;return e[22]!==r||e[23]!==s.request||e[24]!==f||e[25]!==c||e[26]!==l?(x=t.jsx(ge,{request:p,responding:f,gone:c,onAnswer:l,onOpenSession:r}),e[22]=r,e[23]=s.request,e[24]=f,e[25]=c,e[26]=l,e[27]=x):x=e[27],x}case"elicitation":{const p=s.request;let f;e[28]!==n.responding||e[29]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[28]=n.responding,e[29]=s.request.requestId,e[30]=f):f=e[30];let c;e[31]!==a||e[32]!==n||e[33]!==u?(c=a?(x,g)=>void n.answerElicitation(u,x,g):void 0,e[31]=a,e[32]=n,e[33]=u,e[34]=c):c=e[34];let l;return e[35]!==s.request||e[36]!==f||e[37]!==c?(l=t.jsx(Fe,{request:p,responding:f,onAnswer:c}),e[35]=s.request,e[36]=f,e[37]=c,e[38]=l):l=e[38],l}case"dialog":{const p=s.request;let f;e[39]!==n.responding||e[40]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[39]=n.responding,e[40]=s.request.requestId,e[41]=f):f=e[41];let c;e[42]!==a||e[43]!==n||e[44]!==u?(c=a?(x,g)=>void n.answerDialog(u,x,g):void 0,e[42]=a,e[43]=n,e[44]=u,e[45]=c):c=e[45];let l;return e[46]!==s.request||e[47]!==f||e[48]!==c?(l=t.jsx(Ye,{request:p,responding:f,onChoose:c}),e[46]=s.request,e[47]=f,e[48]=c,e[49]=l):l=e[49],l}case"plan":case"deferred":{let p;e[50]!==s.kind?(p=s.kind==="plan"?t.jsx(Oe,{className:"text-warning"}):t.jsx(Re,{className:"text-warning"}),e[50]=s.kind,e[51]=p):p=e[51];const f=s.kind==="plan"?"A plan is waiting for review":"A permission was deferred";let c;e[52]!==f?(c=t.jsx(ee,{children:f}),e[52]=f,e[53]=c):c=e[53];const l=s.kind==="plan"?"Review it in its session.":"Open the session and resume it to answer.";let x;e[54]!==l?(x=t.jsx("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:l}),e[54]=l,e[55]=x):x=e[55];let g;e[56]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ue,{"data-icon":"inline-end"}),e[56]=g):g=e[56];let h;e[57]!==r?(h=t.jsx("div",{className:"col-start-2 mt-2",children:t.jsxs(M,{size:"xs",onClick:r,children:["Open session",g]})}),e[57]=r,e[58]=h):h=e[58];let w;return e[59]!==p||e[60]!==c||e[61]!==x||e[62]!==h?(w=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[p,c,x,h]}),e[59]=p,e[60]=c,e[61]=x,e[62]=h,e[63]=w):w=e[63],w}}}function Ke(m,e,s=()=>!0){const n=new Map(e.map(i=>[i.sessionId,i])),a=i=>{const o=n.get(i);return o?ae(o):Date.now()},r=[];for(const[i,o]of m.permissionsBySession)for(const d of o)r.push({kind:"permission",sessionId:i,since:d.timestamp,request:d});for(const[i,o]of m.questionsBySession)for(const d of o)r.push({kind:"question",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.elicitationsBySession)for(const d of o)r.push({kind:"elicitation",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.dialogsBySession)for(const d of o)r.push({kind:"dialog",sessionId:i,since:d.askedAt,request:d});for(const i of m.awaitingPlan)r.push({kind:"plan",sessionId:i,since:a(i)});for(const i of e)i.agentStatus==="deferred"&&!i.archived&&r.push({kind:"deferred",sessionId:i.sessionId,since:a(i.sessionId)});return r.filter(i=>s(i.sessionId)).sort((i,o)=>i.since-o.since)}function ne(m){switch(m.kind){case"permission":return m.request.requestId;case"question":return m.request.toolUseId;case"elicitation":case"dialog":return m.request.requestId;default:return`${m.kind}:${m.sessionId}`}}const Ve=864e5,ie=3,Ge=8;function Xe(m,e,s=Date.now()){const n=m.filter(d=>!d.archived&&!(d.teamName&&d.agentName)),{topLevel:a,crewOf:r}=be(n),i=a.map(d=>{const u=r.get(d.sessionId)??[],p=u.length?je(d,u):d.lastActivityAt||d.lastModified,f=[d,...u].flatMap(c=>(c.pullRequests??[]).map(l=>({pullRequest:l,by:c}))).sort((c,l)=>Date.parse(l.pullRequest.timestamp)-Date.parse(c.pullRequest.timestamp))[0];return{session:d,members:u,cells:u.map(c=>e(c).state),counts:u.length?we(u,e):null,activityAt:p,...f&&{landed:{number:f.pullRequest.number,title:f.pullRequest.title,url:f.pullRequest.url,by:f.by}}}}).sort((d,u)=>Date.parse(u.activityAt)-Date.parse(d.activityAt)),o=i.filter(d=>s-Date.parse(d.activityAt)<Ve);return(o.length>=ie?o:i.slice(0,ie)).slice(0,Ge)}function Je(m){const e=new Date(m);return e.setHours(0,0,0,0),e.getTime()}const Ze=10;function We(m,e,s=Date.now()){const n=Je(s),a=[],r=new Map;for(const i of m){if(i.archived)continue;for(const d of i.pullRequests??[]){const u=Date.parse(d.timestamp);u>=n&&a.push({kind:"pr",at:u,session:i,number:d.number,title:d.title,url:d.url})}if(!i.crew)continue;const o=ae(i);if(o>=n&&e(i).state==="done"&&a.push({kind:"finished",at:o,session:i}),i.crew.startedAt>=n){const d=`${i.crew.parentId}:${Math.floor(i.crew.startedAt/6e4)}`,u=r.get(d);u?u.push(i):r.set(d,[i])}}for(const i of r.values())a.push({kind:"started",at:Math.min(...i.map(o=>o.crew.startedAt)),parentId:i[0].crew.parentId,sessions:i});return a.sort((i,o)=>o.at-i.at).slice(0,Ze)}const es={working:"bg-success shadow-[0_0_0_1.5px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40"};function fs(m){const e=B.c(69),{onOpenSession:s,onNewSession:n,onBrowseProjects:a,newSessionControl:r}=m,i=Ne(),o=Ie(),{names:d}=qe(),{names:u}=ke(),p=ye();let f;e[0]!==i.sessions?(f=i.sessions.filter(ns),e[0]=i.sessions,e[1]=f):f=e[1];const c=f;let l;e[2]!==c?(l=new Map(c.map(ts)),e[2]=c,e[3]=l):l=e[3];const x=l;let g;e[4]!==o.awaitingDialog||e[5]!==o.awaitingElicitation?(g=new Set([...o.awaitingElicitation,...o.awaitingDialog]),e[4]=o.awaitingDialog,e[5]=o.awaitingElicitation,e[6]=g):g=e[6];let h;e[7]!==o.awaitingPermission||e[8]!==o.awaitingPlan||e[9]!==o.awaitingQuestion||e[10]!==g?(h={awaitingPermission:o.awaitingPermission,awaitingQuestion:o.awaitingQuestion,awaitingPrompt:g,awaitingPlan:o.awaitingPlan},e[7]=o.awaitingPermission,e[8]=o.awaitingPlan,e[9]=o.awaitingQuestion,e[10]=g,e[11]=h):h=e[11];const w=h;let I;e[12]!==i.procBySession||e[13]!==w?(I=z=>ve(z,i.procBySession,w),e[12]=i.procBySession,e[13]=w,e[14]=I):I=e[14];const q=I;let N;e[15]!==x||e[16]!==p?(N=z=>{const H=x.get(z);return p(H==null?void 0:H.access).canInteract},e[15]=x,e[16]=p,e[17]=N):N=e[17];const j=N;let k;e[18]!==j||e[19]!==o||e[20]!==c?(k=Ke(o,c,j),e[18]=j,e[19]=o,e[20]=c,e[21]=k):k=e[21];const y=k;let v;e[22]!==c||e[23]!==q?(v=Xe(c,q),e[22]=c,e[23]=q,e[24]=v):v=e[24];const Q=v;let P;e[25]!==c||e[26]!==q?(P=We(c,q),e[25]=c,e[26]=q,e[27]=P):P=e[27];const F=P;let Y;e[28]!==x||e[29]!==d?(Y=z=>Se(z,x,d),e[28]=x,e[29]=d,e[30]=Y):Y=e[30];const _=Y;let O;e[31]!==x||e[32]!==s?(O=z=>{const H=x.get(z);H?s(H.dirName,H.fileName):_e(z)},e[31]=x,e[32]=s,e[33]=O):O=e[33];const A=O;let R;e[34]!==i.processes?(R=i.processes.filter(ss),e[34]=i.processes,e[35]=R):R=e[35];const D=R.length;let E;e[36]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Mission Control"}),e[36]=E):E=e[36];let C;e[37]!==x||e[38]!==j||e[39]!==o||e[40]!==_||e[41]!==A||e[42]!==y?(C=t.jsx(is,{queue:y,input:o,byId:x,nameOf:_,onOpen:A,canAnswer:j}),e[37]=x,e[38]=j,e[39]=o,e[40]=_,e[41]=A,e[42]=y,e[43]=C):C=e[43];let T;e[44]!==u?(T=z=>u[z.dirName]??Ae(z),e[44]=u,e[45]=T):T=e[45];let L;e[46]!==_||e[47]!==a||e[48]!==n||e[49]!==A||e[50]!==T||e[51]!==Q?(L=t.jsx(ls,{sessions:Q,nameOf:_,projectLabel:T,onOpen:A,onNewSession:n,onBrowseProjects:a}),e[46]=_,e[47]=a,e[48]=n,e[49]=A,e[50]=T,e[51]=Q,e[52]=L):L=e[52];let b;e[53]!==F||e[54]!==_||e[55]!==A?(b=t.jsx(as,{events:F,nameOf:_,onOpen:A}),e[53]=F,e[54]=_,e[55]=A,e[56]=b):b=e[56];let S;e[57]!==L||e[58]!==b?(S=t.jsxs("div",{className:"flex min-w-0 flex-col gap-8",children:[L,b]}),e[57]=L,e[58]=b,e[59]=S):S=e[59];let U;e[60]!==C||e[61]!==S?(U=t.jsxs("div",{className:"grid gap-8 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]",children:[C,S]}),e[60]=C,e[61]=S,e[62]=U):U=e[62];let $;e[63]!==D?($=D>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[D," ",D===1?"agent":"agents"," running on this machine."]}),e[63]=D,e[64]=$):$=e[64];let K;return e[65]!==r||e[66]!==U||e[67]!==$?(K=t.jsx(Ce,{className:"h-full",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-8 px-6 pb-10 pt-16 lg:px-10",children:[E,U,$,r]})}),e[65]=r,e[66]=U,e[67]=$,e[68]=K):K=e[68],K}function ss(m){return m.sessionId}function ts(m){return[m.sessionId,m]}function ns(m){return!m.archived}function X(m){const e=B.c(9),{title:s,count:n,children:a}=m;let r;e[0]!==s?(r=t.jsx("h2",{className:"text-sm font-medium",children:s}),e[0]=s,e[1]=r):r=e[1];let i;e[2]!==n?(i=n!==void 0&&t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n}),e[2]=n,e[3]=i):i=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"flex-1"}),e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==r||e[7]!==i?(d=t.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[r,i,o,a]}),e[5]=a,e[6]=r,e[7]=i,e[8]=d):d=e[8],d}function W(m,e){const s=m==null?void 0:m.crew;return s?e(s.rootId)??s.rootTitle??null:null}const le={permission:"asked a permission",question:"asked a question",elicitation:"asked for input",dialog:"needs a choice",plan:"has a plan to review",deferred:"has a deferred permission"};function is(m){const e=B.c(73),{queue:s,input:n,byId:a,nameOf:r,onOpen:i,canAnswer:o}=m,[d,u]=V.useState(0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];const f=V.useRef(p);if(s.length===0){let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(X,{title:"Needs you",count:0}),e[1]=b):b=e[1];let S;return e[2]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs("section",{"aria-label":"Needs you",className:"min-w-0",children:[b,t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Nothing is waiting on you."})})})]}),e[2]=S):S=e[2],S}const c=Math.min(d,s.length-1),l=s[c];let x;if(e[3]!==a||e[4]!==r||e[5]!==l.sessionId){const b=a.get(l.sessionId);x=W(b,r),e[3]=a,e[4]=r,e[5]=l.sessionId,e[6]=x}else x=e[6];const g=x;let h;e[7]!==c||e[8]!==o||e[9]!==n||e[10]!==i||e[11]!==s.length||e[12]!==l.kind||e[13]!==l.request||e[14]!==l.sessionId?(h=b=>{const S=b.target;if(!(S.closest("input,textarea,select,[contenteditable=true]")||b.metaKey||b.ctrlKey||b.altKey)&&((b.key==="j"||b.key==="n"||b.key==="ArrowDown")&&(b.preventDefault(),u(Math.min(s.length-1,c+1))),(b.key==="k"||b.key==="ArrowUp")&&(b.preventDefault(),u(Math.max(0,c-1))),b.key==="o"&&(b.preventDefault(),i(l.sessionId)),(b.key==="Enter"||b.key==="d")&&S===b.currentTarget&&o(l.sessionId))){if(l.kind!=="permission")return;const U=b.key==="d"||l.request.defaultToNo?"deny":"allow",$=l.request.requestId;if(l.request.availableDecisions&&!l.request.availableDecisions.includes(U)||(b.preventDefault(),f.current.has($)||n.responding.has($)))return;f.current.add($),n.respond(l.sessionId,$,U).finally(()=>f.current.delete($))}},e[7]=c,e[8]=o,e[9]=n,e[10]=i,e[11]=s.length,e[12]=l.kind,e[13]=l.request,e[14]=l.sessionId,e[15]=h):h=e[15];const w=h;let I;e[16]!==c||e[17]!==s.length?(I=s.length>1&&t.jsxs("span",{className:"flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[c+1," of ",s.length,t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:c===0,onClick:()=>u(c-1),children:t.jsx(Ee,{"data-icon":"inline-start"})}),t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:c===s.length-1,onClick:()=>u(c+1),children:t.jsx(ue,{"data-icon":"inline-start"})})]}),e[16]=c,e[17]=s.length,e[18]=I):I=e[18];let q;e[19]!==s.length||e[20]!==I?(q=t.jsx(X,{title:"Needs you",count:s.length,children:I}),e[19]=s.length,e[20]=I,e[21]=q):q=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-warning","aria-hidden":"true"}),e[22]=N):N=e[22];let j;e[23]!==i||e[24]!==l.sessionId?(j=()=>i(l.sessionId),e[23]=i,e[24]=l.sessionId,e[25]=j):j=e[25];let k;e[26]!==r||e[27]!==l.sessionId?(k=r(l.sessionId)??"A session",e[26]=r,e[27]=l.sessionId,e[28]=k):k=e[28];let y;e[29]!==j||e[30]!==k?(y=t.jsx("button",{type:"button",onClick:j,className:"min-w-0 truncate rounded-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:k}),e[29]=j,e[30]=k,e[31]=y):y=e[31];let v;e[32]!==g?(v=g&&t.jsxs("span",{className:"min-w-0 truncate text-muted-foreground",children:["· ",g]}),e[32]=g,e[33]=v):v=e[33];let Q;e[34]!==l.since?(Q=G(new Date(l.since).toISOString()),e[34]=l.since,e[35]=Q):Q=e[35];let P;e[36]!==Q?(P=t.jsxs("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-warning",children:["waiting ",Q]}),e[36]=Q,e[37]=P):P=e[37];let F;e[38]!==v||e[39]!==P||e[40]!==y?(F=t.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-[13px]",children:[N,y,v,P]}),e[38]=v,e[39]=P,e[40]=y,e[41]=F):F=e[41];const Y=le[l.kind];let _;e[42]!==Y?(_=t.jsx("p",{className:"px-0.5 text-xs text-muted-foreground",children:Y}),e[42]=Y,e[43]=_):_=e[43];let O;e[44]!==l?(O=ne(l),e[44]=l,e[45]=O):O=e[45];let A;e[46]!==o||e[47]!==l.sessionId?(A=o(l.sessionId),e[46]=o,e[47]=l.sessionId,e[48]=A):A=e[48];let R;e[49]!==i||e[50]!==l.sessionId?(R=()=>i(l.sessionId),e[49]=i,e[50]=l.sessionId,e[51]=R):R=e[51];let D;e[52]!==n||e[53]!==l||e[54]!==O||e[55]!==A||e[56]!==R?(D=t.jsx(He,{request:l,input:n,canAnswer:A,onOpen:R},O),e[52]=n,e[53]=l,e[54]=O,e[55]=A,e[56]=R,e[57]=D):D=e[57];let E;e[58]!==F||e[59]!==_||e[60]!==D?(E=t.jsxs("div",{className:"flex flex-col gap-2",children:[F,_,D]}),e[58]=F,e[59]=_,e[60]=D,e[61]=E):E=e[61];let C;e[62]!==c||e[63]!==a||e[64]!==r||e[65]!==s?(C=s.length>1&&t.jsx("ol",{className:"mt-3 flex flex-col","aria-label":"Also waiting",children:s.map((b,S)=>S===c?null:t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>u(S),className:"grid w-full grid-cols-[18px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg px-2 py-2 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-right text-[11px] tabular-nums text-muted-foreground/80",children:S+1}),t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"truncate font-medium",children:[r(b.sessionId)??"A session",W(a.get(b.sessionId),r)&&t.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",W(a.get(b.sessionId),r)]})]}),t.jsx("span",{className:"truncate text-[11.5px] text-muted-foreground",children:le[b.kind]})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-warning",children:G(new Date(b.since).toISOString())})]})},ne(b)))}),e[62]=c,e[63]=a,e[64]=r,e[65]=s,e[66]=C):C=e[66];let T;e[67]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("p",{className:"mt-2 px-0.5 text-[11px] text-muted-foreground/80",children:"J / K move · Enter answers · D denies · O opens"}),e[67]=T):T=e[67];let L;return e[68]!==w||e[69]!==E||e[70]!==C||e[71]!==q?(L=t.jsxs("section",{"aria-label":"Needs you",tabIndex:0,onKeyDown:w,className:"min-w-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[q,E,C,T]}),e[68]=w,e[69]=E,e[70]=C,e[71]=q,e[72]=L):L=e[72],L}function ls(m){const e=B.c(16),{sessions:s,nameOf:n,projectLabel:a,onOpen:r,onNewSession:i,onBrowseProjects:o}=m;let d;e[0]!==o?(d=o&&t.jsxs(M,{variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:o,children:[t.jsx(Te,{"data-icon":"inline-start"}),"All projects"]}),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==i?(u=i&&t.jsxs(M,{variant:"outline",size:"xs",onClick:i,children:[t.jsx(Le,{"data-icon":"inline-start"}),"New session"]}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==s.length||e[5]!==d||e[6]!==u?(p=t.jsxs(X,{title:"Your sessions",count:s.length,children:[d,u]}),e[4]=s.length,e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==r||e[10]!==a||e[11]!==s?(f=s.length===0?t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Start a session and it shows up here, with every session it starts."})})}):t.jsx("ul",{className:"flex flex-col",children:s.map(l=>t.jsxs("li",{className:"border-t border-border/70 first:border-t-0",children:[l.members.length>0&&t.jsx("div",{role:"group","aria-label":`${n(l.session.sessionId)} crew`,className:"flex flex-wrap gap-1 px-3 pt-3",children:l.members.map((x,g)=>t.jsx("button",{type:"button","aria-label":`Open ${n(x.sessionId)??"crew member"}`,title:`${n(x.sessionId)}: ${l.cells[g]}`,onClick:()=>r(x.sessionId),className:"flex size-5 items-center justify-center rounded-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:t.jsx("span",{className:De("size-2 rounded-[2px]",es[l.cells[g]])})},x.sessionId))}),t.jsxs("button",{type:"button",onClick:()=>r(l.session.sessionId),className:"grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg px-3 py-3 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring xl:grid-cols-[minmax(0,1fr)_auto]",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[t.jsx("span",{className:"truncate text-[13.5px] font-medium",children:n(l.session.sessionId)??"Untitled session"}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a(l.session)})]}),t.jsx("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:l.counts?t.jsxs(t.Fragment,{children:[l.counts.working>0&&t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.working})," working"]}),l.counts.needsYou>0&&t.jsxs("span",{className:"text-warning",children:[t.jsx("span",{className:"font-medium tabular-nums",children:l.counts.needsYou})," need you"]}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.size})," in crew"]})]}):l.session.isActive&&t.jsx("span",{children:"working"})}),t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[l.landed&&t.jsxs(de,{variant:"outline",className:"shrink-0",children:["#",l.landed.number]}),t.jsx("span",{className:"truncate",children:l.landed?`${l.landed.title??"Pull request"} · ${n(l.landed.by.sessionId)??""}`:l.session.lastUserMessage??""})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:l.counts?`crew active ${G(l.activityAt)}`:G(l.activityAt)})]})]},l.session.sessionId))}),e[8]=n,e[9]=r,e[10]=a,e[11]=s,e[12]=f):f=e[12];let c;return e[13]!==p||e[14]!==f?(c=t.jsxs("section",{"aria-label":"Your sessions",className:"min-w-0",children:[p,f]}),e[13]=p,e[14]=f,e[15]=c):c=e[15],c}function as(m){const e=B.c(10),{events:s,nameOf:n,onOpen:a}=m;if(s.length===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(X,{title:"Landed today"}),e[0]=r):r=e[0];let i;if(e[1]!==s||e[2]!==n||e[3]!==a){let d;e[5]!==n||e[6]!==a?(d=u=>{const p=u.kind==="started"?u.parentId:u.session.sessionId,f=new Date(u.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(p),className:"grid w-full grid-cols-[48px_minmax(0,1fr)] items-baseline gap-2.5 rounded-md px-3 py-1.5 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:f}),t.jsx("span",{className:"min-w-0 truncate",children:os(u,n)})]})},`${u.kind}:${p}:${u.at}`)},e[5]=n,e[6]=a,e[7]=d):d=e[7],i=s.map(d),e[1]=s,e[2]=n,e[3]=a,e[4]=i}else i=e[4];let o;return e[8]!==i?(o=t.jsxs("section",{"aria-label":"Landed today",className:"min-w-0",children:[r,t.jsx("ol",{className:"flex flex-col",children:i})]}),e[8]=i,e[9]=o):o=e[9],o}function os(m,e){switch(m.kind){case"pr":return t.jsxs(t.Fragment,{children:[t.jsxs(de,{variant:"outline",className:"mr-2 text-success",children:["#",m.number]}),t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsxs("span",{className:"text-muted-foreground",children:[" · ",m.title??"opened a pull request"]})]});case"finished":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsx("span",{className:"text-muted-foreground",children:" finished"})]});case"started":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:m.sessions.length===1?e(m.sessions[0].sessionId)??"A session":`${m.sessions.length} sessions`}),t.jsxs("span",{className:"text-muted-foreground",children:[" started · ",e(m.parentId)??"by another session"]})]})}}export{fs as MissionHome};
@@ -1 +1 @@
1
- import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-CW9tjG1S.js";import"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const E=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{E as MobileFileChanges};
1
+ import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-CYJLZdyZ.js";import"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const E=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{E as MobileFileChanges};