MCPcopy
hub / github.com/google/adk-python /

Class

src/google/adk/cli/browser/chunk-ICVZGLGO.js:6–6  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(r){this.unput(this.match.slice(r))},"less"),pastInput:c(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var r=this.pastInput(),t=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
5`+t+"^"},"showPosition"),test_match:c(function(r,t){var o,a,u;if(this.options.backtrack_lexer&&(u={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(u.yylloc.range=this.yylloc.range.slice(0))),a=r[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],o=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),o)return o;if(this._backtrack){for(var s in u)this[s]=u[s];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,t,o,a;this._more||(this.yytext="",this.match="");for(var u=this._currentRules(),s=0;s<u.length;s++)if(o=this._input.match(this.rules[u[s]]),o&&(!t||o[0].length>t[0].length)){if(t=o,a=s,this.options.backtrack_lexer){if(r=this.test_match(o,u[s]),r!==!1)return r;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(r=this.test_match(t,u[a]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var t=this.next();return t||this.lex()},"lex"),begin:c(function(t){this.conditionStack.push(t)},"begin"),popState:c(function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:c(function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:c(function(t){this.begin(t)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:c(function(t,o,a,u){var s=u;switch(a){case 0:return t.getLogger().trace("Found comment",o.yytext),6;break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;break;case 4:this.popState();break;case 5:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return t.getLogger().trace("SPACELINE"),6;break;case 7:return 7;case 8:return 15;case 9:t.getLogger().trace("end icon"),this.popState();break;case 10:return t.getLogger().trace("Exploding node"),this.begin("NODE"),19;break;case 11:return t.getLogger().trace("Cloud"),this.begin("NODE"),19;break;case 12:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;break;case 13:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;break;case 14:return this.begin("NODE"),19;break;case 15:return this.begin("NODE"),19;break;case 16:return this.begin("NODE"),19;break;case 17:return this.begin("NODE"),19;break;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return t.getLogger().trace("description:",o.yytext),"NODE_DESCR";break;case 26:this.popState();break;case 27:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";break;case 28:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";break;case 29:return this.popState(),t.getLogger().trace("node end ...",o.yytext),"NODE_DEND";break;case 30:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";break;case 31:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";break;case 32:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";break;case 33:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";break;case 34:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";break;case 35:return t.getLogger().trace("Long description:",o.yytext),20;break;case 36:return t.getLogger().trace("Long description:",o.yytext),20;break}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return N})();B.lexer=ye;function A(){this.yy={}}return c(A,"Parser"),A.prototype=B,B.Parser=A,new A})();q.parser=q;var Ne=q,ve=12,D={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Le=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=D,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{c(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let n=this.nodes.length-1;n>=0;n--)if(this.nodes[n].level<e)return this.nodes[n];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,n,i,l){T.info("addNode",e,n,i,l);let g=!1;this.nodes.length===0?(this.baseLevel=e,e=0,g=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,g=!1);let h=V(),f=h.mindmap?.padding??R.mindmap.padding;switch(l){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:f*=2;break}let E={id:this.count++,nodeId:w(n,h),level:e,descr:w(i,h),type:l,children:[],width:h.mindmap?.maxNodeWidth??R.mindmap.maxNodeWidth,padding:f,isRoot:g},p=this.getParent(e);if(p)p.children.push(E),this.nodes.push(E);else if(g)this.nodes.push(E);else throw new Error(`There can be only one root. No parent could be found for ("${E.descr}")`)}getType(e,n){switch(T.debug("In get type",e,n),e){case"[":return this.nodeType.RECT;case"(":return n===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,n){this.elements[e]=n}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;let n=V(),i=this.nodes[this.nodes.length-1];e.icon&&(i.icon=w(e.icon,n)),e.class&&(i.class=w(e.class,n))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,n){if(e.level===0?e.section=void 0:e.section=n,e.children)for(let[i,l]of e.children.entries()){let g=e.level===0?i%(ve-1):n;this.assignSections(l,g)}}flattenNodes(e,n){let i=["mindmap-node"];e.isRoot===!0?i.push("section-root","section--1"):e.section!==void 0&&i.push(`section-${e.section}`),e.class&&i.push(e.class);let l=i.join(" "),g=c(f=>{switch(f){case D.CIRCLE:return"mindmapCircle";case D.RECT:return"rect";case D.ROUNDED_RECT:return"rounded";case D.CLOUD:return"cloud";case D.BANG:return"bang";case D.HEXAGON:return"hexagon";case D.DEFAULT:return"defaultMindmapNode";case D.NO_BORDER:default:return"rect"}},"getShapeFromType"),h={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:g(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:l,cssStyles:[],look:"default",icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(n.push(h),e.children)for(let f of e.children)this.flattenNodes(f,n)}generateEdges(e,n){if(e.children)for(let i of e.children){let l="edge";i.section!==void 0&&(l+=` section-edge-${i.section}`);let g=e.level+1;l+=` edge-depth-${g}`;let h={id:`edge_${e.id}_${i.id}`,start:e.id.toString(),end:i.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:"default",classes:l,depth:e.level,section:i.section};n.push(h),this.generateEdges(i,n)}}getData(){let e=this.getMindmap(),n=V(),l=de().layout!==void 0,g=n;if(l||(g.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:g};T.debug("getData: mindmapRoot",e,n),this.assignSections(e);let h=[],f=[];this.flattenNodes(e,h),this.generateEdges(e,f),T.debug(`getData: processed ${h.length} nodes and ${f.length} edges`);let E=new Map;for(let p of h)E.set(p.id,{shape:p.shape,width:p.width,height:p.height,padding:p.padding});return{nodes:h,edges:f,config:g,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(E),type:"mindmap",diagramId:"mindmap-"+Y()}}getLogger(){return T}},Te=c((e,n,i,l)=>ae(null,null,function*(){T.debug(`Rendering mindmap diagram
7`+e);let g=l.db,h=g.getData(),f=pe(n,h.config.securityLevel);h.type=l.type,h.layoutAlgorithm=ue(h.config.layout,{fallback:"cose-bilkent"}),h.diagramId=n,g.getMindmap()&&(h.nodes.forEach(p=>{p.shape==="rounded"?(p.radius=15,p.taper=15,p.stroke="none",p.width=0,p.padding=15):p.shape==="circle"?p.padding=10:p.shape==="rect"&&(p.width=0,p.padding=10)}),yield ge(h,f),fe(f,h.config.mindmap?.padding??R.mindmap.padding,"mindmapDiagram",h.config.mindmap?.useMaxWidth??R.mindmap.useMaxWidth))}),"draw"),Oe={draw:Te},Ie=c(e=>{let n="";for(let i=0;i<e.THEME_COLOR_LIMIT;i++)e["lineColor"+i]=e["lineColor"+i]||e["cScaleInv"+i],ce(e["lineColor"+i])?e["lineColor"+i]=le(e["lineColor"+i],20):e["lineColor"+i]=he(e["lineColor"+i],20);for(let i=0;i<e.THEME_COLOR_LIMIT;i++){let l=""+(17-3*i);n+=`
8 .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} polygon, .section-${i-1} path {
9 fill: ${e["cScale"+i]};

Callers

nothing calls this directly

Calls 1

cFunction · 0.90

Tested by

no test coverage detected