sessiongraph-app-darwin-arm64 1.0.23 → 1.0.24

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.
@@ -1,4 +1,4 @@
1
- import{v as ge,k as te,l as k,m as Ee,n as L,q as Le,r as Me,u as De,D as Te,I as Ie,c as he,b as ye,V as Pe,w as ve,x as ke,y as Ne,h as Be,z as Fe,A as je,B as He,E as qe,F as Se,G as Oe,t as Re,d as Ge,P as Ke,H as we,J as _e}from"./index-DK0pBf-7.js";import{TimelineScene as Ue}from"./scene-BCuZ73oU.js";import"./three-DDiuFd7k.js";function We(s){const h=s.settings.tokens?s.sessions.filter(l=>typeof l.tokens=="number"):[],m=h.reduce((l,i)=>l+i.tokens,0);return{sessionCount:s.sessions.length,tokenCount:h.length&&Number.isSafeInteger(m)?m:null,tokensPartial:h.length>0&&h.length<s.sessions.length}}function Xe(s){const h=We(s),m=[`${h.sessionCount.toLocaleString()} sessions`];if(s.settings.tokens&&m.push(h.tokenCount===null?"Tokens unknown":`${h.tokenCount.toLocaleString()} tokens`),s.settings.messageCounts){const l=s.sessions.filter(i=>i.messages?.count!=null);m.push(l.length?`${l.reduce((i,x)=>i+x.messages.count,0).toLocaleString()} messages`:"Messages unknown")}return m.join(" · ")}const A=s=>s==null?"unknown":s.toLocaleString(),z=s=>s===null?"unknown":new Date(s).toLocaleString(),se=(s,h=!1)=>new Date(s).toLocaleDateString("en",{month:"short",day:"numeric",...h?{year:"numeric"}:{}}),Ye=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1});let Ve=0;function Ze(s,h,m={}){let l=ge(h),i=te(l),x=new Map(i.lanes.flatMap(e=>e.nodes.map(t=>[Number(t.session.projectID),e.label])));s.classList.add("public-viewer"),s.dataset.graphAudio="";const ne=`public-graph-help-${++Ve}`;s.classList.toggle("public-viewer-full",!!m.fullscreen),s.innerHTML=`
1
+ import{v as ge,k as te,l as k,m as Ee,n as L,q as Le,r as Me,u as De,D as Te,I as Ie,c as he,b as ye,V as Pe,w as ve,x as ke,y as Ne,z as Be,h as Fe,A as je,B as He,E as qe,F as Oe,G as Se,H as Ke,t as Re,d as Ge,P as _e,J as we,K as Ue}from"./index-YT1ntRdY.js";import{TimelineScene as We}from"./scene-BkT0QJrf.js";import"./three-DDiuFd7k.js";function Ye(s){const h=s.settings.tokens?s.sessions.filter(l=>typeof l.tokens=="number"):[],m=h.reduce((l,i)=>l+i.tokens,0);return{sessionCount:s.sessions.length,tokenCount:h.length&&Number.isSafeInteger(m)?m:null,tokensPartial:h.length>0&&h.length<s.sessions.length}}function Ze(s){const h=Ye(s),m=[`${h.sessionCount.toLocaleString()} sessions`];if(s.settings.tokens&&m.push(h.tokenCount===null?"Tokens unknown":`${h.tokenCount.toLocaleString()} tokens`),s.settings.messageCounts){const l=s.sessions.filter(i=>i.messages?.count!=null);m.push(l.length?`${l.reduce((i,x)=>i+x.messages.count,0).toLocaleString()} messages`:"Messages unknown")}return m.join(" · ")}const A=s=>s==null?"unknown":s.toLocaleString(),z=s=>s===null?"unknown":new Date(s).toLocaleString(),se=(s,h=!1)=>new Date(s).toLocaleDateString("en",{month:"short",day:"numeric",...h?{year:"numeric"}:{}}),Ve=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1});let ze=0;function et(s,h,m={}){let l=ge(h),i=te(l),x=new Map(i.lanes.flatMap(e=>e.nodes.map(t=>[Number(t.session.projectID),e.label])));s.classList.add("public-viewer"),s.dataset.graphAudio="";const ae=`public-graph-help-${++ze}`;s.classList.toggle("public-viewer-full",!!m.fullscreen),s.innerHTML=`
2
2
  <div class="public-canvas" aria-label="Interactive public session graph"></div>
3
3
  <nav class="public-view-controls" aria-label="Graph controls">
4
4
  ${k("center-focus","Fit view",{"data-fit":!0},"Fit view (F)")}
@@ -19,6 +19,6 @@ import{v as ge,k as te,l as k,m as Ee,n as L,q as Le,r as Me,u as De,D as Te,I a
19
19
  <div class="public-tooltip" hidden></div>
20
20
  <section class="public-playback public-panel timeline-controls" aria-label="Timeline controls">${Le(`<span class="public-period-label">${L("clock")}<span data-range-label>Timeline</span></span><div class="range-buttons" role="group" aria-label="Date range"><button type="button" data-days="7">7D</button><button type="button" data-days="30">30D</button><button type="button" data-days="90">90D</button><button type="button" data-days="ytd" title="Year to date">YTD</button><button type="button" data-days="0">All</button></div><select data-speed aria-label="Playback speed"><option value="0.5">0.5×</option><option value="1" selected>1×</option><option value="2">2×</option></select>${k("x","Close timeline",{"data-close-timeline":!0})}`,{},{showCoverage:!1})}</section>
21
21
  ${Me(["fit","clear"],"public-hints")}
22
- ${De(ne,["fit","clear"])}
23
- <p class="public-announcement" role="status"></p>`;const n=e=>s.querySelector(e);m.profileCard&&n(".public-left").prepend(m.profileCard);const y=e=>n(`[data-playback=${e}]`),ae=n(".public-canvas"),M=n(".public-session"),D=n(".public-session-data"),R=n(".public-list"),T=n(".public-browser"),J=n(".public-playback"),I=n("[data-project]"),P=n("[data-harness]"),Ce=n("[data-speed]"),G=y("scrubber"),S=y("play"),Ae=matchMedia("(prefers-reduced-motion: reduce)"),N=new AbortController,v={...Te,focusDimming:!1,messageDots:l.settings.messageTimestamps},K=new Ie(v,()=>{},s),ie=()=>l.settings.timestamps?"ytd":0;let d,b=null,g=l.sessions,w=ie(),_=0,B=!1,u=1,$=0,Q=0,le=!1,U=[],F,oe=he(i.nodes.map(e=>e.session)),X=ye(i.nodes.map(e=>e.session),{});const C=e=>{T.hidden=!e,n("[data-sessions]").setAttribute("aria-expanded",String(e))},re=e=>{J.hidden=!e,n("[data-timeline]").setAttribute("aria-expanded",String(e))},ce=e=>{n(".public-announcement").textContent=e},E=e=>{M.hidden=!e;const t=n("[data-detail]");t.hidden=b===null,t.setAttribute("aria-expanded",String(e))};let de=new Map;const ue=new Pe(R,{key:e=>String(e.id),estimate:()=>66,render:(e,t)=>{const r=document.createElement("div"),a=document.createElement("button"),p=document.createElement("span"),o=document.createElement("small");r.setAttribute("role","listitem"),r.setAttribute("aria-posinset",String(t+1)),r.setAttribute("aria-setsize",String(g.length)),a.type="button",a.dataset.session=String(e.id),a.setAttribute("aria-pressed",String(b===e.id)),a.style.setProperty("--session-color",de.get(e.id)||"#b0e9d6"),p.textContent=`Session ${e.id+1}`,e.harness&&o.append(ve(e.harness,m.sourceIconBase));const c=document.createElement("span");return c.textContent=[x.get(e.group),e.model].filter(Boolean).join(" · "),o.append(c),a.append(p,o),a.onclick=()=>j(String(e.id)),r.append(a),r}});function f(){cancelAnimationFrame(_),_=0,B=!1,$=0,s.classList.remove("playback-mode"),F&&(C(F.browser),E(F.details&&b!==null),F=void 0),d?.setPlaying(!1),S.innerHTML=L("play"),S.setAttribute("aria-label","Play timeline")}function j(e){f();const t=e===null?void 0:l.sessions[Number(e)];b=t&&g.some(a=>a.id===t.id)?t.id:null,d?.select(b===null?null:String(b)),d?.setEvents([]),U=[],D.replaceChildren(),E(b!==null);for(const a of R.querySelectorAll("button"))a.setAttribute("aria-pressed",String(a.dataset.session===String(b)));if(b===null||!t)return;if(s.clientWidth<1e3&&C(!1),u=1,H(),n("[data-session-heading]").textContent=`Session ${t.id+1}`,t.harness){const a=document.createElement("div");a.className="public-source-badge",a.append(ve(t.harness,m.sourceIconBase),ke(t.harness)),D.append(a)}const r=[["folder","Project",x.get(t.group)||"Unknown"]];"model"in t&&r.push(["cpu","Model",t.model??"unknown"]),"harness"in t&&!t.harness&&r.push(["bot","Agent","unknown"]),"tokens"in t&&r.push(["coins","Tokens incl. cache",A(t.tokens)]),t.timestamps&&r.push(["calendar","Created",z(t.timestamps.created)],["clock","Last message",z(t.timestamps.lastMessageAt)]),t.messages&&(r.push(["message","Messages",A(t.messages.count)]),t.messages.untimed&&r.push(["clock","Untimed messages",A(t.messages.untimed)])),D.insertAdjacentHTML("beforeend",Ne(r));for(const[a,p,o]of[["Fork of",t.fork,"git-fork"],["Child of",t.parent,"network"]])if(p!==null){const c=document.createElement("button");c.className="public-relation",c.type="button",c.dataset.related=String(p),c.innerHTML=L(o),c.append(`${a} Session ${p+1}`),c.disabled=!g.some(V=>V.id===p),c.onclick=()=>j(String(p)),D.append(c)}if(t.messageTimes?.values.length){const a=document.createElement("details"),p=document.createElement("summary");p.textContent=`${A(t.messageTimes.values.length)} message timestamps`;const o=document.createElement("pre");o.textContent=t.messageTimes.values.map(z).join(`
24
- `),a.append(p,o),D.append(a),U=t.messageTimes.values.map((c,V)=>({id:`public-${V}`,ordinal:V,kind:"message",name:"Message",role:"user",time:c,timeSource:"recorded",preview:""})),d?.setEvents(U)}d?.focus(String(t.id)),ce(`Selected Session ${t.id+1}.`)}function xe(){if(n("[data-count]").textContent=A(g.length),de=new Map(i.nodes.map(e=>[Number(e.session.id),e.color])),ue.setItems(g),R.querySelector(".public-list-empty")?.remove(),!g.length){const e=document.createElement("p");e.className="public-list-empty",e.textContent="No sessions match these filters.",R.append(e)}}function H(e=!1){d?.setCutoff(u,e),G.value=String(Math.round(u*1e3));const t=i.start+(i.end-i.start)*u,r=oe(t,u===1);y("date").textContent=l.settings.timestamps&&i.nodes.length?se(t):`${A(r)} sessions`,y("period").textContent=l.settings.timestamps&&i.nodes.length?Be(t,i.end-i.start):"All time",y("cursor").style.left=`${u*100}%`,y("histogram").style.setProperty("--progress",`${u*100}%`),y("summary").hidden=!g.length,y("sessions").textContent=A(r);const a=X.at(t,u===1);y("tokens").textContent=X.recorded&&Fe(a.tokens)?Ye.format(a.tokens):"—",n("[data-token-total]").hidden=!l.settings.tokens}function W(e=!1){f(),u=1;const{min:t,max:r}=w==="ytd"?qe({days:w,fromDate:"",toDate:""}):{min:w?Math.max(...l.sessions.map(Se))-w*864e5:0,max:1/0};g=l.sessions.filter(o=>{const c=Se(o);return(!I.value||String(o.group)===I.value)&&(!P.value||o.harness===P.value)&&c>=t&&c<=r}).sort(Oe),(!e||g.length!==l.sessions.length)&&(i=te(l,new Set(g.map(o=>o.id)))),oe=he(i.nodes.map(o=>o.session)),X=ye(i.nodes.map(o=>o.session),{}),d?.setGraph(i,!0),j(null);const a=Re(i.nodes.map(o=>Ge(o.session)),i.start,i.end),p=Math.max(1,...a);y("histogram").replaceChildren(...a.map(o=>{const c=document.createElement("span");return c.style.height=`${Math.max(4,o/p*100)}%`,c.style.opacity=o?".8":".15",c})),n("[data-range-label]").textContent=g.length?l.settings.timestamps?`${se(i.start)} — ${se(i.end,!0)}`:"Timeline":"No sessions";for(const o of s.querySelectorAll("[data-days]"))o.setAttribute("aria-pressed",String(o.dataset.days===String(w)));S.disabled=!g.length,G.disabled=!g.length,xe(),H()}try{d=new Ue(ae,{onSelect:e=>{j(e),e!==null&&K.play("select")},onPlaybackInterrupt:f,onHover:(e,t,r)=>{const a=n(".public-tooltip");if(a.hidden=!e,e){const p=s.getBoundingClientRect();a.textContent=e.session.title,a.style.left=`${Math.max(8,Math.min(s.clientWidth-135,t-p.left+14))}px`,a.style.top=`${Math.max(8,r-p.top-35)}px`}},onEvent:e=>{const t=U.find(r=>r.id===e);t&&(d?.focusEvent(t),ce(z(t.time)))},onEventHover(){}},{panels:[T,M,J,...m.profileCard?[m.profileCard]:[]],focusTop:80}),d.applyPreferences(v)}catch{ae.textContent="3D rendering is unavailable. Explore sessions in the panel.",n("[data-fit]").disabled=!0}function pe(){I.replaceChildren(new Option("All projects","")),P.replaceChildren(new Option("All sources","")),[...x].sort((e,t)=>e[0]-t[0]).forEach(([e,t])=>I.add(new Option(t,String(e)))),[...new Set(l.sessions.flatMap(e=>e.harness?[e.harness]:[]))].sort().forEach(e=>P.add(new Option(ke(e),e))),n("[data-harness-filter]").hidden=!l.settings.harness;for(const e of s.querySelectorAll("[data-days]"))e.hidden=!l.settings.timestamps&&e.dataset.days!=="0"}pe();for(const e of[I,P])e.onchange=()=>W();for(const e of s.querySelectorAll("[data-days]"))e.onclick=()=>{w=e.dataset.days==="ytd"?"ytd":Number(e.dataset.days),W()};n("[data-sessions]").onclick=()=>{f(),T.hidden&&s.clientWidth<1e3&&E(!1),C(T.hidden)},n("[data-close-list]").onclick=()=>C(!1),n("[data-close-detail]").onclick=()=>E(!1),n("[data-detail]").onclick=()=>{b!==null&&(f(),M.hidden&&s.clientWidth<1e3&&C(!1),E(M.hidden))},n("[data-focus]").onclick=()=>{b!==null&&d?.focus(String(b))};const me=()=>{f(),d?.reset()};n("[data-fit]").onclick=me,n("[data-timeline]").onclick=()=>{f(),re(J.hidden)},n("[data-close-timeline]").onclick=()=>re(!1);const q=n(`#${ne}`);let Z=!0;const Y=()=>d?.setSuspended(!Z||document.hidden||q.open);n("[data-help]").onclick=()=>{f(),q.showModal(),Y()},n("[data-close-help]").onclick=()=>q.close(),q.addEventListener("close",Y,{signal:N.signal});const O=n("[data-mute]");O.onclick=()=>{v.muted=!v.muted,K.configure(v);const e=je(v.muted);O.innerHTML=L(e.glyph),O.title=e.label,O.setAttribute("aria-label",e.label),O.setAttribute("aria-pressed",String(v.muted)),v.muted||K.play()};const ee=()=>d?.applyPreferences(v);Ae.addEventListener("change",ee,{signal:N.signal});const be=e=>{if(le||!B)return;const t=Math.max(0,e-Q);Q=e,u<1?u=Math.min(1,u+t*Number(Ce.value)/Ke):$+=t,H(),d?.setPlaybackOutro(u>=1?Math.min(1,$/we):null),u>=1&&$>=we+_e?f():_=requestAnimationFrame(be)};S.onclick=()=>{if(B)return f();u>=1&&(u=0),F={browser:!T.hidden,details:!M.hidden},C(!1),E(!1),n(".public-tooltip").hidden=!0,s.classList.add("playback-mode"),B=!0,$=0,Q=performance.now(),H(),d?.setPlaying(!0),S.innerHTML=L("pause"),S.setAttribute("aria-label","Pause timeline"),_=requestAnimationFrame(be)},G.oninput=()=>{f(),u=Number(G.value)/1e3,H(!0)},s.tabIndex=-1,s.addEventListener("keydown",e=>{q.open||e.target.matches("input, select, textarea")||e.metaKey||e.ctrlKey||e.altKey||(e.key.toLowerCase()==="f"&&(e.preventDefault(),me()),e.key==="Escape"&&j(null),e.code==="Space"&&!e.target.closest("button, summary")&&(e.preventDefault(),S.click()))},{signal:N.signal}),document.addEventListener("visibilitychange",()=>{document.hidden&&f(),Y()},{signal:N.signal});const fe=new IntersectionObserver(([e])=>{Z=e.isIntersecting,Z||f(),Y()});fe.observe(s),s.clientWidth<760&&C(!1),W(!0),ee();const $e=He(s);return{diagnostics:()=>({...d?.diagnostics(),playing:B,progress:u,outro:$,selected:b}),setData(e){l=ge(e),i=te(l),x=new Map(i.lanes.flatMap(t=>t.nodes.map(r=>[Number(r.session.projectID),t.label]))),v.messageDots=l.settings.messageTimestamps,w=ie(),b=null,pe(),W(!0),ee()},dispose(){le=!0,f(),N.abort(),fe.disconnect(),$e(),ue.dispose(),d?.dispose(),K.dispose(),delete s.dataset.graphAudio,s.replaceChildren(),s.classList.remove("public-viewer","public-viewer-full")}}}export{Ze as createPublicViewer,Xe as publicSummary};
22
+ ${De(ae,["fit","clear"])}
23
+ <p class="public-announcement" role="status"></p>`;const a=e=>s.querySelector(e);m.profileCard&&a(".public-left").prepend(m.profileCard);const y=e=>a(`[data-playback=${e}]`),ne=a(".public-canvas"),M=a(".public-session"),D=a(".public-session-data"),K=a(".public-list"),T=a(".public-browser"),J=a(".public-playback"),I=a("[data-project]"),P=a("[data-harness]"),Ce=a("[data-speed]"),R=y("scrubber"),S=y("play"),Ae=matchMedia("(prefers-reduced-motion: reduce)"),N=new AbortController,v={...Te,focusDimming:!1,messageDots:l.settings.messageTimestamps},G=new Ie(v,()=>{},s),ie=()=>l.settings.timestamps?"ytd":0;let d,b=null,g=l.sessions,w=ie(),_=0,B=!1,u=1,$=0,Q=0,le=!1,U=[],F,oe=he(i.nodes.map(e=>e.session)),X=ye(i.nodes.map(e=>e.session),{});const C=e=>{T.hidden=!e,a("[data-sessions]").setAttribute("aria-expanded",String(e))},re=e=>{J.hidden=!e,a("[data-timeline]").setAttribute("aria-expanded",String(e))},ce=e=>{a(".public-announcement").textContent=e},E=e=>{M.hidden=!e;const t=a("[data-detail]");t.hidden=b===null,t.setAttribute("aria-expanded",String(e))};let de=new Map;const ue=new Pe(K,{key:e=>String(e.id),estimate:()=>66,render:(e,t)=>{const r=document.createElement("div"),n=document.createElement("button"),p=document.createElement("span"),o=document.createElement("small");r.setAttribute("role","listitem"),r.setAttribute("aria-posinset",String(t+1)),r.setAttribute("aria-setsize",String(g.length)),n.type="button",n.dataset.session=String(e.id),n.setAttribute("aria-pressed",String(b===e.id)),n.style.setProperty("--session-color",de.get(e.id)||"#b0e9d6"),p.textContent=`Session ${e.id+1}`,e.harness&&o.append(ve(e.harness,m.sourceIconBase));const c=document.createElement("span");return c.textContent=[x.get(e.group),e.model].filter(Boolean).join(" · "),o.append(c),n.append(p,o),n.onclick=()=>j(String(e.id)),r.append(n),r}});function f(){cancelAnimationFrame(_),_=0,B=!1,$=0,s.classList.remove("playback-mode"),F&&(C(F.browser),E(F.details&&b!==null),F=void 0),d?.setPlaying(!1),S.innerHTML=L("play"),S.setAttribute("aria-label","Play timeline")}function j(e){f();const t=e===null?void 0:l.sessions[Number(e)];b=t&&g.some(n=>n.id===t.id)?t.id:null,d?.select(b===null?null:String(b)),d?.setEvents([]),U=[],D.replaceChildren(),E(b!==null);for(const n of K.querySelectorAll("button"))n.setAttribute("aria-pressed",String(n.dataset.session===String(b)));if(b===null||!t)return;if(s.clientWidth<1e3&&C(!1),u=1,H(),a("[data-session-heading]").textContent=`Session ${t.id+1}`,t.harness){const n=document.createElement("div");n.className="public-source-badge",n.append(ve(t.harness,m.sourceIconBase),ke(t.harness)),D.append(n)}const r=[["folder","Project",x.get(t.group)||"Unknown"]];"model"in t&&r.push(["cpu","Model",Ne(t)]),"harness"in t&&!t.harness&&r.push(["bot","Agent","unknown"]),"tokens"in t&&r.push(["coins","Tokens incl. cache",A(t.tokens)]),t.timestamps&&r.push(["calendar","Created",z(t.timestamps.created)],["clock","Last message",z(t.timestamps.lastMessageAt)]),t.messages&&(r.push(["message","Messages",A(t.messages.count)]),t.messages.untimed&&r.push(["clock","Untimed messages",A(t.messages.untimed)])),D.insertAdjacentHTML("beforeend",Be(r));for(const[n,p,o]of[["Fork of",t.fork,"git-fork"],["Child of",t.parent,"network"]])if(p!==null){const c=document.createElement("button");c.className="public-relation",c.type="button",c.dataset.related=String(p),c.innerHTML=L(o),c.append(`${n} Session ${p+1}`),c.disabled=!g.some(V=>V.id===p),c.onclick=()=>j(String(p)),D.append(c)}if(t.messageTimes?.values.length){const n=document.createElement("details"),p=document.createElement("summary");p.textContent=`${A(t.messageTimes.values.length)} message timestamps`;const o=document.createElement("pre");o.textContent=t.messageTimes.values.map(z).join(`
24
+ `),n.append(p,o),D.append(n),U=t.messageTimes.values.map((c,V)=>({id:`public-${V}`,ordinal:V,kind:"message",name:"Message",role:"user",time:c,timeSource:"recorded",preview:""})),d?.setEvents(U)}d?.focus(String(t.id)),ce(`Selected Session ${t.id+1}.`)}function xe(){if(a("[data-count]").textContent=A(g.length),de=new Map(i.nodes.map(e=>[Number(e.session.id),e.color])),ue.setItems(g),K.querySelector(".public-list-empty")?.remove(),!g.length){const e=document.createElement("p");e.className="public-list-empty",e.textContent="No sessions match these filters.",K.append(e)}}function H(e=!1){d?.setCutoff(u,e),R.value=String(Math.round(u*1e3));const t=i.start+(i.end-i.start)*u,r=oe(t,u===1);y("date").textContent=l.settings.timestamps&&i.nodes.length?se(t):`${A(r)} sessions`,y("period").textContent=l.settings.timestamps&&i.nodes.length?Fe(t,i.end-i.start):"All time",y("cursor").style.left=`${u*100}%`,y("histogram").style.setProperty("--progress",`${u*100}%`),y("summary").hidden=!g.length,y("sessions").textContent=A(r);const n=X.at(t,u===1);y("tokens").textContent=X.recorded&&je(n.tokens)?Ve.format(n.tokens):"—",a("[data-token-total]").hidden=!l.settings.tokens}function W(e=!1){f(),u=1;const{min:t,max:r}=w==="ytd"?Oe({days:w,fromDate:"",toDate:""}):{min:w?Math.max(...l.sessions.map(Se))-w*864e5:0,max:1/0};g=l.sessions.filter(o=>{const c=Se(o);return(!I.value||String(o.group)===I.value)&&(!P.value||o.harness===P.value)&&c>=t&&c<=r}).sort(Ke),(!e||g.length!==l.sessions.length)&&(i=te(l,new Set(g.map(o=>o.id)))),oe=he(i.nodes.map(o=>o.session)),X=ye(i.nodes.map(o=>o.session),{}),d?.setGraph(i,!0),j(null);const n=Re(i.nodes.map(o=>Ge(o.session)),i.start,i.end),p=Math.max(1,...n);y("histogram").replaceChildren(...n.map(o=>{const c=document.createElement("span");return c.style.height=`${Math.max(4,o/p*100)}%`,c.style.opacity=o?".8":".15",c})),a("[data-range-label]").textContent=g.length?l.settings.timestamps?`${se(i.start)} — ${se(i.end,!0)}`:"Timeline":"No sessions";for(const o of s.querySelectorAll("[data-days]"))o.setAttribute("aria-pressed",String(o.dataset.days===String(w)));S.disabled=!g.length,R.disabled=!g.length,xe(),H()}try{d=new We(ne,{onSelect:e=>{j(e),e!==null&&G.play("select")},onPlaybackInterrupt:f,onHover:(e,t,r)=>{const n=a(".public-tooltip");if(n.hidden=!e,e){const p=s.getBoundingClientRect();n.textContent=e.session.title,n.style.left=`${Math.max(8,Math.min(s.clientWidth-135,t-p.left+14))}px`,n.style.top=`${Math.max(8,r-p.top-35)}px`}},onEvent:e=>{const t=U.find(r=>r.id===e);t&&(d?.focusEvent(t),ce(z(t.time)))},onEventHover(){}},{panels:[T,M,J,...m.profileCard?[m.profileCard]:[]],focusTop:80}),d.applyPreferences(v)}catch{ne.textContent="3D rendering is unavailable. Explore sessions in the panel.",a("[data-fit]").disabled=!0}function pe(){I.replaceChildren(new Option("All projects","")),P.replaceChildren(new Option("All sources","")),[...x].sort((e,t)=>e[0]-t[0]).forEach(([e,t])=>I.add(new Option(t,String(e)))),[...new Set(l.sessions.flatMap(e=>e.harness?[e.harness]:[]))].sort().forEach(e=>P.add(new Option(ke(e),e))),a("[data-harness-filter]").hidden=!l.settings.harness;for(const e of s.querySelectorAll("[data-days]"))e.hidden=!l.settings.timestamps&&e.dataset.days!=="0"}pe();for(const e of[I,P])e.onchange=()=>W();for(const e of s.querySelectorAll("[data-days]"))e.onclick=()=>{w=e.dataset.days==="ytd"?"ytd":Number(e.dataset.days),W()};a("[data-sessions]").onclick=()=>{f(),T.hidden&&s.clientWidth<1e3&&E(!1),C(T.hidden)},a("[data-close-list]").onclick=()=>C(!1),a("[data-close-detail]").onclick=()=>E(!1),a("[data-detail]").onclick=()=>{b!==null&&(f(),M.hidden&&s.clientWidth<1e3&&C(!1),E(M.hidden))},a("[data-focus]").onclick=()=>{b!==null&&d?.focus(String(b))};const me=()=>{f(),d?.reset()};a("[data-fit]").onclick=me,a("[data-timeline]").onclick=()=>{f(),re(J.hidden)},a("[data-close-timeline]").onclick=()=>re(!1);const q=a(`#${ae}`);let Z=!0;const Y=()=>d?.setSuspended(!Z||document.hidden||q.open);a("[data-help]").onclick=()=>{f(),q.showModal(),Y()},a("[data-close-help]").onclick=()=>q.close(),q.addEventListener("close",Y,{signal:N.signal});const O=a("[data-mute]");O.onclick=()=>{v.muted=!v.muted,G.configure(v);const e=He(v.muted);O.innerHTML=L(e.glyph),O.title=e.label,O.setAttribute("aria-label",e.label),O.setAttribute("aria-pressed",String(v.muted)),v.muted||G.play()};const ee=()=>d?.applyPreferences(v);Ae.addEventListener("change",ee,{signal:N.signal});const be=e=>{if(le||!B)return;const t=Math.max(0,e-Q);Q=e,u<1?u=Math.min(1,u+t*Number(Ce.value)/_e):$+=t,H(),d?.setPlaybackOutro(u>=1?Math.min(1,$/we):null),u>=1&&$>=we+Ue?f():_=requestAnimationFrame(be)};S.onclick=()=>{if(B)return f();u>=1&&(u=0),F={browser:!T.hidden,details:!M.hidden},C(!1),E(!1),a(".public-tooltip").hidden=!0,s.classList.add("playback-mode"),B=!0,$=0,Q=performance.now(),H(),d?.setPlaying(!0),S.innerHTML=L("pause"),S.setAttribute("aria-label","Pause timeline"),_=requestAnimationFrame(be)},R.oninput=()=>{f(),u=Number(R.value)/1e3,H(!0)},s.tabIndex=-1,s.addEventListener("keydown",e=>{q.open||e.target.matches("input, select, textarea")||e.metaKey||e.ctrlKey||e.altKey||(e.key.toLowerCase()==="f"&&(e.preventDefault(),me()),e.key==="Escape"&&j(null),e.code==="Space"&&!e.target.closest("button, summary")&&(e.preventDefault(),S.click()))},{signal:N.signal}),document.addEventListener("visibilitychange",()=>{document.hidden&&f(),Y()},{signal:N.signal});const fe=new IntersectionObserver(([e])=>{Z=e.isIntersecting,Z||f(),Y()});fe.observe(s),s.clientWidth<760&&C(!1),W(!0),ee();const $e=qe(s);return{diagnostics:()=>({...d?.diagnostics(),playing:B,progress:u,outro:$,selected:b}),setData(e){l=ge(e),i=te(l),x=new Map(i.lanes.flatMap(t=>t.nodes.map(r=>[Number(r.session.projectID),t.label]))),v.messageDots=l.settings.messageTimestamps,w=ie(),b=null,pe(),W(!0),ee()},dispose(){le=!0,f(),N.abort(),fe.disconnect(),$e(),ue.dispose(),d?.dispose(),G.dispose(),delete s.dataset.graphAudio,s.replaceChildren(),s.classList.remove("public-viewer","public-viewer-full")}}}export{et as createPublicViewer,Ze as publicSummary};
@@ -1,4 +1,4 @@
1
- import{R as De,W as Ae,H as Ce,T as Ee,M as ve,C as V,S as xe,a as k,G as X,P as he,I as ge,b as F,D,c as L,A as H,d as Z,e as j,B as E,F as I,f as re,g as U,V as v,h as O,i as ne,j as Fe,k as Ge,l as Ue,O as Oe,E as ze,U as Xe,m as Le,n as He,o as _e,p as Ve,q as Ne,r as se,s as $e,t as We,u as ue,v as je,w as qe,x as ae,y as de,z as Ye,L as Ze,J as we,K as Me,N as Ke}from"./three-DDiuFd7k.js";import{K as te,L as P,D as Re,M as le,N as B,a as Qe,O as Je,Q as oe,T as et,U as tt,W as it}from"./index-DK0pBf-7.js";class st extends De{target=new Ae(1,1,{type:Ce});copy=new Ee(this.target.texture);setSamples(e){this.target.samples!==e&&(this.target.samples=e,this.target.dispose())}setSize(e,t){this.target.setSize(e,t)}render(e,t,s,o,i){if(!this.target.samples){super.render(e,t,s,o,i);return}super.render(e,t,this.target,o,i),this.copy.render(e,t,s,o,i)}dispose(){this.copy.dispose(),this.target.dispose()}}const ot=new Intl.DateTimeFormat("en",{month:"short"}),rt=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"});function nt(u){if(u.calendarTime===!1||!(u.end>u.start))return[];const e=new Date(u.start),t=new Date(u.end);if(!Number.isFinite(+e)||!Number.isFinite(+t))return[];const s=h=>h.getFullYear()*12+h.getMonth(),o=s(e),i=s(t),r=Math.ceil((i-o+1)/24),a=[1,2,3,6,12].find(h=>h>=r)??Math.ceil(r/12)*12,n=o===i||e.getFullYear()!==t.getFullYear()?rt:ot,l=[];for(let h=Math.ceil(o/a)*a;h<=i;h+=a){const c=new Date(0);c.setFullYear(Math.floor(h/12),h%12,1),c.setHours(0,0,0,0),+c>=u.start&&+c<=u.end&&l.push({x:te(+c,u),label:n.format(c)})}return!l.length&&o===i&&l.push({x:te(u.start,u),label:n.format(e)}),l}const Te=`
1
+ import{R as De,W as Ae,H as Ce,T as Ee,M as ve,C as V,S as xe,a as k,G as X,P as he,I as ge,b as F,D,c as L,A as H,d as Z,e as j,B as E,F as I,f as re,g as U,V as v,h as O,i as ne,j as Fe,k as Ge,l as Ue,O as Oe,E as ze,U as Xe,m as Le,n as He,o as _e,p as Ve,q as Ne,r as se,s as $e,t as We,u as ue,v as je,w as qe,x as ae,y as de,z as Ye,L as Ze,J as we,K as Me,N as Qe}from"./three-DDiuFd7k.js";import{L as te,M as P,D as Re,N as le,O as B,a as Ke,Q as Je,T as oe,U as et,W as tt,X as it}from"./index-YT1ntRdY.js";class st extends De{target=new Ae(1,1,{type:Ce});copy=new Ee(this.target.texture);setSamples(e){this.target.samples!==e&&(this.target.samples=e,this.target.dispose())}setSize(e,t){this.target.setSize(e,t)}render(e,t,s,o,i){if(!this.target.samples){super.render(e,t,s,o,i);return}super.render(e,t,this.target,o,i),this.copy.render(e,t,s,o,i)}dispose(){this.copy.dispose(),this.target.dispose()}}const ot=new Intl.DateTimeFormat("en",{month:"short"}),rt=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"});function nt(u){if(u.calendarTime===!1||!(u.end>u.start))return[];const e=new Date(u.start),t=new Date(u.end);if(!Number.isFinite(+e)||!Number.isFinite(+t))return[];const s=h=>h.getFullYear()*12+h.getMonth(),o=s(e),i=s(t),r=Math.ceil((i-o+1)/24),a=[1,2,3,6,12].find(h=>h>=r)??Math.ceil(r/12)*12,n=o===i||e.getFullYear()!==t.getFullYear()?rt:ot,l=[];for(let h=Math.ceil(o/a)*a;h<=i;h+=a){const c=new Date(0);c.setFullYear(Math.floor(h/12),h%12,1),c.setHours(0,0,0,0),+c>=u.start&&+c<=u.end&&l.push({x:te(+c,u),label:n.format(c)})}return!l.length&&o===i&&l.push({x:te(u.start,u),label:n.format(e)}),l}const Te=`
2
2
  attribute float nodeIndex;
3
3
  uniform float uSelected;
4
4
  uniform float uHovered;
@@ -68,7 +68,7 @@ import{R as De,W as Ae,H as Ce,T as Ee,M as ve,C as V,S as xe,a as k,G as X,P as
68
68
  float tail = smoothstep(0., .04, along) * (.18 + .82 * pow(along, .7));
69
69
  float alpha = (core * .8 + halo * .28) * tail * vAlpha * uTrailOpacity * uIntensity;
70
70
  gl_FragColor = vec4(vColor * (1.1 + core * .35), alpha);
71
- }`}),b=new j(y,g);b.frustumCulled=!1,i.add(b);const m=new E,R=[],f=[],w=[],S=[],A=[],C=[],K=[0];for(let x=0;x<u.length;x++){const N=Math.min(24,Math.max(8,Math.ceil((l[x]-n[x*3])/3)));for(let T=0;T<N;T++)R.push((T+.5)/N,P(`${c[x]}:${T}`),0),f.push(...n.slice(x*3,x*3+3)),w.push(l[x]),S.push(h[x]),A.push(c[x]),C.push(...d.slice(x*3,x*3+3));K.push(R.length/3)}for(const[x,N,T]of[["position",R,3],["origin",f,3],["endX",w,1],["radius",S,1],["seed",A,1],["color",C,3]])m.setAttribute(x,new I(N,T));const Q=new re(new Float32Array(R.length/3),1).setUsage(D);m.setAttribute("reveal",Q);const _=new U(m,new L({uniforms:a,vertexColors:!0,transparent:!0,depthWrite:!1,blending:H,vertexShader:`${Pe}
71
+ }`}),b=new j(y,g);b.frustumCulled=!1,i.add(b);const m=new E,R=[],f=[],w=[],S=[],A=[],C=[],Q=[0];for(let x=0;x<u.length;x++){const N=Math.min(24,Math.max(8,Math.ceil((l[x]-n[x*3])/3)));for(let T=0;T<N;T++)R.push((T+.5)/N,P(`${c[x]}:${T}`),0),f.push(...n.slice(x*3,x*3+3)),w.push(l[x]),S.push(h[x]),A.push(c[x]),C.push(...d.slice(x*3,x*3+3));Q.push(R.length/3)}for(const[x,N,T]of[["position",R,3],["origin",f,3],["endX",w,1],["radius",S,1],["seed",A,1],["color",C,3]])m.setAttribute(x,new I(N,T));const K=new re(new Float32Array(R.length/3),1).setUsage(D);m.setAttribute("reveal",K);const _=new U(m,new L({uniforms:a,vertexColors:!0,transparent:!0,depthWrite:!1,blending:H,vertexShader:`${Pe}
72
72
  void main() {
73
73
  float head = clamp(uHeadX, origin.x, endX), span = head - origin.x;
74
74
  float clock = uTrailTime * uTrailFlow * uTrailSpeed;
@@ -86,7 +86,7 @@ import{R as De,W as Ae,H as Ce,T as Ee,M as ve,C as V,S as xe,a as k,G as X,P as
86
86
  vAlpha = step(.001, span) * smoothstep(.45,1.,reveal) * smoothstep(0., .12, span) * pow(t, 1.4) * (.3 + .7 * position.y) * uGraphReveal * mix(1., .1, uContextFocus);
87
87
  }`,fragmentShader:`uniform float uTrailOpacity; uniform float uIntensity; varying vec3 vColor; varying float vAlpha;
88
88
  void main() { float d = length(gl_PointCoord - .5) * 2.; if (d > 1.) discard;
89
- gl_FragColor = vec4(vColor * 1.7, pow(1.-d, 1.6) * vAlpha * uTrailOpacity * uIntensity); }`}));return _.name="comet-particles",_.frustumCulled=!1,i.add(_),{group:i,update(x){let N=!1;for(let T=0;T<u.length;T++){const ce=x[r[T]];M.getX(T)!==ce&&(N=!0,M.setX(T,ce),Q.array.fill(ce,K[T],K[T+1]))}N&&(M.needsUpdate=!0,Q.needsUpdate=!0)}}}class ct{constructor(e,t,s=!1){this.links=e,this.group.userData.kind="relationship";const o=new he(1,2,48,1),i=new ge;i.index=o.index,i.attributes=o.attributes,i.instanceCount=e.length;for(const[a,n]of[["a","v0"],["b","v1"],["c","v2"],["d","v3"]])i.setAttribute(a,new F(Float32Array.from(e.flatMap(l=>l.curve[n].toArray())),3));i.setAttribute("color",new F(Float32Array.from(e.flatMap(a=>a.color.toArray())),3)),this.progress=new F(new Float32Array(e.length),1).setUsage(D),i.setAttribute("reveal",this.progress);const r=new j(i,new L({uniforms:{...t,uIntensity:{value:s?1.15:.65}},vertexColors:!0,transparent:!0,depthWrite:!1,side:Z,blending:H,vertexShader:`attribute vec3 a,b,c,d; attribute float reveal; uniform float uPixelScale,uPixelRatio;
89
+ gl_FragColor = vec4(vColor * 1.7, pow(1.-d, 1.6) * vAlpha * uTrailOpacity * uIntensity); }`}));return _.name="comet-particles",_.frustumCulled=!1,i.add(_),{group:i,update(x){let N=!1;for(let T=0;T<u.length;T++){const ce=x[r[T]];M.getX(T)!==ce&&(N=!0,M.setX(T,ce),K.array.fill(ce,Q[T],Q[T+1]))}N&&(M.needsUpdate=!0,K.needsUpdate=!0)}}}class ct{constructor(e,t,s=!1){this.links=e,this.group.userData.kind="relationship";const o=new he(1,2,48,1),i=new ge;i.index=o.index,i.attributes=o.attributes,i.instanceCount=e.length;for(const[a,n]of[["a","v0"],["b","v1"],["c","v2"],["d","v3"]])i.setAttribute(a,new F(Float32Array.from(e.flatMap(l=>l.curve[n].toArray())),3));i.setAttribute("color",new F(Float32Array.from(e.flatMap(a=>a.color.toArray())),3)),this.progress=new F(new Float32Array(e.length),1).setUsage(D),i.setAttribute("reveal",this.progress);const r=new j(i,new L({uniforms:{...t,uIntensity:{value:s?1.15:.65}},vertexColors:!0,transparent:!0,depthWrite:!1,side:Z,blending:H,vertexShader:`attribute vec3 a,b,c,d; attribute float reveal; uniform float uPixelScale,uPixelRatio;
90
90
  varying vec3 vColor; varying float vAcross,vAlong,vReveal;
91
91
  vec3 curve(float t) { float s=1.-t; return s*s*s*a+3.*s*s*t*b+3.*s*t*t*c+t*t*t*d; }
92
92
  void main() {
@@ -226,7 +226,7 @@ import{R as De,W as Ae,H as Ce,T as Ee,M as ve,C as V,S as xe,a as k,G as X,P as
226
226
  mv.xy+=orbit(angle,position.y)*orbitSize(mv);gl_Position=projectionMatrix*mv;
227
227
  gl_PointSize=(3.5-position.z*.45)*uPixelRatio;
228
228
  vColor=mix(uOrbitColor,vec3(1.),.5);vAlpha=exp(-position.z*.6)*smoothstep(0.,.4,uTime-uOrbitBorn);
229
- }`));o.frustumCulled=!1,this.orbit.add(o),this.group.add(this.orbit)}select(e){this.selected=e,this.messageXs=[],this.packets=[],this.uniforms.uSelectedIndex.value=e?this.indices.get(e.session.id)??-1:-1,this.uniforms.uOrbitBorn.value=this.time,e&&this.uniforms.uOrbitColor.value.copy(Y(e))}events(e){this.messageXs=this.selected?e.filter(t=>le(t)&&t.time!==null&&t.timeSource!=="unknown").map(t=>te(t.time,this.graph)).filter(t=>t>=this.selected.startPosition[0]&&t<=this.selected.position[0]).sort((t,s)=>t-s):[]}seek(e,t,s,o){if(this.uniforms.uHeadX.value=t,o&&(this.wind=mt(e,t,Number.isFinite(this.lastScrub)?this.time-this.lastScrub:1/30,Math.max(1,B(1,this.graph)-B(0,this.graph))),this.lastScrub=this.time,this.uniforms.uWindX.value=t),t<e&&(this.packets=[]),s&&this.preferences.messageDots&&this.selected){for(const i of pt(this.messageXs,e,t))this.packets.push({x:i,born:this.time});this.packets=this.packets.slice(-8)}}pointer(e,t,s,o){const i=new O(e/s*2-1,1-t/o*2),r=i.clone().sub(this.uniforms.uPointer.value).multiplyScalar(12);this.pointerActive||r.set(0,0),r.clampLength(0,1.5),this.uniforms.uPointerVelocity.value.copy(r),this.uniforms.uPointer.value.copy(i),this.pointerActive=!0,this.pointerAt=this.time}leave(){this.pointerActive=!1}update(e,t,s,o,i){this.time=e,this.group.visible=i.motion&&!i.suspended&&this.graph.nodes.length>0,this.uniforms.uTime.value=e,this.uniforms.uPixelScale.value=i.pixelScale,this.uniforms.uPixelRatio.value=i.pixelRatio,this.uniforms.uViewport.value.set(i.width,i.height),this.uniforms.uPointerStrength.value=k.damp(this.uniforms.uPointerStrength.value,Number(this.pointerActive),7,t),e-this.pointerAt>.03&&this.uniforms.uPointerVelocity.value.multiplyScalar(Math.exp(-t*6)),this.uniforms.uHoverStrength.value=k.damp(this.uniforms.uHoverStrength.value,+!!i.hoverCenter,8,t),i.hoverCenter&&this.uniforms.uHover.value.fromArray(i.hoverCenter),this.wind*=Math.exp(-t*4.5),this.uniforms.uWind.value=this.wind;const r=s.matrixWorldInverse.elements;this.uniforms.uTimeAxis.value.set(r[0],r[1]),this.uniforms.uTimeAxis.value.lengthSq()<1e-4?this.uniforms.uTimeAxis.value.set(1,0):this.uniforms.uTimeAxis.value.normalize();const a=i.playing||this.preferences.trailFlow;if(this.uniforms.uFlow.value=Number(a),this.uniforms.uFocus.value=Number(this.preferences.focusDimming&&!!this.selected&&!i.playing),this.dust&&(this.dust.visible=this.preferences.stars),this.windBand&&(this.windBand.visible=Math.abs(this.wind)>.005),this.energy&&(this.energy.visible=this.preferences.trails!=="off"&&a),this.energyReveal){let l=!1;this.energyIndices.forEach((h,c)=>{const d=o[h]||0;this.energyReveal.getX(c)!==d&&(this.energyReveal.setX(c,d),l=!0)}),l&&(this.energyReveal.needsUpdate=!0)}this.orbit&&(this.orbit.visible=!!i.selectedCenter),i.selectedCenter&&this.selected&&(this.uniforms.uOrbitCenter.value.fromArray(i.selectedCenter),this.uniforms.uOrbitRadius.value=this.selected.radius*this.preferences.nodeScale/100*2.7),this.packets=this.packets.filter(l=>e-l.born<1.15);let n=0;if(this.packetGeometry&&this.selected&&this.preferences.messageDots&&i.selectedCenter)for(const l of this.packets)for(let h=0;h<8;h++){const c=e-l.born-h*.018,d=Math.max(0,Math.min(1,c/.75)),p=Math.min(this.uniforms.uHeadX.value,this.selected.position[0]),y=Math.max(this.selected.startPosition[0],Math.min(p,l.x+(p-l.x)*d));this.packetGeometry.getAttribute("position").setXYZ(n,...G(this.selected,y)),this.packetGeometry.getAttribute("alpha").setX(n++,c<0?0:Math.exp(-h*.35)*Math.max(0,1-c/1.15))}return this.packetGeometry&&(this.packetGeometry.setDrawRange(0,n),this.packetGeometry.getAttribute("position").needsUpdate=!0,this.packetGeometry.getAttribute("alpha").needsUpdate=!0),this.group.visible&&(this.preferences.stars||a&&this.preferences.trails!=="off"||!!i.selectedCenter||Math.abs(this.wind)>.005||e<this.visibleBirthsUntil||this.packets.length>0)}reset(){this.packets=[],this.wind=0,this.lastScrub=-1/0,this.visibleBirthsUntil=0,this.leave();const e=this.sparkGeometry?.getAttribute("born");e&&(e.array.fill(-1e3),e.needsUpdate=!0)}dispose(){this.disposeLayers(),this.energyIndices=[],this.packets=[],this.messageXs=[]}diagnostics(){return{enabled:this.group.visible,dust:this.dust?.geometry.getAttribute("position").count||0,energyParticles:this.energyIndices.length,burstSlots:me[this.preferences.quality].bursts,messagePackets:this.packets.length,wind:this.wind,orbit:!!this.orbit?.visible}}disposeLayers(){this.group.traverse(e=>{const t=e;t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(s=>s.dispose())}),this.group.clear(),this.dust=void 0,this.energy=void 0,this.windBand=void 0,this.orbit=void 0,this.sparkGeometry=void 0,this.packetGeometry=void 0}}function gt(u,e,t=72){const s=u.right-u.left,o=u.bottom-u.top,i={left:Math.min(16,s/4),right:s-Math.min(16,s/4),top:Math.min(t,o/4),bottom:o-Math.min(24,o/4)};let r=[i];for(const h of e){const c={left:h.left-u.left-20,right:h.right-u.left+20,top:h.top-u.top-20,bottom:h.bottom-u.top+20};r=r.flatMap(d=>c.right<=d.left||c.left>=d.right||c.bottom<=d.top||c.top>=d.bottom?[d]:[{...d,right:Math.min(d.right,c.left)},{...d,left:Math.max(d.left,c.right)},{...d,bottom:Math.min(d.bottom,c.top)},{...d,top:Math.max(d.top,c.bottom)}].filter(p=>p.right>p.left&&p.bottom>p.top))}const a=h=>(h.right-h.left)*(h.bottom-h.top),n=r.filter(h=>h.right-h.left>=120&&h.bottom-h.top>=100),l=(n.length?n:r).sort((h,c)=>a(c)-a(h))[0]??i;return{x:(l.left+l.right)/2,y:(l.top+l.bottom)/2,width:l.right-l.left,height:l.bottom-l.top}}class Se{constructor(e=48){this.cellSize=e}cellSize;cells=new Map;clear(){this.cells.clear()}add(e,t,s,o,i,r){if(![t,s,o].every(Number.isFinite)||t+o<0||s+o<0||t-o>i||s-o>r)return;const a=Math.floor(Math.max(0,t-o)/this.cellSize),n=Math.floor(Math.min(i,t+o)/this.cellSize),l=Math.floor(Math.max(0,s-o)/this.cellSize),h=Math.floor(Math.min(r,s+o)/this.cellSize);for(let c=l;c<=h;c++)for(let d=a;d<=n;d++){const p=`${d}:${c}`,y=this.cells.get(p);y?y.push(e):this.cells.set(p,[e])}}at(e,t){return this.cells.get(`${Math.floor(e/this.cellSize)}:${Math.floor(t/this.cellSize)}`)||[]}}function yt(u){return Qe(u.kind==="commit"?"git-commit":u.role==="user"?"user":"bot")}const q=-105,J=70;function W(u){u.traverse(e=>{const t=e;e instanceof ae&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(o=>o.dispose())}),u.clear()}class wt{constructor(e,t,s={}){this.container=e,this.options=s,this.onSelect=t.onSelect,this.onHover=t.onHover,this.onEvent=t.onEvent,this.onEventHover=t.onEventHover,this.renderer=new Ge({antialias:!1,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(Math.max(devicePixelRatio,1.5),2)),this.renderer.localClippingEnabled=!0,this.renderer.setClearColor(new V().setRGB(.001,.0017,.0024),1),this.renderer.toneMapping=Ue,this.renderer.toneMappingExposure=1.05,this.renderer.domElement.setAttribute("aria-label","Interactive 3D session timeline. Drag to orbit, scroll to zoom. Sessions are also available in the list."),this.renderer.domElement.tabIndex=0,e.append(this.renderer.domElement),this.labelLayer=document.createElement("div"),this.labelLayer.className="scene-labels",this.labelLayer.dataset.motion=String(this.motion),e.append(this.labelLayer),this.controls=new Oe(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.065,this.controls.rotateSpeed=.5,this.controls.zoomSpeed=.8,this.controls.addEventListener("change",()=>{this.cameraDirty=!0}),this.controls.addEventListener("start",()=>{this.targetPosition=void 0,this.targetLook=void 0,this.focusedSession=null,this.playing&&t.onPlaybackInterrupt()}),this.camera.position.set(20,70,320),this.scene.add(this.graphGroup,this.selectionGroup,this.filesGroup,this.particles.group);const o=Math.min(2,this.renderer.capabilities.maxSamples),i=new Ae(1,1,{type:Ce,depthBuffer:o===0});this.composer=new ze(this.renderer,i),this.scenePass=new st(this.scene,this.camera),this.scenePass.setSamples(o),this.composer.addPass(this.scenePass),this.bloom=new Xe(new O(1,1),.23,.4,.9);for(const a of[this.bloom.renderTargetBright,...this.bloom.renderTargetsHorizontal,...this.bloom.renderTargetsVertical])a.depthBuffer=!1;this.composer.addPass(this.bloom),this.smaa=new Le,this.composer.addPass(this.smaa),this.composer.addPass(new He);const r=this.smaa;for(const a of[r._areaTexture??r.areaTexture,r._searchTexture??r.searchTexture])a?.image?.addEventListener("load",()=>{this.dirty=!0},{once:!0});this.addStars(),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),this.renderer.domElement.addEventListener("pointermove",this.pointerMove),this.renderer.domElement.addEventListener("pointerdown",this.pointerStart),this.renderer.domElement.addEventListener("pointerup",this.pointerEnd),this.renderer.domElement.addEventListener("pointercancel",()=>{this.pointerID=null}),this.renderer.domElement.addEventListener("pointerleave",this.pointerLeave),this.renderer.domElement.addEventListener("webglcontextlost",this.contextLost),this.resize(),s.manual||this.animate()}container;options;renderer;scene=new _e;camera=new Ve(45,1,.1,2500);controls;composer;scenePass;bloom;smaa;dirty=!0;cameraDirty=!0;cameraSettlesAt=0;graphGroup=new X;selectionGroup=new X;filesGroup=new X;labels=[];labelLayer;graph={nodes:[],edges:[],lanes:[],start:0,end:0};nodeMesh;nodeByID=new Map;nodeIndices=new Map;focusUniforms={uSelected:{value:-1},uHovered:{value:-1},uFocus:{value:0},uFamilyTime:{value:0}};familyDepth;familyGlowDepth;selectionBorn=0;particles=new vt;raycaster=new Ne;nodeGrid=new Se;markerGrid=new Se;pickingDirty=!0;pickingView=new se;pickingProjection=new se;pickMesh;pickMatrix=new se;pickHits=[];width=1;height=1;pointer=new O;pointerDown=new O;pointerID=null;pointerDragged=!1;selected=null;hovered=null;cutoff=1;clipPlane=new $e(new v(-1,0,0),151);motion=!matchMedia("(prefers-reduced-motion: reduce)").matches;suspended=!1;frame=0;resizeObserver;targetPosition;targetLook;playing=!1;playbackPath;playbackRadii=[];playbackSphere=new We;playbackFocus=new v;playbackOffset=new v;playbackOutro=null;playbackOrbit;playbackYawSpeed=0;glowMaterial;glowPositions;time=0;previousFrame=performance.now();nodeReveal=new Float32Array;nodeBorn=new Float64Array;arrivals;comets;selectedComets;links;selectedLinks;headDirection=new v;revealAttribute;revealsActive=!1;graphBorn=0;fileMesh;eventMarkers=[];selectedEvent=null;focusedEvent;focusedSession=null;eventIcons=[];iconPoint=new v;markerUniforms={uPixelRatio:{value:1},uSelected:{value:-1},uHovered:{value:-1}};fileOffsets=[];fileOrigin=new v;fileBorn=0;fileUniforms={uTime:{value:0},uBorn:{value:0},uMotion:{value:1},uOrigin:{value:new v}};lineUniforms={uCutoff:{value:160},uReveal:{value:1}};preferences={...Re};trailUniforms={uTrailTime:{value:0},uTrailFlow:{value:0},uTrailSpeed:{value:.5},uTrailOpacity:{value:1}};cometUniforms={uHeadX:{value:150},uPixelScale:{value:1e3},uNodeScale:{value:1}};stars;transform=new ue;onSelect;onHover;onEvent;onEventHover;contextLost=e=>{e.preventDefault(),this.container.dispatchEvent(new CustomEvent("scene-error",{detail:"The graphics context was lost. Reload to restore the 3D view; the session list is still available."}))};addStars(){const e=[];for(let s=0;s<280;s++)e.push((P(`sx${s}`)-.5)*1100,(P(`sy${s}`)-.5)*700,-120-P(`sz${s}`)*500);const t=new E;t.setAttribute("position",new I(e,3)),this.stars=new U(t,new je({color:"#7b9fa9",size:.4,transparent:!0,opacity:.18,sizeAttenuation:!0})),this.scene.add(this.stars)}applyPreferences(e){const t=this.preferences;this.preferences={...e},this.particles.configure(e);const s=Je(e,matchMedia("(prefers-reduced-motion: reduce)").matches);if(s!==this.motion&&this.setMotion(s),e.quality!==t.quality){const i=e.quality==="performance"?0:Math.min(e.quality==="high"?4:2,this.renderer.capabilities.maxSamples);this.scenePass.setSamples(i);for(const r of[this.composer.renderTarget1,this.composer.renderTarget2])r.depthBuffer=i===0,r.dispose();this.smaa.enabled=e.quality!=="performance",this.resize()}this.bloom.strength=e.bloom/100,this.bloom.enabled=e.quality!=="performance"&&e.bloom>0,this.stars&&(this.stars.visible=e.stars),this.labelLayer.hidden=!e.labels,this.trailUniforms.uTrailOpacity.value=e.trailOpacity/42,this.trailUniforms.uTrailSpeed.value=e.trailSpeed/100,this.cometUniforms.uNodeScale.value=e.nodeScale/100;for(const i of[this.graphGroup,this.selectionGroup])for(const r of i.children)r.userData.kind==="lifetime"&&(r.visible=e.trails==="all"||e.trails==="selected"&&i===this.selectionGroup),r.userData.kind==="relationship"&&(r.visible=e.relationships);const o=this.selectionGroup.getObjectByName("event-markers");o&&(o.visible=e.messageDots),this.nodeMesh&&t.nodeScale!==e.nodeScale&&(this.nodeMesh.boundingSphere=null,this.revealsActive=!0),t.messageDots!==e.messageDots&&(this.revealsActive=!0),this.dirty=!0}setGraph(e,t=!1,s=!1){const o=s?new Map(this.graph.nodes.map((f,w)=>[f.session.id,this.nodeBorn[w]])):void 0;if(this.pickingDirty=!0,this.dirty=!0,W(this.graphGroup),W(this.selectionGroup),W(this.filesGroup),this.eventMarkers=[],this.eventIcons=[],this.fileMesh=void 0,this.fileOffsets=[],this.labels=[],this.labelLayer.replaceChildren(),this.graph=e,this.particles.setGraph(e),(!s||!this.playing)&&(this.playbackPath=void 0,this.playbackRadii=[]),this.nodeByID=new Map(e.nodes.map(f=>[f.session.id,f])),this.nodeIndices=new Map(e.nodes.map((f,w)=>[f.session.id,w])),this.focusUniforms.uSelected.value=this.selected?this.nodeIndices.get(this.selected)??-1:-1,this.focusUniforms.uHovered.value=-1,this.hovered=null,this.nodeMesh=void 0,this.pickMesh=void 0,this.glowMaterial=void 0,this.glowPositions=void 0,this.arrivals=void 0,this.links=void 0,this.selectedLinks=void 0,this.comets=void 0,this.selectedComets=void 0,this.graphBorn=s?this.time-1:this.time,this.nodeBorn=Float64Array.from(e.nodes,f=>o?.get(f.session.id)??NaN),this.nodeReveal=new Float32Array(e.nodes.length),this.revealsActive=this.motion&&e.nodes.length>0,this.familyDepth=void 0,this.familyGlowDepth=void 0,!e.nodes.length)return;const i=new qe(1,32,20),r=Float32Array.from(e.nodes,(f,w)=>w);i.setAttribute("nodeIndex",new F(r,1));const a=new Float32Array(e.nodes.length).fill(-1);this.familyDepth=new F(a,1).setUsage(D),i.setAttribute("familyDepth",this.familyDepth);const n=new ae(i,at(this.focusUniforms),e.nodes.length);n.instanceMatrix.setUsage(D),n.frustumCulled=!1;const l=new ue,h=[],c=[],d=[];e.nodes.forEach((f,w)=>{l.position.fromArray(f.position),l.scale.setScalar(f.radius*this.preferences.nodeScale/100),l.updateMatrix(),n.setMatrixAt(w,l.matrix);const S=Y(f);n.setColorAt(w,S),h.push(...f.position),c.push(...S.toArray()),d.push(f.radius*11)}),n.instanceMatrix.needsUpdate=!0,n.computeBoundingSphere(),this.nodeMesh=n,this.pickMesh=new j(i,n.material),this.graphGroup.add(n);const p=new E;this.glowPositions=new I(h,3).setUsage(D),p.setAttribute("position",this.glowPositions),p.setAttribute("color",new I(c,3)),p.setAttribute("size",new I(d,1)),p.setAttribute("nodeIndex",new re(r,1)),this.familyGlowDepth=new re(a,1).setUsage(D),p.setAttribute("familyDepth",this.familyGlowDepth),this.revealAttribute=new re(this.nodeReveal,1).setUsage(D),p.setAttribute("reveal",this.revealAttribute),this.glowMaterial=new L({uniforms:{...this.focusUniforms,uCutoff:{value:151},uScale:{value:this.container.clientHeight*this.renderer.getPixelRatio()*.9},uGlowSize:{value:1},uGlowIntensity:{value:1}},vertexShader:`${Te}
229
+ }`));o.frustumCulled=!1,this.orbit.add(o),this.group.add(this.orbit)}select(e){this.selected=e,this.messageXs=[],this.packets=[],this.uniforms.uSelectedIndex.value=e?this.indices.get(e.session.id)??-1:-1,this.uniforms.uOrbitBorn.value=this.time,e&&this.uniforms.uOrbitColor.value.copy(Y(e))}events(e){this.messageXs=this.selected?e.filter(t=>le(t)&&t.time!==null&&t.timeSource!=="unknown").map(t=>te(t.time,this.graph)).filter(t=>t>=this.selected.startPosition[0]&&t<=this.selected.position[0]).sort((t,s)=>t-s):[]}seek(e,t,s,o){if(this.uniforms.uHeadX.value=t,o&&(this.wind=mt(e,t,Number.isFinite(this.lastScrub)?this.time-this.lastScrub:1/30,Math.max(1,B(1,this.graph)-B(0,this.graph))),this.lastScrub=this.time,this.uniforms.uWindX.value=t),t<e&&(this.packets=[]),s&&this.preferences.messageDots&&this.selected){for(const i of pt(this.messageXs,e,t))this.packets.push({x:i,born:this.time});this.packets=this.packets.slice(-8)}}pointer(e,t,s,o){const i=new O(e/s*2-1,1-t/o*2),r=i.clone().sub(this.uniforms.uPointer.value).multiplyScalar(12);this.pointerActive||r.set(0,0),r.clampLength(0,1.5),this.uniforms.uPointerVelocity.value.copy(r),this.uniforms.uPointer.value.copy(i),this.pointerActive=!0,this.pointerAt=this.time}leave(){this.pointerActive=!1}update(e,t,s,o,i){this.time=e,this.group.visible=i.motion&&!i.suspended&&this.graph.nodes.length>0,this.uniforms.uTime.value=e,this.uniforms.uPixelScale.value=i.pixelScale,this.uniforms.uPixelRatio.value=i.pixelRatio,this.uniforms.uViewport.value.set(i.width,i.height),this.uniforms.uPointerStrength.value=k.damp(this.uniforms.uPointerStrength.value,Number(this.pointerActive),7,t),e-this.pointerAt>.03&&this.uniforms.uPointerVelocity.value.multiplyScalar(Math.exp(-t*6)),this.uniforms.uHoverStrength.value=k.damp(this.uniforms.uHoverStrength.value,+!!i.hoverCenter,8,t),i.hoverCenter&&this.uniforms.uHover.value.fromArray(i.hoverCenter),this.wind*=Math.exp(-t*4.5),this.uniforms.uWind.value=this.wind;const r=s.matrixWorldInverse.elements;this.uniforms.uTimeAxis.value.set(r[0],r[1]),this.uniforms.uTimeAxis.value.lengthSq()<1e-4?this.uniforms.uTimeAxis.value.set(1,0):this.uniforms.uTimeAxis.value.normalize();const a=i.playing||this.preferences.trailFlow;if(this.uniforms.uFlow.value=Number(a),this.uniforms.uFocus.value=Number(this.preferences.focusDimming&&!!this.selected&&!i.playing),this.dust&&(this.dust.visible=this.preferences.stars),this.windBand&&(this.windBand.visible=Math.abs(this.wind)>.005),this.energy&&(this.energy.visible=this.preferences.trails!=="off"&&a),this.energyReveal){let l=!1;this.energyIndices.forEach((h,c)=>{const d=o[h]||0;this.energyReveal.getX(c)!==d&&(this.energyReveal.setX(c,d),l=!0)}),l&&(this.energyReveal.needsUpdate=!0)}this.orbit&&(this.orbit.visible=!!i.selectedCenter),i.selectedCenter&&this.selected&&(this.uniforms.uOrbitCenter.value.fromArray(i.selectedCenter),this.uniforms.uOrbitRadius.value=this.selected.radius*this.preferences.nodeScale/100*2.7),this.packets=this.packets.filter(l=>e-l.born<1.15);let n=0;if(this.packetGeometry&&this.selected&&this.preferences.messageDots&&i.selectedCenter)for(const l of this.packets)for(let h=0;h<8;h++){const c=e-l.born-h*.018,d=Math.max(0,Math.min(1,c/.75)),p=Math.min(this.uniforms.uHeadX.value,this.selected.position[0]),y=Math.max(this.selected.startPosition[0],Math.min(p,l.x+(p-l.x)*d));this.packetGeometry.getAttribute("position").setXYZ(n,...G(this.selected,y)),this.packetGeometry.getAttribute("alpha").setX(n++,c<0?0:Math.exp(-h*.35)*Math.max(0,1-c/1.15))}return this.packetGeometry&&(this.packetGeometry.setDrawRange(0,n),this.packetGeometry.getAttribute("position").needsUpdate=!0,this.packetGeometry.getAttribute("alpha").needsUpdate=!0),this.group.visible&&(this.preferences.stars||a&&this.preferences.trails!=="off"||!!i.selectedCenter||Math.abs(this.wind)>.005||e<this.visibleBirthsUntil||this.packets.length>0)}reset(){this.packets=[],this.wind=0,this.lastScrub=-1/0,this.visibleBirthsUntil=0,this.leave();const e=this.sparkGeometry?.getAttribute("born");e&&(e.array.fill(-1e3),e.needsUpdate=!0)}dispose(){this.disposeLayers(),this.energyIndices=[],this.packets=[],this.messageXs=[]}diagnostics(){return{enabled:this.group.visible,dust:this.dust?.geometry.getAttribute("position").count||0,energyParticles:this.energyIndices.length,burstSlots:me[this.preferences.quality].bursts,messagePackets:this.packets.length,wind:this.wind,orbit:!!this.orbit?.visible}}disposeLayers(){this.group.traverse(e=>{const t=e;t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(s=>s.dispose())}),this.group.clear(),this.dust=void 0,this.energy=void 0,this.windBand=void 0,this.orbit=void 0,this.sparkGeometry=void 0,this.packetGeometry=void 0}}function gt(u,e,t=72){const s=u.right-u.left,o=u.bottom-u.top,i={left:Math.min(16,s/4),right:s-Math.min(16,s/4),top:Math.min(t,o/4),bottom:o-Math.min(24,o/4)};let r=[i];for(const h of e){const c={left:h.left-u.left-20,right:h.right-u.left+20,top:h.top-u.top-20,bottom:h.bottom-u.top+20};r=r.flatMap(d=>c.right<=d.left||c.left>=d.right||c.bottom<=d.top||c.top>=d.bottom?[d]:[{...d,right:Math.min(d.right,c.left)},{...d,left:Math.max(d.left,c.right)},{...d,bottom:Math.min(d.bottom,c.top)},{...d,top:Math.max(d.top,c.bottom)}].filter(p=>p.right>p.left&&p.bottom>p.top))}const a=h=>(h.right-h.left)*(h.bottom-h.top),n=r.filter(h=>h.right-h.left>=120&&h.bottom-h.top>=100),l=(n.length?n:r).sort((h,c)=>a(c)-a(h))[0]??i;return{x:(l.left+l.right)/2,y:(l.top+l.bottom)/2,width:l.right-l.left,height:l.bottom-l.top}}class Se{constructor(e=48){this.cellSize=e}cellSize;cells=new Map;clear(){this.cells.clear()}add(e,t,s,o,i,r){if(![t,s,o].every(Number.isFinite)||t+o<0||s+o<0||t-o>i||s-o>r)return;const a=Math.floor(Math.max(0,t-o)/this.cellSize),n=Math.floor(Math.min(i,t+o)/this.cellSize),l=Math.floor(Math.max(0,s-o)/this.cellSize),h=Math.floor(Math.min(r,s+o)/this.cellSize);for(let c=l;c<=h;c++)for(let d=a;d<=n;d++){const p=`${d}:${c}`,y=this.cells.get(p);y?y.push(e):this.cells.set(p,[e])}}at(e,t){return this.cells.get(`${Math.floor(e/this.cellSize)}:${Math.floor(t/this.cellSize)}`)||[]}}function yt(u){return Ke(u.kind==="commit"?"git-commit":u.role==="user"?"user":"bot")}const q=-105,J=70;function W(u){u.traverse(e=>{const t=e;e instanceof ae&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(o=>o.dispose())}),u.clear()}class wt{constructor(e,t,s={}){this.container=e,this.options=s,this.onSelect=t.onSelect,this.onHover=t.onHover,this.onEvent=t.onEvent,this.onEventHover=t.onEventHover,this.renderer=new Ge({antialias:!1,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(Math.max(devicePixelRatio,1.5),2)),this.renderer.localClippingEnabled=!0,this.renderer.setClearColor(new V().setRGB(.001,.0017,.0024),1),this.renderer.toneMapping=Ue,this.renderer.toneMappingExposure=1.05,this.renderer.domElement.setAttribute("aria-label","Interactive 3D session timeline. Drag to orbit, scroll to zoom. Sessions are also available in the list."),this.renderer.domElement.tabIndex=0,e.append(this.renderer.domElement),this.labelLayer=document.createElement("div"),this.labelLayer.className="scene-labels",this.labelLayer.dataset.motion=String(this.motion),e.append(this.labelLayer),this.controls=new Oe(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.065,this.controls.rotateSpeed=.5,this.controls.zoomSpeed=.8,this.controls.addEventListener("change",()=>{this.cameraDirty=!0}),this.controls.addEventListener("start",()=>{this.targetPosition=void 0,this.targetLook=void 0,this.focusedSession=null,this.playing&&t.onPlaybackInterrupt()}),this.camera.position.set(20,70,320),this.scene.add(this.graphGroup,this.selectionGroup,this.filesGroup,this.particles.group);const o=Math.min(2,this.renderer.capabilities.maxSamples),i=new Ae(1,1,{type:Ce,depthBuffer:o===0});this.composer=new ze(this.renderer,i),this.scenePass=new st(this.scene,this.camera),this.scenePass.setSamples(o),this.composer.addPass(this.scenePass),this.bloom=new Xe(new O(1,1),.23,.4,.9);for(const a of[this.bloom.renderTargetBright,...this.bloom.renderTargetsHorizontal,...this.bloom.renderTargetsVertical])a.depthBuffer=!1;this.composer.addPass(this.bloom),this.smaa=new Le,this.composer.addPass(this.smaa),this.composer.addPass(new He);const r=this.smaa;for(const a of[r._areaTexture??r.areaTexture,r._searchTexture??r.searchTexture])a?.image?.addEventListener("load",()=>{this.dirty=!0},{once:!0});this.addStars(),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),this.renderer.domElement.addEventListener("pointermove",this.pointerMove),this.renderer.domElement.addEventListener("pointerdown",this.pointerStart),this.renderer.domElement.addEventListener("pointerup",this.pointerEnd),this.renderer.domElement.addEventListener("pointercancel",()=>{this.pointerID=null}),this.renderer.domElement.addEventListener("pointerleave",this.pointerLeave),this.renderer.domElement.addEventListener("webglcontextlost",this.contextLost),this.resize(),s.manual||this.animate()}container;options;renderer;scene=new _e;camera=new Ve(45,1,.1,2500);controls;composer;scenePass;bloom;smaa;dirty=!0;cameraDirty=!0;cameraSettlesAt=0;graphGroup=new X;selectionGroup=new X;filesGroup=new X;labels=[];labelLayer;graph={nodes:[],edges:[],lanes:[],start:0,end:0};nodeMesh;nodeByID=new Map;nodeIndices=new Map;focusUniforms={uSelected:{value:-1},uHovered:{value:-1},uFocus:{value:0},uFamilyTime:{value:0}};familyDepth;familyGlowDepth;selectionBorn=0;particles=new vt;raycaster=new Ne;nodeGrid=new Se;markerGrid=new Se;pickingDirty=!0;pickingView=new se;pickingProjection=new se;pickMesh;pickMatrix=new se;pickHits=[];width=1;height=1;pointer=new O;pointerDown=new O;pointerID=null;pointerDragged=!1;selected=null;hovered=null;cutoff=1;clipPlane=new $e(new v(-1,0,0),151);motion=!matchMedia("(prefers-reduced-motion: reduce)").matches;suspended=!1;frame=0;resizeObserver;targetPosition;targetLook;playing=!1;playbackPath;playbackRadii=[];playbackSphere=new We;playbackFocus=new v;playbackOffset=new v;playbackOutro=null;playbackOrbit;playbackYawSpeed=0;glowMaterial;glowPositions;time=0;previousFrame=performance.now();nodeReveal=new Float32Array;nodeBorn=new Float64Array;arrivals;comets;selectedComets;links;selectedLinks;headDirection=new v;revealAttribute;revealsActive=!1;graphBorn=0;fileMesh;eventMarkers=[];selectedEvent=null;focusedEvent;focusedSession=null;eventIcons=[];iconPoint=new v;markerUniforms={uPixelRatio:{value:1},uSelected:{value:-1},uHovered:{value:-1}};fileOffsets=[];fileOrigin=new v;fileBorn=0;fileUniforms={uTime:{value:0},uBorn:{value:0},uMotion:{value:1},uOrigin:{value:new v}};lineUniforms={uCutoff:{value:160},uReveal:{value:1}};preferences={...Re};trailUniforms={uTrailTime:{value:0},uTrailFlow:{value:0},uTrailSpeed:{value:.5},uTrailOpacity:{value:1}};cometUniforms={uHeadX:{value:150},uPixelScale:{value:1e3},uNodeScale:{value:1}};stars;transform=new ue;onSelect;onHover;onEvent;onEventHover;contextLost=e=>{e.preventDefault(),this.container.dispatchEvent(new CustomEvent("scene-error",{detail:"The graphics context was lost. Reload to restore the 3D view; the session list is still available."}))};addStars(){const e=[];for(let s=0;s<280;s++)e.push((P(`sx${s}`)-.5)*1100,(P(`sy${s}`)-.5)*700,-120-P(`sz${s}`)*500);const t=new E;t.setAttribute("position",new I(e,3)),this.stars=new U(t,new je({color:"#7b9fa9",size:.4,transparent:!0,opacity:.18,sizeAttenuation:!0})),this.scene.add(this.stars)}applyPreferences(e){const t=this.preferences;this.preferences={...e},this.particles.configure(e);const s=Je(e,matchMedia("(prefers-reduced-motion: reduce)").matches);if(s!==this.motion&&this.setMotion(s),e.quality!==t.quality){const i=e.quality==="performance"?0:Math.min(e.quality==="high"?4:2,this.renderer.capabilities.maxSamples);this.scenePass.setSamples(i);for(const r of[this.composer.renderTarget1,this.composer.renderTarget2])r.depthBuffer=i===0,r.dispose();this.smaa.enabled=e.quality!=="performance",this.resize()}this.bloom.strength=e.bloom/100,this.bloom.enabled=e.quality!=="performance"&&e.bloom>0,this.stars&&(this.stars.visible=e.stars),this.labelLayer.hidden=!e.labels,this.trailUniforms.uTrailOpacity.value=e.trailOpacity/42,this.trailUniforms.uTrailSpeed.value=e.trailSpeed/100,this.cometUniforms.uNodeScale.value=e.nodeScale/100;for(const i of[this.graphGroup,this.selectionGroup])for(const r of i.children)r.userData.kind==="lifetime"&&(r.visible=e.trails==="all"||e.trails==="selected"&&i===this.selectionGroup),r.userData.kind==="relationship"&&(r.visible=e.relationships);const o=this.selectionGroup.getObjectByName("event-markers");o&&(o.visible=e.messageDots),this.nodeMesh&&t.nodeScale!==e.nodeScale&&(this.nodeMesh.boundingSphere=null,this.revealsActive=!0),t.messageDots!==e.messageDots&&(this.revealsActive=!0),this.dirty=!0}setGraph(e,t=!1,s=!1){const o=s?new Map(this.graph.nodes.map((f,w)=>[f.session.id,this.nodeBorn[w]])):void 0;if(this.pickingDirty=!0,this.dirty=!0,W(this.graphGroup),W(this.selectionGroup),W(this.filesGroup),this.eventMarkers=[],this.eventIcons=[],this.fileMesh=void 0,this.fileOffsets=[],this.labels=[],this.labelLayer.replaceChildren(),this.graph=e,this.particles.setGraph(e),(!s||!this.playing)&&(this.playbackPath=void 0,this.playbackRadii=[]),this.nodeByID=new Map(e.nodes.map(f=>[f.session.id,f])),this.nodeIndices=new Map(e.nodes.map((f,w)=>[f.session.id,w])),this.focusUniforms.uSelected.value=this.selected?this.nodeIndices.get(this.selected)??-1:-1,this.focusUniforms.uHovered.value=-1,this.hovered=null,this.nodeMesh=void 0,this.pickMesh=void 0,this.glowMaterial=void 0,this.glowPositions=void 0,this.arrivals=void 0,this.links=void 0,this.selectedLinks=void 0,this.comets=void 0,this.selectedComets=void 0,this.graphBorn=s?this.time-1:this.time,this.nodeBorn=Float64Array.from(e.nodes,f=>o?.get(f.session.id)??NaN),this.nodeReveal=new Float32Array(e.nodes.length),this.revealsActive=this.motion&&e.nodes.length>0,this.familyDepth=void 0,this.familyGlowDepth=void 0,!e.nodes.length)return;const i=new qe(1,32,20),r=Float32Array.from(e.nodes,(f,w)=>w);i.setAttribute("nodeIndex",new F(r,1));const a=new Float32Array(e.nodes.length).fill(-1);this.familyDepth=new F(a,1).setUsage(D),i.setAttribute("familyDepth",this.familyDepth);const n=new ae(i,at(this.focusUniforms),e.nodes.length);n.instanceMatrix.setUsage(D),n.frustumCulled=!1;const l=new ue,h=[],c=[],d=[];e.nodes.forEach((f,w)=>{l.position.fromArray(f.position),l.scale.setScalar(f.radius*this.preferences.nodeScale/100),l.updateMatrix(),n.setMatrixAt(w,l.matrix);const S=Y(f);n.setColorAt(w,S),h.push(...f.position),c.push(...S.toArray()),d.push(f.radius*11)}),n.instanceMatrix.needsUpdate=!0,n.computeBoundingSphere(),this.nodeMesh=n,this.pickMesh=new j(i,n.material),this.graphGroup.add(n);const p=new E;this.glowPositions=new I(h,3).setUsage(D),p.setAttribute("position",this.glowPositions),p.setAttribute("color",new I(c,3)),p.setAttribute("size",new I(d,1)),p.setAttribute("nodeIndex",new re(r,1)),this.familyGlowDepth=new re(a,1).setUsage(D),p.setAttribute("familyDepth",this.familyGlowDepth),this.revealAttribute=new re(this.nodeReveal,1).setUsage(D),p.setAttribute("reveal",this.revealAttribute),this.glowMaterial=new L({uniforms:{...this.focusUniforms,uCutoff:{value:151},uScale:{value:this.container.clientHeight*this.renderer.getPixelRatio()*.9},uGlowSize:{value:1},uGlowIntensity:{value:1}},vertexShader:`${Te}
230
230
  attribute float size; attribute float reveal; varying vec3 vColor; varying float vVisible; uniform float uScale; uniform float uCutoff; uniform float uGlowSize;
231
231
  void main() { vColor = color; vVisible = reveal; vNodeEmphasis = nodeEmphasis(); vec4 mv = modelViewMatrix * vec4(position, 1.0);
232
232
  gl_PointSize = clamp(size * uGlowSize * uScale / max(.1,-mv.z), 2.0, 100.0); gl_Position = projectionMatrix * mv; }`,fragmentShader:`varying vec3 vColor; varying float vVisible; varying float vNodeEmphasis; uniform float uGlowIntensity;
@@ -241,8 +241,8 @@ diffuseColor.a *= ${r?"step(vTimelineX, uTimelineCutoff)":"smoothstep(0.0, .6, u
241
241
  gl_FragColor = vec4(mix(mix(vec3(1.0), uTint, .08), vec3(1.0,.66,.2),vCommit) * (1.5 + vActive * .3), 1.0 - smoothstep(.55, 1.0, d)); }`}),c=new X;c.name="event-markers",c.visible=this.preferences.messageDots;const d=new U(a.clone(),new L({uniforms:{...n,uPointScale:{value:3}},transparent:!0,depthWrite:!1,depthTest:!1,blending:H,vertexShader:l,fragmentShader:`uniform float uCutoff; uniform vec3 uTint; varying float vTimeX; varying float vActive;
242
242
  void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0 || vTimeX > uCutoff) discard;
