=.99?RD:fr>.6?AM:G);budT.textContent=Math.round(fr*100)+’%’}}}
build1();chips(‘c1′,’s’,play1);play1(‘weak’);
/* ———- TAB 2: routing ———- */
var s2=$(‘#s2’),lanes=[],wire,qmark,needT,rw;
var LA=[[‘Search’,’find candidate sources’,’srch’],[‘Fetch’,’clean page content’,’doc’],[‘Browser’,’your code drives it’,’win’],[‘Web Agent’,’goal in, JSON out (Mako)’,’bot’]];
function icon(g,k,x,y){var st={fill:’none’,stroke:’currentColor’,’stroke-width’:2.2,’stroke-linecap’:’round’};
if(k===’srch’){el(‘circle’,Object.assign({cx:x-3,cy:y-3,r:8},st),g);el(‘line’,Object.assign({x1:x+3,y1:y+3,x2:x+9,y2:y+9},st),g)}
if(k===’doc’){el(‘rect’,Object.assign({x:x-8,y:y-10,width:16,height:20,rx:2},st),g);[ -4,0,4].forEach(function(o){el(‘line’,Object.assign({x1:x-4,y1:y+o,x2:x+4,y2:y+o},st),g)})}
if(k===’win’){el(‘rect’,Object.assign({x:x-11,y:y-9,width:22,height:18,rx:2},st),g);el(‘line’,Object.assign({x1:x-11,y1:y-4,x2:x+11,y2:y-4},st),g)}
if(k===’bot’){el(‘rect’,Object.assign({x:x-9,y:y-6,width:18,height:14,rx:4},st),g);el(‘line’,Object.assign({x1:x,y1:y-6,x2:x,y2:y-11},st),g);el(‘circle’,{cx:x-4,cy:y+1,r:1.8,fill:’currentColor’},g);el(‘circle’,{cx:x+4,cy:y+1,r:1.8,fill:’currentColor’},g)}}
function build2(){clear(s2);arrowDefs(s2,’a2′,G);
tx(s2,110,40,’Evidence need’,{‘font-size’:12,fill:MU});
el(‘circle’,{cx:110,cy:150,r:52,fill:’#1b2410′,stroke:G,’stroke-width’:2},s2);
qmark=tx(s2,110,150,’?’,{‘font-size’:40,’font-weight’:800,fill:G});
needT=tx(s2,110,222,”,{‘font-size’:13,fill:TX});
wire=el(‘path’,{fill:’none’,stroke:G,’stroke-width’:2.5,class:’wire’,’marker-end’:’url(#a2)’},s2);
LA.forEach(function(l,i){var y=42+i*70,g=el(‘g’,{style:’color:’+MU},s2);
var r=el(‘rect’,{x:380,y:y-24,width:240,height:52,rx:11,fill:BX,stroke:LN,’stroke-width’:1.5},g);icon(g,l[2],410,y+2);
var t=tx(g,436,y-6,l[0],{‘font-size’:17,’font-weight’:700,’text-anchor’:’start’});tx(g,436,y+13,l[1],{‘font-size’:12,fill:MU,’text-anchor’:’start’});
lanes.push({g:g,r:r,t:t,y:y})});
rw=el(‘g’,{opacity:0},s2);el(‘rect’,{x:30,y:262,width:160,height:44,rx:10,fill:’#2a2111′,stroke:AM,’stroke-width’:1.5},rw);
tx(rw,110,284,’Rewrite query’,{‘font-size’:15,’font-weight’:700,fill:AM});boost(s2,1.22)}
var RT=[[‘no URL yet’,0,’Discover before paying to inspect or operate pages.’],[‘have a URL’,1,’Skip search. It cannot add discovery value here.’],[‘scripted clicks’,2,’Deterministic navigation stays in your code.’],[‘many pages’,3,’Keeps the goal and run state while the path changes.’],[‘bad evidence’,-1,’No escalation. A heavier tool will not fix a weak query.’]];
function route(i){i=+i;var r=RT[i];needT.textContent=r[0];$(‘#k2’).innerHTML=r[2];
lanes.forEach(function(l,k){var on=k===r[1];l.r.setAttribute(‘stroke’,on?G:LN);l.r.setAttribute(‘fill’,on?’#1b2410′:BX);l.g.setAttribute(‘style’,’color:’+(on?G:MU)+’;opacity:’+(r[1]<0?.35:on?1:.55));l.t.setAttribute(‘fill’,on?’#fff’:TX)});
if(r[1]>=0){var y=lanes[r[1]].y;wire.setAttribute(‘d’,’M164 150 C 270 150, 270 ‘+y+’, 374 ‘+y);wire.setAttribute(‘opacity’,1);rw.setAttribute(‘opacity’,0);qmark.textContent=”?”}
else{wire.setAttribute(‘d’,’M110 204 L 110 256′);rw.setAttribute(‘opacity’,1);qmark.textContent=”!”}
wire.animate&&wire.animate([{opacity:0},{opacity:1}],{duration:400})}
build2();chips(‘c2′,’r’,route);route(0);
/* ———- TAB 3: deep research ———- */
var s3=$(‘#s3’),dots=[],spawn=null,stage=0,last3=0;
function tagPill(x,y,s,c){var w=s.length*7.4+26;el(‘rect’,{x:x-w/2,y:y-14,width:w,height:28,rx:14,fill:c==G?’#1b2410′:c==RD?’#2a1412′:’#2a2111′,stroke:c,’stroke-width’:1.5},s3);tx(s3,x,y+1,s,{‘font-size’:13,’font-weight’:700,fill:c})}
function bx(x,y,w,h,label,col,fs){el(‘rect’,{x:x,y:y,width:w,height:h,rx:11,fill:BX,stroke:col||LN,’stroke-width’:1.6},s3);if(label)tx(s3,x+w/2,y+h/2,label,{‘font-size’:fs||15,’font-weight’:700})}
var weight=0;
function v3(v){v=+v;stage=v;clear(s3);dots=[];arrowDefs(s3,’a3′,LN);
if(v===0){bx(30,50,240,200,”,LN);tx(s3,150,72,’Orchestrator’,{‘font-size’:15,’font-weight’:700});
var bars=[[‘structured state’,G],[‘chat history’,’#5b8def’],[‘past reports’,’#5b8def’],[‘findings’,’#5b8def’],[‘user intent’,’#5b8def’]];
bars.forEach(function(b,i){var y=96+i*30;el(‘rect’,{x:50,y:y,width:200,height:22,rx:5,fill:b[1],’fill-opacity’:.18,stroke:b[1],’stroke-opacity’:.6},s3);tx(s3,62,y+11,b[0],{‘font-size’:12,’text-anchor’:’start’,fill:TX})});
el(‘line’,{x1:340,y1:40,x2:340,y2:260,stroke:RD,’stroke-width’:2,’stroke-dasharray’:’6 6′},s3);tx(s3,340,30,’boundary’,{‘font-size’:11,fill:RD});
bx(420,110,190,80,”,LN);tx(s3,515,140,’Planner’,{‘font-size’:16,’font-weight’:700});tx(s3,515,164,’fresh LLM call’,{‘font-size’:12,fill:MU});
tagPill(515,236,’Context lost’,RD);
spawn=function(){var i=Math.floor(Math.random()*5),y=107+i*30;dots.push({x:250,y:y,tx:420,ty:150,c:i?’#5b8def’:G,die:i?340:null,v:2.4})};
$(‘#k3′).innerHTML=’Only structured state crossed. Follow-ups like “focus only on pricing risks” drifted.’}
if(v===1){bx(30,110,170,80,’Orchestrator’,RD);var ys=[50,150,250];
ys.forEach(function(y,i){bx(430,y-26,180,52,’Subagent ‘+(i+1),LN,14);el(‘line’,{x1:200,y1:150,x2:430,y2:y,stroke:LN,’stroke-width’:1.5},s3)});
tagPill(115,240,’Latency ↑ Cost ↑’,RD);
spawn=function(){var y=ys[Math.floor(Math.random()*3)],out=Math.random()<.5;dots.push(out?{x:200,y:150,tx:430,ty:y,c:MU,v:4}:{x:430,y:y,tx:200,ty:150,c:AM,v:4})};
$(‘#k3′).innerHTML=’1 subagent per query. The orchestrator kept dispatching, waiting and merging.’}
if(v===2){bx(30,100,190,100,”,G);tx(s3,125,135,’Orchestrator’,{‘font-size’:16,’font-weight’:700});tx(s3,125,160,’plan + decide next’,{‘font-size’:12,fill:G});
[‘Search’,’Fetch’,’Browse’].forEach(function(n,i){var y=60+i*60;bx(290,y-20,110,40,n,LN,14);el(‘line’,{x1:220,y1:150,x2:290,y2:y,stroke:LN,’stroke-width’:1.5},s3);el(‘line’,{x1:400,y1:y,x2:460,y2:120,stroke:LN,’stroke-width’:1.5},s3)});
bx(460,70,150,100,”,G);tx(s3,535,106,’Rank + extract’,{‘font-size’:14,’font-weight’:700});tx(s3,535,128,’plain code’,{‘font-size’:12,fill:G});
el(‘path’,{d:’M535 170 C 535 250, 125 260, 125 204′,’fill’:’none’,stroke:G,’stroke-width’:1.5,’stroke-dasharray’:’4 5′,’marker-end’:’url(#a3)’},s3);
tx(s3,330,262,’ranked sources + extracted claims’,{‘font-size’:12,fill:G});
tagPill(330,20,’Context ↓ Latency ↓ Cost ↓’,G);
spawn=function(){var i=Math.floor(Math.random()*3),y=60+i*60;dots.push({x:400,y:y,tx:460,ty:120,c:MU,v:2.2,r:6,then:1})};
$(‘#k3′).innerHTML=’Deterministic steps became tool calls. The orchestrator only sees the distilled result.’}
if(v===3){spawn=null;
var w=el(‘g’,{},s3),gl=[[‘Goal: product sentiment’,0],[‘Goal: unemployment rate’,1]];
gl.forEach(function(g,i){var x=i?330:30,on=weight===i,rg=el(‘g’,{style:’cursor:pointer’},w);el(‘rect’,{x:x,y:10,width:280,height:34,rx:17,fill:on?G:BX,stroke:on?G:LN},rg);tx(rg,x+140,28,g[0],{‘font-size’:13,’font-weight’:700,fill:on?’#111′:TX});rg.onclick=function(){weight=i;v3(3)}});
tx(s3,170,272,’Social posts’,{‘font-size’:14,’font-weight’:700});tx(s3,480,272,’Government report’,{‘font-size’:14,’font-weight’:700});
var soc=[[110,110],[160,90],[210,120],[130,170],[185,165],[235,180],[95,215],[150,225],[215,225]];
soc.forEach(function(p){var c=el(‘circle’,{cx:p[0],cy:p[1],r:6,fill:weight===0?G:’#3a3a3a’},s3);c.animate&&c.animate([{r:6},{r:weight===0?20:6}],{duration:700,fill:’forwards’,easing:’ease-out’});if(weight===0)c.setAttribute(‘r’,20)});
var gv=el(‘circle’,{cx:480,cy:160,r:weight===1?78:16,fill:weight===1?G:’#3a3a3a’,’fill-opacity’:.9},s3);gv.animate&&gv.animate([{r:16},{r:weight===1?78:16}],{duration:700,easing:’ease-out’});
$(‘#k3’).innerHTML=’Same sources, different weight. Rank by the research objective, not one quality score.’}
boost(s3,1.25);setTimeout(post,60)}
function tick3(ts){if(spawn&&ts-last3>(stage===1?110:260)){spawn();last3=ts}
for(var i=dots.length-1;i>=0;i–){var d=dots[i];if(!d.e){d.e=el(‘circle’,{r:d.r||5,fill:d.c,cx:d.x,cy:d.y},s3)}
var dx=d.tx-d.x,dy=d.ty-d.y,l=Math.hypot(dx,dy);
if(d.die&&d.x>=d.die-2){d.e.setAttribute(‘fill’,RD);d.fade=(d.fade||1)-.06;d.e.setAttribute(‘opacity’,d.fade);if(d.fade<=0){d.e.remove();dots.splice(i,1)}continue}
if(l=1)anim4=null}}
build4();chips(‘c4′,’b’,function(b){cur=b;drawScatter(false)});drawScatter(true);
function loop(ts){if(active===’p1’&&run1)run1.tick(ts);if(active===’p3′)tick3(ts);if(anim4)anim4(ts);
if(pts.TinyFish)pts.TinyFish.ring.setAttribute(‘r’,15+3*Math.sin(ts/220));requestAnimationFrame(loop)}
requestAnimationFrame(loop);
window.addEventListener(‘load’,post);window.addEventListener(‘resize’,post);setTimeout(post,300);
})();