sessiongraph 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/PRIVACY.md +15 -61
  2. package/README.md +35 -55
  3. package/bin/sessiongraph.mjs +14 -8
  4. package/dist/assets/index-C0jATzD9.css +1 -0
  5. package/dist/assets/{index-D4P4hbvc.js → index-CFlNwG9H.js} +1 -1
  6. package/dist/assets/index-D24Hz9MJ.js +180 -0
  7. package/dist/assets/{index-Kotmn42s.js → index-D7udGrT1.js} +1 -1
  8. package/dist/assets/{index-BLM-0yG6.js → index-U9QGDl1t.js} +1 -1
  9. package/dist/assets/katagami-sans-DMv8PCo8.woff2 +0 -0
  10. package/dist/assets/licenses/hugeicons.txt +21 -0
  11. package/dist/assets/licenses/katagami.txt +93 -0
  12. package/dist/assets/public-viewer-CyDoUT6s.css +1 -0
  13. package/dist/assets/public-viewer-iQBchlbq.js +24 -0
  14. package/dist/assets/scene-DmT4K5Nj.js +248 -0
  15. package/dist/assets/share-DrezE0sG.js +7 -0
  16. package/dist/assets/{three-D_1Qt16u.js → three-DDiuFd7k.js} +21 -21
  17. package/dist/assets/{worker-C10U_apJ.js → worker-B9mWJfQ6.js} +1 -1
  18. package/dist/index.html +2 -2
  19. package/dist-server/cli.mjs +50326 -17640
  20. package/dist-server/install-cli.mjs +204 -0
  21. package/dist-server/server.mjs +1089 -379
  22. package/docs/cli.md +293 -190
  23. package/docs/guide.md +16 -9
  24. package/docs/import-coverage.md +73 -5
  25. package/docs/performance.md +164 -0
  26. package/docs/releases.md +6 -0
  27. package/package.json +18 -10
  28. package/dist/assets/external-links-BmBkCsrt.js +0 -1
  29. package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  30. package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  31. package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  32. package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  33. package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  34. package/dist/assets/index-B1kyvo41.js +0 -175
  35. package/dist/assets/index-Du0_nVjH.css +0 -1
  36. package/dist/assets/publishing-CEvQPkO1.css +0 -1
  37. package/dist/assets/publishing-D9CqkbeB.js +0 -23
  38. package/dist/assets/scene-CTHyYtma.js +0 -139
  39. package/dist/assets/share-Cw1E-ED9.js +0 -7
  40. package/docs/importer-comparison.md +0 -48
  41. package/docs/session-artifacts-audit.md +0 -176