243
243
  float alpha = exp(-d*d*5.0) * (1.0-smoothstep(.6,1.0,d)) * mix(.2,.32,vActive);
244
- gl_FragColor = vec4(mix(vec3(1.0), uTint, .65), alpha); }`}));d.renderOrder=9;const p=new U(a,h);p.renderOrder=10,c.add(d,p),this.selectionGroup.add(c);const y=this.eventMarkers.length-1,M=new Set;for(let g=y;g>=Math.max(0,y-31);g--)M.add(g);for(let g=0;g<32&&y>31;g++)M.add(Math.floor(g*(y-32)/31));for(const g of this.eventMarkers.map((b,m)=>({...b,index:m})).filter(b=>b.item.kind==="commit").slice(-32))M.add(g.index);for(const g of[...M].sort((b,m)=>m-b)){const b=document.createElement("div");b.className="event-marker-icon",b.setAttribute("aria-hidden","true"),b.style.color=this.eventMarkers[g].item.kind==="commit"?"#ffd580":"#ffffff",b.append(yt(this.eventMarkers[g].item)),this.labelLayer.append(b),this.eventIcons.push({element:b,marker:g,visible:!1,transform:""})}t&&this.focusedSession===this.selected&&this.selected&&this.focus(this.selected)}clearEventIcons(){for(const e of this.eventIcons)e.element.remove();this.eventIcons=[]}selectEvent(e){this.selectedEvent=e,e||(this.focusedEvent=void 0),this.markerUniforms.uSelected.value=this.eventMarkers.findIndex(t=>t.item.id===e),this.dirty=!0}focusEvent(e){this.focusedSession=null;const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t||e.time===null||!le(e)&&e.kind!=="commit")return;const s=te(e.time,this.graph);!Number.isFinite(s)||s<t.startPosition[0]||s>t.position[0]||(this.focusedEvent={...e,preview:"preview"in e?e.preview:(e.text||e.input||e.output||"").slice(0,180)},this.eventMarkers.some(o=>o.item.id===e.id)||this.setEvents(this.eventMarkers.map(o=>o.item)),this.selectEvent(e.id),this.focusPoint(new v(...G(t,s)),8))}setFiles(e){this.dirty=!0,W(this.filesGroup),this.fileMesh=void 0,this.fileOffsets=[];const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t)return;const s=[],o=[],i=e.slice(0,80);if(!i.length)return;const r=new Ke(.55),a=new ve({color:"#edc899"}),n=new ae(r,a,i.length);n.instanceMatrix.setUsage(D),n.frustumCulled=!1,this.fileMesh=n,this.fileBorn=this.time,this.fileOrigin.fromArray(t.position),this.fileUniforms.uOrigin.value.copy(this.fileOrigin),this.fileUniforms.uBorn.value=this.fileBorn;const l=new ue;if(i.forEach((h,c)=>{const d=c*2.399963,p=9+Math.sqrt(c)*2.5,y=[t.position[0]+Math.cos(d)*p,t.position[1]+Math.sin(d)*p,t.position[2]+6+P(h.path)*8];this.fileOffsets.push(new v(...y).sub(this.fileOrigin)),l.position.fromArray(y),l.scale.setScalar(this.motion?0:1),l.updateMatrix(),n.setMatrixAt(c,l.matrix);const M=this.edgeCurve(t.position,y).getPoints(24);for(let g=1;g<M.length;g++)s.push(...M[g-1].toArray(),...M[g].toArray()),o.push(c*.018,c*.018)}),n.instanceMatrix.needsUpdate=!0,this.filesGroup.add(n),s.length){const h=new E;h.setAttribute("position",new I(s,3)),h.setAttribute("delay",new I(o,1));const c=new L({uniforms:this.fileUniforms,transparent:!0,depthWrite:!1,blending:H,vertexShader:`attribute float delay; uniform vec3 uOrigin; uniform float uTime; uniform float uBorn; uniform float uMotion; varying float vAlpha;
244
+ gl_FragColor = vec4(mix(vec3(1.0), uTint, .65), alpha); }`}));d.renderOrder=9;const p=new U(a,h);p.renderOrder=10,c.add(d,p),this.selectionGroup.add(c);const y=this.eventMarkers.length-1,M=new Set;for(let g=y;g>=Math.max(0,y-31);g--)M.add(g);for(let g=0;g<32&&y>31;g++)M.add(Math.floor(g*(y-32)/31));for(const g of this.eventMarkers.map((b,m)=>({...b,index:m})).filter(b=>b.item.kind==="commit").slice(-32))M.add(g.index);for(const g of[...M].sort((b,m)=>m-b)){const b=document.createElement("div");b.className="event-marker-icon",b.setAttribute("aria-hidden","true"),b.style.color=this.eventMarkers[g].item.kind==="commit"?"#ffd580":"#ffffff",b.append(yt(this.eventMarkers[g].item)),this.labelLayer.append(b),this.eventIcons.push({element:b,marker:g,visible:!1,transform:""})}t&&this.focusedSession===this.selected&&this.selected&&this.focus(this.selected)}clearEventIcons(){for(const e of this.eventIcons)e.element.remove();this.eventIcons=[]}selectEvent(e){this.selectedEvent=e,e||(this.focusedEvent=void 0),this.markerUniforms.uSelected.value=this.eventMarkers.findIndex(t=>t.item.id===e),this.dirty=!0}focusEvent(e){this.focusedSession=null;const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t||e.time===null||!le(e)&&e.kind!=="commit")return;const s=te(e.time,this.graph);!Number.isFinite(s)||s<t.startPosition[0]||s>t.position[0]||(this.focusedEvent={...e,preview:"preview"in e?e.preview:(e.text||e.input||e.output||"").slice(0,180)},this.eventMarkers.some(o=>o.item.id===e.id)||this.setEvents(this.eventMarkers.map(o=>o.item)),this.selectEvent(e.id),this.focusPoint(new v(...G(t,s)),8))}setFiles(e){this.dirty=!0,W(this.filesGroup),this.fileMesh=void 0,this.fileOffsets=[];const t=this.selected?this.nodeByID.get(this.selected):void 0;if(!t)return;const s=[],o=[],i=e.slice(0,80);if(!i.length)return;const r=new Qe(.55),a=new ve({color:"#edc899"}),n=new ae(r,a,i.length);n.instanceMatrix.setUsage(D),n.frustumCulled=!1,this.fileMesh=n,this.fileBorn=this.time,this.fileOrigin.fromArray(t.position),this.fileUniforms.uOrigin.value.copy(this.fileOrigin),this.fileUniforms.uBorn.value=this.fileBorn;const l=new ue;if(i.forEach((h,c)=>{const d=c*2.399963,p=9+Math.sqrt(c)*2.5,y=[t.position[0]+Math.cos(d)*p,t.position[1]+Math.sin(d)*p,t.position[2]+6+P(h.path)*8];this.fileOffsets.push(new v(...y).sub(this.fileOrigin)),l.position.fromArray(y),l.scale.setScalar(this.motion?0:1),l.updateMatrix(),n.setMatrixAt(c,l.matrix);const M=this.edgeCurve(t.position,y).getPoints(24);for(let g=1;g<M.length;g++)s.push(...M[g-1].toArray(),...M[g].toArray()),o.push(c*.018,c*.018)}),n.instanceMatrix.needsUpdate=!0,this.filesGroup.add(n),s.length){const h=new E;h.setAttribute("position",new I(s,3)),h.setAttribute("delay",new I(o,1));const c=new L({uniforms:this.fileUniforms,transparent:!0,depthWrite:!1,blending:H,vertexShader:`attribute float delay; uniform vec3 uOrigin; uniform float uTime; uniform float uBorn; uniform float uMotion; varying float vAlpha;
245
245
  void main() { float t = uMotion > .5 ? clamp((uTime-uBorn-delay)/.85,0.0,1.0) : 1.0; float p = 1.0-pow(1.0-t,3.0);
246
246
  vec3 offset = (position-uOrigin)*p; float a = uMotion > .5 ? sin(uTime*.22)*.035 : 0.0;
247
247
  offset.xy = mat2(cos(a),sin(a),-sin(a),cos(a))*offset.xy;
248
- vAlpha = smoothstep(0.0,.3,t)*.34; gl_Position = projectionMatrix*modelViewMatrix*vec4(uOrigin+offset,1.0); }`,fragmentShader:"varying float vAlpha; void main(){gl_FragColor=vec4(.78,.57,.32,vAlpha);}"});this.filesGroup.add(new we(h,c))}}focus(e){const t=this.nodeByID.get(e);if(!t)return;this.selected!==e&&this.select(e),this.focusedSession=e;const s=t.radius*this.preferences.nodeScale/100,o=Math.max(8,s*this.height/(2*Math.tan(Math.PI/8)*24)),i=oe(t,B(this.cutoff,this.graph))[0],r=new v(...G(t,i)),a=this.focusDirection(),n=new v(...ke(t,i));n.projectOnPlane(a),n.lengthSq()<1e-4&&n.set(1,0,0).applyQuaternion(this.camera.quaternion),n.normalize();const l=this.preferences.messageDots?Math.max(.06,o*2*Math.tan(Math.PI/8)/this.height*8):.02;r.addScaledVector(n,s+l),this.focusPoint(r,o)}focusPoint(e,t){this.frameFocus();const s=this.focusDirection();this.targetLook=e,this.targetPosition=e.clone().addScaledVector(s,t),this.dirty=!0}focusDirection(){const e=this.camera.position.clone().sub(this.controls.target);return e.lengthSq()>1e-6?e.normalize():this.camera.getWorldDirection(e).negate()}focusArea(){const e=(this.options.panels??[]).filter(t=>!t.hidden&&t.getClientRects().length&&getComputedStyle(t).visibility!=="hidden").map(t=>t.getBoundingClientRect());return gt(this.container.getBoundingClientRect(),e,this.options.focusTop??(this.width>=760?92:72))}frameFocus(){const e=this.container.clientWidth,t=this.container.clientHeight,{x:s,y:o}=this.focusArea(),i=e/2-s,r=t/2-o,a=this.camera.view;a?.enabled&&a.fullWidth===e&&a.fullHeight===t&&a.offsetX===i&&a.offsetY===r||(this.camera.setViewOffset(e,t,i,r,e,t),this.dirty=!0)}framePlayback(){this.camera.setViewOffset(this.width,this.height,0,Math.min(70,this.height*.08),this.width,this.height)}reset(){if(this.focusedSession=null,this.camera.clearViewOffset(),!this.graph.nodes.length)return;const e=new ne().setFromPoints(this.graph.nodes.flatMap(n=>[new v(...n.startPosition),new v(...n.position)]));this.preferences.labels&&this.labels.some(n=>n.month)&&(e.min.y=Math.min(e.min.y,q-12));const t=e.getSize(new v),s=e.getCenter(new v),o=2*Math.tan(k.degToRad(22.5)),i=(t.y+30)/o,r=(t.x+50)/(o*this.camera.aspect),a=Math.max(i,r,100)+t.z/2+20;this.targetLook=s,this.targetPosition=s.clone().add(new v(18,45,a))}setMotion(e){this.motion=e,e||this.particles.reset(),e&&this.playing&&!this.playbackPath&&this.buildPlaybackPath(),e&&this.playing&&this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target)),this.labelLayer.dataset.motion=String(e),this.revealsActive=this.graph.nodes.length>0,this.dirty=!0}setSuspended(e){this.suspended=e,this.previousFrame=performance.now(),this.dirty=!0}diagnostics(){return{camera:this.camera.position.toArray(),target:this.controls.target.toArray(),cameraZoom:this.camera.zoom,zoomRestricted:this.controls.minDistance>0||Number.isFinite(this.controls.maxDistance),cameraMoving:!!(this.targetPosition||this.targetLook),timeFrame:this.graph.timeFrame,timeRange:[this.graph.start,this.graph.end],cutoffX:this.clipPlane.constant,nodes:this.graph.nodes.length,edges:this.graph.edges.length,lanes:this.graph.lanes.map(e=>({key:e.key,label:e.label,kind:e.kind,color:e.color,sessions:e.nodes.length,sources:[...new Set(e.nodes.map(t=>t.session.source||"opencode"))]})),xRange:[Math.min(...this.graph.nodes.map(e=>e.position[0])),Math.max(...this.graph.nodes.map(e=>e.position[0]))],yRange:[Math.min(...this.graph.nodes.map(e=>e.position[1])),Math.max(...this.graph.nodes.map(e=>e.position[1]))],calls:this.renderer.info.render.calls,geometries:this.renderer.info.memory.geometries,msaaSamples:this.composer.renderTarget1.samples,smaa:this.smaa.enabled,pixelRatio:this.renderer.getPixelRatio(),bloomSize:[this.bloom.renderTargetBright.width,this.bloom.renderTargetBright.height],forkReveals:this.links?.samples()||[],cutoff:this.cutoff,selectedVisible:this.selectionGroup.visible,selectedNode:this.selected,selectedPosition:this.selected&&this.nodeByID.has(this.selected)?this.orbCenter(this.nodeByID.get(this.selected)):void 0,selectedEndpoint:this.selected&&this.nodeByID.has(this.selected)?(()=>{const e=this.nodeByID.get(this.selected);return G(e,oe(e,B(this.cutoff,this.graph))[0])})():void 0,selectedRadius:this.selected&&this.nodeByID.has(this.selected)?this.drawnRadius(this.nodeByID.get(this.selected)):void 0,headSamples:this.graph.nodes.slice(0,32).map((e,t)=>{const s=new se;this.nodeMesh?.getMatrixAt(t,s);const o=new v(...this.orbCenter(e));return o.project(this.camera),{id:e.session.id,start:e.startPosition[0],end:e.position[0],x:s.elements[12],glowX:this.glowPositions?.getX(t),reveal:this.nodeReveal[t],screen:[(o.x+1)/2*this.width,(1-o.y)/2*this.height]}}),focusDimming:this.focusUniforms.uFocus.value,nodeSegments:this.nodeMesh?.geometry.parameters.widthSegments,eventMarkers:this.eventMarkers.length,eventIcons:this.eventIcons.filter(e=>e.visible).length,focusArea:this.focusArea(),selectedScreen:this.selected&&this.nodeByID.has(this.selected)?(()=>{const e=new v(...this.orbCenter(this.nodeByID.get(this.selected)));return e.project(this.camera),[(e.x+1)/2*this.width,(1-e.y)/2*this.height]})():void 0,selectedEvent:this.selectedEvent,selectedEventPosition:this.eventMarkers.find(e=>e.item.id===this.selectedEvent)?.position.toArray(),markerSamples:this.eventMarkers.slice(-30).map(({item:e,position:t})=>{const s=t.clone();return s.project(this.camera),{id:e.id,kind:e.kind,time:e.time,position:t.toArray(),x:(s.x+1)/2*this.container.clientWidth,y:(1-s.y)/2*this.container.clientHeight}}),sessionTrails:this.graph.nodes.filter(e=>e.position[0]>e.startPosition[0]).length,renderedFrames:this.renderer.info.render.frame,revealingNodes:this.revealsActive,revealedNodes:this.nodeReveal.filter(e=>e>.95).length,fileSatellites:this.fileOffsets.length,fileRevealProgress:this.motion?Math.min(1,(this.time-this.fileBorn)/(.85+this.fileOffsets.length*.018)):1,motion:this.motion,suspended:this.suspended,particles:this.particles.diagnostics(),playbackFollowing:this.playing&&this.motion&&!!this.playbackPath,playbackOutro:this.playbackOutro,playbackOrbitAngle:this.playbackOrbit?this.playbackSphere.theta-this.playbackOrbit.theta:0,playbackFocus:this.playbackFocus.toArray(),preferences:{...this.preferences}}}setCutoff(e,t=!1){this.dirty=!0;const s=B(this.cutoff,this.graph);if(this.cutoff=k.clamp(e,0,1),this.particles.seek(s,B(this.cutoff,this.graph),this.playing&&this.motion,t&&this.motion),!this.nodeMesh)return;const o=B(this.cutoff,this.graph)+.001;this.cometUniforms.uHeadX.value=B(this.cutoff,this.graph),this.clipPlane.constant=o,this.lineUniforms.uCutoff.value=this.cutoff>=1?o+10:o,this.revealsActive=!0;const i=this.selected?this.nodeByID.get(this.selected):void 0;i&&i.position[0]<=o&&!this.filesGroup.visible&&(this.fileBorn=this.time,this.fileUniforms.uBorn.value=this.fileBorn),this.selectionGroup.visible=!i||i.startPosition[0]<=o,this.filesGroup.visible=!i||i.position[0]<=o;const r=this.selectionGroup.getObjectByName("selection-ring");r&&i&&(r.position.fromArray(this.orbCenter(i)),r.visible=i.startPosition[0]<=o),this.glowMaterial&&(this.glowMaterial.uniforms.uCutoff.value=o)}animateNodes(){if(!this.nodeMesh||!this.revealsActive)return;this.pickingDirty=!0;let e=!1;const t=[],s=B(this.cutoff,this.graph);for(let o=0;o<this.graph.nodes.length;o++){const i=this.graph.nodes[o],r=i.startPosition[0]<=s;r?Number.isFinite(this.nodeBorn[o])||(this.nodeBorn[o]=this.time,this.motion&&t.push(i)):this.nodeBorn[o]=NaN;const a=r?this.motion?k.smoothstep(this.time-this.nodeBorn[o],0,.45):1:0;r&&a<1&&(e=!0),this.nodeReveal[o]=a;const n=this.orbCenter(i);this.transform.position.fromArray(n),this.glowPositions?.setXYZ(o,...n),this.transform.scale.setScalar(this.drawnRadius(i)),this.transform.updateMatrix(),this.nodeMesh.setMatrixAt(o,this.transform.matrix)}this.nodeMesh.instanceMatrix.needsUpdate=!0,this.revealAttribute&&(this.revealAttribute.needsUpdate=!0),this.glowPositions&&(this.glowPositions.needsUpdate=!0),this.arrivals&&(this.arrivals.mesh.visible=this.motion&&e,this.arrivals.update()),this.links?.update(this.nodeReveal),this.comets?.update(this.nodeReveal),this.selectedComets?.update(this.nodeReveal),this.particles.births(t,this.time),this.revealsActive=e}animateFiles(){if(this.fileUniforms.uTime.value=this.time,this.fileUniforms.uMotion.value=Number(this.motion),!this.fileMesh)return;const e=this.motion?Math.sin(this.time*.22)*.035:0,t=Math.cos(e),s=Math.sin(e);this.fileOffsets.forEach((o,i)=>{const a=1-(1-(this.motion?k.clamp((this.time-this.fileBorn-i*.018)/.85,0,1):1))**3;this.transform.position.set((o.x*t-o.y*s)*a,(o.x*s+o.y*t)*a,o.z*a).add(this.fileOrigin),this.transform.scale.setScalar(a),this.transform.rotation.set(this.motion?this.time*.18+i:0,this.motion?this.time*.24+i:0,Math.PI/4),this.transform.updateMatrix(),this.fileMesh.setMatrixAt(i,this.transform.matrix)}),this.fileMesh.instanceMatrix.needsUpdate=!0,this.transform.rotation.set(0,0,0)}updatePicking(){if(!this.pickingDirty&&this.pickingView.equals(this.camera.matrixWorldInverse)&&this.pickingProjection.equals(this.camera.projectionMatrix))return;this.pickingView.copy(this.camera.matrixWorldInverse),this.pickingProjection.copy(this.camera.projectionMatrix),this.nodeGrid.clear(),this.markerGrid.clear();const e=new v,t=new v;this.graph.nodes.forEach((s,o)=>{if(!this.nodeMesh||(e.fromArray(this.nodeMesh.instanceMatrix.array,o*16+12).applyMatrix4(this.nodeMesh.matrixWorld),t.copy(e).applyMatrix4(this.camera.matrixWorldInverse),e.project(this.camera),e.z<-1||e.z>1))return;const i=this.drawnRadius(s),r=-t.z,a=Math.max(.001,r-i),n=this.width/2*Math.abs(this.camera.projectionMatrix.elements[0])*i*(1+Math.abs(t.x)/r)/a,l=this.height/2*Math.abs(this.camera.projectionMatrix.elements[5])*i*(1+Math.abs(t.y)/r)/a,h=(e.x+1)/2*this.width,c=(1-e.y)/2*this.height;this.nodeGrid.add({index:o,x:h,y:c},h,c,Math.max(12,n,l),this.width,this.height)}),this.eventMarkers.forEach(({position:s},o)=>{if(e.copy(s),e.project(this.camera),e.z<-1||e.z>1)return;const i=(e.x+1)/2*this.width,r=(1-e.y)/2*this.height;this.markerGrid.add({index:o,x:i,y:r},i,r,22,this.width,this.height)}),this.pickingDirty=!1}pick(e){if(!this.nodeMesh||!this.pickMesh)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;this.pointer.set(s/this.width*2-1,-o/this.height*2+1),this.raycaster.setFromCamera(this.pointer,this.camera);let i=null,r=1/0,a=null,n=e.pointerType==="touch"?12:6;for(const l of this.nodeGrid.at(s,o)){const h=this.graph.nodes[l.index];if(h.startPosition[0]>this.clipPlane.constant||this.nodeReveal[l.index]<.05)continue;this.nodeMesh.getMatrixAt(l.index,this.pickMatrix),this.pickMesh.matrixWorld.multiplyMatrices(this.nodeMesh.matrixWorld,this.pickMatrix),this.pickHits.length=0,this.pickMesh.raycast(this.raycaster,this.pickHits);for(const d of this.pickHits)d.distance<r&&(r=d.distance,i=h);const c=Math.hypot(l.x-s,l.y-o);c<n&&(a=h,n=c)}return i||a}pointerStart=e=>{this.pointerID=e.isPrimary&&e.button===0?e.pointerId:null,this.pointerDragged=!1,this.pointerDown.set(e.clientX,e.clientY),this.onHover(null,0,0)};pickEvent(e){if(!this.preferences.messageDots||!this.selectionGroup.visible)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;let i=1/0,r=-1,a=0;for(const n of this.markerGrid.at(s,o)){if(this.eventMarkers[n.index].position.x>this.lineUniforms.uCutoff.value)continue;const l=Math.hypot(n.x-s,n.y-o);l>(e.pointerType==="touch"?22:10)||(a++,l<i&&(i=l,r=n.index))}return r>=0?{index:r,item:this.eventMarkers[r].item,count:a}:null}pointerEnd=e=>{const t=e.button===0&&this.pointerID===e.pointerId&&!this.pointerDragged;if(this.pointerID=null,!t||this.pointerDown.distanceTo(new O(e.clientX,e.clientY))>5)return;const s=this.pickEvent(e);if(s){this.selectEvent(s.item.id),this.onEvent(s.item.id),this.focusEvent(s.item);return}const o=this.pick(e);this.onSelect(o?.session.id||null)};pointerMove=e=>{if(this.pointerID===e.pointerId&&this.pointerDown.distanceTo(new O(e.clientX,e.clientY))>5&&(this.pointerDragged=!0),e.buttons){this.particles.leave();return}const t=this.renderer.domElement.getBoundingClientRect();this.particles.pointer(e.clientX-t.left,e.clientY-t.top,this.width,this.height),this.motion&&this.preferences.stars&&(this.dirty=!0);const s=this.pickEvent(e);this.markerUniforms.uHovered.value!==(s?.index??-1)&&(this.markerUniforms.uHovered.value=s?.index??-1,this.dirty=!0);const o=s?null:this.pick(e),i=o?.session.id||null;i!==this.hovered&&(this.hovered=i,this.focusUniforms.uHovered.value=i?this.nodeIndices.get(i)??-1:-1,this.dirty=!0),this.renderer.domElement.style.cursor=o||s?"pointer":"grab";const r=this.container.getBoundingClientRect();s?this.onEventHover(s.item,s.count,e.clientX-r.left,e.clientY-r.top):this.onHover(o,e.clientX-r.left,e.clientY-r.top)};pointerLeave=()=>{this.particles.leave(),this.hovered=null,this.focusUniforms.uHovered.value=-1,this.markerUniforms.uHovered.value=-1,this.dirty=!0,this.onHover(null,0,0)};resize(){this.dirty=!0,this.pickingDirty=!0,this.revealsActive=!0;const e=this.container.clientWidth,t=this.container.clientHeight;if(!e||!t)return;this.width=e,this.height=t;const s=this.preferences.quality,o=this.options.manual||s==="performance"?1:s==="high"?Math.min(Math.max(devicePixelRatio,2),2.5):Math.min(Math.max(devicePixelRatio,1.5),2),r=Math.min(o,Math.sqrt((s==="high"?5e6:3e6)/(e*t)),this.renderer.capabilities.maxTextureSize/Math.max(e,t));this.renderer.getPixelRatio()!==r&&(this.renderer.setPixelRatio(r),this.composer.setPixelRatio(r)),this.camera.aspect=e/t,this.playing&&this.motion?this.framePlayback():this.camera.view?.enabled&&this.frameFocus(),this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.composer.setSize(e,t);const a=Math.min(r,s==="high"?1.5:1);this.bloom.setSize(Math.max(32,e*a),Math.max(32,t*a)),this.markerUniforms.uPixelRatio.value=this.renderer.getPixelRatio(),this.cometUniforms.uPixelScale.value=t*this.renderer.getPixelRatio()/(2*Math.tan(k.degToRad(this.camera.fov/2))),this.glowMaterial&&(this.glowMaterial.uniforms.uScale.value=t*this.renderer.getPixelRatio()*.9)}animate=()=>{this.frame=requestAnimationFrame(this.animate);const e=performance.now(),t=this.suspended?0:Math.min(.05,(e-this.previousFrame)/1e3);this.previousFrame=e,!(document.hidden||this.suspended&&!this.dirty)&&this.renderFrame(t)};renderFrame(e){this.time+=e;const s=this.animatePlaybackCamera(e)||!!this.targetPosition;if(this.targetPosition&&this.targetLook){const m=this.motion&&!this.suspended?1-Math.exp(-4.7*e):1;this.camera.position.lerp(this.targetPosition,m),this.controls.target.lerp(this.targetLook,m),this.camera.position.distanceTo(this.targetPosition)<.05&&(this.targetPosition=void 0,this.targetLook=void 0)}this.controls.update();const o=this.cameraDirty;(o||s)&&(this.cameraSettlesAt=this.time+.15);const i=!this.options.manual&&this.preferences.quality==="balanced"&&!this.playing&&this.time<this.cameraSettlesAt,r=this.preferences.quality!=="performance"&&!i;this.smaa.enabled!==r&&(this.smaa.enabled=r,this.dirty=!0);const a=this.preferences.quality!=="performance"&&this.preferences.bloom>0&&!i;this.bloom.enabled!==a&&(this.bloom.enabled=a,this.dirty=!0),!this.playing&&this.camera.view?.enabled&&(this.focusedSession||this.focusedEvent)&&this.frameFocus(),this.camera.updateMatrixWorld();const n=this.selected?this.nodeByID.get(this.selected):void 0,l=!this.playing&&this.preferences.focusDimming&&n&&n.startPosition[0]<=this.clipPlane.constant?1:0,h=Math.abs(this.focusUniforms.uFocus.value-l)>.001;this.focusUniforms.uFocus.value=h&&this.motion&&!this.suspended?k.damp(this.focusUniforms.uFocus.value,l,10,e):l,this.focusUniforms.uFamilyTime.value=this.preferences.relationships?this.motion?this.time-this.selectionBorn:1e6:-1e6;const c=this.motion&&(this.playing||this.preferences.trailFlow)&&this.preferences.trails!=="off";this.trailUniforms.uTrailTime.value=this.time,this.trailUniforms.uTrailFlow.value=Number(c);const d=this.hovered?this.nodeByID.get(this.hovered):void 0,p=this.particles.update(this.time,this.suspended?0:e,this.camera,this.nodeReveal,{motion:this.motion,suspended:this.suspended,playing:this.playing,pixelScale:this.cometUniforms.uPixelScale.value,pixelRatio:this.renderer.getPixelRatio(),width:this.width,height:this.height,selectedCenter:n&&this.selectionGroup.visible?this.orbCenter(n):void 0,hoverCenter:d?this.orbCenter(d):void 0});if(!this.dirty&&!o&&!s&&!h&&!this.revealsActive&&!c&&!p&&!(this.motion&&this.selected&&this.selectionGroup.visible))return;if((o||s)&&(this.revealsActive=!0),this.animateNodes(),this.selectedLinks?.update(this.nodeReveal,this.motion?this.time-this.selectionBorn:1/0),n){const m=this.orbCenter(n);this.fileOrigin.fromArray(m),this.fileUniforms.uOrigin.value.copy(this.fileOrigin);for(const R of this.labels)R.priority&&R.point.set(m[0],m[1]+6,m[2])}this.animateFiles(),this.lineUniforms.uReveal.value=this.motion?k.smoothstep(this.time-this.graphBorn,0,.9):1;const y=this.selectionGroup.getObjectByName("selection-ring");y&&(n&&y.position.fromArray(this.orbCenter(n)),y.quaternion.copy(this.camera.quaternion),y.scale.setScalar(this.preferences.nodeScale/100*(this.motion?1+Math.sin(this.time*2)*.07:1)));const M=this.width,g=this.height,b=[];for(const m of this.labels){const f=m.point.clone().project(this.camera),w=m.priority?Math.min(260,M-24):m.month?m.element.textContent.length>3?62:32:this.options.manual?235:155,S=(f.x*.5+.5)*M,A=m.priority?k.clamp(S-w/2,12,M-w-12):m.month?S-w/2:S,C=(-f.y*.5+.5)*g+(m.priority?-24:m.month?4:0),K=b.some(x=>A<x.x+x.width+8&&A+w+8>x.x&&Math.abs(C-x.y)<26),Q=m.priority&&n?n.startPosition[0]<=this.clipPlane.constant:m.point.x<=this.clipPlane.constant,_=(M>600||m.priority||m.month)&&!K&&(!m.month||A>=12)&&A+w<=M-12&&Q&&f.z<1&&f.z>-1&&Math.abs(f.x)<.95&&Math.abs(f.y)<.9;if(m.visible!==_&&(m.element.classList.toggle("visible",_),m.visible=_),_){m.x=A,m.y=C;const x=`translate(${A}px, ${C}px)${m.month?` translateX(${w/2}px) translateX(-50%)`:""}`;m.transform!==x&&(m.element.style.transform=x,m.transform=x),b.push({x:A,y:C,width:w})}}for(const m of this.eventIcons){const R=this.eventMarkers[m.marker],f=this.iconPoint.copy(R.position);f.project(this.camera);const w=(f.x+1)/2*M-6,S=(1-f.y)/2*g-25,A=this.preferences.messageDots&&this.selectionGroup.visible&&R.position.x<=this.clipPlane.constant&&f.z>-1&&f.z<1&&w>12&&w<M-24&&S>12&&S<g-30&&!b.some(C=>w<C.x+C.width+12&&w+24>C.x&&Math.abs(S-C.y)<24);if(A!==m.visible&&(m.element.classList.toggle("visible",A),m.visible=A),A){const C=`translate(${Math.round(w)}px, ${Math.round(S)}px)`;C!==m.transform&&(m.element.style.transform=C,m.transform=C),b.push({x:w,y:S,width:12})}}this.composer.render(),this.cameraDirty=!1,this.dirty=!1}prepareCapture(){this.setPlaying(!1),this.time=0,this.graphBorn=0,this.particles.reset(),this.bloom.strength=Math.min(this.bloom.strength,.08),this.bloom.radius=0,this.bloom.threshold=1.2,this.trailUniforms.uTrailOpacity.value=Math.min(this.trailUniforms.uTrailOpacity.value,.5),this.glowMaterial&&(this.glowMaterial.uniforms.uGlowSize.value=.7,this.glowMaterial.uniforms.uGlowIntensity.value=.45),this.reset(),this.targetPosition&&this.targetLook&&(this.camera.position.copy(this.targetPosition),this.controls.target.copy(this.targetLook)),this.targetPosition=void 0,this.targetLook=void 0,this.controls.enableDamping=!1,this.controls.update(),this.setCutoff(0),this.setPlaying(!0)}captureFrame(e,t,s,o=null){if(this.setCutoff(e),this.setPlaybackOutro(o),this.renderFrame(t),s.drawImage(this.renderer.domElement,0,0,this.width,this.height),!!this.preferences.labels){s.save(),s.font='11px "IBM Plex Mono", monospace',s.textBaseline="top";for(const i of this.labels)if(i.visible&&!i.priority){s.fillStyle=i.element.style.getPropertyValue("--label-color"),s.globalAlpha=.8;const r=i.element.textContent||"",a=(i.x||0)+(i.month?((r.length>3?62:32)-s.measureText(r).width)/2:8);s.fillText(r,a,(i.y||0)+5)}s.restore()}}dispose(){cancelAnimationFrame(this.frame),this.resizeObserver.disconnect(),this.controls.dispose(),this.particles.dispose(),this.scene.traverse(e=>{const t=e;e instanceof ae&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(s=>s.dispose())});for(const e of this.composer.passes)e.dispose();this.composer.dispose(),this.renderer.dispose(),this.renderer.domElement.removeEventListener("webglcontextlost",this.contextLost),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.labelLayer.remove()}}export{wt as TimelineScene};
248
+ vAlpha = smoothstep(0.0,.3,t)*.34; gl_Position = projectionMatrix*modelViewMatrix*vec4(uOrigin+offset,1.0); }`,fragmentShader:"varying float vAlpha; void main(){gl_FragColor=vec4(.78,.57,.32,vAlpha);}"});this.filesGroup.add(new we(h,c))}}focus(e){const t=this.nodeByID.get(e);if(!t)return;this.selected!==e&&this.select(e),this.focusedSession=e;const s=t.radius*this.preferences.nodeScale/100,o=Math.max(8,s*this.height/(2*Math.tan(Math.PI/8)*24)),i=oe(t,B(this.cutoff,this.graph))[0],r=new v(...G(t,i)),a=this.focusDirection(),n=new v(...ke(t,i));n.projectOnPlane(a),n.lengthSq()<1e-4&&n.set(1,0,0).applyQuaternion(this.camera.quaternion),n.normalize();const l=this.preferences.messageDots?Math.max(.06,o*2*Math.tan(Math.PI/8)/this.height*8):.02;r.addScaledVector(n,s+l),this.focusPoint(r,o)}focusPoint(e,t){this.frameFocus();const s=this.focusDirection();this.targetLook=e,this.targetPosition=e.clone().addScaledVector(s,t),this.dirty=!0}focusDirection(){const e=this.camera.position.clone().sub(this.controls.target);return e.lengthSq()>1e-6?e.normalize():this.camera.getWorldDirection(e).negate()}focusArea(){const e=(this.options.panels??[]).filter(t=>!t.hidden&&t.getClientRects().length&&getComputedStyle(t).visibility!=="hidden").map(t=>t.getBoundingClientRect());return gt(this.container.getBoundingClientRect(),e,this.options.focusTop??(this.width>=760?92:72))}frameFocus(){const e=this.container.clientWidth,t=this.container.clientHeight,{x:s,y:o}=this.focusArea(),i=e/2-s,r=t/2-o,a=this.camera.view;a?.enabled&&a.fullWidth===e&&a.fullHeight===t&&a.offsetX===i&&a.offsetY===r||(this.camera.setViewOffset(e,t,i,r,e,t),this.dirty=!0)}framePlayback(){this.camera.setViewOffset(this.width,this.height,0,Math.min(70,this.height*.08),this.width,this.height)}reset(){if(this.focusedSession=null,this.camera.clearViewOffset(),!this.graph.nodes.length)return;const e=new ne().setFromPoints(this.graph.nodes.flatMap(n=>[new v(...n.startPosition),new v(...n.position)]));this.preferences.labels&&this.labels.some(n=>n.month)&&(e.min.y=Math.min(e.min.y,q-12));const t=e.getSize(new v),s=e.getCenter(new v),o=2*Math.tan(k.degToRad(22.5)),i=(t.y+30)/o,r=(t.x+50)/(o*this.camera.aspect),a=Math.max(i,r,100)+t.z/2+20;this.targetLook=s,this.targetPosition=s.clone().add(new v(18,45,a))}setMotion(e){this.motion=e,e||this.particles.reset(),e&&this.playing&&!this.playbackPath&&this.buildPlaybackPath(),e&&this.playing&&this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target)),this.labelLayer.dataset.motion=String(e),this.revealsActive=this.graph.nodes.length>0,this.dirty=!0}setSuspended(e){this.suspended=e,this.previousFrame=performance.now(),this.dirty=!0}diagnostics(){return{camera:this.camera.position.toArray(),target:this.controls.target.toArray(),cameraZoom:this.camera.zoom,zoomRestricted:this.controls.minDistance>0||Number.isFinite(this.controls.maxDistance),cameraMoving:!!(this.targetPosition||this.targetLook),timeFrame:this.graph.timeFrame,timeRange:[this.graph.start,this.graph.end],cutoffX:this.clipPlane.constant,nodes:this.graph.nodes.length,edges:this.graph.edges.length,lanes:this.graph.lanes.map(e=>({key:e.key,label:e.label,kind:e.kind,color:e.color,sessions:e.nodes.length,sources:[...new Set(e.nodes.map(t=>t.session.source||"opencode"))]})),xRange:[Math.min(...this.graph.nodes.map(e=>e.position[0])),Math.max(...this.graph.nodes.map(e=>e.position[0]))],yRange:[Math.min(...this.graph.nodes.map(e=>e.position[1])),Math.max(...this.graph.nodes.map(e=>e.position[1]))],calls:this.renderer.info.render.calls,geometries:this.renderer.info.memory.geometries,msaaSamples:this.composer.renderTarget1.samples,smaa:this.smaa.enabled,pixelRatio:this.renderer.getPixelRatio(),bloomSize:[this.bloom.renderTargetBright.width,this.bloom.renderTargetBright.height],forkReveals:this.links?.samples()||[],cutoff:this.cutoff,selectedVisible:this.selectionGroup.visible,selectedNode:this.selected,selectedPosition:this.selected&&this.nodeByID.has(this.selected)?this.orbCenter(this.nodeByID.get(this.selected)):void 0,selectedEndpoint:this.selected&&this.nodeByID.has(this.selected)?(()=>{const e=this.nodeByID.get(this.selected);return G(e,oe(e,B(this.cutoff,this.graph))[0])})():void 0,selectedRadius:this.selected&&this.nodeByID.has(this.selected)?this.drawnRadius(this.nodeByID.get(this.selected)):void 0,headSamples:this.graph.nodes.slice(0,32).map((e,t)=>{const s=new se;this.nodeMesh?.getMatrixAt(t,s);const o=new v(...this.orbCenter(e));return o.project(this.camera),{id:e.session.id,start:e.startPosition[0],end:e.position[0],x:s.elements[12],glowX:this.glowPositions?.getX(t),reveal:this.nodeReveal[t],screen:[(o.x+1)/2*this.width,(1-o.y)/2*this.height]}}),focusDimming:this.focusUniforms.uFocus.value,nodeSegments:this.nodeMesh?.geometry.parameters.widthSegments,eventMarkers:this.eventMarkers.length,eventIcons:this.eventIcons.filter(e=>e.visible).length,focusArea:this.focusArea(),selectedScreen:this.selected&&this.nodeByID.has(this.selected)?(()=>{const e=new v(...this.orbCenter(this.nodeByID.get(this.selected)));return e.project(this.camera),[(e.x+1)/2*this.width,(1-e.y)/2*this.height]})():void 0,selectedEvent:this.selectedEvent,selectedEventPosition:this.eventMarkers.find(e=>e.item.id===this.selectedEvent)?.position.toArray(),markerSamples:this.eventMarkers.slice(-30).map(({item:e,position:t})=>{const s=t.clone();return s.project(this.camera),{id:e.id,kind:e.kind,time:e.time,position:t.toArray(),x:(s.x+1)/2*this.container.clientWidth,y:(1-s.y)/2*this.container.clientHeight}}),sessionTrails:this.graph.nodes.filter(e=>e.position[0]>e.startPosition[0]).length,renderedFrames:this.renderer.info.render.frame,revealingNodes:this.revealsActive,revealedNodes:this.nodeReveal.filter(e=>e>.95).length,fileSatellites:this.fileOffsets.length,fileRevealProgress:this.motion?Math.min(1,(this.time-this.fileBorn)/(.85+this.fileOffsets.length*.018)):1,motion:this.motion,suspended:this.suspended,particles:this.particles.diagnostics(),playbackFollowing:this.playing&&this.motion&&!!this.playbackPath,playbackOutro:this.playbackOutro,playbackOrbitAngle:this.playbackOrbit?this.playbackSphere.theta-this.playbackOrbit.theta:0,playbackFocus:this.playbackFocus.toArray(),preferences:{...this.preferences}}}setCutoff(e,t=!1){this.dirty=!0;const s=B(this.cutoff,this.graph);if(this.cutoff=k.clamp(e,0,1),this.particles.seek(s,B(this.cutoff,this.graph),this.playing&&this.motion,t&&this.motion),!this.nodeMesh)return;const o=B(this.cutoff,this.graph)+.001;this.cometUniforms.uHeadX.value=B(this.cutoff,this.graph),this.clipPlane.constant=o,this.lineUniforms.uCutoff.value=this.cutoff>=1?o+10:o,this.revealsActive=!0;const i=this.selected?this.nodeByID.get(this.selected):void 0;i&&i.position[0]<=o&&!this.filesGroup.visible&&(this.fileBorn=this.time,this.fileUniforms.uBorn.value=this.fileBorn),this.selectionGroup.visible=!i||i.startPosition[0]<=o,this.filesGroup.visible=!i||i.position[0]<=o;const r=this.selectionGroup.getObjectByName("selection-ring");r&&i&&(r.position.fromArray(this.orbCenter(i)),r.visible=i.startPosition[0]<=o),this.glowMaterial&&(this.glowMaterial.uniforms.uCutoff.value=o)}animateNodes(){if(!this.nodeMesh||!this.revealsActive)return;this.pickingDirty=!0;let e=!1;const t=[],s=B(this.cutoff,this.graph);for(let o=0;o<this.graph.nodes.length;o++){const i=this.graph.nodes[o],r=i.startPosition[0]<=s;r?Number.isFinite(this.nodeBorn[o])||(this.nodeBorn[o]=this.time,this.motion&&t.push(i)):this.nodeBorn[o]=NaN;const a=r?this.motion?k.smoothstep(this.time-this.nodeBorn[o],0,.45):1:0;r&&a<1&&(e=!0),this.nodeReveal[o]=a;const n=this.orbCenter(i);this.transform.position.fromArray(n),this.glowPositions?.setXYZ(o,...n),this.transform.scale.setScalar(this.drawnRadius(i)),this.transform.updateMatrix(),this.nodeMesh.setMatrixAt(o,this.transform.matrix)}this.nodeMesh.instanceMatrix.needsUpdate=!0,this.revealAttribute&&(this.revealAttribute.needsUpdate=!0),this.glowPositions&&(this.glowPositions.needsUpdate=!0),this.arrivals&&(this.arrivals.mesh.visible=this.motion&&e,this.arrivals.update()),this.links?.update(this.nodeReveal),this.comets?.update(this.nodeReveal),this.selectedComets?.update(this.nodeReveal),this.particles.births(t,this.time),this.revealsActive=e}animateFiles(){if(this.fileUniforms.uTime.value=this.time,this.fileUniforms.uMotion.value=Number(this.motion),!this.fileMesh)return;const e=this.motion?Math.sin(this.time*.22)*.035:0,t=Math.cos(e),s=Math.sin(e);this.fileOffsets.forEach((o,i)=>{const a=1-(1-(this.motion?k.clamp((this.time-this.fileBorn-i*.018)/.85,0,1):1))**3;this.transform.position.set((o.x*t-o.y*s)*a,(o.x*s+o.y*t)*a,o.z*a).add(this.fileOrigin),this.transform.scale.setScalar(a),this.transform.rotation.set(this.motion?this.time*.18+i:0,this.motion?this.time*.24+i:0,Math.PI/4),this.transform.updateMatrix(),this.fileMesh.setMatrixAt(i,this.transform.matrix)}),this.fileMesh.instanceMatrix.needsUpdate=!0,this.transform.rotation.set(0,0,0)}updatePicking(){if(!this.pickingDirty&&this.pickingView.equals(this.camera.matrixWorldInverse)&&this.pickingProjection.equals(this.camera.projectionMatrix))return;this.pickingView.copy(this.camera.matrixWorldInverse),this.pickingProjection.copy(this.camera.projectionMatrix),this.nodeGrid.clear(),this.markerGrid.clear();const e=new v,t=new v;this.graph.nodes.forEach((s,o)=>{if(!this.nodeMesh||(e.fromArray(this.nodeMesh.instanceMatrix.array,o*16+12).applyMatrix4(this.nodeMesh.matrixWorld),t.copy(e).applyMatrix4(this.camera.matrixWorldInverse),e.project(this.camera),e.z<-1||e.z>1))return;const i=this.drawnRadius(s),r=-t.z,a=Math.max(.001,r-i),n=this.width/2*Math.abs(this.camera.projectionMatrix.elements[0])*i*(1+Math.abs(t.x)/r)/a,l=this.height/2*Math.abs(this.camera.projectionMatrix.elements[5])*i*(1+Math.abs(t.y)/r)/a,h=(e.x+1)/2*this.width,c=(1-e.y)/2*this.height;this.nodeGrid.add({index:o,x:h,y:c},h,c,Math.max(12,n,l),this.width,this.height)}),this.eventMarkers.forEach(({position:s},o)=>{if(e.copy(s),e.project(this.camera),e.z<-1||e.z>1)return;const i=(e.x+1)/2*this.width,r=(1-e.y)/2*this.height;this.markerGrid.add({index:o,x:i,y:r},i,r,22,this.width,this.height)}),this.pickingDirty=!1}pick(e){if(!this.nodeMesh||!this.pickMesh)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;this.pointer.set(s/this.width*2-1,-o/this.height*2+1),this.raycaster.setFromCamera(this.pointer,this.camera);let i=null,r=1/0,a=null,n=e.pointerType==="touch"?12:6;for(const l of this.nodeGrid.at(s,o)){const h=this.graph.nodes[l.index];if(h.startPosition[0]>this.clipPlane.constant||this.nodeReveal[l.index]<.05)continue;this.nodeMesh.getMatrixAt(l.index,this.pickMatrix),this.pickMesh.matrixWorld.multiplyMatrices(this.nodeMesh.matrixWorld,this.pickMatrix),this.pickHits.length=0,this.pickMesh.raycast(this.raycaster,this.pickHits);for(const d of this.pickHits)d.distance<r&&(r=d.distance,i=h);const c=Math.hypot(l.x-s,l.y-o);c<n&&(a=h,n=c)}return i||a}pointerStart=e=>{this.pointerID=e.isPrimary&&e.button===0?e.pointerId:null,this.pointerDragged=!1,this.pointerDown.set(e.clientX,e.clientY),this.onHover(null,0,0)};pickEvent(e){if(!this.preferences.messageDots||!this.selectionGroup.visible)return null;this.updatePicking();const t=this.renderer.domElement.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;let i=1/0,r=-1,a=0;for(const n of this.markerGrid.at(s,o)){if(this.eventMarkers[n.index].position.x>this.lineUniforms.uCutoff.value)continue;const l=Math.hypot(n.x-s,n.y-o);l>(e.pointerType==="touch"?22:10)||(a++,l<i&&(i=l,r=n.index))}return r>=0?{index:r,item:this.eventMarkers[r].item,count:a}:null}pointerEnd=e=>{const t=e.button===0&&this.pointerID===e.pointerId&&!this.pointerDragged;if(this.pointerID=null,!t||this.pointerDown.distanceTo(new O(e.clientX,e.clientY))>5)return;const s=this.pickEvent(e);if(s){this.selectEvent(s.item.id),this.onEvent(s.item.id),this.focusEvent(s.item);return}const o=this.pick(e);this.onSelect(o?.session.id||null)};pointerMove=e=>{if(this.pointerID===e.pointerId&&this.pointerDown.distanceTo(new O(e.clientX,e.clientY))>5&&(this.pointerDragged=!0),e.buttons){this.particles.leave();return}const t=this.renderer.domElement.getBoundingClientRect();this.particles.pointer(e.clientX-t.left,e.clientY-t.top,this.width,this.height),this.motion&&this.preferences.stars&&(this.dirty=!0);const s=this.pickEvent(e);this.markerUniforms.uHovered.value!==(s?.index??-1)&&(this.markerUniforms.uHovered.value=s?.index??-1,this.dirty=!0);const o=s?null:this.pick(e),i=o?.session.id||null;i!==this.hovered&&(this.hovered=i,this.focusUniforms.uHovered.value=i?this.nodeIndices.get(i)??-1:-1,this.dirty=!0),this.renderer.domElement.style.cursor=o||s?"pointer":"grab";const r=this.container.getBoundingClientRect();s?this.onEventHover(s.item,s.count,e.clientX-r.left,e.clientY-r.top):this.onHover(o,e.clientX-r.left,e.clientY-r.top)};pointerLeave=()=>{this.particles.leave(),this.hovered=null,this.focusUniforms.uHovered.value=-1,this.markerUniforms.uHovered.value=-1,this.dirty=!0,this.onHover(null,0,0)};resize(){this.dirty=!0,this.pickingDirty=!0,this.revealsActive=!0;const e=this.container.clientWidth,t=this.container.clientHeight;if(!e||!t)return;this.width=e,this.height=t;const s=this.preferences.quality,o=this.options.manual||s==="performance"?1:s==="high"?Math.min(Math.max(devicePixelRatio,2),2.5):Math.min(Math.max(devicePixelRatio,1.5),2),r=Math.min(o,Math.sqrt((s==="high"?5e6:3e6)/(e*t)),this.renderer.capabilities.maxTextureSize/Math.max(e,t));this.renderer.getPixelRatio()!==r&&(this.renderer.setPixelRatio(r),this.composer.setPixelRatio(r)),this.camera.aspect=e/t,this.playing&&this.motion?this.framePlayback():this.camera.view?.enabled&&this.frameFocus(),this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.composer.setSize(e,t);const a=Math.min(r,s==="high"?1.5:1);this.bloom.setSize(Math.max(32,e*a),Math.max(32,t*a)),this.markerUniforms.uPixelRatio.value=this.renderer.getPixelRatio(),this.cometUniforms.uPixelScale.value=t*this.renderer.getPixelRatio()/(2*Math.tan(k.degToRad(this.camera.fov/2))),this.glowMaterial&&(this.glowMaterial.uniforms.uScale.value=t*this.renderer.getPixelRatio()*.9)}animate=()=>{this.frame=requestAnimationFrame(this.animate);const e=performance.now(),t=this.suspended?0:Math.min(.05,(e-this.previousFrame)/1e3);this.previousFrame=e,!(document.hidden||this.suspended&&!this.dirty)&&this.renderFrame(t)};renderFrame(e){this.time+=e;const s=this.animatePlaybackCamera(e)||!!this.targetPosition;if(this.targetPosition&&this.targetLook){const m=this.motion&&!this.suspended?1-Math.exp(-4.7*e):1;this.camera.position.lerp(this.targetPosition,m),this.controls.target.lerp(this.targetLook,m),this.camera.position.distanceTo(this.targetPosition)<.05&&(this.targetPosition=void 0,this.targetLook=void 0)}this.controls.update();const o=this.cameraDirty;(o||s)&&(this.cameraSettlesAt=this.time+.15);const i=!this.options.manual&&this.preferences.quality==="balanced"&&!this.playing&&this.time<this.cameraSettlesAt,r=this.preferences.quality!=="performance"&&!i;this.smaa.enabled!==r&&(this.smaa.enabled=r,this.dirty=!0);const a=this.preferences.quality!=="performance"&&this.preferences.bloom>0&&!i;this.bloom.enabled!==a&&(this.bloom.enabled=a,this.dirty=!0),!this.playing&&this.camera.view?.enabled&&(this.focusedSession||this.focusedEvent)&&this.frameFocus(),this.camera.updateMatrixWorld();const n=this.selected?this.nodeByID.get(this.selected):void 0,l=!this.playing&&this.preferences.focusDimming&&n&&n.startPosition[0]<=this.clipPlane.constant?1:0,h=Math.abs(this.focusUniforms.uFocus.value-l)>.001;this.focusUniforms.uFocus.value=h&&this.motion&&!this.suspended?k.damp(this.focusUniforms.uFocus.value,l,10,e):l,this.focusUniforms.uFamilyTime.value=this.preferences.relationships?this.motion?this.time-this.selectionBorn:1e6:-1e6;const c=this.motion&&(this.playing||this.preferences.trailFlow)&&this.preferences.trails!=="off";this.trailUniforms.uTrailTime.value=this.time,this.trailUniforms.uTrailFlow.value=Number(c);const d=this.hovered?this.nodeByID.get(this.hovered):void 0,p=this.particles.update(this.time,this.suspended?0:e,this.camera,this.nodeReveal,{motion:this.motion,suspended:this.suspended,playing:this.playing,pixelScale:this.cometUniforms.uPixelScale.value,pixelRatio:this.renderer.getPixelRatio(),width:this.width,height:this.height,selectedCenter:n&&this.selectionGroup.visible?this.orbCenter(n):void 0,hoverCenter:d?this.orbCenter(d):void 0});if(!this.dirty&&!o&&!s&&!h&&!this.revealsActive&&!c&&!p&&!(this.motion&&this.selected&&this.selectionGroup.visible))return;if((o||s)&&(this.revealsActive=!0),this.animateNodes(),this.selectedLinks?.update(this.nodeReveal,this.motion?this.time-this.selectionBorn:1/0),n){const m=this.orbCenter(n);this.fileOrigin.fromArray(m),this.fileUniforms.uOrigin.value.copy(this.fileOrigin);for(const R of this.labels)R.priority&&R.point.set(m[0],m[1]+6,m[2])}this.animateFiles(),this.lineUniforms.uReveal.value=this.motion?k.smoothstep(this.time-this.graphBorn,0,.9):1;const y=this.selectionGroup.getObjectByName("selection-ring");y&&(n&&y.position.fromArray(this.orbCenter(n)),y.quaternion.copy(this.camera.quaternion),y.scale.setScalar(this.preferences.nodeScale/100*(this.motion?1+Math.sin(this.time*2)*.07:1)));const M=this.width,g=this.height,b=[];for(const m of this.labels){const f=m.point.clone().project(this.camera),w=m.priority?Math.min(260,M-24):m.month?m.element.textContent.length>3?62:32:this.options.manual?235:155,S=(f.x*.5+.5)*M,A=m.priority?k.clamp(S-w/2,12,M-w-12):m.month?S-w/2:S,C=(-f.y*.5+.5)*g+(m.priority?-24:m.month?4:0),Q=b.some(x=>A<x.x+x.width+8&&A+w+8>x.x&&Math.abs(C-x.y)<26),K=m.priority&&n?n.startPosition[0]<=this.clipPlane.constant:m.point.x<=this.clipPlane.constant,_=(M>600||m.priority||m.month)&&!Q&&(!m.month||A>=12)&&A+w<=M-12&&K&&f.z<1&&f.z>-1&&Math.abs(f.x)<.95&&Math.abs(f.y)<.9;if(m.visible!==_&&(m.element.classList.toggle("visible",_),m.visible=_),_){m.x=A,m.y=C;const x=`translate(${A}px, ${C}px)${m.month?` translateX(${w/2}px) translateX(-50%)`:""}`;m.transform!==x&&(m.element.style.transform=x,m.transform=x),b.push({x:A,y:C,width:w})}}for(const m of this.eventIcons){const R=this.eventMarkers[m.marker],f=this.iconPoint.copy(R.position);f.project(this.camera);const w=(f.x+1)/2*M-6,S=(1-f.y)/2*g-25,A=this.preferences.messageDots&&this.selectionGroup.visible&&R.position.x<=this.clipPlane.constant&&f.z>-1&&f.z<1&&w>12&&w<M-24&&S>12&&S<g-30&&!b.some(C=>w<C.x+C.width+12&&w+24>C.x&&Math.abs(S-C.y)<24);if(A!==m.visible&&(m.element.classList.toggle("visible",A),m.visible=A),A){const C=`translate(${Math.round(w)}px, ${Math.round(S)}px)`;C!==m.transform&&(m.element.style.transform=C,m.transform=C),b.push({x:w,y:S,width:12})}}this.composer.render(),this.cameraDirty=!1,this.dirty=!1}prepareCapture(){this.setPlaying(!1),this.time=0,this.graphBorn=0,this.particles.reset(),this.bloom.strength=Math.min(this.bloom.strength,.08),this.bloom.radius=0,this.bloom.threshold=1.2,this.trailUniforms.uTrailOpacity.value=Math.min(this.trailUniforms.uTrailOpacity.value,.5),this.glowMaterial&&(this.glowMaterial.uniforms.uGlowSize.value=.7,this.glowMaterial.uniforms.uGlowIntensity.value=.45),this.reset(),this.targetPosition&&this.targetLook&&(this.camera.position.copy(this.targetPosition),this.controls.target.copy(this.targetLook)),this.targetPosition=void 0,this.targetLook=void 0,this.controls.enableDamping=!1,this.controls.update(),this.setCutoff(0),this.setPlaying(!0)}captureFrame(e,t,s,o=null){if(this.setCutoff(e),this.setPlaybackOutro(o),this.renderFrame(t),s.drawImage(this.renderer.domElement,0,0,this.width,this.height),!!this.preferences.labels){s.save(),s.font='11px "IBM Plex Mono", monospace',s.textBaseline="top";for(const i of this.labels)if(i.visible&&!i.priority){s.fillStyle=i.element.style.getPropertyValue("--label-color"),s.globalAlpha=.8;const r=i.element.textContent||"",a=(i.x||0)+(i.month?((r.length>3?62:32)-s.measureText(r).width)/2:8);s.fillText(r,a,(i.y||0)+5)}s.restore()}}dispose(){cancelAnimationFrame(this.frame),this.resizeObserver.disconnect(),this.controls.dispose(),this.particles.dispose(),this.scene.traverse(e=>{const t=e;e instanceof ae&&e.dispose(),t.geometry?.dispose(),t.material&&(Array.isArray(t.material)?t.material:[t.material]).forEach(s=>s.dispose())});for(const e of this.composer.passes)e.dispose();this.composer.dispose(),this.renderer.dispose(),this.renderer.domElement.removeEventListener("webglcontextlost",this.contextLost),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.labelLayer.remove()}}export{wt as TimelineScene};
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ClDHxy66.js","assets/index-DK0pBf-7.js","assets/index-BROemBuT.css","assets/index-DWWZZL6C.js"])))=>i.map(i=>d[i]);
2
- import{p as z,i as j,_ as H,s as K,a as V,o as J,b as Q,c as Y,t as Z,d as ee,S as L,e as te,f as ae,g as se,h as oe}from"./index-DK0pBf-7.js";import{TimelineScene as re}from"./scene-BCuZ73oU.js";import"./three-DDiuFd7k.js";const ne="#b0e9d6",ie="#dbe7e3",O=128,le=10,de="M102 24 86 40H36a14 14 0 0 0 0 28h40a14 14 0 0 1 0 28H22",ce=[[102,24],[36,40],[22,96]],ue=10;let U;function he(e,l,a,n,i=ne){U??=new Path2D(de),e.save(),e.translate(l,a),e.scale(n/O,n/O),e.strokeStyle=e.fillStyle=i,e.lineWidth=le,e.lineCap=e.lineJoin="round",e.stroke(U);for(const[y,h]of ce)e.beginPath(),e.arc(y,h,ue,0,Math.PI*2),e.fill();e.restore()}function pe(e){const l=z(e.lanes.length),a=new Map(e.lanes.flatMap(s=>s.nodes.map(t=>[t.session.id,s.key]))),n=new Map;for(const s of e.nodes.map(t=>t.session).sort((t,r)=>t.created-r.created||t.id.localeCompare(r.id))){const t=a.get(s.id);t!==void 0&&!n.has(t)&&n.set(t,n.size)}const i=new Map(e.nodes.map((s,t)=>[s.session.id,`session-${t}`])),y=new Map(e.lanes.flatMap((s,t)=>s.nodes.map(r=>[r.session.id,`project-${t}`]))),h=e.nodes.map(s=>{const t=s.session,r={id:i.get(t.id),title:"Session",projectID:y.get(t.id),directory:"",created:t.created,updated:t.created,activity:t.activity&&{firstMessageAt:t.activity.firstMessageAt,lastMessageAt:t.activity.lastMessageAt,userMessages:t.activity.userMessages,untimedUserMessages:t.activity.untimedUserMessages},archived:!1,model:"",provider:"",agent:"",cost:null,source:t.source==="continue"?"continue":t.source==="opencode"||!t.source?"opencode":"unknown",tokens:t.tokens};return t.parentID&&i.has(t.parentID)&&(r.parentID=i.get(t.parentID)),t.forkID&&i.has(t.forkID)&&(r.forkID=i.get(t.forkID)),{session:r,position:[...s.position],startPosition:[...s.startPosition],color:s.color,radius:s.radius}}),d=new Map(h.map(s=>[s.session.id,s]));return{start:e.start,end:e.end,timeFrame:e.timeFrame&&{...e.timeFrame},nodes:h,edges:e.edges.map(s=>({from:i.get(s.from),to:i.get(s.to),kind:s.kind})),lanes:e.lanes.map((s,t)=>({key:`project-${t}`,label:l[n.get(s.key)],color:s.color,kind:"directory",y:s.y,z:s.z,nodes:s.nodes.map(r=>d.get(i.get(r.session.id)))}))}}const $={mp4:{label:"MP4",description:"MP4 video",mime:"video/mp4",filename:"sessiongraph-playback.mp4"}},T=`My coding sessions, visualized with SessionGraph.
3
- https://sessiongraph.ai`,ye=`https://x.com/intent/tweet?text=${encodeURIComponent(T)}`,G=e=>e instanceof Error&&e.name==="AbortError";async function me(e,l,a){const{label:n,description:i,mime:y,filename:h}=$[a];try{if(j()){const[{save:d},{writeFile:s}]=await Promise.all([H(()=>import("./index-ClDHxy66.js"),__vite__mapDeps([0,1,2])),H(()=>import("./index-DWWZZL6C.js"),__vite__mapDeps([3,1,2]))]),t=await d({title:`Save SessionGraph ${n}`,defaultPath:h,filters:[{name:i,extensions:[a]}]});if(!t)return"cancelled";await s(t,new Uint8Array(await e.arrayBuffer()))}else{const d=window.showSaveFilePicker;if(d){const t=await(await d.call(window,{suggestedName:h,types:[{description:i,accept:{[y]:[`.${a}`]}}]})).createWritable();try{await t.write(e),await t.close()}catch(r){throw await t.abort().catch(()=>{}),r}}else{const s=document.createElement("a");return s.href=l,s.download=h,document.body.append(s),s.click(),s.remove(),"downloaded"}}return"saved"}catch(d){if(G(d))return"cancelled";throw d}}const g=960,P=600,q='"Katagami Sans", sans-serif',fe=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e);function ve(e,l,a,n,i,y){const s=P-122,t=Math.max(1,...n);e.save(),he(e,24,14,28),e.fillStyle=ie,e.font=`600 14px ${q}`,e.textAlign="left",e.textBaseline="middle",e.fillText("SessionGraph",58,28),e.restore();for(let u=0;u<n.length;u++){const m=Math.max(2,n[u]/t*22);e.fillStyle=u/n.length<=a?"#91bfae":"#253d39",e.fillRect(260+u/n.length*440,s-m,440/n.length-2,m)}e.fillStyle="#d6f4e8",e.fillRect(260+440*a,s-27,1,31);const r=l.start+(l.end-l.start)*a,k=i.at(r,a===1).tokens;e.textAlign="center",e.fillStyle="#a0baae",e.font='12px "IBM Plex Mono", monospace',e.fillText(oe(r,l.end-l.start),g/2,s+23),e.fillStyle="#e7f5ee",e.font=`36px ${q}`,e.fillText(y(r,a===1).toLocaleString("en"),g/2-105,s+66),e.fillText(i.recorded?fe(k):"—",g/2+105,s+66),e.font=`12px ${q}`,e.fillStyle="#92b0a3",e.fillText("Sessions",g/2-105,s+87),e.fillText("Burnt tokens",g/2+105,s+87),e.textAlign="left"}async function be(e,l,a,n){a.throwIfAborted();const{label:i,mime:y}=$.mp4,h=Q(e.nodes.map(p=>p.session)),d=Y(e.nodes.map(p=>p.session)),s=Z(e.nodes.map(p=>ee(p.session)),e.start,e.end),t=document.createElement("div");t.className="share-render-host",t.setAttribute("aria-hidden","true"),t.style.cssText=`position:fixed;left:-12000px;top:0;width:${g}px;height:${P}px;pointer-events:none;visibility:hidden`,document.body.append(t);const r=document.createElement("canvas");r.width=g,r.height=P;const k=r.getContext("2d",{willReadFrequently:!0});let u,m;try{if(!k)throw new Error("Canvas export is unavailable.");u=new re(t,{onSelect(){},onHover(){},onPlaybackInterrupt(){},onEvent(){},onEventHover(){}},{manual:!0}),u.applyPreferences({...l,quality:"balanced",motion:"on",labels:!0,focusDimming:!1,trails:l.trails==="selected"?"all":l.trails}),u.setGraph(e,!0),u.prepareCapture(),await document.fonts.ready,a.throwIfAborted(),m=new Worker(new URL("/assets/mp4-worker-Dc_1QUwS.js",import.meta.url),{type:"module"});const p=(v,A=[])=>new Promise((b,w)=>{a.throwIfAborted();const f=()=>{clearTimeout(M),a.removeEventListener("abort",C),m.onmessage=null,m.onerror=null},C=()=>{f(),w(a.reason)},M=setTimeout(()=>{f(),w(new Error(`${i} encoding timed out. Please try again.`))},6e4);a.addEventListener("abort",C,{once:!0}),m.onmessage=E=>{f(),E.data.error?w(new Error(E.data.error)):b(E.data)},m.onerror=()=>{f(),w(new Error(`Could not start the ${i} encoder.`))},m.postMessage(v,A)});await p({init:!0,width:g,height:P});for(let v=0;v<L;v++){a.throwIfAborted();const A=te(v);u.captureFrame(A,1/ae,k,se(v)),ve(k,e,A,s,h,d);const b=k.getImageData(0,0,g,P).data.buffer;await p({rgba:b,width:g,height:P},[b]),n((v+1)/L)}const I=await p({finish:!0});return new Blob([I.bytes],{type:y})}finally{m?.terminate(),u?.dispose(),t.remove()}}function ke(e,l){const a=document.createElement("dialog");a.className="share-dialog",a.setAttribute("aria-labelledby","share-title"),a.innerHTML=`<p>Create a private MP4 video. Project and session names are hidden, and nothing is uploaded.</p>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D4p45n7i.js","assets/index-YT1ntRdY.js","assets/index-BROemBuT.css","assets/index-DFcP_XK3.js"])))=>i.map(i=>d[i]);
2
+ import{p as z,i as j,_ as H,s as K,a as V,o as J,b as Q,c as Y,t as Z,d as ee,S as L,e as te,f as ae,g as se,h as oe}from"./index-YT1ntRdY.js";import{TimelineScene as re}from"./scene-BkT0QJrf.js";import"./three-DDiuFd7k.js";const ne="#b0e9d6",ie="#dbe7e3",O=128,le=10,de="M102 24 86 40H36a14 14 0 0 0 0 28h40a14 14 0 0 1 0 28H22",ce=[[102,24],[36,40],[22,96]],ue=10;let U;function he(e,l,a,n,i=ne){U??=new Path2D(de),e.save(),e.translate(l,a),e.scale(n/O,n/O),e.strokeStyle=e.fillStyle=i,e.lineWidth=le,e.lineCap=e.lineJoin="round",e.stroke(U);for(const[y,h]of ce)e.beginPath(),e.arc(y,h,ue,0,Math.PI*2),e.fill();e.restore()}function pe(e){const l=z(e.lanes.length),a=new Map(e.lanes.flatMap(s=>s.nodes.map(t=>[t.session.id,s.key]))),n=new Map;for(const s of e.nodes.map(t=>t.session).sort((t,r)=>t.created-r.created||t.id.localeCompare(r.id))){const t=a.get(s.id);t!==void 0&&!n.has(t)&&n.set(t,n.size)}const i=new Map(e.nodes.map((s,t)=>[s.session.id,`session-${t}`])),y=new Map(e.lanes.flatMap((s,t)=>s.nodes.map(r=>[r.session.id,`project-${t}`]))),h=e.nodes.map(s=>{const t=s.session,r={id:i.get(t.id),title:"Session",projectID:y.get(t.id),directory:"",created:t.created,updated:t.created,activity:t.activity&&{firstMessageAt:t.activity.firstMessageAt,lastMessageAt:t.activity.lastMessageAt,userMessages:t.activity.userMessages,untimedUserMessages:t.activity.untimedUserMessages},archived:!1,model:"",provider:"",agent:"",cost:null,source:t.source==="continue"?"continue":t.source==="opencode"||!t.source?"opencode":"unknown",tokens:t.tokens};return t.parentID&&i.has(t.parentID)&&(r.parentID=i.get(t.parentID)),t.forkID&&i.has(t.forkID)&&(r.forkID=i.get(t.forkID)),{session:r,position:[...s.position],startPosition:[...s.startPosition],color:s.color,radius:s.radius}}),d=new Map(h.map(s=>[s.session.id,s]));return{start:e.start,end:e.end,timeFrame:e.timeFrame&&{...e.timeFrame},nodes:h,edges:e.edges.map(s=>({from:i.get(s.from),to:i.get(s.to),kind:s.kind})),lanes:e.lanes.map((s,t)=>({key:`project-${t}`,label:l[n.get(s.key)],color:s.color,kind:"directory",y:s.y,z:s.z,nodes:s.nodes.map(r=>d.get(i.get(r.session.id)))}))}}const $={mp4:{label:"MP4",description:"MP4 video",mime:"video/mp4",filename:"sessiongraph-playback.mp4"}},T=`My coding sessions, visualized with SessionGraph.
3
+ https://sessiongraph.ai`,ye=`https://x.com/intent/tweet?text=${encodeURIComponent(T)}`,G=e=>e instanceof Error&&e.name==="AbortError";async function me(e,l,a){const{label:n,description:i,mime:y,filename:h}=$[a];try{if(j()){const[{save:d},{writeFile:s}]=await Promise.all([H(()=>import("./index-D4p45n7i.js"),__vite__mapDeps([0,1,2])),H(()=>import("./index-DFcP_XK3.js"),__vite__mapDeps([3,1,2]))]),t=await d({title:`Save SessionGraph ${n}`,defaultPath:h,filters:[{name:i,extensions:[a]}]});if(!t)return"cancelled";await s(t,new Uint8Array(await e.arrayBuffer()))}else{const d=window.showSaveFilePicker;if(d){const t=await(await d.call(window,{suggestedName:h,types:[{description:i,accept:{[y]:[`.${a}`]}}]})).createWritable();try{await t.write(e),await t.close()}catch(r){throw await t.abort().catch(()=>{}),r}}else{const s=document.createElement("a");return s.href=l,s.download=h,document.body.append(s),s.click(),s.remove(),"downloaded"}}return"saved"}catch(d){if(G(d))return"cancelled";throw d}}const g=960,P=600,q='"Katagami Sans", sans-serif',fe=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e);function ve(e,l,a,n,i,y){const s=P-122,t=Math.max(1,...n);e.save(),he(e,24,14,28),e.fillStyle=ie,e.font=`600 14px ${q}`,e.textAlign="left",e.textBaseline="middle",e.fillText("SessionGraph",58,28),e.restore();for(let u=0;u<n.length;u++){const m=Math.max(2,n[u]/t*22);e.fillStyle=u/n.length<=a?"#91bfae":"#253d39",e.fillRect(260+u/n.length*440,s-m,440/n.length-2,m)}e.fillStyle="#d6f4e8",e.fillRect(260+440*a,s-27,1,31);const r=l.start+(l.end-l.start)*a,k=i.at(r,a===1).tokens;e.textAlign="center",e.fillStyle="#a0baae",e.font='12px "IBM Plex Mono", monospace',e.fillText(oe(r,l.end-l.start),g/2,s+23),e.fillStyle="#e7f5ee",e.font=`36px ${q}`,e.fillText(y(r,a===1).toLocaleString("en"),g/2-105,s+66),e.fillText(i.recorded?fe(k):"—",g/2+105,s+66),e.font=`12px ${q}`,e.fillStyle="#92b0a3",e.fillText("Sessions",g/2-105,s+87),e.fillText("Burnt tokens",g/2+105,s+87),e.textAlign="left"}async function be(e,l,a,n){a.throwIfAborted();const{label:i,mime:y}=$.mp4,h=Q(e.nodes.map(p=>p.session)),d=Y(e.nodes.map(p=>p.session)),s=Z(e.nodes.map(p=>ee(p.session)),e.start,e.end),t=document.createElement("div");t.className="share-render-host",t.setAttribute("aria-hidden","true"),t.style.cssText=`position:fixed;left:-12000px;top:0;width:${g}px;height:${P}px;pointer-events:none;visibility:hidden`,document.body.append(t);const r=document.createElement("canvas");r.width=g,r.height=P;const k=r.getContext("2d",{willReadFrequently:!0});let u,m;try{if(!k)throw new Error("Canvas export is unavailable.");u=new re(t,{onSelect(){},onHover(){},onPlaybackInterrupt(){},onEvent(){},onEventHover(){}},{manual:!0}),u.applyPreferences({...l,quality:"balanced",motion:"on",labels:!0,focusDimming:!1,trails:l.trails==="selected"?"all":l.trails}),u.setGraph(e,!0),u.prepareCapture(),await document.fonts.ready,a.throwIfAborted(),m=new Worker(new URL("/assets/mp4-worker-Dc_1QUwS.js",import.meta.url),{type:"module"});const p=(v,A=[])=>new Promise((b,w)=>{a.throwIfAborted();const f=()=>{clearTimeout(M),a.removeEventListener("abort",C),m.onmessage=null,m.onerror=null},C=()=>{f(),w(a.reason)},M=setTimeout(()=>{f(),w(new Error(`${i} encoding timed out. Please try again.`))},6e4);a.addEventListener("abort",C,{once:!0}),m.onmessage=E=>{f(),E.data.error?w(new Error(E.data.error)):b(E.data)},m.onerror=()=>{f(),w(new Error(`Could not start the ${i} encoder.`))},m.postMessage(v,A)});await p({init:!0,width:g,height:P});for(let v=0;v<L;v++){a.throwIfAborted();const A=te(v);u.captureFrame(A,1/ae,k,se(v)),ve(k,e,A,s,h,d);const b=k.getImageData(0,0,g,P).data.buffer;await p({rgba:b,width:g,height:P},[b]),n((v+1)/L)}const I=await p({finish:!0});return new Blob([I.bytes],{type:y})}finally{m?.terminate(),u?.dispose(),t.remove()}}function ke(e,l){const a=document.createElement("dialog");a.className="share-dialog",a.setAttribute("aria-labelledby","share-title"),a.innerHTML=`<p>Create a private MP4 video. Project and session names are hidden, and nothing is uploaded.</p>
4
4
  <div class="share-preview"><video aria-label="SessionGraph playback with hidden project and session names" muted loop playsinline controls hidden></video><div class="share-progress"><progress max="100" value="0" aria-label="Creating video"></progress><span role="status">Creating video… 0%</span></div></div>
5
5
  <p class="share-notice" role="status" hidden></p>
6
6
  <div class="share-actions"><button class="text-button share-close">Cancel</button><button class="secondary-button share-retry" hidden>Try again</button><a class="secondary-button share-x" target="_blank" rel="noopener noreferrer" hidden>Share in X</a><button class="secondary-button share-system" aria-label="Open share tray" aria-controls="playback-share-tray" aria-expanded="false" hidden>Share…</button><button class="primary-button share-save" hidden>Save MP4</button></div>
@@ -12,7 +12,7 @@
12
12
  <link rel="icon" sizes="any" href="/favicon.ico" />
13
13
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
14
14
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
15
- <script type="module" crossorigin src="/assets/index-DK0pBf-7.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-YT1ntRdY.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-BROemBuT.css">
17
17
  </head>
18
18
  <body>
@@ -18,7 +18,7 @@
18
18
  </data>
19
19
  <key>Resources/resources/cli-package.json</key>
20
20
  <data>
21
- s28hq2O7ILA2UtcLcLF6U1etYS0=
21
+ yskbF2uVxtZD9QkhhTnSiNe5DIY=
22
22
  </data>
23
23
  <key>Resources/resources/cli.mjs</key>
24
24
  <data>
@@ -34,7 +34,7 @@
34
34
  </data>
35
35
  <key>Resources/resources/server.mjs</key>
36
36
  <data>
37
- vwkz/tVBAART4vfjlyPavHsAmI8=
37
+ k6qKL5xtSPXzgA8aBIsg4oi39V4=
38
38
  </data>
39
39
  <key>Resources/resources/web/apple-touch-icon.png</key>
40
40
  <data>
@@ -80,25 +80,25 @@
80
80
  <data>
81
81
  LdRX2sBB3T5WDAsZLCwBlsMYXPw=
82
82
  </data>
83
- <key>Resources/resources/web/assets/index-BROemBuT.css</key>
83
+ <key>Resources/resources/web/assets/index-B05th82t.js</key>
84
84
  <data>
85
- g2aBf3McT5wt3r65bIJWSPbQxQg=
85
+ 7vnsxOa0ybuy1ehxzRxO8QZlc0Y=
86
86
  </data>
87
- <key>Resources/resources/web/assets/index-ClDHxy66.js</key>
87
+ <key>Resources/resources/web/assets/index-BROemBuT.css</key>
88
88
  <data>
89
- /0FZRHJk8enwA6fv9xeUnjO1DDM=
89
+ g2aBf3McT5wt3r65bIJWSPbQxQg=
90
90
  </data>
91
- <key>Resources/resources/web/assets/index-DK0pBf-7.js</key>
91
+ <key>Resources/resources/web/assets/index-D4p45n7i.js</key>
92
92
  <data>
93
- 3xcJifMlBaODuYN88C4X07XDcho=
93
+ gZQBqinWENotCZL8PpxlJAgGl+8=
94
94
  </data>
95
- <key>Resources/resources/web/assets/index-DWWZZL6C.js</key>
95
+ <key>Resources/resources/web/assets/index-DFcP_XK3.js</key>
96
96
  <data>
97
- h6X/MkVAaNA5V5wveGphGkbZWak=
97
+ HJYwOX6nVDnS3+T1GDxyoSViaSg=
98
98
  </data>
99
- <key>Resources/resources/web/assets/index-tIWYckIn.js</key>
99
+ <key>Resources/resources/web/assets/index-YT1ntRdY.js</key>
100
100
  <data>
101
- TKVRjX0Z42zUPElknXUkgqGmd0w=
101
+ dGUurist0yhdRHqLLDDQZ6M/7/o=
102
102
  </data>
103
103
  <key>Resources/resources/web/assets/katagami-sans-DMv8PCo8.woff2</key>
104
104
  <data>
@@ -116,21 +116,21 @@
116
116
  <data>
117
117
  2/71pbsZ0DyFW7H+mzqWhzexMXI=
118
118
  </data>
119
- <key>Resources/resources/web/assets/public-viewer-B1aKDYpa.js</key>
120
- <data>
121
- qH0Cz9zcCnbT2TutXY/jgtpAm34=
122
- </data>
123
119
  <key>Resources/resources/web/assets/public-viewer-CyDoUT6s.css</key>
124
120
  <data>
125
121
  FbjEO4oNsj+TTw0kRQAJcIlHVqM=
126
122
  </data>
127
- <key>Resources/resources/web/assets/scene-BCuZ73oU.js</key>
123
+ <key>Resources/resources/web/assets/public-viewer-DZqNLaJW.js</key>
124
+ <data>
125
+ HWhVJE/ibGB71CtPxtZvPDcDZjw=
126
+ </data>
127
+ <key>Resources/resources/web/assets/scene-BkT0QJrf.js</key>
128
128
  <data>
129
- bzYpA5mCqHVBM3AGA6AWa0WOiCg=
129
+ BAT5jnYYa6VoXAUV0liiMf853UM=
130
130
  </data>
131
- <key>Resources/resources/web/assets/share-mJrTMarx.js</key>
131
+ <key>Resources/resources/web/assets/share-jfnlc0aB.js</key>
132
132
  <data>
133
- Elv+nggMvTW66x8jkMjqCUkUTLE=
133
+ Nas6x/583ujeV3ArkTIU4JkHXn8=
134
134
  </data>
135
135
  <key>Resources/resources/web/assets/three-DDiuFd7k.js</key>
136
136
  <data>
@@ -170,7 +170,7 @@
170
170
  </data>
171
171
  <key>Resources/resources/web/index.html</key>
172
172
  <data>
173
- k2irXqUK6COS8WfLclP8tV1EBLk=
173
+ AiZES1Nir/SPpzIIrSiLKHeb+ds=
174
174
  </data>
175
175
  <key>Resources/resources/web/sources/LICENSE-APACHE-2.0.txt</key>
176
176
  <data>
@@ -416,7 +416,7 @@
416
416
  <dict>
417
417
  <key>hash2</key>
418
418
  <data>
419
- ssz2kat1NginI7VJe9dAgSQpWrKaj64JGZOAt7br0VA=
419
+ zNhyfHHf9XudQAOBStnWa7xBoAAVt8liueOfCcT9OdE=
420
420
  </data>
421
421
  </dict>
422
422
  <key>Resources/resources/cli.mjs</key>
@@ -444,7 +444,7 @@
444
444
  <dict>
445
445
  <key>hash2</key>
446
446
  <data>
447
- LwxoI7U+bNl9PKdkK7X+2dGO/Fpe91eDMeJX2UZExUo=
447
+ jJmlYS9CsmTyqaZzCvF/KUdX1BmwoLSadPdZvfEx1G0=
448
448
  </data>
449
449
  </dict>
450
450
  <key>Resources/resources/web/apple-touch-icon.png</key>
@@ -524,39 +524,39 @@
524
524
  vO1WHZkeP4HBUMCOcff6hJ/L/1I1YPYFkkXy7c4ZtgA=
525
525
  </data>
526
526
  </dict>
527
- <key>Resources/resources/web/assets/index-BROemBuT.css</key>
527
+ <key>Resources/resources/web/assets/index-B05th82t.js</key>
528
528
  <dict>
529
529
  <key>hash2</key>
530
530
  <data>
531
- uFSlaOzGL1gV/ou9yGh7lcgEpUZAZUEuOiyK/Wr1sbk=
531
+ Sws6fgfuOntAPsYxRCkRVoUleATK7EQ9nC3ooSm8z1Q=
532
532
  </data>
533
533
  </dict>
534
- <key>Resources/resources/web/assets/index-ClDHxy66.js</key>
534
+ <key>Resources/resources/web/assets/index-BROemBuT.css</key>
535
535
  <dict>
536
536
  <key>hash2</key>
537
537
  <data>
538
- qWingzPQPU8xr4+dvhpZOC7wFXKLWMEOTuCjx2QMBLg=
538
+ uFSlaOzGL1gV/ou9yGh7lcgEpUZAZUEuOiyK/Wr1sbk=
539
539
  </data>
540
540
  </dict>
541
- <key>Resources/resources/web/assets/index-DK0pBf-7.js</key>
541
+ <key>Resources/resources/web/assets/index-D4p45n7i.js</key>
542
542
  <dict>
543
543
  <key>hash2</key>
544
544
  <data>
545
- opzAbOE2wvIRtA6PNU6WERyBqoDgqJPAKV27cdjy040=
545
+ DBD2Da0G0VtlaAPnR91E0ZvALD7wMqmO1+kRgV3Khd0=
546
546
  </data>
547
547
  </dict>
548
- <key>Resources/resources/web/assets/index-DWWZZL6C.js</key>
548
+ <key>Resources/resources/web/assets/index-DFcP_XK3.js</key>
549
549
  <dict>
550
550
  <key>hash2</key>
551
551
  <data>
552
- 89aTxLVlhxKtAxB55LvO3CZeevb0BzKlFKImOncGsPE=
552
+ D14YBpziarwwuHiYoiCoGQgPiTS4VvzIkGBg1PCywhE=
553
553
  </data>
554
554
  </dict>
555
- <key>Resources/resources/web/assets/index-tIWYckIn.js</key>
555
+ <key>Resources/resources/web/assets/index-YT1ntRdY.js</key>
556
556
  <dict>
557
557
  <key>hash2</key>
558
558
  <data>
559
- uwQV5kFCyATu0lrvM+czvDJKShHC2LxM6Uyh3iEhAus=
559
+ 2gl0SWrsjCa8krnCBycZuTYudRrzcIte5f846CiEntI=
560
560
  </data>
561
561
  </dict>
562
562
  <key>Resources/resources/web/assets/katagami-sans-DMv8PCo8.woff2</key>
@@ -587,32 +587,32 @@
587
587
  VaH6cQJD5lKhlsXhS1dVQylTIaiWiRK8K2VSicyCuzg=
588
588
  </data>
589
589
  </dict>
590
- <key>Resources/resources/web/assets/public-viewer-B1aKDYpa.js</key>
590
+ <key>Resources/resources/web/assets/public-viewer-CyDoUT6s.css</key>
591
591
  <dict>
592
592
  <key>hash2</key>
593
593
  <data>
594
- W6c4Aq7kI88CpOkb0fk0QzXaM/MEMwwSilD9nGpF0z4=
594
+ kHOF7F9x/2xGro47Y79QJR2l+FdOkROiBbbW+Uj3g50=
595
595
  </data>
596
596
  </dict>
597
- <key>Resources/resources/web/assets/public-viewer-CyDoUT6s.css</key>
597
+ <key>Resources/resources/web/assets/public-viewer-DZqNLaJW.js</key>
598
598
  <dict>
599
599
  <key>hash2</key>
600
600
  <data>
601
- kHOF7F9x/2xGro47Y79QJR2l+FdOkROiBbbW+Uj3g50=
601
+ qaCCplIQ/HLx7ZErydUHiTr9FfTdQYckMN1VIgtGMEA=
602
602
  </data>
603
603
  </dict>
604
- <key>Resources/resources/web/assets/scene-BCuZ73oU.js</key>
604
+ <key>Resources/resources/web/assets/scene-BkT0QJrf.js</key>
605
605
  <dict>
606
606
  <key>hash2</key>
607
607
  <data>
608
- faivzncS/f8w1poimmHDF5qqvJSTF4Sa1K/sKn0cORw=
608
+ dOimY7fMJInzSEgN0ugfLn7l8cZW2mA2d9W29mISWks=
609
609
  </data>
610
610
  </dict>
611
- <key>Resources/resources/web/assets/share-mJrTMarx.js</key>
611
+ <key>Resources/resources/web/assets/share-jfnlc0aB.js</key>
612
612
  <dict>
613
613
  <key>hash2</key>
614
614
  <data>
615
- 0C4y26iSrzLzV1f4w9RUZvBQWYU45YjyBCiR54FGLn8=
615
+ yqv4Zy/yx5NwpY/WvFtN7L3Sdo8FxcHcKseLR/XbOhc=
616
616
  </data>
617
617
  </dict>
618
618
  <key>Resources/resources/web/assets/three-DDiuFd7k.js</key>
@@ -682,7 +682,7 @@
682
682
  <dict>
683
683
  <key>hash2</key>
684
684
  <data>
685
- 2lYg2IO37Swgk7ZOHN/Y31BLC4CFYyZ1FFow29qpgU4=
685
+ Y9i42B5tv2GxKb6pSUnwv1gAfWzZwiBkyL4qyg3flmY=
686
686
  </data>
687
687
  </dict>
688
688
  <key>Resources/resources/web/sources/LICENSE-APACHE-2.0.txt</key>