groove-dev 0.25.7 → 0.25.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@groove-dev/gui/dist/assets/{index-DlWsuLvF.js → index-DVW2lYyr.js} +1 -1
- package/node_modules/@groove-dev/gui/dist/index.html +1 -1
- package/node_modules/@groove-dev/gui/src/components/dashboard/fleet-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/dashboard/intel-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/dashboard/routing-chart.jsx +2 -2
- package/package.json +1 -1
- package/packages/gui/dist/assets/{index-DlWsuLvF.js → index-DVW2lYyr.js} +1 -1
- package/packages/gui/dist/index.html +1 -1
- package/packages/gui/src/components/dashboard/fleet-panel.jsx +1 -1
- package/packages/gui/src/components/dashboard/intel-panel.jsx +1 -1
- package/packages/gui/src/components/dashboard/routing-chart.jsx +2 -2
|
@@ -570,7 +570,7 @@ Error generating stack: `+c.message+`
|
|
|
570
570
|
`);l=o<0?s:s.slice(0,o)}return n+l.length>this.to?l.slice(0,this.to-n):l}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(n,s,l=0){this.block=jc.create(n,l,this.lineStart+s,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(n,s,l=0){this.startContext(this.parser.getNodeType(n),s,l)}addNode(n,s,l){typeof n=="number"&&(n=new ha(this.parser.nodeSet.types[n],El,El,(l??this.prevLineEnd())-s)),this.block.addChild(n,s-this.block.from)}addElement(n){this.block.addChild(n.toTree(this.parser.nodeSet),n.from-this.block.from)}addLeafElement(n,s){this.addNode(this.buffer.writeElements(Sf(s.children,n.marks),-s.from).finish(s.type,s.to-s.from),s.from)}finishContext(){let n=this.stack.pop(),s=this.stack[this.stack.length-1];s.addChild(n.toTree(this.parser.nodeSet),n.from-s.from),this.block=s}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(n){return this.ranges.length>1?ly(this.ranges,0,n.topNode,this.ranges[0].from,this.reusePlaceholders):n}finishLeaf(n){for(let l of n.parsers)if(l.finish(this,n))return;let s=Sf(this.parser.parseInline(n.content,n.start),n.marks);this.addNode(this.buffer.writeElements(s,-n.start).finish(se.Paragraph,n.content.length),n.start)}elt(n,s,l,o){return typeof n=="string"?ze(this.parser.getNodeType(n),s,l,o):new oy(n,s)}get buffer(){return new iy(this.parser.nodeSet)}}function ly(t,n,s,l,o){let u=t[n].to,d=[],O=[],m=s.from+l;function p(x,g){for(;g?x>=u:x>u;){let b=t[n+1].from-u;l+=b,x+=b,n++,u=t[n].to}}for(let x=s.firstChild;x;x=x.nextSibling){p(x.from+l,!0);let g=x.from+l,b,y=o.get(x.tree);y?b=y:x.to+l>u?(b=ly(t,n,x,l,o),p(x.to+l,!1)):b=x.toTree(),d.push(b),O.push(g-m)}return p(s.to+l,!1),new ha(s.type,d,O,s.to+l-m,s.tree?s.tree.propValues:void 0)}class Lc extends Q0{constructor(n,s,l,o,u,d,O,m,p){super(),this.nodeSet=n,this.blockParsers=s,this.leafBlockParsers=l,this.blockNames=o,this.endLeafBlock=u,this.skipContextMarkup=d,this.inlineParsers=O,this.inlineNames=m,this.wrappers=p,this.nodeTypes=Object.create(null);for(let x of n.types)this.nodeTypes[x.name]=x.id}createParse(n,s,l){let o=new mz(this,n,s,l);for(let u of this.wrappers)o=u(o,n,s,l);return o}configure(n){let s=yf(n);if(!s)return this;let{nodeSet:l,skipContextMarkup:o}=this,u=this.blockParsers.slice(),d=this.leafBlockParsers.slice(),O=this.blockNames.slice(),m=this.inlineParsers.slice(),p=this.inlineNames.slice(),x=this.endLeafBlock.slice(),g=this.wrappers;if(Vr(s.defineNodes)){o=Object.assign({},o);let b=l.types.slice(),y;for(let Q of s.defineNodes){let{name:w,block:T,composite:k,style:P}=typeof Q=="string"?{name:Q}:Q;if(b.some(G=>G.name==w))continue;k&&(o[b.length]=(G,X,C)=>k(X,C,G.value));let $=b.length,_=k?["Block","BlockContext"]:T?$>=se.ATXHeading1&&$<=se.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;b.push(li.define({id:$,name:w,props:_&&[[nn.group,_]]})),P&&(y||(y={}),Array.isArray(P)||P instanceof Nj?y[w]=P:Object.assign(y,P))}l=new Nf(b),y&&(l=l.extend(Ns(y)))}if(Vr(s.props)&&(l=l.extend(...s.props)),Vr(s.remove))for(let b of s.remove){let y=this.blockNames.indexOf(b),Q=this.inlineNames.indexOf(b);y>-1&&(u[y]=d[y]=void 0),Q>-1&&(m[Q]=void 0)}if(Vr(s.parseBlock))for(let b of s.parseBlock){let y=O.indexOf(b.name);if(y>-1)u[y]=b.parse,d[y]=b.leaf;else{let Q=b.before?Vo(O,b.before):b.after?Vo(O,b.after)+1:O.length-1;u.splice(Q,0,b.parse),d.splice(Q,0,b.leaf),O.splice(Q,0,b.name)}b.endLeaf&&x.push(b.endLeaf)}if(Vr(s.parseInline))for(let b of s.parseInline){let y=p.indexOf(b.name);if(y>-1)m[y]=b.parse;else{let Q=b.before?Vo(p,b.before):b.after?Vo(p,b.after)+1:p.length-1;m.splice(Q,0,b.parse),p.splice(Q,0,b.name)}}return s.wrap&&(g=g.concat(s.wrap)),new Lc(l,u,d,O,x,o,m,p,g)}getNodeType(n){let s=this.nodeTypes[n];if(s==null)throw new RangeError(`Unknown node type '${n}'`);return s}parseInline(n,s){let l=new mh(this,n,s);e:for(let o=s;o<l.end;){let u=l.char(o);for(let d of this.inlineParsers)if(d){let O=d(l,u,o);if(O>=0){o=O;continue e}}o++}return l.resolveMarkers(0)}}function Vr(t){return t!=null&&t.length>0}function yf(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let n=yf(t[0]);if(t.length==1)return n;let s=yf(t.slice(1));if(!s||!n)return n||s;let l=(d,O)=>(d||El).concat(O||El),o=n.wrap,u=s.wrap;return{props:l(n.props,s.props),defineNodes:l(n.defineNodes,s.defineNodes),parseBlock:l(n.parseBlock,s.parseBlock),parseInline:l(n.parseInline,s.parseInline),remove:l(n.remove,s.remove),wrap:o?u?(d,O,m,p)=>o(u(d,O,m,p),O,m,p):o:u}}function Vo(t,n){let s=t.indexOf(n);if(s<0)throw new RangeError(`Position specified relative to unknown parser ${n}`);return s}let ry=[li.none];for(let t=1,n;n=se[t];t++)ry[t]=li.define({id:t,name:n,props:t>=se.Escape?[]:[[nn.group,t in Hv?["Block","BlockContext"]:["Block","LeafBlock"]]],top:n=="Document"});const El=[];class iy{constructor(n){this.nodeSet=n,this.content=[],this.nodes=[]}write(n,s,l,o=0){return this.content.push(n,s,l,4+o*4),this}writeElements(n,s=0){for(let l of n)l.writeTo(this,s);return this}finish(n,s){return ha.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:n,length:s})}}let ai=class{constructor(n,s,l,o=El){this.type=n,this.from=s,this.to=l,this.children=o}writeTo(n,s){let l=n.content.length;n.writeElements(this.children,s),n.content.push(this.type,this.from+s,this.to+s,n.content.length+4-l)}toTree(n){return new iy(n).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class oy{constructor(n,s){this.tree=n,this.from=s}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return El}writeTo(n,s){n.nodes.push(this.tree),n.content.push(n.nodes.length-1,this.from+s,this.to+s,-1)}toTree(){return this.tree}}function ze(t,n,s,l){return new ai(t,n,s,l)}const cy={resolve:"Emphasis",mark:"EmphasisMark"},uy={resolve:"Emphasis",mark:"EmphasisMark"},ys={},wc={};class Gt{constructor(n,s,l,o){this.type=n,this.from=s,this.to=l,this.side=o}}const Z1="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let ni=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{ni=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const XO={Escape(t,n,s){if(n!=92||s==t.end-1)return-1;let l=t.char(s+1);for(let o=0;o<Z1.length;o++)if(Z1.charCodeAt(o)==l)return t.append(ze(se.Escape,s,s+2));return-1},Entity(t,n,s){if(n!=38)return-1;let l=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(s+1,s+31));return l?t.append(ze(se.Entity,s,s+1+l[0].length)):-1},InlineCode(t,n,s){if(n!=96||s&&t.char(s-1)==96)return-1;let l=s+1;for(;l<t.end&&t.char(l)==96;)l++;let o=l-s,u=0;for(;l<t.end;l++)if(t.char(l)==96){if(u++,u==o&&t.char(l+1)!=96)return t.append(ze(se.InlineCode,s,l+1,[ze(se.CodeMark,s,s+o),ze(se.CodeMark,l+1-o,l+1)]))}else u=0;return-1},HTMLTag(t,n,s){if(n!=60||s==t.end-1)return-1;let l=t.slice(s+1,t.end),o=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(l);if(o)return t.append(ze(se.Autolink,s,s+1+o[0].length,[ze(se.LinkMark,s,s+1),ze(se.URL,s+1,s+o[0].length),ze(se.LinkMark,s+o[0].length,s+1+o[0].length)]));let u=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(l);if(u)return t.append(ze(se.Comment,s,s+1+u[0].length));let d=/^\?[^]*?\?>/.exec(l);if(d)return t.append(ze(se.ProcessingInstruction,s,s+1+d[0].length));let O=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(l);return O?t.append(ze(se.HTMLTag,s,s+1+O[0].length)):-1},Emphasis(t,n,s){if(n!=95&&n!=42)return-1;let l=s+1;for(;t.char(l)==n;)l++;let o=t.slice(s-1,s),u=t.slice(l,l+1),d=ni.test(o),O=ni.test(u),m=/\s|^$/.test(o),p=/\s|^$/.test(u),x=!p&&(!O||m||d),g=!m&&(!d||p||O),b=x&&(n==42||!g||d),y=g&&(n==42||!x||O);return t.append(new Gt(n==95?cy:uy,s,l,(b?1:0)|(y?2:0)))},HardBreak(t,n,s){if(n==92&&t.char(s+1)==10)return t.append(ze(se.HardBreak,s,s+2));if(n==32){let l=s+1;for(;t.char(l)==32;)l++;if(t.char(l)==10&&l>=s+2)return t.append(ze(se.HardBreak,s,l+1))}return-1},Link(t,n,s){return n==91?t.append(new Gt(ys,s,s+1,1)):-1},Image(t,n,s){return n==33&&t.char(s+1)==91?t.append(new Gt(wc,s,s+2,1)):-1},LinkEnd(t,n,s){if(n!=93)return-1;for(let l=t.parts.length-1;l>=0;l--){let o=t.parts[l];if(o instanceof Gt&&(o.type==ys||o.type==wc)){if(!o.side||t.skipSpace(o.to)==s&&!/[(\[]/.test(t.slice(s+1,s+2)))return t.parts[l]=null,-1;let u=t.takeContent(l),d=t.parts[l]=pz(t,u,o.type==ys?se.Link:se.Image,o.from,s+1);if(o.type==ys)for(let O=0;O<l;O++){let m=t.parts[O];m instanceof Gt&&m.type==ys&&(m.side=0)}return d.to}}return-1}};function pz(t,n,s,l,o){let{text:u}=t,d=t.char(o),O=o;if(n.unshift(ze(se.LinkMark,l,l+(s==se.Image?2:1))),n.push(ze(se.LinkMark,o-1,o)),d==40){let m=t.skipSpace(o+1),p=dy(u,m-t.offset,t.offset),x;p&&(m=t.skipSpace(p.to),m!=p.to&&(x=Oy(u,m-t.offset,t.offset),x&&(m=t.skipSpace(x.to)))),t.char(m)==41&&(n.push(ze(se.LinkMark,o,o+1)),O=m+1,p&&n.push(p),x&&n.push(x),n.push(ze(se.LinkMark,m,O)))}else if(d==91){let m=fy(u,o-t.offset,t.offset,!1);m&&(n.push(m),O=m.to)}return ze(s,l,O,n)}function dy(t,n,s){if(t.charCodeAt(n)==60){for(let o=n+1;o<t.length;o++){let u=t.charCodeAt(o);if(u==62)return ze(se.URL,n+s,o+1+s);if(u==60||u==10)return!1}return null}else{let o=0,u=n;for(let d=!1;u<t.length;u++){let O=t.charCodeAt(u);if(ca(O))break;if(d)d=!1;else if(O==40)o++;else if(O==41){if(!o)break;o--}else O==92&&(d=!0)}return u>n?ze(se.URL,n+s,u+s):u==t.length?null:!1}}function Oy(t,n,s){let l=t.charCodeAt(n);if(l!=39&&l!=34&&l!=40)return!1;let o=l==40?41:l;for(let u=n+1,d=!1;u<t.length;u++){let O=t.charCodeAt(u);if(d)d=!1;else{if(O==o)return ze(se.LinkTitle,n+s,u+1+s);O==92&&(d=!0)}}return null}function fy(t,n,s,l){for(let o=!1,u=n+1,d=Math.min(t.length,u+999);u<d;u++){let O=t.charCodeAt(u);if(o)o=!1;else{if(O==93)return l?!1:ze(se.LinkLabel,n+s,u+1+s);if(l&&!ca(O)&&(l=!1),O==91)return!1;O==92&&(o=!0)}}return null}class mh{constructor(n,s,l){this.parser=n,this.text=s,this.offset=l,this.parts=[]}char(n){return n>=this.end?-1:this.text.charCodeAt(n-this.offset)}get end(){return this.offset+this.text.length}slice(n,s){return this.text.slice(n-this.offset,s-this.offset)}append(n){return this.parts.push(n),n.to}addDelimiter(n,s,l,o,u){return this.append(new Gt(n,s,l,(o?1:0)|(u?2:0)))}get hasOpenLink(){for(let n=this.parts.length-1;n>=0;n--){let s=this.parts[n];if(s instanceof Gt&&(s.type==ys||s.type==wc))return!0}return!1}addElement(n){return this.append(n)}resolveMarkers(n){for(let l=n;l<this.parts.length;l++){let o=this.parts[l];if(!(o instanceof Gt&&o.type.resolve&&o.side&2))continue;let u=o.type==cy||o.type==uy,d=o.to-o.from,O,m=l-1;for(;m>=n;m--){let w=this.parts[m];if(w instanceof Gt&&w.side&1&&w.type==o.type&&!(u&&(o.side&1||w.side&2)&&(w.to-w.from+d)%3==0&&((w.to-w.from)%3||d%3))){O=w;break}}if(!O)continue;let p=o.type.resolve,x=[],g=O.from,b=o.to;if(u){let w=Math.min(2,O.to-O.from,d);g=O.to-w,b=o.from+w,p=w==1?"Emphasis":"StrongEmphasis"}O.type.mark&&x.push(this.elt(O.type.mark,g,O.to));for(let w=m+1;w<l;w++)this.parts[w]instanceof ai&&x.push(this.parts[w]),this.parts[w]=null;o.type.mark&&x.push(this.elt(o.type.mark,o.from,b));let y=this.elt(p,g,b,x);this.parts[m]=u&&O.from!=g?new Gt(O.type,O.from,g,O.side):null,(this.parts[l]=u&&o.to!=b?new Gt(o.type,b,o.to,o.side):null)?this.parts.splice(l,0,y):this.parts[l]=y}let s=[];for(let l=n;l<this.parts.length;l++){let o=this.parts[l];o instanceof ai&&s.push(o)}return s}findOpeningDelimiter(n){for(let s=this.parts.length-1;s>=0;s--){let l=this.parts[s];if(l instanceof Gt&&l.type==n&&l.side&1)return s}return null}takeContent(n){let s=this.resolveMarkers(n);return this.parts.length=n,s}getDelimiterAt(n){let s=this.parts[n];return s instanceof Gt?s:null}skipSpace(n){return Gr(this.text,n-this.offset)+this.offset}elt(n,s,l,o){return typeof n=="string"?ze(this.parser.getNodeType(n),s,l,o):new oy(n,s)}}mh.linkStart=ys;mh.imageStart=wc;function Sf(t,n){if(!n.length)return t;if(!t.length)return n;let s=t.slice(),l=0;for(let o of n){for(;l<s.length&&s[l].to<o.to;)l++;if(l<s.length&&s[l].from<o.from){let u=s[l];u instanceof ai&&(s[l]=new ai(u.type,u.from,u.to,Sf(u.children,[o])))}else s.splice(l++,0,o)}return s}const xz=[se.CodeBlock,se.ListItem,se.OrderedList,se.BulletList];class gz{constructor(n,s){this.fragments=n,this.input=s,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,n.length&&(this.fragment=n[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(n,s){for(;this.fragment&&this.fragment.to<=n;)this.nextFragment();if(!this.fragment||this.fragment.from>(n?n-1:0))return!1;if(this.fragmentEnd<0){let u=this.fragment.to;for(;u>0&&this.input.read(u-1,u)!=`
|
|
571
571
|
`;)u--;this.fragmentEnd=u?u-1:0}let l=this.cursor;l||(l=this.cursor=this.fragment.tree.cursor(),l.firstChild());let o=n+this.fragment.offset;for(;l.to<=o;)if(!l.parent())return!1;for(;;){if(l.from>=o)return this.fragment.from<=s;if(!l.childAfter(o))return!1}}matches(n){let s=this.cursor.tree;return s&&s.prop(nn.contextHash)==n}takeNodes(n){let s=this.cursor,l=this.fragment.offset,o=this.fragmentEnd-(this.fragment.openEnd?1:0),u=n.absoluteLineStart,d=u,O=n.block.children.length,m=d,p=O;for(;;){if(s.to-l>o){if(s.type.isAnonymous&&s.firstChild())continue;break}let x=hy(s.from-l,n.ranges);if(s.to-l<=n.ranges[n.rangeI].to)n.addNode(s.tree,x);else{let g=new ha(n.parser.nodeSet.types[se.Paragraph],[],[],0,n.block.hashProp);n.reusePlaceholders.set(g,s.tree),n.addNode(g,x)}if(s.type.is("Block")&&(xz.indexOf(s.type.id)<0?(d=s.to-l,O=n.block.children.length):(d=m,O=p),m=s.to-l,p=n.block.children.length),!s.nextSibling())break}for(;n.block.children.length>O;)n.block.children.pop(),n.block.positions.pop();return d-u}}function hy(t,n){let s=t;for(let l=1;l<n.length;l++){let o=n[l-1].to,u=n[l].from;o<t&&(s-=u-o)}return s}const bz=Ns({"Blockquote/...":A.quote,HorizontalRule:A.contentSeparator,"ATXHeading1/... SetextHeading1/...":A.heading1,"ATXHeading2/... SetextHeading2/...":A.heading2,"ATXHeading3/...":A.heading3,"ATXHeading4/...":A.heading4,"ATXHeading5/...":A.heading5,"ATXHeading6/...":A.heading6,"Comment CommentBlock":A.comment,Escape:A.escape,Entity:A.character,"Emphasis/...":A.emphasis,"StrongEmphasis/...":A.strong,"Link/... Image/...":A.link,"OrderedList/... BulletList/...":A.list,"BlockQuote/...":A.quote,"InlineCode CodeText":A.monospace,"URL Autolink":A.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":A.processingInstruction,"CodeInfo LinkLabel":A.labelName,LinkTitle:A.string,Paragraph:A.content}),vz=new Lc(new Nf(ry).extend(bz),Object.keys(Yo).map(t=>Yo[t]),Object.keys(Yo).map(t=>sy[t]),Object.keys(Yo),fz,Hv,Object.keys(XO).map(t=>XO[t]),Object.keys(XO),[]);function yz(t,n,s){let l=[];for(let o=t.firstChild,u=n;;o=o.nextSibling){let d=o?o.from:s;if(d>u&&l.push({from:u,to:d}),!o)break;u=o.to}return l}function Sz(t){let{codeParser:n,htmlParser:s}=t;return{wrap:T0((o,u)=>{let d=o.type.id;if(n&&(d==se.CodeBlock||d==se.FencedCode)){let O="";if(d==se.FencedCode){let p=o.node.getChild(se.CodeInfo);p&&(O=u.read(p.from,p.to))}let m=n(O);if(m)return{parser:m,overlay:p=>p.type.id==se.CodeText,bracketed:d==se.FencedCode}}else if(s&&(d==se.HTMLBlock||d==se.HTMLTag||d==se.CommentBlock))return{parser:s,overlay:yz(o.node,o.from,o.to)};return null})}}const Qz={resolve:"Strikethrough",mark:"StrikethroughMark"},jz={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":A.strikethrough}},{name:"StrikethroughMark",style:A.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,n,s){if(n!=126||t.char(s+1)!=126||t.char(s+2)==126)return-1;let l=t.slice(s-1,s),o=t.slice(s+2,s+3),u=/\s|^$/.test(l),d=/\s|^$/.test(o),O=ni.test(l),m=ni.test(o);return t.addDelimiter(Qz,s,s+2,!d&&(!m||u||O),!u&&(!O||d||m))},after:"Emphasis"}]};function Dr(t,n,s=0,l,o=0){let u=0,d=!0,O=-1,m=-1,p=!1,x=()=>{l.push(t.elt("TableCell",o+O,o+m,t.parser.parseInline(n.slice(O,m),o+O)))};for(let g=s;g<n.length;g++){let b=n.charCodeAt(g);b==124&&!p?((!d||O>-1)&&u++,d=!1,l&&(O>-1&&x(),l.push(t.elt("TableDelimiter",g+o,g+o+1))),O=m=-1):(p||b!=32&&b!=9)&&(O<0&&(O=g),m=g+1),p=!p&&b==92}return O>-1&&(u++,l&&x()),u}function A1(t,n){for(let s=n;s<t.length;s++){let l=t.charCodeAt(s);if(l==124)return!0;l==92&&s++}return!1}const my=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class E1{constructor(){this.rows=null}nextLine(n,s,l){if(this.rows==null){this.rows=!1;let o;if((s.next==45||s.next==58||s.next==124)&&my.test(o=s.text.slice(s.pos))){let u=[];Dr(n,l.content,0,u,l.start)==Dr(n,o,s.pos)&&(this.rows=[n.elt("TableHeader",l.start,l.start+l.content.length,u),n.elt("TableDelimiter",n.lineStart+s.pos,n.lineStart+s.text.length)])}}else if(this.rows){let o=[];Dr(n,s.text,s.pos,o,n.lineStart),this.rows.push(n.elt("TableRow",n.lineStart+s.pos,n.lineStart+s.text.length,o))}return!1}finish(n,s){return this.rows?(n.addLeafElement(s,n.elt("Table",s.start,s.start+s.content.length,this.rows)),!0):!1}}const wz={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":A.heading}},"TableRow",{name:"TableCell",style:A.content},{name:"TableDelimiter",style:A.processingInstruction}],parseBlock:[{name:"Table",leaf(t,n){return A1(n.content,0)?new E1:null},endLeaf(t,n,s){if(s.parsers.some(o=>o instanceof E1)||!A1(n.text,n.basePos))return!1;let l=t.peekLine();return my.test(l)&&Dr(t,n.text,n.basePos)==Dr(t,l,n.basePos)},before:"SetextHeading"}]};class kz{nextLine(){return!1}finish(n,s){return n.addLeafElement(s,n.elt("Task",s.start,s.start+s.content.length,[n.elt("TaskMarker",s.start,s.start+3),...n.parser.parseInline(s.content.slice(3),s.start+3)])),!0}}const $z={defineNodes:[{name:"Task",block:!0,style:A.list},{name:"TaskMarker",style:A.atom}],parseBlock:[{name:"TaskList",leaf(t,n){return/^\[[ xX]\][ \t]/.test(n.content)&&t.parentType().name=="ListItem"?new kz:null},after:"SetextHeading"}]},q1=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,M1=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,Tz=/[\w-]+\.[\w-]+($|\/)/,Y1=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,V1=/\/[a-zA-Z\d@.]+/gy;function U1(t,n,s,l){let o=0;for(let u=n;u<s;u++)t[u]==l&&o++;return o}function Nz(t,n){M1.lastIndex=n;let s=M1.exec(t);if(!s||Tz.exec(s[0])[0].indexOf("_")>-1)return-1;let l=n+s[0].length;for(;;){let o=t[l-1],u;if(/[?!.,:*_~]/.test(o)||o==")"&&U1(t,n,l,")")>U1(t,n,l,"("))l--;else if(o==";"&&(u=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(n,l))))l=n+u.index;else break}return l}function L1(t,n){Y1.lastIndex=n;let s=Y1.exec(t);if(!s)return-1;let l=s[0][s[0].length-1];return l=="_"||l=="-"?-1:n+s[0].length-(l=="."?1:0)}const Pz={parseInline:[{name:"Autolink",parse(t,n,s){let l=s-t.offset;if(l&&/\w/.test(t.text[l-1]))return-1;q1.lastIndex=l;let o=q1.exec(t.text),u=-1;if(!o)return-1;if(o[1]||o[2]){if(u=Nz(t.text,l+o[0].length),u>-1&&t.hasOpenLink){let d=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(l,u));u=l+d[0].length}}else o[3]?u=L1(t.text,l):(u=L1(t.text,l+o[0].length),u>-1&&o[0]=="xmpp:"&&(V1.lastIndex=u,o=V1.exec(t.text),o&&(u=o.index+o[0].length)));return u<0?-1:(t.addElement(t.elt("URL",s,u+t.offset)),u+t.offset)}}]},zz=[wz,$z,jz,Pz];function py(t,n,s){return(l,o,u)=>{if(o!=t||l.char(u+1)==t)return-1;let d=[l.elt(s,u,u+1)];for(let O=u+1;O<l.end;O++){let m=l.char(O);if(m==t)return l.addElement(l.elt(n,u,O+1,d.concat(l.elt(s,O,O+1))));if(m==92&&d.push(l.elt("Escape",O,O+++2)),ca(m))break}return-1}}const Rz={defineNodes:[{name:"Superscript",style:A.special(A.content)},{name:"SuperscriptMark",style:A.processingInstruction}],parseInline:[{name:"Superscript",parse:py(94,"Superscript","SuperscriptMark")}]},Cz={defineNodes:[{name:"Subscript",style:A.special(A.content)},{name:"SubscriptMark",style:A.processingInstruction}],parseInline:[{name:"Subscript",parse:py(126,"Subscript","SubscriptMark")}]},Xz={defineNodes:[{name:"Emoji",style:A.character}],parseInline:[{name:"Emoji",parse(t,n,s){let l;return n!=58||!(l=/^[a-zA-Z_0-9]+:/.exec(t.slice(s+1,t.end)))?-1:t.addElement(t.elt("Emoji",s,s+1+l[0].length))}}]},xy=$0({commentTokens:{block:{open:"<!--",close:"-->"}}}),gy=new nn,by=vz.configure({props:[Ps.add(t=>!t.is("Block")||t.is("Document")||Qf(t)!=null||_z(t)?void 0:(n,s)=>({from:s.doc.lineAt(n.from).to,to:n.to})),gy.add(Qf),ql.add({Document:()=>null}),_j.add({Document:xy})]});function Qf(t){let n=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return n?+n[1]:void 0}function _z(t){return t.name=="OrderedList"||t.name=="BulletList"}function Zz(t,n){let s=t;for(;;){let l=s.nextSibling,o;if(!l||(o=Qf(l.type))!=null&&o<=n)break;s=l}return s.to}const Az=zj.of((t,n,s)=>{for(let l=xa(t).resolveInner(s,-1);l&&!(l.from<n);l=l.parent){let o=l.type.prop(gy);if(o==null)continue;let u=Zz(l,o);if(u>s)return{from:s,to:u}}return null});function ph(t){return new Rj(xy,t,[],"markdown")}const Ez=ph(by),qz=by.configure([zz,Cz,Rz,Xz,{props:[Ps.add({Table:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})})]}]),kc=ph(qz);function Mz(t,n){return s=>{if(s&&t){let l=null;if(s=/\S*/.exec(s)[0],typeof t=="function"?l=t(s):l=jg.matchLanguageName(t,s,!0),l instanceof jg)return l.support?l.support.language.parser:Zj.getSkippingParser(l.load());if(l)return l.parser}return n?n.parser:null}}let _O=class{constructor(n,s,l,o,u,d,O){this.node=n,this.from=s,this.to=l,this.spaceBefore=o,this.spaceAfter=u,this.type=d,this.item=O}blank(n,s=!0){let l=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(n!=null){for(;l.length<n;)l+=" ";return l}else{for(let o=this.to-this.from-l.length-this.spaceAfter.length;o>0;o--)l+=" ";return l+(s?this.spaceAfter:"")}}marker(n,s){let l=this.node.name=="OrderedList"?String(+yy(this.item,n)[2]+s):"";return this.spaceBefore+l+this.type+this.spaceAfter}};function vy(t,n){let s=[],l=[];for(let o=t;o;o=o.parent){if(o.name=="FencedCode")return l;(o.name=="ListItem"||o.name=="Blockquote")&&s.push(o)}for(let o=s.length-1;o>=0;o--){let u=s[o],d,O=n.lineAt(u.from),m=u.from-O.from;if(u.name=="Blockquote"&&(d=/^ *>( ?)/.exec(O.text.slice(m))))l.push(new _O(u,m,m+d[0].length,"",d[1],">",null));else if(u.name=="ListItem"&&u.parent.name=="OrderedList"&&(d=/^( *)\d+([.)])( *)/.exec(O.text.slice(m)))){let p=d[3],x=d[0].length;p.length>=4&&(p=p.slice(0,p.length-4),x-=4),l.push(new _O(u.parent,m,m+x,d[1],p,d[2],u))}else if(u.name=="ListItem"&&u.parent.name=="BulletList"&&(d=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(O.text.slice(m)))){let p=d[4],x=d[0].length;p.length>4&&(p=p.slice(0,p.length-4),x-=4);let g=d[2];d[3]&&(g+=d[3].replace(/[xX]/," ")),l.push(new _O(u.parent,m,m+x,d[1],p,g,u))}}return l}function yy(t,n){return/^(\s*)(\d+)(?=[.)])/.exec(n.sliceString(t.from,t.from+10))}function ZO(t,n,s,l=0){for(let o=-1,u=t;;){if(u.name=="ListItem"){let O=yy(u,n),m=+O[2];if(o>=0){if(m!=o+1)return;s.push({from:u.from+O[1].length,to:u.from+O[0].length,insert:String(o+2+l)})}o=m}let d=u.nextSibling;if(!d)break;u=d}}function xh(t,n){let s=/^[ \t]*/.exec(t)[0].length;if(!s||n.facet(Cj)!=" ")return t;let l=Wr(t,4,s),o="";for(let u=l;u>0;)u>=4?(o+=" ",u-=4):(o+=" ",u--);return o+t.slice(s)}const Yz=(t={})=>({state:n,dispatch:s})=>{let l=xa(n),{doc:o}=n,u=null,d=n.changeByRange(O=>{if(!O.empty||!kc.isActiveAt(n,O.from,-1)&&!kc.isActiveAt(n,O.from,1))return u={range:O};let m=O.from,p=o.lineAt(m),x=vy(l.resolveInner(m,-1),o);for(;x.length&&x[x.length-1].from>m-p.from;)x.pop();if(!x.length)return u={range:O};let g=x[x.length-1];if(g.to-g.spaceAfter.length>m-p.from)return u={range:O};let b=m>=g.to-g.spaceAfter.length&&!/\S/.test(p.text.slice(g.to));if(g.item&&b){let k=g.node.firstChild,P=g.node.getChild("ListItem","ListItem");if(k.to>=m||P&&P.to<m||p.from>0&&!/[^\s>]/.test(o.lineAt(p.from-1).text)||t.nonTightLists===!1){let $=x.length>1?x[x.length-2]:null,_,G="";$&&$.item?(_=p.from+$.from,G=$.marker(o,1)):_=p.from+($?$.to:0);let X=[{from:_,to:m,insert:G}];return g.node.name=="OrderedList"&&ZO(g.item,o,X,-2),$&&$.node.name=="OrderedList"&&ZO($.item,o,X),{range:Dn.cursor(_+G.length),changes:X}}else{let $=D1(x,n,p);return{range:Dn.cursor(m+$.length+1),changes:{from:p.from,insert:$+n.lineBreak}}}}if(g.node.name=="Blockquote"&&b&&p.from){let k=o.lineAt(p.from-1),P=/>\s*$/.exec(k.text);if(P&&P.index==g.from){let $=n.changes([{from:k.from+P.index,to:k.to},{from:p.from+g.from,to:p.to}]);return{range:O.map($),changes:$}}}let y=[];g.node.name=="OrderedList"&&ZO(g.item,o,y);let Q=g.item&&g.item.from<p.from,w="";if(!Q||/^[\s\d.)\-+*>]*/.exec(p.text)[0].length>=g.to)for(let k=0,P=x.length-1;k<=P;k++)w+=k==P&&!Q?x[k].marker(o,1):x[k].blank(k<P?Wr(p.text,4,x[k+1].from)-w.length:null);let T=m;for(;T>p.from&&/\s/.test(p.text.charAt(T-p.from-1));)T--;return w=xh(w,n),Uz(g.node,n.doc)&&(w=D1(x,n,p)+n.lineBreak+w),y.push({from:T,to:m,insert:n.lineBreak+w}),{range:Dn.cursor(T+w.length+1),changes:y}});return u?!1:(s(n.update(d,{scrollIntoView:!0,userEvent:"input"})),!0)},Vz=Yz();function G1(t){return t.name=="QuoteMark"||t.name=="ListMark"}function Uz(t,n){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let s=t.firstChild,l=t.getChild("ListItem","ListItem");if(!l)return!1;let o=n.lineAt(s.to),u=n.lineAt(l.from),d=/^[\s>]*$/.test(o.text);return o.number+(d?0:1)<u.number}function D1(t,n,s){let l="";for(let o=0,u=t.length-2;o<=u;o++)l+=t[o].blank(o<u?Wr(s.text,4,t[o+1].from)-l.length:null,o<u);return xh(l,n)}function Lz(t,n){let s=t.resolveInner(n,-1),l=n;G1(s)&&(l=s.from,s=s.parent);for(let o;o=s.childBefore(l);)if(G1(o))l=o.from;else if(o.name=="OrderedList"||o.name=="BulletList")s=o.lastChild,l=s.to;else break;return s}const Gz=({state:t,dispatch:n})=>{let s=xa(t),l=null,o=t.changeByRange(u=>{let d=u.from,{doc:O}=t;if(u.empty&&kc.isActiveAt(t,u.from)){let m=O.lineAt(d),p=vy(Lz(s,d),O);if(p.length){let x=p[p.length-1],g=x.to-x.spaceAfter.length+(x.spaceAfter?1:0);if(d-m.from>g&&!/\S/.test(m.text.slice(g,d-m.from)))return{range:Dn.cursor(m.from+g),changes:{from:m.from+g,to:d}};if(d-m.from==g&&(!x.item||m.from<=x.item.from||!/\S/.test(m.text.slice(0,x.to)))){let b=m.from+x.from;if(x.item&&x.node.from<x.item.from&&/\S/.test(m.text.slice(x.from,x.to))){let y=x.blank(Wr(m.text,4,x.to)-Wr(m.text,4,x.from));return b==m.from&&(y=xh(y,t)),{range:Dn.cursor(b+y.length),changes:{from:b,to:m.from+x.to,insert:y}}}if(b<d)return{range:Dn.cursor(b),changes:{from:b,to:d}}}}}return l={range:u}});return l?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:"delete"})),!0)},Dz=[{key:"Enter",run:Vz},{key:"Backspace",run:Gz}],Sy=Bv({matchClosingTags:!1});function Wz(t={}){let{codeLanguages:n,defaultCodeLanguage:s,addKeymap:l=!0,base:{parser:o}=Ez,completeHTMLTags:u=!0,pasteURLAsLink:d=!0,htmlTagLanguage:O=Sy}=t;if(!(o instanceof Lc))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let m=t.extensions?[t.extensions]:[],p=[O.support,Az],x;d&&p.push(Fz),s instanceof Qs?(p.push(s.support),x=s.language):s&&(x=s);let g=n||x?Mz(n,x):void 0;m.push(Sz({codeParser:g,htmlParser:O.language.parser})),l&&p.push(Pj.high(tf.of(Dz)));let b=ph(o.configure(m));return u&&p.push(b.data.of({autocomplete:Bz})),new Qs(b,p)}function Bz(t){let{state:n,pos:s}=t,l=/<[:\-\.\w\u00b7-\uffff]*$/.exec(n.sliceDoc(s-25,s));if(!l)return null;let o=xa(n).resolveInner(s,-1);for(;o&&!o.type.isTop;){if(o.name=="CodeBlock"||o.name=="FencedCode"||o.name=="ProcessingInstructionBlock"||o.name=="CommentBlock"||o.name=="Link"||o.name=="Image")return null;o=o.parent}return{from:s-l[0].length,to:s,options:Hz(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let AO=null;function Hz(){if(AO)return AO;let t=tz(new Xj(N0.create({extensions:Sy}),0,!0));return AO=t?t.options:[]}const Iz=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Fz=Rl.domEventHandlers({paste:(t,n)=>{var s;let{main:l}=n.state.selection;if(l.empty)return!1;let o=(s=t.clipboardData)===null||s===void 0?void 0:s.getData("text/plain");if(!o||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(o)||(/^www\./.test(o)&&(o="https://"+o),!kc.isActiveAt(n.state,l.from,1)))return!1;let u=xa(n.state),d=!1;return u.iterate({from:l.from,to:l.to,enter:O=>{(O.from>l.from||Iz.test(O.name))&&(d=!0)},leave:O=>{O.to<l.to&&(d=!0)}}),d?!1:(n.dispatch({changes:[{from:l.from,insert:"["},{from:l.to,insert:`](${o})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),Kz=1,Qy=194,jy=195,Jz=196,W1=197,eR=198,tR=199,aR=200,nR=2,wy=3,B1=201,sR=24,lR=25,rR=49,iR=50,oR=55,cR=56,uR=57,dR=59,OR=60,fR=61,hR=62,mR=63,pR=65,xR=238,gR=71,bR=241,vR=242,yR=243,SR=244,QR=245,jR=246,wR=247,kR=248,ky=72,$R=249,TR=250,NR=251,PR=252,zR=253,RR=254,CR=255,XR=256,_R=73,ZR=77,AR=263,ER=112,qR=130,MR=151,YR=152,VR=155,$s=10,si=13,gh=32,Gc=9,bh=35,UR=40,LR=46,jf=123,H1=125,$y=39,Ty=34,I1=92,GR=111,DR=120,WR=78,BR=117,HR=85,IR=new Set([lR,rR,iR,AR,pR,qR,cR,uR,xR,hR,mR,ky,_R,ZR,OR,fR,MR,YR,VR,ER]);function EO(t){return t==$s||t==si}function qO(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const FR=new gt((t,n)=>{let s;if(t.next<0)t.acceptToken(tR);else if(n.context.flags&tc)EO(t.next)&&t.acceptToken(eR,1);else if(((s=t.peek(-1))<0||EO(s))&&n.canShift(W1)){let l=0;for(;t.next==gh||t.next==Gc;)t.advance(),l++;(t.next==$s||t.next==si||t.next==bh)&&t.acceptToken(W1,-l)}else EO(t.next)&&t.acceptToken(Jz,1)},{contextual:!0}),KR=new gt((t,n)=>{let s=n.context;if(s.flags)return;let l=t.peek(-1);if(l==$s||l==si){let o=0,u=0;for(;;){if(t.next==gh)o++;else if(t.next==Gc)o+=8-o%8;else break;t.advance(),u++}o!=s.indent&&t.next!=$s&&t.next!=si&&t.next!=bh&&(o<s.indent?t.acceptToken(jy,-u):t.acceptToken(Qy))}}),tc=1,Ny=2,Ka=4,Ja=8,en=16,tn=32;function ac(t,n,s){this.parent=t,this.indent=n,this.flags=s,this.hash=(t?t.hash+t.hash<<8:0)+n+(n<<4)+s+(s<<6)}const JR=new ac(null,0,0);function eC(t){let n=0;for(let s=0;s<t.length;s++)n+=t.charCodeAt(s)==Gc?8-n%8:1;return n}const F1=new Map([[bR,0],[vR,Ka],[yR,Ja],[SR,Ja|Ka],[QR,en],[jR,en|Ka],[wR,en|Ja],[kR,en|Ja|Ka],[$R,tn],[TR,tn|Ka],[NR,tn|Ja],[PR,tn|Ja|Ka],[zR,tn|en],[RR,tn|en|Ka],[CR,tn|en|Ja],[XR,tn|en|Ja|Ka]].map(([t,n])=>[t,n|Ny])),tC=new rh({start:JR,reduce(t,n,s,l){return t.flags&tc&&IR.has(n)||(n==gR||n==ky)&&t.flags&Ny?t.parent:t},shift(t,n,s,l){return n==Qy?new ac(t,eC(l.read(l.pos,s.pos)),0):n==jy?t.parent:n==sR||n==oR||n==dR||n==wy?new ac(t,0,tc):F1.has(n)?new ac(t,0,F1.get(n)|t.flags&tc):t},hash(t){return t.hash}}),aC=new gt(t=>{for(let n=0;n<5;n++){if(t.next!="print".charCodeAt(n))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let n=0;;n++){let s=t.peek(n);if(!(s==gh||s==Gc)){s!=UR&&s!=LR&&s!=$s&&s!=si&&s!=bh&&t.acceptToken(Kz);return}}}),nC=new gt((t,n)=>{let{flags:s}=n.context,l=s&Ka?Ty:$y,o=(s&Ja)>0,u=!(s&en),d=(s&tn)>0,O=t.pos;for(;!(t.next<0);)if(d&&t.next==jf)if(t.peek(1)==jf)t.advance(2);else{if(t.pos==O){t.acceptToken(wy,1);return}break}else if(u&&t.next==I1){if(t.pos==O){t.advance();let m=t.next;m>=0&&(t.advance(),sC(t,m)),t.acceptToken(nR);return}break}else if(t.next==I1&&!u&&t.peek(1)>-1)t.advance(2);else if(t.next==l&&(!o||t.peek(1)==l&&t.peek(2)==l)){if(t.pos==O){t.acceptToken(B1,o?3:1);return}break}else if(t.next==$s){if(o)t.advance();else if(t.pos==O){t.acceptToken(B1);return}break}else t.advance();t.pos>O&&t.acceptToken(aR)});function sC(t,n){if(n==GR)for(let s=0;s<2&&t.next>=48&&t.next<=55;s++)t.advance();else if(n==DR)for(let s=0;s<2&&qO(t.next);s++)t.advance();else if(n==BR)for(let s=0;s<4&&qO(t.next);s++)t.advance();else if(n==HR)for(let s=0;s<8&&qO(t.next);s++)t.advance();else if(n==WR&&t.next==jf){for(t.advance();t.next>=0&&t.next!=H1&&t.next!=$y&&t.next!=Ty&&t.next!=$s;)t.advance();t.next==H1&&t.advance()}}const lC=Ns({'async "*" "**" FormatConversion FormatSpec':A.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":A.controlKeyword,"in not and or is del":A.operatorKeyword,"from def class global nonlocal lambda":A.definitionKeyword,import:A.moduleKeyword,"with as print":A.keyword,Boolean:A.bool,None:A.null,VariableName:A.variableName,"CallExpression/VariableName":A.function(A.variableName),"FunctionDefinition/VariableName":A.function(A.definition(A.variableName)),"ClassDefinition/VariableName":A.definition(A.className),PropertyName:A.propertyName,"CallExpression/MemberExpression/PropertyName":A.function(A.propertyName),Comment:A.lineComment,Number:A.number,String:A.string,FormatString:A.special(A.string),Escape:A.escape,UpdateOp:A.updateOperator,"ArithOp!":A.arithmeticOperator,BitOp:A.bitwiseOperator,CompareOp:A.compareOperator,AssignOp:A.definitionOperator,Ellipsis:A.punctuation,At:A.meta,"( )":A.paren,"[ ]":A.squareBracket,"{ }":A.brace,".":A.derefOperator,", ;":A.separator}),rC={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},iC=Fn.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#Cp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p BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:tC,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[lC],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%T[]%o]p%Tpq%oqr'ars)Yst*xtu%Tuv,dvw-hwx.Uxy/tyz0[z{0r{|2S|}2p}!O3W!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T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[aC,KR,FR,nC,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>rC[t]||-1}],tokenPrec:7668}),K1=new Pf,Py=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Uo(t){return(n,s,l)=>{if(l)return!1;let o=n.node.getChild("VariableName");return o&&s(o,t),!0}}const oC={FunctionDefinition:Uo("function"),ClassDefinition:Uo("class"),ForStatement(t,n,s){if(s){for(let l=t.node.firstChild;l;l=l.nextSibling)if(l.name=="VariableName")n(l,"variable");else if(l.name=="in")break}},ImportStatement(t,n){var s,l;let{node:o}=t,u=((s=o.firstChild)===null||s===void 0?void 0:s.name)=="from";for(let d=o.getChild("import");d;d=d.nextSibling)d.name=="VariableName"&&((l=d.nextSibling)===null||l===void 0?void 0:l.name)!="as"&&n(d,u?"variable":"namespace")},AssignStatement(t,n){for(let s=t.node.firstChild;s;s=s.nextSibling)if(s.name=="VariableName")n(s,"variable");else if(s.name==":"||s.name=="AssignOp")break},ParamList(t,n){for(let s=null,l=t.node.firstChild;l;l=l.nextSibling)l.name=="VariableName"&&(!s||!/\*|AssignOp/.test(s.name))&&n(l,"variable"),s=l},CapturePattern:Uo("variable"),AsPattern:Uo("variable"),__proto__:null};function zy(t,n){let s=K1.get(n);if(s)return s;let l=[],o=!0;function u(d,O){let m=t.sliceString(d.from,d.to);l.push({label:m,type:O})}return n.cursor(Tc.IncludeAnonymous).iterate(d=>{if(d.name){let O=oC[d.name];if(O&&O(d,u,o)||!o&&Py.has(d.name))return!1;o=!1}else if(d.to-d.from>8192){for(let O of zy(t,d.node))l.push(O);return!1}}),K1.set(n,l),l}const J1=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Ry=["String","FormatString","Comment","PropertyName"];function cC(t){let n=xa(t.state).resolveInner(t.pos,-1);if(Ry.indexOf(n.name)>-1)return null;let s=n.name=="VariableName"||n.to-n.from<20&&J1.test(t.state.sliceDoc(n.from,n.to));if(!s&&!t.explicit)return null;let l=[];for(let o=n;o;o=o.parent)Py.has(o.name)&&(l=l.concat(zy(t.state.doc,o)));return{options:l,from:s?n.from:t.pos,validFor:J1}}const uC=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),dC=[Ie("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ie("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ie("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ie("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ie(`if \${}:
|
|
572
572
|
|
|
573
|
-
`,{label:"if",detail:"block",type:"keyword"}),Ie("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ie("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ie("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ie("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],OC=j0(Ry,w0(uC.concat(dC)));function MO(t){let{node:n,pos:s}=t,l=t.lineIndent(s,-1),o=null;for(;;){let u=n.childBefore(s);if(u)if(u.name=="Comment")s=u.from;else if(u.name=="Body"||u.name=="MatchBody")t.baseIndentFor(u)+t.unit<=l&&(o=u),n=u;else if(u.name=="MatchClause")n=u;else if(u.type.is("Statement"))n=u;else break;else break}return o}function YO(t,n){let s=t.baseIndentFor(n),l=t.lineAt(t.pos,-1),o=l.from+l.text.length;return/^\s*($|#)/.test(l.text)&&t.node.to<o+100&&!/\S/.test(t.state.sliceDoc(o,t.node.to))&&t.lineIndent(t.pos,-1)<=s||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(t.textAfter)&&t.lineIndent(t.pos,-1)>s?null:s+t.unit}const VO=ri.define({name:"python",parser:iC.configure({props:[ql.add({Body:t=>{var n;let s=/^\s*(#|$)/.test(t.textAfter)&&MO(t)||t.node;return(n=YO(t,s))!==null&&n!==void 0?n:t.continue()},MatchBody:t=>{var n;let s=MO(t);return(n=YO(t,s||t.node))!==null&&n!==void 0?n:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Io({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Io({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Io({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var n;let s=MO(t);return(n=s&&YO(t,s))!==null&&n!==void 0?n:t.continue()}}),Ps.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Nc,Body:(t,n)=>({from:t.from+1,to:t.to-(t.to==n.doc.length?0:1)}),"String FormatString":(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function fC(){return new Qs(VO,[VO.data.of({autocomplete:cC}),VO.data.of({autocomplete:OC})])}const Lo={javascript:()=>pf({jsx:!0,typescript:!1}),typescript:()=>pf({jsx:!0,typescript:!0}),css:()=>Nv(),html:()=>Bv(),json:()=>oz(),markdown:()=>Wz(),python:()=>fC()},hC=Rl.theme({"&":{backgroundColor:"#24282f",color:"#bcc2cd",fontFamily:"var(--font-mono)",fontSize:"13px",height:"100%"},".cm-scroller":{overflow:"auto"},".cm-content":{caretColor:"#33afbc"},".cm-cursor":{borderLeftColor:"#33afbc"},".cm-gutters":{backgroundColor:"#24282f",borderRight:"1px solid #2c313a",color:"#505862"},".cm-activeLineGutter":{backgroundColor:"#2c313a"},".cm-activeLine":{backgroundColor:"rgba(44, 49, 58, 0.5)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"rgba(51, 175, 188, 0.15)"}},{dark:!0});function mC({content:t,language:n,onChange:s,onSave:l}){const o=v.useRef(null),u=v.useRef(null),d=v.useRef(new Aj),O=v.useRef(s),m=v.useRef(l);return O.current=s,m.current=l,v.useEffect(()=>{if(!o.current)return;const p=Lo[n]||Lo.javascript,x=tf.of([{key:"Mod-s",run:()=>{var y;return(y=m.current)==null||y.call(m),!0}}]),g=N0.create({doc:t||"",extensions:[qj(),Mj(),Yj(),Vj(),Uj(),Lj(),Gj(),tf.of([...Dj,...Wj,...Bj]),x,Ej,hC,d.current.of(p()),Rl.updateListener.of(y=>{var Q;y.docChanged&&((Q=O.current)==null||Q.call(O,y.state.doc.toString()))})]}),b=new Rl({state:g,parent:o.current});return u.current=b,()=>{b.destroy(),u.current=null}},[]),v.useEffect(()=>{const p=u.current;if(!p)return;const x=p.state.doc.toString();t!==x&&p.dispatch({changes:{from:0,to:x.length,insert:t||""}})},[t]),v.useEffect(()=>{const p=u.current;if(!p)return;const x=Lo[n]||Lo.javascript;p.dispatch({effects:d.current.reconfigure(x())})},[n]),i.jsx("div",{ref:o,className:"w-full h-full overflow-hidden"})}const pC=["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif"],Cy=["mp4","webm","mov","avi","mkv","ogv"];function xC(t){var s;const n=(s=t.split(".").pop())==null?void 0:s.toLowerCase();return pC.includes(n)||Cy.includes(n)}function gC({path:t}){var u;const n=(u=t.split(".").pop())==null?void 0:u.toLowerCase(),s=`/api/files/raw?path=${encodeURIComponent(t)}`,l=t.split("/").pop(),o=Cy.includes(n);return i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-surface-0 p-8 gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-3 font-sans",children:[i.jsx(Ge,{children:n==null?void 0:n.toUpperCase()}),i.jsx("span",{className:"font-mono",children:l}),i.jsx("a",{href:s,target:"_blank",rel:"noopener",className:"text-accent hover:text-accent/80 transition-colors",children:i.jsx(hc,{size:12})})]}),o?i.jsx("video",{src:s,controls:!0,className:"max-w-full max-h-[70vh] rounded-md border border-border"}):i.jsx("img",{src:s,alt:l,className:"max-w-full max-h-[70vh] rounded-md border border-border object-contain"})]})}function bC(){const t=L(b=>b.editorActiveFile),n=L(b=>b.editorFiles),s=L(b=>b.editorChangedFiles),l=L(b=>b.updateFileContent),o=L(b=>b.saveFile),u=L(b=>b.reloadFile),d=L(b=>b.dismissFileChange),[O,m]=v.useState("");v.useEffect(()=>{te.get("/files/root").then(b=>m(b.root||"")).catch(()=>{})},[]);const p=t?n[t]:null,x=t&&xC(t),g=t&&s[t];return i.jsxs("div",{className:"flex h-full",children:[i.jsx("div",{className:"w-60 flex-shrink-0 border-r border-border",children:i.jsx(AP,{rootDir:O})}),i.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.jsx(EP,{}),i.jsxs("div",{className:"flex-1 relative min-h-0",children:[g&&i.jsxs("div",{className:"absolute top-0 left-0 right-0 z-10 flex items-center gap-2 px-4 py-2 bg-warning/10 border-b border-warning/20",children:[i.jsx(qc,{size:14,className:"text-warning"}),i.jsx("span",{className:"text-xs text-warning font-sans flex-1",children:"File modified externally"}),i.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>u(t),children:[i.jsx(Jn,{size:12})," Reload"]}),i.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>d(t),children:[i.jsx(jt,{size:12})," Dismiss"]})]}),!t&&i.jsx("div",{className:"w-full h-full flex items-center justify-center text-text-4 font-sans",children:i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx(un,{size:32,className:"mx-auto"}),i.jsx("p",{className:"text-sm",children:"Open a file from the tree"})]})}),t&&x&&i.jsx(gC,{path:t}),t&&!x&&p&&i.jsx(mC,{content:p.content,language:p.language,onChange:b=>l(t,b),onSave:()=>o(t)})]})]})]})}function vC(){var w;const t=L(T=>T.connected),n=L(T=>T.agents),[s,l]=v.useState(null),[o,u]=v.useState(!0),[d,O]=v.useState({tokens:[],cost:[],saved:[],efficiency:[],cache:[],inputOutput:[],agents:[],turns:[]}),m=v.useRef(0);v.useEffect(()=>{if(!t)return;let T=!0;async function k(){try{const $=await te.get("/dashboard");if(!T)return;l($),u(!1),m.current=Date.now(),O(_=>{var ce,oe,ie,K,z,H,E,re,ee;const G=Date.now(),X=(Pe,Se)=>[...Pe.slice(-59),{t:G,v:Se||0}],C=((ce=$.tokens)==null?void 0:ce.totalTokens)||0,N=((ie=(oe=$.tokens)==null?void 0:oe.savings)==null?void 0:ie.total)||0,B=C+N,V=((K=$.tokens)==null?void 0:K.totalInputTokens)||0,ne=((z=$.tokens)==null?void 0:z.totalOutputTokens)||0;return{tokens:X(_.tokens,C),cost:X(_.cost,(H=$.tokens)==null?void 0:H.totalCostUsd),saved:X(_.saved,N),efficiency:X(_.efficiency,B>0?N/B*100:0),cache:X(_.cache,(E=$.tokens)==null?void 0:E.cacheHitRate),inputOutput:X(_.inputOutput,ne>0?V/ne:0),agents:X(_.agents,((re=$.agents)==null?void 0:re.running)||0),turns:X(_.turns,(ee=$.tokens)==null?void 0:ee.totalTurns)}})}catch{T&&u(!1)}}k();const P=setInterval(k,4e3);return()=>{T=!1,clearInterval(P)}},[t]);const p=((w=s==null?void 0:s.agents)==null?void 0:w.breakdown)||[],x=(s==null?void 0:s.routing)||null,g=(s==null?void 0:s.rotation)||null,b=(s==null?void 0:s.adaptive)||[],y=(s==null?void 0:s.journalist)||null,Q=(g==null?void 0:g.rotating)||[];return{data:s,loading:o,agents:n,connected:t,kpiHistory:d,lastFetch:m.current,agentBreakdown:p,routing:x,rotation:g,adaptive:b,journalist:y,rotating:Q}}const e0=v.memo(function({connected:n,runningCount:s,totalCount:l,uptime:o,lastFetch:u,activeTeam:d}){return i.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-surface-1 border-b border-border",children:[i.jsx("h2",{className:"text-xs font-semibold text-text-0 font-sans tracking-wide uppercase",children:"Command Center"}),d&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-text-4",children:"/"}),i.jsx("span",{className:"text-xs font-mono text-text-2",children:d.name})]}),i.jsx("div",{className:"flex-1"}),n&&i.jsxs("div",{className:"flex items-center gap-3.5 text-xs font-mono text-text-2",children:[i.jsxs("span",{children:[i.jsx("span",{className:"text-text-1",children:s}),i.jsxs("span",{className:"text-text-3",children:["/",l]}),i.jsx("span",{className:"ml-1 text-text-3",children:"agents"})]}),o>0&&i.jsxs("span",{className:"text-text-3",children:["Up ",Yc(o)]}),u>0&&i.jsxs("span",{className:"flex items-center gap-1 text-text-4",children:[i.jsx(Jn,{size:9}),i.jsx("span",{children:vt(u)})]})]}),i.jsx(ws,{status:n?"running":"crashed",size:"sm"})]})});function la(t,n){const s=parseInt(t.slice(1,3),16),l=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${s},${l},${o},${n})`}const xe={surface0:"#1a1e25",surface4:"#2c313a",surface5:"#333842",text0:"#e6e6e6",text1:"#bcc2cd",text2:"#8b929e",text3:"#6e7681",text4:"#505862",accent:"#33afbc",success:"#4ae168",warning:"#e5c07b",danger:"#e06c75",info:"#61afef",purple:"#c678dd",orange:"#d19a66"};function yC({data:t,color:n=xe.accent,width:s=72,height:l=22}){if(!t||t.length<2)return i.jsx("div",{style:{width:s,height:l}});const o=t.map(x=>x.v),u=Math.min(...o),O=Math.max(...o)-u||1,m=t.map((x,g)=>{const b=g/(t.length-1)*s,y=l-(x.v-u)/O*(l-2)-1;return`${b},${y}`}).join(" "),p=`kpi-${n.replace("#","")}`;return i.jsxs("svg",{width:s,height:l,className:"flex-shrink-0",children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:n,stopOpacity:"0.2"}),i.jsx("stop",{offset:"100%",stopColor:n,stopOpacity:"0"})]})}),i.jsx("polygon",{points:`0,${l} ${m} ${s},${l}`,fill:`url(#${p})`}),i.jsx("polyline",{points:m,fill:"none",stroke:n,strokeWidth:"1.5",strokeLinejoin:"round",strokeOpacity:"0.8"})]})}const SC=v.memo(function({label:n,value:s,sparkData:l,color:o=xe.accent,className:u}){return i.jsxs("div",{className:le("flex items-center gap-2.5 px-3 py-2.5 min-w-0","bg-surface-1",u),children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5 truncate",children:n}),i.jsx("div",{className:"text-base font-semibold font-mono text-text-0 tabular-nums leading-none",children:s})]}),i.jsx(yC,{data:l,color:o})]})});function QC({kpis:t}){return i.jsx("div",{className:"flex flex-wrap border-b border-border",style:{background:"var(--color-surface-0)"},children:t.map(n=>i.jsx(SC,{label:n.label,value:n.value,sparkData:n.sparkData,color:n.color,className:le("flex-1 basis-[12.5%] min-w-[140px]","border-b border-r border-border")},n.label))})}const jC={actual:"ACT",estimated:"EST",local:"LOC"},wC=v.memo(function({agent:n,isRotating:s}){const l=n.status==="running"||n.status==="starting",o=Math.round((n.contextUsage||0)*100),u=s?"#c678dd":th(n.status),d=n.quality,O=(d==null?void 0:d.toolSuccessRate)!=null?Math.round(d.toolSuccessRate*100):null,m=n.rotationThreshold?Math.round(n.rotationThreshold*100):null;return i.jsxs("div",{className:"px-3 py-2 hover:bg-surface-3 transition-colors space-y-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"relative flex-shrink-0 w-[6px] h-[6px]",children:[i.jsx("span",{className:"absolute inset-0 rounded-sm",style:{background:u}}),l&&i.jsx("span",{className:"absolute inset-[-2px] rounded-sm",style:{background:u,opacity:.15,animation:"node-pulse-bar 2s ease-in-out infinite"}})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate leading-none",children:n.name}),i.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:n.role}),i.jsx("span",{className:"text-2xs text-text-4",children:"/"}),i.jsx("span",{className:"text-2xs font-mono text-text-3",children:kC(n.model)})]})]}),i.jsx("div",{className:"flex-1"}),O!=null&&i.jsxs("span",{className:"text-2xs font-mono font-bold uppercase px-1 py-px rounded-sm flex-shrink-0",style:{color:O>=90?"#4ae168":O>=70?"#e5c07b":"#e06c75",background:O>=90?"rgba(74,225,104,0.1)":O>=70?"rgba(229,192,123,0.1)":"rgba(224,108,117,0.1)"},children:[O,"%"]}),n.costSource&&n.costSource!=="actual"&&i.jsx("span",{className:"text-2xs font-mono text-text-4 uppercase tracking-wider flex-shrink-0",children:jC[n.costSource]||""}),i.jsxs("div",{className:"text-right flex-shrink-0",children:[i.jsx("div",{className:"text-xs font-mono text-text-1 tabular-nums leading-none",children:Je(n.tokens||0)}),(n.costUsd||0)>0&&i.jsx("div",{className:"text-2xs font-mono text-text-3 mt-0.5",children:Mc(n.costUsd)})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1 h-[3px] bg-surface-0 rounded-full overflow-visible",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full transition-all duration-700",style:{width:`${Math.max(o,1)}%`,background:o>80?"#e06c75":o>60?"#e5c07b":l?"#61afef":"#333842"}}),m&&i.jsx("div",{className:"absolute top-[-2px] w-px h-[7px]",style:{left:`${m}%`,background:"#c678dd"},title:`Rotation at ${m}%`})]}),i.jsxs("span",{className:"text-2xs font-mono text-text-2 tabular-nums flex-shrink-0 w-7 text-right",children:[o,"%"]})]})]})});function kC(t){if(!t||t==="auto"||t==="default")return"default";const n=t.match(/^claude-(opus|sonnet|haiku)-(\d+)-(\d+)/);return n?`${n[1][0].toUpperCase()}${n[1].slice(1)} ${n[2]}.${n[3]}`:t.startsWith("gemini-")?t.replace("gemini-","Gem ").replace("-preview",""):t.length>12?t.slice(0,12)+"...":t}const $C=v.memo(function({agentBreakdown:n,rotating:s=[]}){if(!(n!=null&&n.length))return i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"No agents"});const l={};for(const u of n){const d=u.teamId||"ungrouped";l[d]||(l[d]=[]),l[d].push(u)}const o=new Set(s);return i.jsx(es,{className:"flex-1",children:i.jsx("div",{className:"py-1",children:Object.entries(l).map(([u,d])=>i.jsxs("div",{children:[i.jsx("div",{className:"px-3 pt-2 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:u})}),d.map(O=>i.jsx(wC,{agent:O,isRotating:o.has(O.id)},O.id))]},u))})})}),TC=v.memo(function({data:n}){const s=v.useRef(null),l=v.useRef(null),[o,u]=v.useState({width:0,height:0}),[d,O]=v.useState(null),{width:m,height:p}=o,x={top:28,right:12,bottom:8,left:12},g=Math.max(m-x.left-x.right,0),b=Math.max(p-x.top-x.bottom,0),y=v.useMemo(()=>!n||n.length<2?[]:n.slice(1).map((T,k)=>{const P=n[k],$=(T.t-P.t)/6e4,_=Math.max((T.tokens||0)-(P.tokens||0),0);return{burnRate:$>0?Math.round(_/$):0,cacheHitRate:T.cacheHitRate||0,running:T.running||0,agents:T.agents||0,t:T.t}}),[n]);v.useEffect(()=>{const T=s.current;if(!T)return;const k=new ResizeObserver(P=>{const{width:$,height:_}=P[0].contentRect;$>0&&_>0&&u({width:Math.floor($),height:Math.floor(_)})});return k.observe(T),()=>k.disconnect()},[]);const Q=v.useCallback(T=>{const k=l.current;if(!k||!y.length||g<=0)return;const P=k.getBoundingClientRect(),$=T.clientX-P.left-x.left;if($<0||$>g){O(null);return}const _=Math.round($/g*(y.length-1));O({x:x.left+_/Math.max(y.length-1,1)*g,index:_})},[y,g,x.left]),w=v.useCallback(()=>O(null),[]);return v.useEffect(()=>{const T=l.current;if(!T||!y.length||m<=0||p<=0||g<=0||b<=0)return;const k=T.getContext("2d"),P=window.devicePixelRatio||1;T.width=m*P,T.height=p*P,k.scale(P,P),k.clearRect(0,0,m,p);const $=y.map(z=>z.burnRate),_=y.map(z=>z.cacheHitRate),G=y.map(z=>z.running),X=Math.max(...$,100),C=Math.max(...G,1),N=z=>x.left+z/Math.max(y.length-1,1)*g,B=z=>x.top+b-z/X*b,V=z=>x.top+b-z*b,ne=Math.max(g/y.length-1,2);for(let z=0;z<y.length;z++){const H=G[z];if(H<=0)continue;const E=H/C*b*.3,re=N(z)-ne/2,ee=x.top+b-E;k.fillStyle=la(xe.surface5,.5),k.fillRect(re,ee,ne,E)}k.setLineDash([2,4]),k.strokeStyle=la(xe.text4,.2),k.lineWidth=1;for(let z=1;z<=3;z++){const H=x.top+b/4*z;k.beginPath(),k.moveTo(x.left,H),k.lineTo(x.left+g,H),k.stroke()}k.setLineDash([]),k.font="9px 'JetBrains Mono Variable', monospace",k.textAlign="left",k.fillStyle=la(xe.text3,.5),k.fillText(`${Je(X)}/m`,x.left+4,x.top+10),k.fillText(`${Je(Math.round(X/2))}/m`,x.left+4,x.top+b/2+4),k.beginPath(),k.moveTo(x.left,x.top+b);for(let z=0;z<y.length;z++)k.lineTo(N(z),B($[z]));k.lineTo(N(y.length-1),x.top+b),k.closePath();const ce=k.createLinearGradient(0,x.top,0,x.top+b);ce.addColorStop(0,la(xe.accent,.2)),ce.addColorStop(.7,la(xe.accent,.04)),ce.addColorStop(1,la(xe.accent,0)),k.fillStyle=ce,k.fill(),k.beginPath(),k.strokeStyle=xe.accent,k.lineWidth=1.5,k.lineJoin="round";for(let z=0;z<y.length;z++){const H=N(z),E=B($[z]);z===0?k.moveTo(H,E):k.lineTo(H,E)}k.stroke();const oe=_.some(z=>z>0);if(oe){k.beginPath(),k.strokeStyle=la(xe.info,.45),k.lineWidth=1,k.lineJoin="round",k.setLineDash([2,3]);for(let z=0;z<y.length;z++){const H=N(z),E=V(_[z]);z===0?k.moveTo(H,E):k.lineTo(H,E)}k.stroke(),k.setLineDash([])}k.font="9px 'Inter Variable', sans-serif",k.textAlign="right";let ie=m-x.right-4;const K=14;if(oe&&(k.fillStyle=la(xe.info,.5),k.fillText("Cache %",ie,K),ie-=k.measureText("Cache %").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),ie-=14),k.fillStyle=la(xe.surface5,.7),k.fillText("Agents",ie,K),ie-=k.measureText("Agents").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),ie-=14,k.fillStyle=xe.accent,k.fillText("Burn Rate",ie,K),ie-=k.measureText("Burn Rate").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),d&&d.index>=0&&d.index<y.length){const z=d.x,H=y[d.index];k.beginPath(),k.moveTo(z,x.top),k.lineTo(z,x.top+b),k.strokeStyle=la(xe.text1,.15),k.lineWidth=1,k.stroke();const E=B(H.burnRate);k.beginPath(),k.arc(z,E,3,0,Math.PI*2),k.fillStyle=xe.accent,k.fill();const re=[{label:"Burn",value:`${Je(H.burnRate)}/m`,color:xe.accent},{label:"Cache",value:ks(H.cacheHitRate*100),color:xe.info},{label:"Agents",value:`${H.running}/${H.agents}`,color:xe.text2}],ee=104,Pe=re.length*16+12;let Se=z+12;Se+ee>m-8&&(Se=z-ee-12);const ve=Math.max(x.top,E-Pe/2);k.fillStyle=la(xe.surface0,.92),k.beginPath(),k.roundRect(Se,ve,ee,Pe,4),k.fill(),k.strokeStyle=la(xe.text4,.2),k.lineWidth=1,k.stroke(),k.textAlign="left",re.forEach((_e,W)=>{const ue=ve+14+W*16;k.beginPath(),k.arc(Se+8,ue-3,2,0,Math.PI*2),k.fillStyle=_e.color,k.fill(),k.font="8px 'Inter Variable', sans-serif",k.fillStyle=xe.text3,k.fillText(_e.label,Se+14,ue),k.font="9px 'JetBrains Mono Variable', monospace",k.fillStyle=xe.text0,k.textAlign="right",k.fillText(_e.value,Se+ee-8,ue),k.textAlign="left"})}},[y,m,p,d,g,b,x]),i.jsx("div",{ref:s,className:"absolute inset-0",children:m>0&&p>0&&i.jsx("canvas",{ref:l,style:{width:m,height:p},className:"block cursor-crosshair",onMouseMove:Q,onMouseLeave:w})})}),NC=v.memo(function({cacheRead:n=0,cacheCreation:s=0,totalInput:l=0,size:o=140}){const u=v.useRef(null),d=n+s+l,O=d>0?n/d*100:0;return v.useEffect(()=>{const m=u.current;if(!m)return;const p=window.devicePixelRatio||1;m.width=o*p,m.height=o*p;const x=m.getContext("2d");x.scale(p,p),x.clearRect(0,0,o,o);const g=o/2,b=o/2,y=(o-12)/2,Q=5,w=135*Math.PI/180,T=405*Math.PI/180,k=T-w;if(x.beginPath(),x.arc(g,b,y,w,T),x.strokeStyle=xe.surface4,x.lineWidth=Q,x.lineCap="round",x.stroke(),d>0){const P=n/d,$=s/d;if(P>0){const _=w+k*P;x.beginPath(),x.arc(g,b,y,w,_),x.strokeStyle=xe.accent,x.lineWidth=Q,x.lineCap="round",x.stroke()}if($>0){const _=w+k*P,G=_+k*$;x.beginPath(),x.arc(g,b,y,_,G),x.strokeStyle=xe.purple,x.lineWidth=Q,x.lineCap="butt",x.stroke()}}x.textAlign="center",x.textBaseline="middle",x.font=`600 ${o*.2}px 'JetBrains Mono Variable', monospace`,x.fillStyle=xe.text0,x.fillText(`${Math.round(O)}%`,g,b-3),x.font=`500 ${o*.08}px 'JetBrains Mono Variable', monospace`,x.fillStyle=xe.text3,x.fillText("CACHE",g,b+o*.13)},[n,s,l,o,d,O]),i.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-3 py-3",children:[i.jsx("canvas",{ref:u,className:"flex-shrink-0",style:{width:o,height:o}}),i.jsxs("div",{className:"w-full mt-3 space-y-1.5 max-w-[160px]",children:[i.jsx(UO,{color:xe.accent,label:"Read",value:Je(n)}),i.jsx(UO,{color:xe.purple,label:"Create",value:Je(s)}),i.jsx(UO,{color:xe.surface5,label:"Miss",value:Je(Math.max(l-n-s,0))})]})]})});function UO({color:t,label:n,value:s}){return i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:t}}),i.jsx("span",{className:"text-text-3 uppercase tracking-wider flex-1",children:n}),i.jsx("span",{className:"text-text-1 tabular-nums",children:s})]})}const t0={heavy:xe.danger,medium:xe.warning,light:xe.success},a0={heavy:"Heavy",medium:"Medium",light:"Light"},PC=v.memo(function({routing:n,agentBreakdown:s}){if(!n)return null;const{byTier:l={},totalDecisions:o=0,autoRoutedCount:u=0}=n,d=["heavy","medium","light"],O=d.reduce((g,b)=>g+(l[b]||0),0),m={};for(const g of s||[]){const b=g.model||"default";m[b]||(m[b]={tokens:0,agents:0}),m[b].tokens+=g.tokens||0,m[b].agents+=1}const p=Object.entries(m).sort((g,b)=>b[1].tokens-g[1].tokens),x=p.length>0?p[0][1].tokens:0;return i.jsxs("div",{className:"flex flex-col h-full px-3 py-3 overflow-y-auto",children:[O>0&&i.jsxs("div",{className:"space-y-1.5 mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:"Tier Distribution"}),i.jsxs("span",{className:"text-2xs font-mono text-text-4 ml-auto tabular-nums",children:[Je(O)," decisions"]})]}),i.jsx("div",{className:"h-[6px] bg-surface-0 rounded-full overflow-hidden flex",children:d.map(g=>{const b=l[g]||0;if(b===0)return null;const y=b/O*100;return i.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${y}%`,background:t0[g]},title:`${a0[g]}: ${b} (${Math.round(y)}%)`},g)})}),i.jsx("div",{className:"flex items-center gap-3",children:d.map(g=>{const b=l[g]||0;if(b===0)return null;const y=O>0?b/O*100:0;return i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:t0[g]}}),i.jsx("span",{className:"text-2xs font-mono text-text-2",children:a0[g]}),i.jsx("span",{className:"text-2xs font-mono text-text-4 tabular-nums",children:ks(y)})]},g)})})]}),p.length>0&&i.jsxs("div",{className:"space-y-1.5 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:"Models in Use"}),u>0&&i.jsxs("span",{className:"text-2xs font-mono text-text-4 ml-auto",children:[u," auto"]})]}),i.jsx("div",{className:"space-y-1.5",children:p.map(([g,b])=>{const y=x>0?b.tokens/x*100:0;return i.jsxs("div",{className:"space-y-0.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 flex-1 truncate",children:zC(g)}),i.jsxs("span",{className:"text-2xs font-mono text-text-3 tabular-nums",children:[b.agents," agent",b.agents!==1?"s":""]}),i.jsx("span",{className:"text-xs font-mono text-text-1 tabular-nums",children:Je(b.tokens)})]}),i.jsx("div",{className:"h-[3px] bg-surface-0 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(y,2)}%`,background:xe.accent}})})]},g)})})]}),O===0&&p.length===0&&i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono",children:"No routing data"})]})});function zC(t){if(!t||t==="auto"||t==="default")return"Default";const n=t.match(/^claude-(opus|sonnet|haiku)-(\d+)-(\d+)/);return n?`${n[1][0].toUpperCase()}${n[1].slice(1)} ${n[2]}.${n[3]}`:t.startsWith("gemini-")?t.replace("gemini-","Gemini ").replace("-preview",""):t}function RC(t){const n=t+"CollectionProvider",[s,l]=zs(n),[o,u]=s(n,{collectionRef:{current:null},itemMap:new Map}),d=w=>{const{scope:T,children:k}=w,P=Yn.useRef(null),$=Yn.useRef(new Map).current;return i.jsx(o,{scope:T,itemMap:$,collectionRef:P,children:k})};d.displayName=n;const O=t+"CollectionSlot",m=lc(O),p=Yn.forwardRef((w,T)=>{const{scope:k,children:P}=w,$=u(O,k),_=it(T,$.collectionRef);return i.jsx(m,{ref:_,children:P})});p.displayName=O;const x=t+"CollectionItemSlot",g="data-radix-collection-item",b=lc(x),y=Yn.forwardRef((w,T)=>{const{scope:k,children:P,...$}=w,_=Yn.useRef(null),G=it(T,_),X=u(x,k);return Yn.useEffect(()=>(X.itemMap.set(_,{ref:_,...$}),()=>void X.itemMap.delete(_))),i.jsx(b,{[g]:"",ref:G,children:P})});y.displayName=x;function Q(w){const T=u(t+"CollectionConsumer",w);return Yn.useCallback(()=>{const P=T.collectionRef.current;if(!P)return[];const $=Array.from(P.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort((X,C)=>$.indexOf(X.ref.current)-$.indexOf(C.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:d,Slot:p,ItemSlot:y},Q,l]}var LO="rovingFocusGroup.onEntryFocus",CC={bubbles:!1,cancelable:!0},mi="RovingFocusGroup",[wf,Xy,XC]=RC(mi),[_C,_y]=zs(mi,[XC]),[ZC,AC]=_C(mi),Zy=v.forwardRef((t,n)=>i.jsx(wf.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(wf.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(EC,{...t,ref:n})})}));Zy.displayName=mi;var EC=v.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,orientation:l,loop:o=!1,dir:u,currentTabStopId:d,defaultCurrentTabStopId:O,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=t,b=v.useRef(null),y=it(n,b),Q=ah(u),[w,T]=Xc({prop:d,defaultProp:O??null,onChange:m,caller:mi}),[k,P]=v.useState(!1),$=Rt(p),_=Xy(s),G=v.useRef(!1),[X,C]=v.useState(0);return v.useEffect(()=>{const N=b.current;if(N)return N.addEventListener(LO,$),()=>N.removeEventListener(LO,$)},[$]),i.jsx(ZC,{scope:s,orientation:l,dir:Q,loop:o,currentTabStopId:w,onItemFocus:v.useCallback(N=>T(N),[T]),onItemShiftTab:v.useCallback(()=>P(!0),[]),onFocusableItemAdd:v.useCallback(()=>C(N=>N+1),[]),onFocusableItemRemove:v.useCallback(()=>C(N=>N-1),[]),children:i.jsx(Be.div,{tabIndex:k||X===0?-1:0,"data-orientation":l,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:Ee(t.onMouseDown,()=>{G.current=!0}),onFocus:Ee(t.onFocus,N=>{const B=!G.current;if(N.target===N.currentTarget&&B&&!k){const V=new CustomEvent(LO,CC);if(N.currentTarget.dispatchEvent(V),!V.defaultPrevented){const ne=_().filter(z=>z.focusable),ce=ne.find(z=>z.active),oe=ne.find(z=>z.id===w),K=[ce,oe,...ne].filter(Boolean).map(z=>z.ref.current);qy(K,x)}}G.current=!1}),onBlur:Ee(t.onBlur,()=>P(!1))})})}),Ay="RovingFocusGroupItem",Ey=v.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,focusable:l=!0,active:o=!1,tabStopId:u,children:d,...O}=t,m=kl(),p=u||m,x=AC(Ay,s),g=x.currentTabStopId===p,b=Xy(s),{onFocusableItemAdd:y,onFocusableItemRemove:Q,currentTabStopId:w}=x;return v.useEffect(()=>{if(l)return y(),()=>Q()},[l,y,Q]),i.jsx(wf.ItemSlot,{scope:s,id:p,focusable:l,active:o,children:i.jsx(Be.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...O,ref:n,onMouseDown:Ee(t.onMouseDown,T=>{l?x.onItemFocus(p):T.preventDefault()}),onFocus:Ee(t.onFocus,()=>x.onItemFocus(p)),onKeyDown:Ee(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){x.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const k=YC(T,x.orientation,x.dir);if(k!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let $=b().filter(_=>_.focusable).map(_=>_.ref.current);if(k==="last")$.reverse();else if(k==="prev"||k==="next"){k==="prev"&&$.reverse();const _=$.indexOf(T.currentTarget);$=x.loop?VC($,_+1):$.slice(_+1)}setTimeout(()=>qy($))}}),children:typeof d=="function"?d({isCurrentTabStop:g,hasTabStop:w!=null}):d})})});Ey.displayName=Ay;var qC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MC(t,n){return n!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YC(t,n,s){const l=MC(t.key,s);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(l))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(l)))return qC[l]}function qy(t,n=!1){const s=document.activeElement;for(const l of t)if(l===s||(l.focus({preventScroll:n}),document.activeElement!==s))return}function VC(t,n){return t.map((s,l)=>t[(n+l)%t.length])}var UC=Zy,LC=Ey,Dc="Tabs",[GC]=zs(Dc,[_y]),My=_y(),[DC,vh]=GC(Dc),Yy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,onValueChange:o,defaultValue:u,orientation:d="horizontal",dir:O,activationMode:m="automatic",...p}=t,x=ah(O),[g,b]=Xc({prop:l,onChange:o,defaultProp:u??"",caller:Dc});return i.jsx(DC,{scope:s,baseId:kl(),value:g,onValueChange:b,orientation:d,dir:x,activationMode:m,children:i.jsx(Be.div,{dir:x,"data-orientation":d,...p,ref:n})})});Yy.displayName=Dc;var Vy="TabsList",Uy=v.forwardRef((t,n)=>{const{__scopeTabs:s,loop:l=!0,...o}=t,u=vh(Vy,s),d=My(s);return i.jsx(UC,{asChild:!0,...d,orientation:u.orientation,dir:u.dir,loop:l,children:i.jsx(Be.div,{role:"tablist","aria-orientation":u.orientation,...o,ref:n})})});Uy.displayName=Vy;var Ly="TabsTrigger",Gy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,disabled:o=!1,...u}=t,d=vh(Ly,s),O=My(s),m=By(d.baseId,l),p=Hy(d.baseId,l),x=l===d.value;return i.jsx(LC,{asChild:!0,...O,focusable:!o,active:x,children:i.jsx(Be.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:m,...u,ref:n,onMouseDown:Ee(t.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?d.onValueChange(l):g.preventDefault()}),onKeyDown:Ee(t.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&d.onValueChange(l)}),onFocus:Ee(t.onFocus,()=>{const g=d.activationMode!=="manual";!x&&!o&&g&&d.onValueChange(l)})})})});Gy.displayName=Ly;var Dy="TabsContent",Wy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,forceMount:o,children:u,...d}=t,O=vh(Dy,s),m=By(O.baseId,l),p=Hy(O.baseId,l),x=l===O.value,g=v.useRef(x);return v.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),i.jsx(ga,{present:o||x,children:({present:b})=>i.jsx(Be.div,{"data-state":x?"active":"inactive","data-orientation":O.orientation,role:"tabpanel","aria-labelledby":m,hidden:!b,id:p,tabIndex:0,...d,ref:n,style:{...t.style,animationDuration:g.current?"0s":void 0},children:b&&u})})});Wy.displayName=Dy;function By(t,n){return`${t}-trigger-${n}`}function Hy(t,n){return`${t}-content-${n}`}var WC=Yy,BC=Uy,HC=Gy,IC=Wy;function Iy({children:t,...n}){return i.jsx(WC,{...n,children:t})}function Fy({children:t,className:n,...s}){return i.jsx(BC,{className:le("flex items-center gap-0 border-b border-border-subtle",n),...s,children:t})}function Nl({children:t,className:n,...s}){return i.jsx(HC,{className:le("px-3 py-2 text-sm font-medium font-sans text-text-2","border-b-2 border-transparent","hover:text-text-0 hover:bg-surface-5/50","data-[state=active]:text-text-0 data-[state=active]:border-accent","transition-colors duration-100 cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",n),...s,children:t})}function Pl({children:t,className:n,...s}){return i.jsx(IC,{className:le("flex-1 min-h-0",n),...s,children:t})}function n0({data:t,color:n=xe.accent,width:s=60,height:l=16}){if(!t||t.length<2)return i.jsx("div",{style:{width:s,height:l}});const o=Array.isArray(t[0])?t:t.map(p=>typeof p=="number"?p:p.v),u=Math.min(...o),O=Math.max(...o)-u||1,m=o.map((p,x)=>{const g=x/(o.length-1)*s,b=l-(p-u)/O*(l-2)-1;return`${g},${b}`}).join(" ");return i.jsx("svg",{width:s,height:l,className:"flex-shrink-0",children:i.jsx("polyline",{points:m,fill:"none",stroke:n,strokeWidth:"1",strokeLinejoin:"round",strokeOpacity:"0.7"})})}function GO({label:t,value:n,total:s,color:l}){const o=s>0?n/s*100:0;return i.jsxs("div",{className:"space-y-0.5",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[i.jsx("span",{className:"text-text-2",children:t}),i.jsx("span",{className:"text-text-1 tabular-nums",children:Je(n)})]}),i.jsx("div",{className:"h-[2px] bg-surface-0 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.min(o,100)}%`,background:l}})})]})}function FC({tokens:t,rotation:n}){var d;const s=(t==null?void 0:t.savings)||{},l=s.total||0,u=((t==null?void 0:t.totalTokens)||0)+l;return i.jsxs("div",{className:"p-3 space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Rotations"}),i.jsx("div",{className:"text-xl font-mono font-semibold text-text-0 tabular-nums leading-none",children:(n==null?void 0:n.totalRotations)||0})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Saved"}),i.jsx("div",{className:"text-xl font-mono font-semibold text-success tabular-nums leading-none",children:Je(l)}),u>0&&i.jsxs("div",{className:"text-2xs font-mono text-text-3 mt-0.5",children:[ks(l/u*100)," of total"]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(GO,{label:"Rotation",value:s.fromRotation||0,total:u,color:xe.accent}),i.jsx(GO,{label:"Conflict prevention",value:s.fromConflictPrevention||0,total:u,color:xe.purple}),i.jsx(GO,{label:"Cold-start skip",value:s.fromColdStartSkip||0,total:u,color:xe.info})]}),((d=n==null?void 0:n.history)==null?void 0:d.length)>0&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1.5",children:"Recent"}),i.jsx("div",{className:"space-y-1",children:n.history.slice(-8).reverse().map((O,m)=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono px-2 py-1 bg-surface-0 rounded",children:[i.jsx("span",{className:"text-text-1 font-medium capitalize truncate flex-1",children:O.agentName||O.role}),i.jsx("span",{className:"text-text-3 tabular-nums",children:ks((O.contextUsage||0)*100)}),i.jsx("span",{className:"text-text-4",children:vt(O.timestamp)})]},m))})]})]})}function KC({adaptive:t}){if(!(t!=null&&t.length))return i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"No adaptive profiles"});function n(s){const l=s.split(":");return{provider:l[0]||s,role:l[1]||""}}return i.jsx("div",{children:i.jsxs("div",{className:"p-3 space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2 px-2 pb-1 text-2xs font-mono text-text-4 uppercase tracking-wider",children:[i.jsx("span",{className:"flex-1",children:"Role"}),i.jsx("span",{className:"w-12 text-right",children:"Threshold"}),i.jsx("span",{className:"w-12 text-right",children:"Adj."}),i.jsx("span",{className:"w-14 text-right",children:"Status"})]}),t.map(s=>{var O,m;const{provider:l,role:o}=n(s.key),u=((O=s.thresholdHistory)==null?void 0:O.length)>1,d=((m=s.recentScores)==null?void 0:m.length)>1;return i.jsxs("div",{className:"bg-surface-0 rounded px-2 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 capitalize",children:o||l}),o&&i.jsx("span",{className:"text-2xs font-mono text-text-4 ml-1.5",children:l})]}),i.jsx("span",{className:"w-12 text-right text-xs font-mono font-semibold text-text-0 tabular-nums",children:ks(s.threshold*100)}),i.jsx("span",{className:"w-12 text-right text-2xs font-mono text-text-3 tabular-nums",children:s.adjustments}),i.jsx("span",{className:le("w-14 text-right text-2xs font-mono font-bold uppercase",s.converged?"text-success":"text-text-4"),children:s.converged?"Converged":"Learning"})]}),(u||d)&&i.jsxs("div",{className:"flex items-center gap-3 mt-1.5 pl-1",children:[u&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-4",children:"Threshold"}),i.jsx(n0,{data:s.thresholdHistory.map(p=>p.v),color:s.converged?xe.success:xe.accent,width:70,height:12})]}),d&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-4",children:"Quality"}),i.jsx(n0,{data:s.recentScores,color:xe.warning,width:70,height:12})]})]})]},s.key)})]})})}function JC({journalist:t}){var n;return t?i.jsx("div",{children:i.jsxs("div",{className:"p-3 space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Cycles"}),i.jsx("div",{className:"text-lg font-mono font-semibold text-text-0 tabular-nums leading-none",children:t.cycleCount||0})]}),t.lastCycleAt&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Last"}),i.jsx("div",{className:"text-xs font-mono text-text-2",children:vt(t.lastCycleAt)})]}),t.synthesizing&&i.jsx("span",{className:"text-2xs font-mono font-bold text-accent uppercase tracking-wider animate-pulse",children:"Synthesizing"})]}),t.lastSummary&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Summary"}),i.jsx("div",{className:"text-xs font-sans text-text-2 leading-relaxed",children:t.lastSummary})]}),t.projectMap&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Project Map"}),i.jsx("div",{className:"text-xs font-mono text-text-2 leading-relaxed whitespace-pre-wrap",children:t.projectMap})]}),t.decisions&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Decisions"}),i.jsx("div",{className:"text-xs font-mono text-text-2 leading-relaxed whitespace-pre-wrap",children:t.decisions})]}),((n=t.recentHistory)==null?void 0:n.length)>0&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1.5",children:"History"}),i.jsx("div",{className:"space-y-1",children:t.recentHistory.slice().reverse().map((s,l)=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono px-2 py-1 bg-surface-0 rounded",children:[i.jsxs("span",{className:"text-text-3",children:["#",s.cycle]}),i.jsxs("span",{className:"text-text-2 flex-1 truncate",children:[s.agentCount," agents"]}),i.jsx("span",{className:"text-text-4",children:vt(s.timestamp)})]},l))})]})]})}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"Journalist inactive"})}const eX=v.memo(function({tokens:n,rotation:s,adaptive:l,journalist:o}){return i.jsxs(Iy,{defaultValue:"rotation",className:"flex flex-col h-full",children:[i.jsxs(Fy,{className:"flex-shrink-0 px-1",children:[i.jsxs(Nl,{value:"rotation",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(Vl,{size:11}),"Rotation"]}),i.jsxs(Nl,{value:"adaptive",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(j5,{size:11}),"Adaptive"]}),i.jsxs(Nl,{value:"journalist",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(Ff,{size:11}),"Journalist"]})]}),i.jsx(Pl,{value:"rotation",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(FC,{tokens:n,rotation:s})})}),i.jsx(Pl,{value:"adaptive",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(KC,{adaptive:l})})}),i.jsx(Pl,{value:"journalist",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(JC,{journalist:o})})})]})}),tX={spawn:zN,complete:Ir,crash:qc,kill:Nb,rotate:Vl,error:Jf},aX={spawn:"text-accent",complete:"text-success",crash:"text-danger",kill:"text-text-3",rotate:"text-purple",error:"text-danger"};function nX(t){const n=t.agentName||t.role||"";switch(t.type){case"spawn":return`${n} spawned`;case"complete":return`${n} completed`;case"crash":return`${n} crashed`;case"kill":return`${n} killed`;case"rotate":return`${n} rotated`;default:return t.text||t.type||"event"}}const sX=v.memo(function({events:n=[]}){return n.length?i.jsx("div",{className:"flex items-center gap-3 overflow-x-auto py-2 px-3",children:n.slice(-15).reverse().map((s,l)=>{const o=tX[s.type]||Pa,u=aX[s.type]||"text-text-3",d=nX(s);return i.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i.jsx(o,{size:11,className:u}),i.jsx("span",{className:"text-xs font-sans text-text-2 whitespace-nowrap",children:d}),i.jsx("span",{className:"text-2xs font-mono text-text-4",children:vt(s.t||s.timestamp)})]},l)})}):i.jsx("div",{className:"text-xs text-text-3 font-mono py-2.5 text-center",children:"No recent activity"})});function ra({className:t,...n}){return i.jsx("div",{className:le("rounded-md bg-surface-4","bg-gradient-to-r from-surface-4 via-surface-5 to-surface-4","bg-[length:200%_100%] animate-[shimmer_1.5s_ease-in-out_infinite]",t),...n})}function lX(){return i.jsxs("div",{className:"flex-1 grid gap-px p-0",style:{gridTemplateRows:"auto minmax(0, 1fr) minmax(0, 1fr)",gridTemplateColumns:"3fr 1.5fr 1.5fr",background:"#282c34"},children:[i.jsx("div",{className:"col-span-3",children:i.jsx(ra,{className:"h-[72px] rounded-none"})}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx("div",{className:"col-span-2",children:i.jsx(ra,{className:"h-full rounded-none"})})]})}function rX(){const{data:t,loading:n,agents:s,connected:l,kpiHistory:o,lastFetch:u,agentBreakdown:d,routing:O,rotation:m,adaptive:p,journalist:x,rotating:g}=vC(),b=s.filter(X=>X.status==="running").length;if(!l)return i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-2 text-text-3 font-mono",children:[i.jsx(Ac,{size:28,className:"mx-auto"}),i.jsx("p",{className:"text-xs",children:"Connecting to daemon..."})]})});if(n||!t)return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(e0,{connected:l,runningCount:0,totalCount:0,uptime:0,lastFetch:0}),i.jsx(lX,{})]});const y=t.tokens||{},Q={totalTokens:y.totalTokens||0,totalCostUsd:y.totalCostUsd||0,totalInputTokens:y.totalInputTokens||0,totalOutputTokens:y.totalOutputTokens||0,cacheReadTokens:y.cacheReadTokens||0,cacheCreationTokens:y.cacheCreationTokens||0,cacheHitRate:y.cacheHitRate||0,totalTurns:y.totalTurns||0,agentCount:y.agentCount||0,savings:y.savings||{}},w=Q.totalTokens+(Q.savings.total||0),T=w>0?(Q.savings.total||0)/w*100:0,k=Q.totalOutputTokens>0?(Q.totalInputTokens/Q.totalOutputTokens).toFixed(1):"—",P=t.timeline||{},$=P.snapshots||[],_=P.events||t.events||[],G=[{label:"Tokens Used",value:Je(Q.totalTokens),sparkData:o.tokens,color:xe.accent},{label:"Total Cost",value:Mc(Q.totalCostUsd),sparkData:o.cost,color:xe.warning},{label:"Tokens Saved",value:Je(Q.savings.total||0),sparkData:o.saved,color:xe.success},{label:"Efficiency",value:ks(T),sparkData:o.efficiency,color:xe.purple},{label:"Cache Rate",value:ks(Q.cacheHitRate*100),sparkData:o.cache,color:xe.info},{label:"I/O Ratio",value:`${k}:1`,sparkData:o.inputOutput,color:xe.orange},{label:"Agents",value:`${b}/${s.length}`,sparkData:o.agents,color:xe.accent},{label:"Turns",value:Je(Q.totalTurns),sparkData:o.turns,color:xe.text2}];return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(e0,{connected:l,runningCount:b,totalCount:s.length,uptime:t.uptime||0,lastFetch:u,activeTeam:t.activeTeam}),i.jsx(QC,{kpis:G}),i.jsxs("div",{className:"flex-1 min-h-0 grid",style:{gridTemplateRows:"minmax(0, 1fr) minmax(0, 1fr)",gridTemplateColumns:"3fr 1.5fr 1.5fr",background:"#282c34",gap:"1px"},children:[i.jsx("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 relative",children:i.jsx(TC,{data:$})}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-l border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Cache Performance"})}),i.jsx(NC,{cacheRead:Q.cacheReadTokens,cacheCreation:Q.cacheCreationTokens,totalInput:Q.totalInputTokens})]}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-l border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Model Routing"})}),i.jsx(PC,{routing:O,agentBreakdown:d})]}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-t border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1 flex-shrink-0",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Agent Fleet"})}),i.jsx($C,{agentBreakdown:d,rotating:g})]}),i.jsx("div",{className:"col-span-2 min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-t border-l border-border",children:i.jsx(eX,{tokens:Q,rotation:m,adaptive:p,journalist:x})})]}),i.jsx("div",{className:"flex-shrink-0 bg-surface-1 border-t border-border",children:i.jsx(sX,{events:_})})]})}const s0={sm:12,md:16,lg:20};function iX({fill:t="full",size:n,color:s="#fbbf24",emptyColor:l="rgba(255,255,255,0.4)"}){const o=`star-${Math.random().toString(36).slice(2,8)}`;return i.jsxs("svg",{width:n,height:n,viewBox:"0 0 20 20",fill:"none",children:[t==="half"&&i.jsx("defs",{children:i.jsxs("linearGradient",{id:o,children:[i.jsx("stop",{offset:"50%",stopColor:s}),i.jsx("stop",{offset:"50%",stopColor:l})]})}),i.jsx("path",{d:"M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.49L10 14.27 5.06 16.7 6 11.21l-4-3.9 5.53-.8L10 1.5z",fill:t==="full"?s:t==="half"?`url(#${o})`:l})]})}function Ky({rating:t=0,count:n,size:s="sm"}){const l=s0[s]||s0.sm,o=[];for(let u=1;u<=5;u++)t>=u?o.push("full"):t>=u-.5?o.push("half"):o.push("empty");return i.jsxs("span",{className:"inline-flex items-center",style:{gap:1},children:[o.map((u,d)=>i.jsx(iX,{fill:u,size:l},d)),n!=null&&i.jsxs("span",{className:"ml-1 text-[11px] text-[var(--text-dim,#6b7f95)] font-sans",children:["(",n,")"]})]})}const l0={design:{color:"#c678dd",bg:"rgba(198,120,221,0.12)"},quality:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},devtools:{color:"#33afbc",bg:"rgba(51,175,188,0.14)"},workflow:{color:"#fbbf24",bg:"rgba(251,191,36,0.12)"},security:{color:"#f87171",bg:"rgba(248,113,113,0.12)"},specialized:{color:"#f59e0b",bg:"rgba(245,158,11,0.12)"},verified:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},anthropic:{color:"#f59e0b",bg:"rgba(245,158,11,0.12)"},published:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},draft:{color:"#6b7f95",bg:"rgba(255,255,255,0.06)"},review:{color:"#c678dd",bg:"rgba(198,120,221,0.12)"},rejected:{color:"#f87171",bg:"rgba(248,113,113,0.12)"},free:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"}};function Jy({label:t,variant:n,className:s}){const l=l0[n]||l0.draft;return i.jsx("span",{className:le("inline-flex items-center whitespace-nowrap font-sans select-none",s),style:{padding:"3px 8px",borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",lineHeight:1.4,color:l.color,background:l.bg},children:t})}function eS({price:t=0,size:n="sm"}){const s=!t||t===0,l={sm:"text-2xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-xs px-3 py-1"};return i.jsx("span",{className:`inline-flex items-center font-mono font-semibold rounded whitespace-nowrap ${l[n]||l.sm} ${s?"bg-success/12 text-success":"bg-white/8 text-text-1"}`,children:s?"Free":`$${t.toFixed(2)}`})}function tS({type:t="verified",size:n=12}){const s=t==="claude-official"||t==="anthropic"?"#f59e0b":"#4ade80";return i.jsxs("svg",{width:n,height:n,viewBox:"0 0 20 20",fill:"none",className:"inline-block flex-shrink-0",children:[i.jsx("path",{d:"M10 0l2.36 3.15L16.18 2l.68 3.93L20.8 7.1l-1.87 3.52L20.8 14.14l-3.94 1.17-.68 3.93-3.82-1.15L10 21.24l-2.36-3.15-3.82 1.15-.68-3.93-3.94-1.17 1.87-3.52L-.8 7.1l3.94-1.17.68-3.93 3.82 1.15L10 0z",fill:s}),i.jsx("path",{d:"M7 10.5l2 2 4-4.5",fill:"none",stroke:"#24282f",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const aS="groove_favorites";function yh(){try{return JSON.parse(localStorage.getItem(aS)||"[]")}catch{return[]}}function oX(t){return yh().includes(t)}function cX(t){const n=yh(),s=n.indexOf(t);return s>=0?n.splice(s,1):n.push(t),localStorage.setItem(aS,JSON.stringify(n)),s<0}function uX(t){const n=new Set(yh());return t.map(s=>({...s,favorited:n.has(s.id)}))}function dX({filled:t,size:n=16}){return i.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:t?"#f87171":"none",stroke:t?"#f87171":"rgba(255,255,255,0.3)",strokeWidth:"2",children:i.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})})}function OX(){return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function fX({skill:t,onClick:n}){var u,d;const[s,l]=v.useState(()=>oX(t.id));function o(O){O.stopPropagation(),l(cX(t.id))}return i.jsxs("div",{onClick:()=>n==null?void 0:n(t),className:le("flex flex-col cursor-pointer group","bg-surface-1 border border-border-subtle rounded-md","hover:border-accent/30 hover:bg-surface-2","transition-all duration-150"),style:{padding:20,minHeight:280},children:[i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 bg-accent/12 text-[20px]",children:t.icon||((d=(u=t.name)==null?void 0:u[0])==null?void 0:d.toUpperCase())||"?"}),i.jsx("button",{onClick:o,className:"opacity-40 group-hover:opacity-80 hover:!opacity-100 transition-opacity cursor-pointer bg-transparent border-0 p-0",children:i.jsx(dX,{filled:s})})]}),i.jsx("div",{className:"mt-3 text-[15px] font-semibold text-text-0 font-sans line-clamp-2 leading-snug",children:t.name}),i.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-text-3 font-sans",children:[i.jsxs("span",{children:["by ",t.author||"Community"]}),(t.source==="claude-official"||t.verified)&&i.jsx(tS,{type:t.source,size:12})]}),i.jsx("div",{className:"mt-2.5 text-xs text-text-2 font-sans line-clamp-3 flex-1 leading-relaxed",children:t.description}),i.jsx("div",{className:"mt-3",children:i.jsx(Jy,{label:t.category||"general",variant:t.category||"draft"})}),i.jsx("div",{className:"h-px bg-border-subtle my-3"}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(Ky,{rating:t.rating||0,count:t.rating_count||t.ratingCount||0,size:"sm"}),i.jsxs("span",{className:"flex items-center gap-1 text-xs text-text-3 font-mono",children:[i.jsx(OX,{}),Je(t.downloads||0)]}),i.jsx(eS,{price:t.price||0,size:"sm"})]})]})}function nS(){return i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md animate-pulse",style:{padding:20,minHeight:280},children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-surface-4"}),i.jsx("div",{className:"mt-3 h-4 w-[70%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-2 h-3 w-[40%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-3.5 h-3 w-full rounded bg-surface-4"}),i.jsx("div",{className:"mt-1.5 h-3 w-[90%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-1.5 h-3 w-[60%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-3.5 h-5 w-[50px] rounded bg-surface-4"}),i.jsx("div",{className:"h-px bg-surface-4 my-3"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("div",{className:"h-3 w-16 rounded bg-surface-4"}),i.jsx("div",{className:"h-3 w-12 rounded bg-surface-4"}),i.jsx("div",{className:"h-3 w-10 rounded bg-surface-4"})]})]})}const hX={slack:"https://cdn.simpleicons.org/slack/E01E5A",github:"https://cdn.simpleicons.org/github/white",stripe:"https://cdn.simpleicons.org/stripe/635BFF",gmail:"https://cdn.simpleicons.org/gmail/EA4335","google-calendar":"https://cdn.simpleicons.org/googlecalendar/4285F4","google-drive":"https://cdn.simpleicons.org/googledrive/4285F4","google-maps":"https://cdn.simpleicons.org/googlemaps/4285F4",postgres:"https://cdn.simpleicons.org/postgresql/4169E1",notion:"https://cdn.simpleicons.org/notion/white",discord:"https://cdn.simpleicons.org/discord/5865F2",linear:"https://cdn.simpleicons.org/linear/5E6AD2","brave-search":"https://cdn.simpleicons.org/brave/FB542B","home-assistant":"https://cdn.simpleicons.org/homeassistant/18BCF2"};function mX({item:t,size:n=40}){const s=hX[t.id];if(s)return i.jsxs("div",{className:"rounded-md bg-surface-4 flex items-center justify-center flex-shrink-0 overflow-hidden",style:{width:n,height:n},children:[i.jsx("img",{src:s,alt:t.name,className:"w-5 h-5",onError:u=>{u.target.style.display="none",u.target.nextSibling.style.display="flex"}}),i.jsx("div",{className:"hidden items-center justify-center w-full h-full text-lg font-bold font-sans text-text-1",children:(t.name||"?")[0]})]});const l=(t.name||"?")[0].toUpperCase(),o=t.name?t.name.charCodeAt(0)*37%360:200;return i.jsx("div",{className:"rounded-md flex items-center justify-center flex-shrink-0 text-lg font-bold font-sans",style:{width:n,height:n,background:`hsl(${o}, 40%, 18%)`,color:`hsl(${o}, 60%, 65%)`},children:l})}function pX({item:t,onClick:n,className:s}){var o;const l=t.installed;return i.jsxs("button",{onClick:()=>n(t),className:le("flex flex-col p-5 rounded-md border border-border-subtle bg-surface-1 text-left","hover:border-accent/30 hover:bg-surface-2","transition-all duration-150 cursor-pointer group",s),style:{minHeight:200},children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx(mX,{item:t,size:36}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[14px] font-semibold text-text-0 font-sans truncate",children:t.name}),(t.verified||t.verified==="mcp-official")&&i.jsx(Ir,{size:11,className:"text-accent flex-shrink-0"})]}),i.jsx("span",{className:"text-2xs text-text-3 font-sans",children:t.author||"Community"})]})]}),i.jsx("p",{className:"text-xs text-text-2 font-sans line-clamp-3 mb-3 flex-1 leading-relaxed",children:t.description}),i.jsx("div",{className:"h-px bg-border-subtle my-2"}),i.jsxs("div",{className:"flex items-center gap-3 text-2xs text-text-3 font-sans",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Df,{size:10}),Je(t.downloads||0)]}),(t.rating||0)>0&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Db,{size:10,className:"text-warning",fill:"currentColor"}),(o=t.rating)==null?void 0:o.toFixed(1)]}),i.jsx("span",{className:"flex-1"}),l&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Installed"})]})]})}function sS({value:t,onChange:n,placeholder:s="Search skills, tags, authors...",large:l}){const[o,u]=v.useState(t||""),d=v.useRef(null);v.useEffect(()=>{u(t||"")},[t]);function O(m){const p=m.target.value;u(p),clearTimeout(d.current),d.current=setTimeout(()=>n(p),300)}return i.jsxs("div",{className:"relative w-full",children:[i.jsx(Cs,{size:16,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-text-4 pointer-events-none"}),i.jsx("input",{value:o,onChange:O,placeholder:s,className:le("w-full font-sans outline-none","bg-surface-0 border border-border text-text-0 placeholder:text-text-4","focus:border-accent/40 transition-colors",l?"py-3 pl-11 pr-12 text-[15px] rounded-lg":"py-2.5 pl-10 pr-3 text-sm rounded-md")}),l&&i.jsx("kbd",{className:"absolute right-3.5 top-1/2 -translate-y-1/2 bg-surface-4 text-text-4 px-2 py-0.5 rounded text-xs font-mono",children:"/"})]})}const xX=[{id:"",label:"All"},{id:"design",label:"Design"},{id:"quality",label:"Quality"},{id:"devtools",label:"Dev Tools"},{id:"workflow",label:"Workflow"},{id:"security",label:"Security"},{id:"specialized",label:"Specialized"}];function gX({selected:t="",categories:n=xX,onSelect:s}){return i.jsx("div",{className:"flex gap-2 overflow-x-auto",style:{scrollbarWidth:"none"},children:n.map(l=>{const o=t===l.id;return i.jsx("button",{onClick:()=>s(l.id),className:le("whitespace-nowrap font-sans cursor-pointer select-none transition-all text-[13px] rounded-full border",o?"bg-accent text-surface-0 border-accent font-semibold":"bg-surface-1 text-text-3 border-border-subtle hover:text-text-1 hover:border-border font-medium"),style:{padding:"7px 16px"},children:l.label},l.id)})})}function Wc(){const t=L(n=>n.addToast);return{success:(n,s)=>t("success",n,s),error:(n,s)=>t("error",n,s),info:(n,s)=>t("info",n,s),warning:(n,s)=>t("warning",n,s)}}function bX({skill:t,onBack:n}){var w,T,k;const s=Wc(),[l,o]=v.useState(""),[u,d]=v.useState(!1),[O,m]=v.useState(!1),[p,x]=v.useState(t.installed),[g,b]=v.useState(!0);v.useEffect(()=>{b(!0),te.get(`/skills/${t.id}/content`).then(P=>{o(P.content||""),d(P.requiresPurchase||!1)}).catch(()=>{}).finally(()=>b(!1))},[t.id]);async function y(){m(!0);try{await te.post(`/skills/${t.id}/install`),x(!0),s.success(`${t.name} installed`)}catch(P){s.error("Install failed",P.message)}m(!1)}async function Q(){const{marketplaceAuthenticated:P,marketplaceLogin:$,marketplaceCheckout:_}=L.getState();if(!P){$();return}try{await _(t.id)}catch{}}return i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-6 py-5",children:[i.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-text-3 font-sans hover:text-text-0 cursor-pointer bg-transparent border-0 mb-4",children:[i.jsx(Tb,{size:14})," Back"]}),i.jsxs("div",{className:"flex gap-8",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-11 h-11 rounded-lg flex items-center justify-center flex-shrink-0 bg-accent/10 border border-accent/20 text-[22px]",children:t.icon||((T=(w=t.name)==null?void 0:w[0])==null?void 0:T.toUpperCase())}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h1",{className:"text-lg font-bold text-text-0 font-sans",children:t.name}),i.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-text-3 font-sans",children:[i.jsx("span",{children:t.author||"Community"}),(t.source==="claude-official"||t.verified)&&i.jsx(tS,{type:t.source,size:13})]})]})]}),i.jsx("p",{className:"mt-3 text-sm text-text-2 font-sans leading-relaxed",children:t.description}),((k=t.tags)==null?void 0:k.length)>0&&i.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:t.tags.map(P=>i.jsx("span",{className:"text-2xs text-text-3 font-sans px-2 py-0.5 rounded bg-surface-4",children:P},P))}),i.jsx("div",{className:"h-px bg-border-subtle my-5"}),g?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-3 w-48 bg-surface-4 rounded animate-pulse"}),i.jsx("div",{className:"h-3 w-full bg-surface-4 rounded animate-pulse"}),i.jsx("div",{className:"h-3 w-3/4 bg-surface-4 rounded animate-pulse"})]}):l?i.jsxs("div",{className:"text-sm text-text-2 font-sans leading-relaxed",children:[i.jsx("h2",{className:"text-sm font-semibold text-text-0 mb-2",children:"About"}),i.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:l})]}):u?i.jsxs("div",{className:"bg-warning/5 border border-warning/15 rounded-lg px-4 py-3",children:[i.jsx("p",{className:"text-sm text-text-1 font-sans font-medium",children:"Paid skill — purchase to view content"}),i.jsx("p",{className:"text-xs text-text-3 font-sans mt-1",children:"Sign in and purchase this skill to access its full instructions."})]}):i.jsx("p",{className:"text-xs text-text-4 font-sans",children:"Content loading failed — check your connection."})]}),i.jsx("div",{className:"w-[240px] flex-shrink-0",children:i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-lg p-4 sticky top-4",children:[i.jsx(eS,{price:t.price||0,size:"md"}),u&&!p?i.jsxs("button",{onClick:Q,className:"w-full mt-3 py-2 px-3 text-xs font-sans font-semibold rounded cursor-pointer transition-all hover:opacity-85 flex items-center justify-center gap-2 border bg-warning/15 text-warning border-warning/20 hover:bg-warning/25",children:["Buy $",(t.price||0).toFixed(2)]}):i.jsx("button",{onClick:y,disabled:O||p,className:`w-full mt-3 py-2 px-3 text-xs font-sans font-semibold rounded cursor-pointer transition-all hover:opacity-85 disabled:opacity-60 disabled:cursor-not-allowed flex items-center justify-center gap-2 border ${p?"bg-success/15 text-success border-success/20":"bg-accent/15 text-accent border-accent/20 hover:bg-accent/25"}`,children:O?"Installing...":p?"✓ Installed":"Install"}),i.jsx("div",{className:"mt-4 flex flex-col gap-2.5",children:[["Downloads",i.jsx("span",{className:"font-mono text-text-0",children:Je(t.downloads||0)},"d")],["Rating",i.jsx(Ky,{rating:t.rating||0,count:t.rating_count||t.ratingCount,size:"sm"},"r")],["Version",i.jsx("span",{className:"font-mono text-text-0",children:t.version||"1.0.0"},"v")],["Category",i.jsx(Jy,{label:t.category||"general",variant:t.category||"draft"},"c")],["Source",i.jsx("span",{className:"text-text-0",children:t.source==="claude-official"?"Anthropic":"Community"},"s")]].map(([P,$])=>i.jsxs("div",{className:"flex justify-between items-center text-xs font-sans",children:[i.jsx("span",{className:"text-text-3",children:P}),$]},P))})]})})]})]})})}function vX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),[o,u]=v.useState(""),[d,O]=v.useState(""),[m,p]=v.useState("popular"),[x,g]=v.useState(null);return v.useEffect(()=>{l(!0);const b=new URLSearchParams;o&&b.set("search",o),d&&b.set("category",d),m&&b.set("sort",m),te.get(`/skills/registry?${b}`).then(y=>n(uX(y.skills||y.items||(Array.isArray(y)?y:[])))).catch(()=>n([])).finally(()=>l(!1))},[o,d,m]),x?i.jsx(bX,{skill:x,onBack:()=>g(null)}):i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-72",children:i.jsx(sS,{value:o,onChange:u})}),i.jsx(gX,{selected:d,onSelect:O}),i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsxs("select",{value:m,onChange:b=>p(b.target.value),className:"appearance-none font-sans cursor-pointer pr-7 py-2 pl-3 text-xs bg-surface-0 border border-border-subtle rounded text-text-1 focus:outline-none",children:[i.jsx("option",{value:"popular",children:"Popular"}),i.jsx("option",{value:"rating",children:"Top Rated"}),i.jsx("option",{value:"newest",children:"Newest"}),i.jsx("option",{value:"name",children:"A-Z"})]}),i.jsx(Hn,{size:12,className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-4 pointer-events-none"})]}),i.jsx("span",{className:"text-2xs text-text-4 font-mono flex-shrink-0",children:t.length})]}),i.jsx("div",{className:"mt-4 grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:s?Array.from({length:8}).map((b,y)=>i.jsx(nS,{},y)):t.map(b=>i.jsx(fX,{skill:b,onClick:g},b.id))}),!s&&t.length===0&&i.jsx("div",{className:"text-center py-16 text-text-4 font-sans text-sm",children:"No skills found."})]})})}function yX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),[o,u]=v.useState(""),d=Wc();return v.useEffect(()=>{l(!0),te.get(`/integrations/registry?search=${encodeURIComponent(o)}`).then(O=>n(O.integrations||O.items||(Array.isArray(O)?O:[]))).catch(()=>n([])).finally(()=>l(!1))},[o]),i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-72",children:i.jsx(sS,{value:o,onChange:u,placeholder:"Search integrations..."})}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"text-2xs text-text-4 font-mono flex-shrink-0",children:t.length})]}),i.jsx("div",{className:"mt-4 grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:s?Array.from({length:6}).map((O,m)=>i.jsx(nS,{},m)):t.map(O=>i.jsx(pX,{item:O,onClick:()=>d.info(`${O.name} — install via CLI: groove integrations install ${O.id}`)},O.id))}),!s&&t.length===0&&i.jsx("div",{className:"text-center py-16 text-text-4 font-sans text-sm",children:"No integrations found."})]})})}function SX(){const t=L(g=>g.marketplaceAuthenticated),n=L(g=>g.marketplaceLogin),[s,l]=v.useState([]),[o,u]=v.useState([]),[d,O]=v.useState(!0),m=Wc(),p=v.useRef(null);v.useEffect(()=>{O(!0),Promise.all([t?te.get("/auth/purchases").then(g=>g.purchases||[]).catch(()=>[]):Promise.resolve([]),te.get("/skills/installed").then(g=>Array.isArray(g)?g:g.skills||[]).catch(()=>[])]).then(([g,b])=>{l(g),u(b)}).finally(()=>O(!1))},[t]);async function x(g){var y;const b=(y=g.target.files)==null?void 0:y[0];if(b){try{const Q=await b.text(),w=b.name.replace(/\.md$/i,"");await te.post("/skills/import",{name:w,content:Q}),m.success(`Imported "${w}"`);const T=await te.get("/skills/installed");u(Array.isArray(T)?T:T.skills||[])}catch(Q){m.error("Import failed",Q.message)}g.target.value=""}}return d?i.jsx("div",{className:"p-5 space-y-3",children:[...Array(4)].map((g,b)=>i.jsx(ra,{className:"h-14 rounded-md"},b))}):i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4 space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{ref:p,type:"file",accept:".md",onChange:x,className:"hidden"}),i.jsxs(je,{variant:"secondary",size:"md",onClick:()=>{var g;return(g=p.current)==null?void 0:g.click()},className:"gap-1.5",children:[i.jsx($N,{size:13}),"Import .md Skill"]}),i.jsx("span",{className:"text-2xs text-text-4 font-sans",children:"Drop a markdown skill file to install locally"})]}),t&&s.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider mb-3 flex items-center gap-1.5",children:[i.jsx(yO,{size:12}),"Purchases (",s.length,")"]}),i.jsx("div",{className:"space-y-1.5",children:s.map(g=>{var b,y;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md bg-surface-1 border border-border-subtle",children:[i.jsx("div",{className:"w-8 h-8 rounded-md bg-accent/10 flex items-center justify-center text-sm flex-shrink-0",children:g.skill_icon||((y=(b=g.skill_name)==null?void 0:b[0])==null?void 0:y.toUpperCase())||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:g.skill_name||g.skill_id}),i.jsxs("div",{className:"text-2xs text-text-4 font-sans",children:["$",(g.amount||0).toFixed(2)," · ",vt(g.created_at)]})]}),i.jsx(Ge,{variant:"success",className:"text-2xs flex-shrink-0",children:"Owned"})]},g.id||g.skill_id)})})]}),t&&s.length===0&&i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(yO,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-3 font-sans",children:"No purchases yet"})]}),!t&&i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(yO,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-2 font-sans mb-3",children:"Sign in to see your purchases"}),i.jsxs(je,{variant:"primary",size:"sm",onClick:n,className:"gap-1.5 mx-auto",children:[i.jsx(Hf,{size:12})," Sign in"]})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider mb-3 flex items-center gap-1.5",children:[i.jsx(qb,{size:12}),"Installed (",o.length,")"]}),o.length===0?i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(Df,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-3 font-sans",children:"No skills installed — browse the Skills tab or import a .md file"})]}):i.jsx("div",{className:"space-y-1.5",children:o.map(g=>{var b,y;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md bg-surface-1 border border-border-subtle group",children:[i.jsx("div",{className:"w-8 h-8 rounded-md bg-accent/10 flex items-center justify-center text-sm flex-shrink-0",children:g.icon||((y=(b=g.name)==null?void 0:b[0])==null?void 0:y.toUpperCase())||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:g.name||g.id}),i.jsx("div",{className:"text-2xs text-text-3 font-sans truncate",children:g.description||g.category||"local skill"})]}),i.jsx(Ge,{variant:"accent",className:"text-2xs flex-shrink-0",children:"Installed"})]},g.id)})})]})]})})}function QX(){const t=L(o=>o.marketplaceAuthenticated),n=L(o=>o.marketplaceUser),s=L(o=>o.marketplaceLogin),l=L(o=>o.marketplaceLogout);return t?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-surface-3 border border-border-subtle",children:[i.jsx("div",{className:"w-4 h-4 rounded-full bg-accent/20 flex items-center justify-center",children:i.jsx(Wb,{size:9,className:"text-accent"})}),i.jsx("span",{className:"text-xs text-text-0 font-sans font-medium max-w-[120px] truncate",children:(n==null?void 0:n.displayName)||(n==null?void 0:n.id)||"Account"})]}),i.jsx("button",{onClick:l,className:"flex items-center gap-1 px-2 py-1.5 rounded text-xs text-text-3 hover:text-text-0 hover:bg-surface-3 font-sans cursor-pointer transition-colors",children:i.jsx(Zb,{size:11})})]}):i.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold font-sans text-text-0 bg-accent/15 border border-accent/25 rounded hover:bg-accent/25 cursor-pointer transition-colors",children:[i.jsx(Hf,{size:12}),"Sign in"]})}function jX(){const[t,n]=v.useState("skills"),s=[{id:"skills",label:"Skills",icon:Lr},{id:"integrations",label:"Integrations",icon:Mb},{id:"library",label:"My Library",icon:qb}];return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"flex-shrink-0 bg-surface-1 border-b border-border-subtle",children:i.jsxs("div",{className:"flex items-center px-5 h-11",children:[i.jsx("div",{className:"flex items-center",children:s.map(l=>{const o=l.icon;return i.jsxs("button",{onClick:()=>n(l.id),className:`flex items-center gap-1.5 px-3 py-2.5 text-xs font-semibold font-sans cursor-pointer select-none border-b-2 -mb-px transition-colors ${t===l.id?"border-accent text-text-0":"border-transparent text-text-3 hover:text-text-1"}`,children:[i.jsx(o,{size:12}),l.label]},l.id)})}),i.jsx("div",{className:"flex-1"}),i.jsx(QX,{})]})}),i.jsxs("div",{className:"flex-1 min-h-0",children:[t==="skills"&&i.jsx(vX,{}),t==="integrations"&&i.jsx(yX,{}),t==="library"&&i.jsx(SX,{})]})]})}function wX(){const t=L(u=>u.teams),n=L(u=>u.agents),s=L(u=>u.activeTeamId),l=L(u=>u.deleteTeam),o=L(u=>u.addToast);return t.length===0?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx(hi,{size:28,className:"mx-auto text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No teams yet"}),i.jsx("p",{className:"text-2xs font-sans text-text-4",children:"Teams are created when you spawn agents or launch a planner"})]})}):i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"p-4 space-y-3",children:t.map(u=>{const d=n.filter(y=>y.teamId===u.id),O=d.filter(y=>y.status==="running"||y.status==="starting"),m=d.filter(y=>y.status==="completed"),p=d.filter(y=>y.status==="crashed"),x=d.reduce((y,Q)=>y+(Q.tokensUsed||0),0),g=d.reduce((y,Q)=>y+(Q.costUsd||0),0),b=u.id===s;return i.jsxs("div",{className:le("rounded-md border bg-surface-1 overflow-hidden transition-colors",b?"border-accent/30":"border-border-subtle"),children:[i.jsxs("div",{className:"px-4 py-3 flex items-center gap-3",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm font-semibold text-text-0 font-sans",children:u.name}),b&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Active"})]}),u.workingDir&&i.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[i.jsx(Rb,{size:10,className:"text-text-4"}),i.jsx("span",{className:"text-2xs font-mono text-text-3 truncate",children:u.workingDir})]})]}),i.jsx("button",{onClick:()=>{if(d.some(y=>y.status==="running")){o("error","Stop running agents first");return}l(u.id)},className:"p-1.5 text-text-4 hover:text-danger rounded transition-colors cursor-pointer",title:"Delete team",children:i.jsx(fi,{size:13})})]}),i.jsxs("div",{className:"px-4 py-2.5 border-t border-border-subtle bg-surface-0 flex items-center gap-4",children:[i.jsx(gl,{label:"Agents",value:d.length}),i.jsx(gl,{label:"Running",value:O.length,color:O.length>0?"text-success":void 0}),i.jsx(gl,{label:"Done",value:m.length}),i.jsx(gl,{label:"Crashed",value:p.length,color:p.length>0?"text-danger":void 0}),i.jsx("div",{className:"flex-1"}),i.jsx(gl,{label:"Tokens",value:Je(x)}),g>0&&i.jsx(gl,{label:"Cost",value:Mc(g)})]}),d.length>0&&i.jsx("div",{className:"border-t border-border-subtle",children:d.map(y=>i.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b border-border-subtle last:border-b-0",children:[i.jsx(ws,{status:y.status,size:"sm"}),i.jsx("span",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:y.name}),i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase",children:y.role}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"text-2xs font-mono text-text-2 tabular-nums",children:Je(y.tokensUsed||0)})]},y.id))})]},u.id)})})})}function gl({label:t,value:n,color:s}){return i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:le("text-xs font-mono tabular-nums",s||"text-text-1"),children:n}),i.jsx("div",{className:"text-2xs font-mono text-text-4 uppercase tracking-wider",children:t})]})}function kX(){const t=L(l=>l.pendingApprovals),n=L(l=>l.approveRequest),s=L(l=>l.rejectRequest);return t.length===0?null:i.jsxs("div",{className:"px-4 pt-4 space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(qc,{size:12,className:"text-warning"}),i.jsxs("span",{className:"text-2xs font-mono text-warning uppercase tracking-wider",children:["Pending (",t.length,")"]})]}),t.map(l=>{var o,u,d;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-md bg-warning/5 border border-warning/20",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"text-xs text-text-0 font-sans font-medium truncate",children:[l.agentName,": ",((o=l.action)==null?void 0:o.description)||((u=l.action)==null?void 0:u.type)||"action"]}),((d=l.action)==null?void 0:d.filePath)&&i.jsx("div",{className:"text-2xs font-mono text-text-3 truncate mt-0.5",children:l.action.filePath}),i.jsx("div",{className:"text-2xs text-text-4 font-mono mt-0.5",children:vt(l.requestedAt)})]}),i.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[i.jsxs(je,{variant:"primary",size:"sm",onClick:()=>n(l.id),className:"h-7 px-2.5 gap-1 text-2xs",children:[i.jsx(Gb,{size:10})," Approve"]}),i.jsxs(je,{variant:"danger",size:"sm",onClick:()=>s(l.id),className:"h-7 px-2.5 gap-1 text-2xs",children:[i.jsx(pN,{size:10})," Reject"]})]})]},l.id)})]})}function $X(){const t=L(m=>m.resolvedApprovals),[n,s]=v.useState([]),[l,o]=v.useState(!0);v.useEffect(()=>{const m=setInterval(u,4e3);return u(),()=>clearInterval(m)},[]);async function u(){try{const m=await te.get("/pm/history");s(m.history||m||[])}catch{}o(!1)}const d=new Set,O=[...t,...n].filter(m=>{const p=m.id||`${m.agentName}-${m.timestamp}`;return d.has(p)?!1:(d.add(p),!0)});return i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.jsx(kX,{}),i.jsxs("div",{className:"p-4 space-y-1.5",children:[l&&O.length===0&&i.jsx("div",{className:"text-center py-12 text-text-4 font-mono text-xs",children:"Loading..."}),!l&&O.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Ir,{size:24,className:"mx-auto mb-2 text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No approval history"}),i.jsx("p",{className:"text-2xs text-text-4 font-sans mt-1",children:"Approvals appear when agents use Auto permission mode"})]}),O.map((m,p)=>{var g;const x=m.status==="approved"||m.verdict==="approved";return i.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-md bg-surface-0 border border-border-subtle",children:[x?i.jsx(Ir,{size:12,className:"text-success flex-shrink-0"}):i.jsx(Nb,{size:12,className:"text-danger flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"text-xs text-text-1 font-sans truncate",children:[i.jsx("span",{className:"font-medium text-text-0",children:m.agentName}),i.jsx("span",{className:"text-text-3 mx-1",children:"·"}),i.jsx("span",{children:((g=m.action)==null?void 0:g.description)||m.action||"action"})]}),m.reason&&i.jsx("div",{className:"text-2xs text-text-3 font-sans truncate mt-0.5",children:m.reason})]}),i.jsx("span",{className:"text-2xs font-mono text-text-4 flex-shrink-0",children:vt(m.resolvedAt||m.timestamp)})]},m.id||p)})]})]})}function TX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),o=Wc();v.useEffect(()=>{const O=setInterval(u,1e4);return u(),()=>clearInterval(O)},[]);async function u(){try{const O=await te.get("/schedules");n(O.schedules||O||[])}catch{}l(!1)}async function d(O,m){try{await te.post(`/schedules/${O}/${m?"disable":"enable"}`),u()}catch(p){o.error("Failed to toggle schedule",p.message)}}return i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsxs("div",{className:"p-4 space-y-2",children:[s&&t.length===0&&i.jsx("div",{className:"text-center py-12 text-text-4 font-mono text-xs",children:"Loading..."}),!s&&t.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Oc,{size:24,className:"mx-auto mb-2 text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No schedules configured"}),i.jsx("p",{className:"text-2xs text-text-4 font-sans mt-1",children:"Use the CLI to create agent schedules"})]}),t.map(O=>i.jsxs("div",{className:"rounded-md border border-border-subtle bg-surface-0 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-text-0 font-sans",children:O.name}),i.jsx(Ge,{variant:O.enabled?"success":"default",className:"text-2xs",children:O.enabled?"Active":"Paused"})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("span",{className:"text-2xs font-mono text-text-2",children:O.cron}),i.jsx("span",{className:"text-2xs text-text-4",children:"·"}),i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase",children:O.role}),O.teamId&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-2xs text-text-4",children:"·"}),i.jsx("span",{className:"text-2xs font-sans text-text-3",children:O.teamName||O.teamId})]})]}),O.prompt&&i.jsx("div",{className:"text-2xs font-sans text-text-4 mt-1 truncate",children:O.prompt})]}),i.jsx(je,{variant:"secondary",size:"sm",onClick:()=>d(O.id,O.enabled),className:"h-7 px-2.5 gap-1 text-2xs",children:O.enabled?i.jsxs(i.Fragment,{children:[i.jsx(DT,{size:10})," Pause"]}):i.jsxs(i.Fragment,{children:[i.jsx(FT,{size:10})," Enable"]})})]}),O.lastRunAt&&i.jsxs("div",{className:"px-4 py-1.5 border-t border-border-subtle bg-surface-1 text-2xs font-mono text-text-4",children:["Last run: ",vt(O.lastRunAt),O.nextRunAt&&i.jsxs("span",{className:"ml-3",children:["Next: ",vt(O.nextRunAt)]})]})]},O.id))]})})}function NX(){return i.jsxs(Iy,{defaultValue:"dashboard",className:"flex flex-col h-full",children:[i.jsxs("div",{className:"px-4 pt-3 bg-surface-1 border-b border-border",children:[i.jsx("div",{className:"flex items-center gap-4 mb-0",children:i.jsx("h2",{className:"text-xs font-semibold text-text-0 font-sans tracking-wide uppercase",children:"Management"})}),i.jsxs(Fy,{className:"border-b-0",children:[i.jsxs(Nl,{value:"dashboard",className:"inline-flex items-center gap-1.5",children:[i.jsx(QT,{size:12}),"Teams"]}),i.jsxs(Nl,{value:"approvals",className:"inline-flex items-center gap-1.5",children:[i.jsx(wT,{size:12}),"Approvals"]}),i.jsxs(Nl,{value:"schedules",className:"inline-flex items-center gap-1.5",children:[i.jsx(Oc,{size:12}),"Schedules"]})]})]}),i.jsx(Pl,{value:"dashboard",className:"flex-1 min-h-0",children:i.jsx(wX,{})}),i.jsx(Pl,{value:"approvals",className:"flex-1 min-h-0",children:i.jsx($X,{})}),i.jsx(Pl,{value:"schedules",className:"flex-1 min-h-0",children:i.jsx(TX,{})})]})}const PX={code:"Code",general:"General"},zX={light:"text-success",medium:"text-accent",heavy:"text-warning"};function RX(t){return t<1?`${Math.round(t*1024)} MB`:`${t} GB`}function lS({hardware:t}){if(!t)return null;const{totalRamGb:n,gpu:s,isAppleSilicon:l}=t;return i.jsxs("div",{className:"flex items-center gap-3 bg-surface-0 rounded-lg border border-border-subtle px-3 py-2.5",children:[i.jsx(If,{size:14,className:"text-text-3 flex-shrink-0"}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2 text-xs font-sans",children:[i.jsxs("span",{className:"text-text-0 font-semibold",children:[n," GB RAM"]}),s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-text-4",children:"·"}),i.jsx("span",{className:"text-text-2",children:s.name})]}),l&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Unified Memory"})]})})]})}function CX({onRecheck:t}){const[n,s]=v.useState(null),[l,o]=v.useState(!1),[u,d]=v.useState(!1),[O,m]=v.useState(!1),p=L(_=>_.addToast);v.useEffect(()=>{te.post("/providers/ollama/check").then(s).catch(()=>{})},[]);async function x(){o(!0);try{const _=await te.post("/providers/ollama/check");s(_),_.installed&&_.serverRunning?(p("success","Ollama is ready!"),t()):_.installed?p("info","Ollama installed — server needs to start"):p("info","Ollama not found — install and try again")}catch{}o(!1)}async function g(){d(!0);try{if((await te.post("/providers/ollama/serve")).ok){p("success","Ollama server started!");let G=!1;for(let X=0;X<5;X++){await new Promise(N=>setTimeout(N,2e3));const C=await te.post("/providers/ollama/check");if(s(C),C.serverRunning){G=!0;break}}G&&t()}}catch(_){p("error","Could not start server",_.message)}d(!1)}function b(_){navigator.clipboard.writeText(_),m(!0),setTimeout(()=>m(!1),2e3)}if(!n)return i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Loading..."});const{hardware:y,install:Q,requirements:w,installed:T,serverRunning:k}=n,P=y.totalRamGb>=w.minRAM,$=y.recommended;return i.jsxs("div",{className:"space-y-3 p-3",children:[i.jsx(lS,{hardware:y}),P?i.jsxs("div",{className:"flex items-start gap-2 bg-success/8 border border-success/20 rounded-lg px-3 py-2.5",children:[i.jsx(ia,{size:14,className:"text-success flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans",children:[i.jsx("span",{className:"text-success font-semibold",children:"Your system is ready."}),i.jsx("span",{className:"text-text-2 ml-1",children:$.code?`Recommended: ${$.code}`:`${y.totalRamGb} GB RAM available`})]})]}):i.jsxs("div",{className:"flex items-start gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans text-text-2",children:[i.jsxs("span",{className:"text-warning font-semibold",children:[y.totalRamGb," GB RAM detected."]})," ","Minimum ",w.minRAM," GB needed. Smallest models may still work."]})]}),T&&!k&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-start gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans text-text-2",children:[i.jsx("span",{className:"text-warning font-semibold",children:"Ollama installed but server not running."})," ","The server needs to be running to pull and use models."]})]}),i.jsxs(je,{variant:"primary",size:"md",onClick:g,disabled:u,className:"w-full gap-1.5",children:[i.jsx(Pa,{size:12}),u?"Starting...":"Start Ollama Server"]})]}),!T&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"text-xs font-semibold text-text-1 font-sans",children:"Install Ollama"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"flex-1 bg-surface-0 border border-border-subtle rounded-md px-3 py-2 text-xs font-mono text-text-1 truncate",children:Q.command}),i.jsxs(je,{variant:"secondary",size:"sm",onClick:()=>b(Q.command),className:"h-8 px-2.5 gap-1 flex-shrink-0",children:[O?i.jsx(ia,{size:12}):i.jsx(ff,{size:12}),O?"Copied":"Copy"]})]}),Q.alt&&i.jsx("p",{className:"text-2xs text-text-4 font-sans",children:Q.alt})]}),i.jsxs(je,{variant:"secondary",size:"md",onClick:x,disabled:l,className:"w-full gap-1.5",children:[i.jsx(Jn,{size:12,className:l?"animate-spin":""}),l?"Checking...":T?"Check again":"I installed it — check again"]})]})}function XX({model:t,isInstalled:n,isRecommended:s,canRun:l,onPull:o,onDelete:u,pulling:d}){const O=d===t.id;return i.jsxs("div",{className:le("flex items-center gap-2 px-3 py-2 border-t border-border-subtle transition-colors",!l&&"opacity-40"),children:[n?i.jsx(ia,{size:12,className:"text-success flex-shrink-0"}):i.jsx("div",{className:"w-3"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 truncate",children:t.name}),s&&i.jsx(Db,{size:10,className:"text-warning flex-shrink-0"})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[i.jsx("span",{className:le("text-2xs font-semibold font-sans",zX[t.tier]),children:t.tier}),i.jsx("span",{className:"text-2xs text-text-4 font-sans",children:RX(t.sizeGb)}),i.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:["· ",t.ramGb," GB RAM"]})]})]}),n?i.jsx("button",{onClick:()=>u(t.id),className:"p-1.5 text-text-4 hover:text-danger rounded transition-colors cursor-pointer",title:"Remove model",children:i.jsx(fi,{size:12})}):l?i.jsx(je,{variant:"secondary",size:"sm",onClick:()=>o(t.id),disabled:!!d,className:"h-7 px-2 text-2xs gap-1",children:O?i.jsxs(i.Fragment,{children:[i.jsx(Jn,{size:10,className:"animate-spin"})," Pulling..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Df,{size:10})," Pull"]})}):i.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:["Needs ",t.ramGb," GB"]})]})}function _X({onStopped:t}){const[n,s]=v.useState(null),l=L(d=>d.addToast);async function o(){s("stopping");try{(await te.post("/providers/ollama/stop")).ok?(l("info","Ollama server stopped"),t&&t()):l("error","Could not stop server")}catch(d){l("error","Stop failed",d.message)}s(null)}async function u(){s("restarting");try{(await te.post("/providers/ollama/restart")).ok?l("success","Ollama server restarted"):l("error","Restart failed")}catch(d){l("error","Restart failed",d.message)}s(null)}return i.jsxs("div",{className:"flex items-center gap-2 bg-success/8 border border-success/20 rounded-lg px-3 py-2",children:[i.jsxs("span",{className:"relative flex-shrink-0 w-[6px] h-[6px]",children:[i.jsx("span",{className:"absolute inset-0 rounded-full bg-success"}),i.jsx("span",{className:"absolute inset-[-2px] rounded-full bg-success opacity-20 animate-pulse"})]}),i.jsx("span",{className:"text-xs font-sans text-success font-semibold",children:"Server Running"}),i.jsx("span",{className:"text-2xs font-mono text-text-4",children:":11434"}),i.jsx("div",{className:"flex-1"}),i.jsxs("button",{onClick:u,disabled:!!n,className:"flex items-center gap-1 text-2xs font-sans text-text-3 hover:text-accent cursor-pointer transition-colors disabled:opacity-40",children:[i.jsx(Jn,{size:10,className:n==="restarting"?"animate-spin":""}),n==="restarting"?"Restarting...":"Restart"]}),i.jsxs("button",{onClick:o,disabled:!!n,className:"flex items-center gap-1 text-2xs font-sans text-text-3 hover:text-danger cursor-pointer transition-colors disabled:opacity-40",children:[i.jsx(on,{size:10}),n==="stopping"?"Stopping...":"Stop"]})]})}function ZX({onModelChange:t}){var N,B;const[n,s]=v.useState(null),[l,o]=v.useState(null),[u,d]=v.useState("code"),[O,m]=v.useState(!1),[p,x]=v.useState(!1),g=L(V=>V.addToast),b=v.useRef(!1);function y(){te.get("/providers/ollama/models").then(V=>{var ne;s(V),!b.current&&((ne=V.installed)==null?void 0:ne.length)===0&&(b.current=!0,setTimeout(y,2e3))}).catch(()=>{})}v.useEffect(()=>{y()},[]);async function Q(V){o(V);try{await te.post("/providers/ollama/pull",{model:V}),g("success",`Pulled ${V}`),y(),t&&t()}catch(ne){g("error",`Pull failed: ${ne.message}`)}o(null)}async function w(V){try{await te.delete(`/providers/ollama/models/${encodeURIComponent(V)}`),g("info",`Removed ${V}`),y(),t&&t()}catch(ne){g("error",`Delete failed: ${ne.message}`)}}if(!n)return i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Loading..."});const{installed:T,catalog:k,hardware:P}=n,$=new Set(T.map(V=>V.id)),_=P.totalRamGb,G=[(N=P.recommended)==null?void 0:N.code,(B=P.recommended)==null?void 0:B.general].filter(Boolean),X=k.filter(V=>V.category===u),C=O?X:X.filter(V=>V.ramGb<=_);return p?i.jsxs("div",{className:"space-y-3 p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0"}),i.jsxs("span",{className:"text-xs font-sans text-text-2",children:[i.jsx("span",{className:"text-warning font-semibold",children:"Ollama server stopped."})," ","Start it again to pull and use models."]})]}),i.jsxs(je,{variant:"primary",size:"md",onClick:async()=>{try{(await te.post("/providers/ollama/serve")).ok&&(g("success","Ollama server started!"),x(!1),b.current=!1,setTimeout(y,2e3))}catch(V){g("error","Could not start server",V.message)}},className:"w-full gap-1.5",children:[i.jsx(Pa,{size:12}),"Start Ollama Server"]})]}):i.jsxs("div",{className:"space-y-2 p-3",children:[i.jsx(_X,{onStopped:()=>x(!0)}),i.jsx(lS,{hardware:P}),T.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-sans text-text-2",children:[i.jsx(Xb,{size:12,className:"text-text-3"}),i.jsx("span",{className:"font-semibold",children:T.length})," model",T.length!==1?"s":""," installed"]}),i.jsx("div",{className:"flex bg-surface-0 rounded-lg p-0.5 border border-border-subtle",children:Object.entries(PX).map(([V,ne])=>i.jsx("button",{onClick:()=>d(V),className:le("flex-1 px-3 py-1.5 text-2xs font-semibold font-sans rounded-md transition-all cursor-pointer",u===V?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:ne},V))}),i.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-0 overflow-hidden",children:[C.map(V=>i.jsx(XX,{model:V,isInstalled:$.has(V.id),isRecommended:G.includes(V.id),canRun:V.ramGb<=_,onPull:Q,onDelete:w,pulling:l},V.id)),C.length===0&&i.jsxs("div",{className:"px-3 py-4 text-center text-xs text-text-4 font-sans",children:["No ",u," models available for your hardware"]})]}),!O&&X.length>C.length&&i.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 text-2xs text-text-3 hover:text-accent font-sans cursor-pointer transition-colors",children:[i.jsx(Hn,{size:10}),"Show ",X.length-C.length," more (exceed your RAM)"]})]})}function rS({isInstalled:t,onModelChange:n}){const[s,l]=v.useState(!1),[o,u]=v.useState(!1);return v.useEffect(()=>{t?te.post("/providers/ollama/check").then(d=>{l(d.installed&&d.serverRunning),u(!0)}).catch(()=>u(!0)):u(!0)},[t]),o?s?i.jsx(ZX,{onModelChange:n}):i.jsx(CX,{onRecheck:()=>{l(!0),n&&n()}}):i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Checking Ollama..."})}var DO="focusScope.autoFocusOnMount",WO="focusScope.autoFocusOnUnmount",r0={bubbles:!1,cancelable:!0},AX="FocusScope",iS=v.forwardRef((t,n)=>{const{loop:s=!1,trapped:l=!1,onMountAutoFocus:o,onUnmountAutoFocus:u,...d}=t,[O,m]=v.useState(null),p=Rt(o),x=Rt(u),g=v.useRef(null),b=it(n,w=>m(w)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(l){let w=function($){if(y.paused||!O)return;const _=$.target;O.contains(_)?g.current=_:Vn(g.current,{select:!0})},T=function($){if(y.paused||!O)return;const _=$.relatedTarget;_!==null&&(O.contains(_)||Vn(g.current,{select:!0}))},k=function($){if(document.activeElement===document.body)for(const G of $)G.removedNodes.length>0&&Vn(O)};document.addEventListener("focusin",w),document.addEventListener("focusout",T);const P=new MutationObserver(k);return O&&P.observe(O,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",T),P.disconnect()}}},[l,O,y.paused]),v.useEffect(()=>{if(O){o0.add(y);const w=document.activeElement;if(!O.contains(w)){const k=new CustomEvent(DO,r0);O.addEventListener(DO,p),O.dispatchEvent(k),k.defaultPrevented||(EX(UX(oS(O)),{select:!0}),document.activeElement===w&&Vn(O))}return()=>{O.removeEventListener(DO,p),setTimeout(()=>{const k=new CustomEvent(WO,r0);O.addEventListener(WO,x),O.dispatchEvent(k),k.defaultPrevented||Vn(w??document.body,{select:!0}),O.removeEventListener(WO,x),o0.remove(y)},0)}}},[O,p,x,y]);const Q=v.useCallback(w=>{if(!s&&!l||y.paused)return;const T=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(T&&k){const P=w.currentTarget,[$,_]=qX(P);$&&_?!w.shiftKey&&k===_?(w.preventDefault(),s&&Vn($,{select:!0})):w.shiftKey&&k===$&&(w.preventDefault(),s&&Vn(_,{select:!0})):k===P&&w.preventDefault()}},[s,l,y.paused]);return i.jsx(Be.div,{tabIndex:-1,...d,ref:b,onKeyDown:Q})});iS.displayName=AX;function EX(t,{select:n=!1}={}){const s=document.activeElement;for(const l of t)if(Vn(l,{select:n}),document.activeElement!==s)return}function qX(t){const n=oS(t),s=i0(n,t),l=i0(n.reverse(),t);return[s,l]}function oS(t){const n=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const o=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||o?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)n.push(s.currentNode);return n}function i0(t,n){for(const s of t)if(!MX(s,{upTo:n}))return s}function MX(t,{upTo:n}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(n!==void 0&&t===n)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function YX(t){return t instanceof HTMLInputElement&&"select"in t}function Vn(t,{select:n=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&YX(t)&&n&&t.select()}}var o0=VX();function VX(){let t=[];return{add(n){const s=t[0];n!==s&&(s==null||s.pause()),t=c0(t,n),t.unshift(n)},remove(n){var s;t=c0(t,n),(s=t[0])==null||s.resume()}}}function c0(t,n){const s=[...t],l=s.indexOf(n);return l!==-1&&s.splice(l,1),s}function UX(t){return t.filter(n=>n.tagName!=="A")}var BO=0;function LX(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??u0()),document.body.insertAdjacentElement("beforeend",t[1]??u0()),BO++,()=>{BO===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),BO--}},[])}function u0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var wa=function(){return wa=Object.assign||function(n){for(var s,l=1,o=arguments.length;l<o;l++){s=arguments[l];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(n[u]=s[u])}return n},wa.apply(this,arguments)};function cS(t,n){var s={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&n.indexOf(l)<0&&(s[l]=t[l]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,l=Object.getOwnPropertySymbols(t);o<l.length;o++)n.indexOf(l[o])<0&&Object.prototype.propertyIsEnumerable.call(t,l[o])&&(s[l[o]]=t[l[o]]);return s}function GX(t,n,s){if(s||arguments.length===2)for(var l=0,o=n.length,u;l<o;l++)(u||!(l in n))&&(u||(u=Array.prototype.slice.call(n,0,l)),u[l]=n[l]);return t.concat(u||Array.prototype.slice.call(n))}var nc="right-scroll-bar-position",sc="width-before-scroll-bar",DX="with-scroll-bars-hidden",WX="--removed-body-scroll-bar-size";function HO(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function BX(t,n){var s=v.useState(function(){return{value:t,callback:n,facade:{get current(){return s.value},set current(l){var o=s.value;o!==l&&(s.value=l,s.callback(l,o))}}}})[0];return s.callback=n,s.facade}var HX=typeof window<"u"?v.useLayoutEffect:v.useEffect,d0=new WeakMap;function IX(t,n){var s=BX(null,function(l){return t.forEach(function(o){return HO(o,l)})});return HX(function(){var l=d0.get(s);if(l){var o=new Set(l),u=new Set(t),d=s.current;o.forEach(function(O){u.has(O)||HO(O,null)}),u.forEach(function(O){o.has(O)||HO(O,d)})}d0.set(s,t)},[t]),s}function FX(t){return t}function KX(t,n){n===void 0&&(n=FX);var s=[],l=!1,o={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(u){var d=n(u,l);return s.push(d),function(){s=s.filter(function(O){return O!==d})}},assignSyncMedium:function(u){for(l=!0;s.length;){var d=s;s=[],d.forEach(u)}s={push:function(O){return u(O)},filter:function(){return s}}},assignMedium:function(u){l=!0;var d=[];if(s.length){var O=s;s=[],O.forEach(u),d=s}var m=function(){var x=d;d=[],x.forEach(u)},p=function(){return Promise.resolve().then(m)};p(),s={push:function(x){d.push(x),p()},filter:function(x){return d=d.filter(x),s}}}};return o}function JX(t){t===void 0&&(t={});var n=KX(null);return n.options=wa({async:!0,ssr:!1},t),n}var uS=function(t){var n=t.sideCar,s=cS(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=n.read();if(!l)throw new Error("Sidecar medium not found");return v.createElement(l,wa({},s))};uS.isSideCarExport=!0;function e_(t,n){return t.useMedium(n),uS}var dS=JX(),IO=function(){},Bc=v.forwardRef(function(t,n){var s=v.useRef(null),l=v.useState({onScrollCapture:IO,onWheelCapture:IO,onTouchMoveCapture:IO}),o=l[0],u=l[1],d=t.forwardProps,O=t.children,m=t.className,p=t.removeScrollBar,x=t.enabled,g=t.shards,b=t.sideCar,y=t.noRelative,Q=t.noIsolation,w=t.inert,T=t.allowPinchZoom,k=t.as,P=k===void 0?"div":k,$=t.gapMode,_=cS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),G=b,X=IX([s,n]),C=wa(wa({},_),o);return v.createElement(v.Fragment,null,x&&v.createElement(G,{sideCar:dS,removeScrollBar:p,shards:g,noRelative:y,noIsolation:Q,inert:w,setCallbacks:u,allowPinchZoom:!!T,lockRef:s,gapMode:$}),d?v.cloneElement(v.Children.only(O),wa(wa({},C),{ref:X})):v.createElement(P,wa({},C,{className:m,ref:X}),O))});Bc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bc.classNames={fullWidth:sc,zeroRight:nc};var t_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function a_(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=t_();return n&&t.setAttribute("nonce",n),t}function n_(t,n){t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n))}function s_(t){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(t)}var l_=function(){var t=0,n=null;return{add:function(s){t==0&&(n=a_())&&(n_(n,s),s_(n)),t++},remove:function(){t--,!t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},r_=function(){var t=l_();return function(n,s){v.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&s])}},OS=function(){var t=r_(),n=function(s){var l=s.styles,o=s.dynamic;return t(l,o),null};return n},i_={left:0,top:0,right:0,gap:0},FO=function(t){return parseInt(t||"",10)||0},o_=function(t){var n=window.getComputedStyle(document.body),s=n[t==="padding"?"paddingLeft":"marginLeft"],l=n[t==="padding"?"paddingTop":"marginTop"],o=n[t==="padding"?"paddingRight":"marginRight"];return[FO(s),FO(l),FO(o)]},c_=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return i_;var n=o_(t),s=document.documentElement.clientWidth,l=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,l-s+n[2]-n[0])}},u_=OS(),zl="data-scroll-locked",d_=function(t,n,s,l){var o=t.left,u=t.top,d=t.right,O=t.gap;return s===void 0&&(s="margin"),`
|
|
573
|
+
`,{label:"if",detail:"block",type:"keyword"}),Ie("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ie("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ie("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ie("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],OC=j0(Ry,w0(uC.concat(dC)));function MO(t){let{node:n,pos:s}=t,l=t.lineIndent(s,-1),o=null;for(;;){let u=n.childBefore(s);if(u)if(u.name=="Comment")s=u.from;else if(u.name=="Body"||u.name=="MatchBody")t.baseIndentFor(u)+t.unit<=l&&(o=u),n=u;else if(u.name=="MatchClause")n=u;else if(u.type.is("Statement"))n=u;else break;else break}return o}function YO(t,n){let s=t.baseIndentFor(n),l=t.lineAt(t.pos,-1),o=l.from+l.text.length;return/^\s*($|#)/.test(l.text)&&t.node.to<o+100&&!/\S/.test(t.state.sliceDoc(o,t.node.to))&&t.lineIndent(t.pos,-1)<=s||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(t.textAfter)&&t.lineIndent(t.pos,-1)>s?null:s+t.unit}const VO=ri.define({name:"python",parser:iC.configure({props:[ql.add({Body:t=>{var n;let s=/^\s*(#|$)/.test(t.textAfter)&&MO(t)||t.node;return(n=YO(t,s))!==null&&n!==void 0?n:t.continue()},MatchBody:t=>{var n;let s=MO(t);return(n=YO(t,s||t.node))!==null&&n!==void 0?n:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Io({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Io({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Io({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var n;let s=MO(t);return(n=s&&YO(t,s))!==null&&n!==void 0?n:t.continue()}}),Ps.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Nc,Body:(t,n)=>({from:t.from+1,to:t.to-(t.to==n.doc.length?0:1)}),"String FormatString":(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function fC(){return new Qs(VO,[VO.data.of({autocomplete:cC}),VO.data.of({autocomplete:OC})])}const Lo={javascript:()=>pf({jsx:!0,typescript:!1}),typescript:()=>pf({jsx:!0,typescript:!0}),css:()=>Nv(),html:()=>Bv(),json:()=>oz(),markdown:()=>Wz(),python:()=>fC()},hC=Rl.theme({"&":{backgroundColor:"#24282f",color:"#bcc2cd",fontFamily:"var(--font-mono)",fontSize:"13px",height:"100%"},".cm-scroller":{overflow:"auto"},".cm-content":{caretColor:"#33afbc"},".cm-cursor":{borderLeftColor:"#33afbc"},".cm-gutters":{backgroundColor:"#24282f",borderRight:"1px solid #2c313a",color:"#505862"},".cm-activeLineGutter":{backgroundColor:"#2c313a"},".cm-activeLine":{backgroundColor:"rgba(44, 49, 58, 0.5)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"rgba(51, 175, 188, 0.15)"}},{dark:!0});function mC({content:t,language:n,onChange:s,onSave:l}){const o=v.useRef(null),u=v.useRef(null),d=v.useRef(new Aj),O=v.useRef(s),m=v.useRef(l);return O.current=s,m.current=l,v.useEffect(()=>{if(!o.current)return;const p=Lo[n]||Lo.javascript,x=tf.of([{key:"Mod-s",run:()=>{var y;return(y=m.current)==null||y.call(m),!0}}]),g=N0.create({doc:t||"",extensions:[qj(),Mj(),Yj(),Vj(),Uj(),Lj(),Gj(),tf.of([...Dj,...Wj,...Bj]),x,Ej,hC,d.current.of(p()),Rl.updateListener.of(y=>{var Q;y.docChanged&&((Q=O.current)==null||Q.call(O,y.state.doc.toString()))})]}),b=new Rl({state:g,parent:o.current});return u.current=b,()=>{b.destroy(),u.current=null}},[]),v.useEffect(()=>{const p=u.current;if(!p)return;const x=p.state.doc.toString();t!==x&&p.dispatch({changes:{from:0,to:x.length,insert:t||""}})},[t]),v.useEffect(()=>{const p=u.current;if(!p)return;const x=Lo[n]||Lo.javascript;p.dispatch({effects:d.current.reconfigure(x())})},[n]),i.jsx("div",{ref:o,className:"w-full h-full overflow-hidden"})}const pC=["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif"],Cy=["mp4","webm","mov","avi","mkv","ogv"];function xC(t){var s;const n=(s=t.split(".").pop())==null?void 0:s.toLowerCase();return pC.includes(n)||Cy.includes(n)}function gC({path:t}){var u;const n=(u=t.split(".").pop())==null?void 0:u.toLowerCase(),s=`/api/files/raw?path=${encodeURIComponent(t)}`,l=t.split("/").pop(),o=Cy.includes(n);return i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-surface-0 p-8 gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-3 font-sans",children:[i.jsx(Ge,{children:n==null?void 0:n.toUpperCase()}),i.jsx("span",{className:"font-mono",children:l}),i.jsx("a",{href:s,target:"_blank",rel:"noopener",className:"text-accent hover:text-accent/80 transition-colors",children:i.jsx(hc,{size:12})})]}),o?i.jsx("video",{src:s,controls:!0,className:"max-w-full max-h-[70vh] rounded-md border border-border"}):i.jsx("img",{src:s,alt:l,className:"max-w-full max-h-[70vh] rounded-md border border-border object-contain"})]})}function bC(){const t=L(b=>b.editorActiveFile),n=L(b=>b.editorFiles),s=L(b=>b.editorChangedFiles),l=L(b=>b.updateFileContent),o=L(b=>b.saveFile),u=L(b=>b.reloadFile),d=L(b=>b.dismissFileChange),[O,m]=v.useState("");v.useEffect(()=>{te.get("/files/root").then(b=>m(b.root||"")).catch(()=>{})},[]);const p=t?n[t]:null,x=t&&xC(t),g=t&&s[t];return i.jsxs("div",{className:"flex h-full",children:[i.jsx("div",{className:"w-60 flex-shrink-0 border-r border-border",children:i.jsx(AP,{rootDir:O})}),i.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.jsx(EP,{}),i.jsxs("div",{className:"flex-1 relative min-h-0",children:[g&&i.jsxs("div",{className:"absolute top-0 left-0 right-0 z-10 flex items-center gap-2 px-4 py-2 bg-warning/10 border-b border-warning/20",children:[i.jsx(qc,{size:14,className:"text-warning"}),i.jsx("span",{className:"text-xs text-warning font-sans flex-1",children:"File modified externally"}),i.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>u(t),children:[i.jsx(Jn,{size:12})," Reload"]}),i.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>d(t),children:[i.jsx(jt,{size:12})," Dismiss"]})]}),!t&&i.jsx("div",{className:"w-full h-full flex items-center justify-center text-text-4 font-sans",children:i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx(un,{size:32,className:"mx-auto"}),i.jsx("p",{className:"text-sm",children:"Open a file from the tree"})]})}),t&&x&&i.jsx(gC,{path:t}),t&&!x&&p&&i.jsx(mC,{content:p.content,language:p.language,onChange:b=>l(t,b),onSave:()=>o(t)})]})]})]})}function vC(){var w;const t=L(T=>T.connected),n=L(T=>T.agents),[s,l]=v.useState(null),[o,u]=v.useState(!0),[d,O]=v.useState({tokens:[],cost:[],saved:[],efficiency:[],cache:[],inputOutput:[],agents:[],turns:[]}),m=v.useRef(0);v.useEffect(()=>{if(!t)return;let T=!0;async function k(){try{const $=await te.get("/dashboard");if(!T)return;l($),u(!1),m.current=Date.now(),O(_=>{var ce,oe,ie,K,z,H,E,re,ee;const G=Date.now(),X=(Pe,Se)=>[...Pe.slice(-59),{t:G,v:Se||0}],C=((ce=$.tokens)==null?void 0:ce.totalTokens)||0,N=((ie=(oe=$.tokens)==null?void 0:oe.savings)==null?void 0:ie.total)||0,B=C+N,V=((K=$.tokens)==null?void 0:K.totalInputTokens)||0,ne=((z=$.tokens)==null?void 0:z.totalOutputTokens)||0;return{tokens:X(_.tokens,C),cost:X(_.cost,(H=$.tokens)==null?void 0:H.totalCostUsd),saved:X(_.saved,N),efficiency:X(_.efficiency,B>0?N/B*100:0),cache:X(_.cache,(E=$.tokens)==null?void 0:E.cacheHitRate),inputOutput:X(_.inputOutput,ne>0?V/ne:0),agents:X(_.agents,((re=$.agents)==null?void 0:re.running)||0),turns:X(_.turns,(ee=$.tokens)==null?void 0:ee.totalTurns)}})}catch{T&&u(!1)}}k();const P=setInterval(k,4e3);return()=>{T=!1,clearInterval(P)}},[t]);const p=((w=s==null?void 0:s.agents)==null?void 0:w.breakdown)||[],x=(s==null?void 0:s.routing)||null,g=(s==null?void 0:s.rotation)||null,b=(s==null?void 0:s.adaptive)||[],y=(s==null?void 0:s.journalist)||null,Q=(g==null?void 0:g.rotating)||[];return{data:s,loading:o,agents:n,connected:t,kpiHistory:d,lastFetch:m.current,agentBreakdown:p,routing:x,rotation:g,adaptive:b,journalist:y,rotating:Q}}const e0=v.memo(function({connected:n,runningCount:s,totalCount:l,uptime:o,lastFetch:u,activeTeam:d}){return i.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-surface-1 border-b border-border",children:[i.jsx("h2",{className:"text-xs font-semibold text-text-0 font-sans tracking-wide uppercase",children:"Command Center"}),d&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-text-4",children:"/"}),i.jsx("span",{className:"text-xs font-mono text-text-2",children:d.name})]}),i.jsx("div",{className:"flex-1"}),n&&i.jsxs("div",{className:"flex items-center gap-3.5 text-xs font-mono text-text-2",children:[i.jsxs("span",{children:[i.jsx("span",{className:"text-text-1",children:s}),i.jsxs("span",{className:"text-text-3",children:["/",l]}),i.jsx("span",{className:"ml-1 text-text-3",children:"agents"})]}),o>0&&i.jsxs("span",{className:"text-text-3",children:["Up ",Yc(o)]}),u>0&&i.jsxs("span",{className:"flex items-center gap-1 text-text-4",children:[i.jsx(Jn,{size:9}),i.jsx("span",{children:vt(u)})]})]}),i.jsx(ws,{status:n?"running":"crashed",size:"sm"})]})});function la(t,n){const s=parseInt(t.slice(1,3),16),l=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${s},${l},${o},${n})`}const xe={surface0:"#1a1e25",surface4:"#2c313a",surface5:"#333842",text0:"#e6e6e6",text1:"#bcc2cd",text2:"#8b929e",text3:"#6e7681",text4:"#505862",accent:"#33afbc",success:"#4ae168",warning:"#e5c07b",danger:"#e06c75",info:"#61afef",purple:"#c678dd",orange:"#d19a66"};function yC({data:t,color:n=xe.accent,width:s=72,height:l=22}){if(!t||t.length<2)return i.jsx("div",{style:{width:s,height:l}});const o=t.map(x=>x.v),u=Math.min(...o),O=Math.max(...o)-u||1,m=t.map((x,g)=>{const b=g/(t.length-1)*s,y=l-(x.v-u)/O*(l-2)-1;return`${b},${y}`}).join(" "),p=`kpi-${n.replace("#","")}`;return i.jsxs("svg",{width:s,height:l,className:"flex-shrink-0",children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:n,stopOpacity:"0.2"}),i.jsx("stop",{offset:"100%",stopColor:n,stopOpacity:"0"})]})}),i.jsx("polygon",{points:`0,${l} ${m} ${s},${l}`,fill:`url(#${p})`}),i.jsx("polyline",{points:m,fill:"none",stroke:n,strokeWidth:"1.5",strokeLinejoin:"round",strokeOpacity:"0.8"})]})}const SC=v.memo(function({label:n,value:s,sparkData:l,color:o=xe.accent,className:u}){return i.jsxs("div",{className:le("flex items-center gap-2.5 px-3 py-2.5 min-w-0","bg-surface-1",u),children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5 truncate",children:n}),i.jsx("div",{className:"text-base font-semibold font-mono text-text-0 tabular-nums leading-none",children:s})]}),i.jsx(yC,{data:l,color:o})]})});function QC({kpis:t}){return i.jsx("div",{className:"flex flex-wrap border-b border-border",style:{background:"var(--color-surface-0)"},children:t.map(n=>i.jsx(SC,{label:n.label,value:n.value,sparkData:n.sparkData,color:n.color,className:le("flex-1 basis-[12.5%] min-w-[140px]","border-b border-r border-border")},n.label))})}const jC={actual:"ACT",estimated:"EST",local:"LOC"},wC=v.memo(function({agent:n,isRotating:s}){const l=n.status==="running"||n.status==="starting",o=Math.round((n.contextUsage||0)*100),u=s?"#c678dd":th(n.status),d=n.quality,O=(d==null?void 0:d.toolSuccessRate)!=null?Math.round(d.toolSuccessRate*100):null,m=n.rotationThreshold?Math.round(n.rotationThreshold*100):null;return i.jsxs("div",{className:"px-3 py-2 hover:bg-surface-3 transition-colors space-y-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"relative flex-shrink-0 w-[6px] h-[6px]",children:[i.jsx("span",{className:"absolute inset-0 rounded-sm",style:{background:u}}),l&&i.jsx("span",{className:"absolute inset-[-2px] rounded-sm",style:{background:u,opacity:.15,animation:"node-pulse-bar 2s ease-in-out infinite"}})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate leading-none",children:n.name}),i.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:n.role}),i.jsx("span",{className:"text-2xs text-text-4",children:"/"}),i.jsx("span",{className:"text-2xs font-mono text-text-3",children:kC(n.model)})]})]}),i.jsx("div",{className:"flex-1"}),O!=null&&i.jsxs("span",{className:"text-2xs font-mono font-bold uppercase px-1 py-px rounded-sm flex-shrink-0",style:{color:O>=90?"#4ae168":O>=70?"#e5c07b":"#e06c75",background:O>=90?"rgba(74,225,104,0.1)":O>=70?"rgba(229,192,123,0.1)":"rgba(224,108,117,0.1)"},children:[O,"%"]}),n.costSource&&n.costSource!=="actual"&&i.jsx("span",{className:"text-2xs font-mono text-text-4 uppercase tracking-wider flex-shrink-0",children:jC[n.costSource]||""}),i.jsxs("div",{className:"text-right flex-shrink-0",children:[i.jsx("div",{className:"text-xs font-mono text-text-1 tabular-nums leading-none",children:Je(n.tokens||0)}),(n.costUsd||0)>0&&i.jsx("div",{className:"text-2xs font-mono text-text-3 mt-0.5",children:Mc(n.costUsd)})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1 h-[3px] bg-surface-4 rounded-full overflow-visible",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full transition-all duration-700",style:{width:`${Math.max(o,1)}%`,background:o>80?"#e06c75":o>60?"#e5c07b":l?"#61afef":"#333842"}}),m&&i.jsx("div",{className:"absolute top-[-2px] w-px h-[7px]",style:{left:`${m}%`,background:"#c678dd"},title:`Rotation at ${m}%`})]}),i.jsxs("span",{className:"text-2xs font-mono text-text-2 tabular-nums flex-shrink-0 w-7 text-right",children:[o,"%"]})]})]})});function kC(t){if(!t||t==="auto"||t==="default")return"default";const n=t.match(/^claude-(opus|sonnet|haiku)-(\d+)-(\d+)/);return n?`${n[1][0].toUpperCase()}${n[1].slice(1)} ${n[2]}.${n[3]}`:t.startsWith("gemini-")?t.replace("gemini-","Gem ").replace("-preview",""):t.length>12?t.slice(0,12)+"...":t}const $C=v.memo(function({agentBreakdown:n,rotating:s=[]}){if(!(n!=null&&n.length))return i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"No agents"});const l={};for(const u of n){const d=u.teamId||"ungrouped";l[d]||(l[d]=[]),l[d].push(u)}const o=new Set(s);return i.jsx(es,{className:"flex-1",children:i.jsx("div",{className:"py-1",children:Object.entries(l).map(([u,d])=>i.jsxs("div",{children:[i.jsx("div",{className:"px-3 pt-2 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:u})}),d.map(O=>i.jsx(wC,{agent:O,isRotating:o.has(O.id)},O.id))]},u))})})}),TC=v.memo(function({data:n}){const s=v.useRef(null),l=v.useRef(null),[o,u]=v.useState({width:0,height:0}),[d,O]=v.useState(null),{width:m,height:p}=o,x={top:28,right:12,bottom:8,left:12},g=Math.max(m-x.left-x.right,0),b=Math.max(p-x.top-x.bottom,0),y=v.useMemo(()=>!n||n.length<2?[]:n.slice(1).map((T,k)=>{const P=n[k],$=(T.t-P.t)/6e4,_=Math.max((T.tokens||0)-(P.tokens||0),0);return{burnRate:$>0?Math.round(_/$):0,cacheHitRate:T.cacheHitRate||0,running:T.running||0,agents:T.agents||0,t:T.t}}),[n]);v.useEffect(()=>{const T=s.current;if(!T)return;const k=new ResizeObserver(P=>{const{width:$,height:_}=P[0].contentRect;$>0&&_>0&&u({width:Math.floor($),height:Math.floor(_)})});return k.observe(T),()=>k.disconnect()},[]);const Q=v.useCallback(T=>{const k=l.current;if(!k||!y.length||g<=0)return;const P=k.getBoundingClientRect(),$=T.clientX-P.left-x.left;if($<0||$>g){O(null);return}const _=Math.round($/g*(y.length-1));O({x:x.left+_/Math.max(y.length-1,1)*g,index:_})},[y,g,x.left]),w=v.useCallback(()=>O(null),[]);return v.useEffect(()=>{const T=l.current;if(!T||!y.length||m<=0||p<=0||g<=0||b<=0)return;const k=T.getContext("2d"),P=window.devicePixelRatio||1;T.width=m*P,T.height=p*P,k.scale(P,P),k.clearRect(0,0,m,p);const $=y.map(z=>z.burnRate),_=y.map(z=>z.cacheHitRate),G=y.map(z=>z.running),X=Math.max(...$,100),C=Math.max(...G,1),N=z=>x.left+z/Math.max(y.length-1,1)*g,B=z=>x.top+b-z/X*b,V=z=>x.top+b-z*b,ne=Math.max(g/y.length-1,2);for(let z=0;z<y.length;z++){const H=G[z];if(H<=0)continue;const E=H/C*b*.3,re=N(z)-ne/2,ee=x.top+b-E;k.fillStyle=la(xe.surface5,.5),k.fillRect(re,ee,ne,E)}k.setLineDash([2,4]),k.strokeStyle=la(xe.text4,.2),k.lineWidth=1;for(let z=1;z<=3;z++){const H=x.top+b/4*z;k.beginPath(),k.moveTo(x.left,H),k.lineTo(x.left+g,H),k.stroke()}k.setLineDash([]),k.font="9px 'JetBrains Mono Variable', monospace",k.textAlign="left",k.fillStyle=la(xe.text3,.5),k.fillText(`${Je(X)}/m`,x.left+4,x.top+10),k.fillText(`${Je(Math.round(X/2))}/m`,x.left+4,x.top+b/2+4),k.beginPath(),k.moveTo(x.left,x.top+b);for(let z=0;z<y.length;z++)k.lineTo(N(z),B($[z]));k.lineTo(N(y.length-1),x.top+b),k.closePath();const ce=k.createLinearGradient(0,x.top,0,x.top+b);ce.addColorStop(0,la(xe.accent,.2)),ce.addColorStop(.7,la(xe.accent,.04)),ce.addColorStop(1,la(xe.accent,0)),k.fillStyle=ce,k.fill(),k.beginPath(),k.strokeStyle=xe.accent,k.lineWidth=1.5,k.lineJoin="round";for(let z=0;z<y.length;z++){const H=N(z),E=B($[z]);z===0?k.moveTo(H,E):k.lineTo(H,E)}k.stroke();const oe=_.some(z=>z>0);if(oe){k.beginPath(),k.strokeStyle=la(xe.info,.45),k.lineWidth=1,k.lineJoin="round",k.setLineDash([2,3]);for(let z=0;z<y.length;z++){const H=N(z),E=V(_[z]);z===0?k.moveTo(H,E):k.lineTo(H,E)}k.stroke(),k.setLineDash([])}k.font="9px 'Inter Variable', sans-serif",k.textAlign="right";let ie=m-x.right-4;const K=14;if(oe&&(k.fillStyle=la(xe.info,.5),k.fillText("Cache %",ie,K),ie-=k.measureText("Cache %").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),ie-=14),k.fillStyle=la(xe.surface5,.7),k.fillText("Agents",ie,K),ie-=k.measureText("Agents").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),ie-=14,k.fillStyle=xe.accent,k.fillText("Burn Rate",ie,K),ie-=k.measureText("Burn Rate").width+4,k.beginPath(),k.arc(ie,K-3,2.5,0,Math.PI*2),k.fill(),d&&d.index>=0&&d.index<y.length){const z=d.x,H=y[d.index];k.beginPath(),k.moveTo(z,x.top),k.lineTo(z,x.top+b),k.strokeStyle=la(xe.text1,.15),k.lineWidth=1,k.stroke();const E=B(H.burnRate);k.beginPath(),k.arc(z,E,3,0,Math.PI*2),k.fillStyle=xe.accent,k.fill();const re=[{label:"Burn",value:`${Je(H.burnRate)}/m`,color:xe.accent},{label:"Cache",value:ks(H.cacheHitRate*100),color:xe.info},{label:"Agents",value:`${H.running}/${H.agents}`,color:xe.text2}],ee=104,Pe=re.length*16+12;let Se=z+12;Se+ee>m-8&&(Se=z-ee-12);const ve=Math.max(x.top,E-Pe/2);k.fillStyle=la(xe.surface0,.92),k.beginPath(),k.roundRect(Se,ve,ee,Pe,4),k.fill(),k.strokeStyle=la(xe.text4,.2),k.lineWidth=1,k.stroke(),k.textAlign="left",re.forEach((_e,W)=>{const ue=ve+14+W*16;k.beginPath(),k.arc(Se+8,ue-3,2,0,Math.PI*2),k.fillStyle=_e.color,k.fill(),k.font="8px 'Inter Variable', sans-serif",k.fillStyle=xe.text3,k.fillText(_e.label,Se+14,ue),k.font="9px 'JetBrains Mono Variable', monospace",k.fillStyle=xe.text0,k.textAlign="right",k.fillText(_e.value,Se+ee-8,ue),k.textAlign="left"})}},[y,m,p,d,g,b,x]),i.jsx("div",{ref:s,className:"absolute inset-0",children:m>0&&p>0&&i.jsx("canvas",{ref:l,style:{width:m,height:p},className:"block cursor-crosshair",onMouseMove:Q,onMouseLeave:w})})}),NC=v.memo(function({cacheRead:n=0,cacheCreation:s=0,totalInput:l=0,size:o=140}){const u=v.useRef(null),d=n+s+l,O=d>0?n/d*100:0;return v.useEffect(()=>{const m=u.current;if(!m)return;const p=window.devicePixelRatio||1;m.width=o*p,m.height=o*p;const x=m.getContext("2d");x.scale(p,p),x.clearRect(0,0,o,o);const g=o/2,b=o/2,y=(o-12)/2,Q=5,w=135*Math.PI/180,T=405*Math.PI/180,k=T-w;if(x.beginPath(),x.arc(g,b,y,w,T),x.strokeStyle=xe.surface4,x.lineWidth=Q,x.lineCap="round",x.stroke(),d>0){const P=n/d,$=s/d;if(P>0){const _=w+k*P;x.beginPath(),x.arc(g,b,y,w,_),x.strokeStyle=xe.accent,x.lineWidth=Q,x.lineCap="round",x.stroke()}if($>0){const _=w+k*P,G=_+k*$;x.beginPath(),x.arc(g,b,y,_,G),x.strokeStyle=xe.purple,x.lineWidth=Q,x.lineCap="butt",x.stroke()}}x.textAlign="center",x.textBaseline="middle",x.font=`600 ${o*.2}px 'JetBrains Mono Variable', monospace`,x.fillStyle=xe.text0,x.fillText(`${Math.round(O)}%`,g,b-3),x.font=`500 ${o*.08}px 'JetBrains Mono Variable', monospace`,x.fillStyle=xe.text3,x.fillText("CACHE",g,b+o*.13)},[n,s,l,o,d,O]),i.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-3 py-3",children:[i.jsx("canvas",{ref:u,className:"flex-shrink-0",style:{width:o,height:o}}),i.jsxs("div",{className:"w-full mt-3 space-y-1.5 max-w-[160px]",children:[i.jsx(UO,{color:xe.accent,label:"Read",value:Je(n)}),i.jsx(UO,{color:xe.purple,label:"Create",value:Je(s)}),i.jsx(UO,{color:xe.surface5,label:"Miss",value:Je(Math.max(l-n-s,0))})]})]})});function UO({color:t,label:n,value:s}){return i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:t}}),i.jsx("span",{className:"text-text-3 uppercase tracking-wider flex-1",children:n}),i.jsx("span",{className:"text-text-1 tabular-nums",children:s})]})}const t0={heavy:xe.danger,medium:xe.warning,light:xe.success},a0={heavy:"Heavy",medium:"Medium",light:"Light"},PC=v.memo(function({routing:n,agentBreakdown:s}){if(!n)return null;const{byTier:l={},totalDecisions:o=0,autoRoutedCount:u=0}=n,d=["heavy","medium","light"],O=d.reduce((g,b)=>g+(l[b]||0),0),m={};for(const g of s||[]){const b=g.model||"default";m[b]||(m[b]={tokens:0,agents:0}),m[b].tokens+=g.tokens||0,m[b].agents+=1}const p=Object.entries(m).sort((g,b)=>b[1].tokens-g[1].tokens),x=p.length>0?p[0][1].tokens:0;return i.jsxs("div",{className:"flex flex-col h-full px-3 py-3 overflow-y-auto",children:[O>0&&i.jsxs("div",{className:"space-y-1.5 mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:"Tier Distribution"}),i.jsxs("span",{className:"text-2xs font-mono text-text-4 ml-auto tabular-nums",children:[Je(O)," decisions"]})]}),i.jsx("div",{className:"h-[6px] bg-surface-4 rounded-full overflow-hidden flex",children:d.map(g=>{const b=l[g]||0;if(b===0)return null;const y=b/O*100;return i.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${y}%`,background:t0[g]},title:`${a0[g]}: ${b} (${Math.round(y)}%)`},g)})}),i.jsx("div",{className:"flex items-center gap-3",children:d.map(g=>{const b=l[g]||0;if(b===0)return null;const y=O>0?b/O*100:0;return i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:t0[g]}}),i.jsx("span",{className:"text-2xs font-mono text-text-2",children:a0[g]}),i.jsx("span",{className:"text-2xs font-mono text-text-4 tabular-nums",children:ks(y)})]},g)})})]}),p.length>0&&i.jsxs("div",{className:"space-y-1.5 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider",children:"Models in Use"}),u>0&&i.jsxs("span",{className:"text-2xs font-mono text-text-4 ml-auto",children:[u," auto"]})]}),i.jsx("div",{className:"space-y-1.5",children:p.map(([g,b])=>{const y=x>0?b.tokens/x*100:0;return i.jsxs("div",{className:"space-y-0.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 flex-1 truncate",children:zC(g)}),i.jsxs("span",{className:"text-2xs font-mono text-text-3 tabular-nums",children:[b.agents," agent",b.agents!==1?"s":""]}),i.jsx("span",{className:"text-xs font-mono text-text-1 tabular-nums",children:Je(b.tokens)})]}),i.jsx("div",{className:"h-[3px] bg-surface-4 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(y,2)}%`,background:xe.accent}})})]},g)})})]}),O===0&&p.length===0&&i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono",children:"No routing data"})]})});function zC(t){if(!t||t==="auto"||t==="default")return"Default";const n=t.match(/^claude-(opus|sonnet|haiku)-(\d+)-(\d+)/);return n?`${n[1][0].toUpperCase()}${n[1].slice(1)} ${n[2]}.${n[3]}`:t.startsWith("gemini-")?t.replace("gemini-","Gemini ").replace("-preview",""):t}function RC(t){const n=t+"CollectionProvider",[s,l]=zs(n),[o,u]=s(n,{collectionRef:{current:null},itemMap:new Map}),d=w=>{const{scope:T,children:k}=w,P=Yn.useRef(null),$=Yn.useRef(new Map).current;return i.jsx(o,{scope:T,itemMap:$,collectionRef:P,children:k})};d.displayName=n;const O=t+"CollectionSlot",m=lc(O),p=Yn.forwardRef((w,T)=>{const{scope:k,children:P}=w,$=u(O,k),_=it(T,$.collectionRef);return i.jsx(m,{ref:_,children:P})});p.displayName=O;const x=t+"CollectionItemSlot",g="data-radix-collection-item",b=lc(x),y=Yn.forwardRef((w,T)=>{const{scope:k,children:P,...$}=w,_=Yn.useRef(null),G=it(T,_),X=u(x,k);return Yn.useEffect(()=>(X.itemMap.set(_,{ref:_,...$}),()=>void X.itemMap.delete(_))),i.jsx(b,{[g]:"",ref:G,children:P})});y.displayName=x;function Q(w){const T=u(t+"CollectionConsumer",w);return Yn.useCallback(()=>{const P=T.collectionRef.current;if(!P)return[];const $=Array.from(P.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort((X,C)=>$.indexOf(X.ref.current)-$.indexOf(C.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:d,Slot:p,ItemSlot:y},Q,l]}var LO="rovingFocusGroup.onEntryFocus",CC={bubbles:!1,cancelable:!0},mi="RovingFocusGroup",[wf,Xy,XC]=RC(mi),[_C,_y]=zs(mi,[XC]),[ZC,AC]=_C(mi),Zy=v.forwardRef((t,n)=>i.jsx(wf.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(wf.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(EC,{...t,ref:n})})}));Zy.displayName=mi;var EC=v.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,orientation:l,loop:o=!1,dir:u,currentTabStopId:d,defaultCurrentTabStopId:O,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...g}=t,b=v.useRef(null),y=it(n,b),Q=ah(u),[w,T]=Xc({prop:d,defaultProp:O??null,onChange:m,caller:mi}),[k,P]=v.useState(!1),$=Rt(p),_=Xy(s),G=v.useRef(!1),[X,C]=v.useState(0);return v.useEffect(()=>{const N=b.current;if(N)return N.addEventListener(LO,$),()=>N.removeEventListener(LO,$)},[$]),i.jsx(ZC,{scope:s,orientation:l,dir:Q,loop:o,currentTabStopId:w,onItemFocus:v.useCallback(N=>T(N),[T]),onItemShiftTab:v.useCallback(()=>P(!0),[]),onFocusableItemAdd:v.useCallback(()=>C(N=>N+1),[]),onFocusableItemRemove:v.useCallback(()=>C(N=>N-1),[]),children:i.jsx(Be.div,{tabIndex:k||X===0?-1:0,"data-orientation":l,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:Ee(t.onMouseDown,()=>{G.current=!0}),onFocus:Ee(t.onFocus,N=>{const B=!G.current;if(N.target===N.currentTarget&&B&&!k){const V=new CustomEvent(LO,CC);if(N.currentTarget.dispatchEvent(V),!V.defaultPrevented){const ne=_().filter(z=>z.focusable),ce=ne.find(z=>z.active),oe=ne.find(z=>z.id===w),K=[ce,oe,...ne].filter(Boolean).map(z=>z.ref.current);qy(K,x)}}G.current=!1}),onBlur:Ee(t.onBlur,()=>P(!1))})})}),Ay="RovingFocusGroupItem",Ey=v.forwardRef((t,n)=>{const{__scopeRovingFocusGroup:s,focusable:l=!0,active:o=!1,tabStopId:u,children:d,...O}=t,m=kl(),p=u||m,x=AC(Ay,s),g=x.currentTabStopId===p,b=Xy(s),{onFocusableItemAdd:y,onFocusableItemRemove:Q,currentTabStopId:w}=x;return v.useEffect(()=>{if(l)return y(),()=>Q()},[l,y,Q]),i.jsx(wf.ItemSlot,{scope:s,id:p,focusable:l,active:o,children:i.jsx(Be.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...O,ref:n,onMouseDown:Ee(t.onMouseDown,T=>{l?x.onItemFocus(p):T.preventDefault()}),onFocus:Ee(t.onFocus,()=>x.onItemFocus(p)),onKeyDown:Ee(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){x.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const k=YC(T,x.orientation,x.dir);if(k!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let $=b().filter(_=>_.focusable).map(_=>_.ref.current);if(k==="last")$.reverse();else if(k==="prev"||k==="next"){k==="prev"&&$.reverse();const _=$.indexOf(T.currentTarget);$=x.loop?VC($,_+1):$.slice(_+1)}setTimeout(()=>qy($))}}),children:typeof d=="function"?d({isCurrentTabStop:g,hasTabStop:w!=null}):d})})});Ey.displayName=Ay;var qC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MC(t,n){return n!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YC(t,n,s){const l=MC(t.key,s);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(l))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(l)))return qC[l]}function qy(t,n=!1){const s=document.activeElement;for(const l of t)if(l===s||(l.focus({preventScroll:n}),document.activeElement!==s))return}function VC(t,n){return t.map((s,l)=>t[(n+l)%t.length])}var UC=Zy,LC=Ey,Dc="Tabs",[GC]=zs(Dc,[_y]),My=_y(),[DC,vh]=GC(Dc),Yy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,onValueChange:o,defaultValue:u,orientation:d="horizontal",dir:O,activationMode:m="automatic",...p}=t,x=ah(O),[g,b]=Xc({prop:l,onChange:o,defaultProp:u??"",caller:Dc});return i.jsx(DC,{scope:s,baseId:kl(),value:g,onValueChange:b,orientation:d,dir:x,activationMode:m,children:i.jsx(Be.div,{dir:x,"data-orientation":d,...p,ref:n})})});Yy.displayName=Dc;var Vy="TabsList",Uy=v.forwardRef((t,n)=>{const{__scopeTabs:s,loop:l=!0,...o}=t,u=vh(Vy,s),d=My(s);return i.jsx(UC,{asChild:!0,...d,orientation:u.orientation,dir:u.dir,loop:l,children:i.jsx(Be.div,{role:"tablist","aria-orientation":u.orientation,...o,ref:n})})});Uy.displayName=Vy;var Ly="TabsTrigger",Gy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,disabled:o=!1,...u}=t,d=vh(Ly,s),O=My(s),m=By(d.baseId,l),p=Hy(d.baseId,l),x=l===d.value;return i.jsx(LC,{asChild:!0,...O,focusable:!o,active:x,children:i.jsx(Be.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:m,...u,ref:n,onMouseDown:Ee(t.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?d.onValueChange(l):g.preventDefault()}),onKeyDown:Ee(t.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&d.onValueChange(l)}),onFocus:Ee(t.onFocus,()=>{const g=d.activationMode!=="manual";!x&&!o&&g&&d.onValueChange(l)})})})});Gy.displayName=Ly;var Dy="TabsContent",Wy=v.forwardRef((t,n)=>{const{__scopeTabs:s,value:l,forceMount:o,children:u,...d}=t,O=vh(Dy,s),m=By(O.baseId,l),p=Hy(O.baseId,l),x=l===O.value,g=v.useRef(x);return v.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),i.jsx(ga,{present:o||x,children:({present:b})=>i.jsx(Be.div,{"data-state":x?"active":"inactive","data-orientation":O.orientation,role:"tabpanel","aria-labelledby":m,hidden:!b,id:p,tabIndex:0,...d,ref:n,style:{...t.style,animationDuration:g.current?"0s":void 0},children:b&&u})})});Wy.displayName=Dy;function By(t,n){return`${t}-trigger-${n}`}function Hy(t,n){return`${t}-content-${n}`}var WC=Yy,BC=Uy,HC=Gy,IC=Wy;function Iy({children:t,...n}){return i.jsx(WC,{...n,children:t})}function Fy({children:t,className:n,...s}){return i.jsx(BC,{className:le("flex items-center gap-0 border-b border-border-subtle",n),...s,children:t})}function Nl({children:t,className:n,...s}){return i.jsx(HC,{className:le("px-3 py-2 text-sm font-medium font-sans text-text-2","border-b-2 border-transparent","hover:text-text-0 hover:bg-surface-5/50","data-[state=active]:text-text-0 data-[state=active]:border-accent","transition-colors duration-100 cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",n),...s,children:t})}function Pl({children:t,className:n,...s}){return i.jsx(IC,{className:le("flex-1 min-h-0",n),...s,children:t})}function n0({data:t,color:n=xe.accent,width:s=60,height:l=16}){if(!t||t.length<2)return i.jsx("div",{style:{width:s,height:l}});const o=Array.isArray(t[0])?t:t.map(p=>typeof p=="number"?p:p.v),u=Math.min(...o),O=Math.max(...o)-u||1,m=o.map((p,x)=>{const g=x/(o.length-1)*s,b=l-(p-u)/O*(l-2)-1;return`${g},${b}`}).join(" ");return i.jsx("svg",{width:s,height:l,className:"flex-shrink-0",children:i.jsx("polyline",{points:m,fill:"none",stroke:n,strokeWidth:"1",strokeLinejoin:"round",strokeOpacity:"0.7"})})}function GO({label:t,value:n,total:s,color:l}){const o=s>0?n/s*100:0;return i.jsxs("div",{className:"space-y-0.5",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs font-mono",children:[i.jsx("span",{className:"text-text-2",children:t}),i.jsx("span",{className:"text-text-1 tabular-nums",children:Je(n)})]}),i.jsx("div",{className:"h-[2px] bg-surface-4 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.min(o,100)}%`,background:l}})})]})}function FC({tokens:t,rotation:n}){var d;const s=(t==null?void 0:t.savings)||{},l=s.total||0,u=((t==null?void 0:t.totalTokens)||0)+l;return i.jsxs("div",{className:"p-3 space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Rotations"}),i.jsx("div",{className:"text-xl font-mono font-semibold text-text-0 tabular-nums leading-none",children:(n==null?void 0:n.totalRotations)||0})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Saved"}),i.jsx("div",{className:"text-xl font-mono font-semibold text-success tabular-nums leading-none",children:Je(l)}),u>0&&i.jsxs("div",{className:"text-2xs font-mono text-text-3 mt-0.5",children:[ks(l/u*100)," of total"]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(GO,{label:"Rotation",value:s.fromRotation||0,total:u,color:xe.accent}),i.jsx(GO,{label:"Conflict prevention",value:s.fromConflictPrevention||0,total:u,color:xe.purple}),i.jsx(GO,{label:"Cold-start skip",value:s.fromColdStartSkip||0,total:u,color:xe.info})]}),((d=n==null?void 0:n.history)==null?void 0:d.length)>0&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1.5",children:"Recent"}),i.jsx("div",{className:"space-y-1",children:n.history.slice(-8).reverse().map((O,m)=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono px-2 py-1 bg-surface-0 rounded",children:[i.jsx("span",{className:"text-text-1 font-medium capitalize truncate flex-1",children:O.agentName||O.role}),i.jsx("span",{className:"text-text-3 tabular-nums",children:ks((O.contextUsage||0)*100)}),i.jsx("span",{className:"text-text-4",children:vt(O.timestamp)})]},m))})]})]})}function KC({adaptive:t}){if(!(t!=null&&t.length))return i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"No adaptive profiles"});function n(s){const l=s.split(":");return{provider:l[0]||s,role:l[1]||""}}return i.jsx("div",{children:i.jsxs("div",{className:"p-3 space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2 px-2 pb-1 text-2xs font-mono text-text-4 uppercase tracking-wider",children:[i.jsx("span",{className:"flex-1",children:"Role"}),i.jsx("span",{className:"w-12 text-right",children:"Threshold"}),i.jsx("span",{className:"w-12 text-right",children:"Adj."}),i.jsx("span",{className:"w-14 text-right",children:"Status"})]}),t.map(s=>{var O,m;const{provider:l,role:o}=n(s.key),u=((O=s.thresholdHistory)==null?void 0:O.length)>1,d=((m=s.recentScores)==null?void 0:m.length)>1;return i.jsxs("div",{className:"bg-surface-0 rounded px-2 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 capitalize",children:o||l}),o&&i.jsx("span",{className:"text-2xs font-mono text-text-4 ml-1.5",children:l})]}),i.jsx("span",{className:"w-12 text-right text-xs font-mono font-semibold text-text-0 tabular-nums",children:ks(s.threshold*100)}),i.jsx("span",{className:"w-12 text-right text-2xs font-mono text-text-3 tabular-nums",children:s.adjustments}),i.jsx("span",{className:le("w-14 text-right text-2xs font-mono font-bold uppercase",s.converged?"text-success":"text-text-4"),children:s.converged?"Converged":"Learning"})]}),(u||d)&&i.jsxs("div",{className:"flex items-center gap-3 mt-1.5 pl-1",children:[u&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-4",children:"Threshold"}),i.jsx(n0,{data:s.thresholdHistory.map(p=>p.v),color:s.converged?xe.success:xe.accent,width:70,height:12})]}),d&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-2xs font-mono text-text-4",children:"Quality"}),i.jsx(n0,{data:s.recentScores,color:xe.warning,width:70,height:12})]})]})]},s.key)})]})})}function JC({journalist:t}){var n;return t?i.jsx("div",{children:i.jsxs("div",{className:"p-3 space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Cycles"}),i.jsx("div",{className:"text-lg font-mono font-semibold text-text-0 tabular-nums leading-none",children:t.cycleCount||0})]}),t.lastCycleAt&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-0.5",children:"Last"}),i.jsx("div",{className:"text-xs font-mono text-text-2",children:vt(t.lastCycleAt)})]}),t.synthesizing&&i.jsx("span",{className:"text-2xs font-mono font-bold text-accent uppercase tracking-wider animate-pulse",children:"Synthesizing"})]}),t.lastSummary&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Summary"}),i.jsx("div",{className:"text-xs font-sans text-text-2 leading-relaxed",children:t.lastSummary})]}),t.projectMap&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Project Map"}),i.jsx("div",{className:"text-xs font-mono text-text-2 leading-relaxed whitespace-pre-wrap",children:t.projectMap})]}),t.decisions&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1",children:"Decisions"}),i.jsx("div",{className:"text-xs font-mono text-text-2 leading-relaxed whitespace-pre-wrap",children:t.decisions})]}),((n=t.recentHistory)==null?void 0:n.length)>0&&i.jsxs("div",{children:[i.jsx("div",{className:"text-2xs font-mono text-text-3 uppercase tracking-wider mb-1.5",children:"History"}),i.jsx("div",{className:"space-y-1",children:t.recentHistory.slice().reverse().map((s,l)=>i.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono px-2 py-1 bg-surface-0 rounded",children:[i.jsxs("span",{className:"text-text-3",children:["#",s.cycle]}),i.jsxs("span",{className:"text-text-2 flex-1 truncate",children:[s.agentCount," agents"]}),i.jsx("span",{className:"text-text-4",children:vt(s.timestamp)})]},l))})]})]})}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-text-3 font-mono p-4",children:"Journalist inactive"})}const eX=v.memo(function({tokens:n,rotation:s,adaptive:l,journalist:o}){return i.jsxs(Iy,{defaultValue:"rotation",className:"flex flex-col h-full",children:[i.jsxs(Fy,{className:"flex-shrink-0 px-1",children:[i.jsxs(Nl,{value:"rotation",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(Vl,{size:11}),"Rotation"]}),i.jsxs(Nl,{value:"adaptive",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(j5,{size:11}),"Adaptive"]}),i.jsxs(Nl,{value:"journalist",className:"text-xs px-2.5 py-1.5 inline-flex items-center gap-1.5",children:[i.jsx(Ff,{size:11}),"Journalist"]})]}),i.jsx(Pl,{value:"rotation",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(FC,{tokens:n,rotation:s})})}),i.jsx(Pl,{value:"adaptive",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(KC,{adaptive:l})})}),i.jsx(Pl,{value:"journalist",className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0 overflow-y-auto",children:i.jsx(JC,{journalist:o})})})]})}),tX={spawn:zN,complete:Ir,crash:qc,kill:Nb,rotate:Vl,error:Jf},aX={spawn:"text-accent",complete:"text-success",crash:"text-danger",kill:"text-text-3",rotate:"text-purple",error:"text-danger"};function nX(t){const n=t.agentName||t.role||"";switch(t.type){case"spawn":return`${n} spawned`;case"complete":return`${n} completed`;case"crash":return`${n} crashed`;case"kill":return`${n} killed`;case"rotate":return`${n} rotated`;default:return t.text||t.type||"event"}}const sX=v.memo(function({events:n=[]}){return n.length?i.jsx("div",{className:"flex items-center gap-3 overflow-x-auto py-2 px-3",children:n.slice(-15).reverse().map((s,l)=>{const o=tX[s.type]||Pa,u=aX[s.type]||"text-text-3",d=nX(s);return i.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i.jsx(o,{size:11,className:u}),i.jsx("span",{className:"text-xs font-sans text-text-2 whitespace-nowrap",children:d}),i.jsx("span",{className:"text-2xs font-mono text-text-4",children:vt(s.t||s.timestamp)})]},l)})}):i.jsx("div",{className:"text-xs text-text-3 font-mono py-2.5 text-center",children:"No recent activity"})});function ra({className:t,...n}){return i.jsx("div",{className:le("rounded-md bg-surface-4","bg-gradient-to-r from-surface-4 via-surface-5 to-surface-4","bg-[length:200%_100%] animate-[shimmer_1.5s_ease-in-out_infinite]",t),...n})}function lX(){return i.jsxs("div",{className:"flex-1 grid gap-px p-0",style:{gridTemplateRows:"auto minmax(0, 1fr) minmax(0, 1fr)",gridTemplateColumns:"3fr 1.5fr 1.5fr",background:"#282c34"},children:[i.jsx("div",{className:"col-span-3",children:i.jsx(ra,{className:"h-[72px] rounded-none"})}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx(ra,{className:"rounded-none"}),i.jsx("div",{className:"col-span-2",children:i.jsx(ra,{className:"h-full rounded-none"})})]})}function rX(){const{data:t,loading:n,agents:s,connected:l,kpiHistory:o,lastFetch:u,agentBreakdown:d,routing:O,rotation:m,adaptive:p,journalist:x,rotating:g}=vC(),b=s.filter(X=>X.status==="running").length;if(!l)return i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-2 text-text-3 font-mono",children:[i.jsx(Ac,{size:28,className:"mx-auto"}),i.jsx("p",{className:"text-xs",children:"Connecting to daemon..."})]})});if(n||!t)return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(e0,{connected:l,runningCount:0,totalCount:0,uptime:0,lastFetch:0}),i.jsx(lX,{})]});const y=t.tokens||{},Q={totalTokens:y.totalTokens||0,totalCostUsd:y.totalCostUsd||0,totalInputTokens:y.totalInputTokens||0,totalOutputTokens:y.totalOutputTokens||0,cacheReadTokens:y.cacheReadTokens||0,cacheCreationTokens:y.cacheCreationTokens||0,cacheHitRate:y.cacheHitRate||0,totalTurns:y.totalTurns||0,agentCount:y.agentCount||0,savings:y.savings||{}},w=Q.totalTokens+(Q.savings.total||0),T=w>0?(Q.savings.total||0)/w*100:0,k=Q.totalOutputTokens>0?(Q.totalInputTokens/Q.totalOutputTokens).toFixed(1):"—",P=t.timeline||{},$=P.snapshots||[],_=P.events||t.events||[],G=[{label:"Tokens Used",value:Je(Q.totalTokens),sparkData:o.tokens,color:xe.accent},{label:"Total Cost",value:Mc(Q.totalCostUsd),sparkData:o.cost,color:xe.warning},{label:"Tokens Saved",value:Je(Q.savings.total||0),sparkData:o.saved,color:xe.success},{label:"Efficiency",value:ks(T),sparkData:o.efficiency,color:xe.purple},{label:"Cache Rate",value:ks(Q.cacheHitRate*100),sparkData:o.cache,color:xe.info},{label:"I/O Ratio",value:`${k}:1`,sparkData:o.inputOutput,color:xe.orange},{label:"Agents",value:`${b}/${s.length}`,sparkData:o.agents,color:xe.accent},{label:"Turns",value:Je(Q.totalTurns),sparkData:o.turns,color:xe.text2}];return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx(e0,{connected:l,runningCount:b,totalCount:s.length,uptime:t.uptime||0,lastFetch:u,activeTeam:t.activeTeam}),i.jsx(QC,{kpis:G}),i.jsxs("div",{className:"flex-1 min-h-0 grid",style:{gridTemplateRows:"minmax(0, 1fr) minmax(0, 1fr)",gridTemplateColumns:"3fr 1.5fr 1.5fr",background:"#282c34",gap:"1px"},children:[i.jsx("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 relative",children:i.jsx(TC,{data:$})}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-l border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Cache Performance"})}),i.jsx(NC,{cacheRead:Q.cacheReadTokens,cacheCreation:Q.cacheCreationTokens,totalInput:Q.totalInputTokens})]}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-l border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Model Routing"})}),i.jsx(PC,{routing:O,agentBreakdown:d})]}),i.jsxs("div",{className:"min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-t border-border",children:[i.jsx("div",{className:"px-3 pt-2.5 pb-1 flex-shrink-0",children:i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase tracking-widest",children:"Agent Fleet"})}),i.jsx($C,{agentBreakdown:d,rotating:g})]}),i.jsx("div",{className:"col-span-2 min-w-0 min-h-0 overflow-hidden bg-surface-1 flex flex-col border-t border-l border-border",children:i.jsx(eX,{tokens:Q,rotation:m,adaptive:p,journalist:x})})]}),i.jsx("div",{className:"flex-shrink-0 bg-surface-1 border-t border-border",children:i.jsx(sX,{events:_})})]})}const s0={sm:12,md:16,lg:20};function iX({fill:t="full",size:n,color:s="#fbbf24",emptyColor:l="rgba(255,255,255,0.4)"}){const o=`star-${Math.random().toString(36).slice(2,8)}`;return i.jsxs("svg",{width:n,height:n,viewBox:"0 0 20 20",fill:"none",children:[t==="half"&&i.jsx("defs",{children:i.jsxs("linearGradient",{id:o,children:[i.jsx("stop",{offset:"50%",stopColor:s}),i.jsx("stop",{offset:"50%",stopColor:l})]})}),i.jsx("path",{d:"M10 1.5l2.47 5.01 5.53.8-4 3.9.94 5.49L10 14.27 5.06 16.7 6 11.21l-4-3.9 5.53-.8L10 1.5z",fill:t==="full"?s:t==="half"?`url(#${o})`:l})]})}function Ky({rating:t=0,count:n,size:s="sm"}){const l=s0[s]||s0.sm,o=[];for(let u=1;u<=5;u++)t>=u?o.push("full"):t>=u-.5?o.push("half"):o.push("empty");return i.jsxs("span",{className:"inline-flex items-center",style:{gap:1},children:[o.map((u,d)=>i.jsx(iX,{fill:u,size:l},d)),n!=null&&i.jsxs("span",{className:"ml-1 text-[11px] text-[var(--text-dim,#6b7f95)] font-sans",children:["(",n,")"]})]})}const l0={design:{color:"#c678dd",bg:"rgba(198,120,221,0.12)"},quality:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},devtools:{color:"#33afbc",bg:"rgba(51,175,188,0.14)"},workflow:{color:"#fbbf24",bg:"rgba(251,191,36,0.12)"},security:{color:"#f87171",bg:"rgba(248,113,113,0.12)"},specialized:{color:"#f59e0b",bg:"rgba(245,158,11,0.12)"},verified:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},anthropic:{color:"#f59e0b",bg:"rgba(245,158,11,0.12)"},published:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"},draft:{color:"#6b7f95",bg:"rgba(255,255,255,0.06)"},review:{color:"#c678dd",bg:"rgba(198,120,221,0.12)"},rejected:{color:"#f87171",bg:"rgba(248,113,113,0.12)"},free:{color:"#4ade80",bg:"rgba(74,222,128,0.12)"}};function Jy({label:t,variant:n,className:s}){const l=l0[n]||l0.draft;return i.jsx("span",{className:le("inline-flex items-center whitespace-nowrap font-sans select-none",s),style:{padding:"3px 8px",borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",lineHeight:1.4,color:l.color,background:l.bg},children:t})}function eS({price:t=0,size:n="sm"}){const s=!t||t===0,l={sm:"text-2xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-xs px-3 py-1"};return i.jsx("span",{className:`inline-flex items-center font-mono font-semibold rounded whitespace-nowrap ${l[n]||l.sm} ${s?"bg-success/12 text-success":"bg-white/8 text-text-1"}`,children:s?"Free":`$${t.toFixed(2)}`})}function tS({type:t="verified",size:n=12}){const s=t==="claude-official"||t==="anthropic"?"#f59e0b":"#4ade80";return i.jsxs("svg",{width:n,height:n,viewBox:"0 0 20 20",fill:"none",className:"inline-block flex-shrink-0",children:[i.jsx("path",{d:"M10 0l2.36 3.15L16.18 2l.68 3.93L20.8 7.1l-1.87 3.52L20.8 14.14l-3.94 1.17-.68 3.93-3.82-1.15L10 21.24l-2.36-3.15-3.82 1.15-.68-3.93-3.94-1.17 1.87-3.52L-.8 7.1l3.94-1.17.68-3.93 3.82 1.15L10 0z",fill:s}),i.jsx("path",{d:"M7 10.5l2 2 4-4.5",fill:"none",stroke:"#24282f",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const aS="groove_favorites";function yh(){try{return JSON.parse(localStorage.getItem(aS)||"[]")}catch{return[]}}function oX(t){return yh().includes(t)}function cX(t){const n=yh(),s=n.indexOf(t);return s>=0?n.splice(s,1):n.push(t),localStorage.setItem(aS,JSON.stringify(n)),s<0}function uX(t){const n=new Set(yh());return t.map(s=>({...s,favorited:n.has(s.id)}))}function dX({filled:t,size:n=16}){return i.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:t?"#f87171":"none",stroke:t?"#f87171":"rgba(255,255,255,0.3)",strokeWidth:"2",children:i.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})})}function OX(){return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function fX({skill:t,onClick:n}){var u,d;const[s,l]=v.useState(()=>oX(t.id));function o(O){O.stopPropagation(),l(cX(t.id))}return i.jsxs("div",{onClick:()=>n==null?void 0:n(t),className:le("flex flex-col cursor-pointer group","bg-surface-1 border border-border-subtle rounded-md","hover:border-accent/30 hover:bg-surface-2","transition-all duration-150"),style:{padding:20,minHeight:280},children:[i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 bg-accent/12 text-[20px]",children:t.icon||((d=(u=t.name)==null?void 0:u[0])==null?void 0:d.toUpperCase())||"?"}),i.jsx("button",{onClick:o,className:"opacity-40 group-hover:opacity-80 hover:!opacity-100 transition-opacity cursor-pointer bg-transparent border-0 p-0",children:i.jsx(dX,{filled:s})})]}),i.jsx("div",{className:"mt-3 text-[15px] font-semibold text-text-0 font-sans line-clamp-2 leading-snug",children:t.name}),i.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-xs text-text-3 font-sans",children:[i.jsxs("span",{children:["by ",t.author||"Community"]}),(t.source==="claude-official"||t.verified)&&i.jsx(tS,{type:t.source,size:12})]}),i.jsx("div",{className:"mt-2.5 text-xs text-text-2 font-sans line-clamp-3 flex-1 leading-relaxed",children:t.description}),i.jsx("div",{className:"mt-3",children:i.jsx(Jy,{label:t.category||"general",variant:t.category||"draft"})}),i.jsx("div",{className:"h-px bg-border-subtle my-3"}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(Ky,{rating:t.rating||0,count:t.rating_count||t.ratingCount||0,size:"sm"}),i.jsxs("span",{className:"flex items-center gap-1 text-xs text-text-3 font-mono",children:[i.jsx(OX,{}),Je(t.downloads||0)]}),i.jsx(eS,{price:t.price||0,size:"sm"})]})]})}function nS(){return i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md animate-pulse",style:{padding:20,minHeight:280},children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-surface-4"}),i.jsx("div",{className:"mt-3 h-4 w-[70%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-2 h-3 w-[40%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-3.5 h-3 w-full rounded bg-surface-4"}),i.jsx("div",{className:"mt-1.5 h-3 w-[90%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-1.5 h-3 w-[60%] rounded bg-surface-4"}),i.jsx("div",{className:"mt-3.5 h-5 w-[50px] rounded bg-surface-4"}),i.jsx("div",{className:"h-px bg-surface-4 my-3"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("div",{className:"h-3 w-16 rounded bg-surface-4"}),i.jsx("div",{className:"h-3 w-12 rounded bg-surface-4"}),i.jsx("div",{className:"h-3 w-10 rounded bg-surface-4"})]})]})}const hX={slack:"https://cdn.simpleicons.org/slack/E01E5A",github:"https://cdn.simpleicons.org/github/white",stripe:"https://cdn.simpleicons.org/stripe/635BFF",gmail:"https://cdn.simpleicons.org/gmail/EA4335","google-calendar":"https://cdn.simpleicons.org/googlecalendar/4285F4","google-drive":"https://cdn.simpleicons.org/googledrive/4285F4","google-maps":"https://cdn.simpleicons.org/googlemaps/4285F4",postgres:"https://cdn.simpleicons.org/postgresql/4169E1",notion:"https://cdn.simpleicons.org/notion/white",discord:"https://cdn.simpleicons.org/discord/5865F2",linear:"https://cdn.simpleicons.org/linear/5E6AD2","brave-search":"https://cdn.simpleicons.org/brave/FB542B","home-assistant":"https://cdn.simpleicons.org/homeassistant/18BCF2"};function mX({item:t,size:n=40}){const s=hX[t.id];if(s)return i.jsxs("div",{className:"rounded-md bg-surface-4 flex items-center justify-center flex-shrink-0 overflow-hidden",style:{width:n,height:n},children:[i.jsx("img",{src:s,alt:t.name,className:"w-5 h-5",onError:u=>{u.target.style.display="none",u.target.nextSibling.style.display="flex"}}),i.jsx("div",{className:"hidden items-center justify-center w-full h-full text-lg font-bold font-sans text-text-1",children:(t.name||"?")[0]})]});const l=(t.name||"?")[0].toUpperCase(),o=t.name?t.name.charCodeAt(0)*37%360:200;return i.jsx("div",{className:"rounded-md flex items-center justify-center flex-shrink-0 text-lg font-bold font-sans",style:{width:n,height:n,background:`hsl(${o}, 40%, 18%)`,color:`hsl(${o}, 60%, 65%)`},children:l})}function pX({item:t,onClick:n,className:s}){var o;const l=t.installed;return i.jsxs("button",{onClick:()=>n(t),className:le("flex flex-col p-5 rounded-md border border-border-subtle bg-surface-1 text-left","hover:border-accent/30 hover:bg-surface-2","transition-all duration-150 cursor-pointer group",s),style:{minHeight:200},children:[i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx(mX,{item:t,size:36}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-[14px] font-semibold text-text-0 font-sans truncate",children:t.name}),(t.verified||t.verified==="mcp-official")&&i.jsx(Ir,{size:11,className:"text-accent flex-shrink-0"})]}),i.jsx("span",{className:"text-2xs text-text-3 font-sans",children:t.author||"Community"})]})]}),i.jsx("p",{className:"text-xs text-text-2 font-sans line-clamp-3 mb-3 flex-1 leading-relaxed",children:t.description}),i.jsx("div",{className:"h-px bg-border-subtle my-2"}),i.jsxs("div",{className:"flex items-center gap-3 text-2xs text-text-3 font-sans",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Df,{size:10}),Je(t.downloads||0)]}),(t.rating||0)>0&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Db,{size:10,className:"text-warning",fill:"currentColor"}),(o=t.rating)==null?void 0:o.toFixed(1)]}),i.jsx("span",{className:"flex-1"}),l&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Installed"})]})]})}function sS({value:t,onChange:n,placeholder:s="Search skills, tags, authors...",large:l}){const[o,u]=v.useState(t||""),d=v.useRef(null);v.useEffect(()=>{u(t||"")},[t]);function O(m){const p=m.target.value;u(p),clearTimeout(d.current),d.current=setTimeout(()=>n(p),300)}return i.jsxs("div",{className:"relative w-full",children:[i.jsx(Cs,{size:16,className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-text-4 pointer-events-none"}),i.jsx("input",{value:o,onChange:O,placeholder:s,className:le("w-full font-sans outline-none","bg-surface-0 border border-border text-text-0 placeholder:text-text-4","focus:border-accent/40 transition-colors",l?"py-3 pl-11 pr-12 text-[15px] rounded-lg":"py-2.5 pl-10 pr-3 text-sm rounded-md")}),l&&i.jsx("kbd",{className:"absolute right-3.5 top-1/2 -translate-y-1/2 bg-surface-4 text-text-4 px-2 py-0.5 rounded text-xs font-mono",children:"/"})]})}const xX=[{id:"",label:"All"},{id:"design",label:"Design"},{id:"quality",label:"Quality"},{id:"devtools",label:"Dev Tools"},{id:"workflow",label:"Workflow"},{id:"security",label:"Security"},{id:"specialized",label:"Specialized"}];function gX({selected:t="",categories:n=xX,onSelect:s}){return i.jsx("div",{className:"flex gap-2 overflow-x-auto",style:{scrollbarWidth:"none"},children:n.map(l=>{const o=t===l.id;return i.jsx("button",{onClick:()=>s(l.id),className:le("whitespace-nowrap font-sans cursor-pointer select-none transition-all text-[13px] rounded-full border",o?"bg-accent text-surface-0 border-accent font-semibold":"bg-surface-1 text-text-3 border-border-subtle hover:text-text-1 hover:border-border font-medium"),style:{padding:"7px 16px"},children:l.label},l.id)})})}function Wc(){const t=L(n=>n.addToast);return{success:(n,s)=>t("success",n,s),error:(n,s)=>t("error",n,s),info:(n,s)=>t("info",n,s),warning:(n,s)=>t("warning",n,s)}}function bX({skill:t,onBack:n}){var w,T,k;const s=Wc(),[l,o]=v.useState(""),[u,d]=v.useState(!1),[O,m]=v.useState(!1),[p,x]=v.useState(t.installed),[g,b]=v.useState(!0);v.useEffect(()=>{b(!0),te.get(`/skills/${t.id}/content`).then(P=>{o(P.content||""),d(P.requiresPurchase||!1)}).catch(()=>{}).finally(()=>b(!1))},[t.id]);async function y(){m(!0);try{await te.post(`/skills/${t.id}/install`),x(!0),s.success(`${t.name} installed`)}catch(P){s.error("Install failed",P.message)}m(!1)}async function Q(){const{marketplaceAuthenticated:P,marketplaceLogin:$,marketplaceCheckout:_}=L.getState();if(!P){$();return}try{await _(t.id)}catch{}}return i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-6 py-5",children:[i.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-text-3 font-sans hover:text-text-0 cursor-pointer bg-transparent border-0 mb-4",children:[i.jsx(Tb,{size:14})," Back"]}),i.jsxs("div",{className:"flex gap-8",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-11 h-11 rounded-lg flex items-center justify-center flex-shrink-0 bg-accent/10 border border-accent/20 text-[22px]",children:t.icon||((T=(w=t.name)==null?void 0:w[0])==null?void 0:T.toUpperCase())}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h1",{className:"text-lg font-bold text-text-0 font-sans",children:t.name}),i.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-text-3 font-sans",children:[i.jsx("span",{children:t.author||"Community"}),(t.source==="claude-official"||t.verified)&&i.jsx(tS,{type:t.source,size:13})]})]})]}),i.jsx("p",{className:"mt-3 text-sm text-text-2 font-sans leading-relaxed",children:t.description}),((k=t.tags)==null?void 0:k.length)>0&&i.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:t.tags.map(P=>i.jsx("span",{className:"text-2xs text-text-3 font-sans px-2 py-0.5 rounded bg-surface-4",children:P},P))}),i.jsx("div",{className:"h-px bg-border-subtle my-5"}),g?i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"h-3 w-48 bg-surface-4 rounded animate-pulse"}),i.jsx("div",{className:"h-3 w-full bg-surface-4 rounded animate-pulse"}),i.jsx("div",{className:"h-3 w-3/4 bg-surface-4 rounded animate-pulse"})]}):l?i.jsxs("div",{className:"text-sm text-text-2 font-sans leading-relaxed",children:[i.jsx("h2",{className:"text-sm font-semibold text-text-0 mb-2",children:"About"}),i.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:l})]}):u?i.jsxs("div",{className:"bg-warning/5 border border-warning/15 rounded-lg px-4 py-3",children:[i.jsx("p",{className:"text-sm text-text-1 font-sans font-medium",children:"Paid skill — purchase to view content"}),i.jsx("p",{className:"text-xs text-text-3 font-sans mt-1",children:"Sign in and purchase this skill to access its full instructions."})]}):i.jsx("p",{className:"text-xs text-text-4 font-sans",children:"Content loading failed — check your connection."})]}),i.jsx("div",{className:"w-[240px] flex-shrink-0",children:i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-lg p-4 sticky top-4",children:[i.jsx(eS,{price:t.price||0,size:"md"}),u&&!p?i.jsxs("button",{onClick:Q,className:"w-full mt-3 py-2 px-3 text-xs font-sans font-semibold rounded cursor-pointer transition-all hover:opacity-85 flex items-center justify-center gap-2 border bg-warning/15 text-warning border-warning/20 hover:bg-warning/25",children:["Buy $",(t.price||0).toFixed(2)]}):i.jsx("button",{onClick:y,disabled:O||p,className:`w-full mt-3 py-2 px-3 text-xs font-sans font-semibold rounded cursor-pointer transition-all hover:opacity-85 disabled:opacity-60 disabled:cursor-not-allowed flex items-center justify-center gap-2 border ${p?"bg-success/15 text-success border-success/20":"bg-accent/15 text-accent border-accent/20 hover:bg-accent/25"}`,children:O?"Installing...":p?"✓ Installed":"Install"}),i.jsx("div",{className:"mt-4 flex flex-col gap-2.5",children:[["Downloads",i.jsx("span",{className:"font-mono text-text-0",children:Je(t.downloads||0)},"d")],["Rating",i.jsx(Ky,{rating:t.rating||0,count:t.rating_count||t.ratingCount,size:"sm"},"r")],["Version",i.jsx("span",{className:"font-mono text-text-0",children:t.version||"1.0.0"},"v")],["Category",i.jsx(Jy,{label:t.category||"general",variant:t.category||"draft"},"c")],["Source",i.jsx("span",{className:"text-text-0",children:t.source==="claude-official"?"Anthropic":"Community"},"s")]].map(([P,$])=>i.jsxs("div",{className:"flex justify-between items-center text-xs font-sans",children:[i.jsx("span",{className:"text-text-3",children:P}),$]},P))})]})})]})]})})}function vX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),[o,u]=v.useState(""),[d,O]=v.useState(""),[m,p]=v.useState("popular"),[x,g]=v.useState(null);return v.useEffect(()=>{l(!0);const b=new URLSearchParams;o&&b.set("search",o),d&&b.set("category",d),m&&b.set("sort",m),te.get(`/skills/registry?${b}`).then(y=>n(uX(y.skills||y.items||(Array.isArray(y)?y:[])))).catch(()=>n([])).finally(()=>l(!1))},[o,d,m]),x?i.jsx(bX,{skill:x,onBack:()=>g(null)}):i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-72",children:i.jsx(sS,{value:o,onChange:u})}),i.jsx(gX,{selected:d,onSelect:O}),i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsxs("select",{value:m,onChange:b=>p(b.target.value),className:"appearance-none font-sans cursor-pointer pr-7 py-2 pl-3 text-xs bg-surface-0 border border-border-subtle rounded text-text-1 focus:outline-none",children:[i.jsx("option",{value:"popular",children:"Popular"}),i.jsx("option",{value:"rating",children:"Top Rated"}),i.jsx("option",{value:"newest",children:"Newest"}),i.jsx("option",{value:"name",children:"A-Z"})]}),i.jsx(Hn,{size:12,className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-4 pointer-events-none"})]}),i.jsx("span",{className:"text-2xs text-text-4 font-mono flex-shrink-0",children:t.length})]}),i.jsx("div",{className:"mt-4 grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:s?Array.from({length:8}).map((b,y)=>i.jsx(nS,{},y)):t.map(b=>i.jsx(fX,{skill:b,onClick:g},b.id))}),!s&&t.length===0&&i.jsx("div",{className:"text-center py-16 text-text-4 font-sans text-sm",children:"No skills found."})]})})}function yX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),[o,u]=v.useState(""),d=Wc();return v.useEffect(()=>{l(!0),te.get(`/integrations/registry?search=${encodeURIComponent(o)}`).then(O=>n(O.integrations||O.items||(Array.isArray(O)?O:[]))).catch(()=>n([])).finally(()=>l(!1))},[o]),i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-72",children:i.jsx(sS,{value:o,onChange:u,placeholder:"Search integrations..."})}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"text-2xs text-text-4 font-mono flex-shrink-0",children:t.length})]}),i.jsx("div",{className:"mt-4 grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:s?Array.from({length:6}).map((O,m)=>i.jsx(nS,{},m)):t.map(O=>i.jsx(pX,{item:O,onClick:()=>d.info(`${O.name} — install via CLI: groove integrations install ${O.id}`)},O.id))}),!s&&t.length===0&&i.jsx("div",{className:"text-center py-16 text-text-4 font-sans text-sm",children:"No integrations found."})]})})}function SX(){const t=L(g=>g.marketplaceAuthenticated),n=L(g=>g.marketplaceLogin),[s,l]=v.useState([]),[o,u]=v.useState([]),[d,O]=v.useState(!0),m=Wc(),p=v.useRef(null);v.useEffect(()=>{O(!0),Promise.all([t?te.get("/auth/purchases").then(g=>g.purchases||[]).catch(()=>[]):Promise.resolve([]),te.get("/skills/installed").then(g=>Array.isArray(g)?g:g.skills||[]).catch(()=>[])]).then(([g,b])=>{l(g),u(b)}).finally(()=>O(!1))},[t]);async function x(g){var y;const b=(y=g.target.files)==null?void 0:y[0];if(b){try{const Q=await b.text(),w=b.name.replace(/\.md$/i,"");await te.post("/skills/import",{name:w,content:Q}),m.success(`Imported "${w}"`);const T=await te.get("/skills/installed");u(Array.isArray(T)?T:T.skills||[])}catch(Q){m.error("Import failed",Q.message)}g.target.value=""}}return d?i.jsx("div",{className:"p-5 space-y-3",children:[...Array(4)].map((g,b)=>i.jsx(ra,{className:"h-14 rounded-md"},b))}):i.jsx(es,{className:"h-full",children:i.jsxs("div",{className:"px-5 py-4 space-y-6",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("input",{ref:p,type:"file",accept:".md",onChange:x,className:"hidden"}),i.jsxs(je,{variant:"secondary",size:"md",onClick:()=>{var g;return(g=p.current)==null?void 0:g.click()},className:"gap-1.5",children:[i.jsx($N,{size:13}),"Import .md Skill"]}),i.jsx("span",{className:"text-2xs text-text-4 font-sans",children:"Drop a markdown skill file to install locally"})]}),t&&s.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider mb-3 flex items-center gap-1.5",children:[i.jsx(yO,{size:12}),"Purchases (",s.length,")"]}),i.jsx("div",{className:"space-y-1.5",children:s.map(g=>{var b,y;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md bg-surface-1 border border-border-subtle",children:[i.jsx("div",{className:"w-8 h-8 rounded-md bg-accent/10 flex items-center justify-center text-sm flex-shrink-0",children:g.skill_icon||((y=(b=g.skill_name)==null?void 0:b[0])==null?void 0:y.toUpperCase())||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:g.skill_name||g.skill_id}),i.jsxs("div",{className:"text-2xs text-text-4 font-sans",children:["$",(g.amount||0).toFixed(2)," · ",vt(g.created_at)]})]}),i.jsx(Ge,{variant:"success",className:"text-2xs flex-shrink-0",children:"Owned"})]},g.id||g.skill_id)})})]}),t&&s.length===0&&i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(yO,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-3 font-sans",children:"No purchases yet"})]}),!t&&i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(yO,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-2 font-sans mb-3",children:"Sign in to see your purchases"}),i.jsxs(je,{variant:"primary",size:"sm",onClick:n,className:"gap-1.5 mx-auto",children:[i.jsx(Hf,{size:12})," Sign in"]})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider mb-3 flex items-center gap-1.5",children:[i.jsx(qb,{size:12}),"Installed (",o.length,")"]}),o.length===0?i.jsxs("div",{className:"bg-surface-1 border border-border-subtle rounded-md px-4 py-6 text-center",children:[i.jsx(Df,{size:20,className:"mx-auto text-text-4 mb-2"}),i.jsx("p",{className:"text-xs text-text-3 font-sans",children:"No skills installed — browse the Skills tab or import a .md file"})]}):i.jsx("div",{className:"space-y-1.5",children:o.map(g=>{var b,y;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md bg-surface-1 border border-border-subtle group",children:[i.jsx("div",{className:"w-8 h-8 rounded-md bg-accent/10 flex items-center justify-center text-sm flex-shrink-0",children:g.icon||((y=(b=g.name)==null?void 0:b[0])==null?void 0:y.toUpperCase())||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:g.name||g.id}),i.jsx("div",{className:"text-2xs text-text-3 font-sans truncate",children:g.description||g.category||"local skill"})]}),i.jsx(Ge,{variant:"accent",className:"text-2xs flex-shrink-0",children:"Installed"})]},g.id)})})]})]})})}function QX(){const t=L(o=>o.marketplaceAuthenticated),n=L(o=>o.marketplaceUser),s=L(o=>o.marketplaceLogin),l=L(o=>o.marketplaceLogout);return t?i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-surface-3 border border-border-subtle",children:[i.jsx("div",{className:"w-4 h-4 rounded-full bg-accent/20 flex items-center justify-center",children:i.jsx(Wb,{size:9,className:"text-accent"})}),i.jsx("span",{className:"text-xs text-text-0 font-sans font-medium max-w-[120px] truncate",children:(n==null?void 0:n.displayName)||(n==null?void 0:n.id)||"Account"})]}),i.jsx("button",{onClick:l,className:"flex items-center gap-1 px-2 py-1.5 rounded text-xs text-text-3 hover:text-text-0 hover:bg-surface-3 font-sans cursor-pointer transition-colors",children:i.jsx(Zb,{size:11})})]}):i.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold font-sans text-text-0 bg-accent/15 border border-accent/25 rounded hover:bg-accent/25 cursor-pointer transition-colors",children:[i.jsx(Hf,{size:12}),"Sign in"]})}function jX(){const[t,n]=v.useState("skills"),s=[{id:"skills",label:"Skills",icon:Lr},{id:"integrations",label:"Integrations",icon:Mb},{id:"library",label:"My Library",icon:qb}];return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"flex-shrink-0 bg-surface-1 border-b border-border-subtle",children:i.jsxs("div",{className:"flex items-center px-5 h-11",children:[i.jsx("div",{className:"flex items-center",children:s.map(l=>{const o=l.icon;return i.jsxs("button",{onClick:()=>n(l.id),className:`flex items-center gap-1.5 px-3 py-2.5 text-xs font-semibold font-sans cursor-pointer select-none border-b-2 -mb-px transition-colors ${t===l.id?"border-accent text-text-0":"border-transparent text-text-3 hover:text-text-1"}`,children:[i.jsx(o,{size:12}),l.label]},l.id)})}),i.jsx("div",{className:"flex-1"}),i.jsx(QX,{})]})}),i.jsxs("div",{className:"flex-1 min-h-0",children:[t==="skills"&&i.jsx(vX,{}),t==="integrations"&&i.jsx(yX,{}),t==="library"&&i.jsx(SX,{})]})]})}function wX(){const t=L(u=>u.teams),n=L(u=>u.agents),s=L(u=>u.activeTeamId),l=L(u=>u.deleteTeam),o=L(u=>u.addToast);return t.length===0?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center space-y-2",children:[i.jsx(hi,{size:28,className:"mx-auto text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No teams yet"}),i.jsx("p",{className:"text-2xs font-sans text-text-4",children:"Teams are created when you spawn agents or launch a planner"})]})}):i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"p-4 space-y-3",children:t.map(u=>{const d=n.filter(y=>y.teamId===u.id),O=d.filter(y=>y.status==="running"||y.status==="starting"),m=d.filter(y=>y.status==="completed"),p=d.filter(y=>y.status==="crashed"),x=d.reduce((y,Q)=>y+(Q.tokensUsed||0),0),g=d.reduce((y,Q)=>y+(Q.costUsd||0),0),b=u.id===s;return i.jsxs("div",{className:le("rounded-md border bg-surface-1 overflow-hidden transition-colors",b?"border-accent/30":"border-border-subtle"),children:[i.jsxs("div",{className:"px-4 py-3 flex items-center gap-3",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm font-semibold text-text-0 font-sans",children:u.name}),b&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Active"})]}),u.workingDir&&i.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[i.jsx(Rb,{size:10,className:"text-text-4"}),i.jsx("span",{className:"text-2xs font-mono text-text-3 truncate",children:u.workingDir})]})]}),i.jsx("button",{onClick:()=>{if(d.some(y=>y.status==="running")){o("error","Stop running agents first");return}l(u.id)},className:"p-1.5 text-text-4 hover:text-danger rounded transition-colors cursor-pointer",title:"Delete team",children:i.jsx(fi,{size:13})})]}),i.jsxs("div",{className:"px-4 py-2.5 border-t border-border-subtle bg-surface-0 flex items-center gap-4",children:[i.jsx(gl,{label:"Agents",value:d.length}),i.jsx(gl,{label:"Running",value:O.length,color:O.length>0?"text-success":void 0}),i.jsx(gl,{label:"Done",value:m.length}),i.jsx(gl,{label:"Crashed",value:p.length,color:p.length>0?"text-danger":void 0}),i.jsx("div",{className:"flex-1"}),i.jsx(gl,{label:"Tokens",value:Je(x)}),g>0&&i.jsx(gl,{label:"Cost",value:Mc(g)})]}),d.length>0&&i.jsx("div",{className:"border-t border-border-subtle",children:d.map(y=>i.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b border-border-subtle last:border-b-0",children:[i.jsx(ws,{status:y.status,size:"sm"}),i.jsx("span",{className:"text-xs font-semibold text-text-0 font-sans truncate",children:y.name}),i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase",children:y.role}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"text-2xs font-mono text-text-2 tabular-nums",children:Je(y.tokensUsed||0)})]},y.id))})]},u.id)})})})}function gl({label:t,value:n,color:s}){return i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:le("text-xs font-mono tabular-nums",s||"text-text-1"),children:n}),i.jsx("div",{className:"text-2xs font-mono text-text-4 uppercase tracking-wider",children:t})]})}function kX(){const t=L(l=>l.pendingApprovals),n=L(l=>l.approveRequest),s=L(l=>l.rejectRequest);return t.length===0?null:i.jsxs("div",{className:"px-4 pt-4 space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(qc,{size:12,className:"text-warning"}),i.jsxs("span",{className:"text-2xs font-mono text-warning uppercase tracking-wider",children:["Pending (",t.length,")"]})]}),t.map(l=>{var o,u,d;return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-md bg-warning/5 border border-warning/20",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"text-xs text-text-0 font-sans font-medium truncate",children:[l.agentName,": ",((o=l.action)==null?void 0:o.description)||((u=l.action)==null?void 0:u.type)||"action"]}),((d=l.action)==null?void 0:d.filePath)&&i.jsx("div",{className:"text-2xs font-mono text-text-3 truncate mt-0.5",children:l.action.filePath}),i.jsx("div",{className:"text-2xs text-text-4 font-mono mt-0.5",children:vt(l.requestedAt)})]}),i.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[i.jsxs(je,{variant:"primary",size:"sm",onClick:()=>n(l.id),className:"h-7 px-2.5 gap-1 text-2xs",children:[i.jsx(Gb,{size:10})," Approve"]}),i.jsxs(je,{variant:"danger",size:"sm",onClick:()=>s(l.id),className:"h-7 px-2.5 gap-1 text-2xs",children:[i.jsx(pN,{size:10})," Reject"]})]})]},l.id)})]})}function $X(){const t=L(m=>m.resolvedApprovals),[n,s]=v.useState([]),[l,o]=v.useState(!0);v.useEffect(()=>{const m=setInterval(u,4e3);return u(),()=>clearInterval(m)},[]);async function u(){try{const m=await te.get("/pm/history");s(m.history||m||[])}catch{}o(!1)}const d=new Set,O=[...t,...n].filter(m=>{const p=m.id||`${m.agentName}-${m.timestamp}`;return d.has(p)?!1:(d.add(p),!0)});return i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.jsx(kX,{}),i.jsxs("div",{className:"p-4 space-y-1.5",children:[l&&O.length===0&&i.jsx("div",{className:"text-center py-12 text-text-4 font-mono text-xs",children:"Loading..."}),!l&&O.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Ir,{size:24,className:"mx-auto mb-2 text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No approval history"}),i.jsx("p",{className:"text-2xs text-text-4 font-sans mt-1",children:"Approvals appear when agents use Auto permission mode"})]}),O.map((m,p)=>{var g;const x=m.status==="approved"||m.verdict==="approved";return i.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-md bg-surface-0 border border-border-subtle",children:[x?i.jsx(Ir,{size:12,className:"text-success flex-shrink-0"}):i.jsx(Nb,{size:12,className:"text-danger flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"text-xs text-text-1 font-sans truncate",children:[i.jsx("span",{className:"font-medium text-text-0",children:m.agentName}),i.jsx("span",{className:"text-text-3 mx-1",children:"·"}),i.jsx("span",{children:((g=m.action)==null?void 0:g.description)||m.action||"action"})]}),m.reason&&i.jsx("div",{className:"text-2xs text-text-3 font-sans truncate mt-0.5",children:m.reason})]}),i.jsx("span",{className:"text-2xs font-mono text-text-4 flex-shrink-0",children:vt(m.resolvedAt||m.timestamp)})]},m.id||p)})]})]})}function TX(){const[t,n]=v.useState([]),[s,l]=v.useState(!0),o=Wc();v.useEffect(()=>{const O=setInterval(u,1e4);return u(),()=>clearInterval(O)},[]);async function u(){try{const O=await te.get("/schedules");n(O.schedules||O||[])}catch{}l(!1)}async function d(O,m){try{await te.post(`/schedules/${O}/${m?"disable":"enable"}`),u()}catch(p){o.error("Failed to toggle schedule",p.message)}}return i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsxs("div",{className:"p-4 space-y-2",children:[s&&t.length===0&&i.jsx("div",{className:"text-center py-12 text-text-4 font-mono text-xs",children:"Loading..."}),!s&&t.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Oc,{size:24,className:"mx-auto mb-2 text-text-4"}),i.jsx("p",{className:"text-xs font-sans text-text-3",children:"No schedules configured"}),i.jsx("p",{className:"text-2xs text-text-4 font-sans mt-1",children:"Use the CLI to create agent schedules"})]}),t.map(O=>i.jsxs("div",{className:"rounded-md border border-border-subtle bg-surface-0 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-text-0 font-sans",children:O.name}),i.jsx(Ge,{variant:O.enabled?"success":"default",className:"text-2xs",children:O.enabled?"Active":"Paused"})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("span",{className:"text-2xs font-mono text-text-2",children:O.cron}),i.jsx("span",{className:"text-2xs text-text-4",children:"·"}),i.jsx("span",{className:"text-2xs font-mono text-text-3 uppercase",children:O.role}),O.teamId&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-2xs text-text-4",children:"·"}),i.jsx("span",{className:"text-2xs font-sans text-text-3",children:O.teamName||O.teamId})]})]}),O.prompt&&i.jsx("div",{className:"text-2xs font-sans text-text-4 mt-1 truncate",children:O.prompt})]}),i.jsx(je,{variant:"secondary",size:"sm",onClick:()=>d(O.id,O.enabled),className:"h-7 px-2.5 gap-1 text-2xs",children:O.enabled?i.jsxs(i.Fragment,{children:[i.jsx(DT,{size:10})," Pause"]}):i.jsxs(i.Fragment,{children:[i.jsx(FT,{size:10})," Enable"]})})]}),O.lastRunAt&&i.jsxs("div",{className:"px-4 py-1.5 border-t border-border-subtle bg-surface-1 text-2xs font-mono text-text-4",children:["Last run: ",vt(O.lastRunAt),O.nextRunAt&&i.jsxs("span",{className:"ml-3",children:["Next: ",vt(O.nextRunAt)]})]})]},O.id))]})})}function NX(){return i.jsxs(Iy,{defaultValue:"dashboard",className:"flex flex-col h-full",children:[i.jsxs("div",{className:"px-4 pt-3 bg-surface-1 border-b border-border",children:[i.jsx("div",{className:"flex items-center gap-4 mb-0",children:i.jsx("h2",{className:"text-xs font-semibold text-text-0 font-sans tracking-wide uppercase",children:"Management"})}),i.jsxs(Fy,{className:"border-b-0",children:[i.jsxs(Nl,{value:"dashboard",className:"inline-flex items-center gap-1.5",children:[i.jsx(QT,{size:12}),"Teams"]}),i.jsxs(Nl,{value:"approvals",className:"inline-flex items-center gap-1.5",children:[i.jsx(wT,{size:12}),"Approvals"]}),i.jsxs(Nl,{value:"schedules",className:"inline-flex items-center gap-1.5",children:[i.jsx(Oc,{size:12}),"Schedules"]})]})]}),i.jsx(Pl,{value:"dashboard",className:"flex-1 min-h-0",children:i.jsx(wX,{})}),i.jsx(Pl,{value:"approvals",className:"flex-1 min-h-0",children:i.jsx($X,{})}),i.jsx(Pl,{value:"schedules",className:"flex-1 min-h-0",children:i.jsx(TX,{})})]})}const PX={code:"Code",general:"General"},zX={light:"text-success",medium:"text-accent",heavy:"text-warning"};function RX(t){return t<1?`${Math.round(t*1024)} MB`:`${t} GB`}function lS({hardware:t}){if(!t)return null;const{totalRamGb:n,gpu:s,isAppleSilicon:l}=t;return i.jsxs("div",{className:"flex items-center gap-3 bg-surface-0 rounded-lg border border-border-subtle px-3 py-2.5",children:[i.jsx(If,{size:14,className:"text-text-3 flex-shrink-0"}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2 text-xs font-sans",children:[i.jsxs("span",{className:"text-text-0 font-semibold",children:[n," GB RAM"]}),s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-text-4",children:"·"}),i.jsx("span",{className:"text-text-2",children:s.name})]}),l&&i.jsx(Ge,{variant:"accent",className:"text-2xs",children:"Unified Memory"})]})})]})}function CX({onRecheck:t}){const[n,s]=v.useState(null),[l,o]=v.useState(!1),[u,d]=v.useState(!1),[O,m]=v.useState(!1),p=L(_=>_.addToast);v.useEffect(()=>{te.post("/providers/ollama/check").then(s).catch(()=>{})},[]);async function x(){o(!0);try{const _=await te.post("/providers/ollama/check");s(_),_.installed&&_.serverRunning?(p("success","Ollama is ready!"),t()):_.installed?p("info","Ollama installed — server needs to start"):p("info","Ollama not found — install and try again")}catch{}o(!1)}async function g(){d(!0);try{if((await te.post("/providers/ollama/serve")).ok){p("success","Ollama server started!");let G=!1;for(let X=0;X<5;X++){await new Promise(N=>setTimeout(N,2e3));const C=await te.post("/providers/ollama/check");if(s(C),C.serverRunning){G=!0;break}}G&&t()}}catch(_){p("error","Could not start server",_.message)}d(!1)}function b(_){navigator.clipboard.writeText(_),m(!0),setTimeout(()=>m(!1),2e3)}if(!n)return i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Loading..."});const{hardware:y,install:Q,requirements:w,installed:T,serverRunning:k}=n,P=y.totalRamGb>=w.minRAM,$=y.recommended;return i.jsxs("div",{className:"space-y-3 p-3",children:[i.jsx(lS,{hardware:y}),P?i.jsxs("div",{className:"flex items-start gap-2 bg-success/8 border border-success/20 rounded-lg px-3 py-2.5",children:[i.jsx(ia,{size:14,className:"text-success flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans",children:[i.jsx("span",{className:"text-success font-semibold",children:"Your system is ready."}),i.jsx("span",{className:"text-text-2 ml-1",children:$.code?`Recommended: ${$.code}`:`${y.totalRamGb} GB RAM available`})]})]}):i.jsxs("div",{className:"flex items-start gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans text-text-2",children:[i.jsxs("span",{className:"text-warning font-semibold",children:[y.totalRamGb," GB RAM detected."]})," ","Minimum ",w.minRAM," GB needed. Smallest models may still work."]})]}),T&&!k&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-start gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs font-sans text-text-2",children:[i.jsx("span",{className:"text-warning font-semibold",children:"Ollama installed but server not running."})," ","The server needs to be running to pull and use models."]})]}),i.jsxs(je,{variant:"primary",size:"md",onClick:g,disabled:u,className:"w-full gap-1.5",children:[i.jsx(Pa,{size:12}),u?"Starting...":"Start Ollama Server"]})]}),!T&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"text-xs font-semibold text-text-1 font-sans",children:"Install Ollama"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"flex-1 bg-surface-0 border border-border-subtle rounded-md px-3 py-2 text-xs font-mono text-text-1 truncate",children:Q.command}),i.jsxs(je,{variant:"secondary",size:"sm",onClick:()=>b(Q.command),className:"h-8 px-2.5 gap-1 flex-shrink-0",children:[O?i.jsx(ia,{size:12}):i.jsx(ff,{size:12}),O?"Copied":"Copy"]})]}),Q.alt&&i.jsx("p",{className:"text-2xs text-text-4 font-sans",children:Q.alt})]}),i.jsxs(je,{variant:"secondary",size:"md",onClick:x,disabled:l,className:"w-full gap-1.5",children:[i.jsx(Jn,{size:12,className:l?"animate-spin":""}),l?"Checking...":T?"Check again":"I installed it — check again"]})]})}function XX({model:t,isInstalled:n,isRecommended:s,canRun:l,onPull:o,onDelete:u,pulling:d}){const O=d===t.id;return i.jsxs("div",{className:le("flex items-center gap-2 px-3 py-2 border-t border-border-subtle transition-colors",!l&&"opacity-40"),children:[n?i.jsx(ia,{size:12,className:"text-success flex-shrink-0"}):i.jsx("div",{className:"w-3"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-xs font-mono text-text-1 truncate",children:t.name}),s&&i.jsx(Db,{size:10,className:"text-warning flex-shrink-0"})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[i.jsx("span",{className:le("text-2xs font-semibold font-sans",zX[t.tier]),children:t.tier}),i.jsx("span",{className:"text-2xs text-text-4 font-sans",children:RX(t.sizeGb)}),i.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:["· ",t.ramGb," GB RAM"]})]})]}),n?i.jsx("button",{onClick:()=>u(t.id),className:"p-1.5 text-text-4 hover:text-danger rounded transition-colors cursor-pointer",title:"Remove model",children:i.jsx(fi,{size:12})}):l?i.jsx(je,{variant:"secondary",size:"sm",onClick:()=>o(t.id),disabled:!!d,className:"h-7 px-2 text-2xs gap-1",children:O?i.jsxs(i.Fragment,{children:[i.jsx(Jn,{size:10,className:"animate-spin"})," Pulling..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Df,{size:10})," Pull"]})}):i.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:["Needs ",t.ramGb," GB"]})]})}function _X({onStopped:t}){const[n,s]=v.useState(null),l=L(d=>d.addToast);async function o(){s("stopping");try{(await te.post("/providers/ollama/stop")).ok?(l("info","Ollama server stopped"),t&&t()):l("error","Could not stop server")}catch(d){l("error","Stop failed",d.message)}s(null)}async function u(){s("restarting");try{(await te.post("/providers/ollama/restart")).ok?l("success","Ollama server restarted"):l("error","Restart failed")}catch(d){l("error","Restart failed",d.message)}s(null)}return i.jsxs("div",{className:"flex items-center gap-2 bg-success/8 border border-success/20 rounded-lg px-3 py-2",children:[i.jsxs("span",{className:"relative flex-shrink-0 w-[6px] h-[6px]",children:[i.jsx("span",{className:"absolute inset-0 rounded-full bg-success"}),i.jsx("span",{className:"absolute inset-[-2px] rounded-full bg-success opacity-20 animate-pulse"})]}),i.jsx("span",{className:"text-xs font-sans text-success font-semibold",children:"Server Running"}),i.jsx("span",{className:"text-2xs font-mono text-text-4",children:":11434"}),i.jsx("div",{className:"flex-1"}),i.jsxs("button",{onClick:u,disabled:!!n,className:"flex items-center gap-1 text-2xs font-sans text-text-3 hover:text-accent cursor-pointer transition-colors disabled:opacity-40",children:[i.jsx(Jn,{size:10,className:n==="restarting"?"animate-spin":""}),n==="restarting"?"Restarting...":"Restart"]}),i.jsxs("button",{onClick:o,disabled:!!n,className:"flex items-center gap-1 text-2xs font-sans text-text-3 hover:text-danger cursor-pointer transition-colors disabled:opacity-40",children:[i.jsx(on,{size:10}),n==="stopping"?"Stopping...":"Stop"]})]})}function ZX({onModelChange:t}){var N,B;const[n,s]=v.useState(null),[l,o]=v.useState(null),[u,d]=v.useState("code"),[O,m]=v.useState(!1),[p,x]=v.useState(!1),g=L(V=>V.addToast),b=v.useRef(!1);function y(){te.get("/providers/ollama/models").then(V=>{var ne;s(V),!b.current&&((ne=V.installed)==null?void 0:ne.length)===0&&(b.current=!0,setTimeout(y,2e3))}).catch(()=>{})}v.useEffect(()=>{y()},[]);async function Q(V){o(V);try{await te.post("/providers/ollama/pull",{model:V}),g("success",`Pulled ${V}`),y(),t&&t()}catch(ne){g("error",`Pull failed: ${ne.message}`)}o(null)}async function w(V){try{await te.delete(`/providers/ollama/models/${encodeURIComponent(V)}`),g("info",`Removed ${V}`),y(),t&&t()}catch(ne){g("error",`Delete failed: ${ne.message}`)}}if(!n)return i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Loading..."});const{installed:T,catalog:k,hardware:P}=n,$=new Set(T.map(V=>V.id)),_=P.totalRamGb,G=[(N=P.recommended)==null?void 0:N.code,(B=P.recommended)==null?void 0:B.general].filter(Boolean),X=k.filter(V=>V.category===u),C=O?X:X.filter(V=>V.ramGb<=_);return p?i.jsxs("div",{className:"space-y-3 p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-warning/8 border border-warning/20 rounded-lg px-3 py-2.5",children:[i.jsx(on,{size:14,className:"text-warning flex-shrink-0"}),i.jsxs("span",{className:"text-xs font-sans text-text-2",children:[i.jsx("span",{className:"text-warning font-semibold",children:"Ollama server stopped."})," ","Start it again to pull and use models."]})]}),i.jsxs(je,{variant:"primary",size:"md",onClick:async()=>{try{(await te.post("/providers/ollama/serve")).ok&&(g("success","Ollama server started!"),x(!1),b.current=!1,setTimeout(y,2e3))}catch(V){g("error","Could not start server",V.message)}},className:"w-full gap-1.5",children:[i.jsx(Pa,{size:12}),"Start Ollama Server"]})]}):i.jsxs("div",{className:"space-y-2 p-3",children:[i.jsx(_X,{onStopped:()=>x(!0)}),i.jsx(lS,{hardware:P}),T.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-sans text-text-2",children:[i.jsx(Xb,{size:12,className:"text-text-3"}),i.jsx("span",{className:"font-semibold",children:T.length})," model",T.length!==1?"s":""," installed"]}),i.jsx("div",{className:"flex bg-surface-0 rounded-lg p-0.5 border border-border-subtle",children:Object.entries(PX).map(([V,ne])=>i.jsx("button",{onClick:()=>d(V),className:le("flex-1 px-3 py-1.5 text-2xs font-semibold font-sans rounded-md transition-all cursor-pointer",u===V?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:ne},V))}),i.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-0 overflow-hidden",children:[C.map(V=>i.jsx(XX,{model:V,isInstalled:$.has(V.id),isRecommended:G.includes(V.id),canRun:V.ramGb<=_,onPull:Q,onDelete:w,pulling:l},V.id)),C.length===0&&i.jsxs("div",{className:"px-3 py-4 text-center text-xs text-text-4 font-sans",children:["No ",u," models available for your hardware"]})]}),!O&&X.length>C.length&&i.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 text-2xs text-text-3 hover:text-accent font-sans cursor-pointer transition-colors",children:[i.jsx(Hn,{size:10}),"Show ",X.length-C.length," more (exceed your RAM)"]})]})}function rS({isInstalled:t,onModelChange:n}){const[s,l]=v.useState(!1),[o,u]=v.useState(!1);return v.useEffect(()=>{t?te.post("/providers/ollama/check").then(d=>{l(d.installed&&d.serverRunning),u(!0)}).catch(()=>u(!0)):u(!0)},[t]),o?s?i.jsx(ZX,{onModelChange:n}):i.jsx(CX,{onRecheck:()=>{l(!0),n&&n()}}):i.jsx("div",{className:"py-4 text-center text-xs text-text-4 font-sans",children:"Checking Ollama..."})}var DO="focusScope.autoFocusOnMount",WO="focusScope.autoFocusOnUnmount",r0={bubbles:!1,cancelable:!0},AX="FocusScope",iS=v.forwardRef((t,n)=>{const{loop:s=!1,trapped:l=!1,onMountAutoFocus:o,onUnmountAutoFocus:u,...d}=t,[O,m]=v.useState(null),p=Rt(o),x=Rt(u),g=v.useRef(null),b=it(n,w=>m(w)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(l){let w=function($){if(y.paused||!O)return;const _=$.target;O.contains(_)?g.current=_:Vn(g.current,{select:!0})},T=function($){if(y.paused||!O)return;const _=$.relatedTarget;_!==null&&(O.contains(_)||Vn(g.current,{select:!0}))},k=function($){if(document.activeElement===document.body)for(const G of $)G.removedNodes.length>0&&Vn(O)};document.addEventListener("focusin",w),document.addEventListener("focusout",T);const P=new MutationObserver(k);return O&&P.observe(O,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",T),P.disconnect()}}},[l,O,y.paused]),v.useEffect(()=>{if(O){o0.add(y);const w=document.activeElement;if(!O.contains(w)){const k=new CustomEvent(DO,r0);O.addEventListener(DO,p),O.dispatchEvent(k),k.defaultPrevented||(EX(UX(oS(O)),{select:!0}),document.activeElement===w&&Vn(O))}return()=>{O.removeEventListener(DO,p),setTimeout(()=>{const k=new CustomEvent(WO,r0);O.addEventListener(WO,x),O.dispatchEvent(k),k.defaultPrevented||Vn(w??document.body,{select:!0}),O.removeEventListener(WO,x),o0.remove(y)},0)}}},[O,p,x,y]);const Q=v.useCallback(w=>{if(!s&&!l||y.paused)return;const T=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(T&&k){const P=w.currentTarget,[$,_]=qX(P);$&&_?!w.shiftKey&&k===_?(w.preventDefault(),s&&Vn($,{select:!0})):w.shiftKey&&k===$&&(w.preventDefault(),s&&Vn(_,{select:!0})):k===P&&w.preventDefault()}},[s,l,y.paused]);return i.jsx(Be.div,{tabIndex:-1,...d,ref:b,onKeyDown:Q})});iS.displayName=AX;function EX(t,{select:n=!1}={}){const s=document.activeElement;for(const l of t)if(Vn(l,{select:n}),document.activeElement!==s)return}function qX(t){const n=oS(t),s=i0(n,t),l=i0(n.reverse(),t);return[s,l]}function oS(t){const n=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const o=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||o?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)n.push(s.currentNode);return n}function i0(t,n){for(const s of t)if(!MX(s,{upTo:n}))return s}function MX(t,{upTo:n}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(n!==void 0&&t===n)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function YX(t){return t instanceof HTMLInputElement&&"select"in t}function Vn(t,{select:n=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&YX(t)&&n&&t.select()}}var o0=VX();function VX(){let t=[];return{add(n){const s=t[0];n!==s&&(s==null||s.pause()),t=c0(t,n),t.unshift(n)},remove(n){var s;t=c0(t,n),(s=t[0])==null||s.resume()}}}function c0(t,n){const s=[...t],l=s.indexOf(n);return l!==-1&&s.splice(l,1),s}function UX(t){return t.filter(n=>n.tagName!=="A")}var BO=0;function LX(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??u0()),document.body.insertAdjacentElement("beforeend",t[1]??u0()),BO++,()=>{BO===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),BO--}},[])}function u0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var wa=function(){return wa=Object.assign||function(n){for(var s,l=1,o=arguments.length;l<o;l++){s=arguments[l];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(n[u]=s[u])}return n},wa.apply(this,arguments)};function cS(t,n){var s={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&n.indexOf(l)<0&&(s[l]=t[l]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,l=Object.getOwnPropertySymbols(t);o<l.length;o++)n.indexOf(l[o])<0&&Object.prototype.propertyIsEnumerable.call(t,l[o])&&(s[l[o]]=t[l[o]]);return s}function GX(t,n,s){if(s||arguments.length===2)for(var l=0,o=n.length,u;l<o;l++)(u||!(l in n))&&(u||(u=Array.prototype.slice.call(n,0,l)),u[l]=n[l]);return t.concat(u||Array.prototype.slice.call(n))}var nc="right-scroll-bar-position",sc="width-before-scroll-bar",DX="with-scroll-bars-hidden",WX="--removed-body-scroll-bar-size";function HO(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function BX(t,n){var s=v.useState(function(){return{value:t,callback:n,facade:{get current(){return s.value},set current(l){var o=s.value;o!==l&&(s.value=l,s.callback(l,o))}}}})[0];return s.callback=n,s.facade}var HX=typeof window<"u"?v.useLayoutEffect:v.useEffect,d0=new WeakMap;function IX(t,n){var s=BX(null,function(l){return t.forEach(function(o){return HO(o,l)})});return HX(function(){var l=d0.get(s);if(l){var o=new Set(l),u=new Set(t),d=s.current;o.forEach(function(O){u.has(O)||HO(O,null)}),u.forEach(function(O){o.has(O)||HO(O,d)})}d0.set(s,t)},[t]),s}function FX(t){return t}function KX(t,n){n===void 0&&(n=FX);var s=[],l=!1,o={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(u){var d=n(u,l);return s.push(d),function(){s=s.filter(function(O){return O!==d})}},assignSyncMedium:function(u){for(l=!0;s.length;){var d=s;s=[],d.forEach(u)}s={push:function(O){return u(O)},filter:function(){return s}}},assignMedium:function(u){l=!0;var d=[];if(s.length){var O=s;s=[],O.forEach(u),d=s}var m=function(){var x=d;d=[],x.forEach(u)},p=function(){return Promise.resolve().then(m)};p(),s={push:function(x){d.push(x),p()},filter:function(x){return d=d.filter(x),s}}}};return o}function JX(t){t===void 0&&(t={});var n=KX(null);return n.options=wa({async:!0,ssr:!1},t),n}var uS=function(t){var n=t.sideCar,s=cS(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=n.read();if(!l)throw new Error("Sidecar medium not found");return v.createElement(l,wa({},s))};uS.isSideCarExport=!0;function e_(t,n){return t.useMedium(n),uS}var dS=JX(),IO=function(){},Bc=v.forwardRef(function(t,n){var s=v.useRef(null),l=v.useState({onScrollCapture:IO,onWheelCapture:IO,onTouchMoveCapture:IO}),o=l[0],u=l[1],d=t.forwardProps,O=t.children,m=t.className,p=t.removeScrollBar,x=t.enabled,g=t.shards,b=t.sideCar,y=t.noRelative,Q=t.noIsolation,w=t.inert,T=t.allowPinchZoom,k=t.as,P=k===void 0?"div":k,$=t.gapMode,_=cS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),G=b,X=IX([s,n]),C=wa(wa({},_),o);return v.createElement(v.Fragment,null,x&&v.createElement(G,{sideCar:dS,removeScrollBar:p,shards:g,noRelative:y,noIsolation:Q,inert:w,setCallbacks:u,allowPinchZoom:!!T,lockRef:s,gapMode:$}),d?v.cloneElement(v.Children.only(O),wa(wa({},C),{ref:X})):v.createElement(P,wa({},C,{className:m,ref:X}),O))});Bc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bc.classNames={fullWidth:sc,zeroRight:nc};var t_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function a_(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=t_();return n&&t.setAttribute("nonce",n),t}function n_(t,n){t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n))}function s_(t){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(t)}var l_=function(){var t=0,n=null;return{add:function(s){t==0&&(n=a_())&&(n_(n,s),s_(n)),t++},remove:function(){t--,!t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},r_=function(){var t=l_();return function(n,s){v.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&s])}},OS=function(){var t=r_(),n=function(s){var l=s.styles,o=s.dynamic;return t(l,o),null};return n},i_={left:0,top:0,right:0,gap:0},FO=function(t){return parseInt(t||"",10)||0},o_=function(t){var n=window.getComputedStyle(document.body),s=n[t==="padding"?"paddingLeft":"marginLeft"],l=n[t==="padding"?"paddingTop":"marginTop"],o=n[t==="padding"?"paddingRight":"marginRight"];return[FO(s),FO(l),FO(o)]},c_=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return i_;var n=o_(t),s=document.documentElement.clientWidth,l=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,l-s+n[2]-n[0])}},u_=OS(),zl="data-scroll-locked",d_=function(t,n,s,l){var o=t.left,u=t.top,d=t.right,O=t.gap;return s===void 0&&(s="margin"),`
|
|
574
574
|
.`.concat(DX,` {
|
|
575
575
|
overflow: hidden `).concat(l,`;
|
|
576
576
|
padding-right: `).concat(O,"px ").concat(l,`;
|