@@ -1 +1 @@
1
- import{E as i}from"./index-B1kyvo41.js";function r(e){if(e!==void 0){if(typeof e=="string")return e;if("ok"in e&&"cancel"in e)return{OkCancelCustom:[e.ok,e.cancel]};if("yes"in e&&"no"in e&&"cancel"in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if("ok"in e)return{OkCustom:e.ok}}}async function f(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}async function k(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|save",{options:e})}async function l(e,a){return await i("plugin:dialog|message",{message:e,title:a?.title,kind:a?.kind,buttons:r(a?.buttons)})}async function s(e,a){const n=typeof a=="string"?{title:a}:a;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),l(e,n)}async function u(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Yes";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"No"}:"YesNo"})===t}async function d(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Ok";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"Cancel"}:"OkCancel"})===t}export{u as ask,d as confirm,s as message,f as open,k as save};
1
+ import{j as i}from"./index-D24Hz9MJ.js";function r(e){if(e!==void 0){if(typeof e=="string")return e;if("ok"in e&&"cancel"in e)return{OkCancelCustom:[e.ok,e.cancel]};if("yes"in e&&"no"in e&&"cancel"in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if("ok"in e)return{OkCustom:e.ok}}}async function f(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}async function k(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|save",{options:e})}async function l(e,a){return await i("plugin:dialog|message",{message:e,title:a?.title,kind:a?.kind,buttons:r(a?.buttons)})}async function s(e,a){const n=typeof a=="string"?{title:a}:a;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),l(e,n)}async function u(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Yes";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"No"}:"YesNo"})===t}async function d(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Ok";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"Cancel"}:"OkCancel"})===t}export{u as ask,d as confirm,s as message,f as open,k as save};
@@ -1 +1 @@
1
- import{E as a,U as i,V as o}from"./index-B1kyvo41.js";class l extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){const d=new o;e&&(d.onmessage=e);const r=await a("plugin:updater|download",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)});await this.downloadedBytes?.close().catch(()=>{}),this.downloadedBytes=new i(r)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){const d=new o;e&&(d.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)})}async close(){await this.downloadedBytes?.close(),await super.close()}}async function w(s){const e=await a("plugin:updater|check",{...s,headers:t(s?.headers)});return e?new l(e):null}function t(s){return s?Array.from(new Headers(s).entries()):void 0}export{l as Update,w as check};
1
+ import{j as a,R as i,C as o}from"./index-D24Hz9MJ.js";class l extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){const d=new o;e&&(d.onmessage=e);const r=await a("plugin:updater|download",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)});await this.downloadedBytes?.close().catch(()=>{}),this.downloadedBytes=new i(r)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){const d=new o;e&&(d.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)})}async close(){await this.downloadedBytes?.close(),await super.close()}}async function w(s){const e=await a("plugin:updater|check",{...s,headers:t(s?.headers)});return e?new l(e):null}function t(s){return s?Array.from(new Headers(s).entries()):void 0}export{l as Update,w as check};
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hugeicons
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2026 The Katagami Project Authors (https://github.com/Kevin-Liu-01/Katagami). Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter). Copyright 2022 The Noto Project Authors (https://github.com/notofonts), for the scripts merged into Katagami Sans, Katagami Round, Katagami Text and Katagami Serif from Noto Sans and Noto Serif Tibetan. Copyright 2017 IBM Corp. with Reserved Font Name "Plex", for Katagami CJK SC, TC, JP and KR, from IBM Plex Sans TC, JP and KR and from Frex Sans GB, a modified version of IBM Plex Sans SC. Copyright 2025 The Frex Sans Project Authors (https://gitee.com/NightFurySL2001/flex-sc), for Katagami CJK SC, from Frex Sans GB.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1 @@
1
+ .public-viewer{position:relative;height:min(80vh,760px);min-height:520px;min-width:0;border:1px solid #c9e3db1a;border-radius:var(--radius-12);background:var(--color-canvas);overflow:hidden;color:var(--color-text);font:13px/1.5 var(--app-sans, "Geist Variable", Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);isolation:isolate;container:public-graph / inline-size;--mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace}.public-viewer-full{height:100%;min-height:0;border:0;border-radius:var(--radius-none)}.public-viewer,.public-viewer *{box-sizing:border-box}.public-viewer [hidden]{display:none!important}.public-viewer :where(button,input,select){font:inherit;color:inherit}.public-viewer :where(button){cursor:pointer;border:0;background:none;padding:0;transition:background .18s,color .18s,border-color .18s}.public-viewer button:disabled{opacity:.45;cursor:default}.public-viewer :is(button,input,select,summary):focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.public-viewer svg{width:15px;height:15px;flex-shrink:0}.public-canvas{position:absolute;inset:0;display:grid;place-items:center}.public-canvas canvas{display:block;width:100%;height:100%;touch-action:none}.public-toolbar,.public-view-controls,.public-panel,.public-left>.profile-card{background:var(--color-panel-glass, #0c161be6);border:1px solid var(--color-panel-border, #d6eee119);box-shadow:0 12px 48px #0003,inset 0 1px #ffffff04;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px)}.public-toolbar,.public-view-controls{display:flex;gap:5px;align-items:center;height:48px;padding:5px 7px;border-radius:var(--radius-14)}.public-left{position:absolute;top:24px;left:24px;display:flex;flex-direction:column;align-items:flex-start;gap:14px;width:300px;max-height:max(180px,calc(100% - 228px));pointer-events:none}.public-left>*{pointer-events:auto;flex-shrink:0}.public-view-controls{position:absolute;top:24px;right:24px}.public-panel{position:absolute;border-radius:var(--radius-16)}.public-left>.public-browser{position:relative;width:100%;min-height:0;flex-shrink:1;display:flex;flex-direction:column}.public-panel-heading{display:flex;align-items:center;gap:3px;padding:10px 10px 8px 16px;flex-shrink:0}.public-panel-heading h2{flex:1;min-width:0;margin:0;font-size:13px;font-weight:480;color:var(--color-text-secondary)}.public-panel-heading [data-count]{margin-left:7px;font:10px var(--mono);color:#879f93}.public-filters{display:grid;gap:8px;padding:4px 12px 12px;border-bottom:1px solid #c9e3db14}.public-filter{position:relative;display:flex;align-items:center;min-width:0}.public-filter>svg{position:absolute;left:9px;width:14px;height:14px;color:#8ea99b;pointer-events:none;z-index:1}.public-filter .ui-select{width:100%}.public-filter .ui-select .ui-select-trigger{padding:7px 9px 7px 32px;background:transparent;border-color:transparent;color:#bdcfc6}.public-filter .ui-select-with-source .ui-select-trigger{padding-left:9px}.public-filter .ui-select .ui-select-trigger:hover,.public-filter .ui-select .ui-select-trigger[data-state=open]{background:#b0e9d606}.public-list{overflow:auto;overscroll-behavior:contain;min-height:60px;padding:6px 8px 10px}.public-list button{display:block;width:100%;text-align:left;border:1px solid transparent;border-radius:var(--radius-9);padding:11px 12px;margin-bottom:2px}.public-list button:hover{background:#dbf5e805}.public-list button[aria-pressed=true]{background:#b0e9d60b;border-color:#b0e9d61a}.public-list button>span{display:flex;align-items:center;gap:10px;font-size:12px;color:#bccfc5}.public-list button>span:before{content:"";width:5px;height:5px;border-radius:var(--radius-round);background:var(--session-color);flex-shrink:0}.public-list small{display:flex;align-items:center;gap:6px;color:#748e7f;font-size:10px;margin:6px 0 0 15px}.public-list small>span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.public-viewer .source-icon{display:inline-block;width:14px;height:14px;flex:0 0 14px;background:currentColor;mask:var(--source-icon) center / contain no-repeat;-webkit-mask:var(--source-icon) center / contain no-repeat}.public-browser>[data-more]{margin:6px 12px 12px;padding:8px;flex-shrink:0;font-size:11px;color:var(--color-accent)}.public-session{right:24px;top:86px;width:320px;max-height:calc(100% - 290px);overflow:auto}.public-session-data{padding:0 18px 18px}.public-session-data .graph-session-info{margin-inline:-18px}.public-source-badge{display:flex;align-items:center;gap:7px;color:#91aa9b;font-size:11px;margin-bottom:14px}.public-session p{margin:7px 0;line-height:1.7;color:#a1b6ad;overflow-wrap:anywhere;font-size:12px}.public-session strong{font-weight:450;color:var(--color-text)}.public-session pre{white-space:pre-wrap;font:10px/1.7 var(--mono);max-height:160px;overflow:auto}.public-session details{margin-top:12px;font-size:11px;color:#91aa9b}.public-session summary{cursor:pointer}.public-relation{display:flex;align-items:center;gap:8px;padding:8px 0;color:var(--color-accent);font-size:12px}.public-playback{bottom:24px;left:50%;transform:translate(-50%);width:min(650px,calc(100% - 48px))}.public-period-label{display:flex;align-items:center;gap:8px;flex:1;min-width:0;white-space:nowrap;color:var(--color-text-secondary);font-size:11px}.public-period-label>span{overflow:hidden;text-overflow:ellipsis}.public-period-label svg{width:13px;color:#597368}.public-playback .ui-select .ui-select-trigger{min-height:28px;padding:5px 7px;border-color:transparent;background:transparent;font-size:11px}.public-playback .ui-select-trigger>svg{width:10px}.public-viewer.playback-mode .public-left,.public-viewer.playback-mode .public-view-controls,.public-viewer.playback-mode .public-hints{visibility:hidden}.public-viewer.playback-mode .public-playback{width:min(580px,calc(100% - 40px));bottom:max(24px,env(safe-area-inset-bottom))}.public-hints{position:absolute;bottom:6px;left:24px;margin:0;color:#6e8980;font-size:9px;pointer-events:none}.public-hints kbd{border:1px solid #c4e1d71c;border-radius:var(--radius-4);padding:1px 4px;font:9px var(--mono)}.public-tooltip{position:absolute;padding:6px 10px;background:#0b141aee;border:1px solid #c9e3db24;border-radius:var(--radius-6);pointer-events:none;font-size:11px}.public-announcement{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.public-viewer .scene-labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}.public-viewer .scene-label{position:absolute;left:0;top:0;max-width:180px;padding:5px 8px;font:10px var(--mono);color:var(--label-color);opacity:0;background:#080f1266;border-radius:var(--radius-4);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.public-viewer .scene-label.visible{opacity:.55}@container public-graph (max-width: 760px){.public-left{left:10px;top:10px;width:min(250px,calc(100% - 20px));max-height:max(180px,calc(100% - 215px));gap:12px}.public-view-controls{right:10px;top:10px;gap:1px}.public-session{top:auto;bottom:205px;right:10px;width:min(320px,calc(100% - 20px));max-height:32%}.public-playback{bottom:24px;width:calc(100% - 20px)}.public-hints{left:10px;font-size:8px}}@container public-graph (max-width: 480px){.public-left>.profile-card{height:64px}.public-viewer:has(.public-left>.profile-card) .public-view-controls{top:86px}.public-toolbar .graph-button span,.public-period-label,.public-playback [data-close-timeline]{display:none}.public-playback .range-buttons{margin-left:0;margin-right:auto}.public-playback .playback-summary{gap:12px}.public-playback .playback-summary strong{font-size:23px}.public-playback .playback-summary>span>span{font-size:10px}.public-playback .timeline-track{gap:10px}.public-session{bottom:195px}}
@@ -0,0 +1,24 @@
1
+ import{v as fe,k as te,l as k,m as $e,n as E,q as Ee,r as Le,u as Me,D as Te,I as De,c as ge,b as he,V as Pe,w as ye,x as ve,y as Ie,h as Ne,z as Fe,A as je,B as Be,E as ke,F as He,t as qe,d as Oe,P as Re,G as Se,H as Ge}from"./index-D24Hz9MJ.js";import{TimelineScene as Ke}from"./scene-DmT4K5Nj.js";import"./three-DDiuFd7k.js";function _e(s){const f=s.settings.tokens?s.sessions.filter(o=>typeof o.tokens=="number"):[],u=f.reduce((o,l)=>o+l.tokens,0);return{sessionCount:s.sessions.length,tokenCount:f.length&&Number.isSafeInteger(u)?u:null,tokensPartial:f.length>0&&f.length<s.sessions.length}}function Qe(s){const f=_e(s),u=[`${f.sessionCount.toLocaleString()} sessions`];if(s.settings.tokens&&u.push(f.tokenCount===null?"Tokens unknown":`${f.tokenCount.toLocaleString()} tokens`),s.settings.messageCounts){const o=s.sessions.filter(l=>l.messages?.count!=null);u.push(o.length?`${o.reduce((l,A)=>l+A.messages.count,0).toLocaleString()} messages`:"Messages unknown")}return u.join(" · ")}const C=s=>s==null?"unknown":s.toLocaleString(),z=s=>s===null?"unknown":new Date(s).toLocaleString(),se=(s,f=!1)=>new Date(s).toLocaleDateString("en",{month:"short",day:"numeric",...f?{year:"numeric"}:{}}),Ue=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1});let We=0;function Je(s,f,u={}){let o=fe(f),l=te(o),A=new Map(l.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-${++We}`;s.classList.toggle("public-viewer-full",!!u.fullscreen),s.innerHTML=`
2
+ <div class="public-canvas" aria-label="Interactive public session graph"></div>
3
+ <nav class="public-view-controls" aria-label="Graph controls">
4
+ ${k("center-focus","Fit view",{"data-fit":!0},"Fit view (F)")}
5
+ ${k("clock","Toggle timeline",{"data-timeline":!0,"aria-expanded":"true"},"Timeline")}
6
+ ${k("panel-right","Toggle session details",{"data-detail":!0,"aria-expanded":"false",hidden:!0},"Session details")}
7
+ ${k("circle-help","Help",{"data-help":!0,"aria-haspopup":"dialog"})}
8
+ ${k("volume-2","Mute sound",{"data-mute":!0,"data-sound":"none","aria-pressed":"false"})}
9
+ </nav>
10
+ <div class="public-left">
11
+ <div class="public-toolbar">${k("search","Toggle sessions",{"data-sessions":!0,"aria-expanded":"true"},"Sessions","Sessions")}</div>
12
+ <aside class="public-browser public-panel" aria-label="Sessions">
13
+ <div class="public-panel-heading"><h2>Sessions <span data-count></span></h2>${k("x","Close sessions",{"data-close-list":!0})}</div>
14
+ <div class="public-filters"><div class="public-filter" data-harness-filter><select data-harness data-source-icons="${$e(u.sourceIconBase||"/sources")}" aria-label="Session source"><option value="">All sources</option></select></div><div class="public-filter">${E("folder")}<select data-project aria-label="Project"><option value="">All projects</option></select></div></div>
15
+ <div class="public-list" role="list" aria-label="Sessions"></div>
16
+ </aside>
17
+ </div>
18
+ <aside class="public-session public-panel" aria-label="Session details" hidden><div class="public-panel-heading"><h2 data-session-heading></h2>${k("crosshair","Focus node",{"data-focus":!0})}${k("x","Close session details",{"data-close-detail":!0})}</div><div class="public-session-data"></div></aside>
19
+ <div class="public-tooltip" hidden></div>
20
+ <section class="public-playback public-panel timeline-controls" aria-label="Timeline controls">${Ee(`<span class="public-period-label">${E("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="0" aria-pressed="true">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
+ ${Le(["fit","clear"],"public-hints")}
22
+ ${Me(ne,["fit","clear"])}
23
+ <p class="public-announcement" role="status"></p>`;const n=e=>s.querySelector(e);u.profileCard&&n(".public-left").prepend(u.profileCard);const y=e=>n(`[data-playback=${e}]`),ae=n(".public-canvas"),L=n(".public-session"),M=n(".public-session-data"),R=n(".public-list"),T=n(".public-browser"),Q=n(".public-playback"),D=n("[data-project]"),P=n("[data-harness]"),we=n("[data-speed]"),G=y("scrubber"),S=y("play"),Ce=matchMedia("(prefers-reduced-motion: reduce)"),I=new AbortController,v={...Te,focusDimming:!1,messageDots:o.settings.messageTimestamps},K=new De(v,()=>{},s);let c,p=null,g=o.sessions,N=0,_=0,F=!1,d=1,x=0,J=0,ie=!1,U=[],j,le=ge(l.nodes.map(e=>e.session)),X=he(l.nodes.map(e=>e.session),{});const w=e=>{T.hidden=!e,n("[data-sessions]").setAttribute("aria-expanded",String(e))},oe=e=>{Q.hidden=!e,n("[data-timeline]").setAttribute("aria-expanded",String(e))},re=e=>{n(".public-announcement").textContent=e},$=e=>{L.hidden=!e;const t=n("[data-detail]");t.hidden=p===null,t.setAttribute("aria-expanded",String(e))};let ce=new Map;const de=new Pe(R,{key:e=>String(e.id),estimate:()=>66,render:(e,t)=>{const r=document.createElement("div"),i=document.createElement("button"),a=document.createElement("span"),h=document.createElement("small");r.setAttribute("role","listitem"),r.setAttribute("aria-posinset",String(t+1)),r.setAttribute("aria-setsize",String(g.length)),i.type="button",i.dataset.session=String(e.id),i.setAttribute("aria-pressed",String(p===e.id)),i.style.setProperty("--session-color",ce.get(e.id)||"#b0e9d6"),a.textContent=`Session ${e.id+1}`,e.harness&&h.append(ye(e.harness,u.sourceIconBase));const b=document.createElement("span");return b.textContent=[A.get(e.group),e.model].filter(Boolean).join(" · "),h.append(b),i.append(a,h),i.onclick=()=>B(String(e.id)),r.append(i),r}});function m(){cancelAnimationFrame(_),_=0,F=!1,x=0,s.classList.remove("playback-mode"),j&&(w(j.browser),$(j.details&&p!==null),j=void 0),c?.setPlaying(!1),S.innerHTML=E("play"),S.setAttribute("aria-label","Play timeline")}function B(e){m();const t=e===null?void 0:o.sessions[Number(e)];p=t&&g.some(i=>i.id===t.id)?t.id:null,c?.select(p===null?null:String(p)),c?.setEvents([]),U=[],M.replaceChildren(),$(p!==null);for(const i of R.querySelectorAll("button"))i.setAttribute("aria-pressed",String(i.dataset.session===String(p)));if(p===null||!t)return;if(s.clientWidth<1e3&&w(!1),d=1,H(),n("[data-session-heading]").textContent=`Session ${t.id+1}`,t.harness){const i=document.createElement("div");i.className="public-source-badge",i.append(ye(t.harness,u.sourceIconBase),ve(t.harness)),M.append(i)}const r=[["folder","Project",A.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",C(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",C(t.messages.count)]),t.messages.untimed&&r.push(["clock","Untimed messages",C(t.messages.untimed)])),M.insertAdjacentHTML("beforeend",Ie(r));for(const[i,a,h]of[["Fork of",t.fork,"git-fork"],["Child of",t.parent,"network"]])if(a!==null){const b=document.createElement("button");b.className="public-relation",b.type="button",b.dataset.related=String(a),b.innerHTML=E(h),b.append(`${i} Session ${a+1}`),b.disabled=!g.some(Y=>Y.id===a),b.onclick=()=>B(String(a)),M.append(b)}if(t.messageTimes?.values.length){const i=document.createElement("details"),a=document.createElement("summary");a.textContent=`${C(t.messageTimes.values.length)} message timestamps`;const h=document.createElement("pre");h.textContent=t.messageTimes.values.map(z).join(`
24
+ `),i.append(a,h),M.append(i),U=t.messageTimes.values.map((b,Y)=>({id:`public-${Y}`,ordinal:Y,kind:"message",name:"Message",role:"user",time:b,timeSource:"recorded",preview:""})),c?.setEvents(U)}c?.focus(String(t.id)),re(`Selected Session ${t.id+1}.`)}function Ae(){if(n("[data-count]").textContent=C(g.length),ce=new Map(l.nodes.map(e=>[Number(e.session.id),e.color])),de.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){c?.setCutoff(d,e),G.value=String(Math.round(d*1e3));const t=l.start+(l.end-l.start)*d,r=le(t,d===1);y("date").textContent=o.settings.timestamps&&l.nodes.length?se(t):`${C(r)} sessions`,y("period").textContent=o.settings.timestamps&&l.nodes.length?Ne(t,l.end-l.start):"All time",y("cursor").style.left=`${d*100}%`,y("histogram").style.setProperty("--progress",`${d*100}%`),y("summary").hidden=!g.length,y("sessions").textContent=C(r);const i=X.at(t,d===1);y("tokens").textContent=X.recorded&&Fe(i.tokens)?Ue.format(i.tokens):"—",n("[data-token-total]").hidden=!o.settings.tokens}function W(e=!1){m(),d=1;const t=o.settings.timestamps&&N?Math.max(...o.sessions.map(ke))-N*864e5:0;g=o.sessions.filter(a=>(!D.value||String(a.group)===D.value)&&(!P.value||a.harness===P.value)&&(!t||ke(a)>=t)).sort(He),e||(l=te(o,new Set(g.map(a=>a.id)))),le=ge(l.nodes.map(a=>a.session)),X=he(l.nodes.map(a=>a.session),{}),c?.setGraph(l,!0),B(null);const r=qe(l.nodes.map(a=>Oe(a.session)),l.start,l.end),i=Math.max(1,...r);y("histogram").replaceChildren(...r.map(a=>{const h=document.createElement("span");return h.style.height=`${Math.max(4,a/i*100)}%`,h.style.opacity=a?".8":".15",h})),n("[data-range-label]").textContent=g.length?o.settings.timestamps?`${se(l.start)} — ${se(l.end,!0)}`:"Timeline":"No sessions";for(const a of s.querySelectorAll("[data-days]"))a.setAttribute("aria-pressed",String(Number(a.dataset.days)===N));S.disabled=!g.length,G.disabled=!g.length,Ae(),H()}try{c=new Ke(ae,{onSelect:e=>{B(e),e!==null&&K.play("select")},onPlaybackInterrupt:m,onHover:(e,t,r)=>{const i=n(".public-tooltip");if(i.hidden=!e,e){const a=s.getBoundingClientRect();i.textContent=e.session.title,i.style.left=`${Math.max(8,Math.min(s.clientWidth-135,t-a.left+14))}px`,i.style.top=`${Math.max(8,r-a.top-35)}px`}},onEvent:e=>{const t=U.find(r=>r.id===e);t&&(c?.focusEvent(t),re(z(t.time)))},onEventHover(){}},{panels:[T,L,Q,...u.profileCard?[u.profileCard]:[]],focusTop:80}),c.applyPreferences(v)}catch{ae.textContent="3D rendering is unavailable. Explore sessions in the panel.",n("[data-fit]").disabled=!0}function ue(){D.replaceChildren(new Option("All projects","")),P.replaceChildren(new Option("All sources","")),[...A].sort((e,t)=>e[0]-t[0]).forEach(([e,t])=>D.add(new Option(t,String(e)))),[...new Set(o.sessions.flatMap(e=>e.harness?[e.harness]:[]))].sort().forEach(e=>P.add(new Option(ve(e),e))),n("[data-harness-filter]").hidden=!o.settings.harness;for(const e of s.querySelectorAll("[data-days]"))e.hidden=!o.settings.timestamps&&e.dataset.days!=="0"}ue();for(const e of[D,P])e.onchange=()=>W();for(const e of s.querySelectorAll("[data-days]"))e.hidden=!o.settings.timestamps&&e.dataset.days!=="0",e.onclick=()=>{N=Number(e.dataset.days),W()};n("[data-sessions]").onclick=()=>{m(),T.hidden&&s.clientWidth<1e3&&$(!1),w(T.hidden)},n("[data-close-list]").onclick=()=>w(!1),n("[data-close-detail]").onclick=()=>$(!1),n("[data-detail]").onclick=()=>{p!==null&&(m(),L.hidden&&s.clientWidth<1e3&&w(!1),$(L.hidden))},n("[data-focus]").onclick=()=>{p!==null&&c?.focus(String(p))};const pe=()=>{m(),c?.reset()};n("[data-fit]").onclick=pe,n("[data-timeline]").onclick=()=>{m(),oe(Q.hidden)},n("[data-close-timeline]").onclick=()=>oe(!1);const q=n(`#${ne}`);let Z=!0;const V=()=>c?.setSuspended(!Z||document.hidden||q.open);n("[data-help]").onclick=()=>{m(),q.showModal(),V()},n("[data-close-help]").onclick=()=>q.close(),q.addEventListener("close",V,{signal:I.signal});const O=n("[data-mute]");O.onclick=()=>{v.muted=!v.muted,K.configure(v);const e=je(v.muted);O.innerHTML=E(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=()=>c?.applyPreferences(v);Ce.addEventListener("change",ee,{signal:I.signal});const me=e=>{if(ie||!F)return;const t=Math.max(0,e-J);J=e,d<1?d=Math.min(1,d+t*Number(we.value)/Re):x+=t,H(),c?.setPlaybackOutro(d>=1?Math.min(1,x/Se):null),d>=1&&x>=Se+Ge?m():_=requestAnimationFrame(me)};S.onclick=()=>{if(F)return m();d>=1&&(d=0),j={browser:!T.hidden,details:!L.hidden},w(!1),$(!1),n(".public-tooltip").hidden=!0,s.classList.add("playback-mode"),F=!0,x=0,J=performance.now(),H(),c?.setPlaying(!0),S.innerHTML=E("pause"),S.setAttribute("aria-label","Pause timeline"),_=requestAnimationFrame(me)},G.oninput=()=>{m(),d=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(),pe()),e.key==="Escape"&&B(null),e.code==="Space"&&!e.target.closest("button, summary")&&(e.preventDefault(),S.click()))},{signal:I.signal}),document.addEventListener("visibilitychange",()=>{document.hidden&&m(),V()},{signal:I.signal});const be=new IntersectionObserver(([e])=>{Z=e.isIntersecting,Z||m(),V()});be.observe(s),s.clientWidth<760&&w(!1),W(!0),ee();const xe=Be(s);return{diagnostics:()=>({...c?.diagnostics(),playing:F,progress:d,outro:x,selected:p}),setData(e){o=fe(e),l=te(o),A=new Map(l.lanes.flatMap(t=>t.nodes.map(r=>[Number(r.session.projectID),t.label]))),v.messageDots=o.settings.messageTimestamps,N=0,p=null,ue(),W(!0),ee()},dispose(){ie=!0,m(),I.abort(),be.disconnect(),xe(),de.dispose(),c?.dispose(),K.dispose(),delete s.dataset.graphAudio,s.replaceChildren(),s.classList.remove("public-viewer","public-viewer-full")}}}export{Je as createPublicViewer,Qe as publicSummary};
@@ -0,0 +1,248 @@
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{J as te,K as P,D as Re,L as le,M as B,a as Qe,N as Je,O as oe,Q as et,T as tt,U as it}from"./index-D24Hz9MJ.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
+ attribute float nodeIndex;
3
+ uniform float uSelected;
4
+ uniform float uHovered;
5
+ uniform float uFocus;
6
+ attribute float familyDepth;
7
+ uniform float uFamilyTime;
8
+ varying float vNodeEmphasis;
9
+ float nodeEmphasis() {
10
+ if (abs(nodeIndex - uSelected) < .5) return 1.12;
11
+ if (abs(nodeIndex - uHovered) < .5) return 1.2;
12
+ float family = step(-.5, familyDepth) * smoothstep(familyDepth*.12, familyDepth*.12+.35, uFamilyTime);
13
+ return mix(mix(1.0, .12, uFocus), mix(1.0, .85, uFocus), family);
14
+ }
15
+ `;function Y(u){const e=new V(u.color),t=e.getHSL({h:0,s:0,l:0},xe),s=u.session.id;return e.setHSL(t.h+(P(`${s}:hue`)-.5)*.09,k.clamp(t.s+P(`${s}:saturation`)*.12,.4,.72),.63+P(`${s}:lightness`)*.11,xe)}function at(u){const e=new ve;return e.onBeforeCompile=t=>{Object.assign(t.uniforms,u),t.vertexShader=`${Te}
16
+ varying vec3 vSphereNormal; varying vec3 vSphereView;
17
+ ${t.vertexShader}`.replace("#include <project_vertex>",`
18
+ #include <project_vertex>
19
+ // Instances only translate/uniformly scale, so view-space normals retain
20
+ // the original sphere's lighting and depth cues.
21
+ vSphereNormal = mat3(viewMatrix) * normal;
22
+ vSphereView = -mvPosition.xyz;
23
+ vNodeEmphasis = nodeEmphasis();
24
+ `),t.fragmentShader=`varying vec3 vSphereNormal; varying vec3 vSphereView; varying float vNodeEmphasis;
25
+ ${t.fragmentShader}`.replace("#include <color_fragment>",`
26
+ #include <color_fragment>
27
+ vec3 n = normalize(vSphereNormal);
28
+ float facing = max(dot(n, normalize(vSphereView)), 0.0);
29
+ float light = .8 + .4 * max(dot(n, normalize(vec3(-.5, .65, 1.0))), 0.0);
30
+ // Luminous colored centers bloom; a soft rim still separates overlaps.
31
+ float rim = mix(.35, 1.0, smoothstep(0.0, .28, facing));
32
+ diffuseColor.rgb = mix(diffuseColor.rgb, vec3(1.0), .07 * facing);
33
+ diffuseColor.rgb *= 1.4 * light * rim * vNodeEmphasis;
34
+ `)},e}const Ie=32,ee=4,ie=2*Math.PI/Ie,ye=.02,be=.18;function Be(u,e){const t=Math.max(0,e-u.startPosition[0]),s=Math.min(1,t/ee),o=ye+u.radius*be;return{angle:t*ie+P(u.session.id)*2*Math.PI,amplitude:o*s*s*(3-2*s),derivative:t<ee?o*6*s*(1-s)/ee:0}}function G(u,e){const{angle:t,amplitude:s}=Be(u,e);return[e,u.position[1]+Math.cos(t)*s,u.position[2]+Math.sin(t)*s]}function ke(u,e){const{angle:t,amplitude:s,derivative:o}=Be(u,e);return[1,Math.cos(t)*o-Math.sin(t)*s*ie,Math.sin(t)*o+Math.cos(t)*s*ie]}const Pe=`
35
+ uniform float uHeadX; uniform float uGraphReveal; uniform float uContextFocus;
36
+ uniform float uTrailTime; uniform float uTrailFlow; uniform float uTrailSpeed;
37
+ uniform float uTrailOpacity; uniform float uNodeScale; uniform float uPixelScale;
38
+ attribute vec3 origin; attribute float endX; attribute float radius; attribute float seed; attribute float reveal;
39
+ varying vec3 vColor; varying float vAlpha;
40
+ vec3 cometPoint(float t, float head) {
41
+ float distance = (head - origin.x) * t;
42
+ float phase = distance * ${ie.toFixed(10)} + seed * ${String(2*Math.PI)};
43
+ float curl = (${ye} + radius * ${be}) * smoothstep(0., ${ee.toFixed(1)}, distance);
44
+ return vec3(origin.x + distance, origin.y + cos(phase) * curl, origin.z + sin(phase) * curl);
45
+ }
46
+ `;function lt(u,e,t,s=!1){const o=u.filter(a=>a.position[0]>a.startPosition[0]),i=new X;i.userData.kind="lifetime";const r=[];for(const a of[16,64,256,512]){const n=o.filter(l=>{const h=(l.position[0]-l.startPosition[0])/Ie*32;return(h<=16?16:h<=64?64:h<=256?256:512)===a});if(n.length){const l=ht(n,e,t,s,a);r.push(l),i.add(l.group)}}return{group:i,update(a){for(const n of r)n.update(a)}}}function ht(u,e,t,s,o){const i=new X,r=u.map(x=>t.get(x.session.id)),a={...e,uIntensity:{value:s?1:.48}},n=[],l=[],h=[],c=[],d=[];for(const x of u)n.push(...x.startPosition),l.push(x.position[0]),h.push(x.radius),c.push(P(x.session.id)),d.push(...Y(x).toArray());const p=new he(1,2,o,1),y=new ge;y.index=p.index,y.attributes=p.attributes,y.instanceCount=u.length,y.setAttribute("origin",new F(new Float32Array(n),3)),y.setAttribute("endX",new F(new Float32Array(l),1)),y.setAttribute("radius",new F(new Float32Array(h),1)),y.setAttribute("seed",new F(new Float32Array(c),1)),y.setAttribute("color",new F(new Float32Array(d),3));const M=new F(new Float32Array(u.length),1).setUsage(D);y.setAttribute("reveal",M);const g=new L({uniforms:a,vertexColors:!0,transparent:!0,depthWrite:!1,side:Z,blending:H,vertexShader:`${Pe}
47
+ varying float vAcross; varying float vAlong;
48
+ void main() {
49
+ float head = clamp(uHeadX, origin.x, endX), span = head - origin.x;
50
+ float t = uv.x; vAlong = t; vAcross = position.y;
51
+ vColor = color; vAlpha = step(.0001, span) * smoothstep(.45,1.,reveal) * uGraphReveal * mix(1.0, .12, uContextFocus);
52
+ vec3 point = cometPoint(t, head);
53
+ vec4 mv = modelViewMatrix * vec4(point, 1.0);
54
+ vec3 tangent = cometPoint(min(1., t + .001), head) - cometPoint(max(0., t - .001), head);
55
+ vec2 axis = (modelViewMatrix * vec4(tangent,0.)).xy;
56
+ vec2 normal = length(axis) > .001 ? normalize(vec2(-axis.y, axis.x)) : vec2(0.,1.);
57
+ float taper = pow(max(0., t), 1.25);
58
+ float width = (.012 + radius * uNodeScale * .55 * taper) * smoothstep(0., .06, t);
59
+ mv.xy += normal * position.y * width;
60
+ gl_Position = projectionMatrix * mv;
61
+ }`,fragmentShader:`uniform float uTrailOpacity; uniform float uIntensity;
62
+ varying vec3 vColor; varying float vAlpha; varying float vAcross; varying float vAlong;
63
+ void main() {
64
+ float core = exp(-abs(vAcross) * 7.0), halo = pow(max(0., 1.-abs(vAcross)), 2.);
65
+ // Interpolation can put the first ribbon pixels just below zero.
66
+ // Fractional pow of that value poisons the HDR buffer and every bloom mip.
67
+ float along = clamp(vAlong, 0., 1.);
68
+ float tail = smoothstep(0., .04, along) * (.18 + .82 * pow(along, .7));
69
+ float alpha = (core * .8 + halo * .28) * tail * vAlpha * uTrailOpacity * uIntensity;
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}
72
+ void main() {
73
+ float head = clamp(uHeadX, origin.x, endX), span = head - origin.x;
74
+ float clock = uTrailTime * uTrailFlow * uTrailSpeed;
75
+ float t = fract(position.x - clock * .12 + seed);
76
+ float wake = min(span, 24. + radius * 16.);
77
+ float age = 1. - t;
78
+ float angle = age * 10. + seed * 6.28318 + clock * .5;
79
+ float spread = sin(age * 3.14159) * radius * uNodeScale * (.25 + position.y * .65);
80
+ vec3 point = cometPoint(1. - wake * age / max(.001, span), head);
81
+ point.y += cos(angle) * spread; point.z += sin(angle) * spread;
82
+ vec4 mv = modelViewMatrix * vec4(point, 1.);
83
+ gl_Position = projectionMatrix * mv;
84
+ gl_PointSize = clamp((.045 + radius * .15 * pow(t, .8)) * uPixelScale / max(.1, -mv.z), 1., 7.);
85
+ vColor = color;
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
+ }`,fragmentShader:`uniform float uTrailOpacity; uniform float uIntensity; varying vec3 vColor; varying float vAlpha;
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;
90
+ varying vec3 vColor; varying float vAcross,vAlong,vReveal;
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
+ void main() {
93
+ float t=uv.x*reveal; vec3 p=curve(t);
94
+ vec2 axis=(modelViewMatrix*vec4(curve(min(1.,t+.001))-curve(max(0.,t-.001)),0.)).xy;
95
+ vec2 normal=length(axis)>.0001?normalize(vec2(-axis.y,axis.x)):vec2(0.,1.);
96
+ vec4 mv=modelViewMatrix*vec4(p,1.);
97
+ mv.xy+=normal*position.y*max(.015,-mv.z/uPixelScale*5.5*uPixelRatio);
98
+ gl_Position=projectionMatrix*mv; vColor=color; vAcross=position.y; vAlong=uv.x; vReveal=reveal;
99
+ }`,fragmentShader:`uniform float uIntensity,uContextFocus; varying vec3 vColor; varying float vAcross,vAlong,vReveal;
100
+ void main() {
101
+ if(vReveal<=0.) discard;
102
+ float core=exp(-vAcross*vAcross*100.), aura=exp(-vAcross*vAcross*4.)*(1.-smoothstep(.65,1.,abs(vAcross)));
103
+ float distance=(1.-clamp(vAlong,0.,1.))*16.;
104
+ float tip=exp(-distance*distance)*max(0.,sin(vReveal*3.14159));
105
+ vec3 tint=mix(vColor,vec3(1.),tip*.18);
106
+ float alpha=(core*.8+aura*.24+tip*aura*.7)*smoothstep(0.,.04,vReveal)*uIntensity*mix(1.,.16,uContextFocus);
107
+ gl_FragColor=vec4(tint*(1.2+tip),alpha);
108
+ }`}));r.frustumCulled=!1,this.group.add(r)}links;group=new X;progress;update(e,t=1/0){this.links.forEach((s,o)=>this.progress.setX(o,e[s.child]*(Number.isFinite(t)?k.smoothstep(t-(s.delay||0),0,.4):1))),this.progress.needsUpdate=!0}samples(){return Array.from(this.progress.array).slice(0,32)}}function ut(u,e,t,s){const o=new he(2,2),i=new ge;i.index=o.index,i.attributes=o.attributes,i.instanceCount=u.length;const r=new F(e,3).setUsage(D),a=new F(t,1).setUsage(D);i.setAttribute("center",r),i.setAttribute("reveal",a),i.setAttribute("color",new F(Float32Array.from(u.flatMap(l=>Y(l).toArray())),3)),i.setAttribute("radius",new F(Float32Array.from(u.map(l=>l.radius)),1)),i.setAttribute("nodeIndex",new F(Float32Array.from(u.map((l,h)=>h)),1));const n=new j(i,new L({uniforms:s,vertexColors:!0,transparent:!0,depthWrite:!1,depthTest:!1,side:Z,blending:H,vertexShader:`attribute vec3 center; attribute float reveal,radius; uniform float uPixelScale,uPixelRatio,uNodeScale;
109
+ varying vec3 vColor; varying vec2 vPoint; varying float vAlpha;
110
+ void main(){
111
+ vColor=color; vPoint=position.xy; vAlpha=max(0.,sin(reveal*3.14159));
112
+ if(reveal<=0. || reveal>=1.) { gl_Position=vec4(2.,2.,2.,1.); return; }
113
+ vec4 mv=modelViewMatrix*vec4(center,1.);
114
+ float size=max(radius*uNodeScale*1.8,-mv.z/uPixelScale*4.*uPixelRatio);
115
+ mv.xy+=position.xy*size;
116
+ gl_Position=projectionMatrix*mv;
117
+ }`,fragmentShader:`varying vec3 vColor; varying vec2 vPoint; varying float vAlpha; uniform float uFocus;
118
+ void main(){
119
+ float d=length(vPoint); if(d>=1.) discard;
120
+ float core=exp(-d*d*22.);
121
+ float sparkle=exp(-abs(vPoint.x*vPoint.y)*90.)*pow(max(0.,1.-d),2.);
122
+ gl_FragColor=vec4(mix(vColor,vec3(1.),.65),(core*.18+sparkle*.16)*vAlpha*mix(1.,.16,uFocus));
123
+ }`}));return n.frustumCulled=!1,{mesh:n,update(){r.needsUpdate=!0,a.needsUpdate=!0}}}const me={performance:{dust:160,trails:32,bursts:8,sparks:12},balanced:{dust:560,trails:96,bursts:24,sparks:20},high:{dust:1100,trails:160,bursts:40,sparks:28}};function pe(u,e){const t=Math.min(u.length,Math.max(0,Math.floor(e)));return Array.from({length:t},(s,o)=>u[Math.floor(o*u.length/t)])}function dt(u,e,t=256){const s=new Set(u.nodes.map(n=>n.session.id)),o=new Map;if(!s.has(e)||t<1)return{depths:o,edges:[]};const i=new Map;for(const n of u.edges)if(!(!s.has(n.from)||!s.has(n.to)))for(const[l,h]of[[n.from,n.to],[n.to,n.from]]){const c=i.get(l)||[];c.push(h),i.set(l,c)}const r=[e];o.set(e,0);for(let n=0;n<r.length;n++){const l=r[n];for(const h of i.get(l)||[])o.has(h)||o.size>=t||(o.set(h,o.get(l)+1),r.push(h))}const a=u.edges.filter(n=>o.has(n.from)&&o.has(n.to)).slice(0,t*2).map(n=>({edge:n,depth:Math.min(o.get(n.from),o.get(n.to))}));return{depths:o,edges:a}}function mt(u,e,t,s){if(![u,e,t,s].every(Number.isFinite)||s<=0||u===e)return 0;const o=(e-u)/s/Math.max(1/120,t);return Math.max(-1,Math.min(1,o*.65))}function pt(u,e,t,s=6){if(!Number.isFinite(e)||!Number.isFinite(t)||t<=e)return[];const o=n=>{let l=0,h=u.length;for(;l<h;){const c=l+h>>>1;u[c]<=n?l=c+1:h=c}return l},i=o(e),r=o(t),a=Math.min(r-i,Math.max(0,Math.floor(s)));return Array.from({length:a},(n,l)=>u[i+Math.floor(l*(r-i)/a)])}const fe=Math.PI*2,ft=`
124
+ varying vec3 vColor; varying float vAlpha;
125
+ void main() {
126
+ float d = length(gl_PointCoord - .5) * 2.;
127
+ if (d > 1. || vAlpha < .001) discard;
128
+ gl_FragColor = vec4(vColor, (exp(-d*d*5.) + .25*exp(-d*d*35.)) * (1.-smoothstep(.7,1.,d)) * vAlpha);
129
+ }`,$=(u,e,t=ft)=>new L({uniforms:u,vertexShader:e,fragmentShader:t,transparent:!0,depthWrite:!1,blending:H}),z=(u,e)=>new I(u,e);class vt{group=new X;graph={nodes:[],edges:[],lanes:[],start:0,end:0};preferences={...Re};selected;indices=new Map;kinds=new Map;dust;energy;energyIndices=[];energyReveal;windBand;orbit;sparkGeometry;burstCursor=0;packets=[];messageXs=[];packetGeometry;time=0;wind=0;lastScrub=-1/0;pointerActive=!1;pointerAt=-1/0;visibleBirthsUntil=0;uniforms={uTime:{value:0},uPixelScale:{value:1e3},uPixelRatio:{value:1},uHeadX:{value:150},uViewport:{value:new O(1e3,600)},uPointer:{value:new O(3,3)},uPointerVelocity:{value:new O},uPointerStrength:{value:0},uHover:{value:new v},uHoverStrength:{value:0},uWind:{value:0},uWindX:{value:0},uTimeAxis:{value:new O(1,0)},uFlow:{value:0},uSpeed:{value:.5},uOpacity:{value:1},uSelectedIndex:{value:-1},uSelectedOnly:{value:0},uFocus:{value:0},uOrbitCenter:{value:new v},uOrbitRadius:{value:1},uOrbitColor:{value:new V},uOrbitBorn:{value:0}};configure(e){const t=e.quality!==this.preferences.quality;if(this.preferences={...e},t&&this.graph.nodes.length){const s=this.messageXs;this.setGraph(this.graph),this.messageXs=s}this.uniforms.uSpeed.value=e.trailSpeed/100,this.uniforms.uOpacity.value=e.trailOpacity/100,this.uniforms.uSelectedOnly.value=+(e.trails==="selected"),e.messageDots||(this.packets=[])}setGraph(e){if(this.disposeLayers(),this.graph=e,this.indices=new Map(e.nodes.map((h,c)=>[h.session.id,c])),this.kinds=new Map(e.edges.map(h=>[h.to,h.kind==="fork"?1:2])),this.burstCursor=0,this.visibleBirthsUntil=0,this.wind=0,this.lastScrub=-1/0,this.packets=[],this.messageXs=[],this.energyIndices=[],this.energyReveal=void 0,!e.nodes.length){this.select();return}const t=me[this.preferences.quality],s=new ne;for(const h of e.nodes)s.expandByPoint(new v(...h.position)),s.expandByPoint(new v(...h.startPosition));s.expandByVector(new v(18,18,24));const o=s.getSize(new v),i=s.getCenter(new v),r=[],a=[],n=[];for(let h=0;h<t.dust;h++){const c=e.nodes[Math.floor(P(`dust-lane${h}`)*(e.nodes.length-1))];r.push(s.min.x+P(`dust-x${h}`)*o.x,h%4?c.position[1]+(P(`dust-y${h}`)-.5)*34:s.min.y+P(`dust-y${h}`)*o.y,c.position[2]+(P(`dust-z${h}`)-.5)*65),a.push(P(`dust-seed${h}`)),n.push(...new V(c.color).toArray())}const l=new E;l.setAttribute("position",z(r,3)),l.setAttribute("seed",z(a,1)),l.setAttribute("tint",z(n,3)),this.dust=new U(l,$(this.uniforms,`
130
+ attribute float seed; attribute vec3 tint;
131
+ uniform float uTime,uPixelRatio,uPointerStrength,uHoverStrength,uWind,uWindX;
132
+ uniform vec2 uViewport,uPointer,uPointerVelocity,uTimeAxis; uniform vec3 uHover;
133
+ varying vec3 vColor; varying float vAlpha,vStretch; varying vec2 vAxis;
134
+ void main() {
135
+ vec3 p=position+vec3(sin(uTime*.14+seed*31.)*1.4,cos(uTime*.19+seed*19.)*1.6,sin(uTime*.12+seed*23.)*1.8);
136
+ float gust=exp(-abs(p.x-uWindX)/22.)*abs(uWind);
137
+ p.x+=uWind*gust*14.;
138
+ vec4 mv=modelViewMatrix*vec4(p,1.); vec4 clip=projectionMatrix*mv;
139
+ vec2 screen=clip.xy/max(.001,clip.w);
140
+ vec2 delta=(screen-uPointer)*uViewport*.5;
141
+ float influence=exp(-dot(delta,delta)/9000.)*uPointerStrength;
142
+ vec2 tangent=vec2(-delta.y,delta.x)/max(1.,length(delta));
143
+ clip.xy+=(tangent*influence*10.+uPointerVelocity*influence*26.)*2./uViewport*clip.w;
144
+ vec4 hover=projectionMatrix*modelViewMatrix*vec4(uHover,1.);
145
+ vec2 target=hover.xy/max(.001,hover.w);
146
+ vec2 hd=(screen-target)*uViewport*.5;
147
+ float attraction=exp(-dot(hd,hd)/7000.)*uHoverStrength;
148
+ float angle=uTime*(.5+seed*.5)+seed*62.;
149
+ vec2 orbit=target+vec2(cos(angle),sin(angle))*(17.+seed*22.)*2./uViewport;
150
+ clip.xy=mix(clip.xy,orbit*clip.w,attraction*.72);
151
+ gl_Position=clip;
152
+ vStretch=1.+gust*5.+influence*min(3.,length(uPointerVelocity)*2.);
153
+ vAxis=gust>.01?uTimeAxis:(length(uPointerVelocity)>.001?normalize(uPointerVelocity):vec2(1.,0.));
154
+ gl_PointSize=(1.3+seed*1.7)*uPixelRatio*vStretch;
155
+ vColor=mix(tint,vec3(.75,.91,1.),.4);
156
+ vAlpha=(.14+seed*.22)*(.72+.28*sin(uTime*.7+seed*62.))+gust*.2+attraction*.2;
157
+ }`,`
158
+ varying vec3 vColor; varying float vAlpha,vStretch; varying vec2 vAxis;
159
+ void main() {
160
+ vec2 p=(gl_PointCoord-.5)*2.;
161
+ vec2 q=vec2(dot(p,vAxis),dot(p,vec2(-vAxis.y,vAxis.x))*vStretch);
162
+ float d=length(q); if(d>1.) discard;
163
+ gl_FragColor=vec4(vColor,exp(-d*d*4.)*(1.-smoothstep(.65,1.,d))*vAlpha);
164
+ }`)),this.dust.name="interactive-stardust",this.dust.frustumCulled=!1,this.group.add(this.dust),this.windBand=new j(new he(1,1),$({...this.uniforms,uBandCenter:{value:i},uBandHeight:{value:o.y}},`
165
+ uniform float uWindX,uBandHeight; uniform vec3 uBandCenter; varying vec2 vUv;
166
+ void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(uWindX+position.x*8.,uBandCenter.y+position.y*uBandHeight,uBandCenter.z,1.);}
167
+ `,`
168
+ uniform float uWind; varying vec2 vUv;
169
+ void main(){float a=exp(-abs(vUv.x-.5)*15.)*pow(max(0.,sin(vUv.y*3.14159)),.6)*abs(uWind)*.16;
170
+ gl_FragColor=vec4(.55,.86,1.,a);}
171
+ `)),this.windBand.name="scrub-time-wind",this.windBand.material.side=Z,this.windBand.frustumCulled=!1,this.group.add(this.windBand),this.createEnergy(t.trails),this.createBursts(t.bursts,t.sparks),this.createPackets(),this.createOrbit(),this.select(this.selected&&e.nodes.find(h=>h.session.id===this.selected.session.id))}createEnergy(e){const t=pe(this.graph.nodes.filter(c=>c.position[0]>c.startPosition[0]),e),s=[],o=[],i=[],r=[],a=[],n=[],l=[];for(const c of t)for(let d=0;d<6;d++)s.push(...c.startPosition),o.push(c.position[0]),i.push(c.radius),r.push(P(c.session.id)),a.push(...Y(c).toArray()),n.push(d,0,0),l.push(this.indices.get(c.session.id));const h=new E;for(const[c,d,p]of[["position",n,3],["origin",s,3],["endX",o,1],["radius",i,1],["seed",r,1],["tint",a,3],["nodeIndex",l,1]])h.setAttribute(c,z(d,p));this.energyIndices=l,this.energyReveal=z(new Float32Array(l.length),1),h.setAttribute("reveal",this.energyReveal),this.energy=new U(h,$(this.uniforms,`
172
+ attribute vec3 origin,tint; attribute float endX,radius,seed,reveal,nodeIndex;
173
+ uniform float uTime,uHeadX,uPixelScale,uFlow,uSpeed,uOpacity,uSelectedIndex,uSelectedOnly,uFocus;
174
+ varying vec3 vColor; varying float vAlpha;
175
+ void main(){
176
+ float head=clamp(uHeadX,origin.x,endX),span=max(0.,head-origin.x);
177
+ float t=fract(uTime*(.12+uSpeed*.23)+seed)-position.x*.014;
178
+ float distance=max(0.,t)*span;
179
+ float angle=distance*${ie}+seed*${fe};
180
+ float curl=(${ye}+radius*${be})*smoothstep(0.,${ee.toFixed(1)},distance);
181
+ vec3 p=vec3(origin.x+distance,origin.y+cos(angle)*curl,origin.z+sin(angle)*curl);
182
+ vec4 mv=modelViewMatrix*vec4(p,1.);gl_Position=projectionMatrix*mv;
183
+ float selected=1.-step(.5,abs(nodeIndex-uSelectedIndex));
184
+ float allowed=mix(1.,selected,uSelectedOnly)*mix(1.,mix(.1,1.,selected),uFocus);
185
+ gl_PointSize=clamp((.1+radius*.12)*uPixelScale/max(.1,-mv.z),1.5,5.5)*(1.-position.x*.09);
186
+ vColor=mix(tint,vec3(1.),.42)*(1.35-position.x*.09);
187
+ vAlpha=step(.01,span)*step(0.,t)*smoothstep(0.,.08,t)*smoothstep(0.,.05,1.-t)*exp(-position.x*.55)*reveal*uFlow*uOpacity*allowed;
188
+ }`)),this.energy.name="trail-energy-packets",this.energy.frustumCulled=!1,this.group.add(this.energy)}createBursts(e,t){const s=new E;for(const[i,r]of[["position",3],["origin",3],["tint",3],["born",1],["kind",1]]){const a=new Float32Array(e*t*r);i==="born"&&a.fill(-1e3),s.setAttribute(i,z(a,r).setUsage(D))}for(let i=0;i<e*t;i++){const r=P(`birth-angle${i}`)*fe,a=P(`birth-depth${i}`)*2-1;s.getAttribute("position").setXYZ(i,Math.cos(r)*Math.sqrt(1-a*a),Math.sin(r)*Math.sqrt(1-a*a),a)}this.sparkGeometry=s;const o=new U(s,$(this.uniforms,`
189
+ attribute vec3 origin,tint;attribute float born,kind;
190
+ uniform float uTime,uPixelScale,uHeadX;varying vec3 vColor;varying float vAlpha;
191
+ void main(){
192
+ float age=uTime-born;vec3 direction=position;
193
+ if(age<0. || age>1.2 || origin.x>uHeadX){vAlpha=0.;vColor=tint;gl_PointSize=1.;gl_Position=vec4(2.,2.,2.,1.);return;}
194
+ if(kind>.5 && kind<1.5)direction=vec3(abs(position.x)*.8+.35,sign(position.y)*(.6+abs(position.y)),position.z*.35);
195
+ float distance=(1.-exp(-max(0.,age)*3.))*(2.2+kind*1.7);
196
+ vec3 p=origin+direction*distance;p.y-=max(0.,age)*max(0.,age)*.5;
197
+ vec4 mv=modelViewMatrix*vec4(p,1.);gl_Position=projectionMatrix*mv;
198
+ gl_PointSize=clamp(.15*uPixelScale/max(.1,-mv.z),1.5,5.);
199
+ vColor=mix(tint,vec3(1.),.38)*1.35;
200
+ vAlpha=step(0.,age)*pow(max(0.,1.-age/1.2),2.)*.8;
201
+ }`));o.name="fork-bloom-sparks",o.frustumCulled=!1,this.group.add(o)}births(e,t){if(!this.sparkGeometry||!e.length)return;const s=this.sparkGeometry,o=me[this.preferences.quality],i=pe(e.filter(a=>this.kinds.has(a.session.id)),Math.ceil(o.bursts/2)),r=[...i,...pe(e.filter(a=>!this.kinds.has(a.session.id)),o.bursts-i.length)];for(const a of r){const n=this.burstCursor++%o.bursts,l=this.kinds.get(a.session.id)||0,h=Y(a).lerp(new V(l===1?"#ffc891":"#c3b0ff"),l?.35:0),c=G(a,Math.max(a.startPosition[0],Math.min(this.uniforms.uHeadX.value,a.position[0]))),d=n*o.sparks;for(let p=d;p<d+o.sparks;p++)s.getAttribute("origin").setXYZ(p,...c),s.getAttribute("tint").setXYZ(p,h.r,h.g,h.b),s.getAttribute("born").setX(p,t),s.getAttribute("kind").setX(p,l)}for(const a of["origin","tint","born","kind"])s.getAttribute(a).needsUpdate=!0;this.visibleBirthsUntil=t+1.2}createPackets(){this.packetGeometry=new E,this.packetGeometry.setAttribute("position",z(new Float32Array(192),3).setUsage(D)),this.packetGeometry.setAttribute("alpha",z(new Float32Array(64),1).setUsage(D)),this.packetGeometry.setDrawRange(0,0);const e=new U(this.packetGeometry,$(this.uniforms,`
202
+ attribute float alpha;uniform float uPixelScale;uniform vec3 uOrbitColor;varying vec3 vColor;varying float vAlpha;
203
+ void main(){vec4 mv=modelViewMatrix*vec4(position,1.);gl_Position=projectionMatrix*mv;
204
+ gl_PointSize=clamp(.2*uPixelScale/max(.1,-mv.z),2.,7.);vColor=mix(uOrbitColor,vec3(1.),.6)*1.6;vAlpha=alpha;}
205
+ `));e.name="recorded-message-packets",e.frustumCulled=!1,this.group.add(e)}createOrbit(){this.orbit=new X,this.orbit.name="selection-solar-system";const e=`
206
+ uniform float uTime,uPixelScale,uPixelRatio,uOrbitRadius,uOrbitBorn;
207
+ uniform vec3 uOrbitCenter,uOrbitColor;
208
+ varying vec3 vColor;varying float vAlpha;
209
+ vec2 orbit(float angle,float ring){
210
+ vec2 p=vec2(cos(angle),sin(angle)*mix(.5,.7,ring))*(1.+ring*.26);
211
+ float tilt=mix(.45,-.65,ring)+uTime*.06;
212
+ return mat2(cos(tilt),sin(tilt),-sin(tilt),cos(tilt))*p;
213
+ }
214
+ float orbitSize(vec4 mv){return max(uOrbitRadius,-mv.z/uPixelScale*uPixelRatio*14.);}
215
+ `;for(let i=0;i<2;i++){const r=new j(new Fe(.985,1,96),$(this.uniforms,`${e}
216
+ void main(){
217
+ vec4 mv=modelViewMatrix*vec4(uOrbitCenter,1.);
218
+ float angle=atan(position.y,position.x);
219
+ mv.xy+=orbit(angle,${i.toFixed(1)})*length(position.xy)*orbitSize(mv);
220
+ gl_Position=projectionMatrix*mv;
221
+ vColor=uOrbitColor;vAlpha=.24*smoothstep(0.,.4,uTime-uOrbitBorn);
222
+ }`,"varying vec3 vColor;varying float vAlpha;void main(){gl_FragColor=vec4(vColor,vAlpha);}"));r.material.side=Z,r.frustumCulled=!1,this.orbit.add(r)}const t=new E,s=[];for(let i=0;i<6;i++)for(let r=0;r<5;r++)s.push(i/3*fe,i%2,r);t.setAttribute("position",z(s,3));const o=new U(t,$(this.uniforms,`${e}
223
+ void main(){
224
+ float angle=position.x+uTime*mix(.8,-.6,position.y)-position.z*.07*mix(1.,-1.,position.y);
225
+ vec4 mv=modelViewMatrix*vec4(uOrbitCenter,1.);
226
+ mv.xy+=orbit(angle,position.y)*orbitSize(mv);gl_Position=projectionMatrix*mv;
227
+ gl_PointSize=(3.5-position.z*.45)*uPixelRatio;
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}
230
+ attribute float size; attribute float reveal; varying vec3 vColor; varying float vVisible; uniform float uScale; uniform float uCutoff; uniform float uGlowSize;
231
+ void main() { vColor = color; vVisible = reveal; vNodeEmphasis = nodeEmphasis(); vec4 mv = modelViewMatrix * vec4(position, 1.0);
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;
233
+ void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0) discard;
234
+ float a = pow(max(0., 1.0 - d), 3.1) * .34 * uGlowIntensity * vVisible * vNodeEmphasis; gl_FragColor = vec4(vColor * 1.15, a); }`,vertexColors:!0,transparent:!0,depthWrite:!1,blending:H});const y=new U(p,this.glowMaterial);y.frustumCulled=!1,this.graphGroup.add(y),this.arrivals=ut(e.nodes,this.glowPositions.array,this.nodeReveal,{...this.focusUniforms,...this.cometUniforms,uPixelRatio:this.markerUniforms.uPixelRatio}),this.graphGroup.add(this.arrivals.mesh),this.comets=this.addComets(e.nodes,this.graphGroup),e.lanes.forEach((f,w)=>{const S=Math.min(...f.nodes.map(A=>A.startPosition[0]));w<12&&this.addLabel(f.label,new v(S-4,f.y+8,f.z),f.color)}),this.links=this.addForks(e.edges,this.graphGroup);const M=[],g=[],b=nt(e),m=new V("#314149"),R=b.length>1?b.map(f=>f.x):Array.from({length:9},(f,w)=>B(w/8,e));for(const f of R)this.appendSegments([new v(f,q,-J),new v(f,q,J)],m,M,g);for(const{x:f,label:w}of b)b.length===1&&f!==R[0]&&this.appendSegments([new v(f,q,-J),new v(f,q,J)],m,M,g),this.addLabel(w,new v(f,q,J),"#9ab9b3",!1,!0);this.addLines(M,g,.23),this.setCutoff(this.cutoff),this.selected&&this.select(this.selected),t&&this.reset()}appendSegments(e,t,s,o){for(let i=1;i<e.length;i++)s.push(...e[i-1].toArray(),...e[i].toArray()),o.push(t.r,t.g,t.b,t.r,t.g,t.b)}addComets(e,t){const s=t===this.selectionGroup,o=lt(e,{...this.trailUniforms,...this.cometUniforms,uGraphReveal:this.lineUniforms.uReveal,uContextFocus:s?{value:0}:this.focusUniforms.uFocus},this.nodeIndices,s);return o.group.visible=this.preferences.trails==="all"||s&&this.preferences.trails==="selected",o.update(this.nodeReveal),t.add(o.group),o}drawnRadius(e){const t=this.nodeReveal[this.nodeIndices.get(e.session.id)]??1;return e.radius*this.preferences.nodeScale/100*t}orbCenter(e){const t=B(this.cutoff,this.graph),s=oe(e,t)[0],o=G(e,s),i=this.camera.matrixWorldInverse.elements,r=-(i[2]*o[0]+i[6]*o[1]+i[10]*o[2]+i[14]),a=Math.max(.001,r)*2*Math.tan(k.degToRad(this.camera.fov/2))/(this.height*this.camera.zoom),n=this.selected===e.session.id&&this.preferences.messageDots?Math.max(.06,a*8):.02,l=ke(e,s),h=i[0]*l[0]+i[4]*l[1]+i[8]*l[2],c=i[1]*l[0]+i[5]*l[1]+i[9]*l[2],d=this.headDirection.set(h,c,0);d.lengthSq()<1e-4&&d.set(1,0,0),d.normalize().applyQuaternion(this.camera.quaternion);const p=et(e,t,this.drawnRadius(e),n,d.toArray());return p[1]+=o[1]-e.position[1],p[2]+=o[2]-e.position[2],p}buildPlaybackPath(){if(this.playbackPath=void 0,this.playbackRadii=[],!this.graph.nodes.length)return;const e=this.graph.nodes.flatMap(i=>[new v(...i.position),new v(...i.startPosition)]),t=new ne().setFromPoints(e).getBoundingSphere(new de),s=[],o=Math.max(1,B(1,this.graph)-B(0,this.graph));for(let i=0;i<=100;i++){const r=i/100,a=B(r,this.graph),n=new v,l=new ne;let h=0;for(const y of this.graph.nodes){if(y.startPosition[0]>a)continue;const M=new v(...G(y,oe(y,a)[0])),g=(M.x-a)*300/o,b=Math.exp(-(((g+6)/24)**2));n.addScaledVector(M,b),h+=b,g>=-38&&g<=12&&l.expandByPoint(M)}h>0?n.divideScalar(h):n.copy(t.center);const c=l.isEmpty()?new de(n,0):l.getBoundingSphere(new de),d=Math.max(50,c.radius+c.center.distanceTo(n)),p=k.smoothstep(r,.86,1);n.lerp(t.center,p),s.push(n),this.playbackRadii.push(k.lerp(d,t.radius+20,p))}this.playbackPath=new Ye(s)}setPlaying(e){this.playing!==e&&(this.playing=e,this.playbackOutro=null,this.playbackOrbit=void 0,this.playbackYawSpeed=0,e||(this.playbackPath=void 0,this.playbackRadii=[],this.camera.clearViewOffset()),e&&(this.focusedSession=null,this.camera.clearViewOffset()),e&&this.cutoff===0&&(this.nodeBorn.fill(NaN),this.nodeReveal.fill(0),this.revealsActive=!0),e&&this.motion&&(this.playbackPath||this.buildPlaybackPath(),this.targetPosition=void 0,this.targetLook=void 0,this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target)),this.framePlayback()),this.dirty=!0)}setPlaybackOutro(e){const t=e===null?null:k.clamp(e,0,1);t!==this.playbackOutro&&(t!==null&&this.playbackOutro===null&&(this.playbackSphere.setFromVector3(this.camera.position.clone().sub(this.controls.target)),this.playbackOrbit={theta:this.playbackSphere.theta,phi:this.playbackSphere.phi,radius:this.playbackSphere.radius,focus:this.controls.target.clone(),incomingTurnsPerSecond:this.playbackYawSpeed/(2*Math.PI)}),t===null&&(this.playbackOrbit=void 0),this.playbackOutro=t,this.dirty=!0)}animatePlaybackCamera(e){if(!this.playing||!this.motion||!this.playbackPath)return!1;const t=k.degToRad(this.camera.fov)/2,s=Math.min(t,Math.atan(Math.tan(t)*this.camera.aspect));if(this.playbackOutro!==null&&this.playbackOrbit){const p=this.playbackOrbit,y=this.playbackOutro;return this.playbackSphere.theta=p.theta+tt(y,p.incomingTurnsPerSecond)*Math.PI*2,this.playbackSphere.phi=p.phi,this.playbackSphere.radius=p.radius,this.controls.target.copy(p.focus),this.playbackFocus.copy(this.controls.target),this.camera.position.copy(this.controls.target).add(this.playbackOffset.setFromSpherical(this.playbackSphere)),!0}this.playbackPath.getPoint(this.cutoff,this.playbackFocus);const o=this.cutoff*(this.playbackRadii.length-1),i=Math.floor(o),r=Math.min(i+1,this.playbackRadii.length-1),a=k.lerp(this.playbackRadii[i],this.playbackRadii[r],o-i),n=k.clamp(a/Math.sin(s)*.84,110,1100),l=-.3+this.cutoff*Math.PI,h=.16+Math.sin(this.cutoff*Math.PI)*.12,d=Math.atan2(Math.sin(l-this.playbackSphere.theta),Math.cos(l-this.playbackSphere.theta))*-Math.expm1(-3*e);return this.playbackSphere.theta+=d,e>0&&(this.playbackYawSpeed=d/e),this.playbackSphere.phi=k.damp(this.playbackSphere.phi,Math.PI/2-h,1.5,e),this.playbackSphere.radius=k.damp(this.playbackSphere.radius,n,1.25,e),this.controls.target.lerp(this.playbackFocus,1-Math.exp(-2.1*e)),this.camera.position.copy(this.controls.target).add(this.playbackOffset.setFromSpherical(this.playbackSphere)),!0}addLines(e,t,s,o=this.graphGroup,i="grid",r){if(!e.length)return;const a=new E;a.setAttribute("position",new I(e,3)),a.setAttribute("color",new I(t,3)),r&&a.setAttribute("timelineTime",new I(r,1));const n=new Ze({vertexColors:!0,transparent:!0,opacity:s,depthWrite:!1,blending:H,clippingPlanes:i==="grid"?[this.clipPlane]:[]});o!==this.filesGroup&&(n.onBeforeCompile=h=>{h.uniforms.uTimelineCutoff=this.lineUniforms.uCutoff,h.uniforms.uGraphReveal=this.lineUniforms.uReveal,h.uniforms.uContextFocus=o===this.graphGroup?this.focusUniforms.uFocus:{value:0},h.vertexShader=`${r?"attribute float timelineTime;":""} varying float vTimelineX;
235
+ ${h.vertexShader}`.replace("#include <begin_vertex>",`#include <begin_vertex>
236
+ vTimelineX = ${r?"timelineTime":"position.x"};`),h.fragmentShader=`varying float vTimelineX; uniform float uTimelineCutoff; uniform float uGraphReveal; uniform float uContextFocus;
237
+ ${h.fragmentShader}`.replace("#include <color_fragment>",`#include <color_fragment>
238
+ diffuseColor.a *= ${r?"step(vTimelineX, uTimelineCutoff)":"smoothstep(0.0, .6, uTimelineCutoff - vTimelineX)"} * uGraphReveal * mix(1.0, .16, uContextFocus);`)}),n.customProgramCacheKey=()=>i;const l=new we(a,n);l.userData.kind=i,l.visible=i!=="relationship"||this.preferences.relationships,o.add(l)}edgeCurve(e,t){const s=new v(...e),o=new v(...t),i=Math.max(Math.abs(t[0]-e[0])*.55,Math.min(14,s.distanceTo(o)*.45),2);return new Me(s,new v(e[0]+i,e[1],e[2]),new v(t[0]-i,t[1],t[2]),o)}branchCurve(e,t,s){const[o,i]=it(e,t),r=G(e,o[0]),a=G(t,i[0]);if(s==="child"){const n=new v(...r),l=new v(...a);return new Me(n,n.clone().lerp(l,1/3),n.clone().lerp(l,2/3),l)}return this.edgeCurve(r,a)}addForks(e,t,s){if(!e.length)return;const o=t===this.selectionGroup,i=new ct(e.map((r,a)=>{const n=this.nodeByID.get(r.from),l=this.nodeByID.get(r.to);return{curve:this.branchCurve(n,l,r.kind),child:this.nodeIndices.get(r.to),delay:(s?.[a]||0)*.12,color:new V(r.kind==="fork"?"#edbc8d":"#bda6ef")}}),{uPixelScale:this.cometUniforms.uPixelScale,uPixelRatio:this.markerUniforms.uPixelRatio,uContextFocus:o?{value:0}:this.focusUniforms.uFocus},o);return i.group.visible=this.preferences.relationships,i.update(this.nodeReveal,o&&this.motion?0:1/0),t.add(i.group),i}addLabel(e,t,s,o=!1,i=!1){const r=document.createElement("div");r.className=o?"scene-label selected-label":i?"scene-label month-label":"scene-label",r.textContent=e,r.style.setProperty("--label-color",s),this.labelLayer.append(r);const a={element:r,point:t,priority:o,month:i};o?this.labels.unshift(a):this.labels.push(a)}select(e){this.pickingDirty=!0,this.revealsActive=!0,this.dirty=!0,this.selected!==e&&(this.selectedEvent=null,this.focusedEvent=void 0),this.selected=e,this.selectionBorn=this.time,this.focusUniforms.uFamilyTime.value=this.preferences.relationships?this.motion?0:1e6:-1e6,this.familyDepth&&(this.familyDepth.array.fill(-1),this.familyDepth.needsUpdate=!0),this.familyGlowDepth&&(this.familyGlowDepth.needsUpdate=!0),this.focusUniforms.uSelected.value=e?this.nodeIndices.get(e)??-1:-1,W(this.selectionGroup),this.selectedLinks=void 0,this.selectedComets=void 0,W(this.filesGroup),this.eventMarkers=[],this.clearEventIcons(),this.fileMesh=void 0,this.fileOffsets=[],this.labels=this.labels.filter(i=>(i.priority&&i.element.remove(),!i.priority));const t=e?this.nodeByID.get(e):void 0;if(this.particles.select(t),!t)return;const s=dt(this.graph,t.session.id);for(const[i,r]of s.depths)this.familyDepth?.setX(this.nodeIndices.get(i),r);const o=new j(new Fe(t.radius*1.45,t.radius*1.55,96),new ve({color:"#e1fff4",side:Z,transparent:!0,opacity:.65,depthTest:!1}));o.position.fromArray(this.orbCenter(t)),o.name="selection-ring",this.selectionGroup.add(o),this.selectedComets=this.addComets([t],this.selectionGroup),this.selectedLinks=this.addForks(s.edges.map(i=>i.edge),this.selectionGroup,s.edges.map(i=>i.depth)),this.addLabel(t.session.title.slice(0,52),new v(...t.position).add(new v(0,6,0)),"#e6f3ef",!0),this.setCutoff(this.cutoff)}setEvents(e,t=!1){this.particles.events(e),this.pickingDirty=!0;const s=this.selectionGroup.getObjectByName("event-markers");s&&(W(s),s.removeFromParent()),this.eventMarkers=[],this.clearEventIcons(),this.dirty=!0;const o=this.selected?this.nodeByID.get(this.selected):void 0;if(!o)return;const i=[],r=e.filter(g=>le(g)||g.kind==="commit");this.focusedEvent&&le(this.focusedEvent)&&!r.some(g=>g.id===this.focusedEvent.id)&&r.push(this.focusedEvent);for(const g of r){if(g.time===null)continue;const b=te(g.time,this.graph);if(!Number.isFinite(b)||b<o.startPosition[0]||b>o.position[0])continue;const m=new v(...G(o,b));this.eventMarkers.push({item:g,position:m}),i.push(...m.toArray())}if(!i.length)return;const a=new E;a.setAttribute("position",new I(i,3)),a.setAttribute("markerIndex",new I(this.eventMarkers.map((g,b)=>b),1)),a.setAttribute("isCommit",new I(this.eventMarkers.map(g=>+(g.item.kind==="commit")),1)),this.markerUniforms.uPixelRatio.value=this.renderer.getPixelRatio(),this.markerUniforms.uHovered.value=-1,this.selectEvent(this.selectedEvent);const n={uCutoff:this.lineUniforms.uCutoff,uTint:{value:new V(o.color)},...this.markerUniforms},l=`uniform float uPixelRatio; uniform float uPointScale; uniform float uSelected; uniform float uHovered; attribute float markerIndex; attribute float isCommit; varying float vCommit; varying float vTimeX; varying float vActive;
239
+ void main() { vCommit = isCommit; vTimeX = position.x; vActive = float(abs(markerIndex-uSelected)<.1 || abs(markerIndex-uHovered)<.1); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); gl_PointSize = mix(7.5,12.0,max(vActive,vCommit*.5)) * uPixelRatio * uPointScale; }`,h=new L({uniforms:{...n,uPointScale:{value:1}},transparent:!0,depthWrite:!1,depthTest:!1,vertexShader:l,fragmentShader:`uniform float uCutoff; uniform vec3 uTint; varying float vTimeX; varying float vActive; varying float vCommit;
240
+ void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0 || vTimeX > uCutoff) discard;
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
+ void main() { float d = length(gl_PointCoord - .5) * 2.0; if (d > 1.0 || vTimeX > uCutoff) discard;
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;
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
+ vec3 offset = (position-uOrigin)*p; float a = uMotion > .5 ? sin(uTime*.22)*.035 : 0.0;
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};